Skip to content
Snippets Groups Projects
Select Git revision
  • ade7b1dd555ca0334b0b0b7677a7499d2ec67ef1
  • master default protected
  • development_0.9.5/2.2.2_post_merge_david_branch
  • dhendriks/versions/0.9.5/2.2.2_post_merge
  • feature/MC_sampling
  • push_test
  • development_0.9.5/2.2.2
  • fix/new_mac_fix
  • development_0.9.3/2.2.1_pre-merge
  • dhendriks/versions/0.9.3/2.2.1_pre_merge
  • development_0.9.4/2.2.1
  • development_0.9.5/2.2.1
  • development_0.9.3/2.2.1
  • papers/JOSS_release
  • feature/binary_c_ensemble_manager_implementation
  • feature/HPC
  • development_0.9.2/2.2.1
  • development_0.9.2/2.2.0
  • auto_resolution
  • feature/generate_docs_script
  • feature/custom_system_generator_endpoint
  • 0.9.1
  • v2.2.0
  • archive/queue_solution
  • archive/capsules
  • archive/gitlab_pages
  • 0.3.1
  • 0.3
  • archive/population
  • archive/david_branch
  • archive/black_formatting
  • 2.1.6
  • archive/help_function
  • 0.21
  • 0.2
  • archive/restructure_module
  • 2.1.5
  • archive/readthedocs
  • archive/better_makefile
  • archive/src_location
  • 2.1.4
41 results

IMF-0.05.tar.gz

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    CHANGES 112.56 KiB
    V2.1.5
    
    Updates to the meson build to make it more efficient and work on more platforms.
    
    Change how reset_timeout works so it doesn't require LINUX, rather it requires __HAVE_SETITIMER__ (which is checked for by Meson).
    
    The binary_grid (v1) perl module has been completely deprecated in favour of binary_grid2.
    
    Deprecated the BSE time evolution algorithm (you were warned long ago that this would happen!)
    
    Added atoi and atof to the BAN_UNSAFE_FUNCTIONS list, and removed them throughout.
    
    sync latest perl mods, which contain fixes for the buggy perl 5.31.6
    
    14/11/2019 V2.1.4
    
    What a difference a week makes. 2.1.4 brings some (minor) bug fixes, but
    also a new way to build binary_c: we're switching to Meson (mesonbuild.com).
    
    08/11/2019 V2.1.3 
    
    Added parameters to increase the nova timestep when using individual
    novae: otherwise evolution speed is crippled.
    
    Fixed issues where filling the raw_buffer with many Printf statements
    caused a crash.
    
    Removed the miniz code that is no longer used in buffering, and removed
    the option to compress the output in the raw_buffer. While this saves
    a bit of RAM, the overhead is always too large to be worth the effort.
    The internal_buffering_compression option has been removed, and binary_grid2
    updated to match.
    
    Fixed problem where a very low mass, very wide secondary was assumed to be
    a single-star system, had Jorb = 0 set, leading to a merger and mass loss.
    
    Improved the zone radius calculator in DISCS.
    
    Fixed a bug in the macro to detect true/false as a command line argument.
    
    Rewritten individual_novae to use the events framework, and removed its
    dodgy pre-event code that was supposed to do the same thing (kind of).
    
    Updated to latest binary_grid and rob_misc perl modules.
    
    API:
    
    New API call to binary_c_error_buffer so the error_buffer can be
    retrieved.
    
    Updated API call to binary_c_free_memory with a flag that allows one to
    not free the raw_buffer and error_buffer : useful for logging and
    the python interface (note that these have to be freed by the user).
    
    buffered_printf is now binary_c_buffered_printf and is exposed in the API,
    the Printf macro has been updated to point to this. This change allows
    Perl and Python front-ends to construct Printf code.
    
    02/10/2019 V2.1.2
    
        add new "overspin_algorithm" option to handle what happens
        when a star is spinning faster than it can
        
        currently there are two options:
        OVERSPIN_BSE transfers the excess angular momentum back to the orbit,
               so is conservative in that no mass or angular momentum is lost.
        
        OVERSPIN_MASSLOSS uses the rotationally_enhanced_mass_loss formalism
               given below to remove material which reduces the star's spin.
        
        Also removed the ROTATIONALLY_ENHANCED_MASS_LOSS compile define,
        because this functionality is now required always.
    
    
    14/09/2019 V2.1.1
    
    I have removed the "default" pointer from the cmd_line_args,
    because it really wasn't used except by WTTS. It now is called
    wtts_string to make this explicit, and most variables have it
    set to WTTS_USE_DEFAULT, so the default is output automatically.
    
    The variables such as star[x].mass, separation, metallicity, etc.
    which were set directly in cmd_line_args.h are now replaced by
    preferences->xyz variables, which are then copied to the appropriate
    locations. This means there is a more logical setup with the command
    line args only setting preferences options, rather than random other
    parts of the code.
    
    The new function set_defaults() should be used to set the default
    parameters in preferences. The "list_args" now uses these.
    
    Fixed a bug in configure where binary_c_version_macros.h had the wrong
    ifndef ... endif macros, clashing with binary_c_version.h.
    
    Added the patch number as a macro, so version numbers like 2.1.1
    are now valid.
    
    Added the major, minor and patch number macros to version.c
    
    Also synced the latest libmemoize and librinterpolate.
    
    Fixed a memory leak in the discs code, and its interaction with
    libmemoize, which only manifests itself when an existing disc
    is appended. A call to free the memoize data before doing this
    fixes the problem.
    
    Fixed a bug in stellar_structure_Hestar which caused lock-ups, this was
    because of a tiny-timestep loop.
    
    07/09/2019 Final cleanup for V2.1
    
    There were issues with old/new gcc clashes on our slurm cluster: this
    was because binary_grid was using "cc" to build, which was an old gcc 4.8,
    rather than "$CC" which was gcc 9.2. The former had no C99 support, so
    Booleans were mapped to 4-byte ints, while binary_c and libbinary_c were
    built with 1-byte Bool types. This caused problems, but has been fixed. In
    future, just build your Perl (with perlbrew) and binary_c with the same
    compiler. I've added gnu99 to the build options in the hope of preventing
    this from happening again.
    
    Lots of code cleanup as well, e.g. format statements for size_t
    have been fixed (instead of pretending they are long ints).
    
    Added a link to the python interface
    https://gitlab.eps.surrey.ac.uk/ri0005/binary_c-python
    and updated the README, CHANGES, etc.
    
    04/09/2019 More prep for V2.1
    
    Fixed issues with abundance updates and wind yields in nucsyn_update_abundances: this now uses the previous timestep's abundances, where appropriate, which is more correct.
    
    Synced latest librinterpolate, libmemoize.
    
    Many code updates and cleanups, particularly for GCC9 and its suggestions. You can build these in with "./configure gcc_hints" (on the assumption you are using GCC9). Also fixed (most) function macros so they are of the appropriate style (This(X) rather than THIS(X) or this(X)).
    
    16/08/2019 V2.1 prerelease
    
    Rewritten the evolution rejection algorithm to better respect the
    minimum timestep and use this, instead of a count, to stop the
    number of rejections. Seems to work very well.
    
    Added a check to reject the timestep if angular momentum
    changes too much (usually 5%).
    
    Lots of code cleanup, e.g. new types defined, and functions that used, say,
    int where they should have used Stellar_type have been fixed where spotted.
    
    Changed evolution_difflog to use fewer memcpys.
    
    
    
    21/07/2019 Release binary_c V2.1
    
    Update to V2.1 for release.
    
    Implemented a scheme for Karel Temmink to better treat accretion
    from H-rich, He-rich and other donors onto WDs. This means the accretion_rate_novae_upper_limit has been split to three variables, WD_accretion_rate_novae_upper_limit_*_donor where * is hydrogen, helium or other. Ditto for the upper limit (see below). If the limit is >= 0 then the given number is used as the limit. If the limit is -1 or DONOR_RATE_ALGORITHM_CLAEYS2014 then the Claeys et al. 2014 algirithm is used. If the limit is -2 or DONOR_RATE_ALGORITHM_BSE then the BSE (Hurley et al.2014) algorithm is used.  Many thanks to Karel for looking into this in much time-consuming detail!
    
    See the files compact_object_accretion_limits WD_min_accretion_rate.c and WD_max_accretion_rate.c for details, also donor_types.h which is used to split the types according to HYDROGEN_DONOR, HELIUM_DONOR and other types. 
    
    Related to the above changes, renamed accretion_rate_soft_Xray_upper_limit_* to WD_accretion_rate_new_giant_envelope_lower_limit_* (this seems more physical).
    
    Renamed "H02" to "BSE" everywhere. This should reduce the number of acronyms users have to remember and avoid confusion (H02 is the Hurley et al. (2002) paper, BSE refers tot he "Binary Star Evolution" algorithm described in that paper).
    
    
    
    16/07/2019 Update to V2.0pre33
    
    Many changes as binary_c improves. Many of the changes in V2.0pre33 are really big, so please let me know if there are any problems.
    
    Documentation: a new, updated and HTML version of the binary_c documentation is at
    http://personal.ph.surrey.ac.uk/~ri0005/doc/binary_c/binary_c.html
    
    Solver : the time integration now utilises the derivatives in either a forward-Euler (the "old" way), RK2 or RK4 scheme. (There's a predictor-corrector too, but that's still buggy.) Note that if you use a non-forward-Euler scheme your evolution algorithm must ONLY set derivatives in the various derivative arrays, and these MUST be updated by calling the apply_derivative() function. You can no longer just update, say, the mass and core mass, yourself!
    
    Timestep: the idea of using fixed timesteps has been generalised so that if you need this (similar to NUCSYN_GCE/yield_vs_time.pl requirements) you can easily set this up (see src/timestep/setup_fixed_timesteps.c).
    
    Timestep: You can now apply the various multipliers to timesteps on the command line, e.g. "--timestep_multiplier44 1e6" sets timestep multiplier 44 (which controls the tides, see src/timestep/timestep.h) to 10^6. Setting these numbers smaller means a smaller timestep, and you can find the defaults in src/timestep/timestep_set_default_multipliers(). The current set of default multipliers seems fast enough for general use, but is far more accurate than BSE, particularly in the tidal evolution (so close binaries, with short timesteps, will take a lot longer to evolve than they used to, but are numerically also now more correct). 
    
    Command line arguments: where you used to have to write (say) "--magnetic_braking_algorithm 1" you can now write "--magnetic_braking_algorithm MAGNETIC_BRAKING_ALGORITHM_ANDRONOV_2003", i.e. the macros that you would use in the code are now availalble to you in most command line arguments where they are useful. They are given in the help text too (try "./binary_c help magnetic_braking_algorithm") and should work just fine with binary_grid. These macro maps are made in set_cmd_line_macro_pairs.c - you can add your own if you want.
    
    binary_c evolution loop : the old "RLOF" and "detached" evolution loops have been replaced with a single, more general loop, which is now activated by default (see the parameter "evolution_algorithm").
    
    event handlers: events like common-envelopes, contact systems, RLOF dynamical mergers, supernovae and third dredge up are now not treated during "normal/smooth" time evolution, rather are captured as events at the end of a successful timestep. This treatment is *required* in order to use solvers other than forward-Euler, and is far more flexible than the previous ad-hoc code based on BSE. You can disable 
    
    other fixes: removed a factor 0.4 in compact_object_accretion_limits (thanks to Karel for this) and cleaned up a lot of code.
    
    
    
    12/02/2019 Fix in tides to speed things up. The tidal changes are, in close period systems, rather stiff so lead to small timesteps. To remedy this, tidal changes to stellar angular velocities are now computed analytically, the effective derivative (which is non-linear) is computed with an exponetional "decay", and this "effective derivative" is applied to the Euler scheme. It's not perfect, but it's close to the truth and the speedup is huge (in a few systems).
    
    06/02/2019 Backported some bug fixes from izzard-discs. BH spins are now calculated properly using Kerr solutions: note that if J>Jmax (i.e. the BH is spinning too fast) then the extremal Kerr solution (J=Jmax, R=0.5*RSchwarzschild) is used. Also fixed a bug in the tides where if the rate of change of angular velocity < 1e-50 things went awry. Added a restriction in the timestep code to reduce the timestep when the tides need it: this is rather ad-hoc and, of course, implies we really need an implicit solver. But, as that's a lot of work, we just reduce the timestep. This shouldn't be noticable when the tides are "normal strength" but if they are stronger the timestep will be small (sorry, but at least the answer is more correct!).
    
    22/01/2019 Backported RGI's discs branch changes to master, including: libmemoize support, better backtraces, better debugging, fixed nanchecks, new binary_c file type support, updated circumbinary discs, added new SNIa yields, effective metallicity and Fabian's mass loss routine, extra magnetic braking algorithms, more BH prescriptions, latest binary_grid and supporting modules, updated documentation, updated version information and speedtests, updated options for common-envelope stability, lots of minor bug fixes.  
    
    16/06/2018 Ported drand48 code from glibc just in case you don't have it. Also added an option to use Mersenne twister random numbers instead. 
    
    
    05/02/2018 The code has moved from SVN to git at Surrey. I have tried to fix configure, the version code, etc. as much as possible. Please let me know if there are problems!
    
    
    05/01/2018 changed strncpy to strlcpy, and defined BAN_UNSAFE_FUNCTIONS which, in binary_c_code_options.h, stops various functions which are likely to cause buffer overruns from being used (e.g. strcpy, strcat, gets). This requires strlcpy instead of strncpy, hence libbsd.
    
    Use pkg-config to get the library and C-compiler flags required for the Makefile. 
    
    08/12/2017 Release 2.0pre28
    
    07/12/2017 Bug fixes to third dredge up and HBB code. I broke something in a recent version, which meant that things went wrong when dtfac<1. Now fixed.
    
    05/12/2017 Cleaned up header files so that most start with the binary_c prefix. Still, external code should use the binary_c.h file (or the API access) which hasn't changed.
    
    Added tbse.help file. 
    
    Fixed a bug in common-envelope nucsyn which caused a pathological freeze in new TPAGB stars.  
    
    Preparing release 2.20pre28
    
    25/10/2017 Added Lodders 2010 abundances (thanks to Ghina for the data) and added isotope U234.
    
    16/07/2017 removed references to gaussj and ludcmp/lubksb functions by replacing them with GSL calls.
    Added gsl libs in makefile.
    
    2.0pre28 16/05/2017
    
    Six months of updates since the last release. Phew. But a *LOT* has been improved.
    
    In no particular order:
    
    * Implemented Hall & Tout's (2014) improved radii for stellar cores 
    * more options for common envelope evolution e.g. Nandez+Ivanova and Ge's models (although beware the limited parameter space over which they are likely to be valid)
    * Improved segfault handling by maintaining a separate stack.
    * Improved backtrace on a crash.
    * Uses libbacktrace (which you should install from https://github.com/ianlancetaylor/libbacktrace ) when available.
    * Random number generator is no longer from Numerical Recipes but uses GNU's drand48_r : this is thread-safe, portable and less buggy. 
    * Fixed a lot of debugging statements.
    * Accretion rate limits (e.g. Eddington, thermal) are implemented as multipliers.
    * Accretion limited by rotation (prevent_overspin.c) has been cleaned up.
    * Improved supernova handling. SNe are now set as events that are caught at the end of an evolutionary step (prior to update for the next timestep). The post-SN stellar structure is allocated space and is only set when the star explodes and is kicked.
    * Fixed bugs in the SN kick mechanism and improved the stripping algorithms.
    * SN kicks can now be applied per SN type : you could (for example) kick SNIa systems now as well.
    * SN impact on the companion can be applied per SN type.
    * Lots of updates to the discs code (e.g. photo evaporation, ISM ram stripping).
    * Lots of variables renamed to more sensible alternatives.
    * Derivatives are now applied in the same place for detached and RLOF systems. This makes it a lot easier to track stellar yields. This was a lot of work but has made recent changes far easier to implement. This change also rendered a lot of the RLOF code redundant.
    * Yield code improved, particular SN yields (it was a mess) and SN stripping.
    * Can now have a constant mass/angular momentum accretion rate (e.g. to simulate "star formation").
    * Novae can now be modelled individually. Some physics updates here too (e.g. Shara 1986 algorithm) mostly in advance of some work on novae this summer. epsnov has been renamed as the nova_retention_fraction
    * tbse cleaned up with a few more options, e.g. it now returns the exit code of binary_c (at least in normal run mode) and can do multicore better (e.g. with valgrind)
    * also some small bug fixes in binary_grid(2)
    
    2.0pre27 18/11/2016 
    
    We're zooming in on the 2.0 release now.
    
    Fixed bugs in the stellar magnitudes (stellar_colours.c) : the correction
    for the luminosity of the star was applied twice. I have now checked this
    compared to the absolute magnitude of some nearby stars and now it works. 
    Note that *colours* (e.g. U-B) were correct.
    
    Removed the rate_mask in the nucsyn ensemble, instead made this Ensemble_type
    which can now have multiple values (currently normal, rate and magnitude).
    The appropriate macros are in binary_macros.h.
    
    Renamed a few variables to make things cleaner.
    
    2.0pre26 21/10/2016 
    
    The condor module now works with binary_grid2.
    Documentation suitably updated.
    Fixed some minor bugs.
    Updated configure and perl modules to use generic build options
    in environment variable ARCHFLAGS if defined: you should
    set it as follows on your condor machines:
    
    export ARCHFLAGS="-mtune=generic -march=generic"
    
    2.0pre25 06/10/2016
    
    Updates to binary_grid2 to handle SYSTEM_ERRORs properly.
    
    New flag in grid_options to start a simulation at a given 
    star number (so in the event of a crash the first n stars
    in the grid can be skipped).
    
    Fixed typos in the binary_grid2 template script.
    
    2.0pre24 04/10/2016
    
    Fixed a nasty bug in next_evolving_star where the logic was a bit faulty.
    Fixed minimum RLOF orbit function to return or exit (it previously just exited, which is not what you want when calling it from the shared library).
    Syncd latest perl mods.
    Fixed bug in colours/GAIA code (many thanks to Douglas B. for spotting this).
    Fixed bug in strip_and_mix/comenv which caused a crash when a merged single star emerging from common envelope evolution wasn't star 0.
    
    binary_grid2 pdf added
    
    Lots more API improvements: 
    FORTRAN interface works (again).
    Documentation updated.
    
    2.0pre23 01/10/2016
    
    Updated API functions: now only the API functions are seen through the shared library. Updated the namespace to be more consistent.
    
    2.0pre22 (update) 28/09/2016
    
    Reworked the exit codes. There's now a SPECIAL_EXIT code which is
    used by some (non-API) functions to exit, e.g. version(). 
    
    Updated a lot of the documentation for V2.0+.
    
    2.0pre22 (update) 26/09/2016
    
    Fixed the binary_grid1/2 init abunds function to work with the 
    C and Perl backends.
    
    2.0pre22 (update) 25/09/2016
    
    New binary_grid2 module : this is an object-oriented version
    of binary_grid. The C and Perl backends cater for both 
    binary_grid and binary_grid2 at present (although 2 will
    only be preferred in the future).
    
    tbse_line in binary_grid2 can return an array of arrays, 
    preventing the need for a "split" call in the parser function.
    This is done in C, natively, in binary_grid::C so is a lot faster
    than Perl's split.
    
    Greatly speeded up yields_vs_time by using the latest updates.
    
    2.0pre22 17/09/2016
    
    Minor bug fixes (memory leak, cleaned up free_tmpstore).
    Tested with binary_grid 0.30 which now works with the shared library.
    Synced to binary_grid 0.30 which has newly split C and Perl backends. 
    Clang can now build the shared library.
    Added notes on the shared_library build and how to compile
    with the new binary_grid.
    
    2.0pre21 07/09/2016
    
    Add Mathieu Renzo's implementation of Fryer's BH masses,
    as well as the Tauris and Taken (1998) SN kick,
    Liu+2015 or Wheeler+1975 mass stripping. 
    
    2.0pre20.5 03/09/2016
    
    New tmpstore to store variables which are not required to be in the store.
    Data in tmpstore is not shared between timesteps: it's really temporary
    stuff, but is useful for sharing space amongst functions.
    
    The store now CANNOT depend on stardata AT ALL. It is static data, which
    is allocated just once at the beginning of runtime.
    
    Changed most (all that are used, it seems) variables to local.
    Moved "static" variables to store, tmpstore or common, depending
    on whether they are data that should not change, data that is temporary
    or data that depends on the contents of stardata, respectively.
    
    Fixed memory leaks.
    
    All ALLOC_CHECKS are now done in MALLOC, CALLOC and REALLOC.
    
    STATIC_ARRAYS has been removed and is now the default. You can
    no longer dynamically allocate any pointers inside stardata,
    except in the store or tmpstore.
    
    Seems to -finally!- be truly thread safe.
    
    2.0pre20 29/08/2016
    
    Removed global variables, replaced global_stardata_p with
    locally declared stardata everywhere. First step to being
    thread safe.
    
    New Interpolate wrapper and data_table_t types: should
    replace all interpolate calls.
    
    New store_t struct to store static (unchanging) data between
    calls and/or threads.
    
    
    
    2.0pre19 17/08/2016
    
    Cleaned up main2.c and split into many functions and sub directories.
    
    Bug fix in RLOF which froze after a double-comenv.
    
    More bug fixes with strip and mix.
    
    New tbse option 'multicore' to run on many cores at once, e.g.
    
     tbse multicore 16 --random_systems --repeat 10000
    
    Cleaned up WRLOF code, allowed WRLOF from any giant (not just hydrogen-rich).
    
    2.0pre19 15/08/2016
    
    More bug fixes.
    Some macros were called with (1) and (2) when it should be (0) and (1).
    Fixed bug affecting nucsyn_strip_and_mix : still SNe should be cleaned up.
    
    2.0pre18 12/08/2016
    
    A couple of bug fixes:
    * "other exploder 4" error
    * k2 not being set in WDs
    * argument for fitting preMS stars inside their Roche lobes had incorrect type
    
    Also, updated Holly's table to the latest TAMS models (CND5 project).
    
    2.0pre17 11/08/2016
    
    * Big change : The stars are no longer indexed by 1 and 2, but 0 and 1.
    
    This saves a star_t struct being stored unecessarily inside the stardata_t
    struct, and hence saves a lot of time when using memcpy on stardata (e.g.
    with the new logging code, and when strip-and-mix is enabled i.e. when
    stardata is large). Typical speed increase is ~20%, and can be up to 80%.
    
    The star number is accessed as before, but to find the number of the
    other star you cannot use 3-k, but instead should use the Other_star(k)
    macro. This allows for future changes in a transparent manner.
    
    The smaller memory footprint may also be useful in N-body codes, e.g.
    when using the API.
    
    Note that any scripts which access star 1 and star 2 will have to be
    changed to use star 0 and star 1.
    
    * Also cleaned up the tbse script so that the argstring is far more readable,
    by newlines in the string.
    
    * Added new BH mass prescription from Spera et al. (2015).
    
    
    2.0pre16 9/8/2016 deprecated qcrits, qcrits_degerate, please use the
    individual qcrits instead, e.g. "--qcritMS 1.0" in tbse.
    
    2.0pre15 5/8/2016 (Torino workshop 12)
    
    Added Ge+(2015) qcrit.
    Added Nandez+Ivanova(2016) alpha_ce prescription.
    
    2.0pre14 19/7/2016
    
    Bug fixes (many thanks to the guys in Amsterdam!)
    Added magnetic_braking_factor to modulate magnetic braking for Thomas Masseron
    
    2.0pre13 5/7/2016
    
    Quite a few bug fixes, segfault prevention, etc.
    Added Holly's 1DUP tables.
    Added options to alter initial abundances.
    Added symbiotic (wind fed) novae.
    More fixes to the (still wrong) disk code too.
    
    2.0pre12 4/5/2016
    
    Fixed some issues in RLOF between degenerate objects.
    Fixed loading of qcrit_degenerate, also bugs in tbse script related to this.
    Changed rdisk to rmin (and function name to match) as used in original Ulrich and Burger paper.
    New preference : jorb_RLOF_transfer_model. This is 0 for the Hurley model (direct impact vs disk) or 1 for traditional conservative evolution.
    New preference : gravitational_radiation_model. This is 0 for the Hurley model , 1 for the Hurley model but only when there is no RLOF, or 2 for no gravitational radiation. Set to 3 for the model of Landau and Lifshitz (1951; assumes a circular binary) and 4 for 3 but only when there is no RLOF.
    
    
    2.0pre11
    
    Fixed another memory leak with EVOLUTION_SPLITTING which caused some random crashing. It seems that having dynamic arrays is an issue with evolution splitting, so at present all but the most transient are static. If this is a problem for you, er,... don't use EVOLUTION_SPLITTING :)  
    [later : this is fixed]
    
    2.0pre10
    
    More disk code update (affects nobody except me).
    Bug fixes in EVOLUTION_SPLITTING, thanks to Mathieu Renzo for being my guinea pig on this code :) These were a memory leak and lack of calls to reset_timeout.
    
    Virtual timer is now ignored if the timeout (TIMEOUT_SECONDS in code_options.h) is set to zero.
    
    New option "dumpversion": this is like gcc's '-dumpversion', it outputs ONLY the version number (e.g. '2.0pre10') from version.h.
    
    11/04/2016 Release 2.0pre9
    
    lots of updates to the disc codes, which aren't really 100% correct yet,
    but Adam and I are working on it :)
    
    Clean up evolution splitting so that when N=1 there is just one thread (not two).
    
    Rewritten lots of the RLOF rate calculations to fix a number of issues.
    
    Some cmd line parsing bugs fixed.
    
    29/01/2016 Release 2.0pre8
    
    Fixed some minor bugs, cleaned up a lot of code.
    
    CNO, He and H changes during case A and B RLOF and first DUP have been
    combined into a new routine. This is still a bit experimental (and for other
    isotopes the standard first DUP routine is used) but seems to work well.
    
    07/01/2016 Release 2.0pre7
    
    Fixed a bug in the RLOF timestep calculation. This could cause a large wind loss rate (and hence accretion rate, e.g. in an LBV phase) to be ignored, and hence an enormous increase in stellar mass. 
    
    05/01/2016 Release 2.0pre6
    
    Memory leak fixes.
    More initial abundance options (thanks Carlo).
    Pre-compiled headers.
    Improve build with clang.
    Fix signs of derivatives to be more natural (-ve = loss, +ve = gain).
    
    25/11/2015 Fixed a memory leak associated with buffered_output and compression. 
    
    Changed all log_every_timestep output to use PRINTF rather than printf,
    which automatically takes compression into account.
    
    23/11/2015 Update to 2.0pre3
    
    Bug fixes over the weekend.
    
    20/11/2015 Update to 2.0pre1
    
    Summary: Complete restructuring! Update to binary_c version 2.0 (pre release 1)
    Many updates following suggestions at the binary_c days in September 2015.
    
    Changed directory names:
    iterate -> evolution
    claet -> stellar_timescales
    hrdiag -> stellar_structure
    
    New directories:
    api
    buffering
    disc
    timescales
    timestep
    wind
    
    * Much cleanup of variables. Many names have been changed to better reflect what the variables do, and once and for all try to move away from the FORTRANesque naming structure of old. 
    * Many variables have been removed.
    * Much old code has been deprecated.
    * Some optional features, turned on by macro flags, have been merged into the main trunk and are now standard.
    * Most derivatives, e.g. of mass and angular momentum, are now in the model->derivatives and star[n]->derivatives arrays (label macros are in derivatives.h).
    * The RLOF code now uses these derivatives, rather than derivatives*dt.
    * The parse_arguments routine from BONNFIRES has been backported to binary_c. This is far more flexible than what there was before, and has a comprehensive help system (e.g. "./binary_c help RLOF").
    * Evolution is now in the evolve_detached_system and evolve_RLOF functions.
    * Many pieces of code common to RLOFing and detached systems have been properly merged (e.g. wind losses).
    * Timesteps have been shortened, especially during the HG.
    * The timestep now depends also on the rate of change of the eccentricity.
    * All the above changes have been extensively tested compared to an old version (SVN 3537). There are some differences, but in every case tested so far the newer code has matched the old code when, e.g., the timestep is smaller. The new code is thus more trustworthy!
    * Documentation has been updated for binary_c2, including a flowchart (doc/Binary_c Flowchart.pdf)
    * Placeholders for my new disk project are there.
    * API for running binary_c from other codes, in C (hence C++, Perl, Python, etc.) and FORTRAN interfaces are available. 
    * Shared library build (make libbinary_c.so).
    * previous_stardata storing the previous timestep's state is now standard, and is required by the new logging and RLOF interpolation routines
    * Basic logging is now done by diffing the current stardata and previous_stardata, not at random places in the code
    * Logging every timestep is now in log_every_timestep.c (was iterate_logging)
    * Loop logic has been cleaned extensively
    * New RLOF interpolation routine to zoom in on R=RL with only positive timesteps (this is now the default, the BSE option still exists but is not recommended)
    * Many input parameters have been deprecated or renamed (e.g. bb is now "CRAP_parameter")
    * Timestep routine split into smaller routines based on stellar type
    * Wind routine split into smaller routines based on stellar type
    * Tentative support for Window To The Stars version 2.0
    * Allow FPU precision to be set manually (FPU_PRECISION)
    
    
    13/02/2015 Update to 1.20pre71
    
    Removed deprecated STPAGB, globular cluster, NUCSYN_PROFILES etc. code for leaner build
    Improvements for speed (e.g. in dilute functions)
    Cleaned up many functions to use binary_c.h
    Fixed some memory leaks
    Reduced runtime by CPU warmup time. 
    
    20/08/2014 Update to 1.20pre70
    
    Added features that have been wanted for a long time: reset on failure.
    
    It used to be that you can call the system function "exit(...)" to
    quit the code on error. No longer are you allowed to do this. Instead
    you must use the Exit_binary_c(...) macro. This takes arguments:
    1) Error code (see binary_c_error_codes.h)
    2) A format statement, e.g. a string
    3) Any variables associated with the format statement.
    
    When you are using batchmode, failures are now automatically logged
    (as of binary_grid 0.27) and counted, so at the end of the run you
    can see how many stars failed.
    
    Note that you need to
    
     #include "../binary_c.h" 
    
    which replaces all the old includes.
    
    02/08/2014 Update to 1.20pre69
    
    You can now set the critical q for each stellar type
    as a list, also separately for degenerate stars, so 
    you can replicate the work of (say) Claeys et al 2014.
    
    I have rewritten a lot of Joke's fitting for etaH and etaHe 
    and simplified her code to make it readable.
    
    Also there were changes to 1.20pre68 but that was mainly
    changes to binary_grid.
    
    10/02/2013 Update to 1.20pre67
    
    Because Carlo's s-process stuff is only for Z=1e-4,
    I have put the tables from Busso & Gallino back into the code
    (equivalent to the old EXTENDED_S_PROCESS) and it is enabled by
    default when USE_TABULAR_INTERSHELL_ABUNDANCES_KARAKAS_2002 is 
    enabled (or you can force the issue by defining NUCSYN_S_PROCESS).
    
    However, if USE_TABULAR_INTERSHELL_ABUNDANCES_KARAKAS_2012 is 
    enabled, you're limited to Z=1e-4 until Amanda (and Cherie)
    provide the data for other metallicities... this might be a long wait.
    
    So, here's my recommendation:
    For general work, use 2002.
    For specialist Z=1e-4 work, use 2012.
    
    
    09/02/2013 Happy new year
    
    Hello from sunny South Yarra :)
    
    binary_c update to version 1.20pre66
    (SVN version 1397)
    ------------------------------------
    
    IMPROVED S-PROCESS
    ------------------
    
    new define in nucsyn/nucsyn_parameters.h:
    
      USE_TABULAR_INTERSHELL_ABUNDANCES_KARAKAS_2012
    
    to use Karakas/Lugaro's third-dredge up abundances for both light and heavy 
    elements (deprecates busso/gallino et al which has been REMOVED)
    
    Note that this means you should NOT define
        USE_TABULAR_INTERSHELL_ABUNDANCES_KARAKAS_2002
    anymore (it's still there for testing purposes).
    
    You can control the partial mixing zone with the parameter
    --size_of_pmz
    this is zero by default.
    
    IMPROVED ANGULAR MOMENTUM LOSS
    ------------------------------
    
    jorb_loss can now have the option 3 (JORB_LOSS_SPHERICALLY_SYMMETRIC_WIND)
    
    Wind-RLOF (see Abate et al 2013, MNRAS accepted)
    ------------------------------------------------
    
    To make this work, define WRLOF_MASS_TRANSFER in binary_parameters.h
    (now on by default)
    
    new function : binary_star_functions/WRLOF_rate.c 
    this calculates the wind-RLOF mass transfer rate
    
    You can choose the WRLOF algorithm
    
    --WRLOF_method <n>
    
    (stardata->preferences->WRLOF_method) where
    0 = no WRLOF
    1 = q-dependent
    2 = quadratic 
    (defined in binary_macros.h)
    
    associated with this is the option (binary_parameters.h) 
    USE_WIND_VELOCITY_OF_VW93_ON_TPAGB
    which forces the use of Vassiladis and Wood's wind velocity (rather than
    some fraction of the escape velocity) on the AGB. You probably want this.
    
    
    Backports from BONNFIRES
    ------------------------
    
    Improved tbse script: can now take arguments
    * debug : runs gdb on binary_c for debugging [requires "./configure debug"]
    * valgrind, callgrind, cachegrind, ptrcheck, sgcheck : use valgrid and associated tools for testing [requires "./configure debug"]
    
    e.g. to use gdb to debug binary_c, do the following:
    
    -----
    
    ./configure debug
    make cleanall 
    make
    tbse debug
    
    -----
    (and learn how to use gdb!)
    
    Minor things
    ------------
    
    preferences->no_arg_checking is now set to zero in main2.c (an oversight!)
    
    updated nucsyn_manual.lyx (and pdf) with new options.
    
    lots of unused variables have been removed, sorry there are still a few
    but none make much difference
    
    NANCHECKS has been disabled by default: it slows the code by 25%
    
    ------------------------------------------------------------
    
    24/12/2012 Merry Christmas, again.
    
    Added API functions. Currently in testing, but seems to work.
    
    11/12/2012 Updates to binary_grid, configure, etc. SVN 1215
    
    binary_grid:
    new condor module to provide support for the distributed computing 
    network 'Condor', testing ongoing at the AIfA.
    also some small bug fixes
    
    binary_c:
    removed as many fflushes as possible, in normal use flushing
    should only happen at the end of the run of a star or in the case
    of error (remember stderr is always flushed)
    
    binary_grid and binary_c:
    argument checking is now optional and NOT done by default:
    a lot of time was spent passing args to binary_c and back, you can
    of course switch it back on
    
    01/11/2012 German bank holiday! 
    
    Update to V1.20pre63 (SVN 1138)
    
    binary_grid:
    
    * Much cleanup of binary_grid code.
    * Depreacted many features in binary_grid: old grid(), threaded_grid() are gone, both replaced by the flexigrid. Lots of old features that were never used have been removed. The old code is in the (unused) binary_grid-deprecated.pm module. Please don't use it!
    * Flexigrid now uses perl's native Thread::Queue rather than its own implementation. The code is simpler and more straightforward, also avoids the use of signals (so safer on Condor).
    * Binary_c is opened with Open3 instead of Open2, so STDERR can be captured.
    * Arguments are sent to binary_c in a question/answer session so it is easier to detect when one fails.
    * Better global error handling.
    * Better thread killing.
    * Written new binary_grid-flexigrid documentation.
    * binary_grid requires perl 5.16 (best to install this with perlbrew), latest Perl syntax often implemented where it helps
    * New src/perl/install_modules.pl script to install dependent modules using cpanminus
    * Synced latest versions of Rob's perl modules to binary_c trunk
    * Copied more of my grid scripts into the trunk
    * Added RobMerge, Interpolation modules
    
    binary_c:
    
    * S-process has been removed pending Carlo's updated s-process data (soon!)
    * Isotopic definitions have been back-ported from BONNFIRES, they are now more flexible and based entirely on isotopes (not elements). Note that to set isotopic properties (e.g. abundances) you should use SET_ISOTOPIC_PROPERTY and INCREMENT_ISOTOPIC_PROPERTY. However, this won't work well yet because I haven't converted all references to (e.g.) Xsurf, etc. (Note that this won't affect abundances treated inside loops, only individual settings.) At present the ISOTOPE_ARRAY_SIZE includes all isotopes, so everything will work. If ISOTOPE_ARRAY_SIZE is smaller, and the above macros are used, the code will be faster (at the expense of some isotopes that you might not care about). 
    * Get elemental abundances or [A/B] through the dedicated functions nucsyn_elemental_abundance and nucsyn_elemental_square_bracket
    * New qcrit selection via the command line --qcrit_GB_method : 0 = H02, 1 = Hjellming+Webbink, 2=No comenv, 3=Chen+Han(table), 4=Chen+Han(formula)
    * Moved beta decay timescales to nucsyn_beta_decay_timescales.h
    * Split up the wind routines into individual files for each stellar type. Should be MUCH easier to maintain.
    * main.h and main2.c contain a lot of what was in main.c, main.c is now much simpler
    * removed a lot of test code from interpolate.c, improved the interpolate comments so it's easier to use for newbies
    * removed MULTISTAR code (it was never used)
    * cleaned version code to remove deprecated macros
    * added canberra project code
    
     
    18/03/2012
    
    Bug fixes:
    Missing "*djorb+=x;" in tidal_shrink_up (RLOF case)
    	    *djorb += x; // BUG FIX 18/03/2012	
    
    Change CBp to CBq in calculation of timescales[T_GIANT_TINF_2] in claet_low_mass_GB.c
    
    09/10/2011
    
    Update version to 1.20pre62
    
    Fix to bug in tidal_shrink_up where TINY wasn't small enough 
    for a IS_ZERO test. I really should fix these at some point... the macros
    as they stand are not very reliable :(
    
    18/06/2011
    
    Update version to 1.20pre61
    
    Changed monte_carlo_kick.c to use arbitrary functions for the
    probability distribution of supernova kick speeds.
    See the function for details of how this works: it's really quite
    trivial. To activate this a new variable 
    
    preferences->sn_kick_distribution
    
    should be set to 2 (CUSTOM_KICK_VELOCITY). (NB 1 gives you the Hurley et 
    al 2002 single maxwellian, 0 is a fixed velocity)
    There are also some hard-wired numerical parameters, see binary_parameters.h.
    
    Also includes STARSEARCH stuff (working on this with Herbert, top secret),
    a few bug fixes (e.g. no freeing the file log file pointer when it 
    is NULL, ...) and minor updates to binary_grid to deal with the new option(s).
    
    Note that DISTRIBUTED_SN_KICKS has been marked as 'deprecated' : I have
    not used this code for years and it might not work.
    
    Added colour to DEBUG output (see ANSI colour macros defined in 
    binary_macros.h) - this should help those of you that are getting too
    old to debug full screens of text (Evert! :)
    
    08/02/2011
    
    Happy new year!
    some things removed: CORE2 and ATHLON are no longer used
    
    New physics:
    comenv now exits to stars with an envelope so they can have a PN
    fixed bug in the RLOF/tides (thanks Joke!) 
    
    logging:
    Fabian's log has been added 
    New STARSEARCH is a generic logging functionality
    
    binary_grid added some function calls before/after thread creation 
    and before/after the grid() call in threads.
    Also greatly speeded up test_grid calls (e.g. to count the 
    number of stars in a grid although this doesn't work with
    eccentricity!).
    
    01/02/2011
    
    A few changes of late that are worth mentioning:
    
    Joke has fixed up the SNIa physics in the Hachisu disk wind.
    
    STARSEARCH - a generic model for making a grid of model output - has been implemented (this should be considered in alpha only!). There are some slight changes to binary_macros.h as well.
    
    Some minor improvements and fixes to binary_grid.pm (mainly log output
    but some new functions can be called pre/post thread launching as well)
    
    15/11/2010
    
    The CHANGES file is a bit out of date :)
    
    Many bug fixes have gone in.
    New directories (claet, misc) and everything that is .c or .h has 
    gone into the src directory.
    
    Moved everything to Bonn's SVN server. More information on this is
    pending.
    
    17/03/2008
    
    HRDIAG logging improved when the timestep covered a couple of bins.
    The data was ok but a bit noisy because of the sampling error (now 
    corrected, although the code is more complex).
    Also outputs the probability, mass and luminosity of the stellar population
    which is used by the latest grid-hrd.pl to sum the mass and luminosity
    for all the stars. Peter can use that to normalize his populations.
    
    04/03/2008 : updated to 1.20pre56
    
    Many changes to the rotationally enhanced mass loss (etc) and RLOF routines,
    mainly for Selma.
    
    Split calc_lum_and_evol_time into its own directory and smaller source files
    (in claet/) so hopefully these can be improved. We shall see.
    
    HRDIAG logging improved for project with Peter Anders. See grid-hrd.pl
    also logging/log_hr.c and deltat.c (for calculation of special timesteps)
    
    Lots of changes to binary_grid to do with (Perl) threading and usage on 
    multi-core machines. 
    
    23/12/2008 : updated to 1.20pre55
    
    Many bug fixes to the adaptive RLOF routines.
    Speed increase by remembering the mass strip required from the previous timestep.
    calc_lum_and_evol_time now has a cache, which buys us a few % in runtime.
    New call to calc_lum... in comenv in the case of mergers: prevents
    backward evolution (probably should have been there in the first place!)
    
    Numerous improvements to zfuncs, especially speed improvements
    where constant functions of the metallicity_parameters were calculated.
    These are now moved to new metallicity_parameters (and the array increased
    in size).
    
    New stuff in doc/ : notes on the RLOF routine and timestepping (the
    latter are really for me alone!).
    
    Note that the slowest function is now mrenv: this should be 
    looked at, but each time I do I break it!
    
    16/11/2008 
    
    new Dprint function (actually a macro to a function call) which
    should be used to replace printf calls inside #ifdef DEBUG statements
    
    Note that if you define DEBUG in functions and use Dprint you have to
    use 
    #define DEBUG 1
    instead of #define DEBUG (for silly reasons).
    Otherwise, it should "just work" and the #ifdef DEBUG bits can be removed.  
    
    12/11/2008 Update to 1.20pre52
    
    After a break with the nurses, I have returned to update binary_c/nucsyn.
    
    A new option has been introduced: adaptive RLOF.
    To use it make sure ADAPTIVE_RLOF is defined (in binary_parameters.h)
    and use '--RLOF_method 1' as an option to the code.
    This is a new RLOF algorithm, based on Norbert Langer's code, to try
    to keep the radius of the star just inside (or close to) the Roche radius.
    Note that it gives *VERY* different results (for massive stars at least)
    to the old formalism. The old formalism is used for convective stars 
    (more generally when dr/dm < 0).
    
    There are many free parameters involved, which are tuned to give 
    reasonable results. See binary_parameters.h for all the details. 
    
    19/09/2008 Update to 1.20pre51
    
    I have improved, I hope, the abundances in secondary massive stars.
    The new algorithm is quite complicated, but there's a lyx file in my 
    doc/2008/notes which should explain it.
    
    23/07/2008 Update to 1.20pre49
    
    Oops forgot the 1.20pre48 update.
    
    Not many important changes, but some extra stuff for Norbert
    with regard to the mass-loss from massive stars and prevention of
    accretion of material with a very large angular momentum.
    
    Now in Brussels, so version.c has an updated email address.
    
    Added radiation to the rl() Roche lobe calculation: this is very
    preliminary (RLOF_RADIATION_CORRECTION).
    
    04/04/2008 Update to 1.20pre47
    
    Some bug fixes (esp in calc_intrinsic_spin) where a MORE_OR_EQUAL(0,..)
    should really have been a >0
    
    New:
    
    #define MANUAL_VROT
    Allows you to specify stellar spins on the command line with --vrot
    
    #define VROT_LOGGING
    Enables extra logging for MS stars (e.g. spin rates) for Norbert.
    
    #define ZAMS_MENV_METALLICITY_CORRECTION
    Enables a better fit of the MS convection zone mass in mrenv.c
    It is now a function of (M,Z) (for M<3) i.e. appropriate to the
    CEMPs.
    
    #define NUCSYN_CONVECTIVE_MIXIN
    In the case where thermohaline mixing is disabled, stellar dilution
    is now done (if this is defined) according to mrenv's convective envelope
    mass. (Hence the reason it was refitted as f(M and Z)...)
    This only applies to the secondary star.
    
    16/03/2008 Update to 1.20pre46
    
    Updated interpulse period function to be a better fit to Amanda's
    models (using her 2007 tables).
    
    Also some new options which have been added over the last couple
    of months regarding the minimum mass of the envelope which is 
    required for third DUP. 
    
    14/12/2007 Update to 1.20pre45
    
    Added ROBSMOOTH which should reduce the numerical instability
    which was happening on the transfer from EAGB to TPAGB (and sometimes
    on the TPAGB itself) regarding RLOF.
    
    fixed hrdiag_AGB so that instead of checking if the core mass has exceeded
    the chandrasekhar mass, the code checks if exceeds the maximum TPAGB core
    mass (which is effectively MCh, for an ONe WD composition)
    
    added SN1a script for testing the SNIa rate
    
    new PATHOLOGICAL_RLOF_CHECK : define this to check and correct for the problem of the radius increasing as you go backward in time (and shrink the core mass)
    
    28/11/2007: Update to 1.20pre44
    
    Fixed bug where fage1 wasn't set for some stars in comenv
    
    Now yields for stellar type MASSLESS_REMNANT in mix() - this can 
    only be a HeWD-HeWD merger (according to Jarrod's table) which really
    we don't believe is an explosion anyway. Pff! But, this is now a SN_IA_He
    
    -- earlier today -- 
    
    You can specify the maximum logg for CEMPs through --CEMP_logg_maximum
    (the stellar-type specification is now deprecated)
    
    Many little bug fixes which seem to make little difference.
    
    Added F19 to cold CNO network
    
    Changed CEMP selection criterion to select for 
    logg<preferences->CEMP_logg_maximum rather than just stellar type HG (2)
    or later. These should be very similar!
    
    Updated the yield sources so I can make SNIa yields for Anne Sansom.
    Fixed bugs:
    
    AIC now yields with the WD surface abundances
    Electron capture supernovae also yield now
    dmt and dmr are now set to zero at the beginning of each timestep (oops!)
    Common envelope routine now yields Thorne-Zytkow objects properly
    dtmi wasn't set to zero for degenerate stars at the beginning of each loop, as it should have been
    WDWD mergers in mix() didn't trigger SNIa yields: fixed
    fixed a bug where the final timestep wasn't yielded, esp. if the star was a massless remnant
    
    New attempt at RLOF routine: if STEP_BACK_RLOF is defined then instead
    of negative timesteps the code steps back to a previous saved stardata
    (requires STATIC_ARRAYS of course) and uses that. This does not work at 
    present! Be warned!
    
    Fixed pathological case where negative timestepping in RLOF does makes the 
    radius INCREASE during TPAGB. This is physically reasonable! So, now I 
    shrink the core mass (i.e. a "negative luminosity) in the tpagb routine, 
    without doing any more dredgeup. This is the best I can do at the moment, 
    and it seems to fix most cases. 
    Similarly, star->radius was being set in the TPAGB function when really
    only star->rteff should be.
    Removed a recalculation of the radius in hrdiag_AGB (caused numerical
    problems).
    
    Allow for some tolerance (within 1e-3) of negative ages in 
    acquire..(). This is a numerical problem...
    
    Slightly altered the nucsyn_tpagb function.
    Capped lambda (third dup parameter) at 0.98 to better match amanda's models.
    
    Added NUCSYN_DUAL_SHELL_FLASH and corresponding function 
    nucsyn_dual_shell_flash.c so we can (eventually) implement Simon Campbell's
    dual shell flash for AGB stars.
    
    Updated the grinder script so it works on 64-bit - but really you should 
    build 32-bit if you want this to work.
    
    28/10/2007: train to paris via milan/lausanne
    
    added La to CEMP logs because Ba observations are unreliable
    
    17/10/2007: updated to 1.20pre43 : on the train to torino!
    
    New features:
    
    THERMOHALINE_ENVELOPE_MASS replaces ENVELOPE_MASS in the thermohaline 
    mixing function. See nucsyn_envelope_mass
    
    --vw93_mira_shift <x>
    
    A value which is added to the mira period as calculated by the VW93
    formula. A positive value shortens the tpagb lifetime, a negative 
    value decreases it.
    
    Reprogrammed the parse_arguments function to be ~4-8 times quicker.
    This is by searching the word characters more efficiently than strcmp.
    Note that over 100,000 runs this function takes < 2 seconds, so is not
    a bottleneck and should not really be optimised more (now that is it 
    cleaner).
    
    New script: grinder.pl
    
    This runs valgrind (memcheck) on random input parameters and
    searches for errors. You must build the code with "-g" for this
    to be effective, although it will work without it's hard to find
    the error location. Read the valgrind/memcheck manual to see that it's
    best to off optimization as well (-O0). All this can be done with
    './configure debug' (then rebuild). 
    (This is all, of course, slow. Sorry, but that's the way it is!)
    
    binary_c fixes and improvements:
    
    Fixed a bug when rg wasn't set prior to mrenv which led to a nan crash.
    This was not simple to find! I hope you are grateful.
    
    Fixed a horrible pathological bug in hrdiag where the core mass was
    checked to make sure it didn't shrink. This led to huge luminosities
    which were unfounded.
    
    New arg --minimum_envelope_mass_for_third_dredgeup which allows
    you to set the minimum envelope mass for third DUP on the cmd line.
    The macro MINIMUM_ENVELOPE_MASS_FOR_THIRD_DREDGEUP_DEFAULT contains
    the default value (0.5, if you believe Straniero, nearer 0 if you
    believe Stancliffe... what is it really?)
    
    Fixed a bug which prevented the HBB function from being called, 
    hence we were making no NEMPs! Now it works. Phew. 
    NEMP logging is enabled during CEMP logging.
    
    10/10/2007: updated to 1.20pre42
    
    Bug fix: re-enabled 1st DUP after I broke it (OOPS the comment even 
    said that I had broken it deliberately!)
    
    New options for thermohaline mixing:
    
    Flag MAYBE_NO_THERMOHALINE_MIXING : if defined you can turn off thermohaline
    mixing with "--no_thermohaline_mixing 1" on the command line. Material
    which accretes onto a star remains in the accretion layer of the star.
    
    Flag NUCSYN_MS_CONVECTIVE_REGION : if defined ***together with 
    MAYBE_NO_THERMOHALINE_MIXING  and "--no_thermohaline_mixing 1" *** (see above)
    then material which accretes onto a main sequence star is NOT mixed into
    the envelope but into the *surface convection zone*, 
    which is (sort of) the accretion layer. We do the "mixing" in two steps:
    
    1) mix accreted material into the accretion layer, which increases dmacc
       [dmacc=accretion layer mass]
    2) adjust dmacc to be the same mass as the convection region, with the 
       appropriate mixing of material from the accretion layer into the envelope
       or vice versa.
    
    The function nucsyn_main_sequence_convective_envelope_size is used to 
    calculate the convective envelope size in MS stars, it was fitted to 
    Evert's model set (made with TWIN, overshooting=0.12, Z=1e-4 to 0.02).
    
    Changed the definition of CONVECTIVE_ENVELOPE to NOT include 
    stellar type 0, the low mass main sequence stars, because these 
    certainly are often NOT completely convective. Until we find a 
    better way to deal with these stars I suggest not using them to
    compare to observations (unless you are careful with the 
    above thermohaline mixing schemes).
    
    29/09/2007
    
    Fixed some bugs to do with the new static arrays: sigmav was not 
    being preset in the lookup table correctly, so all the reaction rates
    were =1 ! Of course, the code is now so damned robust that there was 
    no error if you're just looking at the stellar evolution.
    
    26/09/2007
    
    Minor bug fixes to He-star luminosity (which could sometimes be nan)
    
    25/09/2007
    
    Bug fixes: 
    i++ should be at the end of the loop in nancheck
    .h files should not be compiled in for EAGB and CHeB profile
    burning (T,rho,convection) functions. Fixed by adding #ifdef NUCSYN_PROFILES
    where required (compile times should be much faster, especially with icc).
    
    Update 25/09/2007 Post-Split
    
    Some new features were added at the MUSE workshop in Split, Croatia.
    (thanks to ESF for funding!)
    If you define MULTISTAR (in code_options.h, as it's a really low-level
    change) then binary_c can evolve many stars in parallel. Also in
    code_options.h is MULTISTAR_MAX_NUMBER_OF_STARS which is a (currently)
    hard-coded maximum number of stars you can use.
    To use this you must have STATIC_ARRAYS defined. This defines all 
    memory space statically (e.g. "double X[100]" instead of 
    "double *X=malloc(sizeof(double)*100)"). This has the advantage that
    it means stardata contains *all* of the required data, it is not in
    random parts of the memory which would be the case with mallocs. This means
    we can copy stardata (with memcpy, i.e. very fast) and switch in a 
    different stardata, hence we can evolve more than one star at once.
    Of course, this was the original point of having everything in one
    stardata (I really did think of this all those years ago!).
    
    Be warned: the code is still a little buggy, and does not really 
    copy with time going backwards in RLOF. It is work in progress.
    
    New functions for the multistar control with BATCHMODE defined allow you
    to switch from one star to the other. See the files in the mulitstar/ 
    directory, which are called from parse_arguments(). Of course it makes
    no sense to not have BATCHMODE defined if you use MULTISTAR.
    
    The MULTISTAR functions are really designed to work with the nascent
    MUSE stellar evolution interface (Python) function calls, so again
    they are work in progress as the interface is not yet finalised.
    Watch this space.
    
    Update 20/08/2007
    
    Finally I identified what causes the random crashses: madvise.
    So do NOT use the USE_MADVISE switch, so madvise is not to be 
    used anymore. It's a bug in the library, or because my structures
    are not aligned properly in memory. I do not know how to fix it, 
    so just don't use it.
    
    Added the test_grid.pl program: run as
    test_grid.pl ref
    to make reference runs, then 
    test_grid.pl 
    to check that whatever you have changed has not changed the code results.
    This is very useful when optimizing code.
    
    Update 17/08/2007
    
    New: C13 and N14 dredge up for Z=1e-4 stars, better interpulse periods
    for low-Z stars, improved efficiency of interpolation routine, lots of
    updates for the PROFILES code, but it's still not really fixed. Updated
    the manual as well.
    
    Update 20/07/2007
    
    Fixed lots of stuff in the profile burning, it's still not right (segfaults!)
    
    Added the LICENSE file for use of binary_c/nucsyn.
    
    Update 11/07/2007 1.20pre38
    
    Bug in nucsyn_third_dredge_up_abunds fixed.
    
    Update 27/04/2007
    
    See also the SVN log for more details.
    
    Split hrdiag to separate functions, + bug fixes.
    
    New preferences->gbwind, which is 0 for Reimers, 1 for Schroder and Cuntz 2005
    
    PP I, II and III now work, with D, Li and Be equilibrium for reduced runtimes.
    
    Update 14/04/2007
    
    More cleanup.
    
    Extended experimental_convection function to deal with arbitrary convective
    zones, which are read in from Evert's table.
    
    Split X_to_N and N_to_X into nucsyn_Xfuncs.c
    
    Added the dtguess array to common. This stores a guess for the timestep
    used in each nuclear burning network based on the previous burning routine's
    minimum timestep. This saves ~ 20% in the solver (!).
    
    Update 12/04/2007
    
    More code clearup:
    * zfuncs now use RESTRICT wherever possible (except Axel's functions)
    * ktype, idum and label (the log labels) are now in stardata->common
    * split init_common, init_model and init_star into their own files
    * cleaned up initialize_parameters (should be faster?)
    
    Update 11/04/2007
    
    Moved everything in SVN (trunk branch).
    
    I will continue to maintain this function!
    
    -> New functions
    
     rwd, which calculates the radius of a white dwarf. 
    This is used a lot (in hrdiag esp.) so this should simplify things.
    
    lwd, calculates the luminosity of a white dwarf (in hrdiag)
    
    lbh and rbh, which calculate the luminosity and radius of a black hole.
    
    lns and rns, which calculate the luminosity and radius of a neutron star.
    
    Cleaned up hrdiag a bit.
    
    ---- 
    
    Update 06/04/2007
    
    You must enable SAVE_OLD_SPINS to use the jspin1,2 and omega1,2 variables. These
    are not often used, except when I was looking into GRBs, hence they have been split
    from the main code branch.
    
    You must now enable COMENV_NS_ACCRETION to activate the code which
    accretes onto neutron stars during the common envelope phase.
    
    Added -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 to the 'Linux' version
    of the Makefile (via configure). This should not be necessary, but is
    good for compatibility.
    
    Something in mcheif gave nans - so I rearranged it and they went away.
    (Checked vs the fortran version, it's ok)
    
    Changes to fix up the old NUCSYN_PROFILES code with nucleosythesis.
    
    Removed all sections of code references by JJE_FUDGES or LYNNETTE_FUDGES
    
    Removed the old functions:
    
    nucsyn_set_abundance_profile
    nucsyn_compress_abundance_profile
    
    Update:
    
    nucsyn_thermohaline_mix_profile and 
    nucsyn_mix_into to a better integrator.
    nucsyn_H(e)_burn_out_to for phases other than MS->GB
    nucsyn_strip_mass
    
    ---
    
    Update 01/04/2007 1.20pre37
    
    General clearup prior to moving code to subversion.
    
    New script: check_unwanted_files.pl checks to see if there
    are header files in the code tree which are unused. I have cleaned
    up all that I found that were no longer used. Some others I have left
    in which are used rarely, if ever, but they're there just in case.
    
    ---
    
    All S_PROCESS table option flags have been removed, and the code that was
    created when NUCSYN_S_PROCESS_V4 (the default) was set is now the default
    code. The older stuff, and all associated functions, is gone!
    
    Cleared out the He3 burning stuff, we can do this more efficiently with
    the proper Kaps-Rentrop solver.
    
    Moved the nucsyn_free_electron_density function to its own file, 
    enable NUCSYN_FREE_ELECTRON_DENSITY if you want it built (do we have
    a use for it?)
    
    Updated the stardata_status function to include the latest variables
    (except specialist variables which are enabled by #defines).
    
    Finally removed all TIDES definitions from .h files (oops).
    
    Changed 'x_or_not' in calc_wind_mass_loss_from_previous_step to the 
    more useful 'RLOF_bool'
    
    Changed the order of command line args in parse_arguments (see below)
    in order to make it faster - the most often used are at the top.
    
    ---
    
    Currently the code runs the nucsyn_experimental_convection function and
    then quits. This is part of my experimental shell burning.
    
    ---
    
    Moved functions:
    
    The functions balanc,elmhes,gaussj,hqr,interpolate,kaps_rentrop,leqs,lubksb,ludcmp,nancheck,nrutil,qsimp,random_number,SolveCubic2,stiff,svbksb,svdcmp,trapzd 
    have all been moved to the maths/ directory. These are all mathematical
    solvers (usually from Numerical Recipes) which should really have their 
    own location in the code. Now they do.
    
    reaclib.c has been moved into nucsyn/ and renamed to nucsyn_reaclib
    
    reset_reaction_rates has been renamed nucsyn_reset_reaction_rates and 
    moved to nucsyn/.
     
    ---
    
    New functions:
    
    setup/version.c now houses the verison function (split from
    set_up_variables). 
     
    zfuncs/m_conv_core gives you the mass of the convective core on the MS. This
    needs fitting to a proper function and extending to Z other than 0.02.
    
    zfuncs/max_m_conv_core gives you the maximum value of the convective
    core (mass coord) i.e. at the ZAMS. Used by m_conv_core.
    
    The function nucsyn_main_sequence_temperature_and_density.c interpolates
    a table of Evert's model results to tell you T,rho at any time during the 
    MS (and, in fact, up to 1st dredge up, though the burning between the
    terminal main sequence and 1st DUP is negligible except in the very core).
    
    nucsyn_CN_timescale tells you the timescale for CN burning to change
    C12 by an arbitrary (but small!) fraction, e.g. 1e-5. This is very
    useful when you want to determine if burning is going to happen or not.
    
    zfuncs/tbgdzf - I have no idea why this is in the code as it is not used,
    but I have left it in its fortran form. (It was never there at all before!)
    
    nucsyn_burn_pp - the pp chain burning function. Generated automatically,
    does the PPI and PPII chains at present (see networks).
    
    ************************************************************
    
    Update 21/03/2007
    
    Put CLEVER_THERMOHALINE_MIXING in nucsyn_update_masses which calculates
    the depth of thermohaline mixing based on a (completely) artificial
    temperature and density profile for the star. You need to NUCSYN_NUMERICAL_BURN
    
    ---
    
    Defined CLEVER_FIRST_DREDGE_UP which will do the same but does nothing yet.
    
    ---
    
    If you want to use thermalized corrections to nuclear reaction rates
    then you must define NUCSYN_THERMALIZED_CORRECTIONS, however this makes 
    no difference to any results as far as I can tell.
    
    ************************************************************
    
    Update 19/03/2007 - 1.20pre36
    
    Define NO_HeWD_NOVAE to force HeWDs which accrete hydrogen to heat up
    and reignite helium, hence becoming HeMS stars. They will only do this
    if they accrete a minimum of He_REIGNITION_LAYER_THICKNESS.
    
    This is very approximate because we set the age of the HeMS star to zero,
    not really very likely, but the best we can do :(
    
    ---
    
    Rewrote the special_cases function and moved it to the RLOF directory.
    
    From now on *all* RLOF routines should be in there, and what's more you
    should be able to understand what is going on.
    
    This is NOT a trivial change but you should (in practice) not notice the
    difference.
    
    ---
    
    Moved the version number to version.h
    
    ---
    
    Introduced CC_TIMER, which allows you to time CPU cycles on 
    Pentium CPUs. With this I confirmed that RESTRICT gains ~3% CPU time.
    So use it! (if you can)
    
    ************************************************************
    
    Update 18/03/2007 - 1.20pre35
    
    Better support for IIa supernovae which happen inside common envelopes.
    
    You have a choice when two CO cores merge:
    
    1) Enable COMENV_CO_MERGER_GIVES_IIa, then a COWD+COWD merger inside a common
    envelope gives a IIa supernova: i.e. eject the envelope, yield the COWD+COWD 
    just as a 1Mch COWD would be yielded.
    
    or
    
    2) Disable COMENV_CO_MERGER_GIVES_IIa, then  COWD + COWD -> hot, massive COWD -> massive ONeWD, which if M>MCh collapses to a NS in an electron capture supernova, which is defined as type 4 (SN_ECAP).
    
    ---
    
    New function : check_for_supernova, detects supernovae in each star
    based on changes in stellar type. Only for non-SNIa events, replaces check
    in acquire_stellar_parameters_at_apparent_evolution_age. Used in comenv
    as well now.
    
    Changed support for SN detection in common_envelope, merging cores now
    explode properly. These weren't detected before.
    
    Updated support for SN detection in acquire_stellar_parameters_at_apparent_evolution_age to match comenv. 
    
    ---
    
    Temporary change: New define: TOUT_ACCRETION
    
    If enabled, the mass transfer rate in binaries is limited to 
    TOUT_ACCRETION_RATE if it is higher. This prevents common envelope
    evolution and allows many more systems to make SNIa.
    
    ----------------------------------- 
    
    Update 14/03/2007 - 1.20pre34
    
    Included Gijs Nelemans' prescription for common envelope evolution, but it's a bit complicated.
    
    You can choose it with --comenv_prescription <n>, where n=0=COMENV_HURLEY (Hurley) or 1=COMENV_NELEMANS
     (Nelemans). The default is  DEFAULT_COMENV_PRESCRIPTION (=COMENV_HURLEY). See binary_parameters.h to change these.
    
    Choose Gijs' gamma parameter with --nelemans_gamma <g> where g is a number 
    (default=DEFAULT_NELEMANS_GAMMA=1.75)
    
    Note that strictly Gijs' prescription is for low mass, q~1 binaries only, so it is applied
    when q>NELEMANS_MIN_Q (default 0.2, as suggested in Nelemans et al 2000).
    (Later: moved NELEMANS_MIN_Q to preferences->nelemans_minq)
    
    The change in angular momentum is limited to a fraction NELEMANS_MAX_FRAC_J_CHANGE because
    in high q systems all the angumlar momentum is lost! (due to gamma > 1)
    (Later: moved this to preferences->nelemans_max_frac_j_change)
    
    The variable nelemans_n_comenvs is the number of common envelope evolutions
    for which Gijs' prescription is used (default is NELEMANS_N_COMENVS_DEFAULT=1).
    In his first paper this was 1, in his later works it is infinite (i.e. used
    for all comenvs) though a number like 10 should imply this (or even as low as 4!).
    
    ---
    
    Remove SN_YIELDS_HERE option in hrdiag - it should never have been used anyway.
    
    ---
    
    define EXTRA_SNIA_LOGGING for logging regarding SNIa progenitors
    
    ---
    
    Added Hachisu's disk wind: 
    this allows steady accretion onto a WD if q<1.15 (used to be q<~0.7) at a rate
    limited by an expression given in their paper if the mass transfer rate > 
    ACCRETION_RATE_LIMIT_HACHISU=1e-7 Msun/year.
    
    This is controlled by a factor set by --hachisu_disk_wind <f>
    where <f> is the factor. By default, the factor is HACHISU_DISK_WIND_FACTOR_DEFAULT=1e20, 
    so the limit set is huge and is not applied. To match their paper, set f=0.5 or f=1.0. 
    
    As far as I can tell this has only a small effect. 
    
    ---
    
    Changed the code so that nucsyn_sn_yield is always called whether you define NUCSYN
    or not. This is something of a change of policy, but if NUCSYN is not defined then the
    function just outputs to the log file, it doesn't do anything else. 
    If NUCSYN is defined you get the log output + the usual SN yields.
    
    In this way we can build the code without NUCSYN support, but still easily calculate
    SN rates.
    
    ---
    
    Now handles the (unusual?) case where /dev/stdout is chosen for the
    output file. Instead of opening (and closing!) /dev/stdout, the file_log
    pointer is just copied from the usual stdout stream.
    Also for stderr (though you probably shouldn't do this!)
    
    
    ************************************************************
    
    Update 05/03/2007 - 1.20pre33
    
    Update version number (many changes!)
    
    Ongoing debugging to make the supernova rates of my code agree with Jarrod.
    
    New macro TIDAL_STRENGTH_FACTOR corresponds to his ftid, with it you can 
    reduce the strength of the tides. Of course normally this is defined to be
    1.0. 
    
    Removed TIDES references - now you should always have it on! This means all V1.10 changes are now standard.
    
    Fixed a bug which prevented the timestep from reducing when angular
    momentum was exchanged. This was a weird one! It was in calc_intrinsic_spin,
    where there used to be djtt_or_djorb, really you just want djtt.
    This was an update in 1.10, and since I've removed the old TIDES version...
    
    A few minor changes to reflect fixes in Jarrod's 2007 verison of the code 
    (these are marked by comments with '2007' in them).
    
    Defined 
    
    GIANT_CRITICAL_Q_HJELLMING_WEBBINK
    GIANT_CRITICAL_Q_ORIGINAL
    GIANT_CRITICAL_Q_NO_COMENV
    
    so you can choose the critical q value for RLOF in giants.
    Jarrod is using the HJELLMING_WEBBINK version in his new code.
    
    Updates to code based on Jarrod's latest are marked as '2007' changes
    in comments.
    
    Some updates to common_envelope_evolution to fix a couple of nan situations.
    
    Updates to HRDIAG: some checks to prevent log(0) (etc) and new WD cooling 
    methods:
    MESTEL_COOLING
    MODIFIED_MESTEL_COOLING
    
    choose one of them. Ask Jarrod about the latter! Note that AHE and ACO 
    have been redefined.
    
    Minor change to calc_lum_and_evol_time for M<0.1 "stars".
    Updated rpertf (not sure why this has changed?).
    
    ************************************************************
    
    Update 05/02/2007
    
    Update version to 1.20pre32 to take into account new burning
    
    Update 29/01/2007
    
    Removed AGB_POLYTROPE and CONVECTIVE_MIXING parts of nucsyn_tpagb function, in order to simplify it. These are not used by me (or anyone, as far as I know).
    
    Increased ISOTOPE_ARRAY_SIZE to 140 and introduced XO14.
    
    Improving hot CNO to make it more comprehensive.
    
    Update 28/01/2007
    
    New functionality:
    
    Numerical solutions to the nuclear burning equations!
    
    You can enable NUCSYN_NUMERICAL_BURN to use a 4th order (semi-)implicit Kaps-Rentrop scheme for solving the differential equations for nuclear burning. It uses a variable self-adapting timestep which should adapt itself.
    
    Currently, this is ~ 3 times slower (use time_tbse2.pl) than the old analytic burning solutions (although this is using hotCNO rather than the cold CNO of the analyic solver), and (for the isotopes which are solved analytically) gives almost identical results. However, it is very flexible. You can add a network to the file 'networks' and then run 'make_reaction_network_code.pl' to make the burning function, which is then called via a function pointer. The new NeNaMgAl numerical solver does not include Na22, but you could easily put it in there.
    
    The numerical burner changes the H1 and He4 abundances in a self-consistent way, which the analytic burning routine cannot do.
    
    This completely deprecates the old explicit burning codes, which have been removed and should never see the light of day again. If you want to try helium burning with the new code, it should 'just work' but there will, no doubt, be bugs!
    
    Update 14/01/2007
    
    Forced Z>=0.004 in luminosity function pending a fix : stars around 5msun do not lose mass during the tpagb because the mira period is never reached! OOPS
    
    Update 29/12/2006 1.20pre31a
    
    Fixed a bug where tc was calculated (the convective turnover time) and then used for Na22. This errored and produced a NAN which caused a crash. To be precise, I removed the dependence on renv, which was wrong, and replaced it with the stellar radius, which is renv during the AGB anyway! 
    
    So really, why is renv wrong? (or is it?)  
    
    Changed to 1.20pre31a for logistical reasons!
    
    Update 07/12/2006
    
    removed line in mass loss routine which set star->dmt. it was wrong!
    
    Update 01/12/2006
    
    Added function thick_disk_age (in zfuncs, as it's a function of Z) which approximates the thick disk age-metallicity function of Bensby et al 2004. There is an arbitrary low-metallicity limit.
    
    Fixed a bug where djtt was being set twice (affects tides).
    
    New options for the R stars paper:
    
    SMALL_GB_CORES prevents the core radius on the GB being 5* the WD radius, rather it just uses the WD radius. I have looked at TWIN models and they're much nearer the WD estimate than the 'subdwarf' estimate.
    
    CONSERVE_ANGMOM_IN_COMENV preserves the angular momentum of merging cores, rather than recalculating it. This is much more likely to be true - the old method was giving huge values for jorb.
    
    Update 13/11/2006 1.2pre30
    
    Added NUCSYN_LOW_MASS_STRIPPING option, so you can apply surface abundances in star 1 according to terminal main sequence models (calculated with WTTS/TWIN) with Z=0.02, M=0.75-2.0. These are the R-star primaries, so this is a useful option to enable if you are interested in making R star models. 
    
    In theory it would be nice to do this for all stars, but I am not sure how that would be possible. At least in the case of case B RLOF in low mass stars, this is ok to use. 
    
    Update 9/11/2006 1.2pre29
    
    Added SN yields for Al26 from Limongi and Chieffi 2006. These are fitted as a function of initial mass, which is wrong of course, so only works for single stars. I hope to improve this later. The yields include wind AND SN, which is also not how we should do it. This will not work for binaries! It's ok for the STPAGB paper with Arend Jan.
    
    Bug fix: in comenv a TPAGB star was being converted to a helium star, which wasn't right (thanks Axel).
    
    Axel has made some changes to update his fork of the code, but I haven't got it yet ...
    
    Update 9/10/2006 1.2pre28
    
    Added NUCSYN_FIRST_DREDGE_UP_ACCRETION_CORRECTION which scales first dredge up changes in CNO abundances to the present CNO abundance. Note that this only works when you use Amanda's tabular first dredge up, which is not correct, but enough for now.
    
    Update 7/10/2006 1.2pre28pre1
    
    Changed tbse to allow libduma (memory allocation checker) usage. Use './configure duma' to run this. This will set the DUMA flag and so you'll need to make clean, then make. You'll need to run the gdb line in tbse to get it to work.
    
    Fixed memory allocation issues reported by DUMA.
    
    New functions:
    
    free_memory : this frees up memory which DUMA said I wasn't freeing (before exit - so it doesn't really matter but is cleaner)
    exit_binaryc : an exit function which calls free_memory (you should non-debugging replace calls to exit with this)
    
    Introduced NaN checking routine nancheck, enabled if NANCHECKS is defined in code_options.h
    
    Fixed bug where NaNs were found in Xsolar. This is due to the memory being malloced rather than calloced. BE CAREFUL.
    
    Fixed bug where NaNs were found in novae due to nova array not being zeroed before being set with the new tabular routine. (OOPS)
    
    Added NaN checks to nucsyn_burn (these will ALWAYS be on, even if NANCHECKS is not defined)
    
    Defined MAXIMUM_STELLAR_MASS (set to 100.0) and TRIM_SUPERMASSIVE_STARS. If the latter is defined, stars more massive than MAXIMUM_STELLAR_MASS will have their envelope trimmed (and yields calculated) until they are MAXIMUM_STELLAR_MASS. This prevents overruns in the fitting formulae, and crazy stuff when two 100 solar mass stars merge. It's not entirely physical... but better than before!
    
    
    
    Update 6/10/2006 1.2pre27a 
    
    Fixed a bug where temp_mult was being set to 0 instead of 1 in init_star
    
    Update 3/10/2006 1.2pre27 (command line abundance mixtures)
    
    You can now select your abundance mixture from the command line, 
    0=Anders and Grevesse 1989
    1=Karakas et al 2002
    2=Lodders 2003
    3=Asplund 2005
    
    This supercedes the changing of initial abundances via #defines, which is no longer available (sorry!).
    
    Update 17/09/2006 1.2pre26 (CL isotopic yields)
    
    Introduced isotopic yields from Chieffi and Limongi 2004 into the code, as a function of Z, M_CO and mass cut (i.e. remnant mass). Not a trivial task! And this adds lots to the executable size.... ah well !
    
    made all arrays which can be static STATIC
    
    Todo:
    
    make all arrays which can be static STATIC
    
    Update 12/08/2006 1.2pre25 (RS WR all isotopes)
    
    You can now interpolate all the isotopes from Richard's data, except those already interpolated from Lynnette's data.
    
    Fixed bug in nucsyn_calc_yields where Xsource was declared *Xsource, should be **Xsource (only occurs if source following is defined, so is rare).
    
    Updated WR wind source to use Jarrod's prescription, with a new function zfuncs/WR_mu.c, instead of the prescription based on the surface abunds (which is just dodgy).
    
    Update 03/08/2006 1.2pre24 (Extended 1DUP)
    
    Retabulated the first dredge up table to cover the new models from Amanda, Z=1e-4 M3,4,5,6. Now there should not be the C12<C13 problems which occurred at intermediate metallicities.
    
    Update 20/07/2006 1.2pre23 (Lodders)
    
    Define INTIIAL_ABUNDS_LODDERS2003 to use Lodders 2003 initial abundances.
    
    Added MILLISECOND_RANDOMNESS to define random seeds by the millisecond, not the second. Might be useful to you when trying to recreate a particular SN kick (works for me).
    
    Allow idum (random number seed) to be set on the command line (with --idum n, where n should be a negative integer)
    
    Allow log output to be sent to a file other than /tmp/c_log.dat (with --log_filename ... )
    
    Update 19/07/2006 1.2pre22 (RS NeNa)
    
    NUCSYN_WR_RS_TABLE is now implemented. At present this only gives Richard's Ne22 and Na23 abundances for massive stars, but eventually should give you all the isotopes....  
    
    Update 11/07/2006 1.2pre21 (Arlandini)
    
    Introduced NUCSYN_HETEROGENEOUS_HE_STAR which deals with heterogeneous layers outside the CO core (in the helium envelope) at the time of explosion. This is probably not worth including at present as it is (very?) poorly implemented.
    
    Split the CL04 SN yields into those with and without NUCSYN_CCSNE_CHIEFFI_LIMONGI_2004_PORTINARI defined. If with, then the yields from the CL04 paper are used with the Portinari method. If without, Chieffi's yield tables (yields as f(mass cut)) are used directly. This is, of course, much better, but I am still waiting for the yield tables (I have elemental yields, but need isotopic yields).
    
    Slightly improved the interpolation table for intershell abundances.
    
    Calibrated HBB for M=6 Z=0.0001 (now in the table, see 1.2pre19).
    
    Added the option of using Simmerer 2004's r-process yields instead of Arlandini: Choose one of NUCSYN_R_PROCESS_SIMMERER2004 and NUCSYN_R_PROCESS_ARLANDINI1999.
    
    Update 21/06/2006 1.2pre20 
    
    Fixed a quite serious bug in the Chieffi/Limongi SN yield code, where the lookup table was not properly regular. The results were indeed SN yields, but I'm not sure how it worked or whether the correct SN was looked up each time. I fixed up the Portinari method code a bit too, and re-rectangularised the table. It has now been quite thoroughly tested and should be ok. Should be. hmmm. 
    
    Update 19/06/2006 1.2pre19
    
    Improved the calibration of HBB (see below for reasons why): in addition to the usual rise time, burn amount and burn time, the temperature is tweaked a little. However, the changes are really small indeed, and the best fit almost always a multiplication factor of 1.0 (together with the reduction of 0.2% which I had already put in 'by eye'). You should NEVER have to recalibrate the hot bottom burning again... until next time. :)
    
    Update 18/06/2006
    
    Minor change for gcc4.0 : changed CONST_FUNC macro (but left the old one there, in code_options.h, just in case you need it)
    
    Changed ./configure to remove gcda, gcdo and .da files in */* (used to be just *, oops)
    
    Update 1.2pre18 (new DUP tables, Al26m)
    
    Fixed the tables of dredge up material from Amanda - for some unknown reason these were wrong. The difference isn't huge, but I'm going to recalibrate the HBB anyway.
    
    Put Al26m into the code. The difference is very small, even at high mass and low metallicity.
    
    Update 1.2pre17 (novae from tables) 12/06/2006
    
    Nova yields are now interpolated directly from Jose/Hernanz 98's table.
    Reduced temperatures by 0.2% to better fit Amanda's models' Mg24 and Al26.
    
    Update 1.2pre16 (C13 pocket size fix) 12/06/2006
    
    Axel's C13 pocket size correction was being applied to ALL the intershell 
    abundances, which is simply wrong. Fixed.
    
    Update 1.2pre15 (all s elements) 08/06/2006
    
    All s-process elements are now taken from an interpolation table.
    This is defined with NUCSYN_S_PROCESS_V4 in nucsyn_parameters.h 
    
    Update 1.2pre14 (new WR/s tables) 04/06/2006
    
    Added the to s-process table some extra elements (Kr,Sr,Y,Zr,Ba,La,Ce,Nd,Sm,Eu,Pb). I made these tables for Axel a while back, but forgot to put them in the main branch. These override the previous fits, and should be far better.
    
    New: replaced nucsyn_WR and all its hacks with a big lookup table of Lynnette's results for the MM and NL mass loss rates, replacing months of work with two tables! It's pretty fast, of course, and much, much more accurate. I still have to look into putting the minor isotopes in (e.g. C13, the Ne20/22 split, Na23 etc.) and fixing it up for He stars, as Lynnette's helium stars are not quite the same as Jarrod's. 
    The new function is nucsyn_WR_table, called from nucsyn_WR. The old code is there too, of course.
    I also have to work out what will happen in the case of low-mass helium stars... these will probably have to be dealt with using the old-style code in nucsyn_WR, as Lynnette's models cannot possibly deal with them.
    
    I will be looking to put Richard Stancliffe's detailed nucleosynthesis results into the WR code for massive stars, first for Ne22/Na23, but later for all isotopes.
    
    Added NUCSYN_FORCE_DUP_IN_COMENV which forces first/second dredge up in giant envelopes in a common envelope phase. In this way either yields are correct (and we don't care about the incorrect surface abundance, as the phase is short) or we assume the secondary spiral in process mixes the envelope.
    
    Update 31/05/2006 1.2pre13 (hbbtmax fix)
    
    Capped masses in nucsyn_hbbtmax function to prevent problems when
    binary interactions (HeHG + MS comenv -> TPAGB of 13 Msun!) give
    a very large (1.35msun) core, which leads to unfair extrapolations
    
    Update 30/05/2006 1.2pre12 (small AGB core fix)
    
    In some cases (binaries) the core on the AGB was bigger than the mass, 
    so it was automatically reduced. Removed this, as this is a valid result.
    Also made sure that Amanda's mc1tp fits cannot be used outside of the 
    range of the fit, this is more stable (no problem at low mass, but at M>7
    might be unphysical?).
    
    New: lambda_ce option on the command line. If this is unset (or set to -1.0, the default) lambda is automatically chosen in the celamf() function. If it is set to a positive value then this value is used for lambda (i.e. it's constant) as in the old code.
    
    Update ??/05/2006 1.2pre11 (low mass HeWR fixes)
    
    Fixed nucsyn_WR to deal better with low-mass helium stars
    
    Update 01/05/2006 1.20pre10 (AGB low mass/low Z L fix)
    
    Version changed, luminosity bug fix (affected low M and low Z models)
    
    Update 21/04/2006
    
    Version changed to 1.20pre9 (Ne22/WR fix)
    
    Update 20/04/2006
    
    Added a CALCLAMBDA in nucsyn_third_dredge_up to make sure lambda is not zero on the first pulse.
    
    Update 11/04/2006
    
    New function: reset_reaction_rates. This sets all the rate multipliers to 1 (useful!).
    
    Update 10/04/2006
    
    Put checks in nucsyn_WR to force surface hydrogen to be >=0 (it was -1e-6 due to floating point errors), and helium etc.
    
    Update 08/04/2006 (saturday morning urgh)
    
    Fixed core collapse function so it doesn't fail for low CO core mass (e.g. MCh) which can happen in binaries. OK, so it's not correct, but we have no models for this core mass! And at least it gives positive yields...
    
    Update 07/04/2006
    
    Introduced MINIMUM_ENVELOPE_MASS_FOR_THIRD_DREDGEUP to prevent third dredge up at low envelope mass (it's set to 0.1, but we don't really know what it should be).
    Reordered the new stuff in binary_yields, so it now works properly (I think!).
    
    New NUCSYN_LIMIT_SN_TYPES : if you enable this (and do a complete rebuild, as it changes the size of the preferences structure) then you can prevent certain types of supernova (defined in sn.h) from yielding to the ISM by '--disable_sn_type <n>', where n is the supernova type.
    To apply this to gce.pl, use (e.g.) "extra='--disable_sn_type\ 11'" as an argument to the script.
    
    Update 06/04/2006
    
    Added nucsyn_r_process.c, which gives you r-process abundances based on Arlandini et al 1999's subtraction of the s-process isotopes from the solar abundances.
    
    Update 04/04/2006
    
    Changed the way GCE works: I now output DX yields rather than X yields (this is much faster).
    Reverted dgcore to the old code, the new code was broken and was causing hangups all over the place.
    
    New options:
    
    Now AXEL_RGBF_FIX should be enabled BY DEFAULT. This is Axel's excellent fix for the old (dodgy) ragbf and rgbf functions, which gave silly answers at intermediate metallicities.
    
    New options comenv_ns_accretion_fraction and comenv_ns_accretion_mass (and associated macros COMENV_NS_ACCRETION_FRACTION_DEFAULT COMENV_NS_ACCRETION_MASS_DEFAULT) allow you to accrete mass on a star inside a common envelope. Nice! (For Enrico's stuff)
    
    You can use NS_BH_AIC_LOG to track accretion induced collapses of neutron stars.
    
    DETMERS_LOG enables you to track the systems which Rob Detmers is simulating with his 'proper' code.
    
    Defining LOG_TO_STDOUT prevents output to /tmp/c_log.dat and sends everything to stdout.
    
    C13_POCKET_CORRECTION is a correction for dealing with the size of the C13 pocket and of the intershell in Maria's tables. You can define the mass of the C13 layer (relative to the intershell region) with MC13_FRACTION (default = 1/20)
    
    
    
    Update 27/03/2006
    
    Fixed the GRB_PROGENITOR macro in stellar_types.h (which has been buggy for how many years? shows how much I used it! i.e. NOT AT ALL! LOL)
    Define DETMERS_LOG to show post-comenv output for Rob Detmers' stars.
    
    Update (saturday) 18/03/2006
    
    Fixed a bug in celamf (was lam2 *= lam2, should have been lam2 *= 2.0)
    Removed the tau<0.0 check in hrdiag - it seems tau *can* be <0 and it's ok (???)
    
    Update 17/03/2006
    
    Fixed a bug in calc_intrinsic_spin where tflag was not being set.
    
    Update 06/03/2006
    
    Added Van Loon's 2005 mass loss rate formula for O-rich AGB stars and red supergiants as option 4 in --(s)tpagbwind.
    
    Update 02/03/2006
    
    Profiling work is coming on slowly (lots to do!). Many silly bugs have been fixed. Introduced new function nucsyn_intershell_thickness, which gives the thickness of the intershell, or rather doesn't, but allows you to put this in by hand later!
    Added extra checks to second dredge up abundance call in init_first_pulse, to mimic those in hrdiag. It's weird that this hasn't caused problems before... but it's fixed now.
    
    Changed the nucsyn_mix_in_to to add an overshoot parameter, which if FALSE does NOT mix the last shell.
    
    
    Update 24/02/2006 1.20pre8 nucsyn_profiles
    
    Added abundance profiles. Currently the following functions work with profiles:
    
    common_envelope_evolution
    update_masses
    nucsyn_update_masses
    mix
    first, second dredgeup
    tpagb functions
    
    and the following do not
    
    supernova functions
    
    but I am working on it! All stars are given a profile from a 4Msun, Z=0.02 star at present, but Amanda is sending the new data.
    
    There is a whole set of functions to add and remove mass from the surface of the star, and do the appropriate thermohaline mixing. 
    I have written up the new functions in new_functions.lyx, which I can make available.
    
    Update 01/02/2006 1.20pre7
    
    First dredge up now uses a table based on Amanda's models (much more reliable).
    
    Completed fits to Arend Jan's models (as available to date: 8.5, 9, 10 Msun, there are high masses but with too little data to be reliable - yet!) for STPAGB stars. These have fitted: mc1tp, mcbagb, HBB parameters (TBCE, rhoBCE), radius, luminosity. HBB free parameters have been calibrated to surface abundances as best I can, but it's one hell of an extrapolation!
    
    Added new option --no_supernova_yields, this disregards yields from supernovae (e.g. if you're in a globular cluster, you don't want SNe as the ejecta are too fast and will escape).
    
    Update 03/01/2006 1.20pre6
    Updated table of intershell abundances to include all of Amanda's Z=0.0001 models.
    
    Update 15/12/2005 New version : 1.20pre5 (New SNe)
    Chieffi/Limongi yields are now fully implemented: you can choose 
    to use CL04 yields with NUCSYN_CCSNE_CHIEFFI_LIMONGI_2004, or use woosley/weaver with NUCSYN_CCSNE_WOOSLEY_WEAVER_1995. Take your pick! The differences are not huge, but C12 is slightly higher, O16 slightly lower, Fe56 slightly lower, and Else slightly higher. 
    
    Update 14/12/2005
    Updated nucsyn_sn_yield to allow WW95 or Chieff/Limongi2004 yields, although the CL04 table is not ready yet. Split nucsyn_sn_yields.c into lots of smaller functions (all prefixed with nucsyn_sn) and changed all the ifs to a case switch, mergered some identical cases and cleaned up a bit.
    For Z<1e-4 (set with gce_metallicity>=0 but <1e-4) the Umeda/Chieffi yields are now computed.
    
    Update 11/12/2005
    Bored in Brussels. Lots of minor fixes to prevent icc complaining. These helped remove old useless variables.
    
    Update 10/12/2005
    Fixed a bug in mix() and hrdiag() which caused a lock-up when a WD star of high mass (1.2) accretes matter and merges with a MS star to become a new TPAGB star. This fix prevents the age from being less than the tpagb star time for any AGB star (EAGB too) which seems reasonable. It also resets the TPAGB parameters when the mix happens. This might not be physical, but it prevents the code from locking up!
    
    Update 09/12/2005
    Fixed a really nasty bug with binaries and nucsyn_tpagb not setting the radius if dt<0 (i.e. RLOF) by putting a CALCRAD before the if(dt<0)return in nucsyn_tpagb.
    Fixed the code so the recent changes do not crash it if NUCSYN is not defined.
    Added NUCSYN_CEMP_LOGGING to test for CEMP stars. Yay for my project :)
    Fixed a big in nucsyn_update_abundances where the surface abundance was being reset for post-MS stars. oops!
    
    Update 08/12/2005
    
    Fixed a nasty memory overwrite bug in interpolate().
    Fixed the decay isotopes for intermediate mass isotopes (up to Ge71) so that unless beta decays are dealt with explicitly, all the unstable isotopes are assumed to decay instantly. This is reasonable for SNII explosive yields, for example. This *was* done previously, it's just that I made up the product nuclei, now they are accurate :-)
    
    Update 06/12/2005
    
    New: tabular fits to WW95 supernova data, for A,B and C models. These replace the old fits. Define NUCSYN_SUPERNOVAE_USE_TABULAR_WW95_MODELS and NUCSYN_SUPERNOVAE_CC_WW95_A (or B,C) in nucsyn_parameters.h. If NUCSYN_SUPERNOVAE_USE_TABULAR_WW95_MODELS is not defined, the old fits will be used.
    
    New: --gce_metallicity is the metallicity of the gce model. This is useful, because you can set gce_metallicity < 1e-4, and it will be passed to (say) the supernova yields function(s) which can use the lower metallicity. Of course, most of the evolutionary code will fail at Z<1e-4, hence gce_metallicity is separate from the normal metallicity.
    
    Update 05/12/2005
    
    Fixed a bug in mix_shells when m1<TINY (no long happens). Replaced mrenv with the old version, I must improve it at some point. Also fixed a few other random bugs regarding function prototypes which nobody cares about (not even the compiler, unless you enable debugging! ARGH!).
    
    New scripts: 
    
    test_tbse.pl tests your build of binary_c/nucsyn against some default results (they should be the same) and tells you if something is wrong. Note that this requires you have tbse_test.h (should come with the code) which is used instead of the normal configuration files (so the configuration is fixed c.f. the one I am using for testing, otherwise of course the results will be very different!). To use the tbse_test.h enable TBSE_TEST by running "./configure tbse_test" (DO NOT enable it in a file!).
    
    tune_compiler_flags.pl tests the flags available for your C compiler (currently gcc or icc) and determines which you should use for optimum performance on your machine.
    
    Fixed binary_parameters.h so that if you define RATES_OF_MARIA the appropriate other flags are set for the reaction rate variation project (I kept forgetting... oops).
    
    NOTE: gcc is still the main development compiler and you should make sure any code you add does NOT gives warnings with gcc. With icc you'll get all sorts of crap output with -Wall, just ignore it as long as the code works, or disable the warnings with -wd<n> where n is the warning number.
    
    ************************************************************
    
    Update 04/12/2005 : new version 1.20pre4 (ultrafast)
    
    Fixed Fe56 bug at the expense of some radioactive decays of Fe60 and Co59. If you want these then you'll have to alter something... but who cares about Fe60?! :)
    
    MANY improvements to the configure script, esp. for support on pentium(-m) and the old ibook (750). icc support has been improved, I have even put in code to force the use of Intel specific code on AMD64s, which makes the code MUCH faster with icc on AMD64 (as fast as on an equivalent pentium, at least! though still 32 bit... dammit!).  BEWARE!!! Enabling this feature means that icc is generating code for a pentium 4 with all the intel-specific enhancements such code should have, which *** MIGHT NOT WORK *** on your AMD64 CPU! Turning off this feature means your code will be faster with gcc (and -ffast-math). Check code_options.h for the details, or ./configure (FOOL_INTEL_COMPILER is defined to make the code fast on AMD64, FAKE_INTEL_CPU_INDICATOR is either 1024 or 512, depending on whether you want to emulate a pentium-m or Xeon. I have no other test machines... yet!)
    Also loads the intel math library (libimf) for icc on pentiums (we use acml, AMD's offering, on AMDs if available, as it seems quicker).
    
    Enabled -ffast-math in the configure script, for gcc. This seems to change nothing (except speed the code up by ~30%!) but I suppose it might break floating point stuff somewhere. Let me know if it causes you trouble (and try to find the location in the code where it does, I'd rather fix the code than remove -ffast-math as binary_c is really a lot faster with it!).
    
    Fixed the ktype array definition, the last line was wrong? Fortunately it was being set by the instar function, so it didn't matter. But since instar sets a load of constants, I have put the numbers in a constant array instead (see ktypes.h) which is what used to be done *as well*. How pointless! To enable the old instar code just define OLD_INSTAR. But please don't.
    
    Made lots of functions constant, but if you're making new functions PLEASE follow the c99 definition of a constant function. Please use CONST_FUNC, not "const", as different compilers use different definitions (well, icc and gcc, then different versions of gcc!). CONST_FUNC is defined in code_options.h, with a different version for each compiler.
    
    Made many passed-in structures and arrays RESTRICT type. See the C99 definition of __restrict__ (it's in gcc and allegedly in icc). If you have trouble with this, or don't know what it means, then go and look it up!
    
    New macros in binary_macros.h : IS_ZERO and IS_NOT_ZERO to test if a number is zero (or rather fabs()<TINY, but without the fabs), ABS_MORE_THAN, ABS_LESS_THAN, ABS_MORE_THAN_OR_EQUAL - these replace fabs(x)>(=)y etc. without the fabs. fabs is really slow so I have removed calls to it wherever possible.
    
    Introduced macros POW2(x) and POW3(x) for pow(x,2.0) and pow(x,3.0) so you can experiment with replacing pow(x,2.0) with x*x (probably quicker) and pow(x,3.0) with x*x*x (maybe quicker! on icc about the same, on gcc much quicker).
    
    Update 01/12/2005
    
    Fe56 is still <0. Weird.
    Improved the interpolate routine again
    1) Instead of one cache there is now a cache for each table, denoted by their table_id. The width of each cache (and the results cache) is now allocated dynamically, as it is different for each table. 
    2) Searching has been improved so instead of checking each line of data we now skip when it's sensible to do so (enable CLEVER_SKIPS). This should be faster, especially on large tables, though there is some overhead if you're just running the code once.
    Fixed set_up_variables so batchmode works again. 
    
    Update 30/11/2005
    
    Segfaults should no longer happen, as I have reorded the calls to set_up_varialbes and initialize_parameters. The set_up_variables call comes first, as it should, but calls initialize_parameters for you.
    There's a new header file, code_options.h, which has the options specific to the code but not to the physics.
    Cleaned up set_up_variables a bit :) Removed lots of old adaptive grid stuff which was commented out anyway.
    Still the code crashes with Fe56 < 0 (just compile with DEBUG). No idea why...
    Introduced a cache into the interpolation routine. This speeds up the code by a factor of two.
    
    Update 29/11/2005
    
    More code improvements: AMD provide a guide to optimization of code for their CPUs, and doubtless most of the tips in the guide apply to other CPUs. So I have rearranged binary_structures.h to put doubles, then ints, then Booleans, which is the recommended order (this saves a few bytes). Boolean type has been changed to unsigned int. I hope this doesn't break too much, but Booleans should be TRUE (1) or FALSE (0) and nothing else! So it *should* be ok. I will do this for functions today as well.
    
    I have put the distributed_kick routines behind the DISTRIBUTED_SN_KICKS macro (in binary_parameters.h) - this reduces code size a bit.
    
    configure now sets the -DATHLON flag for athlon-specific optimizations, if there are any (not yet...)
    
    Redefined FEQUAL macro to FEQUAL(A,B) (((A)-(B)<TINY)&&((B)-(A)<TINY)), which is four times faster than the old fabs call macro. (YAY!)
    
    The interpolate() function is now optimized as much as I can. That was fun... :) It's certainly a lot quicker than it was, at the expense of code legibility.
    
    Fixed segfaults with a non-static build! Introduced initalize_pointers (currently in main, but i'll move it) to set all pointers to NULL on first run. Also put in a memset for the stardata memory space, as that requires initialization. In fact this could be improved, as some things (which are not set on the cmd line) are not set prior to set_up_variables being called. Clear that up tomorrow!
    
    Update 28/11/2005
    
    Added NUCSYN_QUICK_SIGMAV: this prevents the sigmav array being set unless the temperature (T9) changes by >=0.05. Hopefully this will speed things up.
    Some minor changes to the burning codes, specifically to use the TIMESCALE macro wherever possible, and to speed up execution a little. Hopefully...
    Reinstated "-Wall" into configure... and cleaned up the code to remove most warnings.
    Removed the population synthesis code from set_up_variables (it was commented out anyway!)
    The configure script now determines if you have AMD's acml installed (in /opt/acml<version>/ - versions 2.7.0 and 3.0.0 are supported). If you do, it will use it to override certain functions which are optimised versions of the gnu math library. 
    Profiling in gcc(3.4.3): run './configure profile' to do the configuration, profiling etc. for you and just use the executable it gives back. Note: this mode is NOT useful for debugging! You should debug your code *without* profiling support.
    NOTE my experiments show that the *combination* of profiling and the AMD library can reduce runtime by 10%! Either *alone* is not much better.
    I have put all memory allocation checks behind the ALLOC_CHECKS macro, so you can disable them in order to get some more speed.
    The stardata structure has been reorganised to save space (all Booleans, ints etc put together, and all doubles put together : this improves alignment in memory).
    All references to MEMMAP and memlog have been removed because nobody uses this anymore and it's undocumented. This reduces the stardata structure size from about 1MB to 7kB!!!
    Use of gprof (compile with -pg) shows that most of the cost runtime is in the interpolate function, so I have optimised that a bit more, but note that it's still "slow".
    Tried to use __restrict__ pointers to the interpolate function. Doesn't seem to make much difference! Dammit!
    
    Update 21/11/2005 New version 1.20 pre3 (it needed an update)
    
    New IPOD compilation flag. Oh yes. Configure for an ipod build with "./configure ipod" (requires the arm-elf-gcc compiler and associated toolchain).
    Removed the debugging directory: who uses that old crap? nobody, that's who.
    Removed the global variable "indentation" and some others that are not used much. The only (?) global variables that are still in main.c are the HBB calibration variables. These are only active now if NUCSYN_CALIBRATION_LOG is defined. 
    Remove SMS option (free text messages no longer exist).
    Moved global batchmode variable into the preferences struct where it belongs, and moved all the batchmode stuff into BATCHMODE macro #defines, so you can remove it to make the code shorter.
    Did I mention that I make the intershell abundances fit to Amanda's data table? Well I did. It seems to work well.
    Removed EXACT_M6Z004_FITS related material, this is no longer required.
    Updated nuclear decays to include all the beta- and beta+ decays I have listed, and alpha decays as well. Nice!
    
    ------------------------------------------------------------
    
    Update 18/11/2005 
    Silly update blog continues.
    Added all s-process *isotopic* fits. The executable is now 19MB! Enable this with NUCSYN_EXTENDED_S_PROCESS. Nice :) But there are some NaNs! Ah. Fixed the NaNs. 
    *** WARNING: some of these isotopes may suffer from radioactive decay during the interpulse period. I will (eventually) find a way of including this, but at the present time note this is NOT fixed and IS an error.
    
    ------------------------------------------------------------
    
    Update 17/11/2005
    This is becoming like a diary of doom!
    The s-process fits have been updated again to include zirconium (Zr) which was supposedly dodgy. 
    nucsyn_set_sigmav.c has been cleared up a little bit regarding choice of nuclear reaction rate set, it should be quicker now at least. The reactions which are only relevant to pp, He3, Li (etc) burning have been moved inside NUCSYN_He3_BURNING macros, which are NOT defined.
    Updates for the STPAGB code: a small fix to the nucsyn_mc1tp function so it works again with STPAGB stars (at least at solar metallicity). In preparation for Arend-Jan Poelarends STPAGB fits, I have put all the old Iben/Garcia-Berro etc. fits into macros NUCSYN_STPAGB_IBEN, and AJ's new fits will be in NUCSYN_STPAGB_POELARENDS. You still need NUCSYN_STPAGB to be defined for this to work.
    I am also recalibrating the HBB code. News to follow...
    
    ------------------------------------------------------------
    
    Update 16/11/2005
    
    I have improved the calculation of hydrogen burning (affects only H1 and He4, which are *mostly* changed by DUP anyway) in nucsyn_burn (the analytic version), it's now roughly correct (before was completely wrong!).
    hrdiag has been changed to check if an AGB star has XH1<0.01. If so, it is converted into a (post-MS) helium star. This can happen in the case of a HBBing AGB star in a binary, with a small core and massive envelope. The surface abundances are, of course, wrong as it's not a "normal" He star (which would fit the models from Lynnette) but it's hard to fix this as there's going to be loads of nuclear burning going on and maybe mass loss too. Anyway, at least the code doesn't lock up like it used to!
    Speculation: I will try to fix overburning of Mg24 in M6Z0.004 star. It's weird and not a fault of the burning scheme (as I first suspected) rather the calibration (done with CNO only) might be wrong. I am a little worried that at high temperature we will require the Al27(pa)Mg24 reaction. I hope not though...
    
    ------------------------------------------------------------
    
    Update 15/11/2005
    Wrote an iterative burning scheme (for HBB) so you can test my approximate scheme. It seems my approximate scheme is very good and very fast :-) However, the approximate scheme will fail at logT=8.2, perhaps in STPAGB stars, where hot CNO (and maybe He burning?!) will take place in the envelope. On the other hand, the iterative scheme is completely flexible, indeed the reaction network is generated by a perl script "make_reaction_net.pl" (the output is sent to nucsyn/nucsyn_reaction_network.h which is then just incorporated into the code). The solution method is explicit: though I tried an implicit version it was not quicker and was definitely more complicated. The new method does calculate the amount of hydrogen burned in a much better way than I did before (which is really dodgy, to say the least!). F19 does not get burned enough. Weird!
    
    Improved the s-process fits with the newer models from Maria. Note that in order to have these fits the size of the executable has increased to 1MByte when no optimization is used! This will not do! :) Perhaps with -O3 it is smaller... well, 800KB. Hmmm.
    
    ------------------------------------------------------------
    
    Update 14/11/2005
    
    Change deltat.c to check if stars have had > 1000 thermal pulses. If they have, then the timestep is increased by a factor of 1000. Why? With a 6.9+6.5 Msun binary (P=100d) I found that a ~12Msun star formed with the core of the 6.9Msun star. This leads to a TPAGB phase that is 4Myr long, with ~6e8 pulses! The grid assumed that because this took >30 seconds to run (no surprise!) it had crashed. It hadn't! With the speedup after 1000 pulses the evolution is very quick and the result is almost identical.
    
    ------------------------------------------------------------
    
    Update 08/11/2005
    
    Improved s-process fits for the key elements Ba, Y, Pb and Kr. Instead of my old (dodgy, broken) fits, it now interpolates a table made from Maria's data (Gallino's models). See interpolate.c (new function) a general n-dimensional interpolation function which I anticipate using a lot in the future.
    Added SMOOTH_AGB (changes due to Axel) to smooth the transition from the EAGB to the AGB (defined in binary_parameters.h). Axel is responsible for maintaining this part of the code :) Note that you cannot use SMOOTH_AGB with AXEL but you shouldn't need to (if you try to then SMOOTH_AGB will be undefined).
    Removed the "old" directory, so the adaptive grid has gone (haha, it was crap anyway).
    "grid.pl" now uses my Perl modules (see ~/progs/perl) so it is much smaller, faster (?), more efficient for coding.
    
    Also, I have made a new script "test_yields.pl" which just makes a plot of the yield of each isotope as a function of metallicity. It's very simple, but a good test.
    
    ------------------------------------------------------------
    
    Update 27/10/2005
    
    Improved mc1tp from Amanda's complete set of Z=1e-4 models. However, this lead to an instability in the way we calculate mc1tp, so I have changed the interpolation method to avoid this. The new method is at least as correct (at the metallicities we have, 0.02,0.008,0.004 and 1e-4) and more stable. I also applied this method to mcmin_for_dredgeup, just in case that gets unstable when interpolating.
    
    ------------------------------------------------------------
    
    Update 19/10/2005
    
    Added NUCSYN_STELLAR_POPULATIONS_ENSEMBLE, a better way of outputting rates and numbers of types of stars for as many types of star at a time as possible. This works with gce.sources.pl V1.4, as well as the latest yields_vs_time.pl (V1.4).
    
    ------------------------------------------------------------
    
    Update 17/10/2005
    
    Fixed bug in calc_intrinsic_spin, it was
    f = MIN(1.0,(ttid/pow((2.0*tc),2.0)));
    but should read
    f = MIN(1.0,(pow(ttid/(2.0*tc),2.0)));
    
    Added NUCSYN_ENSEMBLE stuff in the gce logging, so you can now follow an arbitrary number of different stellar populations in GCE. Nice! :)
    
    ------------------------------------------------------------
    
    Update 01/10/2005
    
    New features:
    
    NUCSYN_ID_SOURCES has been extended, so the old version (for cumulative yields as in my thesis) is NUCSYN_ID_SOURCES_OLD_METHOD. You can use the new gce.pl script to do the same as a function of time in a galaxy model (cool, eh?) by enabling NUCSYN_ID_SOURCES_GCE (and NUCSYN_ID_SOURCES).  The source definitions are the same as before (see nucsyn_macros.h).
    
    Fixes for fedora core 4 build:
    
    Fixed configure script to look for lib64 libraries for 64-bit athlon (non-opteron) processor, and to implement -march and -mtune for gcc4.0 (it wasn't working properly before, oops!).
    Fixes for static functions in gcc4.0 (had to move declarations).
    Removed the adaptive grid library and associated variables (they're commented out, at least), you shouldn't be using it now. In order to avoid errors on compilation, you must either
    1) remove the adaptive_grid/ directory completely
    or
    2) Try "mkdir old; mv adaptive_grid old/" (which keep the old crappy code)
    
    Note you'll have to "./configure; make cleanall; make" because I have removed some items from the preferences struct (it's best to do this every time I update the code!).
    
    I plan to revamp the set_up_variables function at some point, so beware!
    
    Another fix: made TINY =1e-10 to prevent other lockups :(
    
    ------------------------------------------------------------
    
    Update 27/09/2005
    
    Finally I am in Utrecht!
    
    Some fixes:
    
    Updated the configure script, it's much simpler now. Please test it!
    
    Fixed a bug in calc_lum_and_evol_time, it wasn't exiting for He stars when it should have. Hopefully this wasn't too important.
    
    Changed TINY to 10* the floating point error. Sometimes the old TINY was not big enough, so numbers which were equal failed the MORE_OR_EQUAL macro (and the others). 
    
    Introduced max_EAGB_He_core_mass in the star_t struct. This follows the size of the helium core on the EAGB (rather than the CO core) so the region which is helium (with some N14) between the CO core and the hydrogen envelope is treated properly during core collapse supernovae. This increases the He and N14 yields, at the expense of H1 and CNO. The fit from gce.pl to the sun is now better.
    
    Improved the nucsyn_WR fits to the terminal abundances from Lynnette. You should now be able to make WO stars.
    
    Improved the core-collapse SN homogeneous/inhomogeneous envelope fits for helium stars, based on pre-SN models from Lynnette. This requires the variable he_mcmax in star_t, which is an estimate of the CO core mass in the helium star at the end of the HeMS. 
    
    New features
    ************
    
    NUCSYN_GCE can be enabled to give you suitable output for the gce.pl and yields_vs_time.pl scripts.
    
    NUCSYN_STELLAR_POPULATIONS gives you output for the stellar populations part of gce.pl. To determine for which population you want to output distributions, enable one of the NUCSYN_STELLAR_POPULATIONS_... macros (see nucsyn_parameters.h). 
    
    NUCSYN_GCE_SN_RATES gives you SN rate output for gce.pl
    
    NUCSYN_PRESENT_DAY_ABUNDS enables special output for a time defined as "the present day" (see gce.pl for details) so you can make an HR diagram of the galaxy as we should observe it *now*. This is really cool. In the case where your resolution is low (it always is, compared to reality, so you want this) you can select NUCSYN_PRESENT_DAY_PERIOD to be, say, 1Myr, and results will be averaged over a Myr. This is useful because otherwise you get very few AGB stars as their lifetime is of the order 1Myr. Note the present day time is set by --present_day (passed in on the command line).
    
    NUCSYN_GCE_OUTFLOW_CHECKS and associated macro settings enables gce.pl to lose mass from a galaxy if the wind velocity of a given star is higher than some reference value.
    
    NUCSYN_GCE_MIN_TIMESTEP is a useful tool for setting the minimum timestep. This is not really required, as yields_vs_time.pl will interpolate for you anyway, and this can be overriden (by gce.pl for example) with --minimum_timestep on the command line.
    
    NUCSYN_MERGER_DREDGEUP enables some carbon to be dredged on WD-core mergers in common envelopes, used to make R-stars.
    
    NUCSYN_ROTATION_EFFECTS and associated macros (set on command line with --nucsyn_rotation_effects, --nucsyn_rotation_effects_critical_Z, --nucsyn_rotation_effects_asymptotic_N14) set the surface N14 abundance to that given for lower than the critical Z. Useful to model rotation effects in massive stars.
    
    If FORM_STARS_AT_BREAKUP is defined then stars are given their Keplerian break-up velocity at birth. 
    
    SELMA gives you Selma's output.
    
    LOG_JJE outputs stuff for John Eldridge.
    
    JJE_FUDGES fixes the code a bit so it works better compared to John Eldridge's modified Eggleton code.
    
    NUCSYN_LOG_JL is not really working yet.
    
    ------------------------------------------------------------
    
    Update 21/03/2005
    
    A new era in 64-bit computing blah blah blah ok so I have no idea how to make the libraries work in this 64-bit environment. I have set the configure script to use "static" mode by default. 
    Fixed the bug in random_number.c because it seems that on a 64-bit machine it *does* matter... 
    Updated the NeNa burning so it solves for the matrix properly and deals with imaginary solutions in a simple (almost correct) way. This is much better than it was before!
    Extra stuff for varying reaction rates, and I have put in Amanda and Maria's reaction rates. You can choose which you'd like in nucsyn_parameters.h.
    Moved the header files around a bit. For example nucsyn.h has now become (mostly) nucsyn_parameters.h. This is much better (honestly).
    Enabling DEBUG seems to cause problems, I haven't fixed this yet but who ever enables DEBUG for the entire code?!
    
    ------------------------------------------------------------
    
    Update 10/07/2004 : Version 1.2: batchmode, STPAGBs, RS's fits, bug fixes
    
    Introduced "batchmode" to run one binary_c process for many stars (avoids the overheads of execvp). The "grid.pl" script is this directory (now included in binary_c.zip) should be used to run a grid of stars and process output on the fly. It is *very* efficient at this (being Perl) and saves you a factor of 4-10 on the previous grids. USE THIS! IT'S GREAT! (works a treat for GCE with gce.pl) The old grid will probably be removed for 1.3 - I have no intention of maintaining it.
    
    There are some bugs which cause the code to freeze (due to the TPAGB radius function I suspect) at some grid points. I am looking into this but cannot promise a fix in the near future. Axel and Onno might have some ideas (?) and we'll come up with something better. The code used to time out (and so the grid would continue) but that is not implemented with batchmode (yet?). It is, of course, better to fix it.
    
    Note that there are two radius functions: an analytic fit and the tabular based fit. The tabular version is more "accurate" since it is correct at each mass/metallicity but outside the fitted mass/metallicity range (and sometimes when interpolating!) it's not great. More work should be done on this.
    
    STPAGB stars : Enable NUCSYN_STPAGB in nucsyn.h. You probably don't want this enabled because the fits are based on work from the models of Garcia-Berro et al using the Iben code which we do not trust. Perhaps that's better than nothing?! Note I have not tried these stars in binaries: probably something will break! Anyway, this work is for a paper which will not be submitted for some time to come, perhaps you'd like to help with it?
    
    There are fits to Richard Stancliffe's LMC and SMC metallicity TPAGB initial core masses, core masses at first dredge-up and dredge-up efficiencies. Please don't use these without citing his work!
    
    The s-process fits have been improved: they are now have half the RMS error that the previous fits had. Nice!
    
    Changed superwind_mira_switchon to tpagb_superwind_mira_switchon so we can incorporate the STPAGB mira switch on.
    
    "spiky_luminosity" is a new variable for each star. It follows the luminosity that results from modulating for the thermal pulses (i.e. dips at each pulse). Handy for CSLF calculation. Everything else breaks if you use it as the real luminosity because it is has steps (infinite gradient!) in it. OOPS!
    
    hrdiag, calc_lum_and_evol_time etc. I have relabelled the array members with macros so they are more readable. The TPAGB luminosity function checks that Lenv and LCMLR are > 0 (and sets them to 0 if not!). It has been doing this for ages in my code but apparently not in Axel's (?)
    
    metallicity_parameters[11] and [12] (the hydrogen and helium "abundance"s) are now replaced by calls to the appropriate star's actual hydrogen and helium abundance if NUCSYN is defined. This affects the Eddington luminosity calculation and the rdgen call in hrdiag.
    
    Axel has improved the luminosity transition from the EAGB to TPAGB. It is now much smoother and we have a CO core mass properly defined on the EAGB. Also, for those of you that prefer to use overshooting models a new way of defining mc1tp (the core mass at the first thermal pulse) has been derived which uses Amanda's models when we (or rather Axel and Onno) believe them. Axel warns that his luminosities may not be valid for M>5.
    
    Axel's changes are enabled with the AXEL flag, defined at the top of binary_parameters.h. You should use this (it is defined by default). The changes, if deemed successful, will be merged into V1.30.
    
    ------------------------------------------------------------
    
    Update 18/02/2004
    
    Not many changes due to thesis writing and moving house.
    One nasty in nucsyn_WR fixed (x should be between 0 and 1 before y is calculated, sometimes x was -1e-10 or so and this caused nans).
    
    Introduced sdB checking code so I can work with Simon Jeffrey.
    
    random_bse.pl script now makes random binaries in order to test the code.
    
    Update 24/10/2003
    
    Some nasty bugs have been fixed:
    
    Fit for Ne20 change at 2DUP diverged for low Z, Z is now capped at 0.004 just in case.
    
    There are now two thermal pulse counters, num_thermal_pulses and num_thermal_pulses_since_mcmin, which should do dredge-up more accurately than just one. The difference seems to be minimal :(
    
    The most evil of bugs in the analytic NeNa burning code: to solve for the abundances a cubic must be solved. Usually there are three real roots, but in the case where there is one the real parts of the other two used to be used (and the oscillation ignored). This didn't work in one case and just gave NaNs. So now the burning is skipped (usually just for one timestep!) until there are three real roots again. What a pain!
    
    Introduced new command line option "--initial_abunds_only". If you call the code with this a list of the initial abundances used (you MUST give a metallicity as well!) is output to the screen and the code exits. I have a specific use for this :)