[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Condor-users] linking problems condor 7.0.1



SOLVED:

In the Makefile, change

CC = ccache gcc
else
CC = gcc

with

CC = condor_compile ccache gcc
else
CC = condor_compile gcc

And then

make -f Makefile_condor binarywewanttousewithcondor

That's it

Pau

2008/7/5, Pau <vim.unix@xxxxxxxxxxxxxx>:
> Hi,
>
>  This is
>
>  $ condor -v
>  $CondorVersion: 7.0.1 Feb 26 2008 BuildID: 76180 $
>  $CondorPlatform: X86_64-LINUX_RHEL3 $
>
>  $ cat /etc/issue
>  Debian Etch (4.0) \s, kernel \r
>  \l @ \n (\m)
>
>  $ uname -a
>  Linux morgane.aei.mpg.de 2.6.24.2-hexe-smp #1 SMP Fri Feb 15 16:27:39
>  CET 2008 x86_64 x86_64 x86_64 GNU/Linux
>
>  I am unsuccessfully trying to link an object file to condor:
>
>  ----------------------------------------------------------------------------------
>  $ gcc-3.4 -Wall -O3 -c scatter_binsingle.c
>
>  $ condor_compile gcc scatter_binsingle.o -o scatter_binsingle
>  LINKING FOR CONDOR : /usr/bin/ld -L/usr/lib/condor -Bstatic
>  --eh-frame-hdr -m elf_x86_64 -dynamic-linker
>  /lib64/ld-linux-x86-64.so.2 -o scatter_binsingle /usr/lib/condor/condor_rt0.o
>  /usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64/crti.o
>  /usr/lib/gcc/x86_64-linux-gnu/4.1.2/crtbeginT.o -L/usr/lib/condor
>  -L/usr/lib/gcc/x86_64-linux-gnu/4.1.2 -L/usr/lib/gcc/x86_64-linux-gnu/4.1.2
>  -L/usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64
>  -L/lib/../lib64 -L/usr/lib/../lib64 scatter_binsingle.o
>  /usr/lib/condor/libcondorsyscall.a /usr/lib/condor/libcondor_z.a
>  /usr/lib/condor/libcomp_libstdc++.a
>  /usr/lib/condor/libcomp_libgcc.a /usr/lib/condor/libcomp_libgcc_eh.a
>  --as-needed --no-as-needed -lcondor_c -lcondor_nss_files
>  -lcondor_nss_dns -lcondor_resolv -lcondor_c -lcondor_nss_files
>  -lcondor_nss_dns -lcondor_resolv -lcondor_c
>  /usr/lib/condor/libcomp_libgcc.a /usr/lib/condor/libcomp_libgcc_eh.a
>  --as-needed --no-as-needed
>  /usr/lib/gcc/x86_64-linux-gnu/4.1.2/crtend.o
>  /usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64/crtn.o
>  /usr/lib/condor/libcondorsyscall.a(condor_file_agent.o): In function
>  `CondorFileAgent::open(char const*, int, int)':
>  /home/condor/execute/dir_17236/userdir/src/condor_ckpt/condor_file_agent.C:106:
>  warning: the use of `tmpnam' is dangerous,
>  better use `mkstemp'
>  /usr/lib/condor/libcondorsyscall.a(switches.o): In function `__gets_chk':
>  /home/condor/execute/dir_17236/userdir/src/condor_syscall_lib/switches.remap-LINUX.h:460:
>  warning: the `gets' function is
>  dangerous and should not be used.
>  scatter_binsingle.o: In function `calc_units':
>  scatter_binsingle.c:(.text+0x90): undefined reference to `fb_sqr'
>  scatter_binsingle.c:(.text+0xab): undefined reference to `fb_sqr'
>  scatter_binsingle.c:(.text+0xc7): undefined reference to `sqrt'
>  scatter_binsingle.o: In function `main':
>  scatter_binsingle.c:(.text+0x13d): undefined reference to `gsl_rng_mt19937'
>  scatter_binsingle.c:(.text+0x143): undefined reference to `fb_debug'
>  scatter_binsingle.c:(.text+0x228): undefined reference to `fb_malloc_hier'
>  scatter_binsingle.c:(.text+0x22d): undefined reference to `gsl_rng_env_setup'
>  scatter_binsingle.c:(.text+0x235): undefined reference to `gsl_rng_alloc'
>  scatter_binsingle.c:(.text+0x245): undefined reference to `gsl_rng_set'
>  scatter_binsingle.c:(.text+0x2a5): undefined reference to `fb_sqr'
>  scatter_binsingle.c:(.text+0x2d0): undefined reference to `fb_sqr'
>  scatter_binsingle.c:(.text+0x2fb): undefined reference to `fb_sqr'
>  scatter_binsingle.c:(.text+0x332): undefined reference to `fb_init_hier'
>  scatter_binsingle.c:(.text+0x614): undefined reference to `fb_sqr'
>  scatter_binsingle.c:(.text+0x630): undefined reference to `fb_sqr'
>  scatter_binsingle.c:(.text+0x691): undefined reference to `fb_normalize'
>  scatter_binsingle.c:(.text+0x699): undefined reference to `gsl_rng_uniform'
>  scatter_binsingle.c:(.text+0x73e): undefined reference to `pow'
>  scatter_binsingle.c:(.text+0x798): undefined reference to `fb_init_scattering'
>  scatter_binsingle.c:(.text+0x7bb): undefined reference to `fb_randorient'
>  scatter_binsingle.c:(.text+0x7e4): undefined reference to `fb_downsync'
>  scatter_binsingle.c:(.text+0x80d): undefined reference to `fb_upsync'
>  scatter_binsingle.c:(.text+0x892): undefined reference to `fewbody'
>  scatter_binsingle.c:(.text+0x8ec): undefined reference to `fb_sprint_hier_hr'
>  scatter_binsingle.c:(.text+0x949): undefined reference to `fb_sprint_hier'
>  scatter_binsingle.c:(.text+0xa10): undefined reference to `fb_sqr'
>  scatter_binsingle.c:(.text+0xa79): undefined reference to `fb_sqr'
>  scatter_binsingle.c:(.text+0xaa1): undefined reference to `fb_sqr'
>  scatter_binsingle.c:(.text+0xad2): undefined reference to `fb_sqr'
>  scatter_binsingle.c:(.text+0xb0f): undefined reference to `gsl_rng_free'
>  scatter_binsingle.c:(.text+0xb61): undefined reference to `fb_free_hier'
>  scatter_binsingle.c:(.text+0xbbb): undefined reference to `fb_n_hier'
>  scatter_binsingle.c:(.text+0xbe7): undefined reference to `fb_mod'
>  scatter_binsingle.c:(.text+0xc19): undefined reference to `fb_mod'
>  scatter_binsingle.c:(.text+0xecf): undefined reference to `sqrt'
>  scatter_binsingle.c:(.text+0xedd): undefined reference to `sqrt'
>  scatter_binsingle.c:(.text+0xeeb): undefined reference to `sqrt'
>  collect2: ld returned 1 exit status
>  ----------------------------------------------------------------------------------
>
>  It seems that it doesn't find the gsl?
>
>  The reason for using gcc-3.4 is because I am trying different things
>  because I have seen that there were problems in older versions of condor; e.g.
>
>  https://lists.cs.wisc.edu/archive/condor-users/2007-June/msg00087.shtml
>
>  but using gcc-3.3 or gcc-4.1 yields the same result
>
>  Here I "force" gcc to be gcc-3.4:
>
>  ------------------------------------------------------------------------------------
>  $ alias gcc='gcc-3.4'
>
>  $ gcc -v
>  Reading specs from /usr/lib/gcc/x86_64-linux-gnu/3.4.6/specs
>  Configured with: ../src/configure -v
>  --enable-languages=c,c++,f77,pascal --prefix=/usr
>  --libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4
>  --enable-shared --with-system-zlib --enable-nls
>  --without-included-gettext --program-suffix=-3.4 --enable-__cxa_atexit
>  --enable-clocale=gnu --enable-libstdcxx-debug x86_64-linux-gnu
>  Thread model: posix
>  gcc version 3.4.6 (Debian 3.4.6-5)
>
>  $ gcc -Wall -O3 -c scatter_binsingle.c
>
>  $ condor_compile gcc scatter_binsingle.o -o scatter_binsingle
>  LINKING FOR CONDOR : /usr/bin/ld -L/usr/lib/condor -Bstatic
>  --eh-frame-hdr -m elf_x86_64 -dynamic-linker
>  /lib64/ld-linux-x86-64.so.2 -o scatter_binsingle
>  /usr/lib/condor/condor_rt0.o
>  /usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64/crti.o
>  /usr/lib/gcc/x86_64-linux-gnu/4.1.2/crtbeginT.o -L/usr/lib/condor
>  -L/usr/lib/gcc/x86_64-linux-gnu/4.1.2
>  -L/usr/lib/gcc/x86_64-linux-gnu/4.1.2
>  -L/usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64
>  -L/lib/../lib64 -L/usr/lib/../lib64 scatter_binsingle.o
>  /usr/lib/condor/libcondorsyscall.a /usr/lib/condor/libcondor_z.a
>  /usr/lib/condor/libcomp_libstdc++.a /usr/lib/condor/libcomp_libgcc.a
>  /usr/lib/condor/libcomp_libgcc_eh.a --as-needed --no-as-needed
>  -lcondor_c -lcondor_nss_files -lcondor_nss_dns -lcondor_resolv
>  -lcondor_c -lcondor_nss_files -lcondor_nss_dns -lcondor_resolv
>  -lcondor_c /usr/lib/condor/libcomp_libgcc.a
>  /usr/lib/condor/libcomp_libgcc_eh.a --as-needed --no-as-needed
>  /usr/lib/gcc/x86_64-linux-gnu/4.1.2/crtend.o
>  /usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64/crtn.o
>  /usr/lib/condor/libcondorsyscall.a(condor_file_agent.o): In function
>  `CondorFileAgent::open(char const*, int, int)':
>  /home/condor/execute/dir_17236/userdir/src/condor_ckpt/condor_file_agent.C:106:
>  warning: the use of `tmpnam' is dangerous, better use `mkstemp'
>  /usr/lib/condor/libcondorsyscall.a(switches.o): In function `__gets_chk':
>  /home/condor/execute/dir_17236/userdir/src/condor_syscall_lib/switches.remap-LINUX.h:460:
>  warning: the `gets' function is dangerous and should not be used.
>  scatter_binsingle.o: In function `calc_units':
>  scatter_binsingle.c:(.text+0x90): undefined reference to `fb_sqr'
>  scatter_binsingle.c:(.text+0xab): undefined reference to `fb_sqr'
>  scatter_binsingle.c:(.text+0xc7): undefined reference to `sqrt'
>  scatter_binsingle.o: In function `main':
>  scatter_binsingle.c:(.text+0x13d): undefined reference to `gsl_rng_mt19937'
>  scatter_binsingle.c:(.text+0x143): undefined reference to `fb_debug'
>  scatter_binsingle.c:(.text+0x228): undefined reference to `fb_malloc_hier'
>  scatter_binsingle.c:(.text+0x22d): undefined reference to `gsl_rng_env_setup'
>  scatter_binsingle.c:(.text+0x235): undefined reference to `gsl_rng_alloc'
>  scatter_binsingle.c:(.text+0x245): undefined reference to `gsl_rng_set'
>  scatter_binsingle.c:(.text+0x2a5): undefined reference to `fb_sqr'
>  scatter_binsingle.c:(.text+0x2d0): undefined reference to `fb_sqr'
>  scatter_binsingle.c:(.text+0x2fb): undefined reference to `fb_sqr'
>  scatter_binsingle.c:(.text+0x332): undefined reference to `fb_init_hier'
>  scatter_binsingle.c:(.text+0x614): undefined reference to `fb_sqr'
>  scatter_binsingle.c:(.text+0x630): undefined reference to `fb_sqr'
>  scatter_binsingle.c:(.text+0x691): undefined reference to `fb_normalize'
>  scatter_binsingle.c:(.text+0x699): undefined reference to `gsl_rng_uniform'
>  scatter_binsingle.c:(.text+0x73e): undefined reference to `pow'
>  scatter_binsingle.c:(.text+0x798): undefined reference to `fb_init_scattering'
>  scatter_binsingle.c:(.text+0x7bb): undefined reference to `fb_randorient'
>  scatter_binsingle.c:(.text+0x7e4): undefined reference to `fb_downsync'
>  scatter_binsingle.c:(.text+0x80d): undefined reference to `fb_upsync'
>  scatter_binsingle.c:(.text+0x892): undefined reference to `fewbody'
>  scatter_binsingle.c:(.text+0x8ec): undefined reference to `fb_sprint_hier_hr'
>  scatter_binsingle.c:(.text+0x949): undefined reference to `fb_sprint_hier'
>  scatter_binsingle.c:(.text+0xa10): undefined reference to `fb_sqr'
>  scatter_binsingle.c:(.text+0xa79): undefined reference to `fb_sqr'
>  scatter_binsingle.c:(.text+0xaa1): undefined reference to `fb_sqr'
>  scatter_binsingle.c:(.text+0xad2): undefined reference to `fb_sqr'
>  scatter_binsingle.c:(.text+0xb0f): undefined reference to `gsl_rng_free'
>  scatter_binsingle.c:(.text+0xb61): undefined reference to `fb_free_hier'
>  scatter_binsingle.c:(.text+0xbbb): undefined reference to `fb_n_hier'
>  scatter_binsingle.c:(.text+0xbe7): undefined reference to `fb_mod'
>  scatter_binsingle.c:(.text+0xc19): undefined reference to `fb_mod'
>  scatter_binsingle.c:(.text+0xecf): undefined reference to `sqrt'
>  scatter_binsingle.c:(.text+0xedd): undefined reference to `sqrt'
>  scatter_binsingle.c:(.text+0xeeb): undefined reference to `sqrt'
>  collect2: ld returned 1 exit status
>  ----------------------------------------------------------------------------------------
>
>  Just to be sure:
>
>  ------------------------------------------------------------------------------------------
>  $ cat scatter_binsingle.c
>
>  /* -*- linux-c -*- */
>  /* exchange_binsingle.c
>
>    Copyright (C) 2002-2004 John M. Fregeau
>
>    This program is free software; you can redistribute it and/or modify
>    it under the terms of the GNU General Public License as published by
>    the Free Software Foundation; either version 2 of the License, or
>    (at your option) any later version.
>
>    This program is distributed in the hope that it will be useful,
>    but WITHOUT ANY WARRANTY; without even the implied warranty of
>    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>    GNU General Public License for more details.
>
>    You should have received a copy of the GNU General Public License
>    along with this program; if not, write to the Free Software
>    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
>  */
>
>  #include <stdio.h>
>  #include <stddef.h>
>  #include <stdlib.h>
>  #include <string.h>
>  #include <math.h>
>  #include <time.h>
>  #include <getopt.h>
>  #include <gsl/gsl_rng.h>
>  #include "fewbody.h"
>
>  /* calculate the units used; here the unit of velocity is the critical
>  velocity, the unit
>    of length is the binary's semimajor axis, G=1, and the other units
>  are derived */
>  int calc_units(fb_obj_t *obj[2], fb_units_t *units)
>  {
>         units->v = sqrt(FB_CONST_G*(obj[0]->m + obj[1]->m)/(obj[0]->m * obj[1]->m) * \
>                         (obj[1]->obj[0]->m * obj[1]->obj[1]->m / obj[1]->a));
>         units->l = obj[1]->a;
>         units->t = units->l / units->v;
>         units->m = units->l * fb_sqr(units->v) / FB_CONST_G;
>         units->E = units->m * fb_sqr(units->v);
>
>         return(0);
>  }
>
>  /* the main attraction */
>  int main(int argc, char *argv[])
>  {
>         int i, j, expt=-1, ngood=0, nbad=0, ncoll=0, bid, sid;
>         unsigned long int seed;
>         double m0, m10, m11, r0, r10, r11, a1, e1;
>         double rtid, vinf, b, m1, t;
>         double bmax;
>         FILE *ofp;
>         /* these are fewbody data types */
>         fb_hier_t hier;
>         fb_input_t input;
>         fb_ret_t retval;
>         fb_units_t units;
>         char string1[1024], string2[1024];
>         /* you need the random number generator for randomizing the binary's
>  phase and orientation */
>         gsl_rng *rng;
>         const gsl_rng_type *rng_type=gsl_rng_mt19937;
>
>         /* set parameters */
>         input.ks = 0; /* KS regularization flag; it must be off to perform
>  physical collisions properly */
>         input.tstop = 1.0e9; /* maximum stopping time */
>         input.Dflag = 0; /* print dynamical data to stdout? */
>         input.dt = 1.0; /* approximate output interval */
>         input.tcpustop = 600.0; /* give up after this many seconds of cpu time */
>         input.absacc = 1.0e-9; /* integrator's absolute accuracy */
>         input.relacc = 1.0e-9; /* integrator's relative accuracy */
>         input.ncount = 500; /* number of integration steps between
>  classification hierarchies */
>         input.tidaltol = 1.0e-5; /* tidal tolerance: this is what most
>  affects energy conservation */
>         /* DEBUG: set speed tolerance here */
>  //      input.speedtol = 5.0e-02;
>         input.speedtol = 1.0e+10;
>         /* DEBUG */
>         input.fexp = 3.0; /* expansion factor of merger products; 3 is a good
>  value for main sequence stars */
>         /* DEBUG: set PN terms here */
>         input.PN1 = 0;
>         input.PN2 = 0;
>         input.PN25 = 0;
>         input.PN3 = 0;
>         input.PN35 = 0;
>         /* DEBUG */
>         input.firstlogentry[0] = '\0'; /* you can store log info in the
>  output stream */
>         seed = 92220UL; /* RNG seed */
>         fb_debug = 0; /* global variable (the only one) controlling debug
>  information */
>
>         /* malloc hier */
>         hier.nstarinit = 3;
>         fb_malloc_hier(&hier);
>
>         /* initialize GSL rng */
>         gsl_rng_env_setup();
>         rng = gsl_rng_alloc(rng_type);
>         gsl_rng_set(rng, seed);
>
>         /* open output file and write header */
>         /* DEBUG: set file name here */
>         ofp = fopen("scatter_params.dat", "w");
>         /* DEBUG */
>         fprintf(ofp, "#1:v_bin[km/s] #2:v_single[km/s] #3:a[AU] #4:e
>  #5:m1[MSUN] #6:m2[MSUN] #7:x1[cm] #8:y1[cm] #9:z1[cm] #10:vx1[km/s]
>  #11:vy1[km/s] #12:vz1[km/s] #13:x2[cm] #14:y2[cm] #15:z2[cm]
>  #16:vx2[km/s] #17:vy2[km/s] #18:vz2[km/s]\n");
>
>         /* loop through experiments */
>         for (i=0; i<2000000; i++) {
>                 expt++;
>
>                 /* DEBUG: set system parameters here (in CGS) */
>                 m0 = 10.0 * FB_CONST_MSUN;
>                 m10 = 10.0 * FB_CONST_MSUN;
>                 m11 = 10.0 * FB_CONST_MSUN;
>                 r0 = FB_REFF_BH * FB_CONST_G * m0 / fb_sqr(FB_CONST_C);
>                 r10 = FB_REFF_BH * FB_CONST_G * m10 / fb_sqr(FB_CONST_C);
>                 r11 = FB_REFF_BH * FB_CONST_G * m11 / fb_sqr(FB_CONST_C);
>                 a1 = 100.0 * FB_CONST_AU;
>                 e1 = 0.0;
>                 /* DEBUG */
>
>                 /* flatten hier */
>                 t = 0.0;
>                 hier.nstar = 3;
>                 fb_init_hier(&hier);
>
>                 /* create binary */
>                 hier.hier[hier.hi[2]+0].obj[0] = &(hier.hier[hier.hi[1]+1]);
>                 hier.hier[hier.hi[2]+0].obj[1] = &(hier.hier[hier.hi[1]+2]);
>                 hier.hier[hier.hi[2]+0].t = t;
>
>                 /* give the objects some properties */
>                 for (j=0; j<hier.nstar; j++) {
>                         hier.hier[hier.hi[1]+j].ncoll = 1;
>                         hier.hier[hier.hi[1]+j].id[0] = j;
>                         snprintf(hier.hier[hier.hi[1]+j].idstring, FB_MAX_STRING_LENGTH, "%d", j);
>                         hier.hier[hier.hi[1]+j].n = 1;
>                         hier.hier[hier.hi[1]+j].obj[0] = NULL;
>                         hier.hier[hier.hi[1]+j].obj[1] = NULL;
>                         hier.hier[hier.hi[1]+j].Eint = 0.0;
>                         hier.hier[hier.hi[1]+j].Lint[0] = 0.0;
>                         hier.hier[hier.hi[1]+j].Lint[1] = 0.0;
>                         hier.hier[hier.hi[1]+j].Lint[2] = 0.0;
>                 }
>
>                 /* set radii */
>                 hier.hier[hier.hi[1]+0].R = r0;
>                 hier.hier[hier.hi[1]+1].R = r10;
>                 hier.hier[hier.hi[1]+2].R = r11;
>
>                 /* masses */
>                 hier.hier[hier.hi[1]+0].m = m0;
>                 hier.hier[hier.hi[1]+1].m = m10;
>                 hier.hier[hier.hi[1]+2].m = m11;
>
>                 hier.hier[hier.hi[2]+0].m = m10 + m11;
>
>                 /* orbital parameters */
>                 hier.hier[hier.hi[2]+0].a = a1;
>                 hier.hier[hier.hi[2]+0].e = e1;
>
>                 /* make obj's point to the correct nodes in the hier */
>                 hier.obj[0] = &(hier.hier[hier.hi[1]+0]);
>                 hier.obj[1] = &(hier.hier[hier.hi[2]+0]);
>                 hier.obj[2] = NULL;
>
>                 /* get the units and normalize */
>                 calc_units(hier.obj, &units);
>                 fb_normalize(&hier, units);
>
>                 /* DEBUG: set v_infinity and maximum impact parameter here */
>                 /* set v_inf to ~20 km/s, a reasonable value for a BH core */
>                 /* vinf = 20.0e5 / units.v; */
>                 /* set v_inf to something less than 1 to get a resonant encounter */
>                 vinf = 0.2;
>                 /* maximum impact parameter, from Hut & Bahcall (1983) (x2 to make
>  sure we catch everything interesting) */
>                 bmax = 1.0 * (4.0/vinf + 0.6);
>                 /* DEBUG */
>                 /* sample impact parameter uniformly in area */
>                 b = sqrt(gsl_rng_uniform(rng)) * bmax;
>
>                 /* analytically move objects along hyperbolic path */
>                 m0 = hier.obj[0]->m;
>                 m1 = hier.obj[1]->m;
>                 a1 = hier.obj[1]->a;
>                 e1 = hier.obj[1]->e;
>                 /* rtid is the radius at which the binary's tidal perturbation
>  (F_tid,max/F_rel,min) is equal
>                    to the tidal tolerance; we want to start the integration at this radius */
>                 rtid = pow(2.0*(m0+m1)/(m1*input.tidaltol), 1.0/3.0) * a1 * (1.0+e1);
>                 fb_init_scattering(hier.obj, vinf, b, rtid);
>
>                 /* randomly orient binary */
>                 fb_randorient(&(hier.hier[hier.hi[2]+0]), rng);
>                 /* use parent node's properties to set properties of child nodes*/
>                 fb_downsync(&(hier.hier[hier.hi[2]+0]), t);
>                 /* determine parent node's properties from child nodes
>                    (this step is not necessary, and was included only as a test) */
>                 fb_upsync(&(hier.hier[hier.hi[2]+0]), t);
>
>                 /* call fewbody! */
>                 retval = fewbody(input, units, &hier, &t, rng);
>
>                 /* print to screen */
>                 fprintf(stdout, "expt=%d retval=%d tcpu=%g DeltaEfrac=%g
>  DeltaLfrac=%g vinf=%g bmax=%g b=%g %s (%s)\n",
>                         expt, retval.retval, retval.tcpu, retval.DeltaEfrac,
>  retval.DeltaLfrac, vinf, bmax, b,
>                         fb_sprint_hier(hier, string1), fb_sprint_hier_hr(hier, string2));
>
>                 /* print to special data file if we have a useable exchange, i.e.,
>  the return value is 1, so the
>                    calculation finished, and energy and angular momentum are
>  conserved reasonably */
>                 if (retval.retval == 1) {
>                         ngood++;
>                         /* no collisions */
>                         if (hier.nstar == 3) {
>                                 /* exchange or preservation */
>                                 if (hier.nobj == 2) {
>                                         /* test to see which object is the binary */
>                                         if (fb_n_hier(hier.obj[0]) == 2) {
>                                                 bid = 0;
>                                                 sid = 1;
>                                         } else {
>                                                 sid = 0;
>                                                 bid = 1;
>                                         }
>                                         fprintf(ofp, "%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g\n",
>                                                 fb_mod(hier.obj[bid]->v) * units.v / 1.0e5,
>                                                 fb_mod(hier.obj[sid]->v) * units.v / 1.0e5,
>                                                 hier.obj[bid]->a * units.l / FB_CONST_AU,
>                                                 hier.obj[bid]->e,
>                                                 hier.obj[bid]->obj[0]->m * units.m / FB_CONST_MSUN,
>                                                 hier.obj[bid]->obj[1]->m * units.m / FB_CONST_MSUN,
>                                                 (hier.obj[bid]->obj[0]->x[0] - hier.obj[bid]->x[0]) * units.l,
>                                                 (hier.obj[bid]->obj[0]->x[1] - hier.obj[bid]->x[1]) * units.l,
>                                                 (hier.obj[bid]->obj[0]->x[2] - hier.obj[bid]->x[2]) * units.l,
>                                                 (hier.obj[bid]->obj[0]->v[0] - hier.obj[bid]->v[0]) * units.v / 1.0e5,
>                                                 (hier.obj[bid]->obj[0]->v[1] - hier.obj[bid]->v[1]) * units.v / 1.0e5,
>                                                 (hier.obj[bid]->obj[0]->v[2] - hier.obj[bid]->v[2]) * units.v / 1.0e5,
>                                                 (hier.obj[bid]->obj[1]->x[0] - hier.obj[bid]->x[0]) * units.l,
>                                                 (hier.obj[bid]->obj[1]->x[1] - hier.obj[bid]->x[1]) * units.l,
>                                                 (hier.obj[bid]->obj[1]->x[2] - hier.obj[bid]->x[2]) * units.l,
>                                                 (hier.obj[bid]->obj[1]->v[0] - hier.obj[bid]->v[0]) * units.v / 1.0e5,
>                                                 (hier.obj[bid]->obj[1]->v[1] - hier.obj[bid]->v[1]) * units.v / 1.0e5,
>                                                 (hier.obj[bid]->obj[1]->v[2] - hier.obj[bid]->v[2]) * units.v / 1.0e5);
>                                         fflush(ofp);
>                                 }
>                         } else { /* hier.nstar != 3, so there must have been a physical collision */
>                                 ncoll++;
>                         }
>                 } else { /* calculation didn't finish, or energy or ang mom wasn't
>  conserved */
>                         nbad++;
>                 }
>
>                 /* incrementally update cross sections on screen */
>                 fprintf(stdout, "n=%d ngood=%d nbad=%d ncoll=%d\n",
>                         ngood+nbad, ngood, nbad, ncoll);
>                 fprintf(stdout, "sigma_coll=%g+/-%g\n",
>                         fb_sqr(bmax)*((double) ncoll)/((double) ngood) * fb_sqr(vinf),
>                         fb_sqr(bmax)*sqrt((double) ncoll)/((double) ngood) * fb_sqr(vinf));
>         }
>
>         /* free stuff */
>         gsl_rng_free(rng);
>         fb_free_hier(hier);
>
>         /* close output file */
>         fclose(ofp);
>
>         /* done */
>         return(0);
>  }
>  ------------------------------------------------------------------------------------------
>