diff --git a/.github/workflows/build_wheels_and_publish.yml b/.github/workflows/build_wheels_and_publish.yml
index 7fb4ab4de..67b58302b 100644
--- a/.github/workflows/build_wheels_and_publish.yml
+++ b/.github/workflows/build_wheels_and_publish.yml
@@ -4,91 +4,89 @@ on:
release:
types: [published]
workflow_dispatch:
-
env:
- CIBW_BUILD: "cp37-* cp38-* cp39-* cp310-*"
+ CIBW_BUILD: "cp39-* cp310-*"
+ CIBW_ARCHS_LINUX: "x86_64"
CIBW_SKIP: "*-win32 *musllinux*"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
+ CIBW_ARCHS_MACOS: "x86_64 arm64"
CIBW_BEFORE_BUILD: pip install numpy --config-settings=setup-args="-Dallow-noblas=true"
+ CIBW_BUILD_VERBOSITY: "1"
+ CIBW_ENVIRONMENT_MACOS: "FC=gfortran"
jobs:
- build-wheels:
+ build-wheels-and-dist:
name: Build ${{ matrix.python-version }} wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
+ python-version: [3.9, "3.10"]
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
name: Install Python
with:
- python-version: "3.7"
+ python-version: "3.10"
- - name: Setup Mac
+ - name: link gfortran and hdf5
if: runner.os == 'macOS'
run: |
- python -m pip install numpy h5py versioneer
- sudo ln -s /usr/local/bin/gfortran-11 /usr/local/bin/gfortran
- sudo mkdir /usr/local/gfortran
- sudo ln -s /usr/local/Cellar/gcc@9/9.3.0_1/lib/gcc/9 /usr/local/gfortran/lib
+ sudo ln -s /opt/homebrew/bin/gfortran-12 /usr/local/bin/gfortran
+ brew reinstall hdf5
- - name: Setup Linux
- if: runner.os == 'Linux'
+ - name: Install numpy
+ run: |
+ python -m pip install --upgrade pip
+ python -m pip install numpy h5py versioneer
+
+ - name: Install dependencies
run: |
- python -m pip install numpy h5py versioneer
+ python -m pip install setuptools wheel build meson-python ninja meson pytest cibuildwheel
+
+ - name: Build source and wheels distribution on MacOS
+ if: runner.os == 'macOS'
+ run: |
+ python -m build --outdir dist
+ find ./dist/*.whl | xargs pip install
+ pytest src/cosmic
- - name: Build wheels
+ - name: Build source and wheels distribution on Linux
+ if: runner.os == 'Linux'
run: |
- python -m pip install cibuildwheel
- python -m cibuildwheel --output-dir wheelhouse
+ python -m build --sdist --outdir dist
+ python -m cibuildwheel --output-dir dist
+
- uses: actions/upload-artifact@v3
with:
- path: ./wheelhouse/*.whl
-
- build-source-dist:
- name: Build source dist
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- with:
- fetch-depth: 0
- - uses: actions/setup-python@v4
- name: Install Python
- with:
- python-version: "3.7"
-
- - name: Build dist
- run: |
- python -m pip install --upgrade pip
- pip install setuptools wheel twine numpy
- python setup.py sdist
- - uses: actions/upload-artifact@v3
- with:
- path: dist/*.tar.gz
+ path: ./dist/*.tar.gz
+
+ - uses: actions/upload-artifact@v3
+ with:
+ path: ./dist/*.whl
publish:
- needs: [build-wheels, build-source-dist]
+ needs: [build-wheels-and-dist]
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
- python-version: [3.8]
+ python-version: ["3.10"]
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v2
+ uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Download builds
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@v4.1.7
with:
name: artifact
path: dist
diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml
index 457bd8757..b1a62e167 100644
--- a/.github/workflows/python-package.yml
+++ b/.github/workflows/python-package.yml
@@ -12,16 +12,18 @@ jobs:
strategy:
fail-fast: false
matrix:
- python-version: ['3.7', '3.8', '3.9', '3.10']
+ python-version: ['3.9', '3.10']
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
+ with:
+ submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
- uses: actions/cache@v2
+ uses: actions/cache@v4
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
diff --git a/.gitignore b/.gitignore
index 2a54457eb..ca24ff619 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,10 @@
+# ignore files without extensions
+*
+!/**/
+!*.*
+
+.DS_Store
+
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
@@ -102,3 +109,9 @@ ENV/
# mypy
.mypy_cache/
+
+*.o
+binary.in
+binary.dat
+*.h5
+fort.99
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 000000000..87f8c6029
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "src/cosmic/src/METISSE"]
+ path = src/cosmic/src/METISSE
+ url = https://github.com/TeamMETISSE/METISSE.git
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 000000000..534b32ba1
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,30 @@
+{
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": "(gdb) Launch",
+ "type": "cppdbg",
+ "request": "launch",
+ "program": "${workspaceRoot}/debug/test",
+ "args": [],
+ "stopAtEntry": false,
+ "cwd": "${workspaceRoot}/debug",
+ "environment": [],
+ "externalConsole": false,
+ "MIMode": "gdb",
+ "preLaunchTask": "make",
+ "setupCommands": [
+ {
+ "description": "Enable pretty-printing for gdb",
+ "text": "-enable-pretty-printing",
+ "ignoreFailures": true
+ },
+ {
+ "description": "Set Disassembly Flavor to Intel",
+ "text": "-gdb-set disassembly-flavor intel",
+ "ignoreFailures": true
+ }
+ ]
+ },
+ ]
+}
\ No newline at end of file
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
new file mode 100644
index 000000000..f8e9969a9
--- /dev/null
+++ b/.vscode/tasks.json
@@ -0,0 +1,13 @@
+{
+ "version": "2.0.0",
+ "tasks": [
+ {
+ "label": "make",
+ "type": "shell",
+ "command": "make test",
+ "options": {
+ "cwd": "${workspaceFolder}/cosmic/src"
+ },
+ }
+ ]
+}
\ No newline at end of file
diff --git a/bin/cosmic-pop b/bin/cosmic-pop
index e131448c7..ee93b8d68 100755
--- a/bin/cosmic-pop
+++ b/bin/cosmic-pop
@@ -48,6 +48,13 @@ def str2bool(v):
###############################################################################
# DEFINE COMMANDLINE ARGUMENTS
###############################################################################
+
+def binfrac_type(value):
+ try:
+ return float(value)
+ except ValueError:
+ return value
+
def parse_commandline():
"""Parse the arguments given on the command-line.
"""
@@ -68,7 +75,7 @@ def parse_commandline():
defaults = {}
if not (args.inifile is None and (('-h' in remaining_argv) or ('--help' in remaining_argv))):
- BSEDict, seed_int, filters, convergence, sampling = utils.parse_inifile(args.inifile)
+ BSEDict, SSEDict, seed_int, filters, convergence, sampling = utils.parse_inifile(args.inifile)
defaults.update(sampling)
defaults.update(filters)
defaults.update(convergence)
@@ -98,10 +105,12 @@ def parse_commandline():
help="Number of binaries to try before checking for "
"convergence, it will check ever Nstep binaries until "
"it reach Niter binaries", type=int, default=10000)
+ parser.add_argument("--max-wall-time", type=int, default=3155760,
+ help="Maximum wall time (seconds) for sampling binaries")
parser.add_argument("--binary_state", nargs='+', type=int)
parser.add_argument("--sampling_method")
parser.add_argument("--primary_model", help="Chooses the initial primary mass function from: salpeter55, kroupa93, kroupa01", type=str)
- parser.add_argument("--binfrac_model", help="Chooses the binary fraction model from: a float between [0,1] and vanHaaften", type=float)
+ parser.add_argument("--binfrac_model", help="Chooses the binary fraction model from: a float between [0,1], vanHaaften, and offner22", type=binfrac_type)
parser.add_argument("--ecc_model", help="Chooses the initial eccentricity distribution model from: thermal, uniform, and sana12", type=str)
parser.add_argument("--porb_model", help="Chooses the initial orbital period distribution model from: log_uniform and sana12", type=str)
parser.add_argument("--SF_start", help="Sets the time in the past when star formation initiates in Myr", type=float)
@@ -163,8 +172,9 @@ if __name__ == '__main__':
pool = schwimmbad.choose_pool(mpi=args.mpi, processes=args.nproc)
if isinstance(pool, MPIPool):
if not pool.is_master():
+ from sys import exit
pool.wait()
- sys.exit(0)
+ exit(0)
nproc = len(pool.workers)
else:
nproc = args.nproc
@@ -175,7 +185,7 @@ if __name__ == '__main__':
# READ AND PARSE INIFILE
###########################################################################
- BSEDict, seed_int, filters, convergence, sampling = utils.parse_inifile(args.inifile)
+ BSEDict, SSEDict, seed_int, filters, convergence, sampling = utils.parse_inifile(args.inifile)
# we now overwrite the inifile values with what was specified from the command line
# (which could mean not overwriting anything at all because they are populated
@@ -211,8 +221,8 @@ if __name__ == '__main__':
"with {0}={2} from the commandline".format(argument, seed_int, getattr(args, argument)))
seed_int = getattr(args, argument)
- # Check that the values in BSEDict, filters, and convergence are valid
- utils.error_check(BSEDict, filters, convergence, sampling)
+ # Check that the values in BSEDict, SSEDict, filters, and convergence are valid
+ utils.error_check(BSEDict, SSEDict, filters, convergence, sampling)
if seed_int != 0:
np.random.seed(seed_int)
@@ -261,7 +271,7 @@ if __name__ == '__main__':
log_file = open('log_kstar1_{0}_kstar2_{1}_SFstart_{2}_SFduration_{3}_metallicity_{4}.txt'.format(kstar1_range_string, kstar2_range_string, sampling['SF_start'], sampling['SF_duration'], sampling['metallicity']), 'w')
# save configuration settings to output file
- configuration_settings = {'BSEDict' : BSEDict, 'filters' : filters,
+ configuration_settings = {'BSEDict' : BSEDict, 'SSEDict': SSEDict, 'filters' : filters,
'convergence' : convergence, 'sampling' : sampling}
for k, v in configuration_settings.items():
@@ -288,7 +298,7 @@ if __name__ == '__main__':
log_file.write("You have specified both qmin and m2_min.\n")
log_file.write("COSMIC will use qmin={} to determine the secondary masses in the initial sample.\n".format(args.qmin))
- while (Nstep < args.Niter) & (np.max(match) > convergence['match']):
+ while (Nstep < args.Niter) & (np.max(match) > convergence['match']) & ((time.time() - start_time) < args.max_wall_time):
# Set random seed such that each iteration gets a unique, determinable seed
rand_seed = seed_int + Nstep
np.random.seed(rand_seed)
@@ -309,7 +319,8 @@ if __name__ == '__main__':
met = sampling['metallicity'],
size = args.Nstep,
qmin = args.qmin,
- params = args.inifile)
+ params = args.inifile,
+ SSEDict = SSEDict)
elif hasattr(args,'m2_min'):
init_samp_list = InitialBinaryTable.sampler(format_ = sampling['sampling_method'],
final_kstar1 = kstar1_range,
@@ -324,7 +335,8 @@ if __name__ == '__main__':
met = sampling['metallicity'],
size = args.Nstep,
m2_min = args.m2_min,
- params = args.inifile)
+ params = args.inifile,
+ SSEDict = SSEDict)
else:
raise ValueError("You must specify either qmin or m2_min in the",
" inifile if you are using the independent sampler")
@@ -374,6 +386,7 @@ if __name__ == '__main__':
bpp, bcm, initCond, kick_info = Evolve.evolve(initialbinarytable=IBT,
pool=pool,
BSEDict=BSEDict,
+ SSEDict=SSEDict,
idx=idx,
dtp=dtp,
timestep_conditions=filters['timestep_conditions'])
diff --git a/changelog.md b/changelog.md
index 407f6fa62..5171f0fa5 100644
--- a/changelog.md
+++ b/changelog.md
@@ -39,3 +39,13 @@ See the discussed changes in our previous releases here: https://github.com/COSM
- Add `teff_1` and `teff_2` as variables that can be used to set `timestep_conditions`
- Add in `-1` option to turn off Magnetic Braking in htmb
- Added `central_bh` and `scale_with_central_bh` as options to the CMC sampler, in order to add central massive black holes to CMC initial conditions
+
+
+## 3.4.11
+ - Added sampling options to ``independent`` sampler to allow for custom power law distributions for ``porb`` and ``q``
+
+## 3.5.0
+ - Feature: Added `bpp_columns` and `bcm_columns` parameters to the `evolve()` function to allow users to specify the columns in the bpp and bcm tables
+ - Bug fix: Changed `kick.f` to use the Pfahl+02 kick prescription by default instead of Kiel & Hurley 2009, this fixes ejection velocities of secondaries and also changed kick_info to have an extra column
+## 3.5.1
+ - Feature: Added Disberg+2025 kick prescription as a new choice of `kickflag` (`kickflag=5`). Applies log-normal distribution to regular CCSN, ECSN/USSN still use `sigmadiv` Maxwellian and BH fallback scaling is still applied via `bhflag` and `bhsigmafrac` as with `kickflag=1`
diff --git a/ci/compile_benchmark.sh b/ci/compile_benchmark.sh
index 495c44fb8..80afbc961 100755
--- a/ci/compile_benchmark.sh
+++ b/ci/compile_benchmark.sh
@@ -1,2 +1,2 @@
-gfortran -coverage -fprofile-arcs -ftest-coverage -O0 src/cosmic/src/assign_remnant.f src/cosmic/src/benchmarkevolv2.f src/cosmic/src/comenv.f src/cosmic/src/corerd.f src/cosmic/src/deltat.f src/cosmic/src/dgcore.f src/cosmic/src/evolv2.f src/cosmic/src/gntage.f src/cosmic/src/hrdiag.f src/cosmic/src/hrdiag_remnant.f src/cosmic/src/instar.f src/cosmic/src/kick.f src/cosmic/src/mix.f src/cosmic/src/mlwind.f src/cosmic/src/mrenv.f src/cosmic/src/ran3.f src/cosmic/src/rl.f src/cosmic/src/star.f src/cosmic/src/zcnsts.f src/cosmic/src/zfuncs.f src/cosmic/src/concatkstars.f src/cosmic/src/bpp_array.f src/cosmic/src/checkstate.f -o benchmarkevolv2.exe -I src/cosmic/src -Wl,-rpath,${CONDA_PREFIX}/lib
+gfortran -coverage -fprofile-arcs -ftest-coverage -O0 src/cosmic/src/hrdiag_remnant.f src/cosmic/src/assign_remnant.f src/cosmic/src/benchmarkevolv2.f src/cosmic/src/corerd.f src/cosmic/src/comenv.f src/cosmic/src/dgcore.f src/cosmic/src/evolv2.f src/cosmic/src/gntage.f src/cosmic/src/instar.f src/cosmic/src/kick.f src/cosmic/src/mix.f src/cosmic/src/mrenv.f src/cosmic/src/ran3.f src/cosmic/src/rl.f src/cosmic/src/concatkstars.f src/cosmic/src/comprad.f src/cosmic/src/bpp_array.f src/cosmic/src/checkstate.f src/cosmic/src/deltat.f src/cosmic/src/mlwind.f src/cosmic/src/hrdiag.f src/cosmic/src/star.f src/cosmic/src/zcnsts.f src/cosmic/src/SSE/SSE_deltat.f src/cosmic/src/SSE/SSE_mlwind.f src/cosmic/src/SSE/SSE_hrdiag.f src/cosmic/src/SSE/SSE_star.f src/cosmic/src/SSE/SSE_zcnsts.f src/cosmic/src/SSE/SSE_zfuncs.f src/cosmic/src/SSE/SSE_gntage.f src/cosmic/src/METISSE/src/track_support.f90 src/cosmic/src/METISSE/src/z_support.f90 src/cosmic/src/METISSE/src/sse_support.f90 src/cosmic/src/METISSE/src/remnant_support.f90 src/cosmic/src/METISSE/src/interp_support.f90 src/cosmic/src/METISSE/src/METISSE_gntage.f90 src/cosmic/src/METISSE/src/METISSE_deltat.f90 src/cosmic/src/METISSE/src/METISSE_mlwind.f90 src/cosmic/src/METISSE/src/METISSE_hrdiag.f90 src/cosmic/src/METISSE/src/METISSE_star.f90 src/cosmic/src/METISSE/src/METISSE_zcnsts.f90 src/cosmic/src/METISSE/src/comenv_lambda.f90 src/cosmic/src/METISSE/src/METISSE_miscellaneous.f90 src/cosmic/src/METISSE_utils.f90 -o benchmarkevolv2.exe -I src/cosmic/src -Wl,-rpath,${CONDA_PREFIX}/lib
./benchmarkevolv2.exe
diff --git a/debug/create_binary_in.py b/debug/create_binary_in.py
new file mode 100644
index 000000000..6f15fbaa3
--- /dev/null
+++ b/debug/create_binary_in.py
@@ -0,0 +1,66 @@
+import pandas as pd
+
+BSE_settings = {'xi': 1.0, 'bhflag': 1, 'neta': 0.5, 'windflag': 3, 'wdflag': 1, 'alpha1': 1.0,
+ 'pts1': 0.001, 'pts3': 0.02, 'pts2': 0.01, 'epsnov': 0.001, 'hewind': 0.5,
+ 'ck': 1000, 'bwind': 0.0, 'lambdaf': 0.0, 'mxns': 3.0, 'beta': -1.0, 'tflag': 1,
+ 'acc2': 1.5, 'grflag': 1, 'remnantflag': 4, 'ceflag': 0, 'eddfac': 1.0,
+ 'ifflag': 0, 'bconst': 3000, 'sigma': 265.0, 'gamma': -2.0, 'pisn': 45.0,
+ 'natal_kick_array': [[-100.0, -100.0, -100.0, -100.0, 0.0],
+ [-100.0, -100.0, -100.0, -100.0, 0.0]], 'bhsigmafrac': 1.0,
+ 'polar_kick_angle': 90, 'qcrit_array': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
+ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
+ 'cekickflag': 2, 'cehestarflag': 0, 'cemergeflag': 0, 'ecsn': 2.25,
+ 'ecsn_mlow': 1.6, 'aic': 1, 'ussn': 0, 'sigmadiv': -20.0, 'qcflag': 5,
+ 'eddlimflag': 0, 'fprimc_array': [2.0/21.0, 2.0/21.0, 2.0/21.0, 2.0/21.0,
+ 2.0/21.0, 2.0/21.0, 2.0/21.0, 2.0/21.0,
+ 2.0/21.0, 2.0/21.0, 2.0/21.0, 2.0/21.0,
+ 2.0/21.0, 2.0/21.0, 2.0/21.0, 2.0/21.0],
+ 'bhspinflag': 0, 'bhspinmag': 0.0, 'rejuv_fac': 1.0, 'rejuvflag': 0, 'htpmb': 1,
+ 'ST_cr': 1, 'ST_tide': 1, 'bdecayfac': 1, 'rembar_massloss': 0.5, 'kickflag' : 1,
+ 'zsun': 0.014, 'bhms_coll_flag': 0, 'don_lim': -1, 'acc_lim': -1, 'binfrac': 0.5,
+ 'rtmsflag': 0, 'wd_mass_lim': 1, 'idum': 100}
+
+
+def create_binary_in(mass0, tphysf, tb, kstar, Z, ecc, BSE_settings):
+ """Create a binary.in file based on the given parameters
+
+ This follows the format in cosmic/src/test_bse.f and changes there would need to be reflected here.
+ """
+ with open('binary.in', 'w') as f:
+ f.write(f'{mass0[0]} {mass0[1]} {tphysf} {tb} {kstar[0]} {kstar[1]} {Z} {ecc}\n')
+
+ lines = [
+ ['neta', 'bwind', 'hewind', 'alpha1', 'lambdaf', 'windflag', 'rtmsflag'],
+ ['ceflag', 'tflag', 'ifflag', 'wdflag', 'bhflag', 'remnantflag', 'mxns', 'idum'],
+ ['pts1', 'pts2', 'pts3'],
+ ['sigma', 'beta', 'xi', 'acc2', 'epsnov', 'eddfac', 'gamma']
+ ]
+
+ for line in lines:
+ f.write(' '.join([str(BSE_settings[key]) for key in line]) + '\n')
+
+
+def convert_initC_row_to_binary_in(initC_file, bin_num):
+ """Convert a row from an initC file to a binary.in file
+
+ Parameters
+ ----------
+ initC_file : `str`
+ Path to the initC file
+ bin_num : `int`
+ The binary number to convert
+ """
+ # get binary from initC
+ initC = pd.read_hdf(initC_file, key="initC")
+ r = initC.loc[bin_num]
+
+ # update BSE settings with those in the binary
+ BSE_settings['idum'] = r['randomseed'].astype(int)
+ for key in BSE_settings:
+ if key in r:
+ BSE_settings[key] = r[key]
+
+ # create binary.in file
+ create_binary_in([r['mass_1'], r['mass_2']], r['tphysf'], r['porb'],
+ [r['kstar_1'].astype(int), r['kstar_2'].astype(int)],
+ r['metallicity'], r['ecc'], BSE_settings)
diff --git a/docs/cosmic-settings.json b/docs/cosmic-settings.json
new file mode 100644
index 000000000..947ba3e66
--- /dev/null
+++ b/docs/cosmic-settings.json
@@ -0,0 +1,1599 @@
+[
+ {
+ "category": "filters",
+ "category_label": "Filters",
+ "category_description": "Settings that filter the data returned by COSMIC simulations",
+ "docs-colour": "cadetblue",
+ "settings": [
+ {
+ "name": "binary_state",
+ "description": "Filter for the final state of the binaries you wish to retain",
+ "type": "checkbox",
+ "options-preface": "Each binary system will end its evolution in one of three states. Use these options to retain only certain endstates.",
+ "options": [
+ {
+ "name": 0,
+ "description": "Retain only binaries still alive today",
+ "default": true
+ },
+ {
+ "name": 1,
+ "description": "Retains binaries that merged",
+ "default": true
+ },
+ {
+ "name": 2,
+ "description": "Retains binaries that were disrupted"
+ }
+ ]
+ },
+ {
+ "name": "timestep_conditions",
+ "description": "Pick specific time resolutions to print at targeted stages of the binary evolution.",
+ "type": "string",
+ "options-preface": "This is used in conjunction with the [bse] section value dtp to determine the timestep resolution for printing to the bcm array. See the related guide for more information.",
+ "options": [
+ {
+ "name": "'dtp=None'",
+ "description": "Only the final time step is printed to the bcm array",
+ "default": true
+ },
+ {
+ "name": "'dtp=1.0'",
+ "description": "Use 1 Myr timesteps for all evolutionary stages"
+ },
+ {
+ "name": "[['binstate==0', 'dtp=1.0']]",
+ "description": "Use 1 Myr timesteps for binaries until they merge or disrupt"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "category": "sampling",
+ "category_label": "Sampling",
+ "category_description": "Settings that change how the initial binary population is sampled",
+ "docs-colour": "darkseagreen",
+ "settings": [
+ {
+ "name": "sampling_method",
+ "description": "Select which models to use to generate an initial sample of binary parameters at Zero Age Main Sequence",
+ "type": "dropdown",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "independent",
+ "description": "Initialize binaries with independent parameter distributions for the primary mass, mass ratio, eccentricity, separation, and binary fraction",
+ "default": true
+ },
+ {
+ "name": "multidim",
+ "description": "Initialize binaries with multidimensional parameter distributions according to Moe & Di Stefano 2017"
+ }
+ ]
+ },
+ {
+ "name": "primary_model",
+ "description": "Model for sampling primary masses
[Only used when sampling_method = independent]",
+ "type": "dropdown",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "salpeter55",
+ "description": "Use the Salpeter 1955 IMF"
+ },
+ {
+ "name": "kroupa93",
+ "description": "Use the Kroupa 1993 IMF"
+ },
+ {
+ "name": "kroupa01",
+ "description": "Use the Kroupa 2001 IMF",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "porb_model",
+ "description": "Model for sampling orbital periods
[Only used when sampling_method = independent]",
+ "type": "dropdown",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "sana12",
+ "description": "Sample from power law orbital period between 0.15 < log(P/day) < 5.5 following Sana+2012",
+ "default": true
+ },
+ {
+ "name": "log_uniform",
+ "description": "Sample semi-major axis flat in log space from RRLO < 0.5 up to \\(10^{5} {\\rm R_{\\odot}}\\) according to Abt (1983) and consistent with Dominik+2012,2013 - then convert to orbital period in days using Kepler's third law."
+ },
+ {
+ "name": "renzo19",
+ "description": "Uses sana12 for massive binaries (\\(m_1 > 15 {\\rm M_{\\odot}}\\)) and flat in log otherwise (following Renzo+19)."
+ },
+ {
+ "name": "raghavan10",
+ "description": "Sample log normal orbital periods in days with mean_logP = 4.9 and sigma_logP = 2.3 between \\(0 < \\log_{10}(P / {\\rm day}) < 9\\) following Raghavan+2010 "
+ },
+ {
+ "name": "moe19",
+ "description": "As raghavan10 but with different close binary fractions following Moe+2019"
+ },
+ {
+ "name": "custom",
+ "description": "Sample from a custom power law. The user provides a dictionary of min, max and slope values for the power law."
+ }
+ ]
+ },
+ {
+ "name": "ecc_model",
+ "description": "Model for sampling eccentricity
[Only used when sampling_method = independent]",
+ "type": "dropdown",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "thermal",
+ "description": "Samples from a thermal eccentricity distribution following Heggie (1975)"
+ },
+ {
+ "name": "uniform",
+ "description": "Samples from a uniform eccentricity distribution"
+ },
+ {
+ "name": "sana12",
+ "description": "Samples from the eccentricity distribution from Sana+2012",
+ "default": true
+ },
+ {
+ "name": "circular",
+ "description": "Assumes zero eccentricity for all systems"
+ }
+ ]
+ },
+ {
+ "name": "qmin",
+ "description": "Minimum mass ratio for sampling the secondary mass
[Only used when sampling_method = independent]",
+ "type": "number",
+ "options-preface": "The assumed mass ratio distribution is flat in \\(q \\equiv m_2 / m_1\\). NOTE: only one of qmin and m2_min should be specified.",
+ "options": [
+ {
+ "name": "values in [0, 1]",
+ "description": "Sets the minimum mass ratio"
+ },
+ {
+ "name": -1,
+ "description": "Set the minimum mass ratio such that the pre-MS lifetime of the secondary is not longer than the full lifetime of the primary if it were to evolve as a single star",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "m2_min",
+ "description": "Minimum secondary mass for sampling
[Only used when sampling_method = independent]",
+ "type": "number",
+ "options-preface": "NOTE: only one of qmin and m2_min should be specified.",
+ "options": [
+ {
+ "name": "positive values",
+ "description": "Sample the secondary mass uniformly between m2_min and mass_1"
+ },
+ {
+ "name": 0.1,
+ "description": "Default value",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "binfrac_model",
+ "description": "Model for sampling binary fraction
[Only used when sampling_method = independent]",
+ "type": "string",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "values between [0, 1]",
+ "description": "Fixed binary fraction"
+ },
+ {
+ "name": "vanHaaften",
+ "description": "Primary mass dependent binary fraction following van Haaften+05"
+ },
+ {
+ "name": "offner22",
+ "description": "Primary mass dependent binary fraction following Offner+22"
+ },
+ {
+ "name": 0.5,
+ "description": "Default value",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "SF_start",
+ "description": "Sets the time in the past when star formation initiates in Myr.",
+ "type": "number",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "positive values",
+ "description": "Start time of star formation in Myr"
+ },
+ {
+ "name": 13700.0,
+ "description": "For example, this specifies a start time at the beginning of a Hubble time",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "SF_duration",
+ "description": "Sets the duration of constant star formation from ``SF_start`` in Myr.",
+ "type": "number",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "positive values",
+ "description": "Duration of star formation in Myr"
+ },
+ {
+ "name": 0.0,
+ "description": "A single burst of star formation",
+ "default": true
+ },
+ {
+ "name": 13700.0,
+ "description": "For example, this specifies a constant star formation rate over a Hubble time"
+ }
+ ]
+
+ },
+ {
+ "name": "metallicity",
+ "description": "Sets the metallicity of the stellar population.",
+ "type": "number",
+ "options-preface": "COSMIC expects an absolute metallicity (i.e., NOT units of zsun)",
+ "options": [
+ {
+ "name": "positive values",
+ "description": "Absolute metallicity"
+ },
+ {
+ "name": 0.02,
+ "description": "For example, this sets the metallicity to approximately solar metallicity",
+ "default": true
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "category": "convergence",
+ "category_label": "Convergence",
+ "category_description": "Settings that control the convergence of the simulation run with cosmic-pop",
+ "docs-colour": "#a873dd",
+ "settings": [
+ {
+ "name": "convergence_params",
+ "description": "A list of parameters you would like to verify have converged to a single distribution shape when running cosmic-pop from the command line.",
+ "type": "checkbox",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "mass_1",
+ "description": "Primary mass",
+ "default": true
+ },
+ {
+ "name": "mass_2",
+ "description": "Secondary mass",
+ "default": true
+ },
+ {
+ "name": "sep",
+ "description": "Separation"
+ },
+ {
+ "name": "porb",
+ "description": "Orbital period",
+ "default": true
+ },
+ {
+ "name": "ecc",
+ "description": "Eccentricity",
+ "default": true
+ },
+ {
+ "name": "massc_1",
+ "description": "Primary core mass"
+ },
+ {
+ "name": "massc_2",
+ "description": "Secondary core mass"
+ },
+ {
+ "name": "rad_1",
+ "description": "Primary radius"
+ },
+ {
+ "name": "rad_2",
+ "description": "Secondary radius"
+ }
+ ]
+ },
+ {
+ "name": "convergence_limits",
+ "description": "Specifies limits for parameters included in the convergence_params list.",
+ "type": "string",
+ "options-preface": "For each parameter specified convergence_limits, the lower and upper limit must be included.",
+ "options": [
+ {
+ "name": "{}",
+ "description": "No limits specified",
+ "default": true
+ },
+ {
+ "name": "{'mass_1' : [5, 10], 'sep' : [0, 10]}",
+ "description": "For example, this specifies that the primary mass must be between 5 and 10 solar masses, and the separation must be between 0 and 10 Rsun."
+ }
+ ]
+ },
+ {
+ "name": "pop_select",
+ "description": "Selects the stage of the evolution at which you would like to check for convergence.",
+ "type": "dropdown",
+ "options-preface": "This will filter for systems that satisfy the final_kstar1 and final_kstar2 selections from the command line call of cosmic-pop at the following states:",
+ "options": [
+ {
+ "name": "formation",
+ "description": "At binary formation",
+ "default": true
+ },
+ {
+ "name": "1_SN",
+ "description": "Just before the first supernova"
+ },
+ {
+ "name": "2_SN",
+ "description": "Just before the second supernova"
+ },
+ {
+ "name": "disruption",
+ "description": "Just before binary disruption"
+ },
+ {
+ "name": "final_state",
+ "description": "After the full evolution specified by the user-supplied evolution time"
+ },
+ {
+ "name": "XRB_form",
+ "description": "At the start of RLOF following the first supernova"
+ }
+ ]
+ },
+ {
+ "name": "apply_convergence_limits",
+ "description": "Whether to filter the binary population (including the bcm, bpp, initC, and kick_info DataFrames) to only contain the binaries that satisfy the constraints from convergence_limits.",
+ "type": "dropdown",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "True",
+ "description": "Filter the binary population to only contain the binaries that satisfy the constraints from convergence_limits"
+ },
+ {
+ "name": "False",
+ "description": "Do not filter the binary population",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "match",
+ "description": "Provides the tolerance for the convergence calculation and is calculated as \\({\\rm match} = \\log_{\\rm 10} (1 - {\\rm convergence})\\)",
+ "type": "number",
+ "options-preface": "",
+ "options": [
+ {
+ "name": -5.0,
+ "description": "For example, this specifies a tolerance of \\(10^{-5}\\) for convergence",
+ "default": true
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "category": "rand_seed",
+ "category_label": "Random Seed",
+ "category_description": "Settings that control the random number generation used",
+ "docs-colour": "#f0ba80",
+ "settings": [
+ {
+ "name": "seed",
+ "description": "Sets the seed for the random number generator (for numpy.random.seed())",
+ "type": "number",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "integer values",
+ "description": "Random seed"
+ },
+ {
+ "name": 42,
+ "description": "For example, this sets the seed to 42",
+ "default": true
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "category": "bse",
+ "category_label": "Binary physics",
+ "category_description": "Settings that control the binary physics in the simulation",
+ "docs-colour": "lightcoral",
+ "settings": [
+ {
+ "name": "pts1",
+ "description": "Sets the timestep modifier for main sequence stars (dtp *= pts1)",
+ "type": "number",
+ "settings-section": "Timesteps",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "positive values",
+ "description": "Timestep modifier"
+ },
+ {
+ "name": 0.001,
+ "description": "Recommended value from Bannerjee+2019 for NS/BH progenitors",
+ "default": true
+ },
+ {
+ "name": 0.05,
+ "description": "Recommended value from Hurley+2000"
+ }
+ ]
+ },
+ {
+ "name": "pts2",
+ "description": "Sets the timestep modifier for Giant Branch (GB, CHeB, AGB, HeGB) stars (dtp *= pts2)",
+ "type": "number",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "positive values",
+ "description": "Timestep modifier"
+ },
+ {
+ "name": 0.01,
+ "description": "Recommended value from Hurley+2000",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "pts3",
+ "description": "Sets the timestep modifier for HG, HeMS stars (dtp *= pts3)",
+ "type": "number",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "positive values",
+ "description": "Timestep modifier"
+ },
+ {
+ "name": 0.02,
+ "description": "Recommended value from Hurley+2000",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "zsun",
+ "description": "Sets the metallicity of the Sun which primarily affects stellar winds.",
+ "type": "number",
+ "settings-section": "Metallicity",
+ "options-preface": "Note that the wind prescriptions for OB stars are calibrated to zsun = 0.019 as described in Vink+2001.",
+ "options": [
+ {
+ "name": "positive values",
+ "description": "Set the solar metallicity"
+ },
+ {
+ "name": 0.014,
+ "description": "Following Asplund+2009",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "windflag",
+ "description": "Selects the model for wind mass loss for each star",
+ "type": "dropdown",
+ "settings-section": "Stellar Winds",
+ "options-preface": "",
+ "options": [
+ {
+ "name": 0,
+ "description": "Standard SSE/BSE (Hurley+2000)"
+ },
+ {
+ "name": 1,
+ "description": "StarTrack (Belczynski+2008)"
+ },
+ {
+ "name": 2,
+ "description": "Metallicity dependence for O/B stars and Wolf Rayet stars (Vink+2001, Vink+2005)"
+ },
+ {
+ "name": 3,
+ "description": "Same as 2, but LBV-like mass loss for giants and non-degenerate stars beyond the Humphreys-Davidson limit",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "eddlimflag",
+ "description": "Adjusts the dependence of mass loss on metallicity for stars near the Eddington limit (see Grafener+2011, Giacobbo+2018).",
+ "type": "dropdown",
+ "options-preface": "",
+ "options": [
+ {
+ "name": 0,
+ "description": "does not adjust metallicity dependence for stars near the Eddington limit",
+ "default": true
+ },
+ {
+ "name": 1,
+ "description": "adjusts metallicity dependence for stars near the Eddington limit as in Giacobbo+2018."
+ }
+ ]
+ },
+ {
+ "name": "neta",
+ "description": "Reimers mass-loss coefficient (Equation 106 of SSE).",
+ "type": "number",
+ "options-preface": "Note: this equation has a typo. There is an extra \\(\\eta\\) out front; the correct rate is directly proportional to \\(\\eta\\). See also Kurdritzki+1978, Section Vb for discussion.",
+ "options": [
+ {
+ "name": "positive values",
+ "description": "Set \\(\\eta\\) value"
+ },
+ {
+ "name": 0.5,
+ "description": "Sets \\(\\eta\\) for Reimers mass loss to 0.5",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "bwind",
+ "description": "Binary enhanced mass loss parameter",
+ "type": "number",
+ "options-preface": "This parameter is used to enhance mass loss in binaries. See Hurley+2000, Eq. 12 for more information.",
+ "options": [
+ {
+ "name": "positive values",
+ "description": "Sets the binary enhanced mass loss parameter, \\(B_w\\), from Hurley+2000, Eq. 12"
+ },
+ {
+ "name": 0.0,
+ "description": "Default value (no effect on single stars)",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "hewind",
+ "description": "Helium star mass loss parameter",
+ "type": "number",
+ "options-preface": "\\( 10^{-13} {\\rm \\ \\texttt{hewind} \\ } L^{2/3}\\) gives He star mass-loss. Equivalent to \\(1 - \\mu\\) in the last equation on Hurley+2000, page 19.",
+ "options": [
+ {
+ "name": "positive values",
+ "description": "Sets the helium star mass loss parameter"
+ },
+ {
+ "name": 0.5,
+ "description": "Default value",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "beta",
+ "description": "Wind velocity factor. \\( v_{\\rm wind}^2 \\propto \\beta\\), see Hurley+2002, Eq. 9.",
+ "type": "number",
+ "options-preface": "",
+ "options": [
+ {
+ "name": -1,
+ "description": "Follow StarTrack prescription for wind velocity factor, \\(\\beta_w\\), from Belczynski+2008"
+ },
+ {
+ "name": "positive values",
+ "description": "Sets the wind velocity factor, \\(\\beta_w\\)"
+ },
+ {
+ "name": 0.125,
+ "description": "Default value",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "xi",
+ "description": "Wind accretion efficiency factor, which gives the fraction of angular momentum lost via winds from the primary that transfers to the spin angular momentum of the companion.",
+ "type": "number",
+ "options-preface": "Corresponds to \\(\\mu_w\\) in Hurley+2002, Eq. 11",
+ "options": [
+ {
+ "name": "positive values",
+ "description": "Sets the wind accretion efficiency factor"
+ },
+ {
+ "name": 0.5,
+ "description": "Default value",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "acc2",
+ "description": "Bondi-Hoyle wind accretion factor where the mean wind accretion rate onto the secondary is proportional to acc2. See Hurley+2002, Eq. 6.",
+ "type": "number",
+ "options-preface": "This value is equivalent to \\(\\alpha_w\\) in Hurley+2002, Eq. 6.",
+ "options": [
+ {
+ "name": "positive values",
+ "description": "Sets the Bondi-Hoyle wind accretion factor, \\(\\alpha_w\\)"
+ },
+ {
+ "name": 1.5,
+ "description": "Default value",
+ "default": true
+ }
+ ]
+ },
+ {
+ "settings-section": "Common-envelope",
+ "settings-section-description": "Note: there are cases where a common envelope is forced regardless of the critical mass ratio for unstable mass transfer. In the following cases, a common envelope occurs regardless of the choices below:
cemergeflag=1 according to Belczynski+2008, cemergeflag=0 allows for both options to be explored, since it is trivial to remove these systems from a population in post processing.",
+ "options": [
+ {
+ "name": 0,
+ "description": "allows the CE to proceed (optimistic CE)"
+ },
+ {
+ "name": 1,
+ "description": "forces the stars to merge in the CE (pessimistic CE)",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "cehestarflag",
+ "description": "Uses fitting formulae from Tauris+2015 for evolving RLO systems with a helium star donor and compact object accretor. NOTE: this flag will override cekickflag if set",
+ "type": "dropdown",
+ "options-preface": "",
+ "options": [
+ {
+ "name": 0,
+ "description": "Do not use the fitting formulae from Tauris+2015",
+ "default": true
+ },
+ {
+ "name": 1,
+ "description": "Use the fitting formulae from Tauris+2015 for final period only"
+ },
+ {
+ "name": 2,
+ "description": "Use the fitting formulae from Tauris+2015 for both final mass and final period"
+ }
+ ]
+ },
+ {
+ "name": "qcflag",
+ "description": "Selects model to determine critical mass ratios for the onset of unstable mass transfer and/or a common envelope during RLO. NOTE: this is overridden by qcrit_array if any of its values are non-zero.",
+ "type": "dropdown",
+ "options-preface": "The table below shows the values for qcflag across the choices of this flag and the kstar type. The equations in the table correspond to:qc = 0.362 + 1.0/(3.0*(1.0 - massc(j1)/mass(j1))) (from Hjellming & Webbink 1983)qc = (1.67d0-zpars(7)+2.d0*(massc(j1)/mass(j1))**5)/2.13d0 (from Claeys+ 2014)",
+ "options": [
+ {
+ "name": 0,
+ "description": "follows Section 2.6 of Hurley+2002 (Default BSE)"
+ },
+ {
+ "name": 1,
+ "description": "same as 0 but with Hjellming & Webbink 1987 for GB/AGB stars",
+ "default": true
+ },
+ {
+ "name": 2,
+ "description": "follows Table 2 of Claeys+2014"
+ },
+ {
+ "name": 3,
+ "description": "same as 2 but with Hjellming & Webbink 1987 for GB/AGB stars"
+ },
+ {
+ "name": 4,
+ "description": "follows Section 5.1 of Belcyznski+2008 except for WD donors which follow BSE"
+ },
+ {
+ "name": 5,
+ "description": "follows Section 2.3 of Neijssel+2020; mass transfer from stripped stars is always assumed to be dynamically stable"
+ }
+ ]
+ },
+ {
+ "name": "qcrit_array",
+ "description": "User-defined values for critical mass ratios for the onset of unstable mass transfer and a common envelope during RLOF.",
+ "type": "string",
+ "options-preface": "Array of dimensions (1,16) specifying user-input values for the critical mass ratios that govern the onset of unstable mass transfer and a common envelope. Each item is set individually for its associated kstar, and a value of 0.0 will apply the prescription specified qcflag for that kstar.qcrit for each kstar type",
+ "default": true
+ }
+ ]
+ },
+ {
+ "settings-section": "Natal kicks",
+ "name": "kickflag",
+ "description": "Sets the particular natal kick prescription to use. Note that sigmadiv, bhflag, bhsigmafrac, aic, and ussn, which are described below, are only used when abs(kickflag)=1. Positive values use the Pfahl+2002 prescription for handling natal kicks.",
+ "type": "dropdown",
+ "options-preface": "",
+ "options": [
+ {
+ "name": 1,
+ "description": "The standard COSMIC kick prescription, where kicks are drawn from a bimodal distribution with standard FeCCSN getting a kick drawn from a Maxwellian distribution with dispersion parameter sigma and ECSN/USSN are drawn according to sigmadiv. This setting has additional possible options for bhflag, bhsigmafrac, aic and ussn.",
+ "default": true
+ },
+ {
+ "name": 2,
+ "description": "Natal kicks are drawn according to sigma and scaled by the ejecta mass and remnant mass following Eq. 1 of Giacobbo & Mapelli 2020 with their default parameters (\\(m_{\\rm NS = 1.2 {\\rm M_\\odot}\\), \\(m_{\\rm ej = 9 {\\rm M_\\odot}\\))"
+ },
+ {
+ "name": 3,
+ "description": "Natal kicks are drawn according to sigma and scaled by just the ejecta mass following Eq. 2 of Giacobbo & Mapelli 2020, which does not scale the kick by (\\(m_{\\rm NS\\)"
+ },
+ {
+ "name": 4,
+ "description": "Natal kicks are drawn according to Eq. 1 of Bray & Eldridge 2016, with their default parameters (\\(\\alpha=70 \\, {\\rm km/s}, \\beta = 120 \\, {\\rm km/s)}"
+ },
+ {
+ "name": 5,
+ "description": "Follows the same prescription as 1, but uses the kick prescription described in Disberg & Mandel 2025 for CCSN."
+ },
+ {
+ "name": "negative values",
+ "description": "Same as above settings but using the old Kiel & Hurley 2009 prescription for changing the orbital configuration of the binary, available for reproducibility purposes but not recommended for new work"
+ }
+ ]
+ },
+ {
+ "name": "sigma",
+ "description": "Sets the dispersion in the Maxwellian for the SN kick velocity in km/s",
+ "type": "number",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "positive values",
+ "description": "Sets the dispersion in the Maxwellian for the SN kick velocity in km/s"
+ },
+ {
+ "name": 265.0,
+ "description": "Default choice",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "bhflag",
+ "description": "Sets the model for how SN kicks are applied to BHs, where bhflag != 0 allows for velocity kick at BH formation",
+ "type": "dropdown",
+ "options-preface": "",
+ "options": [
+ {
+ "name": 0,
+ "description": "No BH kick"
+ },
+ {
+ "name": 1,
+ "description": "fallback-modulated kicks following Fryer+2012",
+ "default": true
+ },
+ {
+ "name": 2,
+ "description": "kicks decreased by ratio of BH mass to NS mass (1.44 Msun); conserves linear momentum"
+ },
+ {
+ "name": 3,
+ "description": "BH natal kicks are not decreased compared to NS kicks and are drawn from the same Maxwellian distribution with dispersion = sigma set above"
+ }
+ ]
+ },
+ {
+ "name": "bhsigmafrac",
+ "description": "Sets a fractional modification which scales down sigma for BHs. This works in addition to whatever is chosen for bhflag, and is applied to sigma before the bhflag prescriptions are applied",
+ "type": "number",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "values between [0, 1]",
+ "description": "reduces sigma by bhsigmafrac for BHs"
+ },
+ {
+ "name": 1.0,
+ "description": "Default choice",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "sigmadiv",
+ "description": "Sets the modified ECSN kick strength",
+ "type": "number",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "positive values",
+ "description": "divide sigma (defined above) by sigmadiv"
+ },
+ {
+ "name": "negative values",
+ "description": " sets ECSN kicks to be drawn from a Maxwellian distribution with dispersion given by sigmadiv"
+ },
+ {
+ "name": -20.0,
+ "description": "Default choice",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "ecsn",
+ "description": "Allows for electron capture SNe and sets the maximum He-star mass (at core helium depletion) that will result in an ECSN",
+ "type": "number",
+ "options-preface": "",
+ "options": [
+ {
+ "name": 0,
+ "description": "turns off ECSN"
+ },
+ {
+ "name": "positive values",
+ "description": "sets maximum He-star mass for ECSN; BSE (Hurley+2002) and StarTrack (Belczynski+2008) use ecsn = 2.25, while Podsiadlowksi+2004 argues that binarity can increase this to ecsn = 2.5"
+ },
+ {
+ "name": 2.25,
+ "description": "Default choice",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "ecsn_low",
+ "description": "Sets the low end of the ECSN mass range",
+ "type": "number",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "positive values",
+ "description": "sets maximum He-star mass for ECSN; BSE (Hurley+2002) uses ecsn_mlow = 1.6, StarTrack (Belczynski+2008) uses ecsn_mlow = 1.85, Podsiadlowksi+2004 argues that binarity can decrease this to ecsn_mlow = 1.4"
+ },
+ {
+ "name": 1.6,
+ "description": "Default choice",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "aic",
+ "description": "Sets the model for accretion induced collapse SN natal kicks",
+ "type": "dropdown",
+ "options-preface": "Applies even if ecsn = 0<.code>",
+ "options": [
+ {
+ "name": 0,
+ "description": "AIC SN receive kicks drawn from Maxwellian with dispersion = sigma defined above"
+ },
+ {
+ "name": 1,
+ "description": "sets AIC SN kick strength according to sigmadiv; NOTE that this will apply even if ecsn = 0.0",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "ussn",
+ "description": "Reduces kicks according to the sigmadiv selection for ultra-stripped supernovae, assumed to happen if a He-star undergoes a CE with a compact companion",
+ "type": "dropdown",
+ "options-preface": "",
+ "options": [
+ {
+ "name": 0,
+ "description": "USSN receive kicks drawn from Maxwellian with dispersion = sigma defined above"
+ },
+ {
+ "name": 1,
+ "description": "sets USSN kick strength according to sigmadiv",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "pisn",
+ "description": "Allows for (pulsational) pair instability supernovae and sets either the model to use or the maximum mass of the remnant.",
+ "type": "number",
+ "options-preface": "",
+ "options": [
+ {
+ "name": 0,
+ "description": "no pulsational pair instability SN"
+ },
+ {
+ "name": -1,
+ "description": " uses the formulae from Spera & Mapelli 2017"
+ },
+ {
+ "name": -2,
+ "description": "uses a polynomial fit to Table 1 in Marchant+2018",
+ "default": true
+ },
+ {
+ "name": -3,
+ "description": "uses a polynomial fit to Table 5 in Woosley 2019"
+ },
+ {
+ "name": "positive values",
+ "description": "turns on pulsational pair instability and pair instability SNe, and sets the maximum mass of the allowed remnant (i.e., the bottom of the pair instability mass gap). He core masses between pisn and 65 Msun are assumed to go through pulsational pair instability and limit the He core mass to pisn, while He core masses from 65-135 Msun are assumed have a pair instability SN and leave no remnant."
+ }
+ ]
+ },
+ {
+ "name": "polar_kick_angle",
+ "description": "Sets the opening angle of the SN kick relative to the pole of the exploding star",
+ "type": "number",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "values between [0, 90]",
+ "description": "Sets the opening angle of the SN kick relative to the pole of the exploding star"
+ },
+ {
+ "name": 0.0,
+ "description": "Strictly polar kicks"
+ },
+ {
+ "name": 90.0,
+ "description": "Fully isotropic kicks (default choice)",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "natal_kick_array",
+ "description": "Array of dimensions (2,5) which takes user input values for the SN natal kick, where the first row corresponds to the first star and the second row corresponds to the second star and columns are: [vk, phi, theta, mean_anomaly, rand_seed].",
+ "type": "string",
+ "options-preface": "NOTE: any numbers outside the ranges below will be sampled in the standard ways detailed above.",
+ "options": [
+ {
+ "name": "vk",
+ "description": "SN kick velocity in km/s, valid on the range [0, inf]"
+ },
+ {
+ "name": "phi",
+ "description": "SN kick co-lateral polar angle in degrees, valid on the range [-90, 90]"
+ },
+ {
+ "name": "theta",
+ "description": "SN kick azimuthal angle in degrees, valid on the range [0, 360]"
+ },
+ {
+ "name": "mean_anomaly",
+ "description": "SN kick mean anomaly in degrees, valid on the range [0, 360]"
+ },
+ {
+ "name": "rand_seed",
+ "description": "supplied if restarting evolution after a supernova has already occurred"
+ },
+ {
+ "name": "[[-100.0, -100.0, -100.0, -100.0, 0.0], [-100.0, -100.0, -100.0, -100.0, 0.0]]",
+ "description": "Default choice, which applies the standard natal kick prescription",
+ "default": true
+ }
+ ]
+ },
+ {
+ "settings-section": "Remnant mass",
+ "name": "remnantflag",
+ "description": "Determines the remnant mass prescription used for NSs and BHs.",
+ "type": "dropdown",
+ "options-preface": "",
+ "options": [
+ {
+ "name": 0,
+ "description": "follows Section 6 of Hurley+2000 (default BSE)"
+ },
+ {
+ "name": 1,
+ "description": "follows Belczynski+2002"
+ },
+ {
+ "name": 2,
+ "description": "follows Belczynski+2008"
+ },
+ {
+ "name": 3,
+ "description": "follows the rapid prescription from Fryer+2012, with updated proto-core mass from Giacobbo & Mapelli 2020. This leads to a mass gap between neutron stars and black holes."
+ },
+ {
+ "name": 4,
+ "description": "follows the delayed prescription from Fryer+2012. This fills the mass gap between neutron stars and black holes.",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "mxns",
+ "description": "Sets the boundary between the maximum NS mass and the minimum BH mass",
+ "type": "number",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "positive values",
+ "description": "Sets the boundary between the maximum NS mass and the minimum BH mass"
+ },
+ {
+ "name": 3.0,
+ "description": "Default choice",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "rembar_massloss",
+ "description": "Determines the prescriptions for mass conversion due to neutrino emission during the collapse of the proto-compact object",
+ "type": "number",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "positive values",
+ "description": "sets the maximum amount of mass loss, which should be about 10% of the maximum mass of an iron core (\\({\\sim 5 \\mathrm{M}_\\odot}\\) Fryer, private communication)"
+ },
+ {
+ "name": "values in [-1, 0)",
+ "description": "assumes that proto-compact objects lose a constant fraction of their baryonic mass when collapsing to a black hole, such that \\(M_{\\rm rem} = (1 + \\texttt{rembar\\_massloss}) M_{\\rm rem}\\) (e.g., rembar_massloss = -0.1 gives the black hole a gravitational mass that is 90% of the proto-compact object's baryonic mass)"
+ },
+ {
+ "name": 0.5,
+ "description": "Default choice",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "wd_mass_lim",
+ "description": "Determines if the maximum white dwarf mass is limited to the chandraekhar mass during merger induced collapse",
+ "type": "dropdown",
+ "options-preface": "",
+ "options": [
+ {
+ "name": 0,
+ "description": "Do not apply the limit"
+ },
+ {
+ "name": 1,
+ "description": "Apply the limit",
+ "default": true
+ }
+ ]
+ },
+ {
+ "settings-section": "Remnant spin",
+ "name": "bhspinflag",
+ "description": "Uses different prescriptions for BH spin after formation",
+ "type": "dropdown",
+ "options-preface": "",
+ "options": [
+ {
+ "name": 0,
+ "description": "sets all BH spins to bhspinmag",
+ "default": true
+ },
+ {
+ "name": 1,
+ "description": "draws a random BH spin between 0 and bhspinmag for every BH"
+ },
+ {
+ "name": 2,
+ "description": "core-mass dependent BH spin (based on Belczynski+2017 v1)"
+ }
+ ]
+ },
+ {
+ "name": "bhspinmag",
+ "description": "Sets either the spin of all BHs or the upper limit of the uniform distribution for BH spins (see bhspinflag)",
+ "type": "number",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "positive values",
+ "description": "Sets either the spin of all BHs or the upper limit of the uniform distribution for BH spins (see bhspinflag)"
+ },
+ {
+ "name": 0.0,
+ "description": "Default choice",
+ "default": true
+ }
+ ]
+ },
+ {
+ "settings-section": "GR Orbital Decay",
+ "name": "grflag",
+ "description": "Turns on or off orbital decay due to gravitational wave emission",
+ "type": "dropdown",
+ "options-preface": "",
+ "options": [
+ {
+ "name": 0,
+ "description": "No orbital decay due to gravitational wave emission"
+ },
+ {
+ "name": 1,
+ "description": "Orbital decay due to gravitational wave emission is turned on",
+ "default": true
+ }
+ ]
+ },
+ {
+ "settings-section": "Mass transfer",
+ "name": "eddfac",
+ "description": "Eddington limit factor for mass transfer.",
+ "options-preface": "",
+ "type": "number",
+ "options": [
+ {
+ "name": "1",
+ "description": "mass transfer rate is limited by the Eddington rate following Equation 67 in Hurley+2002",
+ "default": true
+ },
+ {
+ "name": "values > 1",
+ "description": "permit super-Eddington accretion up to value eddfac"
+ },
+ {
+ "name": "values in [0, 1]",
+ "description": "restrict accretion limit to fraction of Eddington (sub-Eddington accretion)"
+ }
+ ]
+ },
+ {
+ "name": "gamma",
+ "description": "Angular momentum prescriptions for mass lost during Roche-lobe overflow at super-Eddington mass transfer rates",
+ "type": "number",
+ "options-preface": "",
+ "options": [
+ {
+ "name": -1,
+ "description": "assumes the lost material carries away the specific angular momentum of the primary"
+ },
+ {
+ "name": -2,
+ "description": "assumes material is lost from the system as if it is a wind from the secondary",
+ "default": true
+ },
+ {
+ "name": -3,
+ "description": "assumes mass is lost through the outer Lagrangian point, forming a circumbinary disk. See Zapartas+17 Eq. 9 and Artymowicz & Lubow (1994)."
+ },
+ {
+ "name": "positive values",
+ "description": "assumes that the lost material takes away a fraction gamma of the orbital angular momentum"
+ }
+ ]
+ },
+ {
+ "name": "don_lim",
+ "description": "Determines the rate of mass loss through Roche-lobe overflow mass transfer from the donor star",
+ "type": "dropdown",
+ "options-preface": "",
+ "options": [
+ {
+ "name": -1,
+ "description": "donor mass loss rate is calculated following Hurley+2002",
+ "default": true
+ },
+ {
+ "name": -2,
+ "description": "donor mass loss rate is calculated following Claeys+2014"
+ }
+ ]
+ },
+ {
+ "name": "acc_lim",
+ "description": "Limits the amount of mass accreted during Roche-lobe overflow",
+ "type": "number",
+ "options-preface": "",
+ "options": [
+ {
+ "name": -1,
+ "description": "limited to 10x the thermal rate of the accretor for MS/HG/CHeB and unlimited for GB/EAGB/AGB stars",
+ "default": true
+ },
+ {
+ "name": -2,
+ "description": "limited to 1x the thermal rate of the accretor for MS/HG/CHeB and unlimited for GB/EAGB/AGB stars"
+ },
+ {
+ "name": -3,
+ "description": "limited to 10x the thermal rate of the accretor for all stars"
+ },
+ {
+ "name": -4,
+ "description": "limited to 1x the thermal rate of the accretor for all stars"
+ },
+ {
+ "name": ">= 0",
+ "description": "sets overall fraction of donor material that is accreted, with the rest being lost from the system (acc_lim = 0.5 assumes 50% accretion efficiency as in Belczynski+2008)"
+ }
+ ]
+ },
+ {
+ "settings-section": "Tides",
+ "name": "tflag",
+ "description": "Activates tidal circularization following Hurley+2002",
+ "type": "dropdown",
+ "options-preface": "",
+ "options": [
+ {
+ "name": 0,
+ "description": "No tidal circularization"
+ },
+ {
+ "name": 1,
+ "description": "Tidal circularization is turned on",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "ST_tide",
+ "description": "Activates StarTrack setup for tides following Belczynski+2008",
+ "type": "dropdown",
+ "options-preface": "",
+ "options": [
+ {
+ "name": 0,
+ "description": "Follows BSE (Hurley+2002)"
+ },
+ {
+ "name": 1,
+ "description": "Follow StarTrack (Belczynski+2008). Note StarTrack method does not use a better integration scheme (yet) but simply ; follows similar set up to startrack (including initial vrot, using roche-lobe check ; at periastron, and circularisation and synchronisation at start of MT).",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "fprimc_array",
+ "description": "Controls the scaling factor for convective tides. Each value in the array is set individually for its associated kstar. The relevant equation is Hurley+2002 Eq. 21.",
+ "type": "string",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "positive values",
+ "description": "sets scaling factor of Equation 21 referenced above"
+ },
+ {
+ "name": "[2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0]",
+ "description": "Default choice, which applies the standard scaling factor",
+ "default": true
+ }
+ ]
+ },
+ {
+ "settings-section": "White dwarfs",
+ "name": "ifflag",
+ "description": "Activates the initial-final white dwarf mass relation from Han+1995 Equations 3, 4, and 5.",
+ "type": "dropdown",
+ "options-preface": "",
+ "options": [
+ {
+ "name": 0,
+ "description": "No modifications to BSE"
+ },
+ {
+ "name": 1,
+ "description": "Initial-final white dwarf mass relation is turned on",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "wdflag",
+ "description": "Activates an alternate cooling law found in the description immediately following Equation 1 in Hurley & Shara 2003. Equation 1 gives the BSE default Mestel cooling law.",
+ "type": "dropdown",
+ "options-preface": "",
+ "options": [
+ {
+ "name": 0,
+ "description": "No modifications to BSE"
+ },
+ {
+ "name": 1,
+ "description": "Alternate cooling law is turned on",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "epsnov",
+ "description": "Fraction of accreted matter retained in a nova eruption. This is relevant for accretion onto degenerate objects; see Section 2.6.6.2 in Hurley+2002.",
+ "type": "number",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "positive values",
+ "description": "Retains epsnov fraction of accreted matter"
+ },
+ {
+ "name": 0.001,
+ "description": "Default choice",
+ "default": true
+ }
+ ]
+ },
+ {
+ "settings-section": "Pulsars",
+ "name": "bdecayfac",
+ "description": "Activates different models for accretion induced field decay; see Kiel+2008.",
+ "type": "dropdown",
+ "options-preface": "",
+ "options": [
+ {
+ "name": 0,
+ "description": "uses an exponential decay"
+ },
+ {
+ "name": 1,
+ "description": "uses an inverse decay",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "bconst",
+ "description": "Sets the magnetic field decay timescale for pulsars following Section 3 of Kiel+2008.",
+ "type": "number",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "positive values",
+ "description": "sets \\(k\\) in Myr from Equation 8 to bconst"
+ },
+ {
+ "name": 3000,
+ "description": "Default choice",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "ck",
+ "description": "Sets the magnetic field decay timescale for pulsars following Section 3 of Kiel+2008.",
+ "type": "number",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "positive values",
+ "description": "sets \\(\\tau_b\\) in Myr from Equation 2 to ck"
+ },
+ {
+ "name": 1000,
+ "description": "Default choice",
+ "default": true
+ }
+ ]
+ },
+ {
+ "settings-section": "Mixing variables",
+ "name": "rejuv_fac",
+ "description": "Sets the mixing factor in main sequence star collisions. This is hard coded to 0.1 in the original BSE release and in Equation 80 of Hurley+2002 but can lead to extended main sequence lifetimes in some cases.",
+ "type": "number",
+ "options-preface": "",
+ "options": [
+ {
+ "name": "positive values",
+ "description": "sets the mixing factor in main sequence star collisions"
+ },
+ {
+ "name": 1.0,
+ "description": "Default choice",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "rejuvflag",
+ "description": "Sets whether to use the orginal prescription for mixing of main-sequence stars (based on equation 80 of Hurley+2002) or whether to use the ratio of the pre-merger He core mass at the base of the giant branch to the merger product's He core mass at the base of the giant branch",
+ "type": "dropdown",
+ "options-preface": "",
+ "options": [
+ {
+ "name": 0,
+ "description": "No modifications to BSE",
+ "default": true
+ },
+ {
+ "name": 1,
+ "description": "modified mixing times"
+ }
+ ]
+ },
+ {
+ "name": "bhms_coll_flag",
+ "description": "If set to 1, then the star is not destroyed in a BH+star collision if \\(M_{\\rm star} > M_{\\rm BH}\\)",
+ "type": "dropdown",
+ "options-preface": "",
+ "options": [
+ {
+ "name": 0,
+ "description": "Star is destroyed in a BH+star collision even if \\(M_{\\rm star} > M_{\\rm BH}\\)",
+ "default": true
+ },
+ {
+ "name": 1,
+ "description": "Star is not destroyed in a BH+star collision if \\(M_{\\rm star} > M_{\\rm BH}\\)"
+ }
+ ]
+ },
+ {
+ "settings-section": "Magnetic Braking",
+ "name": "htpmb",
+ "description": "Activates different models for magnetic braking",
+ "type": "dropdown",
+ "options-preface": "",
+ "options": [
+ {
+ "name": -1,
+ "description": "No magnetic braking"
+ },
+ {
+ "name": 0,
+ "description": "No modifications to BSE"
+ },
+ {
+ "name": 1,
+ "description": "follows Ivanona and Taam 2003",
+ "default": true
+ }
+ ]
+ },
+ {
+ "settings-section": "Miscellaneous",
+ "name": "ST_cr",
+ "description": "Activates different convective vs radiative boundaries",
+ "type": "dropdown",
+ "options-preface": "",
+ "options": [
+ {
+ "name": 0,
+ "description": "Follows BSE (Hurley+2002)"
+ },
+ {
+ "name": 1,
+ "description": "Follow StarTrack (Belczynski+2008)",
+ "default": true
+ }
+ ]
+ },
+ {
+ "name": "rtmsflag",
+ "description": "Flag for calculating the radius at the end of the main sequence.",
+ "type": "number",
+ "options-preface": "",
+ "options": [
+ {
+ "name": 0,
+ "description": "Use the original SSE calculation except if M>200Msun and Z<0.0008 (~0.04 Zsun). For the exception, an extrapolation is used. This ad hoc extrapolation works well for stars with M < 4000 Msun for Z >= 0.01 Zsun. For lower metallicities, you may still run into issues of negative radii for very massive stars - use at your own risk.",
+ "default": true
+ },
+ {
+ "name": 1,
+ "description": "Calculate using BoOST simulation data. BoOST metallicities = [1.1e-4, 2.1e-4, 1e-3, 2e-3] corresponding to [dwarfD, IZw18, dwarfA, SMC] models (Szecsi et al. (2022))"
+ },
+ {
+ "name": 2,
+ "description": "Calculating using BPASS simulation data. BPASS metallicities = [1e-4, *2e-4*, 1e-3, 2e-3]. NOTE : For BPASS, we used a power law to fit the rtms v/s mzams values for each metallicity. We have coded the best fit power-laws for the above BPASS metallicities here. Since, Z = 2e-4 model is not available in the BPASS tracks, we assume the same rtms v/s mzams power law as Z=1e-4 for Z=2e-4."
+ }
+ ]
+ }
+ ]
+ }
+]
\ No newline at end of file
diff --git a/docs/examples/index.rst b/docs/examples/index.rst
index d34ce949e..e4077d776 100644
--- a/docs/examples/index.rst
+++ b/docs/examples/index.rst
@@ -52,6 +52,13 @@ InitialBinaryTable class. Each initialized binary requires the following paramet
In [4]: print(single_binary)
+A stellar_engine or a method to evolve individual stars in the binary should be provided through another dictionary called SSEDict. Currently, either 'sse' or 'metisse' can be used as a stellar engine. Let's consider that we are using 'sse'.
+
+.. ipython::
+
+ In [5]: SSEDict = {'stellar_engine': 'sse'}
+
+
The flags for the various binary evolution prescriptions used in BSE also need to be set.
Each flag is saved in the BSEDict dictionary. Note that the BSEDict
only needs to be specified the first time a binary is evolved with COSMIC or
@@ -63,16 +70,15 @@ with `Breivik+2020 =1', 'dtp=0.0'], ['RRLO_2>=1', 'dtp=0.0']])
+ In [16]: bpp, bcm, initC, kick_info = Evolve.evolve(initialbinarytable=single_binary, BSEDict=BSEDict, SSEDict=SSEDict, timestep_conditions =[['RRLO_1>=1', 'dtp=0.0'], ['RRLO_2>=1', 'dtp=0.0']])
In [16]: print(bcm[['tphys', 'kstar_1', 'kstar_2', 'mass_1', 'mass_2', 'RRLO_1', 'RRLO_2']])
@@ -264,7 +279,7 @@ Second, pick a certain resolution for the bcm array until the system mergers or
.. ipython::
:okwarning:
- In [16]: bpp, bcm, initC, kick_info = Evolve.evolve(initialbinarytable=single_binary, BSEDict=BSEDict, timestep_conditions =[['binstate=0', 'dtp=1.0']])
+ In [16]: bpp, bcm, initC, kick_info = Evolve.evolve(initialbinarytable=single_binary, BSEDict=BSEDict, SSEDict=SSEDict, timestep_conditions =[['binstate=0', 'dtp=1.0']])
In [16]: print(bcm[['tphys', 'kstar_1', 'kstar_2', 'mass_1', 'mass_2', 'bin_state']])
@@ -275,9 +290,11 @@ Finally, we show how to print a fine resolution only during the HMXB stage of th
In [3]: single_binary = InitialBinaryTable.InitialBinaries(m1=85.543645, m2=84.99784, porb=446.795757, ecc=0.448872, tphysf=13700.0, kstar1=1, kstar2=1, metallicity=0.002)
- In [5]: BSEDict = {'xi': 1.0, 'bhflag': 1, 'neta': 0.5, 'windflag': 3, 'wdflag': 1, 'alpha1': 1.0, 'pts1': 0.001, 'pts3': 0.02, 'pts2': 0.01, 'epsnov': 0.001, 'hewind': 0.5, 'ck': 1000, 'bwind': 0.0, 'lambdaf': 0.0, 'mxns': 3.0, 'beta': -1.0, 'tflag': 1, 'acc2': 1.5, 'grflag' : 1, 'remnantflag': 4, 'ceflag': 0, 'eddfac': 1.0, 'ifflag': 0, 'bconst': 3000, 'sigma': 265.0, 'gamma': -2.0, 'pisn': 45.0, 'natal_kick_array' : [[-100.0,-100.0,-100.0,-100.0,0.0], [-100.0,-100.0,-100.0,-100.0,0.0]], 'bhsigmafrac' : 1.0, 'polar_kick_angle' : 90, 'qcrit_array' : [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0], 'cekickflag' : 2, 'cehestarflag' : 0, 'cemergeflag' : 0, 'ecsn' : 2.25, 'ecsn_mlow' : 1.6, 'aic' : 1, 'ussn' : 0, 'sigmadiv' :-20.0, 'qcflag' : 1, 'eddlimflag' : 0, 'fprimc_array' : [2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0], 'bhspinflag' : 0, 'bhspinmag' : 0.0, 'rejuv_fac' : 1.0, 'rejuvflag' : 0, 'htpmb' : 1, 'ST_cr' : 1, 'ST_tide' : 1, 'bdecayfac' : 1, 'rembar_massloss' : 0.5, 'kickflag' : 0, 'zsun' : 0.014, 'bhms_coll_flag' : 0, 'don_lim' : -1, 'acc_lim' : -1, 'rtmsflag' : 0, 'wd_mass_lim': 1}
+ In [5]: SSEDict = {'stellar_engine': 'sse'}
- In [6]: bpp, bcm, initC, kick_info = Evolve.evolve(initialbinarytable=single_binary, BSEDict=BSEDict, timestep_conditions =[['kstar_1=14', 'kstar_2<10','dtp=0.1'], ['kstar_2=14', 'kstar_1<10','dtp=0.1']])
+ In [5]: BSEDict = {'xi': 1.0, 'bhflag': 1, 'neta': 0.5, 'windflag': 3, 'wdflag': 1, 'alpha1': [1.0, 1.0], 'pts1': 0.001, 'pts3': 0.02, 'pts2': 0.01, 'epsnov': 0.001, 'hewind': 0.5, 'ck': 1000, 'bwind': 0.0, 'lambdaf': 0.0, 'mxns': 3.0, 'beta': -1.0, 'tflag': 1, 'acc2': 1.5, 'grflag' : 1, 'remnantflag': 4, 'ceflag': 0, 'eddfac': 1.0, 'ifflag': 0, 'bconst': 3000, 'sigma': 265.0, 'gamma': -2.0, 'pisn': 45.0, 'natal_kick_array' : [[-100.0,-100.0,-100.0,-100.0,0.0], [-100.0,-100.0,-100.0,-100.0,0.0]], 'bhsigmafrac' : 1.0, 'polar_kick_angle' : 90, 'qcrit_array' : [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0], 'cekickflag' : 2, 'cehestarflag' : 0, 'cemergeflag' : 0, 'ecsn' : 2.25, 'ecsn_mlow' : 1.6, 'aic' : 1, 'ussn' : 0, 'sigmadiv' :-20.0, 'qcflag' : 1, 'eddlimflag' : 0, 'fprimc_array' : [2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0], 'bhspinflag' : 0, 'bhspinmag' : 0.0, 'rejuv_fac' : 1.0, 'rejuvflag' : 0, 'htpmb' : 1, 'ST_cr' : 1, 'ST_tide' : 1, 'bdecayfac' : 1, 'rembar_massloss' : 0.5, 'kickflag' : 0, 'zsun' : 0.014, 'bhms_coll_flag' : 0, 'don_lim' : -1, 'acc_lim' : [-1, -1], 'rtmsflag' : 0, 'wd_mass_lim': 1}
+
+ In [6]: bpp, bcm, initC, kick_info = Evolve.evolve(initialbinarytable=single_binary, BSEDict=BSEDict, SSEDict=SSEDict, timestep_conditions =[['kstar_1=14', 'kstar_2<10','dtp=0.1'], ['kstar_2=14', 'kstar_1<10','dtp=0.1']])
In [16]: print(bcm[['tphys', 'kstar_1', 'kstar_2', 'mass_1', 'mass_2', 'bin_state']])
@@ -294,14 +311,16 @@ started from the beginning and three different points in the evolution, once som
:okwarning:
In [16]: single_binary = InitialBinaryTable.InitialBinaries(m1=25.543645, m2=20.99784, porb=446.795757, ecc=0.448872, tphysf=13700.0, kstar1=1, kstar2=1, metallicity=0.002)
+
+ In [16]: SSEDict = {'stellar_engine': 'sse'}
- In [17]: BSEDict = {'xi': 1.0, 'bhflag': 1, 'neta': 0.5, 'windflag': 3, 'wdflag': 1, 'alpha1': 1.0, 'pts1': 0.001, 'pts3': 0.02, 'pts2': 0.01, 'epsnov': 0.001, 'hewind': 0.5, 'ck': 1000, 'bwind': 0.0, 'lambdaf': 0.0, 'mxns': 3.0, 'beta': -1.0, 'tflag': 1, 'acc2': 1.5, 'remnantflag': 3, 'ceflag': 0, 'eddfac': 1.0, 'ifflag': 0, 'bconst': 3000, 'sigma': 265.0, 'gamma': -2.0, 'pisn': 45.0, 'natal_kick_array' : [[-100.0,-100.0,-100.0,-100.0,0.0], [-100.0,-100.0,-100.0,-100.0,0.0]], 'bhsigmafrac' : 1.0, 'polar_kick_angle' : 90, 'qcrit_array' : [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0], 'cekickflag' : 2, 'cehestarflag' : 0, 'cemergeflag' : 0, 'ecsn' : 2.5, 'ecsn_mlow' : 1.4, 'aic' : 1, 'ussn' : 0, 'sigmadiv' :-20.0, 'qcflag' : 1, 'eddlimflag' : 0, 'fprimc_array' : [2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0], 'bhspinflag' : 0, 'bhspinmag' : 0.0, 'rejuv_fac' : 1.0, 'rejuvflag' : 0, 'htpmb' : 1, 'ST_cr' : 1, 'ST_tide' : 0, 'bdecayfac' : 1, 'randomseed' : -1235453, 'grflag' : 1, 'rembar_massloss' : 0.5, 'kickflag' : 0, 'zsun' : 0.014, 'grflag' : 1, 'bhms_coll_flag' : 0, 'don_lim' : -1, 'acc_lim' : -1, 'rtmsflag' : 0, 'wd_mass_lim': 1}
+ In [17]: BSEDict = {'xi': 1.0, 'bhflag': 1, 'neta': 0.5, 'windflag': 3, 'wdflag': 1, 'alpha1': [1.0,1.0], 'pts1': 0.001, 'pts3': 0.02, 'pts2': 0.01, 'epsnov': 0.001, 'hewind': 0.5, 'ck': 1000, 'bwind': 0.0, 'lambdaf': 0.0, 'mxns': 3.0, 'beta': -1.0, 'tflag': 1, 'acc2': 1.5, 'remnantflag': 3, 'ceflag': 0, 'eddfac': 1.0, 'ifflag': 0, 'bconst': 3000, 'sigma': 265.0, 'gamma': -2.0, 'pisn': 45.0, 'natal_kick_array' : [[-100.0,-100.0,-100.0,-100.0,0.0], [-100.0,-100.0,-100.0,-100.0,0.0]], 'bhsigmafrac' : 1.0, 'polar_kick_angle' : 90, 'qcrit_array' : [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0], 'cekickflag' : 2, 'cehestarflag' : 0, 'cemergeflag' : 0, 'ecsn' : 2.5, 'ecsn_mlow' : 1.4, 'aic' : 1, 'ussn' : 0, 'sigmadiv' :-20.0, 'qcflag' : 1, 'eddlimflag' : 0, 'fprimc_array' : [2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0], 'bhspinflag' : 0, 'bhspinmag' : 0.0, 'rejuv_fac' : 1.0, 'rejuvflag' : 0, 'htpmb' : 1, 'ST_cr' : 1, 'ST_tide' : 0, 'bdecayfac' : 1, 'randomseed' : -1235453, 'grflag' : 1, 'rembar_massloss' : 0.5, 'kickflag' : 0, 'zsun' : 0.014, 'grflag' : 1, 'bhms_coll_flag' : 0, 'don_lim' : -1, 'acc_lim' : [-1, -1], 'rtmsflag' : 0, 'wd_mass_lim': 1}
In [18]: for i in [3, 7, 11]:
- ....: bpp, bcm, initC, kick_info = Evolve.evolve(initialbinarytable=single_binary, BSEDict=BSEDict)
+ ....: bpp, bcm, initC, kick_info = Evolve.evolve(initialbinarytable=single_binary, BSEDict=BSEDict, SSEDict=SSEDict)
....: for column in bpp.columns:
....: initC = initC.assign(**{column:bpp.iloc[i][column]})
- ....: bpp_mid, bcm_mid, initC_mid, kick_info = Evolve.evolve(initialbinarytable=initC, BSEDict={})
+ ....: bpp_mid, bcm_mid, initC_mid, kick_info = Evolve.evolve(initialbinarytable=initC, BSEDict={}, SSEDict={})
....: if i == 3:
....: print("From beginning")
....: print(bpp)
@@ -326,7 +345,7 @@ restart the evolution after the mass transfer would occur. We can do this by usi
In [16]: single_binary = InitialBinaryTable.InitialBinaries(m1=65.0, m2=0.93, porb=4500, ecc=0.448872,
....: tphysf=13700.0, kstar1=1, kstar2=1, metallicity=0.014*0.6)
- In [17]: bpp, bcm, initC, kick_info = Evolve.evolve(initialbinarytable=single_binary, BSEDict=BSEDict)
+ In [17]: bpp, bcm, initC, kick_info = Evolve.evolve(initialbinarytable=single_binary, BSEDict=BSEDict, SSEDict=SSEDict)
In [18]: for column in bpp.columns:
....: initC = initC.assign(**{column:bpp.iloc[6][column]})
@@ -340,7 +359,7 @@ restart the evolution after the mass transfer would occur. We can do this by usi
....: initC['sep'] = utils.a_from_p(p=initC.porb.values, m1=initC.mass_1.values, m2=initC.mass_2.values)
....: initC['bin_num'] = np.linspace(0, 1000, 1000)
- In [23]: bpp_restart, bcm_restart, initC_restart, kick_info_restart = Evolve.evolve(initialbinarytable=initC, BSEDict={})
+ In [23]: bpp_restart, bcm_restart, initC_restart, kick_info_restart = Evolve.evolve(initialbinarytable=initC, BSEDict={}, SSEDict={})
In [23]: bpp_BH = bpp_restart.loc[(bpp_restart.kstar_1 == 14) & (bpp_restart.kstar_2 == 1) & (bpp_restart.porb > 0)].groupby('bin_num', as_index=False).first()
diff --git a/docs/inifile/index.rst b/docs/inifile/index.rst
index 871f3c8ae..f9fbab60c 100644
--- a/docs/inifile/index.rst
+++ b/docs/inifile/index.rst
@@ -647,7 +647,7 @@ common envelope occurs regardless of the choices below:
``aic``, and ``ussn``, which are described below, are
only used when ``kickflag=0``
- ``0`` : The standard COSMIC kick prescription, where
+ ``1`` : The standard COSMIC kick prescription, where
kicks are drawn from a bimodal distribution with
standard FeCCSN getting a kick drawn from a Maxwellian
distribution with dispersion parameter ``sigma`` and ECSN/USSN
@@ -655,18 +655,21 @@ common envelope occurs regardless of the choices below:
additional possible options for ``bhflag``, ``bhsigmafrac``,
``aic`` and ``ussn``.
- ``-1`` : Natal kicks are drawn according to ``sigma`` and
+ ``2`` : Natal kicks are drawn according to ``sigma`` and
scaled by the ejecta mass and remnant mass following Eq. 1 of
`Giacobbo & Mapelli 2020 `_
- ``-2`` : Natal kicks are drawn according to ``sigma`` and
+ ``3`` : Natal kicks are drawn according to ``sigma`` and
scaled by just the ejecta mass following Eq. 2 of
`Giacobbo & Mapelli 2020 `_
- ``-3`` : Natal kicks are drawn according to Eq. 1 of
+ ``4`` : Natal kicks are drawn according to Eq. 1 of
`Bray & Eldridge 2016 `_
- **default = 0**
+ ``negative values`` : As above except using the Kiel & Hurley 2009 velocity
+ implementation instead of the default Pfahl+2002
+
+ **default = 1**
``sigma`` Sets the dispersion in the Maxwellian for the
SN kick velocity in km/s
@@ -1055,6 +1058,11 @@ common envelope occurs regardless of the choices below:
``-2`` : assumes material is lost from the system as
if it is a wind from the secondary
+ ``-3`` : assumes mass is lost through the outer Lagrangian point,
+ forming a circumbinary disk. See Zapartas+17 Eq. 9 and
+ Artymowicz & Lubow (1994).
+
+
``>0`` : assumes that the lost material takes away a
fraction *gamma* of the orbital angular momentum
@@ -1104,6 +1112,7 @@ common envelope occurs regardless of the choices below:
eddfac = 1.0
; gamma is the angular momentum factor for mass lost during Roche-lobe overflow
+ ; gamma=-3: assumes mass is lost through the outer Lagrangian point, forming a circumbinary disk. See Zapartas+17 Eq. 9 and Artymowicz & Lubow (1994).
; gamma=-2: assumes material is lost from the system as if it is a wind from the secondary (for super-Eddington mass transfer rates)
; gamma=-1: assumes the lost material carries with is the specific angular momentum of the primary
; gamma>0: assumes that the lost material take away a fraction (gamma) of the orbital angular momentum
diff --git a/docs/runpop/index.rst b/docs/runpop/index.rst
index cdeffb99d..360502e0e 100644
--- a/docs/runpop/index.rst
+++ b/docs/runpop/index.rst
@@ -318,9 +318,11 @@ The syntax for the Evolve class is as follows:
In [1]: from cosmic.evolve import Evolve
- In [2]: BSEDict = {'xi': 1.0, 'bhflag': 1, 'neta': 0.5, 'windflag': 3, 'wdflag': 1, 'alpha1': 1.0, 'pts1': 0.001, 'pts3': 0.02, 'pts2': 0.01, 'epsnov': 0.001, 'hewind': 0.5, 'ck': 1000, 'bwind': 0.0, 'lambdaf': 0.0, 'mxns': 3.0, 'beta': -1.0, 'tflag': 1, 'acc2': 1.5, 'grflag' : 1, 'remnantflag': 4, 'ceflag': 0, 'eddfac': 1.0, 'ifflag': 0, 'bconst': 3000, 'sigma': 265.0, 'gamma': -2.0, 'pisn': 45.0, 'natal_kick_array' : [[-100.0,-100.0,-100.0,-100.0,0.0], [-100.0,-100.0,-100.0,-100.0,0.0]], 'bhsigmafrac' : 1.0, 'polar_kick_angle' : 90, 'qcrit_array' : [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0], 'cekickflag' : 2, 'cehestarflag' : 0, 'cemergeflag' : 0, 'ecsn' : 2.25, 'ecsn_mlow' : 1.6, 'aic' : 1, 'ussn' : 0, 'sigmadiv' :-20.0, 'qcflag' : 1, 'eddlimflag' : 0, 'fprimc_array' : [2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0], 'bhspinflag' : 0, 'bhspinmag' : 0.0, 'rejuv_fac' : 1.0, 'rejuvflag' : 0, 'htpmb' : 1, 'ST_cr' : 1, 'ST_tide' : 1, 'bdecayfac' : 1, 'rembar_massloss' : 0.5, 'kickflag' : 0, 'zsun' : 0.019, 'bhms_coll_flag' : 0, 'don_lim' : -1, 'acc_lim' : -1, 'rtmsflag' : 0, 'wd_mass_lim' : 1}
+ In [2]: SSEDict = {'stellar_engine' : 'sse'}
- In [3]: bpp, bcm, initC, kick_info = Evolve.evolve(initialbinarytable=InitialBinaries, BSEDict=BSEDict)
+ In [2]: BSEDict = {'xi': 1.0, 'bhflag': 1, 'neta': 0.5, 'windflag': 3, 'wdflag': 1, 'alpha1': [1.0, 1.0], 'pts1': 0.001, 'pts3': 0.02, 'pts2': 0.01, 'epsnov': 0.001, 'hewind': 0.5, 'ck': 1000, 'bwind': 0.0, 'lambdaf': 0.0, 'mxns': 3.0, 'beta': -1.0, 'tflag': 1, 'acc2': 1.5, 'grflag' : 1, 'remnantflag': 4, 'ceflag': 0, 'eddfac': 1.0, 'ifflag': 0, 'bconst': 3000, 'sigma': 265.0, 'gamma': -2.0, 'pisn': 45.0, 'natal_kick_array' : [[-100.0,-100.0,-100.0,-100.0,0.0], [-100.0,-100.0,-100.0,-100.0,0.0]], 'bhsigmafrac' : 1.0, 'polar_kick_angle' : 90, 'qcrit_array' : [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0], 'cekickflag' : 2, 'cehestarflag' : 0, 'cemergeflag' : 0, 'ecsn' : 2.25, 'ecsn_mlow' : 1.6, 'aic' : 1, 'ussn' : 0, 'sigmadiv' :-20.0, 'qcflag' : 1, 'eddlimflag' : 0, 'fprimc_array' : [2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0], 'bhspinflag' : 0, 'bhspinmag' : 0.0, 'rejuv_fac' : 1.0, 'rejuvflag' : 0, 'htpmb' : 1, 'ST_cr' : 1, 'ST_tide' : 1, 'bdecayfac' : 1, 'rembar_massloss' : 0.5, 'kickflag' : 0, 'zsun' : 0.019, 'bhms_coll_flag' : 0, 'don_lim' : -1, 'acc_lim' : [-1, -1], 'rtmsflag' : 0, 'wd_mass_lim' : 1}
+
+ In [3]: bpp, bcm, initC, kick_info = Evolve.evolve(initialbinarytable=InitialBinaries, BSEDict=BSEDict, SSEDict=SSEDict)
In [4]: print(bcm.iloc[:10])
diff --git a/examples/CMC_Params.ini b/examples/CMC_Params.ini
index b31637730..63ccd9e42 100644
--- a/examples/CMC_Params.ini
+++ b/examples/CMC_Params.ini
@@ -403,17 +403,19 @@ qcrit_array = [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]
;;;;;;;;;;;;;;;;;;
; kickflag sets the particular kick prescription to use
-; kickflag=0 uses the standard kick prescription, where kicks are drawn from a bimodal
+; kickflag=1 uses the standard kick prescription, where kicks are drawn from a bimodal
; distribution based on whether they go through FeCCSN or ECSN/USSN
-; kickflag=-1 uses the prescription from Giacobbo & Mapelli 2020 (Eq. 1)
+; kickflag=2 uses the prescription from Giacobbo & Mapelli 2020 (Eq. 1)
; with their default parameters (=1.2 Msun, =9 Msun)
-; kickflag=-2 uses the prescription from Giacobbo & Mapelli 2020 (Eq. 2),
+; kickflag=3 uses the prescription from Giacobbo & Mapelli 2020 (Eq. 2),
; which does not scale the kick by
-; kickflag=-3 uses the prescription from Bray & Eldridge 2016 (Eq. 1)
+; kickflag=4 uses the prescription from Bray & Eldridge 2016 (Eq. 1)
; with their default parameters (alpha=70 km/s, beta=120 km/s)
-; Note: sigmadiv, bhflag, bhsigmafrac, aic, and ussn are only used when kickflag=0
-; default = 0
-kickflag = 0
+; negative kickflags are the same as their positive counterparts, but using the Kiel & Hurley 2009
+; kick implementation instead of the default Pfahl et al. 2002
+; Note: sigmadiv, bhflag, bhsigmafrac, aic, and ussn are only used when abs(kickflag)=1
+; default = 1
+kickflag = 1
; sigma sets is the dispersion in the Maxwellian for the SN kick velocity in km/s
; default = 265.0
@@ -534,6 +536,7 @@ bhspinmag = 0.0
eddfac = 1.0
; gamma is the angular momentum factor for mass lost during RLO
+; gamma=-3: assumes mass is lost through the outer Lagrangian point, forming a circumbinary disk. See Zapartas+17 Eq. 9 and Artymowicz & Lubow (1994).
; gamma=-2: assumes material is lost from the system as if it is a wind from the secondary (for super-Eddington mass transfer rates)
; gamma=-1: assumes the lost material carries with is the specific angular momentum of the primary
; gamma>0: assumes that the lost material take away a fraction (gamma) of the orbital angular momentum
diff --git a/examples/Params.ini b/examples/Params.ini
index 23254bc38..e52afce18 100644
--- a/examples/Params.ini
+++ b/examples/Params.ini
@@ -125,11 +125,30 @@ match = -5.0
; random seed int
seed = 42
+[sse]
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Single Star Evolution;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+; stellar_engine sets what evolution tracks we use for single/binary star evolution
+; stellar_engine = 'sse': Uses SSE fitting formula (Hurley et al., 2000,2002)
+; stellar_engine = 'metisse': Uses METISSE (Agrawal et al 2020, 2023). You must specifiy the directories
+; that contain the stellar-evolution tracks to be interpolated between
+; default = 'sse'
+stellar_engine = 'sse'
+
+; path_to_tracks is the directory containing the main sequence tracks needed for METISSE to interpolate bewteen
+; Required if stellar_engine = 'metisse'
+path_to_tracks = None
+
+; PATH_TO_HE_TRACKS is the directory containing the helium star tracks needed for METISSE to interpolate bewteen
+; Required if stellar_engine = 'metisse'
+path_to_he_tracks = None
[bse]
;;;;;;;;;;;;;;;;;;;;;;
-;;; SAMPLING FLAGS ;;;
+;;; TIMESTEP FLAGS ;;;
;;;;;;;;;;;;;;;;;;;;;;
; pts1,pts2,pts3 determine the timesteps chosen in each
@@ -206,8 +225,8 @@ acc2 = 1.5
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; alpha1 is the common-envelope efficiency parameter
-; default = 1.0
-alpha1 = 1.0
+; default = [1.0, 1.0], for components 1 and 2, respectively
+alpha1 = [1.0, 1.0]
; lambdaf is the binding energy factor for common envelope evolution
; lambdaf>=0.0 uses variable lambda prescription written by Onno Pols,
@@ -270,17 +289,19 @@ qcrit_array = [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]
;;;;;;;;;;;;;;;;;;
; kickflag sets the particular kick prescription to use
-; kickflag=0 uses the standard kick prescription, where kicks are drawn from a bimodal
+; kickflag=1 uses the standard kick prescription, where kicks are drawn from a bimodal
; distribution based on whether they go through FeCCSN or ECSN/USSN
-; kickflag=-1 uses the prescription from Giacobbo & Mapelli 2020 (Eq. 1)
+; kickflag=2 uses the prescription from Giacobbo & Mapelli 2020 (Eq. 1)
; with their default parameters (=1.2 Msun, =9 Msun)
-; kickflag=-2 uses the prescription from Giacobbo & Mapelli 2020 (Eq. 2),
+; kickflag=3 uses the prescription from Giacobbo & Mapelli 2020 (Eq. 2),
; which does not scale the kick by
-; kickflag=-3 uses the prescription from Bray & Eldridge 2016 (Eq. 1)
+; kickflag=4 uses the prescription from Bray & Eldridge 2016 (Eq. 1)
; with their default parameters (alpha=70 km/s, beta=120 km/s)
-; Note: sigmadiv, bhflag, bhsigmafrac, aic, and ussn are only used when kickflag=0
-; default = 0
-kickflag = 0
+; negative kickflags are the same as their positive counterparts, but using the Kiel & Hurley 2009
+; kick implementation instead of the default Pfahl et al. 2002
+; Note: sigmadiv, bhflag, bhsigmafrac, aic, and ussn are only used when abs(kickflag)=1
+; default = 1
+kickflag = 1
; sigma sets is the dispersion in the Maxwellian for the SN kick velocity in km/s
; default = 265.0
@@ -416,6 +437,7 @@ grflag = 1
eddfac = 1.0
; gamma is the angular momentum factor for mass lost during RLO
+; gamma=-3: assumes mass is lost through the outer Lagrangian point, forming a circumbinary disk. See Zapartas+17 Eq. 9 and Artymowicz & Lubow (1994).
; gamma=-2: assumes material is lost from the system as if it is a wind from the secondary (for super-Eddington mass transfer rates)
; gamma=-1: assumes the lost material carries with is the specific angular momentum of the primary
; gamma>0: assumes that the lost material take away a fraction (gamma) of the orbital angular momentum
@@ -435,8 +457,8 @@ don_lim = -1
; acc_lim = -2: assumes the accretion is limited to tkh_acc for MS/CHeB
; acc_lim = -3: assumes the accretion is limited by 10*tkh_acc for all fusing stars
; acc_lim = -4: assumes the accretion is limited by tkh_for all fusing stars
-; default = -1
-acc_lim = -1
+; default = [-1, -1], for components 1 and 2, respectively
+acc_lim = [-1, -1]
diff --git a/meson.build b/meson.build
index 4e056ef2d..2d228c8a2 100644
--- a/meson.build
+++ b/meson.build
@@ -1,7 +1,7 @@
project('cosmic',
'c',
'fortran',
- version : '3.4.10',
+ version : '3.5.0',
default_options: ['warning_level=0', 'optimization=3'],
)
@@ -11,23 +11,21 @@ ff = meson.get_compiler('fortran')
f_args = ff.get_supported_arguments('-fPIC')
add_project_arguments(f_args, language: 'fortran')
-py3 = import('python').find_installation()
+
+py3 = import('python').find_installation(pure: false)
numpy_include_dir = run_command(py3, ['-c', 'import numpy; print(numpy.get_include())'], check: true).stdout().strip()
f2py_include_dir = run_command(py3, ['-c', 'import numpy.f2py; print(numpy.f2py.get_include())'], check: true).stdout().strip()
inc_np = include_directories(numpy_include_dir, f2py_include_dir)
-f2py_source = custom_target(
- 'evolvebin-target',
- input : ['src/cosmic/src/evolv2.f', 'src/cosmic/src/comprad.f'],
- output : ['_evolvebinmodule.c', '_evolvebin-f2pywrappers.f'],
- command : [py3, '-m', 'numpy.f2py', '@INPUT@', '-m', '_evolvebin', '--lower', '@OUTDIR']
-)
+get_hash = run_command('python', './src/cosmic/get_commit_hash.py', check: true).stdout().strip()
+
lib_source = [
'src/cosmic/src/hrdiag_remnant.f',
'src/cosmic/src/assign_remnant.f',
'src/cosmic/src/benchmarkevolv2.f',
+ 'src/cosmic/src/int64.f',
'src/cosmic/src/corerd.f',
'src/cosmic/src/comenv.f',
'src/cosmic/src/dgcore.f',
@@ -48,12 +46,27 @@ lib_source = [
'src/cosmic/src/hrdiag.f',
'src/cosmic/src/star.f',
'src/cosmic/src/zcnsts.f',
- 'src/cosmic/src/deltat.f',
- 'src/cosmic/src/mlwind.f',
- 'src/cosmic/src/hrdiag.f',
- 'src/cosmic/src/star.f',
- 'src/cosmic/src/zcnsts.f',
- 'src/cosmic/src/zfuncs.f',]
+ 'src/cosmic/src/SSE/SSE_deltat.f',
+ 'src/cosmic/src/SSE/SSE_mlwind.f',
+ 'src/cosmic/src/SSE/SSE_hrdiag.f',
+ 'src/cosmic/src/SSE/SSE_star.f',
+ 'src/cosmic/src/SSE/SSE_zcnsts.f',
+ 'src/cosmic/src/SSE/SSE_zfuncs.f',
+ 'src/cosmic/src/SSE/SSE_gntage.f',
+ 'src/cosmic/src/METISSE/src/METISSE_gntage.f90',
+ 'src/cosmic/src/METISSE/src/METISSE_deltat.f90',
+ 'src/cosmic/src/METISSE/src/METISSE_mlwind.f90',
+ 'src/cosmic/src/METISSE/src/METISSE_hrdiag.f90',
+ 'src/cosmic/src/METISSE/src/METISSE_star.f90',
+ 'src/cosmic/src/METISSE/src/METISSE_zcnsts.f90',
+ 'src/cosmic/src/METISSE/src/track_support.f90',
+ 'src/cosmic/src/METISSE/src/z_support.f90',
+ 'src/cosmic/src/METISSE/src/sse_support.f90',
+ 'src/cosmic/src/METISSE/src/remnant_support.f90',
+ 'src/cosmic/src/METISSE/src/interp_support.f90',
+ 'src/cosmic/src/METISSE/src/comenv_lambda.f90',
+ 'src/cosmic/src/METISSE/src/METISSE_miscellaneous.f90',
+ 'src/cosmic/src/METISSE_utils.f90']
# Detect operating system and set appropriate linker flags
host_system = host_machine.system()
@@ -64,6 +77,15 @@ else
ldflags = [] # No special flags for other systems
endif
+
+f2py_source = custom_target(
+ 'evolvebin-target',
+ input : ['src/cosmic/src/evolv2.f', 'src/cosmic/src/comprad.f'],
+ output : ['_evolvebinmodule.c', '_evolvebin-f2pywrappers.f'],
+ command : [py3, '-m', 'numpy.f2py', '@INPUT@', '-m', '_evolvebin', '--lower']
+)
+
+
evolvebin_module = py3.extension_module('_evolvebin',
f2py_source,
lib_source,
@@ -71,19 +93,10 @@ evolvebin_module = py3.extension_module('_evolvebin',
include_directories: inc_np,
link_args: ldflags,
install : true,
- install_dir : py3.get_install_dir() / 'cosmic'
+ subdir : 'cosmic'
)
-
-module_dirs = ['src/cosmic', 'src/cosmic/bse_utils',
- 'src/cosmic/sample', 'src/cosmic/tests']
-
-# Install modules
-foreach mod_dir: module_dirs
- install_subdir(mod_dir,
- install_dir: py3.get_install_dir())
-endforeach
-
-
python_script = 'bin/cosmic-pop'
install_data(python_script, install_dir: get_option('bindir'))
+
+subdir('src/cosmic')
diff --git a/pyproject.toml b/pyproject.toml
index 7dc97e0b6..e548c8c19 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,17 +1,17 @@
[project]
-name = "cosmic"
-distname = "cosmic-popsynth"
+name = "cosmic-popsynth"
+distname = "cosmic"
description = "a Python-interfaced binary population synthesis suite"
authors = [
{ name="Katelyn Breivik", email="katie.breivik@gmail.com" },
{ name="Scott Coughlin" },
{ name="Michael Zevin" },
{ name="Carl L. Rodriguez" },
+ { name="Tom Wagg" },
]
readme = "README.md"
-
-
-requires-python = ">=3.7"
+version = "3.5.1"
+requires-python = ">=3.9"
license = { text = "MIT License" }
classifiers = [
"Development Status :: 5 - Production/Stable",
@@ -21,25 +21,14 @@ classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python",
]
-dynamic = ["version"]
-dependencies = ["numpy", "scipy", "astropy", "configparser",
- "tqdm", "pandas", "tables", "h5py", "schwimmbad",
+dependencies = ["numpy", "scipy", "astropy", "configparser",
+ "tqdm", "pandas", "tables", "h5py", "schwimmbad",
"matplotlib", "importlib-metadata"]
-
-[project.optional-dependencies]
-test = ["pytest", "pytest-xdist", "pytest-cov", "flake8", "coverage"]
-docs = ["sphinx", "numpydoc", "sphinx-bootstrap-theme",
- "sphinxcontrib-programoutput", "sphinx-automodapi",
- "ipython", "sphinx_rtd_theme", "pickleshare"]
-
-
-
[build-system]
-requires = ["meson", "meson-python", "wheel", "numpy", "setuptools"]
build-backend = 'mesonpy'
+requires = ['meson-python', 'numpy']
+[tool.cibuildwheel.macos]
+repair-wheel-command = "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}"
-# pyproject.toml
-[tool.setuptools]
-write_to = "src/cosmic/_version.py"
diff --git a/requirements.txt b/requirements.txt
index 28fb97804..3c0f9e8cd 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,11 +1,11 @@
scipy >= 0.12.1
-numpy >= 1.16
+numpy == 1.23.5
astropy >= 1.1.1
configparser
tqdm >= 4.0
pandas >= 0.24
tables > 3.5.0
-h5py >= 1.3
+h5py >= 3.7.0
schwimmbad >= 0.3.1
matplotlib >= 2.0.0
sphinx >= 1.6.1
@@ -22,3 +22,4 @@ flake8 < 5
pytest
pytest-cov
wheel
+meson
diff --git a/src/cosmic/__init__.py b/src/cosmic/__init__.py
index 612b9baaa..7779958d6 100644
--- a/src/cosmic/__init__.py
+++ b/src/cosmic/__init__.py
@@ -21,8 +21,10 @@
"""
from ._version import __version__
+from ._commit_hash import COMMIT_HASH
__version__ = __version__
+__commithash__ = COMMIT_HASH
__author__ = "Katie Breivik "
__credits__ = [
"Scott Coughlin ",
diff --git a/src/cosmic/_version.py b/src/cosmic/_version.py
index 3a426aa1e..0c11babd0 100644
--- a/src/cosmic/_version.py
+++ b/src/cosmic/_version.py
@@ -1 +1 @@
-__version__ = "3.4.10"
+__version__ = "3.5.1"
diff --git a/src/cosmic/bse_utils/meson.build b/src/cosmic/bse_utils/meson.build
new file mode 100644
index 000000000..a789396cf
--- /dev/null
+++ b/src/cosmic/bse_utils/meson.build
@@ -0,0 +1,10 @@
+python_sources = [
+ '__init__.py',
+ 'zcnsts.py',
+ 'zdata.py'
+]
+
+py3.install_sources(
+ python_sources,
+ subdir: 'cosmic/bse_utils'
+)
\ No newline at end of file
diff --git a/src/cosmic/evolve.py b/src/cosmic/evolve.py
index 2c21d2c1e..42a83a597 100644
--- a/src/cosmic/evolve.py
+++ b/src/cosmic/evolve.py
@@ -41,10 +41,24 @@
__author__ = 'Scott Coughlin '
__credits__ = ['Katelyn Breivik ',
'Michael Zevin ',
- 'digman.12@osu.edu']
+ 'digman.12@osu.edu',
+ 'Tom Wagg ']
__all__ = ['Evolve']
+
+ALL_COLUMNS = ['tphys', 'mass_1', 'mass_2', 'kstar_1', 'kstar_2', 'sep', 'porb',
+ 'ecc', 'RRLO_1', 'RRLO_2', 'evol_type', 'aj_1', 'aj_2', 'tms_1',
+ 'tms_2', 'massc_1', 'massc_2', 'rad_1', 'rad_2', 'mass0_1',
+ 'mass0_2', 'lum_1', 'lum_2', 'teff_1', 'teff_2', 'radc_1',
+ 'radc_2', 'menv_1', 'menv_2', 'renv_1', 'renv_2', 'omega_spin_1',
+ 'omega_spin_2', 'B_1', 'B_2', 'bacc_1', 'bacc_2', 'tacc_1',
+ 'tacc_2', 'epoch_1', 'epoch_2', 'bhspin_1', 'bhspin_2',
+ 'deltam_1', 'deltam_2', 'SN_1', 'SN_2', 'bin_state', 'merger_type']
+
+INTEGER_COLUMNS = ["bin_state", "bin_num", "kstar_1", "kstar_2", "SN_1", "SN_2", "evol_type"]
+
+
BPP_COLUMNS = ['tphys', 'mass_1', 'mass_2', 'kstar_1', 'kstar_2',
'sep', 'porb', 'ecc', 'RRLO_1', 'RRLO_2', 'evol_type',
'aj_1', 'aj_2', 'tms_1', 'tms_2',
@@ -53,7 +67,7 @@
'radc_1', 'radc_2', 'menv_1', 'menv_2', 'renv_1', 'renv_2',
'omega_spin_1', 'omega_spin_2', 'B_1', 'B_2', 'bacc_1', 'bacc_2',
'tacc_1', 'tacc_2', 'epoch_1', 'epoch_2',
- 'bhspin_1', 'bhspin_2', 'bin_num']
+ 'bhspin_1', 'bhspin_2']
BCM_COLUMNS = ['tphys', 'kstar_1', 'mass0_1', 'mass_1', 'lum_1', 'rad_1',
'teff_1', 'massc_1', 'radc_1', 'menv_1', 'renv_1', 'epoch_1',
@@ -61,12 +75,12 @@
'lum_2', 'rad_2', 'teff_2', 'massc_2', 'radc_2', 'menv_2',
'renv_2', 'epoch_2', 'omega_spin_2', 'deltam_2', 'RRLO_2',
'porb', 'sep', 'ecc', 'B_1', 'B_2',
- 'SN_1', 'SN_2', 'bin_state', 'merger_type', 'bin_num']
+ 'SN_1', 'SN_2', 'bin_state', 'merger_type']
KICK_COLUMNS = ['star', 'disrupted', 'natal_kick', 'phi', 'theta', 'mean_anomaly',
'delta_vsysx_1', 'delta_vsysy_1', 'delta_vsysz_1', 'vsys_1_total',
'delta_vsysx_2', 'delta_vsysy_2', 'delta_vsysz_2', 'vsys_2_total',
- 'delta_theta_total', 'omega', 'randomseed', 'bin_num']
+ 'theta_euler', 'phi_euler', 'psi_euler', 'randomseed', 'bin_num']
# We use the list of column in the initialbinarytable function to initialize
# the list of columns that we will send to the fortran evolv2 function.
@@ -95,16 +109,19 @@
INITIAL_CONDITIONS_MISC_COLUMN = ['bin_num']
+INITIAL_CONDITIONS_SSE_COLUMN = ['stellar_engine','path_to_tracks','path_to_he_tracks']
+
# Add the BSE COLUMSN and MISC COLUMN to the PASS_COLUMNS list
INITIAL_CONDITIONS_PASS_COLUMNS.extend(INITIAL_CONDITIONS_BSE_COLUMNS)
INITIAL_CONDITIONS_PASS_COLUMNS.extend(INITIAL_CONDITIONS_MISC_COLUMN)
+INITIAL_CONDITIONS_PASS_COLUMNS.extend(INITIAL_CONDITIONS_SSE_COLUMN)
if sys.version_info.major == 2 and sys.version_info.minor == 7:
INITIAL_BINARY_TABLE_SAVE_COLUMNS = INITIAL_CONDITIONS_PASS_COLUMNS[:]
else:
INITIAL_BINARY_TABLE_SAVE_COLUMNS = INITIAL_CONDITIONS_PASS_COLUMNS.copy()
-for col in ['natal_kick_array', 'qcrit_array', 'fprimc_array']:
+for col in ['natal_kick_array', 'qcrit_array', 'fprimc_array', 'alpha1', 'acc_lim']:
INITIAL_BINARY_TABLE_SAVE_COLUMNS.remove(col)
NATAL_KICK_COLUMNS = ['natal_kick',
@@ -120,10 +137,14 @@
QCRIT_COLUMNS = ['qcrit_{0}'.format(kstar) for kstar in range(0, 16)]
FPRIMC_COLUMNS = ['fprimc_{0}'.format(kstar) for kstar in range(0, 16)]
+ALPHA_COLUMNS = ['alpha1_{0}'.format(star) for star in range(0, 2)]
+ACCLIM_COLUMNS = ['acc_lim_{0}'.format(star) for star in range(0, 2)]
INITIAL_BINARY_TABLE_SAVE_COLUMNS.extend(FLATTENED_NATAL_KICK_COLUMNS)
INITIAL_BINARY_TABLE_SAVE_COLUMNS.extend(QCRIT_COLUMNS)
INITIAL_BINARY_TABLE_SAVE_COLUMNS.extend(FPRIMC_COLUMNS)
+INITIAL_BINARY_TABLE_SAVE_COLUMNS.extend(ALPHA_COLUMNS)
+INITIAL_BINARY_TABLE_SAVE_COLUMNS.extend(ACCLIM_COLUMNS)
# BSE doesn't need the binary fraction, so just add to columns for saving
INITIAL_BINARY_TABLE_SAVE_COLUMNS.insert(7, 'binfrac')
@@ -136,7 +157,7 @@ def __init__():
'''
@classmethod
- def evolve(cls, initialbinarytable, pool=None, **kwargs):
+ def evolve(self, initialbinarytable, pool=None, bpp_columns=None, bcm_columns=None, **kwargs):
"""After setting a number of initial conditions we evolve the system.
Parameters
@@ -144,6 +165,15 @@ def evolve(cls, initialbinarytable, pool=None, **kwargs):
initialbinarytable : DataFrame
Initial conditions of the binary
+ pool : Multiprocessing pool
+ Pool of workers to use to evolve systems in parallel
+
+ bpp_columns : list, optional, default: None
+ Columns to save in the bpp table (key evolutionary stage table)
+
+ bcm_columns : list, optional, default: None
+ Columns to save in the bcm table (detailed evolution table)
+
**kwargs:
There are three ways to tell evolve and thus the fortran
what you want all the flags and other BSE specific
@@ -191,11 +221,11 @@ def evolve(cls, initialbinarytable, pool=None, **kwargs):
Returns
-------
- output_bpp : DataFrame
- Evolutionary history of each binary
+ output_bpp : :class:`pandas.DataFrame`
+ Table of key evolutionary stages for each binary
- output_bcm : DataFrame
- Final state of each binary
+ output_bcm : :class:`pandas.DataFrame`
+ Table of detailed evolution for each binary
initialbinarytable : DataFrame
Initial conditions for each binary
@@ -204,12 +234,19 @@ def evolve(cls, initialbinarytable, pool=None, **kwargs):
nproc = min(kwargs.pop('nproc', 1), len(initialbinarytable))
n_per_block = kwargs.pop('n_per_block', -1)
+ if bpp_columns is None:
+ bpp_columns = BPP_COLUMNS
+ if bcm_columns is None:
+ bcm_columns = BCM_COLUMNS
+
# There are three ways to tell evolve and thus the fortran
# what you want all the flags and other BSE specific
# parameters to be
# NUMBER 1: PASS A DICTIONARY OF FLAGS
BSEDict = kwargs.pop('BSEDict', {})
+ SSEDict = kwargs.pop('SSEDict', {})
+
# NUMBER 2: PASS A PANDAS DATA FRAME WITH PARAMS DEFINED AS COLUMNS
@@ -229,15 +266,15 @@ def evolve(cls, initialbinarytable, pool=None, **kwargs):
if not os.path.isfile(params):
raise ValueError("File does not exist, probably supplied incorrect "
"path to the inifile.")
- BSEDict, _, _, _, _ = utils.parse_inifile(params)
+ BSEDict, SSEDict, _, _, _, _ = utils.parse_inifile(params)
# error check the parameters you are trying to pass to BSE
# if we sent in a table with the parameter names
# then we will temporarily create a dictionary
# in order to verify that the values in the table
# are valid
- utils.error_check(BSEDict)
-
+ utils.error_check(BSEDict, SSEDict)
+
# check the initial conditions of the system and warn user if
# anything is weird about them, such as the star starts
# in Roche Lobe overflow
@@ -253,6 +290,33 @@ def evolve(cls, initialbinarytable, pool=None, **kwargs):
if 'bin_num' not in initialbinarytable.keys():
initialbinarytable = initialbinarytable.assign(bin_num=np.arange(idx, idx + len(initialbinarytable)))
+ if SSEDict:
+ if SSEDict['stellar_engine'] == 'metisse':
+ for k, v in SSEDict.items():
+ if k in initialbinarytable.keys():
+ warnings.warn("The value for {0} in initial binary table is being "
+ "overwritten by the value of {0} from either the params "
+ "file or the SSEDict.".format(k))
+ # assigning values this way work for most of the parameters.:
+
+ kwargs1 = {k: v}
+ initialbinarytable = initialbinarytable.assign(**kwargs1)
+ _evolvebin.se_flags.using_metisse = 1
+ _evolvebin.se_flags.using_sse = 0
+
+
+ elif SSEDict['stellar_engine'] == 'sse':
+ kwargs1 = {'stellar_engine': 'sse'}
+ initialbinarytable = initialbinarytable.assign(**kwargs1)
+ for col in ['path_to_tracks', 'path_to_he_tracks']:
+ kwargs1 = {col: ''}
+ initialbinarytable = initialbinarytable.assign(**kwargs1)
+ _evolvebin.se_flags.using_sse = 1
+ _evolvebin.se_flags.using_metisse = 0
+
+ else:
+ raise ValueError("Use either 'sse' or 'metisse' as stellar engine")
+
for k, v in BSEDict.items():
if k in initialbinarytable.keys():
warnings.warn("The value for {0} in initial binary table is being "
@@ -285,6 +349,22 @@ def evolve(cls, initialbinarytable, pool=None, **kwargs):
index=initialbinarytable.index,
name='fprimc_{0}'.format(kstar))
initialbinarytable.loc[:, 'fprimc_{0}'.format(kstar)] = columns_values
+ elif k == 'alpha1':
+ columns_values = [BSEDict['alpha1']] * len(initialbinarytable)
+ initialbinarytable = initialbinarytable.assign(alpha1=columns_values)
+ for kstar in range(0, 2):
+ columns_values = pd.Series([BSEDict['alpha1'][kstar]] * len(initialbinarytable),
+ index=initialbinarytable.index,
+ name='alpha1_{0}'.format(kstar))
+ initialbinarytable.loc[:, 'alpha1_{0}'.format(kstar)] = columns_values
+ elif k == 'acc_lim':
+ columns_values = [BSEDict['acc_lim']] * len(initialbinarytable)
+ initialbinarytable = initialbinarytable.assign(acc_lim=columns_values)
+ for kstar in range(0,2):
+ columns_values = pd.Series([BSEDict['acc_lim'][kstar]] * len(initialbinarytable),
+ index=initialbinarytable.index,
+ name='acc_lim_{0}'.format(kstar))
+ initialbinarytable.loc[:, 'acc_lim_{0}'.format(kstar)] = columns_values
else:
# assigning values this way work for most of the parameters.
kwargs1 = {k: v}
@@ -295,7 +375,7 @@ def evolve(cls, initialbinarytable, pool=None, **kwargs):
# and either a dictionary or an inifile was not provided
# then we need to raise an ValueError and tell the user to provide
# either a dictionary or an inifile or add more columns
- if not BSEDict:
+ if BSEDict and SSEDict is None:
if ((not set(INITIAL_BINARY_TABLE_SAVE_COLUMNS).issubset(initialbinarytable.columns)) and
(not set(INITIAL_CONDITIONS_PASS_COLUMNS).issubset(initialbinarytable.columns))):
raise ValueError("You are passing BSE parameters as columns in the "
@@ -303,6 +383,11 @@ def evolve(cls, initialbinarytable, pool=None, **kwargs):
"Please pass a BSEDict or a params file or make sure "
"you have all BSE parameters as columns {0} or {1}.".format(
INITIAL_BINARY_TABLE_SAVE_COLUMNS, INITIAL_CONDITIONS_PASS_COLUMNS))
+
+ if (BSEDict and not SSEDict) or (SSEDict and not BSEDict):
+ raise ValueError("If you are passing BSE parameters as columns in the "
+ "initial binary table you must also pass SSE parameters "
+ "in the initial binary table.")
# If you did not supply the natal kick or qcrit_array or fprimc_array in the BSEdict then we construct
# it from the initial conditions table
@@ -319,6 +404,13 @@ def evolve(cls, initialbinarytable, pool=None, **kwargs):
if (pd.Series(FPRIMC_COLUMNS).isin(initialbinarytable.keys()).all()) and ('fprimc_array' not in BSEDict):
initialbinarytable = initialbinarytable.assign(fprimc_array=initialbinarytable[FPRIMC_COLUMNS].values.tolist())
+ if (pd.Series(ALPHA_COLUMNS).isin(initialbinarytable.keys()).all()) and ('alpha1' not in BSEDict):
+ initialbinarytable = initialbinarytable.assign(alpha1=initialbinarytable[ALPHA_COLUMNS].values.tolist())
+
+ if (pd.Series(ACCLIM_COLUMNS).isin(initialbinarytable.keys()).all()) and ('acc_lim' not in BSEDict):
+ initialbinarytable = initialbinarytable.assign(acc_lim=initialbinarytable[ACCLIM_COLUMNS].values.tolist())
+
+
# need to ensure that the order of parameters that we pass to BSE
# is correct
initial_conditions = initialbinarytable[INITIAL_CONDITIONS_PASS_COLUMNS].to_dict('records')
@@ -332,6 +424,22 @@ def evolve(cls, initialbinarytable, pool=None, **kwargs):
timestep_conditions = kwargs.pop('timestep_conditions', [])
set_checkstates(timestep_conditions=timestep_conditions)
+ # set the indices of the columns to include in bpp table (+1 because fortran is 1-indexed)
+ col_inds_bpp = np.zeros(len(ALL_COLUMNS), dtype=int)
+ col_inds_bpp[:len(bpp_columns)] = [ALL_COLUMNS.index(col) + 1 for col in bpp_columns]
+
+ # save bpp column information in the initial conditions
+ for i in range(len(initial_conditions)):
+ initial_conditions[i]["n_col_bpp"] = len(bpp_columns)
+ initial_conditions[i]["col_inds_bpp"] = col_inds_bpp
+
+ # same for bcm
+ col_inds_bcm = np.zeros(len(ALL_COLUMNS), dtype=int)
+ col_inds_bcm[:len(bcm_columns)] = [ALL_COLUMNS.index(col) + 1 for col in bcm_columns]
+ for i in range(len(initial_conditions)):
+ initial_conditions[i]["n_col_bcm"] = len(bcm_columns)
+ initial_conditions[i]["col_inds_bcm"] = col_inds_bcm
+
# check if a pool was passed
if pool is None:
with MultiPool(processes=nproc) as pool:
@@ -380,17 +488,25 @@ def evolve(cls, initialbinarytable, pool=None, **kwargs):
index=kick_info_arrays[:, -1].astype(int))
bpp = pd.DataFrame(bpp_arrays,
- columns=BPP_COLUMNS,
+ columns=bpp_columns + ["bin_num"],
index=bpp_arrays[:, -1].astype(int))
bcm = pd.DataFrame(bcm_arrays,
- columns=BCM_COLUMNS,
+ columns=bcm_columns + ["bin_num"],
index=bcm_arrays[:, -1].astype(int))
- bcm.merger_type = bcm.merger_type.astype(int).astype(str).apply(lambda x: x.zfill(4))
- bcm.bin_state = bcm.bin_state.astype(int)
- bpp.bin_num = bpp.bin_num.astype(int)
- bcm.bin_num = bcm.bin_num.astype(int)
+ # convert a subset of columns to integers
+ for col in INTEGER_COLUMNS:
+ if col in bpp.columns:
+ bpp[col] = bpp[col].astype(int)
+ if col in bcm.columns:
+ bcm[col] = bcm[col].astype(int)
+
+ # convert merger type to a padded string
+ if 'merger_type' in bpp.columns:
+ bpp.merger_type = bpp.merger_type.astype(int).astype(str).apply(lambda x: x.zfill(4))
+ if 'merger_type' in bcm.columns:
+ bcm.merger_type = bcm.merger_type.astype(int).astype(str).apply(lambda x: x.zfill(4))
return bpp, bcm, initialbinarytable, kick_info
@@ -462,10 +578,33 @@ def _evolve_single_system(f):
_evolvebin.metvars.zsun = f["zsun"]
_evolvebin.snvars.kickflag = f["kickflag"]
_evolvebin.cmcpass.using_cmc = 0
+
+ if f["stellar_engine"] == "sse":
+ _evolvebin.se_flags.using_sse = 1
+ _evolvebin.se_flags.using_metisse = 0
+ _evolvebin.metissevars.path_to_tracks = ""
+ _evolvebin.metissevars.path_to_he_tracks = ""
+ _evolvebin.metissevars.z_match_limit = 1e-2
+ _evolvebin.metissevars.METISSE_verbose = False
+ elif f["stellar_engine"] == "metisse":
+ _evolvebin.se_flags.using_metisse = 1
+ _evolvebin.se_flags.using_sse = 0
+ _evolvebin.metissevars.path_to_tracks = f["path_to_tracks"]
+ _evolvebin.metissevars.path_to_he_tracks = f["path_to_he_tracks"]
+ _evolvebin.metissevars.z_match_limit = 1e-2
+ _evolvebin.metissevars.METISSE_verbose = False
+ else:
+ raise ValueError("Use either 'sse' or 'metisse' as stellar engine")
+
+ _evolvebin.col.n_col_bpp = f["n_col_bpp"]
+ _evolvebin.col.col_inds_bpp = f["col_inds_bpp"]
+ _evolvebin.col.n_col_bcm = f["n_col_bcm"]
+ _evolvebin.col.col_inds_bcm = f["col_inds_bcm"]
[bpp_index, bcm_index, kick_info] = _evolvebin.evolv2([f["kstar_1"], f["kstar_2"]],
[f["mass_1"], f["mass_2"]],
- f["porb"], f["ecc"], f["metallicity"], f["tphysf"], f["dtp"],
+ f["porb"], f["ecc"], f["metallicity"],
+ f["tphysf"], f["dtp"],
[f["mass0_1"], f["mass0_2"]],
[f["rad_1"], f["rad_2"]],
[f["lum_1"], f["lum_2"]],
@@ -484,14 +623,18 @@ def _evolve_single_system(f):
np.zeros(20),
np.zeros(20),
f["kick_info"])
- bcm = _evolvebin.binary.bcm[:bcm_index].copy()
- bpp = _evolvebin.binary.bpp[:bpp_index].copy()
- _evolvebin.binary.bpp[:bpp_index] = np.zeros(bpp.shape)
- _evolvebin.binary.bcm[:bcm_index] = np.zeros(bcm.shape)
-
- bpp = np.hstack((bpp, np.ones((bpp.shape[0], 1))*f["bin_num"]))
- bcm = np.hstack((bcm, np.ones((bcm.shape[0], 1))*f["bin_num"]))
- kick_info = np.hstack((kick_info, np.ones((kick_info.shape[0], 1))*f["bin_num"]))
+
+ if bpp_index<0:
+ raise ValueError("Failed in METISSE_zcnsts")
+ else:
+ bpp = _evolvebin.binary.bpp[:bpp_index, :f["n_col_bpp"]].copy()
+ _evolvebin.binary.bpp[:bpp_index, :f["n_col_bpp"]] = np.zeros(bpp.shape)
+ bcm = _evolvebin.binary.bcm[:bcm_index, :f["n_col_bcm"]].copy()
+ _evolvebin.binary.bcm[:bcm_index, :f["n_col_bcm"]] = np.zeros(bcm.shape)
+
+ bpp = np.hstack((bpp, np.ones((bpp.shape[0], 1))*f["bin_num"]))
+ bcm = np.hstack((bcm, np.ones((bcm.shape[0], 1))*f["bin_num"]))
+ kick_info = np.hstack((kick_info, np.ones((kick_info.shape[0], 1))*f["bin_num"]))
return f, bpp, bcm, kick_info, _evolvebin.snvars.natal_kick_array.copy()
diff --git a/src/cosmic/get_commit_hash.py b/src/cosmic/get_commit_hash.py
new file mode 100644
index 000000000..f5ee91eea
--- /dev/null
+++ b/src/cosmic/get_commit_hash.py
@@ -0,0 +1,15 @@
+import subprocess
+
+def get_commit_hash():
+ # Run git command to get the latest commit hash
+ result = subprocess.run(['git', 'rev-parse', 'HEAD'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ commit_hash = result.stdout.decode('utf-8').strip()
+ return commit_hash
+
+def write_commit_hash_to_file(commit_hash):
+ with open('./src/cosmic/_commit_hash.py', 'w') as f:
+ f.write(f'COMMIT_HASH = "{commit_hash}"\n')
+
+if __name__ == "__main__":
+ commit_hash = get_commit_hash()
+ write_commit_hash_to_file(commit_hash)
\ No newline at end of file
diff --git a/src/cosmic/meson.build b/src/cosmic/meson.build
new file mode 100644
index 000000000..2760fa6bf
--- /dev/null
+++ b/src/cosmic/meson.build
@@ -0,0 +1,21 @@
+python_sources = [
+ '__init__.py',
+ '_commit_hash.py',
+ '_version.py',
+ 'checkstate.py',
+ 'evolve.py',
+ 'filter.py',
+ 'get_commit_hash.py',
+ 'Match.py',
+ 'plotting.py',
+ 'utils.py'
+]
+
+py3.install_sources(
+ python_sources,
+ subdir: 'cosmic'
+)
+
+subdir('bse_utils')
+subdir('sample')
+subdir('tests')
diff --git a/src/cosmic/plotting.py b/src/cosmic/plotting.py
index 58ef4c712..c54eb0db0 100644
--- a/src/cosmic/plotting.py
+++ b/src/cosmic/plotting.py
@@ -52,7 +52,7 @@
secondary_color = "C1"
-def evolve_binary(initC, t_min=None, t_max=None, BSEDict={}):
+def evolve_binary(initC, t_min=None, t_max=None, BSEDict={}, SSEDict={}):
"""
Evolves a single binary with all timesteps written
to the bcm array for plotting
@@ -71,6 +71,9 @@ def evolve_binary(initC, t_min=None, t_max=None, BSEDict={}):
BSEDict : `Dict`
Dictionary containing all BSE flags needed
+ SSEDict : `Dict`
+ Dictionary containing all SSE flags needed
+
Returns
-------
bcm : `pandas.DataFrame`
@@ -100,7 +103,7 @@ def evolve_binary(initC, t_min=None, t_max=None, BSEDict={}):
# Call evolution scripts
bpp, bcm, initC, kick_info = Evolve.evolve(
- initialbinarytable=initC, BSEDict=BSEDict
+ initialbinarytable=initC, BSEDict=BSEDict, SSEDict=SSEDict
)
# In case minimum and maximum times are not supplied by user
@@ -620,7 +623,7 @@ def plot_binary_evol(bcm, sys_obs={}, ktype_kwargs={}, t_min=None, t_max=None):
return fig
-def evolve_and_plot(initC, t_min=None, t_max=None, BSEDict=None, sys_obs={}):
+def evolve_and_plot(initC, t_min=None, t_max=None, BSEDict=None, SSEDict=None, sys_obs={}):
"""
Evolve and plot binaries as a function of time
@@ -638,6 +641,9 @@ def evolve_and_plot(initC, t_min=None, t_max=None, BSEDict=None, sys_obs={}):
BSEDict : `Dict`
Dictionary containing all BSE flags needed
+ SSEDict : `Dict`
+ Dictionary containing all SSE flags needed
+
sys_obs : `Dict`
Dictionary containing keys for binary parameters with values to plot
as vertical lines for each stellar component
@@ -670,7 +676,7 @@ def evolve_and_plot(initC, t_min=None, t_max=None, BSEDict=None, sys_obs={}):
# Evolve binary
bcm = evolve_binary(
- initC.iloc[i: i + 1], t_min=t_min_tmp, t_max=t_max_tmp, BSEDict=BSEDict
+ initC.iloc[i: i + 1], t_min=t_min_tmp, t_max=t_max_tmp, BSEDict=BSEDict, SSEDict=SSEDict
)
# Plot binary
diff --git a/src/cosmic/sample/cmc/meson.build b/src/cosmic/sample/cmc/meson.build
new file mode 100644
index 000000000..cf621f722
--- /dev/null
+++ b/src/cosmic/sample/cmc/meson.build
@@ -0,0 +1,10 @@
+python_sources = [
+ '__init__.py',
+ 'elson.py',
+ 'king.py'
+]
+
+py3.install_sources(
+ python_sources,
+ subdir: 'cosmic/sample/cmc'
+)
\ No newline at end of file
diff --git a/src/cosmic/sample/meson.build b/src/cosmic/sample/meson.build
new file mode 100644
index 000000000..fa4e4fec3
--- /dev/null
+++ b/src/cosmic/sample/meson.build
@@ -0,0 +1,13 @@
+python_sources = [
+ '__init__.py',
+ 'initialbinarytable.py',
+ 'initialcmctable.py'
+]
+
+py3.install_sources(
+ python_sources,
+ subdir: 'cosmic/sample'
+)
+
+subdir('cmc')
+subdir('sampler')
\ No newline at end of file
diff --git a/src/cosmic/sample/sampler/cmc.py b/src/cosmic/sample/sampler/cmc.py
index bc50b85e9..49467df9c 100644
--- a/src/cosmic/sample/sampler/cmc.py
+++ b/src/cosmic/sample/sampler/cmc.py
@@ -83,7 +83,7 @@ def get_cmc_sampler(
Sets the pairing of stars M>msort only with stars with M>msort
binfrac_model : `str or float`
- Model for binary fraction; choices include: vanHaaften or a fraction where 1.0 is 100% binaries
+ Model for binary fraction; choices include: vanHaaften, offner22, or a fraction where 1.0 is 100% binaries
binfrac_model_msort : `str or float`
Same as binfrac_model for M>msort
diff --git a/src/cosmic/sample/sampler/independent.py b/src/cosmic/sample/sampler/independent.py
index 974dd6347..35a26bbc7 100644
--- a/src/cosmic/sample/sampler/independent.py
+++ b/src/cosmic/sample/sampler/independent.py
@@ -22,6 +22,7 @@
import numpy as np
import warnings
import pandas as pd
+import warnings
from cosmic import utils
@@ -45,10 +46,12 @@ def get_independent_sampler(
SF_duration,
binfrac_model,
met,
+ SSEDict=None,
size=None,
total_mass=np.inf,
sampling_target="size",
trim_extra_samples=False,
+ q_power_law=0,
**kwargs
):
"""Generates an initial binary sample according to user specified models
@@ -73,8 +76,10 @@ def get_independent_sampler(
ecc_model : `str`
Model to sample eccentricity; choices include: thermal, uniform, sana12
- porb_model : `str`
+ porb_model : `str` or `dict`
Model to sample orbital period; choices include: log_uniform, sana12, raghavan10, moe19
+ or a custom power law distribution defined with a dictionary with keys "min", "max", and "slope"
+ (e.g. {"min": 0.15, "max": 0.55, "slope": -0.55}) would reproduce the Sana+2012 distribution
qmin : `float`
kwarg which sets the minimum mass ratio for sampling the secondary
@@ -114,7 +119,7 @@ def get_independent_sampler(
Duration of constant star formation beginning from SF_Start in Myr
binfrac_model : `str or float`
- Model for binary fraction; choices include: vanHaaften or a fraction where 1.0 is 100% binaries
+ Model for binary fraction; choices include: vanHaaften, offner22, or a fraction where 1.0 is 100% binaries
binfrac_model_msort : `str or float`
Same as binfrac_model for M>msort
@@ -122,6 +127,9 @@ def get_independent_sampler(
met : `float`
Sets the metallicity of the binary population where solar metallicity is zsun
+ SSEDict: `Dict`
+ Sets the engine to use for individual stellar evolution
+
size : `int`
Size of the population to sample
@@ -142,6 +150,11 @@ def get_independent_sampler(
zsun : `float`
optional kwarg for setting effective radii, default is 0.02
+ q_power_law : `float`
+ Exponent for the mass ratio distribution power law, default is 0 (flat in q). Note that
+ q_power_law cannot be exactly -1, as this would result in a divergent distribution.
+
+
Returns
-------
InitialBinaryTable : `pandas.DataFrame`
@@ -159,6 +172,16 @@ def get_independent_sampler(
n_binaries : `int`
Number of binaries needed to generate a population
"""
+ if SSEDict is not None:
+ stellar_engine = SSEDict.get("stellar_engine", "sse")
+ else:
+ stellar_engine = "sse"
+
+ if stellar_engine == "sse" and\
+ (met < 1e-4 or met > 3e-2):
+ warnings.warn("You supplied a metallicity outside of SSE's parameter space [1e-4 <= Z <= 3e-2].\
+ Z will be truncated to this limit.")
+
if sampling_target == "total_mass" and (total_mass is None or total_mass == np.inf):
raise ValueError("If `sampling_target == 'total mass'` then `total_mass` must be supplied")
if size is None and (total_mass is None or total_mass == np.inf):
@@ -212,7 +235,7 @@ def get_independent_sampler(
) = initconditions.binary_select(mass1, binfrac_model=binfrac_model, **kwargs)
# sample secondary masses for the single stars
- mass2_binaries = initconditions.sample_secondary(mass1_binaries, **kwargs)
+ mass2_binaries = initconditions.sample_secondary(mass1_binaries, q_power_law=q_power_law, **kwargs)
# check if this batch of samples will take us over our sampling target
if not target(mass1_binary, size,
@@ -284,8 +307,8 @@ def get_independent_sampler(
zsun = kwargs.pop("zsun", 0.02)
- rad1 = initconditions.set_reff(mass1_binary, metallicity=met, zsun=zsun)
- rad2 = initconditions.set_reff(mass2_binary, metallicity=met, zsun=zsun)
+ rad1 = initconditions.set_reff(mass1_binary, metallicity=met, zsun=zsun, SSEDict=SSEDict)
+ rad2 = initconditions.set_reff(mass2_binary, metallicity=met, zsun=zsun, SSEDict=SSEDict)
# sample periods and eccentricities
# if the porb_model is moe19, the metallicity needs to be supplied
@@ -302,8 +325,11 @@ def get_independent_sampler(
tphysf, metallicity = initconditions.sample_SFH(
SF_start=SF_start, SF_duration=SF_duration, met=met, size=mass1_binary.size
)
- metallicity[metallicity < 1e-4] = 1e-4
- metallicity[metallicity > 0.03] = 0.03
+
+ if stellar_engine == "sse":
+ metallicity[metallicity < 1e-4] = 1e-4
+ metallicity[metallicity > 0.03] = 0.03
+
kstar1 = initconditions.set_kstar(mass1_binary)
kstar2 = initconditions.set_kstar(mass2_binary)
@@ -322,8 +348,11 @@ def get_independent_sampler(
tphysf_singles, metallicity_singles = initconditions.sample_SFH(
SF_start=SF_start, SF_duration=SF_duration, met=met, size=mass1_singles.size
)
- metallicity_singles[metallicity_singles < 1e-4] = 1e-4
- metallicity_singles[metallicity_singles > 0.03] = 0.03
+
+ if stellar_engine == "sse":
+ metallicity_singles[metallicity_singles < 1e-4] = 1e-4
+ metallicity_singles[metallicity_singles > 0.03] = 0.03
+
kstar1_singles = initconditions.set_kstar(mass1_singles)
singles_table = InitialBinaryTable.InitialBinaries(
mass1_singles, # mass1
@@ -477,7 +506,7 @@ def sample_primary(self, primary_model='kroupa01', size=None, **kwargs):
return u, np.sum(u)
# sample secondary mass
- def sample_secondary(self, primary_mass, **kwargs):
+ def sample_secondary(self, primary_mass, q_power_law=0, **kwargs):
"""Sample a secondary mass using draws from a uniform mass ratio distribution motivated by
`Mazeh et al. (1992) `_
and `Goldberg & Mazeh (1994) `_
@@ -590,10 +619,7 @@ def sample_secondary(self, primary_mass, **kwargs):
qmin_vals[highmassIdx] = np.maximum(qmin_vals[highmassIdx], m2_min_msort/primary_mass[highmassIdx])
# --- now, randomly sample mass ratios and get secondary masses
- secondary_mass = np.random.uniform(qmin_vals, 1) * primary_mass
-
-
-
+ secondary_mass = utils.rndm(qmin_vals, 1, q_power_law, size=len(primary_mass)) * primary_mass
return secondary_mass
def binary_select(self, primary_mass, binfrac_model=0.5, **kwargs):
@@ -601,6 +627,7 @@ def binary_select(self, primary_mass, binfrac_model=0.5, **kwargs):
either a binary fraction specified by a float or a
primary-mass dependent binary fraction following
`van Haaften et al.(2009) `_ in appdx
+ or `Offner et al.(2022) `_ in fig 1
Parameters
----------
@@ -609,6 +636,9 @@ def binary_select(self, primary_mass, binfrac_model=0.5, **kwargs):
binfrac_model : str or float
vanHaaften - primary mass dependent and ONLY VALID up to 100 Msun
+
+ offner22 - primary mass dependent
+
float - fraction of binaries; 0.5 means 2 in 3 stars are a binary pair while 1
means every star is in a binary pair
@@ -650,13 +680,35 @@ def binary_select(self, primary_mass, binfrac_model=0.5, **kwargs):
binary_choose_low = np.random.uniform(
0, 1.0, primary_mass[lowmassIdx].size)
+ (singleIdx_low,) = np.where(
+ binary_fraction_low < binary_choose_low)
+ (binaryIdx_low,) = np.where(
+ binary_fraction_low >= binary_choose_low)
+ elif binfrac_model == "offner22":
+ from scipy.interpolate import BSpline
+ t = [0.0331963853, 0.0331963853, 0.0331963853, 0.0331963853, 0.106066017,
+ 0.212132034, 0.424264069, 0.866025404, 1.03077641, 1.11803399,
+ 1.95959179, 3.87298335, 6.32455532, 11.6619038, 29.1547595,
+ 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 150, 150, 150, 150]
+ c = [0.08, 0.15812003, 0.20314101, 0.23842953, 0.33154153, 0.39131739,
+ 0.46020725, 0.59009569, 0.75306454, 0.81652502, 0.93518422, 0.92030594,
+ 0.96, 0.96, 0.96, 0.96, 0.96, 0.96, 0.96, 0.96, 0.96, 0.96, 0.96, 0.96, 0.96]
+ k = 3
+ def offner_curve(x):
+ a = -0.16465041
+ b = -0.11616329
+ return np.piecewise(x, [x < 6.4, x >= 6.4], [BSpline(t,c,k), lambda x : a * np.exp(b * x) + 0.97])
+ binary_fraction_low = offner_curve(primary_mass[lowmassIdx])
+ binary_choose_low = np.random.uniform(
+ 0, 1.0, primary_mass[lowmassIdx].size)
+
(singleIdx_low,) = np.where(
binary_fraction_low < binary_choose_low)
(binaryIdx_low,) = np.where(
binary_fraction_low >= binary_choose_low)
else:
raise ValueError(
- "You have supplied a non-supported binary fraction model. Please choose vanHaaften or a float"
+ "You have supplied a non-supported binary fraction model. Please choose vanHaaften, offner22, or a float"
)
elif type(binfrac_model) == float:
if (binfrac_model <= 1.0) & (binfrac_model >= 0.0):
@@ -675,7 +727,7 @@ def binary_select(self, primary_mass, binfrac_model=0.5, **kwargs):
)
else:
raise ValueError(
- "You have not supplied a model or a fraction. Please choose either vanHaaften or a float"
+ "You have not supplied a model or a fraction. Please choose either vanHaaften, offner22, or a float"
)
# --- if using a different binary fraction for high-mass systems
@@ -686,13 +738,35 @@ def binary_select(self, primary_mass, binfrac_model=0.5, **kwargs):
binary_choose_high = np.random.uniform(
0, 1.0, primary_mass[highmassIdx].size)
+ (singleIdx_high,) = np.where(
+ binary_fraction_high < binary_choose_high)
+ (binaryIdx_high,) = np.where(
+ binary_fraction_high >= binary_choose_high)
+ elif binfrac_model_msort == "offner22":
+ from scipy.interpolate import BSpline
+ t = [0.0331963853, 0.0331963853, 0.0331963853, 0.0331963853, 0.106066017,
+ 0.212132034, 0.424264069, 0.866025404, 1.03077641, 1.11803399,
+ 1.95959179, 3.87298335, 6.32455532, 11.6619038, 29.1547595,
+ 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 150, 150, 150, 150]
+ c = [0.08, 0.15812003, 0.20314101, 0.23842953, 0.33154153, 0.39131739,
+ 0.46020725, 0.59009569, 0.75306454, 0.81652502, 0.93518422, 0.92030594,
+ 0.96, 0.96, 0.96, 0.96, 0.96, 0.96, 0.96, 0.96, 0.96, 0.96, 0.96, 0.96, 0.96]
+ k = 3
+ def offner_curve(x):
+ a = -0.16465041
+ b = -0.11616329
+ return np.piecewise(x, [x < 6.4, x >= 6.4], [BSpline(t,c,k), lambda x : a * np.exp(b * x) + 0.97])
+ binary_fraction_high = offner_curve(primary_mass[highmassIdx])
+ binary_choose_high = np.random.uniform(
+ 0, 1.0, primary_mass[highmassIdx].size)
+
(singleIdx_high,) = np.where(
binary_fraction_high < binary_choose_high)
(binaryIdx_high,) = np.where(
binary_fraction_high >= binary_choose_high)
else:
raise ValueError(
- "You have supplied a non-supported binary fraction model. Please choose vanHaaften or a float"
+ "You have supplied a non-supported binary fraction model. Please choose vanHaaften, offner22, or a float"
)
elif (binfrac_model_msort is not None) and (type(binfrac_model_msort) == float):
if (binfrac_model_msort <= 1.0) & (binfrac_model_msort >= 0.0):
@@ -711,7 +785,7 @@ def binary_select(self, primary_mass, binfrac_model=0.5, **kwargs):
)
elif (binfrac_model_msort is not None):
raise ValueError(
- "You have not supplied a model or a fraction. Please choose either vanHaaften or a float"
+ "You have not supplied a model or a fraction. Please choose either vanHaaften, offner22, or a float"
)
@@ -751,7 +825,7 @@ def sample_porb(self, mass1, mass2, rad1, rad2, porb_model, porb_max=None, size=
radii of the primaries.
rad2 : array
radii of the secondaries
- porb_model : string
+ porb_model : `str` or `dict`
selects which model to sample orbital periods, choices include:
log_uniform : semi-major axis flat in log space from RRLO < 0.5 up to 1e5 Rsun according to
`Abt (1983) `_
@@ -772,6 +846,9 @@ def sample_porb(self, mass1, mass2, rad1, rad2, porb_model, porb_max=None, size=
`Raghavan+2010 _`
but with different close binary fractions following
`Moe+2019 _`
+ Custom power law distribution defined with a dictionary with keys "min", "max", and "slope"
+ (e.g. porb_model={"min": 0.15, "max": 0.55, "slope": -0.55}) would reproduce the
+ Sana+2012 distribution.
met : float
metallicity of the population
@@ -852,6 +929,23 @@ def sample_porb(self, mass1, mass2, rad1, rad2, porb_model, porb_max=None, size=
porb = 10 ** utils.rndm(a=log10_porb_min, b=log10_porb_max, g=-0.55, size=size)
aRL_over_a = a_min / utils.a_from_p(porb,mass1,mass2)
+ elif isinstance(porb_model, dict):
+ # use a power law distribution for the orbital periods
+ params = {
+ "min": 0.15,
+ "max": 5.5,
+ "slope": -0.55,
+ }
+ # update the default parameters with the user-supplied ones
+ params.update(porb_model)
+
+ # same calculations as sana12 case (sample from a power law distribution but avoid RLOF)
+ log10_RL_porb = np.log10(utils.p_from_a(a_min, mass1, mass2))
+ params["min"] = np.full(len(a_min), params["min"])
+ params["min"][params["min"] < log10_RL_porb] = log10_RL_porb[params["min"] < log10_RL_porb]
+ porb = 10**utils.rndm(a=params["min"], b=params["max"], g=params["slope"], size=size)
+ aRL_over_a = a_min / utils.a_from_p(porb, mass1, mass2)
+
elif porb_model == "renzo19":
# Same here: if using CMC, set the maximum porb to the smaller of either the
# hard/soft boundary or 5.5 (from Sana paper)
@@ -903,7 +997,7 @@ def sample_porb(self, mass1, mass2, rad1, rad2, porb_model, porb_max=None, size=
elif porb_model == "moe19":
from scipy.interpolate import interp1d
from scipy.stats import norm
- from scipy.integrate import trapz
+ from scipy.integrate import trapezoid
try:
met = kwargs.pop('met')
except:
@@ -1072,7 +1166,7 @@ def set_kstar(self, mass):
return kstar
- def set_reff(self, mass, metallicity, zsun=0.02):
+ def set_reff(self ,mass, metallicity, zsun=0.02, SSEDict=None):
"""
Better way to set the radii from BSE, by calling it directly
@@ -1092,6 +1186,23 @@ def set_reff(self, mass, metallicity, zsun=0.02):
_evolvebin.metvars.zsun = zsun
+ if (SSEDict == None) or (SSEDict["stellar_engine"] == "sse"):
+ _evolvebin.se_flags.using_sse = True
+ _evolvebin.se_flags.using_metisse = False
+ _evolvebin.metissevars.path_to_tracks = ""
+ _evolvebin.metissevars.path_to_he_tracks = ""
+ _evolvebin.metissevars.z_match_limit = 1e-2
+ _evolvebin.metissevars.METISSE_verbose = False
+ elif SSEDict["stellar_engine"] == "metisse":
+ _evolvebin.se_flags.using_metisse = True
+ _evolvebin.se_flags.using_sse = False
+ _evolvebin.metissevars.path_to_tracks = SSEDict["path_to_tracks"]
+ _evolvebin.metissevars.path_to_he_tracks = SSEDict["path_to_he_tracks"]
+ _evolvebin.metissevars.z_match_limit = 1e-2
+ _evolvebin.metissevars.METISSE_verbose = False
+ else:
+ raise ValueError("Use either 'sse' or 'metisse' as stellar engine")
+
idx = 0
while total_length > max_array_size:
## cycle through the masses max_array_size number at a time
diff --git a/src/cosmic/sample/sampler/meson.build b/src/cosmic/sample/sampler/meson.build
new file mode 100644
index 000000000..7d193decd
--- /dev/null
+++ b/src/cosmic/sample/sampler/meson.build
@@ -0,0 +1,12 @@
+python_sources = [
+ '__init__.py',
+ 'cmc.py',
+ 'independent.py',
+ 'sampler.py',
+ 'multidim.py'
+]
+
+py3.install_sources(
+ python_sources,
+ subdir: 'cosmic/sample/sampler'
+)
\ No newline at end of file
diff --git a/src/cosmic/src/METISSE b/src/cosmic/src/METISSE
new file mode 160000
index 000000000..ede9767e3
--- /dev/null
+++ b/src/cosmic/src/METISSE
@@ -0,0 +1 @@
+Subproject commit ede9767e33696f9b8b00806fcb97a7e12b392be3
diff --git a/src/cosmic/src/METISSE_utils.f90 b/src/cosmic/src/METISSE_utils.f90
new file mode 100644
index 000000000..527198fa4
--- /dev/null
+++ b/src/cosmic/src/METISSE_utils.f90
@@ -0,0 +1,96 @@
+ subroutine assign_commons()
+ use track_support
+ implicit none
+
+ !to assign common variables when METISSE is used with COSMIC
+
+ REAL(dp) :: ecsn,ecsn_mlow
+ COMMON /SNVARS1/ ecsn,ecsn_mlow
+
+ real(dp) :: d
+
+ if(front_end == COSMIC) then
+ ! use inputs from COSMIC
+
+ if (Mec_core > 0.d0) ecsn = Mec_core
+ d = (Mec_core-Mup_core)
+ if (Mup_core > 0.d0 .and. d>tiny ) ecsn_mlow = Mup_core
+
+ else
+ print*,'Error: Front end mismtach in assign commons'
+ print*,'expected 2 (COSMIC); got ', front_end
+ endif
+
+ end subroutine
+
+ subroutine get_bhspin(bhspin,id)
+ use track_support, only: tarr,dp
+ implicit none
+ integer, intent(in) :: id
+ real(dp), intent(out) :: bhspin
+
+ bhspin = tarr(id)% pars% bhspin
+ end subroutine
+
+ subroutine check_error(err)
+ use track_support, only: code_error
+ integer, intent(out) :: err
+ err = 0
+ if(code_error) err = 1
+ end subroutine
+
+
+ subroutine assign_error()
+ use track_support, only: code_error
+ code_error = .true.
+ end subroutine
+
+ subroutine initialize_metisse_front_cmc()
+ ! passing strings with c/cmc is not very realiable
+ ! we set front end like this avoid possible seg faults
+ call initialize_front_end('cosmic')
+ end subroutine
+
+ subroutine get_COSMIC_input()
+ use track_support
+ use z_support, only: Z_accuracy_limit, get_csafe_string
+
+ ! takes inputs from cosmic and assigns them
+ ! to appropiate variables in METISSE
+
+ character(len=strlen) :: path_to_tracks, path_to_he_tracks
+ real(dp) :: z_match_limit
+ LOGICAL METISSE_verbose
+ COMMON/ METISSEVARS/ path_to_tracks,path_to_he_tracks,&
+ z_match_limit, METISSE_verbose
+
+ ! remove the null charcater if any
+ call get_csafe_string(path_to_tracks,METALLICITY_DIR)
+ call get_csafe_string(path_to_he_tracks,METALLICITY_DIR_HE)
+ Z_accuracy_limit = z_match_limit
+ verbose = METISSE_verbose
+
+ end subroutine
+
+ logical function check_path_change() result (load_tracks)
+ use track_support, only: strlen,METALLICITY_DIR, METALLICITY_DIR_HE
+ use z_support, only: get_csafe_string
+
+ character(len=strlen) :: path_to_tracks, path_to_he_tracks
+ COMMON/ METISSEVARS/ path_to_tracks,path_to_he_tracks
+
+ INTEGER :: using_cmc
+ COMMON /CMCPASS/ using_cmc
+
+ character(len=strlen) :: string1,string2
+ load_tracks = .false.
+
+ ! remove the null charcater if any
+ call get_csafe_string(path_to_tracks,string1)
+ call get_csafe_string(path_to_he_tracks, string2)
+
+ if((trim(path_to_tracks)/=trim(METALLICITY_DIR)) .or. &
+ (trim(path_to_he_tracks)/=trim(METALLICITY_DIR_HE))) load_tracks = .true.
+ end function
+
+
diff --git a/src/cosmic/src/Makefile b/src/cosmic/src/Makefile
new file mode 100644
index 000000000..de63903b0
--- /dev/null
+++ b/src/cosmic/src/Makefile
@@ -0,0 +1,22 @@
+IGNORE:
+CMPLR = gfortran
+FFLAGS = -g -O0 -Wall -Wextra
+LFLAGS = const_bse.h zdata.h
+
+.f.o:
+ $(CMPLR) -c $(FFLAGS) $<
+
+SRC = \
+test_bse.f hrdiag_remnant.f assign_remnant.f corerd.f comenv.f dgcore.f \
+evolv2.f gntage.f instar.f kick.f mix.f mrenv.f ran3.f rl.f \
+concatkstars.f comprad.f bpp_array.f checkstate.f deltat.f \
+mlwind.f hrdiag.f star.f zcnsts.f zfuncs.f
+
+OBJT1 = $(SRC:.f=.o)
+
+test: $(OBJT1) $(LFLAGS)
+ $(CMPLR) $(FFLAGS) $(OBJT1) -o test
+ mv test ../../debug/test
+
+clean:
+ rm -f *.o ../../debug/test
\ No newline at end of file
diff --git a/src/cosmic/src/SSE/SSE_deltat.f b/src/cosmic/src/SSE/SSE_deltat.f
new file mode 100644
index 000000000..7b753c208
--- /dev/null
+++ b/src/cosmic/src/SSE/SSE_deltat.f
@@ -0,0 +1,62 @@
+***
+ SUBROUTINE SSE_deltat(kw,age,tm,tn,tscls,dt,dtr)
+ IMPLICIT NONE
+ INCLUDE '../const_bse.h'
+*
+ INTEGER kw
+ REAL*8 age,tm,tn,tscls(20)
+ REAL*8 dt,dtr
+*
+* Base new time scale for changes in radius & mass on stellar type.
+*
+ if(kw.le.1)then
+ dt = pts1*tm
+ dtr = tm - age
+ elseif(kw.eq.2)then
+ dt = pts1*(tscls(1) - tm)
+ dtr = tscls(1) - age
+ elseif(kw.eq.3)then
+ if(age.lt.tscls(6))then
+ dt = pts2*(tscls(4) - age)
+ else
+ dt = pts2*(tscls(5) - age)
+ endif
+ dtr = MIN(tscls(2),tn) - age
+ elseif(kw.eq.4)then
+ dt = pts2*tscls(3)
+ dtr = MIN(tn,tscls(2) + tscls(3)) - age
+ elseif(kw.eq.5)then
+ if(age.lt.tscls(9))then
+ dt = pts3*(tscls(7) - age)
+ else
+ dt = pts3*(tscls(8) - age)
+ endif
+ dtr = MIN(tn,tscls(13)) - age
+ elseif(kw.eq.6)then
+ if(age.lt.tscls(12))then
+ dt = pts3*(tscls(10) - age)
+ else
+ dt = pts3*(tscls(11) - age)
+ endif
+ dt = MIN(dt,0.005d0)
+ dtr = tn - age
+ elseif(kw.eq.7)then
+ dt = pts1*tm
+ dtr = tm - age
+ elseif(kw.eq.8.or.kw.eq.9)then
+ if(age.lt.tscls(6))then
+ dt = pts2*(tscls(4) - age)
+ else
+ dt = pts2*(tscls(5) - age)
+ endif
+ dtr = tn - age
+ else
+* dt = MAX(0.1d0,age*10.d0)
+ dt = MAX(0.1d0,dt*10.d0)
+ dt = MIN(dt,5.0d+02)
+ dtr = dt
+ endif
+*
+ RETURN
+ END
+***
diff --git a/src/cosmic/src/SSE/SSE_gntage.f b/src/cosmic/src/SSE/SSE_gntage.f
new file mode 100644
index 000000000..e82f63ef0
--- /dev/null
+++ b/src/cosmic/src/SSE/SSE_gntage.f
@@ -0,0 +1,300 @@
+***
+ SUBROUTINE SSE_gntage(mc,mt,kw,zpars,m0,aj,k)
+ IMPLICIT NONE
+ INCLUDE '../const_bse.h'
+*
+* A routine to determine the age of a giant from its core mass and type.
+*
+* Author : C. A. Tout
+* Date : 24th September 1996
+* Revised: 21st February 1997 to include core-helium-burning stars
+*
+* Rewritten: 2nd January 1998 by J. R. Hurley to be compatible with
+* the new evolution routines and to include new stellar
+* types.
+*
+*
+ integer kw, k
+ integer j,jmax
+ parameter(jmax=30)
+*
+ real*8 mc,mt,m0,aj,tm,tn,dtm
+ real*8 tscls(20),lums(10),GB(10),zpars(20)
+ real*8 mmin,mmax,mmid,dm,f,fmid,dell,derl,lum
+ real*8 macc,lacc,tiny
+ parameter(macc=0.00001d0,lacc=0.0001d0,tiny=1.0d-14)
+ real*8 mcx,mcy
+*
+ real*8 mcheif,mcagbf,mheif,mbagbf,mcgbf,lmcgbf,lbgbf,lbgbdf
+ external mcheif,mcagbf,mheif,mbagbf,mcgbf,lmcgbf,lbgbf,lbgbdf
+*
+* This should only be entered with KW = 3, 4, 5, 6 or 9
+*
+* First we check that we don't have a CheB star
+* with too small a core mass.
+ if(kw.eq.4)then
+* Set the minimum CHeB core mass using M = Mflash
+ mcy = mcheif(zpars(2),zpars(2),zpars(10))
+ if(mc.le.mcy) kw = 3
+* if(mc.le.mcy) WRITE(66,*)' GNTAGE4: changed to 3'
+ endif
+*
+* Next we check that we don't have a GB star for M => Mfgb
+ if(kw.eq.3)then
+* Set the maximum GB core mass using M = Mfgb
+ mcy = mcheif(zpars(3),zpars(2),zpars(9))
+ if(mc.ge.mcy)then
+ kw = 4
+ aj = 0.d0
+* WRITE(66,*)' GNTAGE3: changed to 4'
+ endif
+ endif
+*
+ if(kw.eq.6)then
+*
+* We try to start the star from the start of the SAGB by
+* setting Mc = Mc,TP.
+*
+ mcy = 0.44d0*2.25d0 + 0.448d0
+ if(mc.gt.mcy)then
+* A type 6 with this sized core mass cannot exist as it should
+* already have become a NS or BH as a type 5.
+* We set it up so that it will.
+ mcx = (mc + 0.35d0)/0.773d0
+ elseif(mc.ge.0.8d0)then
+ mcx = (mc - 0.448d0)/0.44d0
+ else
+ mcx = mc
+ endif
+ m0 = mbagbf(mcx)
+ if(m0.lt.tiny)then
+* Carbon core mass is less then the minimum for the start of SAGB.
+* This must be the case of a low-mass C/O or O/Ne WD with only a
+* very small envelope added or possibly the merger of a helium star
+* with a main sequence star. We will set m0 = mt and then reset the
+* core mass to allow for some helium to be added to the C/O core.
+ kw = 14
+* WRITE(66,*)' GNTAGE6: changed to 4'
+ else
+ CALL star(kw,m0,mt,tm,tn,tscls,lums,GB,zpars,dtm,k)
+ aj = tscls(13) + 2.d0*tiny
+ endif
+ endif
+*
+ if(kw.eq.5)then
+*
+* We fit a Helium core mass at the base of the AGB.
+*
+ m0 = mbagbf(mc)
+ if(m0.lt.tiny)then
+* Helium core mass is less then the BAGB minimum.
+ kw = 14
+* WRITE(66,*)' GNTAGE5: changed to 4'
+ else
+ CALL star(kw,m0,mt,tm,tn,tscls,lums,GB,zpars,dtm,k)
+ aj = tscls(2) + tscls(3) + 2.d0*tiny
+ endif
+ endif
+*
+*
+ if(kw.eq.4)then
+*
+* The supplied age is actually the fractional age, fage, of CHeB lifetime
+* that has been completed, ie. 0 <= aj <= 1.
+*
+ if(aj.lt.0.d0.or.aj.gt.1.d0)then
+* WRITE(99,*)' FATAL ERROR! GNTAGE4: fage out of bounds '
+* WRITE(99,*)' FAGE ',aj
+* WRITE(*,*)' STOP: FATAL ERROR '
+* CALL exit(0)
+* STOP
+ aj = 0.d0
+ endif
+* Get the minimum, fage=1, and maximum, fage=0, allowable masses
+ mcy = mcagbf(zpars(2))
+ if(mc.ge.mcy)then
+ mmin = mbagbf(mc)
+ else
+ mmin = zpars(2)
+ endif
+ mmax = mheif(mc,zpars(2),zpars(10))
+ if(aj.lt.tiny)then
+ m0 = mmax
+ goto 20
+ elseif(aj.ge.1.d0)then
+ m0 = mmin
+ goto 20
+ endif
+* Use the bisection method to find m0
+ fmid = (1.d0-aj)*mcheif(mmax,zpars(2),zpars(10)) +
+ & aj*mcagbf(mmax) - mc
+ f = (1.d0-aj)*mcheif(mmin,zpars(2),zpars(10)) +
+ & aj*mcagbf(mmin) - mc
+ if(f*fmid.ge.0.d0)then
+* This will probably occur if mc is just greater than the minimum
+* allowed mass for a CHeB star and fage > 0.
+ kw = 3
+* WRITE(66,*)' GNTAGE4: changed to 3'
+ goto 90
+ endif
+ m0 = mmin
+ dm = mmax - mmin
+ do 10 , j = 1,jmax
+ dm = 0.5d0*dm
+ mmid = m0 + dm
+ fmid = (1.d0-aj)*mcheif(mmid,zpars(2),zpars(10)) +
+ & aj*mcagbf(mmid) - mc
+ if(fmid.lt.0.d0) m0 = mmid
+ if(ABS(dm).lt.macc.or.ABS(fmid).lt.tiny) goto 20
+ if(j.eq.jmax)then
+* WRITE(99,*)' FATAL ERROR! GNTAGE4: root not found '
+* WRITE(*,*)' STOP: FATAL ERROR '
+* CALL exit(0)
+* STOP
+ m0 = mt
+ aj = 0.d0
+ endif
+ 10 continue
+ 20 continue
+*
+ CALL star(kw,m0,mt,tm,tn,tscls,lums,GB,zpars,dtm,k)
+ aj = tscls(2) + aj*tscls(3)
+*
+ endif
+*
+ 90 continue
+*
+ if(kw.eq.3)then
+*
+* First we double check that we don't have a GB star for M => Mfgb
+ mcy = mcheif(zpars(3),zpars(2),zpars(9))
+ if(mc.ge.mcy)then
+* WRITE(99,*)' GNTAGE3: star too big for GB '
+* WRITE(*,*)' STOP: FATAL ERROR '
+* CALL exit(0)
+* STOP
+ mc = 0.99d0*mcy
+ endif
+* Next we find an m0 so as to place the star at the BGB
+ mcx = mcheif(zpars(2),zpars(2),zpars(9))
+ if(mc.gt.mcx)then
+ m0 = mheif(mc,zpars(2),zpars(9))
+ else
+* Use Newton-Raphson to find m0 from Lbgb
+ m0 = zpars(2)
+ CALL star(kw,m0,mt,tm,tn,tscls,lums,GB,zpars,dtm,k)
+ lum = lmcgbf(mc,GB)
+ j = 0
+ 30 continue
+ dell = lbgbf(m0) - lum
+ if(ABS(dell/lum).le.lacc) goto 40
+ derl = lbgbdf(m0)
+ m0 = m0 - dell/derl
+ j = j + 1
+ if(j.eq.jmax)then
+* WRITE(99,*)' FATAL ERROR! GNTAGE3: root not found '
+* WRITE(*,*)' STOP: FATAL ERROR '
+* CALL exit(0)
+* STOP
+ m0 = zpars(2)
+ m0 = MAX(m0,mt)
+ goto 40
+ endif
+ goto 30
+ 40 continue
+ endif
+ CALL star(kw,m0,mt,tm,tn,tscls,lums,GB,zpars,dtm,k)
+ aj = tscls(1) + 1.0d-06*(tscls(2) - tscls(1))
+*
+ endif
+*
+ if(kw.eq.8.or.kw.eq.9)then
+*
+* We make a post-MS naked helium star.
+* To make things easier we put the star at the TMS point
+* so it actually begins as type 8.
+*
+ kw = 8
+ mmin = mc
+ CALL star(kw,mmin,mc,tm,tn,tscls,lums,GB,zpars,dtm,k)
+ mcx = mcgbf(lums(2),GB,lums(6))
+ if(mcx.ge.mc)then
+* WRITE(99,*)' FATAL ERROR! GNTAGE9: mmin too big '
+* WRITE(*,*)' STOP: FATAL ERROR '
+* CALL exit(0)
+* STOP
+ m0 = mt
+ goto 80
+ endif
+ f = mcx - mc
+ mmax = mt
+ do 50 , j = 1,jmax
+ CALL star(kw,mmax,mc,tm,tn,tscls,lums,GB,zpars,dtm,k)
+ mcy = mcgbf(lums(2),GB,lums(6))
+ if(mcy.gt.mc) goto 60
+ mmax = 2.d0*mmax
+ if(j.eq.jmax)then
+* WRITE(99,*)' FATAL ERROR! GNTAGE9: mmax not found '
+* WRITE(*,*)' STOP: FATAL ERROR '
+* CALL exit(0)
+* STOP
+ m0 = mt
+ goto 80
+ endif
+ 50 continue
+ 60 continue
+ fmid = mcy - mc
+* Use the bisection method to find m0
+ if(f*fmid.ge.0.d0)then
+* WRITE(99,*)' FATAL ERROR! GNTAGE9: root not bracketed '
+* WRITE(*,*)' STOP: FATAL ERROR '
+* CALL exit(0)
+* STOP
+ m0 = mt
+ goto 80
+ endif
+ m0 = mmin
+ dm = mmax - mmin
+ do 70 , j = 1,jmax
+ dm = 0.5d0*dm
+ mmid = m0 + dm
+ CALL star(kw,mmid,mc,tm,tn,tscls,lums,GB,zpars,dtm,k)
+ mcy = mcgbf(lums(2),GB,lums(6))
+ fmid = mcy - mc
+ if(fmid.lt.0.d0) m0 = mmid
+ if(ABS(dm).lt.macc.or.ABS(fmid).lt.tiny) goto 80
+ if(j.eq.jmax)then
+* WRITE(99,*)' FATAL ERROR! GNTAGE9: root not found '
+* WRITE(*,*)' STOP: FATAL ERROR '
+* CALL exit(0)
+* STOP
+ m0 = mt
+ goto 80
+ endif
+ 70 continue
+ 80 continue
+*
+ CALL star(kw,m0,mt,tm,tn,tscls,lums,GB,zpars,dtm,k)
+ aj = tm + 1.0d-10*tm
+*
+ endif
+*
+ if(kw.eq.14)then
+*
+ kw = 4
+ m0 = mt
+ mcy = mcagbf(m0)
+ aj = mc/mcy
+ CALL star(kw,m0,mt,tm,tn,tscls,lums,GB,zpars,dtm,k)
+ if(m0.le.zpars(2))then
+ mcx = mcgbf(lums(4),GB,lums(6))
+ else
+ mcx = mcheif(m0,zpars(2),zpars(10))
+ end if
+ mc = mcx + (mcy - mcx)*aj
+ aj = tscls(2) + aj*tscls(3)
+ endif
+*
+ RETURN
+ END
+***
diff --git a/src/cosmic/src/SSE/SSE_hrdiag.f b/src/cosmic/src/SSE/SSE_hrdiag.f
new file mode 100644
index 000000000..384af5f16
--- /dev/null
+++ b/src/cosmic/src/SSE/SSE_hrdiag.f
@@ -0,0 +1,615 @@
+***
+ SUBROUTINE SSE_hrdiag(mass,aj,mt,tm,tn,tscls,lums,GB,zpars,
+ & r,lum,kw,mc,rc,menv,renv,k2,
+ & bhspin,kidx)
+ IMPLICIT NONE
+ INCLUDE '../const_bse.h'
+*
+*
+* H-R diagram for population I stars.
+* -----------------------------------
+*
+* Computes the new mass, luminosity, radius & stellar type.
+* Input (MASS, AJ, TM, TN, LUMS & TSCLS) supplied by routine STAR.
+* Ref: P.P. Eggleton, M.J. Fitchett & C.A. Tout (1989) Ap.J. 347, 998.
+*
+* Revised 27th March 1995 by C. A. Tout;
+* 24th October 1995 to include metallicity;
+* 14th November 1996 to include naked helium stars;
+* 28th February 1997 to allow accretion induced supernovae.
+*
+* Revised 5th April 1997 by J. R. Hurley
+* to include Z=0.001 as well as Z=0.02, convective overshooting,
+* MS hook and more elaborate CHeB
+*
+*
+ integer kw,kwp,kidx
+*
+ real*8 mass,aj,mt,tm,tn,tscls(20),lums(10),GB(10),zpars(20),met
+ real*8 bhspin
+ real*8 r,lum,mc,rc,menv,renv,k2
+ real*8 mch,mlp,tiny
+* parameter(mch=1.44d0,mlp=12.d0,tiny=1.0d-14)
+ parameter(mlp=12.d0,tiny=1.0d-14)
+ real*8 mass0,mt0,mtc
+ common /fall/fallback
+ REAL*8 fallback
+ REAL ran3
+ EXTERNAL ran3
+*
+* real*8 mchold
+*
+* real*8 avar,bvar
+ real*8 thook,thg,tbagb,tau,tloop,taul,tauh,tau1,tau2,dtau,texp
+ real*8 lx,ly,dell,alpha,betahrdiag,eta
+ real*8 rx,ry,delr,rzams,rtms,gammahrdiag,rmin,taumin,rg
+ parameter(taumin=5.0d-08)
+ real*8 mcmax,mcx,mcy,mcbagb,lambdahrdiag
+* real*8 frac,kappa,sappa,alphap,polyfit
+ real*8 am,xx,fac,rdgen,mew,lum0,kap,zeta,ahe,aco
+ parameter(lum0=7.0d+04,kap=-0.5d0,ahe=4.d0,aco=16.d0)
+*
+ real*8 thookf,tblf
+ real*8 lalphf,lbetaf,lnetaf,lhookf,lgbtf,lmcgbf,lzhef,lpertf
+ real*8 rzamsf,rtmsf,ralphf,rbetaf,rgammf,rhookf
+ real*8 rgbf,rminf,ragbf,rzahbf,rzhef,rhehgf,rhegbf,rpertf
+ real*8 mctmsf,mcgbtf,mcgbf,mcheif,mcagbf,lzahbf
+* real*8 mrem
+ external thookf,tblf
+ external lalphf,lbetaf,lnetaf,lhookf,lgbtf,lmcgbf,lzhef,lpertf
+ external rzamsf,rtmsf,ralphf,rbetaf,rgammf,rhookf
+ external rgbf,rminf,ragbf,rzahbf,rzhef,rhehgf,rhegbf,rpertf
+ external mctmsf,mcgbtf,mcgbf,mcheif,mcagbf,lzahbf
+*
+*
+* ---------------------------------------------------------------------
+* MASS Stellar mass in solar units (input: old; output: new value).
+* AJ Current age in Myr.
+* MT Current mass in solar units (used for R).
+* TM Main sequence time.
+* TN Nuclear burning time.
+* TSCLS Time scale for different stages.
+* LUMS Characteristic luminosity.
+* GB Giant Branch parameters
+* ZPARS Parameters for distinguishing various mass intervals.
+* R Stellar radius in solar units.
+* TE Effective temperature (suppressed).
+* KW Classification type (0 - 15).
+* MC Core mass.
+* ---------------------------------------------------------------------
+*
+*
+* Make evolutionary changes to stars that have not reached KW > 5.
+*
+ mch = 1.44d0 !set here owing to AIC ECSN model.
+*
+ mass0 = mass
+C if(mass0.gt.100.d0) mass = 100.d0
+ mt0 = mt
+C if(mt0.gt.100.d0) mt = 100.d0
+*
+ if(kw.gt.6) goto 90
+*
+ tbagb = tscls(2) + tscls(3)
+ thg = tscls(1) - tm
+*
+ rzams = rzamsf(mass)
+* calculate metallicity using the zpars(14) parameter.
+ met = 10**(LOG10(zpars(14))/0.4)
+ rtms = rtmsf(mass, met)
+*
+ if(aj.lt.tscls(1))then
+*
+* Either on MS or HG
+*
+ rg = rgbf(mt,lums(3))
+*
+ if(aj.lt.tm)then
+*
+* Main sequence star.
+*
+ mc = 0.d0
+ tau = aj/tm
+ thook = thookf(mass)*tscls(1)
+ zeta = 0.01d0
+ tau1 = MIN(1.d0,aj/thook)
+ tau2 = MAX(0.d0,
+ & MIN(1.d0,(aj-(1.d0-zeta)*thook)/(zeta*thook)))
+*
+ dell = lhookf(mass,zpars(1))
+ dtau = tau1**2 - tau2**2
+ alpha = lalphf(mass)
+ betahrdiag = lbetaf(mass)
+ eta = lnetaf(mass)
+ lx = LOG10(lums(2)/lums(1))
+ if(tau.gt.taumin)then
+ xx = alpha*tau + betahrdiag*tau**eta +
+ & (lx - alpha - betahrdiag)*tau**2 - dell*dtau
+ else
+ xx = alpha*tau + (lx - alpha)*tau**2 - dell*dtau
+ endif
+ lum = lums(1)*10.d0**xx
+*
+ delr = rhookf(mass,zpars(1))
+ dtau = tau1**3 - tau2**3
+ alpha = ralphf(mass)
+ betahrdiag = rbetaf(mass)
+ gammahrdiag = rgammf(mass)
+ rx = LOG10(rtms/rzams)
+* Note that the use of taumin is a slightly pedantic attempt to
+* avoid floating point underflow. It IS overkill!
+ if(tau.gt.taumin)then
+ xx = alpha*tau + betahrdiag*tau**10 +
+ & gammahrdiag*tau**40 + (rx - alpha - betahrdiag -
+ & gammahrdiag)*tau**3 - delr*dtau
+ else
+ xx = alpha*tau + (rx - alpha)*tau**3 - delr*dtau
+ endif
+ r = rzams*10.d0**xx
+*
+ if(mass.lt.(zpars(1)-0.3d0))then
+ kw = 0
+* This following is given by Chris for low mass MS stars which will be
+* substantially degenerate. We need the Hydrogen abundance, X, which we
+* calculate from Z assuming that the helium abundance, Y, is calculated
+* according to Y = 0.24 + 2*Z
+ rdgen = 0.0258d0*((1.d0+zpars(11))**(5.d0/3.d0))*
+ & (mass**(-1.d0/3.d0))
+ r = MAX(rdgen,r)
+ else
+ kw = 1
+ endif
+* planets
+ if(mass.lt.0.005d0.and.mass.ge.tiny)then
+ r = 0.16d0
+ endif
+*
+ else
+*
+* Star is on the HG
+*
+ mcx = mc
+ if(mass.le.zpars(2))then
+ mc = mcgbf(lums(3),GB,lums(6))
+ elseif(mass.le.zpars(3))then
+ mc = mcheif(mass,zpars(2),zpars(9))
+ else
+ mc = mcheif(mass,zpars(2),zpars(10))
+ endif
+ eta = mctmsf(mass)
+ tau = (aj - tm)/thg
+ mc = ((1.d0 - tau)*eta + tau)*mc
+ mc = MAX(mc,mcx)
+*
+* Test whether core mass has reached total mass.
+*
+ if(mc.ge.mt)then
+ aj = 0.d0
+ if(mass.gt.zpars(2))then
+*
+* Zero-age helium star
+*
+ mc = 0.d0
+ mass = mt
+ kw = 7
+ CALL SSE_star(kw,mass,mt,tm,tn,tscls,lums,GB,zpars)
+ else
+*
+* Zero-age helium white dwarf.
+*
+ mc = mt
+ mass = mt
+ kw = 10
+ endif
+ else
+ lum = lums(2)*(lums(3)/lums(2))**tau
+ if(mass.le.zpars(3))then
+ rx = rg
+ else
+* He-ignition and end of HG occur at Rmin
+ rmin = rminf(mass)
+ ry = ragbf(mt,lums(4),zpars(2))
+ rx = MIN(rmin,ry)
+ if(mass.le.mlp)then
+ texp = log(mass/mlp)/log(zpars(3)/mlp)
+ rx = rg
+ rx = rmin*(rx/rmin)**texp
+ endif
+ tau2 = tblf(mass,zpars(2),zpars(3))
+ if(tau2.lt.tiny) rx = ry
+ endif
+ r = rtms*(rx/rtms)**tau
+ kw = 2
+ endif
+*
+ endif
+*
+* Now the GB, CHeB and AGB evolution.
+*
+ elseif(aj.lt.tscls(2))then
+*
+* Red Giant.
+*
+ kw = 3
+ lum = lgbtf(aj,GB(1),GB,tscls(4),tscls(5),tscls(6))
+ if(mass.le.zpars(2))then
+* Star has a degenerate He core which grows on the GB
+ mc = mcgbf(lum,GB,lums(6))
+ else
+* Star has a non-degenerate He core which may grow, but
+* only slightly, on the GB
+ tau = (aj - tscls(1))/(tscls(2) - tscls(1))
+ mcx = mcheif(mass,zpars(2),zpars(9))
+ mcy = mcheif(mass,zpars(2),zpars(10))
+ mc = mcx + (mcy - mcx)*tau
+ endif
+ r = rgbf(mt,lum)
+ rg = r
+ if(mc.ge.mt)then
+ aj = 0.d0
+ if(mass.gt.zpars(2))then
+*
+* Zero-age helium star
+*
+ mc = 0.d0
+ mass = mt
+ kw = 7
+ CALL SSE_star(kw,mass,mt,tm,tn,tscls,lums,GB,zpars)
+ else
+*
+* Zero-age helium white dwarf.
+*
+ mc = mt
+ mass = mt
+ kw = 10
+ endif
+ endif
+*
+ elseif(aj.lt.tbagb)then
+*
+* Core helium burning star.
+*
+ if(kw.eq.3.and.mass.le.zpars(2))then
+ mass = mt
+ CALL SSE_star(kw,mass,mt,tm,tn,tscls,lums,GB,zpars)
+ aj = tscls(2)
+ endif
+ if(mass.le.zpars(2))then
+ mcx = mcgbf(lums(4),GB,lums(6))
+ else
+ mcx = mcheif(mass,zpars(2),zpars(10))
+ endif
+ tau = (aj - tscls(2))/tscls(3)
+ mc = mcx + (mcagbf(mass) - mcx)*tau
+*
+ if(mass.le.zpars(2))then
+ lx = lums(5)
+ ly = lums(7)
+ rx = rzahbf(mt,mc,zpars(2))
+ rg = rgbf(mt,lx)
+ rmin = rg*zpars(13)**(mass/zpars(2))
+ texp = MIN(MAX(0.4d0,rmin/rx),2.5d0)
+ ry = ragbf(mt,ly,zpars(2))
+ if(rmin.lt.rx)then
+ taul = (log(rx/rmin))**(1.d0/3.d0)
+ else
+ rmin = rx
+ taul = 0.d0
+ endif
+ tauh = (log(ry/rmin))**(1.d0/3.d0)
+ tau2 = taul*(tau - 1.d0) + tauh*tau
+ r = rmin*exp(abs(tau2)**3)
+ rg = rg + tau*(ry - rg)
+ lum = lx*(ly/lx)**(tau**texp)
+ elseif(mass.gt.zpars(3))then
+*
+* For HM stars He-ignition takes place at Rmin in the HG, and CHeB
+* consists of a blue phase (before tloop) and a RG phase (after tloop).
+*
+ tau2 = tblf(mass,zpars(2),zpars(3))
+ tloop = tscls(2) + tau2*tscls(3)
+ rmin = rminf(mass)
+ rg = rgbf(mt,lums(4))
+ rx = ragbf(mt,lums(4),zpars(2))
+ rmin = MIN(rmin, rx)
+ if(mass.le.mlp) then
+ texp = log(mass/mlp)/log(zpars(3)/mlp)
+ rx = rg
+ rx = rmin*(rx/rmin)**texp
+ else
+ rx = rmin
+ endif
+ texp = MIN(MAX(0.4d0,rmin/rx),2.5d0)
+ lum = lums(4)*(lums(7)/lums(4))**(tau**texp)
+ if(aj.lt.tloop)then
+ ly = lums(4)*(lums(7)/lums(4))**(tau2**texp)
+ ry = ragbf(mt,ly,zpars(2))
+ taul = 0.d0
+ if(ABS(rmin-rx).gt.tiny)then
+ taul = (log(rx/rmin))**(1.d0/3.d0)
+ endif
+ tauh = 0.d0
+ if(ry.gt.rmin) tauh = (log(ry/rmin))**(1.d0/3.d0)
+ tau = (aj - tscls(2))/(tau2*tscls(3))
+ tau2 = taul*(tau - 1.d0) + tauh*tau
+ r = rmin*exp(abs(tau2)**3)
+ rg = rg + tau*(ry - rg)
+ else
+ r = ragbf(mt,lum,zpars(2))
+ rg = r
+ endif
+ else
+*
+* For IM stars CHeB consists of a RG phase (before tloop) and a blue
+* loop (after tloop).
+*
+ tau2 = 1.d0 - tblf(mass,zpars(2),zpars(3))
+ tloop = tscls(2) + tau2*tscls(3)
+ if(aj.lt.tloop)then
+ tau = (tloop - aj)/(tau2*tscls(3))
+ lum = lums(5)*(lums(4)/lums(5))**(tau**3)
+ r = rgbf(mt,lum)
+ rg = r
+ else
+ lx = lums(5)
+ ly = lums(7)
+ rx = rgbf(mt,lx)
+ rmin = rminf(mt)
+ texp = MIN(MAX(0.4d0,rmin/rx),2.5d0)
+ ry = ragbf(mt,ly,zpars(2))
+ if(rmin.lt.rx)then
+ taul = (log(rx/rmin))**(1.d0/3.d0)
+ else
+ rmin = rx
+ taul = 0.d0
+ endif
+ tauh = (log(ry/rmin))**(1.d0/3.d0)
+ tau = (aj - tloop)/(tscls(3) - (tloop - tscls(2)))
+ tau2 = taul*(tau - 1.d0) + tauh*tau
+ r = rmin*exp(abs(tau2)**3)
+ rg = rx + tau*(ry - rx)
+ lum = lx*(ly/lx)**(tau**texp)
+ endif
+ endif
+*
+* Test whether core mass exceeds total mass.
+*
+ if(mc.ge.mt)then
+*
+* Evolved MS naked helium star.
+*
+ kw = 7
+ xx = (aj - tscls(2))/tscls(3)
+ mass = mt
+ CALL SSE_star(kw,mass,mt,tm,tn,tscls,lums,GB,zpars)
+ aj = xx*tm
+ else
+ kw = 4
+ endif
+*
+ else
+*
+* Asymptotic Red Giant.
+*
+* On the AGB the He core mass remains constant until at Ltp it
+* is caught by the C core mass and they grow together.
+*
+ mcbagb = mcagbf(mass)
+ mcx = mcgbtf(tbagb,GB(8),GB,tscls(7),tscls(8),tscls(9))
+ mcmax = MAX(MAX(mch,0.773d0*mcbagb-0.35d0),1.05d0*mcx)
+*
+ if(aj.lt.tscls(13))then
+ mcx = mcgbtf(aj,GB(8),GB,tscls(7),tscls(8),tscls(9))
+ mc = mcbagb
+ lum = lmcgbf(mcx,GB)
+ if(mt.le.mc)then
+*
+* Evolved naked helium star as the envelope is lost but the
+* star has not completed its interior burning. The star becomes
+* a post-HeMS star.
+*
+ kw = 9
+ mt = mc
+ mass = mt
+ mc = mcx
+ CALL SSE_star(kw,mass,mt,tm,tn,tscls,lums,GB,zpars)
+ if(mc.le.GB(7))then
+ aj = tscls(4) - (1.d0/((GB(5)-1.d0)*GB(8)*GB(4)))*
+ & (mc**(1.d0-GB(5)))
+ else
+ aj = tscls(5) - (1.d0/((GB(6)-1.d0)*GB(8)*GB(3)))*
+ & (mc**(1.d0-GB(6)))
+ endif
+ aj = MAX(aj,tm)
+ goto 90
+ else
+ kw = 5
+ endif
+ else
+ kw = 6
+ mc = mcgbtf(aj,GB(2),GB,tscls(10),tscls(11),tscls(12))
+ lum = lmcgbf(mc,GB)
+*
+* Approximate 3rd Dredge-up on AGB by limiting Mc.
+*
+ lambdahrdiag = MIN(0.9d0,0.3d0+0.001d0*mass**5)
+ tau = tscls(13)
+ mcx = mcgbtf(tau,GB(2),GB,tscls(10),tscls(11),tscls(12))
+ mcy = mc
+ mc = mc - lambdahrdiag*(mcy-mcx)
+ mcx = mc
+ mcmax = MIN(mt,mcmax)
+ endif
+ r = ragbf(mt,lum,zpars(2))
+ rg = r
+*
+* Mc,x represents the C core mass and we now test whether it
+* exceeds either the total mass or the maximum allowed core mass.
+*
+ if(mcmax-mcx.lt.tiny)then
+ aj = 0.d0
+ mc = mcmax
+ call assign_remnant(zpars,mc,mcbagb,mass,mt,kw,bhspin,kidx)
+ endif
+*
+ endif
+*
+ 90 continue
+*
+ if(kw.ge.7.and.kw.le.9)then
+*
+* Naked Helium Star
+*
+ rzams = rzhef(mt)
+ rx = rzams
+ if(aj.lt.tm)then
+*
+* Main Sequence
+*
+ kw = 7
+ tau = aj/tm
+ am = MAX(0.d0,0.85d0-0.08d0*mass)
+ lum = lums(1)*(1.d0+0.45d0*tau+am*tau**2)
+ am = MAX(0.d0,0.4d0-0.22d0*LOG10(mt))
+ r = rx*(1.d0+am*(tau-tau**6))
+ rg = rx
+* Star has no core mass and hence no memory of its past
+* which is why we subject mass and mt to mass loss for
+* this phase.
+ mc = 0.d0
+ if(mt.lt.zpars(10)) kw = 10
+ else
+*
+* Helium Shell Burning
+*
+ kw = 8
+ lum = lgbtf(aj,GB(8),GB,tscls(4),tscls(5),tscls(6))
+ r = rhehgf(mt,lum,rx,lums(2))
+ rg = rhegbf(lum)
+ if(r.ge.rg)then
+ kw = 9
+ r = rg
+ endif
+ mc = mcgbf(lum,GB,lums(6))
+ mtc = MIN(mt,1.45d0*mt-0.31d0)
+ mcmax = MIN(mtc,MAX(mch,0.773d0*mass-0.35d0))
+ if(mcmax-mc.lt.tiny)then
+ aj = 0.d0
+ mc = mcmax
+ mcbagb = mass
+ call assign_remnant(zpars,mc,mcbagb,mass,
+ & mt,kw,bhspin,kidx)
+
+ if(kw.eq.11) mt = MAX(mc,(mc+0.31d0)/1.45d0)
+ endif
+ endif
+ endif
+*
+ call hrdiag_remnant(zpars,mt,mc,lum,r,aj,kw)
+*
+* Calculate the core radius and the luminosity and radius of the
+* remnant that the star will become.
+*
+ tau = 0.d0
+ if(kw.le.1.or.kw.eq.7)then
+ rc = 0.d0
+ elseif(kw.le.3)then
+ if(mass.gt.zpars(2))then
+ lx = lzhef(mc)
+ rx = rzhef(mc)
+ rc = rx
+ else
+ if(wdflag.eq.0)then
+ lx = 635.d0*mc*zpars(14)/((ahe*0.1d0)**1.4d0)
+ elseif(wdflag.ge.1)then
+ lx = 300.d0*mc*zpars(14)/((ahe*0.1d0)**1.18d0)
+ endif
+ rx = 0.0115d0*SQRT(MAX(1.48204d-06,
+ & (mch/mc)**(2.d0/3.d0)-(mc/mch)**(2.d0/3.d0)))
+ rc = 5.d0*rx
+ endif
+ elseif(kw.eq.4)then
+ tau = (aj - tscls(2))/tscls(3)
+ kwp = 7
+ CALL SSE_star(kwp,mc,mc,tm,tn,tscls,lums,GB,zpars)
+ am = MAX(0.d0,0.85d0-0.08d0*mc)
+ lx = lums(1)*(1.d0+0.45d0*tau+am*tau**2)
+ rx = rzhef(mc)
+ am = MAX(0.d0,0.4d0-0.22d0*LOG10(mc))
+ rx = rx*(1.d0+am*(tau-tau**6))
+ CALL SSE_star(kw,mass,mt,tm,tn,tscls,lums,GB,zpars)
+ rc = rx
+ elseif(kw.eq.5)then
+ kwp = 9
+ if(tn.gt.tbagb) tau = 3.d0*(aj-tbagb)/(tn-tbagb)
+ CALL SSE_star(kwp,mc,mc,tm,tn,tscls,lums,GB,zpars)
+ lx = lmcgbf(mcx,GB)
+ if(tau.lt.1.d0) lx = lums(2)*(lx/lums(2))**tau
+ rx = rzhef(mc)
+ rx = MIN(rhehgf(mc,lx,rx,lums(2)),rhegbf(lx))
+ CALL SSE_star(kw,mass,mt,tm,tn,tscls,lums,GB,zpars)
+ rc = rx
+ elseif(kw.le.9)then
+ if(wdflag.eq.0)then
+ lx = 635.d0*mc*zpars(14)/((aco*0.1d0)**1.4d0)
+ elseif(wdflag.ge.1)then
+ lx = 300.d0*mc*zpars(14)/((aco*0.1d0)**1.18d0)
+ endif
+ rx = 0.0115d0*SQRT(MAX(1.48204d-06,
+ & (mch/mc)**(2.d0/3.d0) - (mc/mch)**(2.d0/3.d0)))
+ rc = 5.d0*rx
+ else
+ rc = r
+ menv = 1.0d-10
+ renv = 1.0d-10
+ k2 = 0.21d0
+ endif
+*
+* Perturb the luminosity and radius due to small envelope mass.
+*
+ if(kw.ge.2.and.kw.le.9.and.kw.ne.7)then
+ mew = ((mt-mc)/mt)*MIN(5.d0,MAX(1.2d0,(lum/lum0)**kap))
+ if(kw.ge.8) mew = ((mtc-mc)/mtc)*5.d0
+ if(mew.lt.1.d0)then
+ xx = lpertf(mt,mew)
+ lum = lx*(lum/lx)**xx
+ if(r.le.rx)then
+ xx = 0.d0
+ else
+ xx = rpertf(mt,mew,r,rx)
+ endif
+ r = rx*(r/rx)**xx
+ endif
+ rc = MIN(rc,r)
+ endif
+*
+* Calculate mass and radius of convective envelope, and envelope
+* gyration radius.
+*
+ if(kw.lt.10)then
+ CALL mrenv(kw,mass,mt,mc,lum,r,rc,aj,tm,lums(2),lums(3),
+ & lums(4),rzams,rtms,rg,menv,renv,k2)
+ endif
+*
+ if(ST_tide.gt.0)then
+ if(kw.le.2.or.kw.eq.7.or.kw.ge.10)then
+ if(mt.le.1.d0)then
+ k2 = 0.205d0
+ else
+ k2 = 0.075d0
+ endif
+ else
+ k2 = 0.1d0
+ endif
+ endif
+*
+C if(mass.gt.99.99d0)then
+C mass = mass0
+C endif
+C if(mt.gt.99.99d0)then
+C mt = mt0
+C endif
+*
+ return
+ end
+***
diff --git a/src/cosmic/src/SSE/SSE_mlwind.f b/src/cosmic/src/SSE/SSE_mlwind.f
new file mode 100644
index 000000000..3be7c80d5
--- /dev/null
+++ b/src/cosmic/src/SSE/SSE_mlwind.f
@@ -0,0 +1,249 @@
+***
+ real*8 FUNCTION SSE_mlwind(kw,lum,r,mt,mc,rl,z)
+ IMPLICIT NONE
+ INCLUDE '../const_bse.h'
+ integer kw,testflag
+ real*8 lum,r,mt,mc,rl,z,teff,alpha
+ real*8 dml,dms,dmt,p0,x,mew,lum0,kap
+ real*8 MLalpha
+ external MLalpha
+ parameter(lum0=7.0d+04,kap=-0.5d0)
+*
+* windflag = 0 !BSE=0, startrack08=1, vink=2, vink+LBV for all
+* stars=3.
+* Must be one of these values or mlwind will cause problem with code,
+* i.e. mlwind not set (see last line of main if statement...).
+
+ if(windflag.eq.0)then
+* BSE
+*
+* Calculate stellar wind mass loss.
+*
+* Apply mass loss of Nieuwenhuijzen & de Jager, A&A, 1990, 231, 134,
+* for massive stars over the entire HRD.
+ dms = 0.d0
+ if(lum.gt.4000.d0)then
+ x = MIN(1.d0,(lum-4000.d0)/500.d0)
+ dms = 9.6d-15*x*(r**0.81d0)*(lum**1.24d0)*(mt**0.16d0)
+ alpha = 0.5d0
+ dms = dms*(z/zsun)**(alpha)
+ endif
+ if(kw.ge.2.and.kw.le.9)then
+* 'Reimers' mass loss
+ dml = neta*4.0d-13*r*lum/mt
+ if(rl.gt.0.d0) dml =
+ & dml*(1.d0 + bwind*(MIN(0.5d0,(r/rl)))**6)
+* Apply mass loss of Vassiliadis & Wood, ApJ, 1993, 413, 641,
+* for high pulsation periods on AGB.
+ if(kw.eq.5.or.kw.eq.6)then
+ p0 = -2.07d0 - 0.9d0*log10(mt) + 1.94d0*log10(r)
+ p0 = 10.d0**p0
+ p0 = MIN(p0,2000.d0)
+ dmt = -11.4d0+0.0125d0*(p0-100.d0*MAX(mt-2.5d0,0.d0))
+ dmt = 10.d0**dmt
+ dmt = 1.d0*MIN(dmt,1.36d-09*lum)
+ dml = MAX(dml,dmt)
+ endif
+ if(kw.gt.6)then
+ dms = MAX(dml,1.0d-13*hewind*lum**(3.d0/2.d0))
+ else
+ dms = MAX(dml,dms)
+ mew = ((mt-mc)/mt)*MIN(5.d0,MAX(1.2d0,(lum/lum0)**kap))
+* reduced WR-like mass loss for small H-envelope mass
+ if(mew.lt.1.d0)then
+ dml = 1.0d-13*lum**(3.d0/2.d0)*(1.d0 - mew)
+ dms = MAX(dml,dms)
+ endif
+* LBV-like mass loss beyond the Humphreys-Davidson limit.
+ x = 1.0d-5*r*sqrt(lum)
+ if(lum.gt.6.0d+05.and.x.gt.1.d0)then
+ dml = 0.1d0*(x-1.d0)**3*(lum/6.0d+05-1.d0)
+ dms = dms + dml
+ endif
+ endif
+ endif
+*
+ SSE_mlwind = dms
+ elseif(windflag.eq.1)then
+* StarTrack (Beclzynski+08)
+*
+* Calculate stellar wind mass loss.
+*
+* Apply mass loss of Nieuwenhuijzen & de Jager, A&A, 1990, 231, 134,
+* for massive stars over the entire HRD, with no luminosity limit
+* according to Belczynsk+08 pp. 174.
+*
+* This may not be what is actually assumed in StarTrack (see the windf1 function).
+*
+*
+ dms = 0.d0
+ if(lum.gt.4000.d0.or.(kw.ge.0.and.kw.le.1))then
+ if(lum.gt.4000.d0)then
+ x = MIN(1.d0,(lum-4000.d0)/500.d0)
+ else
+ x = 0.1d0/500.d0
+ endif !or is it simply x = Min(1, lum/500)?
+ dms = 9.6d-15*x*(r**0.81d0)*(lum**1.24d0)*(mt**0.16d0)
+ alpha = 0.5d0
+ dms = dms*(z/zsun)**(alpha)
+ endif
+ if(kw.ge.2.and.kw.le.9)then
+* 'Reimers' mass loss
+ dml = neta*4.0d-13*r*lum/mt
+ if(rl.gt.0.d0) dml =
+ & dml*(1.d0 + bwind*(MIN(0.5d0,(r/rl)))**6)
+* Apply mass loss of Vassiliadis & Wood, ApJ, 1993, 413, 641,
+* for high pulsation periods on AGB.
+ if(kw.eq.5.or.kw.eq.6)then
+ p0 = -2.07d0 - 0.9d0*log10(mt) + 1.94d0*log10(r)
+ p0 = 10.d0**p0
+ p0 = MIN(p0,2000.d0)
+ dmt = -11.4d0+0.0125d0*(p0-100.d0*MAX(mt-2.5d0,0.d0))
+ dmt = 10.d0**dmt
+ dmt = 1.d0*MIN(dmt,1.36d-09*lum)
+ dml = MAX(dml,dmt)
+ endif
+ if(kw.gt.6)then
+ dms = MAX(dml,1.0d-13*lum**(3.d0/2.d0)) !hewind here for KH06, not included for StarTrack...
+ else
+ dms = MAX(dml,dms)
+ mew = ((mt-mc)/mt)*MIN(5.d0,MAX(1.2d0,(lum/lum0)**kap))
+* reduced WR-like mass loss for small H-envelope mass
+ if(mew.lt.1.d0)then
+ dml = 1.0d-13*lum**(3.d0/2.d0)*(1.d0 - mew)
+ dms = MAX(dml,dms)
+ endif
+* LBV-like mass loss beyond the Humphreys-Davidson limit.
+ x = 1.0d-5*r*sqrt(lum)
+ if(lum.gt.6.0d+05.and.x.gt.1.d0)then
+ dml = 0.1d0*(x-1.d0)**3*(lum/6.0d+05-1.d0)
+ dms = dms + dml
+ endif
+ endif
+ endif
+*
+ SSE_mlwind = dms
+ elseif(windflag.eq.2.or.windflag.eq.3)then
+* Vink winds etc according to as implemented following
+* Belczynski, Bulik, Fryer, Ruiter, Valsecchi, Vink & Hurley 2010.
+*
+* Firstly implement BSE 'old' winds that cover all other stars not
+* accounted for by Vink winds (see Belczynski+09). Then implement
+* Vink et al. winds.
+*
+* We also include the option for a variable metallicity-dependent mass
+* loss parameter which eddlimflag is set, which makes the metallicity
+* dependence become weaker as the star approaches the electron-scattering
+* Eddington limit (Grafener & Hamann 2008, Giacobbo et al. 2018)
+*
+ teff = 1000.d0*((1130.d0*lum/(r**2.d0))**(1.d0/4.d0))
+ dms = 0.d0
+ if(lum.gt.4000.d0)then
+* Apply mass loss of Nieuwenhuijzen & de Jager, A&A, 1990, 231, 134,
+* for massive stars over the entire HRD after OB stars accounted for.
+ x = MIN(1.d0,(lum-4000.d0)/500.d0)
+ dms = 9.6d-15*x*(r**0.81d0)*(lum**1.24d0)*(mt**0.16d0)
+ alpha = 0.5d0
+ dms = dms*(z/zsun)**(alpha)
+ testflag = 1
+ endif
+ if(kw.ge.2.and.kw.le.6)then
+* 'Reimers' mass loss
+ dml = neta*4.0d-13*r*lum/mt
+ if(rl.gt.0.d0) dml =
+ & dml*(1.d0 + bwind*(MIN(0.5d0,(r/rl)))**6)
+* Apply mass loss of Vassiliadis & Wood, ApJ, 1993, 413, 641,
+* for high pulsation periods on AGB.
+ if(kw.eq.5.or.kw.eq.6)then
+ p0 = -2.07d0 - 0.9d0*log10(mt) + 1.94d0*log10(r)
+ p0 = 10.d0**p0
+ p0 = MIN(p0,2000.d0)
+ dmt = -11.4d0+0.0125d0*(p0-100.d0*MAX(mt-2.5d0,0.d0))
+ dmt = 10.d0**dmt
+ dmt = 1.d0*MIN(dmt,1.36d-09*lum)
+ dml = MAX(dml,dmt)
+ endif
+ dms = MAX(dms,dml)
+ endif
+* Apply Vink, de Koter & Lamers (2001) OB star winds.
+* Next check if hot massive H-rich O/B star in appropriate temperature ranges.
+ if(teff.ge.12500.and.teff.le.25000)then
+ if(eddlimflag.eq.0) alpha = 0.85d0
+ if(eddlimflag.eq.1) alpha = MLalpha(mt,lum,kw)
+ dms = -6.688d0 + 2.210d0*LOG10(lum/1.0d+05) -
+ & 1.339d0*LOG10(mt/30.d0) - 1.601d0*LOG10(1.3d0/2.d0) +
+ & alpha*LOG10(z/zsun) + 1.07d0*LOG10(teff/2.0d+04)
+ dms = 10.d0**dms
+ testflag = 2
+ elseif(teff.gt.25000.)then
+* Although Vink et al. formulae are only defined until Teff=50000K,
+* we follow the Dutch prescription of MESA, and extend to higher Teff
+ dms = -6.697d0 + 2.194d0*LOG10(lum/1.0d+05) -
+ & 1.313d0*LOG10(mt/30.d0) - 1.226d0*LOG10(2.6d0/2.d0) +
+ & alpha*LOG10(z/zsun) +0.933d0*LOG10(teff/4.0d+04) -
+ & 10.92d0*(LOG10(teff/4.0d+04)**2)
+ dms = 10.d0**dms
+ testflag = 2
+ endif
+
+ if((windflag.eq.3.or.kw.ge.2).and.kw.le.6)then
+* LBV-like mass loss beyond the Humphreys-Davidson limit.
+* Optional flag (windflag=3) to use for every non-degenerate star
+* past the limit, rather than just for giant, evolved stars
+ x = 1.0d-5*r*sqrt(lum)
+ if(lum.gt.6.0d+05.and.x.gt.1.d0)then
+ if(eddlimflag.eq.0) alpha = 0.d0
+ if(eddlimflag.eq.1) alpha = MLalpha(mt,lum,kw)
+ dms = 1.5d0*1.0d-04*((z/zsun)**alpha)
+ testflag = 3
+ endif
+ elseif(kw.ge.7.and.kw.le.9)then !WR (naked helium stars)
+* If naked helium use Hamann & Koesterke (1998) WR winds reduced by factor of
+* 10 (Yoon & Langer 2005), with Vink & de Koter (2005) metallicity dependence
+ if(eddlimflag.eq.0) alpha = 0.86d0
+ if(eddlimflag.eq.1) alpha = MLalpha(mt,lum,kw)
+ dms = 1.0d-13*(lum**1.5d0)*((z/zsun)**alpha)
+ testflag = 4
+ endif
+*
+ SSE_mlwind = dms
+ elseif(windflag.eq.4)then
+*
+* Calculate stellar wind mass loss following MIST as closely as possible
+*
+ dms = 0.d0
+ if(kw.ge.0.and.kw.le.9)then
+* 'Reimers' mass loss over the whole HRD
+ dml = 0.1*4.0d-13*r*lum/mt
+ if(rl.gt.0.d0) dml =
+ & dml*(1.d0 + bwind*(MIN(0.5d0,(r/rl)))**6)
+* Apply mass loss of Blocker 1995 for AGB.
+ if(kw.eq.5.or.kw.eq.6)then
+ dml = 4.83d-9*0.2*dml/0.1*((lum)**2.7)/((mt)**2.1)
+ endif
+ if(kw.gt.6)then
+ dms = MAX(dml,1.0d-13*hewind*lum**(3.d0/2.d0))
+ else
+ dms = MAX(dml,dms)
+ mew = ((mt-mc)/mt)*MIN(5.d0,MAX(1.2d0,(lum/lum0)**kap))
+* reduced WR-like mass loss for small H-envelope mass
+ if(mew.lt.1.d0)then
+ dml = 1.0d-13*lum**(3.d0/2.d0)*(1.d0 - mew)
+ dms = MAX(dml,dms)
+ endif
+* LBV-like mass loss beyond the Humphreys-Davidson limit.
+ x = 1.0d-5*r*sqrt(lum)
+ if(lum.gt.6.0d+05.and.x.gt.1.d0)then
+ dml = 0.1d0*(x-1.d0)**3*(lum/6.0d+05-1.d0)
+ dms = dms + dml
+ endif
+ endif
+ endif
+*
+ SSE_mlwind = dms
+
+ endif
+
+ return
+ end
+***
diff --git a/src/cosmic/src/SSE/SSE_star.f b/src/cosmic/src/SSE/SSE_star.f
new file mode 100644
index 000000000..074a566d2
--- /dev/null
+++ b/src/cosmic/src/SSE/SSE_star.f
@@ -0,0 +1,365 @@
+***
+ SUBROUTINE SSE_star(kw,mass,mt,tm,tn,tscls,lums,GB,zpars)
+ IMPLICIT NONE
+ INCLUDE '../const_bse.h'
+*
+*
+* Stellar luminosity & evolution time.
+* ------------------------------------
+*
+*
+ integer kw
+*
+ real*8 mass,mt,tm,tn,tscls(20),lums(10),GB(10),zpars(20)
+ real*8 tgb,tbagb,mch,mcmax,mc1,mc2,mcbagb,dx,am
+ real*8 lambdastar,tau,mtc,mass0
+ parameter(mch=1.44d0)
+*
+ real*8 lzamsf,lzahbf,lzhef
+ real*8 tbgbf,thookf,tHef,themsf,mcgbf,mcagbf,mcheif,mcgbtf
+ real*8 ltmsf,lbgbf,lHeIf,lHef,lbagbf,lmcgbf
+ external lzamsf,lzahbf,lzhef
+ external tbgbf,thookf,tHef,themsf,mcgbf,mcagbf,mcheif,mcgbtf
+ external ltmsf,lbgbf,lHeIf,lHef,lbagbf,lmcgbf
+*
+* Computes the characteristic luminosities at different stages (LUMS),
+* and various timescales (TSCLS).
+* Ref: P.P. Eggleton, M.J. Fitchett & C.A. Tout (1989) Ap.J. 347, 998.
+*
+* Revised 27th March 1995 by C. A. Tout
+* and 24th October 1995 to include metallicity
+* and 13th December 1996 to include naked helium stars
+*
+* Revised 5th April 1997 by J. R. Hurley
+* to include Z=0.001 as well as Z=0.02, convective overshooting,
+* MS hook and more elaborate CHeB. It now also sets the Giant
+* Branch parameters relevant to the mass of the star.
+*
+* ------------------------------------------------------------
+* Times: 1; BGB 2; He ignition 3; He burning
+* 4; Giant t(inf1) 5; Giant t(inf2) 6; Giant t(Mx)
+* 7; FAGB t(inf1) 8; FAGB t(inf2) 9; FAGB t(Mx)
+* 10; SAGB t(inf1) 11; SAGB t(inf2) 12; SAGB t(Mx)
+* 13; TP 14; t(Mcmax)
+*
+* LUMS: 1; ZAMS 2; End MS 3; BGB
+* 4; He ignition 5; He burning 6; L(Mx)
+* 7; BAGB 8; TP
+*
+* GB: 1; effective A(H) 2; A(H,He) 3; B
+* 4; D 5; p 6; q
+* 7; Mx 8; A(He) 9; Mc,BGB
+*
+* ------------------------------------------------------------
+*
+*
+ mass0 = mass
+C if(mass0.gt.100.d0) mass = 100.d0
+*
+ if(kw.ge.7.and.kw.le.9) goto 90
+ if(kw.ge.10) goto 95
+*
+* MS and BGB times
+*
+ tscls(1) = tbgbf(mass)
+ tm = MAX(zpars(8),thookf(mass))*tscls(1)
+*
+* Zero- and terminal age main sequence luminosity
+*
+ lums(1) = lzamsf(mass)
+ lums(2) = ltmsf(mass)
+*
+* Set the GB parameters
+*
+ GB(1) = MAX(-4.8d0,MIN(-5.7d0+0.8d0*mass,-4.1d0+0.14d0*mass))
+ GB(1) = 10.d0**GB(1)
+ GB(2) = 1.27d-05
+ GB(8) = 8.0d-05
+ GB(3) = MAX(3.0d+04,500.d0 + 1.75d+04*mass**0.6d0)
+ if(mass.le.2.0)then
+ GB(4) = zpars(6)
+ GB(5) = 6.d0
+ GB(6) = 3.d0
+ elseif(mass.lt.2.5)then
+ dx = zpars(6) - (0.975d0*zpars(6) - 0.18d0*2.5d0)
+ GB(4) = zpars(6) - dx*(mass - 2.d0)/(0.5d0)
+ GB(5) = 6.d0 - (mass - 2.d0)/(0.5d0)
+ GB(6) = 3.d0 - (mass - 2.d0)/(0.5d0)
+ else
+ GB(4) = MAX(-1.d0,0.5d0*zpars(6) - 0.06d0*mass)
+ GB(4) = MAX(GB(4),0.975d0*zpars(6) - 0.18d0*mass)
+ GB(5) = 5.d0
+ GB(6) = 2.d0
+ endif
+ GB(4) = 10.d0**GB(4)
+ GB(7) = (GB(3)/GB(4))**(1.d0/(GB(5)-GB(6)))
+*
+* Change in slope of giant L-Mc relation.
+ lums(6) = GB(4)*GB(7)**GB(5)
+*
+* HeI ignition luminosity
+ lums(4) = lHeIf(mass,zpars(2))
+ lums(7) = lbagbf(mass,zpars(2))
+*
+ if(mass.lt.0.1d0.and.kw.le.1)then
+ tscls(2) = 1.1d0*tscls(1)
+ tscls(3) = 0.1d0*tscls(1)
+ lums(3) = lbgbf(mass)
+ goto 96
+ endif
+*
+ if(mass.le.zpars(3))then
+* Base of the giant branch luminosity
+ lums(3) = lbgbf(mass)
+* Set GB timescales
+ tscls(4) = tscls(1) + (1.d0/((GB(5)-1.d0)*GB(1)*GB(4)))*
+ & ((GB(4)/lums(3))**((GB(5)-1.d0)/GB(5)))
+ tscls(6) = tscls(4) - (tscls(4) - tscls(1))*((lums(3)/lums(6))
+ & **((GB(5)-1.d0)/GB(5)))
+ tscls(5) = tscls(6) + (1.d0/((GB(6)-1.d0)*GB(1)*GB(3)))*
+ & ((GB(3)/lums(6))**((GB(6)-1.d0)/GB(6)))
+* Set Helium ignition time
+ if(lums(4).le.lums(6))then
+ tscls(2) = tscls(4) - (1.d0/((GB(5)-1.d0)*GB(1)*GB(4)))*
+ & ((GB(4)/lums(4))**((GB(5)-1.d0)/GB(5)))
+ else
+ tscls(2) = tscls(5) - (1.d0/((GB(6)-1.d0)*GB(1)*GB(3)))*
+ & ((GB(3)/lums(4))**((GB(6)-1.d0)/GB(6)))
+ endif
+ tgb = tscls(2) - tscls(1)
+ if(mass.le.zpars(2))then
+ mc1 = mcgbf(lums(4),GB,lums(6))
+ mc2 = mcagbf(mass)
+ lums(5) = lzahbf(mass,mc1,zpars(2))
+ tscls(3) = tHef(mass,mc1,zpars(2))
+ else
+ lums(5) = lHef(mass)*lums(4)
+ tscls(3) = tHef(mass,1.d0,zpars(2))*tscls(1)
+ endif
+ else
+* Note that for M>zpars(3) there is no GB as the star goes from
+* HG -> CHeB -> AGB. So in effect tscls(1) refers to the time of
+* Helium ignition and not the BGB.
+ tscls(2) = tscls(1)
+ tscls(3) = tHef(mass,1.d0,zpars(2))*tscls(1)
+* This now represents the luminosity at the end of CHeB, ie. BAGB
+ lums(5) = lums(7)
+* We set lums(3) to be the luminosity at the end of the HG
+ lums(3) = lums(4)
+ endif
+*
+* Set the core mass at the BGB.
+*
+ if(mass.le.zpars(2))then
+ GB(9) = mcgbf(lums(3),GB,lums(6))
+ elseif(mass.le.zpars(3))then
+ GB(9) = mcheif(mass,zpars(2),zpars(9))
+ else
+ GB(9) = mcheif(mass,zpars(2),zpars(10))
+ endif
+*
+* FAGB time parameters
+*
+ tbagb = tscls(2) + tscls(3)
+ tscls(7) = tbagb + (1.d0/((GB(5)-1.d0)*GB(8)*GB(4)))*
+ & ((GB(4)/lums(7))**((GB(5)-1.d0)/GB(5)))
+ tscls(9) = tscls(7) - (tscls(7) - tbagb)*((lums(7)/lums(6))
+ & **((GB(5)-1.d0)/GB(5)))
+ tscls(8) = tscls(9) + (1.d0/((GB(6)-1.d0)*GB(8)*GB(3)))*
+ & ((GB(3)/lums(6))**((GB(6)-1.d0)/GB(6)))
+*
+* Now to find Ltp and ttp using Mc,He,tp
+*
+ mcbagb = mcagbf(mass)
+ mc1 = mcbagb
+ if(mc1.ge.0.8d0.and.mc1.lt.2.25d0)then
+* The star undergoes dredge-up at Ltp causing a decrease in Mc,He
+ mc1 = 0.44d0*mc1 + 0.448d0
+ endif
+ lums(8) = lmcgbf(mc1,GB)
+ if(mc1.le.GB(7))then
+ tscls(13) = tscls(7) - (1.d0/((GB(5)-1.d0)*GB(8)*GB(4)))*
+ & (mc1**(1.d0-GB(5)))
+ else
+ tscls(13) = tscls(8) - (1.d0/((GB(6)-1.d0)*GB(8)*GB(3)))*
+ & (mc1**(1.d0-GB(6)))
+ endif
+*
+* SAGB time parameters
+*
+ if(mc1.le.GB(7))then
+ tscls(10) = tscls(13) + (1.d0/((GB(5)-1.d0)*GB(2)*GB(4)))*
+ & ((GB(4)/lums(8))**((GB(5)-1.d0)/GB(5)))
+ tscls(12) = tscls(10) - (tscls(10) - tscls(13))*
+ & ((lums(8)/lums(6))**((GB(5)-1.d0)/GB(5)))
+ tscls(11) = tscls(12) + (1.d0/((GB(6)-1.d0)*GB(2)*GB(3)))*
+ & ((GB(3)/lums(6))**((GB(6)-1.d0)/GB(6)))
+ else
+ tscls(10) = tscls(7)
+ tscls(12) = tscls(9)
+ tscls(11) = tscls(13) + (1.d0/((GB(6)-1.d0)*GB(2)*GB(3)))*
+ & ((GB(3)/lums(8))**((GB(6)-1.d0)/GB(6)))
+ endif
+*
+* Get an idea of when Mc,C = Mc,C,max on the AGB
+ tau = tscls(2) + tscls(3)
+ mc2 = mcgbtf(tau,GB(8),GB,tscls(7),tscls(8),tscls(9))
+ mcmax = MAX(MAX(mch,0.773d0*mcbagb - 0.35d0),1.05d0*mc2)
+*
+ if(mcmax.le.mc1)then
+ if(mcmax.le.GB(7))then
+ tscls(14) = tscls(7) - (1.d0/((GB(5)-1.d0)*GB(8)*GB(4)))*
+ & (mcmax**(1.d0-GB(5)))
+ else
+ tscls(14) = tscls(8) - (1.d0/((GB(6)-1.d0)*GB(8)*GB(3)))*
+ & (mcmax**(1.d0-GB(6)))
+ endif
+ else
+* Star is on SAGB and we need to increase mcmax if any 3rd
+* dredge-up has occurred.
+ lambdastar = MIN(0.9d0,0.3d0+0.001d0*mass**5)
+ mcmax = (mcmax - lambdastar*mc1)/(1.d0 - lambdastar)
+ if(mcmax.le.GB(7))then
+ tscls(14) = tscls(10) - (1.d0/((GB(5)-1.d0)*GB(2)*GB(4)))*
+ & (mcmax**(1.d0-GB(5)))
+ else
+ tscls(14) = tscls(11) - (1.d0/((GB(6)-1.d0)*GB(2)*GB(3)))*
+ & (mcmax**(1.d0-GB(6)))
+ endif
+ endif
+ tscls(14) = MAX(tbagb,tscls(14))
+C if(mass.ge.100.d0)then
+C tn = tscls(2)
+C goto 100
+C endif
+*
+* Calculate the nuclear timescale - the time of exhausting
+* nuclear fuel without further mass loss.
+* This means we want to find when Mc = Mt which defines Tn and will
+* be used in determining the timestep required. Note that after some
+* stars reach Mc = Mt there will be a Naked Helium Star lifetime
+* which is also a nuclear burning period but is not included in Tn.
+*
+ if(ABS(mt-mcbagb).lt.1.0d-14.and.kw.lt.5)then
+ tn = tbagb
+ else
+* Note that the only occurence of Mc being double-valued is for stars
+* that have a dredge-up. If Mt = Mc where Mc could be the value taken
+* from CHeB or from the AGB we need to check the current stellar type.
+ if(mt.gt.mcbagb.or.(mt.ge.mc1.and.kw.gt.4))then
+ if(kw.eq.6)then
+ lambdastar = MIN(0.9d0,0.3d0+0.001d0*mass**5)
+ mc1 = (mt - lambdastar*mc1)/(1.d0 - lambdastar)
+ else
+ mc1 = mt
+ endif
+ if(mc1.le.GB(7))then
+ tn = tscls(10) - (1.d0/((GB(5)-1.d0)*GB(2)*GB(4)))*
+ & (mc1**(1.d0-GB(5)))
+ else
+ tn = tscls(11) - (1.d0/((GB(6)-1.d0)*GB(2)*GB(3)))*
+ & (mc1**(1.d0-GB(6)))
+ endif
+ else
+ if(mass.gt.zpars(3))then
+ mc1 = mcheif(mass,zpars(2),zpars(10))
+ if(mt.le.mc1)then
+ tn = tscls(2)
+ else
+ tn = tscls(2) + tscls(3)*((mt - mc1)/(mcbagb - mc1))
+ endif
+ elseif(mass.le.zpars(2))then
+ mc1 = mcgbf(lums(3),GB,lums(6))
+ mc2 = mcgbf(lums(4),GB,lums(6))
+ if(mt.le.mc1)then
+ tn = tscls(1)
+ elseif(mt.le.mc2)then
+ if(mt.le.GB(7))then
+ tn = tscls(4) - (1.d0/((GB(5)-1.d0)*GB(1)*GB(4)))*
+ & (mt**(1.d0-GB(5)))
+ else
+ tn = tscls(5) - (1.d0/((GB(6)-1.d0)*GB(1)*GB(3)))*
+ & (mt**(1.d0-GB(6)))
+ endif
+ else
+ tn = tscls(2) + tscls(3)*((mt - mc2)/(mcbagb - mc2))
+ endif
+ else
+ mc1 = mcheif(mass,zpars(2),zpars(9))
+ mc2 = mcheif(mass,zpars(2),zpars(10))
+ if(mt.le.mc1)then
+ tn = tscls(1)
+ elseif(mt.le.mc2)then
+ tn = tscls(1) + tgb*((mt - mc1)/(mc2 - mc1))
+ else
+ tn = tscls(2) + tscls(3)*((mt - mc2)/(mcbagb - mc2))
+ endif
+ endif
+ endif
+ endif
+ tn = MIN(tn,tscls(14))
+*
+ goto 100
+*
+ 90 continue
+*
+* Calculate Helium star Main Sequence lifetime.
+*
+ tm = themsf(mass)
+ tscls(1) = tm
+*
+* Zero- and terminal age Helium star main sequence luminosity
+*
+ lums(1) = lzhef(mass)
+ am = MAX(0.d0,0.85d0-0.08d0*mass)
+ lums(2) = lums(1)*(1.d0+0.45d0+am)
+*
+* Set the Helium star GB parameters
+*
+ GB(8) = 8.0d-05
+ GB(3) = 4.1d+04
+ GB(4) = 5.5d+04/(1.d0+0.4d0*mass**4)
+ GB(5) = 5.d0
+ GB(6) = 3.d0
+ GB(7) = (GB(3)/GB(4))**(1.d0/(GB(5)-GB(6)))
+* Change in slope of giant L-Mc relation.
+ lums(6) = GB(4)*GB(7)**GB(5)
+*
+*** Set Helium star GB timescales
+*
+ mc1 = mcgbf(lums(2),GB,lums(6))
+ tscls(4) = tm + (1.d0/((GB(5)-1.d0)*GB(8)*GB(4)))*
+ & mc1**(1.d0-GB(5))
+ tscls(6) = tscls(4) - (tscls(4) - tm)*((GB(7)/mc1)
+ & **(1.d0-GB(5)))
+ tscls(5) = tscls(6) + (1.d0/((GB(6)-1.d0)*GB(8)*GB(3)))*
+ & GB(7)**(1.d0-GB(6))
+*
+* Get an idea of when Mc = MIN(Mt,Mc,C,max) on the GB
+ mtc = MIN(mt,1.45d0*mt-0.31d0)
+ if(mtc.le.0.d0) mtc = mt
+ mcmax = MIN(mtc,MAX(mch,0.773d0*mass-0.35d0))
+ if(mcmax.le.GB(7))then
+ tscls(14) = tscls(4) - (1.d0/((GB(5)-1.d0)*GB(8)*GB(4)))*
+ & (mcmax**(1.d0-GB(5)))
+ else
+ tscls(14) = tscls(5) - (1.d0/((GB(6)-1.d0)*GB(8)*GB(3)))*
+ & (mcmax**(1.d0-GB(6)))
+ endif
+ tscls(14) = MAX(tscls(14),tm)
+ tn = tscls(14)
+*
+ goto 100
+*
+ 95 continue
+ tm = 1.0d+10
+ tscls(1) = tm
+ 96 continue
+ tn = 1.0d+10
+*
+ 100 continue
+ mass = mass0
+*
+ return
+ end
+***
diff --git a/src/cosmic/src/SSE/SSE_zcnsts.f b/src/cosmic/src/SSE/SSE_zcnsts.f
new file mode 100644
index 000000000..990410a0c
--- /dev/null
+++ b/src/cosmic/src/SSE/SSE_zcnsts.f
@@ -0,0 +1,383 @@
+***
+ SUBROUTINE SSE_zcnsts(z,zpars)
+ IMPLICIT NONE
+ INCLUDE '../const_bse.h'
+*
+ integer kw
+*
+ real*8 z,zpars(20)
+ real*8 tm,tn,tscls(20),lums(10),GB(10)
+ real*8 lzs,dlzs,lz,lzd,dum1,m1,m2,rr,rb,mhefl,lhefl,thefl,lx
+ real*8 tbgbf,thef,lbagbf,lheif,lhef,lzahbf
+ real*8 rgbf,ragbf,rminf,mcgbf
+ external tbgbf,thef,lbagbf,lheif,lhef,lzahbf
+ external rgbf,ragbf,rminf,mcgbf
+*
+ include '../zdata.h'
+ real*8 msp(200),gbp(200),c(5)
+ common /MSCFF/ msp
+ common /GBCFF/ gbp
+ data c /3.040581d-01, 8.049509d-02, 8.967485d-02,
+ & 8.780198d-02, 2.219170d-02/
+*
+* ------------------------------------------------------------
+*
+* zpars: 1; M below which hook doesn't appear on MS, Mhook.
+* 2; M above which He ignition occurs non-degenerately, Mhef.
+* 3; M above which He ignition occurs on the HG, Mfgb.
+* 4; M below which C/O ignition doesn't occur, Mup.
+* 5; M above which C ignites in the centre, Mec.
+* 6; value of log D for M<= zpars(3)
+* 7; value of x for Rgb propto M^(-x)
+* 8; value of x for tMS = MAX(tHOOK,x*tBGB)
+* 9; constant for McHeIf when computing Mc,BGB, mchefl.
+* 10; constant for McHeIf when computing Mc,HeI, mchefl.
+* 11; hydrogen abundance.
+* 12; helium abundance.
+* 13; constant x in rmin = rgb*x**y used by LM CHeB.
+* 14; z**0.4 to be used for WD L formula.
+*
+* ------------------------------------------------------------
+*
+ lzs = log10(z/zsun)
+ dlzs = 1.d0/(z*log(10.d0))
+ lz = log10(z)
+ lzd = lzs + 1.d0
+*
+ zpars(1) = 1.0185d0 + lzs*(0.16015d0 + lzs*0.0892d0)
+ zpars(2) = 1.995d0 + lzs*(0.25d0 + lzs*0.087d0)
+ zpars(3) = 16.5d0*z**0.06d0/(1.d0 + (1.0d-04/z)**1.27d0)
+ zpars(4) = MAX(6.11044d0 + 1.02167d0*lzs, 5.d0)
+ zpars(5) = zpars(4) + 1.8d0
+ zpars(6) = 5.37d0 + lzs*0.135d0
+ zpars(7) = c(1) + lzs*(c(2) + lzs*(c(3) + lzs*(c(4) + lzs*c(5))))
+ zpars(8) = MAX(0.95d0,MAX(0.95d0-(10.d0/3.d0)*(z-0.01d0),
+ & MIN(0.99d0,0.98d0-(100.d0/7.d0)*(z-0.001d0))))
+***
+* Lzams
+ msp(1) = xz(1)+lzs*(xz(2)+lzs*(xz(3)+lzs*(xz(4)+lzs*xz(5))))
+ msp(2) = xz(6)+lzs*(xz(7)+lzs*(xz(8)+lzs*(xz(9)+lzs*xz(10))))
+ msp(3) = xz(11)+lzs*(xz(12)+lzs*(xz(13)+lzs*(xz(14)+lzs*xz(15))))
+ msp(4) = xz(16)+lzs*(xz(17)+lzs*(xz(18)+lzs*(xz(19)+lzs*xz(20))))
+ msp(5) = xz(21)+lzs*(xz(22)+lzs*(xz(23)+lzs*(xz(24)+lzs*xz(25))))
+ msp(6) = xz(26)+lzs*(xz(27)+lzs*(xz(28)+lzs*(xz(29)+lzs*xz(30))))
+ msp(7) = xz(31)+lzs*(xz(32)+lzs*(xz(33)+lzs*(xz(34)+lzs*xz(35))))
+* Rzams
+ msp(8) = xz(36)+lzs*(xz(37)+lzs*(xz(38)+lzs*(xz(39)+lzs*xz(40))))
+ msp(9) = xz(41)+lzs*(xz(42)+lzs*(xz(43)+lzs*(xz(44)+lzs*xz(45))))
+ msp(10) = xz(46)+lzs*(xz(47)+lzs*(xz(48)+lzs*(xz(49)+lzs*xz(50))))
+ msp(11) = xz(51)+lzs*(xz(52)+lzs*(xz(53)+lzs*(xz(54)+lzs*xz(55))))
+ msp(12) = xz(56)+lzs*(xz(57)+lzs*(xz(58)+lzs*(xz(59)+lzs*xz(60))))
+ msp(13) = xz(61)
+ msp(14) = xz(62)+lzs*(xz(63)+lzs*(xz(64)+lzs*(xz(65)+lzs*xz(66))))
+ msp(15) = xz(67)+lzs*(xz(68)+lzs*(xz(69)+lzs*(xz(70)+lzs*xz(71))))
+ msp(16) = xz(72)+lzs*(xz(73)+lzs*(xz(74)+lzs*(xz(75)+lzs*xz(76))))
+* Tbgb
+ msp(17) = xt(1)+lzs*(xt(2)+lzs*(xt(3)+lzs*xt(4)))
+ msp(18) = xt(5)+lzs*(xt(6)+lzs*(xt(7)+lzs*xt(8)))
+ msp(19) = xt(9)+lzs*(xt(10)+lzs*(xt(11)+lzs*xt(12)))
+ msp(20) = xt(13)+lzs*(xt(14)+lzs*(xt(15)+lzs*xt(16)))
+ msp(21) = xt(17)
+* dTbgb/dz
+ msp(117) = dlzs*(xt(2)+lzs*(2.d0*xt(3)+3.d0*lzs*xt(4)))
+ msp(118) = dlzs*(xt(6)+lzs*(2.d0*xt(7)+3.d0*lzs*xt(8)))
+ msp(119) = dlzs*(xt(10)+lzs*(2.d0*xt(11)+3.d0*lzs*xt(12)))
+ msp(120) = dlzs*(xt(14)+lzs*(2.d0*xt(15)+3.d0*lzs*xt(16)))
+* Thook
+ msp(22) = xt(18)+lzs*(xt(19)+lzs*(xt(20)+lzs*xt(21)))
+ msp(23) = xt(22)
+ msp(24) = xt(23)+lzs*(xt(24)+lzs*(xt(25)+lzs*xt(26)))
+ msp(25) = xt(27)+lzs*(xt(28)+lzs*(xt(29)+lzs*xt(30)))
+ msp(26) = xt(31)
+* Ltms
+ msp(27) = xl(1)+lzs*(xl(2)+lzs*(xl(3)+lzs*(xl(4)+lzs*xl(5))))
+ msp(28) = xl(6)+lzs*(xl(7)+lzs*(xl(8)+lzs*(xl(9)+lzs*xl(10))))
+ msp(29) = xl(11)+lzs*(xl(12)+lzs*(xl(13)+lzs*xl(14)))
+ msp(30) = xl(15)+lzs*(xl(16)+lzs*(xl(17)+lzs*(xl(18)+lzs*xl(19))))
+ msp(27) = msp(27)*msp(30)
+ msp(28) = msp(28)*msp(30)
+ msp(31) = xl(20)+lzs*(xl(21)+lzs*(xl(22)+lzs*xl(23)))
+ msp(32) = xl(24)+lzs*(xl(25)+lzs*(xl(26)+lzs*xl(27)))
+* Lalpha
+ m2 = 2.d0
+ msp(33) = xl(28)+lzs*(xl(29)+lzs*(xl(30)+lzs*xl(31)))
+ msp(34) = xl(32)+lzs*(xl(33)+lzs*(xl(34)+lzs*xl(35)))
+ msp(35) = xl(36)+lzs*(xl(37)+lzs*(xl(38)+lzs*xl(39)))
+ msp(36) = xl(40)+lzs*(xl(41)+lzs*(xl(42)+lzs*xl(43)))
+ msp(37) = MAX(0.9d0,1.1064d0+lzs*(0.415d0+0.18d0*lzs))
+ msp(38) = MAX(1.d0,1.19d0+lzs*(0.377d0+0.176d0*lzs))
+ if(z.gt.0.01d0)then
+ msp(37) = MIN(msp(37),1.d0)
+ msp(38) = MIN(msp(38),1.1d0)
+ endif
+ msp(39) = MAX(0.145d0,0.0977d0-lzs*(0.231d0+0.0753d0*lzs))
+ msp(40) = MIN(0.24d0+lzs*(0.18d0+0.595d0*lzs),0.306d0+0.053d0*lzs)
+ msp(41) = MIN(0.33d0+lzs*(0.132d0+0.218d0*lzs),
+ & 0.3625d0+0.062d0*lzs)
+ msp(42) = (msp(33)+msp(34)*m2**msp(36))/
+ & (m2**0.4d0+msp(35)*m2**1.9d0)
+* Lbeta
+ msp(43) = xl(44)+lzs*(xl(45)+lzs*(xl(46)+lzs*(xl(47)+lzs*xl(48))))
+ msp(44) = xl(49)+lzs*(xl(50)+lzs*(xl(51)+lzs*(xl(52)+lzs*xl(53))))
+ msp(45) = xl(54)+lzs*(xl(55)+lzs*xl(56))
+ msp(46) = MIN(1.4d0,1.5135d0+0.3769d0*lzs)
+ msp(46) = MAX(0.6355d0-0.4192d0*lzs,MAX(1.25d0,msp(46)))
+* Lhook
+ msp(47) = xl(57)+lzs*(xl(58)+lzs*(xl(59)+lzs*xl(60)))
+ msp(48) = xl(61)+lzs*(xl(62)+lzs*(xl(63)+lzs*xl(64)))
+ msp(49) = xl(65)+lzs*(xl(66)+lzs*(xl(67)+lzs*xl(68)))
+ msp(50) = xl(69)+lzs*(xl(70)+lzs*(xl(71)+lzs*xl(72)))
+ msp(51) = MIN(1.4d0,1.5135d0+0.3769d0*lzs)
+ msp(51) = MAX(0.6355d0-0.4192d0*lzs,MAX(1.25d0,msp(51)))
+* Rtms
+ msp(52) = xr(1)+lzs*(xr(2)+lzs*(xr(3)+lzs*(xr(4)+lzs*xr(5))))
+ msp(53) = xr(6)+lzs*(xr(7)+lzs*(xr(8)+lzs*(xr(9)+lzs*xr(10))))
+ msp(54) = xr(11)+lzs*(xr(12)+lzs*(xr(13)+lzs*(xr(14)+lzs*xr(15))))
+ msp(55) = xr(16)+lzs*(xr(17)+lzs*(xr(18)+lzs*xr(19)))
+ msp(56) = xr(20)+lzs*(xr(21)+lzs*(xr(22)+lzs*xr(23)))
+ msp(52) = msp(52)*msp(54)
+ msp(53) = msp(53)*msp(54)
+ msp(57) = xr(24)
+ msp(58) = xr(25)+lzs*(xr(26)+lzs*(xr(27)+lzs*xr(28)))
+ msp(59) = xr(29)+lzs*(xr(30)+lzs*(xr(31)+lzs*xr(32)))
+ msp(60) = xr(33)+lzs*(xr(34)+lzs*(xr(35)+lzs*xr(36)))
+ msp(61) = xr(37)+lzs*(xr(38)+lzs*(xr(39)+lzs*xr(40)))
+*
+ msp(62) = MAX(0.097d0-0.1072d0*(lz+3.d0),MAX(0.097d0,MIN(0.1461d0,
+ & 0.1461d0+0.1237d0*(lz+2.d0))))
+ msp(62) = 10.d0**msp(62)
+ m2 = msp(62) + 0.1d0
+ msp(63) = (msp(52)+msp(53)*msp(62)**msp(55))/
+ & (msp(54)+msp(62)**msp(56))
+ msp(64) = (msp(57)*m2**3+msp(58)*m2**msp(61)+
+ & msp(59)*m2**(msp(61)+1.5d0))/(msp(60)+m2**5)
+* Ralpha
+ msp(65) = xr(41)+lzs*(xr(42)+lzs*(xr(43)+lzs*xr(44)))
+ msp(66) = xr(45)+lzs*(xr(46)+lzs*(xr(47)+lzs*xr(48)))
+ msp(67) = xr(49)+lzs*(xr(50)+lzs*(xr(51)+lzs*xr(52)))
+ msp(68) = xr(53)+lzs*(xr(54)+lzs*(xr(55)+lzs*xr(56)))
+ msp(69) = xr(57)+lzs*(xr(58)+lzs*(xr(59)+lzs*(xr(60)+lzs*xr(61))))
+ msp(70) = MAX(0.9d0,MIN(1.d0,1.116d0+0.166d0*lzs))
+ msp(71) = MAX(1.477d0+0.296d0*lzs,MIN(1.6d0,-0.308d0-1.046d0*lzs))
+ msp(71) = MAX(0.8d0,MIN(0.8d0-2.d0*lzs,msp(71)))
+ msp(72) = xr(62)+lzs*(xr(63)+lzs*xr(64))
+ msp(73) = MAX(0.065d0,0.0843d0-lzs*(0.0475d0+0.0352d0*lzs))
+ msp(74) = 0.0736d0+lzs*(0.0749d0+0.04426d0*lzs)
+ if(z.lt.0.004d0) msp(74) = MIN(0.055d0,msp(74))
+ msp(75) = MAX(0.091d0,MIN(0.121d0,0.136d0+0.0352d0*lzs))
+ msp(76) = (msp(65)*msp(71)**msp(67))/(msp(66) + msp(71)**msp(68))
+ if(msp(70).gt.msp(71))then
+ msp(70) = msp(71)
+ msp(75) = msp(76)
+ endif
+* Rbeta
+ msp(77) = xr(65)+lzs*(xr(66)+lzs*(xr(67)+lzs*xr(68)))
+ msp(78) = xr(69)+lzs*(xr(70)+lzs*(xr(71)+lzs*xr(72)))
+ msp(79) = xr(73)+lzs*(xr(74)+lzs*(xr(75)+lzs*xr(76)))
+ msp(80) = xr(77)+lzs*(xr(78)+lzs*(xr(79)+lzs*xr(80)))
+ msp(81) = xr(81)+lzs*(xr(82)+lzs*lzs*xr(83))
+ if(z.gt.0.01d0) msp(81) = MAX(msp(81),0.95d0)
+ msp(82) = MAX(1.4d0,MIN(1.6d0,1.6d0+lzs*(0.764d0+0.3322d0*lzs)))
+* Rgamma
+ msp(83) = MAX(xr(84)+lzs*(xr(85)+lzs*(xr(86)+lzs*xr(87))),
+ & xr(96)+lzs*(xr(97)+lzs*xr(98)))
+ msp(84) = MIN(0.d0,xr(88)+lzs*(xr(89)+lzs*(xr(90)+lzs*xr(91))))
+ msp(84) = MAX(msp(84),xr(99)+lzs*(xr(100)+lzs*xr(101)))
+ msp(85) = xr(92)+lzs*(xr(93)+lzs*(xr(94)+lzs*xr(95)))
+ msp(85) = MAX(0.d0,MIN(msp(85),7.454d0+9.046d0*lzs))
+ msp(86) = MIN(xr(102)+lzs*xr(103),MAX(2.d0,-13.3d0-18.6d0*lzs))
+ msp(87) = MIN(1.5d0,MAX(0.4d0,2.493d0+1.1475d0*lzs))
+ msp(88) = MAX(1.d0,MIN(1.27d0,0.8109d0-0.6282d0*lzs))
+ msp(88) = MAX(msp(88),0.6355d0-0.4192d0*lzs)
+ msp(89) = MAX(5.855420d-02,-0.2711d0-lzs*(0.5756d0+0.0838d0*lzs))
+* Rhook
+ msp(90) = xr(104)+lzs*(xr(105)+lzs*(xr(106)+lzs*xr(107)))
+ msp(91) = xr(108)+lzs*(xr(109)+lzs*(xr(110)+lzs*xr(111)))
+ msp(92) = xr(112)+lzs*(xr(113)+lzs*(xr(114)+lzs*xr(115)))
+ msp(93) = xr(116)+lzs*(xr(117)+lzs*(xr(118)+lzs*xr(119)))
+ msp(94) = MIN(1.25d0,
+ & MAX(1.1d0,1.9848d0+lzs*(1.1386d0+0.3564d0*lzs)))
+ msp(95) = 0.063d0 + lzs*(0.0481d0 + 0.00984d0*lzs)
+ msp(96) = MIN(1.3d0,MAX(0.45d0,1.2d0+2.45d0*lzs))
+* Lneta
+ if(z.gt.0.0009d0)then
+ msp(97) = 10.d0
+ else
+ msp(97) = 20.d0
+ endif
+* Lbgb
+ gbp(1) = xg(1)+lzs*(xg(2)+lzs*(xg(3)+lzs*xg(4)))
+ gbp(2) = xg(5)+lzs*(xg(6)+lzs*(xg(7)+lzs*xg(8)))
+ gbp(3) = xg(9)+lzs*(xg(10)+lzs*(xg(11)+lzs*xg(12)))
+ gbp(4) = xg(13)+lzs*(xg(14)+lzs*(xg(15)+lzs*xg(16)))
+ gbp(5) = xg(17)+lzs*(xg(18)+lzs*xg(19))
+ gbp(6) = xg(20)+lzs*(xg(21)+lzs*xg(22))
+ gbp(3) = gbp(3)**gbp(6)
+ gbp(7) = xg(23)
+ gbp(8) = xg(24)
+* Lbagb
+* set gbp(16) = 1.d0 until it is reset later with an initial
+* call to Lbagbf using mass = zpars(2) and mhefl = 0.0
+ gbp(9) = xg(25) + lzs*(xg(26) + lzs*xg(27))
+ gbp(10) = xg(28) + lzs*(xg(29) + lzs*xg(30))
+ gbp(11) = 15.d0
+ gbp(12) = xg(31)+lzs*(xg(32)+lzs*(xg(33)+lzs*xg(34)))
+ gbp(13) = xg(35)+lzs*(xg(36)+lzs*(xg(37)+lzs*xg(38)))
+ gbp(14) = xg(39)+lzs*(xg(40)+lzs*(xg(41)+lzs*xg(42)))
+ gbp(15) = xg(43)+lzs*xg(44)
+ gbp(12) = gbp(12)**gbp(15)
+ gbp(14) = gbp(14)**gbp(15)
+ gbp(16) = 1.d0
+* Rgb
+ gbp(17) = -4.6739d0-0.9394d0*lz
+ gbp(17) = 10.d0**gbp(17)
+ gbp(17) = MAX(gbp(17),-0.04167d0+55.67d0*z)
+ gbp(17) = MIN(gbp(17),0.4771d0-9329.21d0*z**2.94d0)
+ gbp(18) = MIN(0.54d0,0.397d0+lzs*(0.28826d0+0.5293d0*lzs))
+ gbp(19) = MAX(-0.1451d0,-2.2794d0-lz*(1.5175d0+0.254d0*lz))
+ gbp(19) = 10.d0**gbp(19)
+ if(z.gt.0.004d0)then
+ gbp(19) = MAX(gbp(19),0.7307d0+14265.1d0*z**3.395d0)
+ endif
+ gbp(20) = xg(45)+lzs*(xg(46)+lzs*(xg(47)+lzs*(xg(48)+
+ & lzs*(xg(49)+lzs*xg(50)))))
+ gbp(21) = xg(51)+lzs*(xg(52)+lzs*(xg(53)+lzs*(xg(54)+lzs*xg(55))))
+ gbp(22) = xg(56)+lzs*(xg(57)+lzs*(xg(58)+lzs*(xg(59)+
+ & lzs*(xg(60)+lzs*xg(61)))))
+ gbp(23) = xg(62)+lzs*(xg(63)+lzs*(xg(64)+lzs*(xg(65)+lzs*xg(66))))
+* Ragb
+ gbp(24) = MIN(0.99164d0-743.123d0*z**2.83d0,
+ & 1.0422d0+lzs*(0.13156d0+0.045d0*lzs))
+ gbp(25) = xg(67)+lzs*(xg(68)+lzs*(xg(69)+lzs*(xg(70)+
+ & lzs*(xg(71)+lzs*xg(72)))))
+ gbp(26) = xg(73)+lzs*(xg(74)+lzs*(xg(75)+lzs*(xg(76)+lzs*xg(77))))
+ gbp(27) = xg(78)+lzs*(xg(79)+lzs*(xg(80)+lzs*(xg(81)+
+ & lzs*(xg(82)+lzs*xg(83)))))
+ gbp(28) = xg(84)+lzs*(xg(85)+lzs*(xg(86)+lzs*(xg(87)+lzs*xg(88))))
+ gbp(29) = xg(89)+lzs*(xg(90)+lzs*(xg(91)+lzs*(xg(92)+
+ & lzs*(xg(93)+lzs*xg(94)))))
+ gbp(30) = xg(95)+lzs*(xg(96)+lzs*(xg(97)+lzs*(xg(98)+
+ & lzs*(xg(99)+lzs*xg(100)))))
+ m1 = zpars(2) - 0.2d0
+ gbp(31) = gbp(29) + gbp(30)*m1
+ gbp(32) = MIN(gbp(25)/zpars(2)**gbp(26),gbp(27)/zpars(2)**gbp(28))
+* Mchei
+ gbp(33) = xg(101)**4
+ gbp(34) = xg(102)*4.d0
+* Mcagb
+ gbp(35) = xg(103)+lzs*(xg(104)+lzs*(xg(105)+lzs*xg(106)))
+ gbp(36) = xg(107)+lzs*(xg(108)+lzs*(xg(109)+lzs*xg(110)))
+ gbp(37) = xg(111)+lzs*xg(112)
+ gbp(35) = gbp(35)**4
+ gbp(36) = gbp(36)*4.d0
+ gbp(37) = gbp(37)**4
+* Lhei
+* set gbp(41) = -1.d0 until it is reset later with an initial
+* call to Lheif using mass = zpars(2) and mhefl = 0.0
+ gbp(38) = xh(1)+lzs*xh(2)
+ gbp(39) = xh(3)+lzs*xh(4)
+ gbp(40) = xh(5)
+ gbp(41) = -1.d0
+ gbp(42) = xh(6)+lzs*(xh(7)+lzs*xh(8))
+ gbp(43) = xh(9)+lzs*(xh(10)+lzs*xh(11))
+ gbp(44) = xh(12)+lzs*(xh(13)+lzs*xh(14))
+ gbp(42) = gbp(42)**2
+ gbp(44) = gbp(44)**2
+* Lhe
+ gbp(45) = xh(15)+lzs*(xh(16)+lzs*xh(17))
+ if(lzs.gt.-1.d0)then
+ gbp(46) = 1.d0 - xh(19)*(lzs+1.d0)**xh(18)
+ else
+ gbp(46) = 1.d0
+ endif
+ gbp(47) = xh(20)+lzs*(xh(21)+lzs*xh(22))
+ gbp(48) = xh(23)+lzs*(xh(24)+lzs*xh(25))
+ gbp(45) = gbp(45)**gbp(48)
+ gbp(47) = gbp(47)**gbp(48)
+ gbp(46) = gbp(46)/zpars(3)**0.1d0+(gbp(46)*gbp(47)-gbp(45))/
+ & zpars(3)**(gbp(48)+0.1d0)
+* Rmin
+ gbp(49) = xh(26)+lzs*(xh(27)+lzs*(xh(28)+lzs*xh(29)))
+ gbp(50) = xh(30)+lzs*(xh(31)+lzs*(xh(32)+lzs*xh(33)))
+ gbp(51) = xh(34)+lzs*(xh(35)+lzs*(xh(36)+lzs*xh(37)))
+ gbp(52) = 5.d0+xh(38)*z**xh(39)
+ gbp(53) = xh(40)+lzs*(xh(41)+lzs*(xh(42)+lzs*xh(43)))
+ gbp(49) = gbp(49)**gbp(53)
+ gbp(51) = gbp(51)**(2.d0*gbp(53))
+* The
+* set gbp(57) = -1.d0 until it is reset later with an initial
+* call to Thef using mass = zpars(2), mc = 0.0 and mhefl = 0.0
+ gbp(54) = xh(44)+lzs*(xh(45)+lzs*(xh(46)+lzs*xh(47)))
+ gbp(55) = xh(48)+lzs*(xh(49)+lzs*xh(50))
+ gbp(55) = MAX(gbp(55),1.d0)
+ gbp(56) = xh(51)
+ gbp(57) = -1.d0
+ gbp(58) = xh(52)+lzs*(xh(53)+lzs*(xh(54)+lzs*xh(55)))
+ gbp(59) = xh(56)+lzs*(xh(57)+lzs*(xh(58)+lzs*xh(59)))
+ gbp(60) = xh(60)+lzs*(xh(61)+lzs*(xh(62)+lzs*xh(63)))
+ gbp(61) = xh(64)+lzs*xh(65)
+ gbp(58) = gbp(58)**gbp(61)
+ gbp(60) = gbp(60)**5
+* Tbl
+ dum1 = zpars(2)/zpars(3)
+ gbp(62) = xh(66)+lzs*xh(67)
+ gbp(62) = -gbp(62)*log10(dum1)
+ gbp(63) = xh(68)
+ if(lzd.gt.0.d0) then
+ gbp(64) = 1.d0-lzd*(xh(69)+lzd*(xh(70)+lzd*xh(71)))
+ else
+ gbp(64) = 1.d0
+ end if
+ gbp(65) = 1.d0-gbp(64)*dum1**gbp(63)
+ gbp(66) = 1.d0 - lzd*(xh(77) + lzd*(xh(78) + lzd*xh(79)))
+ gbp(67) = xh(72) + lzs*(xh(73) + lzs*(xh(74) + lzs*xh(75)))
+ gbp(68) = xh(76)
+* Lzahb
+ gbp(69) = xh(80) + lzs*(xh(81) + lzs*xh(82))
+ gbp(70) = xh(83) + lzs*(xh(84) + lzs*xh(85))
+ gbp(71) = 15.d0
+ gbp(72) = xh(86)
+ gbp(73) = xh(87)
+* Rzahb
+ gbp(75) = xh(88) + lzs*(xh(89) + lzs*(xh(90) + lzs*xh(91)))
+ gbp(76) = xh(92) + lzs*(xh(93) + lzs*(xh(94) + lzs*xh(95)))
+ gbp(77) = xh(96) + lzs*(xh(97) + lzs*(xh(98) + lzs*xh(99)))
+***
+* finish Lbagb
+ mhefl = 0.d0
+ lx = lbagbf(zpars(2),mhefl)
+ gbp(16) = lx
+* finish LHeI
+ dum1 = 0.d0
+ lhefl = lheif(zpars(2),mhefl)
+ gbp(41) = (gbp(38)*zpars(2)**gbp(39)-lhefl)/
+ & (EXP(zpars(2)*gbp(40))*lhefl)
+* finish THe
+ thefl = thef(zpars(2),dum1,mhefl)*tbgbf(zpars(2))
+ gbp(57) = (thefl-gbp(54))/(gbp(54)*EXP(gbp(56)*zpars(2)))
+* finish Tblf
+ rb = ragbf(zpars(3),lheif(zpars(3),zpars(2)),mhefl)
+ rr = 1.d0 - rminf(zpars(3))/rb
+ rr = MAX(rr,1.0d-12)
+ gbp(66) = gbp(66)/(zpars(3)**gbp(67)*rr**gbp(68))
+* finish Lzahb
+ gbp(74) = lhefl*lHef(zpars(2))
+***
+ kw = 0
+ tm = 0.d0
+ tn = 0.d0
+ CALL SSE_star(kw,zpars(2),zpars(2),tm,tn,tscls,lums,GB,zpars)
+ zpars(9) = mcgbf(lums(3),GB,lums(6))
+ zpars(10) = mcgbf(lums(4),GB,lums(6))
+* set the hydrogen and helium abundances
+ zpars(11) = 0.76d0 - 3.d0*z
+ zpars(12) = 0.24d0 + 2.d0*z
+* set constant for low-mass CHeB stars
+ zpars(13) = rminf(zpars(2))/
+ & rgbf(zpars(2),lzahbf(zpars(2),zpars(9),zpars(2)))
+*
+ zpars(14) = z**0.4d0
+*
+ return
+ end
+***
diff --git a/src/cosmic/src/zfuncs.f b/src/cosmic/src/SSE/SSE_zfuncs.f
similarity index 99%
rename from src/cosmic/src/zfuncs.f
rename to src/cosmic/src/SSE/SSE_zfuncs.f
index 704fee7a3..25b78578a 100644
--- a/src/cosmic/src/zfuncs.f
+++ b/src/cosmic/src/SSE/SSE_zfuncs.f
@@ -24,7 +24,7 @@
***
real*8 FUNCTION lzamsf(m)
IMPLICIT NONE
- INCLUDE 'const_bse.h'
+ INCLUDE '../const_bse.h'
real*8 m,mx,a(200)
common /MSCFF/ a
*
@@ -260,7 +260,7 @@ real*8 FUNCTION rtmssse(m)
real*8 FUNCTION rtmsf(m, met)
implicit none
- INCLUDE 'const_bse.h'
+ INCLUDE '../const_bse.h'
real*8 m,met,Rtms200,Rtms199,slope
real*8 rtmssse, rtmsBoost, rtmsBpass
external rtmssse
diff --git a/src/cosmic/src/benchmarkevolv2.f b/src/cosmic/src/benchmarkevolv2.f
index 8bc11ab38..8e127ffba 100644
--- a/src/cosmic/src/benchmarkevolv2.f
+++ b/src/cosmic/src/benchmarkevolv2.f
@@ -10,13 +10,18 @@ PROGRAM benchmarkevolv2
REAL*8 mass0(2),massc(2),menv(2)
REAL*8 rad(2),epoch(2)
REAL*8 lumin(2),renv(2),radc(2)
- REAL*8 zpars(20),kick_info(2,17)
+ REAL*8 zpars(20),kick_info(2,18)
REAL*8 tacc(2),bacc(2),tms(2),B_0(2),ospin(2),bkick(20)
REAL*8 tphys
- REAL*8 kick_info_out(2,17)
+ REAL*8 kick_info_out(2,18)
INTEGER bpp_index_out,bcm_index_out
-
+ using_METISSE = 0
+ using_SSE = 1
+ path_to_tracks = ''
+ path_to_he_tracks = ''
+ z_match_limit = 1d-2
+ METISSE_verbose = .false.
kstar(1) = 0.0; kstar(2) = 0.0
mass(1) = 0.5
mass(2) = 0.5
@@ -85,7 +90,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -168,7 +173,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -251,7 +256,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -334,7 +339,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -417,7 +422,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -500,7 +505,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -583,7 +588,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -666,7 +671,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -749,7 +754,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -832,7 +837,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -915,7 +920,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -998,7 +1003,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -1081,7 +1086,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -1164,7 +1169,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -1247,7 +1252,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -1330,7 +1335,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -1413,7 +1418,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -1496,7 +1501,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -1579,7 +1584,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -1662,7 +1667,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -1745,7 +1750,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -1828,7 +1833,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -1911,7 +1916,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -1994,7 +1999,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -2077,7 +2082,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -2160,7 +2165,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -2243,7 +2248,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -2326,7 +2331,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -2409,7 +2414,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -2492,7 +2497,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -2575,7 +2580,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -2658,7 +2663,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -2741,7 +2746,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -2824,7 +2829,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -2907,7 +2912,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -2990,7 +2995,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -3073,7 +3078,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -3156,7 +3161,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -3239,7 +3244,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -3322,7 +3327,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -3405,7 +3410,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -3488,7 +3493,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -3571,7 +3576,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -3654,7 +3659,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -3737,7 +3742,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -3820,7 +3825,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -3903,7 +3908,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -3986,7 +3991,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -4069,7 +4074,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -4152,7 +4157,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -4235,7 +4240,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -4318,7 +4323,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -4401,7 +4406,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -4484,7 +4489,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -4567,7 +4572,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -4650,7 +4655,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -4733,7 +4738,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -4816,7 +4821,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -4899,7 +4904,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -4982,7 +4987,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -5065,7 +5070,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -5148,7 +5153,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -5231,7 +5236,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -5314,7 +5319,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -5397,7 +5402,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -5480,7 +5485,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -5563,7 +5568,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -5646,7 +5651,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -5729,7 +5734,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -5812,7 +5817,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -5895,7 +5900,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -5978,7 +5983,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -6061,7 +6066,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -6144,7 +6149,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -6227,7 +6232,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -6310,7 +6315,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -6393,7 +6398,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -6476,7 +6481,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -6559,7 +6564,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -6642,7 +6647,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -6725,7 +6730,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -6808,7 +6813,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -6891,7 +6896,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -6974,7 +6979,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -7057,7 +7062,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -7140,7 +7145,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -7223,7 +7228,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -7306,7 +7311,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -7389,7 +7394,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -7472,7 +7477,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -7555,7 +7560,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -7638,7 +7643,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -7721,7 +7726,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -7804,7 +7809,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -7887,7 +7892,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -7970,7 +7975,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -8053,7 +8058,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -8136,7 +8141,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -8219,7 +8224,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -8302,7 +8307,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -8385,7 +8390,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -8468,7 +8473,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -8551,7 +8556,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -8634,7 +8639,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -8717,7 +8722,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -8800,7 +8805,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -8883,7 +8888,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -8966,7 +8971,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -9049,7 +9054,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -9132,7 +9137,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -9215,7 +9220,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -9298,7 +9303,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -9381,7 +9386,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -9464,7 +9469,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -9547,7 +9552,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -9630,7 +9635,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -9713,7 +9718,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -9796,7 +9801,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -9879,7 +9884,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -9962,7 +9967,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -10045,7 +10050,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -10128,7 +10133,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -10211,7 +10216,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -10294,7 +10299,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -10377,7 +10382,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -10460,7 +10465,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -10543,7 +10548,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -10626,7 +10631,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -10709,7 +10714,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -10792,7 +10797,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -10875,7 +10880,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -10958,7 +10963,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -11041,7 +11046,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -11124,7 +11129,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -11207,7 +11212,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -11290,7 +11295,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -11373,7 +11378,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -11456,7 +11461,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -11539,7 +11544,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -11622,7 +11627,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -11705,7 +11710,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -11788,7 +11793,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -11871,7 +11876,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -11954,7 +11959,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -12037,7 +12042,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -12120,7 +12125,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -12203,7 +12208,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -12286,7 +12291,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -12369,7 +12374,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -12452,7 +12457,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -12535,7 +12540,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -12618,7 +12623,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -12701,7 +12706,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -12784,7 +12789,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -12867,7 +12872,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -12950,7 +12955,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -13033,7 +13038,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -13116,7 +13121,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -13199,7 +13204,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -13282,7 +13287,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -13365,7 +13370,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -13448,7 +13453,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -13531,7 +13536,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -13614,7 +13619,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -13697,7 +13702,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -13780,7 +13785,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -13863,7 +13868,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -13946,7 +13951,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -14029,7 +14034,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -14112,7 +14117,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -14195,7 +14200,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -14278,7 +14283,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -14361,7 +14366,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -14444,7 +14449,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -14527,7 +14532,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -14610,7 +14615,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -14693,7 +14698,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -14776,7 +14781,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -14859,7 +14864,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -14942,7 +14947,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -15025,7 +15030,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -15108,7 +15113,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -15191,7 +15196,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -15274,7 +15279,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -15357,7 +15362,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -15440,7 +15445,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -15523,7 +15528,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -15606,7 +15611,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -15689,7 +15694,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -15772,7 +15777,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -15855,7 +15860,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -15938,7 +15943,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -16021,7 +16026,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -16104,7 +16109,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -16187,7 +16192,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -16270,7 +16275,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -16353,7 +16358,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -16436,7 +16441,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -16519,7 +16524,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -16602,7 +16607,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -16685,7 +16690,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -16768,7 +16773,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -16851,7 +16856,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -16934,7 +16939,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -17017,7 +17022,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -17100,7 +17105,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -17183,7 +17188,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -17266,7 +17271,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -17349,7 +17354,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -17432,7 +17437,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -17515,7 +17520,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -17598,7 +17603,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -17681,7 +17686,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -17764,7 +17769,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -17847,7 +17852,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -17930,7 +17935,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -18013,7 +18018,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -18096,7 +18101,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -18179,7 +18184,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -18262,7 +18267,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -18345,7 +18350,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -18428,7 +18433,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -18511,7 +18516,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -18594,7 +18599,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -18677,7 +18682,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -18760,7 +18765,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -18843,7 +18848,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -18926,7 +18931,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -19009,7 +19014,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -19092,7 +19097,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -19175,7 +19180,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -19258,7 +19263,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -19341,7 +19346,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -19424,7 +19429,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -19507,7 +19512,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -19590,7 +19595,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -19673,7 +19678,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -19756,7 +19761,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -19839,7 +19844,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -19922,7 +19927,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -20005,7 +20010,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -20088,7 +20093,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -20171,7 +20176,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
@@ -20254,7 +20259,7 @@ PROGRAM benchmarkevolv2
bdecayfac = 1
grflag = 1
rembar_massloss = 0.5
- kickflag = 0
+ kickflag = -1
zsun = 0.014
bhms_coll_flag = 0
wd_mass_lim = 1
diff --git a/src/cosmic/src/bpp_array.f b/src/cosmic/src/bpp_array.f
index 4c2411b72..5ea53257e 100644
--- a/src/cosmic/src/bpp_array.f
+++ b/src/cosmic/src/bpp_array.f
@@ -1,5 +1,5 @@
***
- SUBROUTINE WRITEBPP(jp,tphys,evolve_type,
+ SUBROUTINE WRITETAB(jp,tphys,evolve_type,
& mass1,mass2,kstar1,kstar2,sep,
& tb,ecc,rrl1,rrl2,
& aj1,aj2,tms1,tms2,
@@ -8,14 +8,17 @@ SUBROUTINE WRITEBPP(jp,tphys,evolve_type,
& teff1,teff2,radc1,radc2,menv1,
& menv2,renv1,renv2,ospin1,ospin2,
& b_0_1,b_0_2,bacc1,bacc2,tacc1,tacc2,
- & epoch1,epoch2,bhspin1,bhspin2)
+ & epoch1,epoch2,bhspin1,bhspin2,
+ & deltam_1,deltam_2,SN_1,SN_2,
+ & bin_state,merger_type,tabname)
IMPLICIT NONE
INCLUDE 'const_bse.h'
+
*
-* Write results to bpp array.
+* Write results to bpp or bcm array.
*
-* Author : Scott Coughlin
-* Date : 12th March 2019
+* Author : Scott Coughlin, Tom Wagg
+* Date : 12th March 2019, September 2024
*
REAL*8 mass1,mass2
REAL*8 evolve_type,sep,tb,ecc,tphys,rrl1,rrl2
@@ -24,141 +27,84 @@ SUBROUTINE WRITEBPP(jp,tphys,evolve_type,
REAL*8 menv1,menv2,renv1,renv2,ospin1,ospin2
REAL*8 b_0_1,b_0_2,bacc1,bacc2,tacc1,tacc2,epoch1,epoch2
REAL*8 bhspin1,bhspin2,teff1,teff2
+ REAL*8 deltam_1,deltam_2
+ INTEGER SN_1,SN_2,bin_state,merger_type
REAL*8 tb_write,sep_cubed
- INTEGER jp
+ INTEGER jp, col_ind
INTEGER kstar1,kstar2
REAL*8 yeardy,aursun,rsunau
+ REAL*8 all_cols(49)
+ CHARACTER*3 tabname
PARAMETER(yeardy=365.24d0,aursun=214.95d0)
- rsunau = 1/aursun
- jp = MIN(900,jp + 1)
- bpp(jp,1) = tphys
- bpp(jp,2) = mass1
- bpp(jp,3) = mass2
- bpp(jp,4) = float(kstar1)
- bpp(jp,5) = float(kstar2)
- bpp(jp,6) = sep
+ all_cols(1) = tphys
+ all_cols(2) = mass1
+ all_cols(3) = mass2
+ all_cols(4) = float(kstar1)
+ all_cols(5) = float(kstar2)
+ all_cols(6) = sep
if(tb.le.0.d0)then
* system was disrupted and tb=-1 and should stay that way
- bpp(jp,7) = tb
+ all_cols(7) = tb
else
+ rsunau = 1/aursun
sep_cubed = (sep*rsunau)*(sep*rsunau)*(sep*rsunau)
tb_write = sqrt(sep_cubed/(mass1+mass2))
- bpp(jp,7) = tb_write*yeardy
- endif
- bpp(jp,8) = ecc
- bpp(jp,9) = rrl1
- bpp(jp,10) = rrl2
- bpp(jp,11) = evolve_type
- bpp(jp,12) = aj1
- bpp(jp,13) = aj2
- bpp(jp,14) = tms1
- bpp(jp,15) = tms2
- bpp(jp,16) = massc1
- bpp(jp,17) = massc2
- bpp(jp,18) = rad1
- bpp(jp,19) = rad2
- bpp(jp,20) = mass0_1
- bpp(jp,21) = mass0_2
- bpp(jp,22) = lumin1
- bpp(jp,23) = lumin2
- bpp(jp,24) = teff1
- bpp(jp,25) = teff2
- bpp(jp,26) = radc1
- bpp(jp,27) = radc2
- bpp(jp,28) = menv1
- bpp(jp,29) = menv2
- bpp(jp,30) = renv1
- bpp(jp,31) = renv2
- bpp(jp,32) = ospin1
- bpp(jp,33) = ospin2
- bpp(jp,34) = b_0_1
- bpp(jp,35) = b_0_2
- bpp(jp,36) = bacc1
- bpp(jp,37) = bacc2
- bpp(jp,38) = tacc1
- bpp(jp,39) = tacc2
- bpp(jp,40) = epoch1
- bpp(jp,41) = epoch2
- bpp(jp,42) = bhspin1
- bpp(jp,43) = bhspin2
- END
-
-***
- SUBROUTINE WRITEBCM(ip,tphys,kstar_1,mass0_1,mass_1,
- & lumin_1,rad_1,teff_1,massc_1,
- & radc_1,menv_1,renv_1,epoch_1,
- & ospin_1,deltam_1,RRLO_1,kstar_2,mass0_2,
- & mass_2,lumin_2,rad_2,teff_2,massc_2,radc_2,
- & menv_2,renv_2,epoch_2,ospin_2,deltam_2,
- & RRLO_2,porb,sep,ecc,B_0_1,B_0_2,
- & SN_1,SN_2,bin_state,merger_type)
- IMPLICIT NONE
- INCLUDE 'const_bse.h'
-*
-* Write results to bcm array.
-*
-* Author : Scott Coughlin
-* Date : 12th March 2019
-*
- REAL*8 tphys,mass0_1,mass_1,lumin_1,rad_1,teff_1
- REAL*8 massc_1,radc_1,menv_1,renv_1,epoch_1
- REAL*8 ospin_1,deltam_1,RRLO_1,porb_write,sep_cubed
- REAL*8 mass0_2,mass_2,lumin_2,rad_2,teff_2,massc_2
- REAL*8 radc_2,menv_2,renv_2,epoch_2,ospin_2,deltam_2
- REAL*8 RRLO_2,porb,sep,ecc,B_0_1,B_0_2
- INTEGER kstar_1,kstar_2,SN_1,SN_2,bin_state,merger_type
- INTEGER ip
- REAL*8 yeardy,aursun,rsunau
- PARAMETER(yeardy=365.24d0,aursun=214.95d0)
-
- rsunau = 1/aursun
-
- ip = ip + 1
- bcm(ip,1) = tphys
- bcm(ip,2) = float(kstar_1)
- bcm(ip,3) = mass0_1
- bcm(ip,4) = mass_1
- bcm(ip,5) = lumin_1
- bcm(ip,6) = rad_1
- bcm(ip,7) = teff_1
- bcm(ip,8) = massc_1
- bcm(ip,9) = radc_1
- bcm(ip,10) = menv_1
- bcm(ip,11) = renv_1
- bcm(ip,12) = epoch_1
- bcm(ip,13) = ospin_1
- bcm(ip,14) = deltam_1
- bcm(ip,15) = RRLO_1
- bcm(ip,16) = float(kstar_2)
- bcm(ip,17) = mass0_2
- bcm(ip,18) = mass_2
- bcm(ip,19) = lumin_2
- bcm(ip,20) = rad_2
- bcm(ip,21) = teff_2
- bcm(ip,22) = massc_2
- bcm(ip,23) = radc_2
- bcm(ip,24) = menv_2
- bcm(ip,25) = renv_2
- bcm(ip,26) = epoch_2
- bcm(ip,27) = ospin_2
- bcm(ip,28) = deltam_2
- bcm(ip,29) = RRLO_2
- if(porb.le.0.d0)then
-* system was disrupted and porb=-1 and should stay that way
- bcm(ip,30) = porb
- else
- sep_cubed = (sep*rsunau)*(sep*rsunau)*(sep*rsunau)
- porb_write = sqrt(sep_cubed/(mass_1+mass_2))
- bcm(ip,30) = porb_write*yeardy
+ all_cols(7) = tb_write*yeardy
endif
- bcm(ip,31) = sep
- bcm(ip,32) = ecc
- bcm(ip,33) = B_0_1
- bcm(ip,34) = B_0_2
- bcm(ip,35) = float(SN_1)
- bcm(ip,36) = float(SN_2)
- bcm(ip,37) = bin_state
- bcm(ip,38) = merger_type
+ all_cols(8) = ecc
+ all_cols(9) = rrl1
+ all_cols(10) = rrl2
+ all_cols(11) = evolve_type
+ all_cols(12) = aj1
+ all_cols(13) = aj2
+ all_cols(14) = tms1
+ all_cols(15) = tms2
+ all_cols(16) = massc1
+ all_cols(17) = massc2
+ all_cols(18) = rad1
+ all_cols(19) = rad2
+ all_cols(20) = mass0_1
+ all_cols(21) = mass0_2
+ all_cols(22) = lumin1
+ all_cols(23) = lumin2
+ all_cols(24) = teff1
+ all_cols(25) = teff2
+ all_cols(26) = radc1
+ all_cols(27) = radc2
+ all_cols(28) = menv1
+ all_cols(29) = menv2
+ all_cols(30) = renv1
+ all_cols(31) = renv2
+ all_cols(32) = ospin1
+ all_cols(33) = ospin2
+ all_cols(34) = b_0_1
+ all_cols(35) = b_0_2
+ all_cols(36) = bacc1
+ all_cols(37) = bacc2
+ all_cols(38) = tacc1
+ all_cols(39) = tacc2
+ all_cols(40) = epoch1
+ all_cols(41) = epoch2
+ all_cols(42) = bhspin1
+ all_cols(43) = bhspin2
+ all_cols(44) = deltam_1
+ all_cols(45) = deltam_2
+ all_cols(46) = float(SN_1)
+ all_cols(47) = float(SN_2)
+ all_cols(48) = bin_state
+ all_cols(49) = merger_type
- END
+* check which table we are writing to and write the appropriate columns
+ if (tabname .eq. 'bpp') then
+ jp = MIN(900,jp + 1) ! Why is the 900 limit here??
+ do 117, col_ind = 1, n_col_bpp
+ bpp(jp,col_ind) = all_cols(col_inds_bpp(col_ind))
+117 continue
+ else if (tabname .eq. 'bcm') then
+ jp = jp + 1
+ do 118, col_ind = 1, n_col_bcm
+ bcm(jp,col_ind) = all_cols(col_inds_bcm(col_ind))
+118 continue
+ end if
+ END
\ No newline at end of file
diff --git a/src/cosmic/src/comenv.f b/src/cosmic/src/comenv.f
index 2a7051acf..11a83d707 100644
--- a/src/cosmic/src/comenv.f
+++ b/src/cosmic/src/comenv.f
@@ -6,7 +6,7 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
& bhspin1,bhspin2,binstate,mergertype,
& jp,tphys,switchedCE,rad,tms,evolve_type,disrupt,
& lumin,B_0,bacc,tacc,epoch,menv_bpp,renv_bpp,
- & bkick)
+ & bkick,deltam_1,deltam_2,dtm)
IMPLICIT NONE
INCLUDE 'const_bse.h'
*
@@ -36,9 +36,10 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
REAL*8 RC1,RC2,Q1,Q2,RL1,RL2,LAMB1,LAMB2
REAL*8 MENV,RENV,MENVD,RZAMS,vk
REAL*8 Porbi,Porbf,Mcf,Menvf,qi,qf,G
- REAL*8 kick_info(2,17),fallback,M1i,M2i
+ REAL*8 kick_info(2,18),fallback,M1i,M2i
REAL*8 bkick(20)
- REAL*8 bhspin1,bhspin2
+ REAL*8 bhspin1,bhspin2,dtm
+ REAL*8 deltam_1,deltam_2
common /fall/fallback
INTEGER formation1,formation2
REAL*8 sigmahold
@@ -59,6 +60,7 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
REAL*8 KW1_TEMP, KW2_TEMP
REAL*8 rad(2),tms(2),lumin(2),B_0(2),bacc(2),tacc(2),epoch(2)
REAL*8 menv_bpp(2),renv_bpp(2)
+ REAL*8 ALPHA_CE
*
* Initialize
*
@@ -88,20 +90,24 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
* Obtain the core masses and radii.
*
KW = KW1
- CALL star(KW1,M01,M1,TM1,TN,TSCLS1,LUMS,GB,ZPARS)
+ CALL star(KW1,M01,M1,TM1,TN,TSCLS1,LUMS,GB,ZPARS,dtm,star1)
CALL hrdiag(M01,AJ1,M1,TM1,TN,TSCLS1,LUMS,GB,ZPARS,
& R1,L1,KW1,MC1,RC1,MENV,RENV,K21,
& bhspin1,star1)
OSPIN1 = JSPIN1/(K21*R1*R1*(M1-MC1)+K3*RC1*RC1*MC1)
MENVD = MENV/(M1-MC1)
- RZAMS = RZAMSF(M01)
*
* Decide which CE prescription to use based on LAMBDA flag
* MJZ: NOTE - Nanjing lambda prescription DOES NOT WORK!
*
- LAMB1 = CELAMF(KW,M01,L1,R1,RZAMS,MENVD,LAMBDAF)
+ IF (using_METISSE.eq.1) THEN
+ CALL comenv_lambda(KW,M01,L1,R1,MENVD,LAMBDAF,STAR1,LAMB1)
+ ELSEIF (using_SSE.eq.1) THEN
+ RZAMS = RZAMSF(M01)
+ LAMB1 = CELAMF(KW,M01,L1,R1,RZAMS,MENVD,LAMBDAF)
+ ENDIF
KW = KW2
- CALL star(KW2,M02,M2,TM2,TN,TSCLS2,LUMS,GB,ZPARS)
+ CALL star(KW2,M02,M2,TM2,TN,TSCLS2,LUMS,GB,ZPARS,dtm,star2)
CALL hrdiag(M02,AJ2,M2,TM2,TN,TSCLS2,LUMS,GB,ZPARS,
& R2,L2,KW2,MC2,RC2,MENV,RENV,K22,
& bhspin2,star2)
@@ -116,8 +122,12 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
*
IF(KW2.GE.2.AND.KW2.LE.9.AND.KW2.NE.7)THEN
MENVD = MENV/(M2-MC2)
- RZAMS = RZAMSF(M02)
- LAMB2 = CELAMF(KW,M02,L2,R2,RZAMS,MENVD,LAMBDAF)
+ IF (using_METISSE.eq.1) THEN
+ CALL comenv_lambda(KW,M02,L2,R2,MENVD,LAMBDAF,STAR2,LAMB2)
+ ELSEIF (using_SSE.eq.1) THEN
+ RZAMS = RZAMSF(M02)
+ LAMB2 = CELAMF(KW,M02,L2,R2,RZAMS,MENVD,LAMBDAF)
+ ENDIF
EBINDI = EBINDI + M2*(M2-MC2)/(LAMB2*R2)
*
* Calculate the initial orbital energy
@@ -136,7 +146,12 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
*
* Calculate the final orbital energy without coalescence.
*
- EORBF = EORBI + EBINDI/ALPHA1
+ IF(switchedCE)THEN
+ ALPHA_CE = ALPHA1(2)
+ ELSE
+ ALPHA_CE = ALPHA1(1)
+ ENDIF
+ EORBF = EORBI + EBINDI/ALPHA_CE
*
* If the secondary is on the main sequence see if it fills its Roche lobe.
*
@@ -187,7 +202,12 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
* Coalescence - calculate final binding energy.
*
EORBF = MAX(MC1*M2/(2.D0*SEPL),EORBI)
- EBINDF = EBINDI - ALPHA1*(EORBF - EORBI)
+ IF(switchedCE)THEN
+ ALPHA_CE = ALPHA1(2)
+ ELSE
+ ALPHA_CE = ALPHA1(1)
+ ENDIF
+ EBINDF = EBINDI - ALPHA_CE*(EORBF - EORBI)
KW1_TEMP = KW
KW2_TEMP = 15
ELSE
@@ -213,7 +233,7 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
M_postCE=MC1
ENDIF
- CALL star(KW1,M01,M1,TM1,TN,TSCLS1,LUMS,GB,ZPARS)
+ CALL star(KW1,M01,M1,TM1,TN,TSCLS1,LUMS,GB,ZPARS,dtm,star1)
CALL hrdiag(M01,AJ1,M1,TM1,TN,TSCLS1,LUMS,GB,ZPARS,
& R1,L1,KW1,MC1,RC1,MENV,RENV,K21,
& bhspin1,star1)
@@ -298,7 +318,7 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
& (rad1_bpp**2.d0))**(1.d0/4.d0))
teff2 = 1000.d0*((1130.d0*lumin(2)/
& (rad2_bpp**2.d0))**(1.d0/4.d0))
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass1_bpp,mass2_bpp,kstar1_bpp,
& kstar2_bpp,SEP_postCE,TB,ECC,
& rrl1_bpp,rrl2_bpp,
@@ -308,13 +328,15 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
& RC2,RC1,menv_bpp(2),menv_bpp(1),renv_bpp(2),
& renv_bpp(1),OSPIN2,OSPIN1,B_0(2),B_0(1),
& bacc(2),bacc(1),tacc(2),tacc(1),epoch(2),
- & epoch(1),bhspin2,bhspin1)
+ & epoch(1),bhspin2,bhspin1,
+ & deltam_2,deltam_1,formation2,formation1,
+ & binstate,mergertype,'bpp')
else
teff1 = 1000.d0*((1130.d0*lumin(1)/
& (rad1_bpp**2.d0))**(1.d0/4.d0))
teff2 = 1000.d0*((1130.d0*lumin(2)/
& (rad2_bpp**2.d0))**(1.d0/4.d0))
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass1_bpp,mass2_bpp,kstar1_bpp,
& kstar2_bpp,SEP_postCE,TB,ECC,
& rrl1_bpp,rrl2_bpp,
@@ -324,7 +346,9 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
& RC1,RC2,menv_bpp(1),menv_bpp(2),renv_bpp(1),
& renv_bpp(2),OSPIN1,OSPIN2,B_0(1),B_0(2),
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin1,bhspin2)
+ & epoch(2),bhspin1,bhspin2,
+ & deltam_1,deltam_2,formation1,formation2,
+ & binstate,mergertype,'bpp')
endif
endif
CALL kick(KW1,M_postCE,M1,M2,ECC,SEP_postCE,
@@ -415,7 +439,12 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
* Calculate the final envelope binding energy.
*
EORBF = MAX(MC1*MC2/(2.D0*SEPL),EORBI)
- EBINDF = EBINDI - ALPHA1*(EORBF - EORBI)
+ IF(switchedCE)THEN
+ ALPHA_CE = ALPHA1(2)
+ ELSE
+ ALPHA_CE = ALPHA1(1)
+ ENDIF
+ EBINDF = EBINDI - ALPHA_CE*(EORBF - EORBI)
if(output) write(*,*)'In dg or giant 1:',M01,M1,R1,M02,M2,
& R2,MC1,MC2,MC3,KW1,KW2,KW,EORBF,EBINDF
*
@@ -515,7 +544,7 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
endif
ENDIF
- CALL star(KW1,M01,M1,TM1,TN,TSCLS1,LUMS,GB,ZPARS)
+ CALL star(KW1,M01,M1,TM1,TN,TSCLS1,LUMS,GB,ZPARS,dtm,star1)
CALL hrdiag(M01,AJ1,M1,TM1,TN,TSCLS1,LUMS,GB,ZPARS,
& R1,L1,KW1,MC1,RC1,MENV,RENV,K21,
& bhspin1,star1)
@@ -599,7 +628,7 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
& (rad1_bpp**2.d0))**(1.d0/4.d0))
teff2 = 1000.d0*((1130.d0*lumin(2)/
& (rad2_bpp**2.d0))**(1.d0/4.d0))
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass1_bpp,mass2_bpp,kstar1_bpp,
& kstar2_bpp,SEP_postCE,TB,ECC,
& rrl1_bpp,rrl2_bpp,
@@ -609,13 +638,15 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
& RC2,RC1,menv_bpp(2),menv_bpp(1),renv_bpp(2),
& renv_bpp(1),OSPIN2,OSPIN1,B_0(2),B_0(1),
& bacc(2),bacc(1),tacc(2),tacc(1),epoch(2),
- & epoch(1),bhspin2,bhspin1)
+ & epoch(1),bhspin2,bhspin1,
+ & deltam_2,deltam_1,formation2,formation1,
+ & binstate,mergertype,'bpp')
else
teff1 = 1000.d0*((1130.d0*lumin(1)/
& (rad1_bpp**2.d0))**(1.d0/4.d0))
teff2 = 1000.d0*((1130.d0*lumin(2)/
& (rad2_bpp**2.d0))**(1.d0/4.d0))
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass1_bpp,mass2_bpp,kstar1_bpp,
& kstar2_bpp,SEP_postCE,TB,ECC,
& rrl1_bpp,rrl2_bpp,
@@ -625,7 +656,9 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
& RC1,RC2,menv_bpp(1),menv_bpp(2),renv_bpp(1),
& renv_bpp(2),OSPIN1,OSPIN2,B_0(1),B_0(2),
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin1,bhspin2)
+ & epoch(2),bhspin1,bhspin2,
+ & deltam_1,deltam_2,formation1,formation2,
+ & binstate,mergertype,'bpp')
endif
endif
* USSN: if ussn flag is set, have reduced kicks for stripped He stars (SN=8)
@@ -678,7 +711,7 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
M_postCE=MC2
ENDIF
- CALL star(KW2,M02,M2,TM2,TN,TSCLS2,LUMS,GB,ZPARS)
+ CALL star(KW2,M02,M2,TM2,TN,TSCLS2,LUMS,GB,ZPARS,dtm,star2)
CALL hrdiag(M02,AJ2,M2,TM2,TN,TSCLS2,LUMS,GB,ZPARS,
& R2,L2,KW2,MC2,RC2,MENV,RENV,K22,
& bhspin2,star2)
@@ -764,7 +797,7 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
& (rad1_bpp**2.d0))**(1.d0/4.d0))
teff2 = 1000.d0*((1130.d0*lumin(2)/
& (rad2_bpp**2.d0))**(1.d0/4.d0))
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass1_bpp,mass2_bpp,kstar1_bpp,
& kstar2_bpp,SEP_postCE,TB,ECC,
& rrl1_bpp,rrl2_bpp,
@@ -774,13 +807,15 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
& RC2,RC1,menv_bpp(2),menv_bpp(1),renv_bpp(2),
& renv_bpp(1),OSPIN2,OSPIN1,B_0(2),B_0(1),
& bacc(2),bacc(1),tacc(2),tacc(1),epoch(2),
- & epoch(1),bhspin2,bhspin1)
+ & epoch(1),bhspin2,bhspin1,
+ & deltam_2,deltam_1,formation2,formation1,
+ & binstate,mergertype,'bpp')
else
teff1 = 1000.d0*((1130.d0*lumin(1)/
& (rad1_bpp**2.d0))**(1.d0/4.d0))
teff2 = 1000.d0*((1130.d0*lumin(2)/
& (rad2_bpp**2.d0))**(1.d0/4.d0))
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass1_bpp,mass2_bpp,kstar1_bpp,
& kstar2_bpp,SEP_postCE,TB,ECC,
& rrl1_bpp,rrl2_bpp,
@@ -790,7 +825,9 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
& RC1,RC2,menv_bpp(1),menv_bpp(2),renv_bpp(1),
& renv_bpp(2),OSPIN1,OSPIN2,B_0(1),B_0(2),
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin1,bhspin2)
+ & epoch(2),bhspin1,bhspin2,
+ & deltam_1,deltam_2,formation1,formation2,
+ & binstate,mergertype,'bpp')
endif
endif
CALL kick(KW2,M_postCE,M2,M1,ECC,SEP_postCE,
@@ -884,17 +921,20 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
if(output) write(*,*)'coel 2 1:',KW,KW1,KW2,M1,M2,MF,MC22,
& TB,OORB
IF(KW.EQ.2)THEN
- CALL star(KW,M1,M1,TM2,TN,TSCLS2,LUMS,GB,ZPARS)
+ if (using_METISSE.eq.1) call set_star_type(star1)
+ CALL star(KW,M1,M1,TM2,TN,TSCLS2,LUMS,GB,ZPARS,dtm,star1)
IF(GB(9).GE.MC1)THEN
M01 = M1
AJ1 = TM2 + (TSCLS2(1) - TM2)*(AJ1-TM1)/(TSCLS1(1) - TM1)
- CALL star(KW,M01,M1,TM1,TN,TSCLS1,LUMS,GB,ZPARS)
+ CALL star(KW,M01,M1,TM1,TN,TSCLS1,LUMS,GB,ZPARS,
+ & dtm,star1)
ENDIF
if(output) write(*,*)'coel 2 2:',KW,KW1,KW2,M1,M01,MC22,
& TB,OORB
ELSEIF(KW.EQ.7)THEN
M01 = M1
- CALL star(KW,M01,M1,TM1,TN,TSCLS1,LUMS,GB,ZPARS)
+ if (using_METISSE.eq.1) call set_star_type(star1)
+ CALL star(KW,M01,M1,TM1,TN,TSCLS1,LUMS,GB,ZPARS,dtm,star1)
AJ1 = TM1*(FAGE1*MC1 + FAGE2*MC22)/(MC1 + MC22)
if(output) write(*,*)'coel 2 3:',KW,KW1,KW2,M1,M01,MC22,
& TB,OORB
@@ -905,8 +945,8 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
*
* Obtain a new age for the giant.
*
- CALL gntage(MC1,M1,KW,ZPARS,M01,AJ1)
- CALL star(KW,M01,M1,TM1,TN,TSCLS1,LUMS,GB,ZPARS)
+ CALL gntage(MC1,M1,KW,ZPARS,M01,AJ1,star1)
+ CALL star(KW,M01,M1,TM1,TN,TSCLS1,LUMS,GB,ZPARS,dtm,star1)
if(output) write(*,*)'coel 2 4:',KW,KW1,KW2,M1,M01,MC22,
& TB,OORB
ENDIF
@@ -920,7 +960,7 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
if(output) write(*,*)'coel 2 5:',KW,M1,M01,R1,MENV,RENV
IF(KW1i.LE.12.and.KW.GE.13)THEN
formation1 = 1
- if(KW.eq.13.and.ecsn.gt.0.d0)then
+ if(KW1.eq.13.and.ecsn.gt.0.d0)then
if(KW1i.le.6)then
if(M1i.le.zpars(5))then
if(sigma.gt.0.d0.and.sigmadiv.gt.0.d0)then
@@ -992,7 +1032,7 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
& (rad1_bpp**2.d0))**(1.d0/4.d0))
teff2 = 1000.d0*((1130.d0*lumin(2)/
& (rad2_bpp**2.d0))**(1.d0/4.d0))
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass1_bpp,mass2_bpp,kstar1_bpp,
& kstar2_bpp,-1.d0,TB,0.d0,
& rrl1_bpp,rrl2_bpp,
@@ -1002,13 +1042,15 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
& RC2,RC1,menv_bpp(2),menv_bpp(1),renv_bpp(2),
& renv_bpp(1),OSPIN2,OSPIN1,B_0(2),B_0(1),
& bacc(2),bacc(1),tacc(2),tacc(1),epoch(2),
- & epoch(1),bhspin2,bhspin1)
+ & epoch(1),bhspin2,bhspin1,
+ & deltam_2,deltam_1,formation2,formation1,
+ & binstate,mergertype,'bpp')
else
teff1 = 1000.d0*((1130.d0*lumin(1)/
& (rad1_bpp**2.d0))**(1.d0/4.d0))
teff2 = 1000.d0*((1130.d0*lumin(2)/
& (rad2_bpp**2.d0))**(1.d0/4.d0))
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass1_bpp,mass2_bpp,kstar1_bpp,
& kstar2_bpp,-1.d0,TB,0.d0,
& rrl1_bpp,rrl2_bpp,
@@ -1018,7 +1060,9 @@ SUBROUTINE COMENV(M01,M1,MC1,AJ1,JSPIN1,KW1,
& RC1,RC2,menv_bpp(1),menv_bpp(2),renv_bpp(1),
& renv_bpp(2),OSPIN1,OSPIN2,B_0(1),B_0(2),
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin1,bhspin2)
+ & epoch(2),bhspin1,bhspin2,
+ & deltam_1,deltam_2,formation1,formation2,
+ & binstate,mergertype,'bpp')
endif
endif
CALL kick(KW,MF,M1,0.d0,0.d0,-1.d0,0.d0,vk,star1,
diff --git a/src/cosmic/src/comprad.f b/src/cosmic/src/comprad.f
index bfbf3dc5c..55eb2c72d 100644
--- a/src/cosmic/src/comprad.f
+++ b/src/cosmic/src/comprad.f
@@ -17,7 +17,7 @@ SUBROUTINE compute_r(mass,z,num,rad)
PARAMETER(loop=100000)
real*8 mass(loop),rad(loop),z
integer k,kstar,num
- real*8 mt,tm,tn,mass0,age,lum,mc,rc,me,re
+ real*8 mt,tm,tn,mass0,age,lum,mc,rc,me,re,dtm
REAL*8 tscls(20),lums(10),GB(10),zpars(20),k2,bhspin
***
@@ -29,8 +29,12 @@ SUBROUTINE compute_r(mass,z,num,rad)
Cf2py intent(in) num
Cf2py intent(out) rad
+ if(using_METISSE.eq.1) CALL initialize_front_end('cosmic')
CALL zcnsts(z,zpars)
+ if(using_METISSE.eq.1) call allocate_track(num,mass)
+
+
***
* Then just loop through everything
***
@@ -46,11 +50,15 @@ SUBROUTINE compute_r(mass,z,num,rad)
kstar = 0
if(mt.ge.0.7) kstar = 1
bhspin = 0.d0
- rc = 0.d0
- CALL star(kstar,mass0,mt,tm,tn,tscls,lums,GB,zpars)
+ rc = 0.d0
+ dtm = 0.d0
+ CALL star(kstar,mass0,mt,tm,tn,tscls,lums,GB,zpars,dtm,k)
CALL hrdiag(mass0,age,mt,tm,tn,tscls,lums,GB,zpars,
& rad(k),lum,kstar,mc,rc,me,re,k2,bhspin,k)
-
+
10 continue
+
+
+ if (using_METISSE.eq.1) call dealloc_track()
END SUBROUTINE compute_r
diff --git a/src/cosmic/src/const_bse.h b/src/cosmic/src/const_bse.h
index e404b8dee..9ba224148 100644
--- a/src/cosmic/src/const_bse.h
+++ b/src/cosmic/src/const_bse.h
@@ -15,7 +15,7 @@
& qcflag,eddlimflag,bhspinflag,aic,rejuvflag,
& htpmb,ST_cr,ST_tide,bdecayfac,grflag,
& bhms_coll_flag,wd_mass_lim,rtmsflag
- REAL*8 don_lim,acc_lim,Mbh_initial
+ REAL*8 don_lim,acc_lim(2),Mbh_initial
COMMON /MTVARS/ don_lim,acc_lim,Mbh_initial
INTEGER ceflag,cekickflag,cemergeflag,cehestarflag,ussn
COMMON /CEFLAGS/ ceflag,cekickflag,cemergeflag,cehestarflag,ussn
@@ -28,7 +28,7 @@
REAL*8 eddfac,gamma
COMMON /WINDVARS/ neta,bwind,hewind,beta,xi,acc2,epsnov,
& eddfac,gamma
- REAL*8 alpha1,lambdaf
+ REAL*8 alpha1(2),lambdaf
REAL*8 qcrit_array(16)
COMMON /CEVARS/ qcrit_array,alpha1,lambdaf
REAL*8 bconst,CK
@@ -55,6 +55,20 @@
COMMON /TSTEPC/ dmmax,drmax
REAL*8 scm(50000,14),spp(20,3)
COMMON /SINGLE/ scm,spp
- REAL*8 bcm(50000,38),bpp(1000,43)
+ REAL*8 bcm(50000,49),bpp(1000,49)
COMMON /BINARY/ bcm,bpp
+ INTEGER n_col_bpp, n_col_bcm
+ INTEGER col_inds_bpp(49), col_inds_bcm(49)
+ COMMON /COL/ n_col_bpp,col_inds_bpp,n_col_bcm,col_inds_bcm
+*
+ INTEGER using_metisse, using_sse
+ COMMON /SE_FLAGS/ using_metisse, using_sse
+ CHARACTER*256 path_to_tracks,path_to_he_tracks
+ real*8 z_match_limit
+ LOGICAL METISSE_verbose
+ COMMON/ METISSEVARS/ path_to_tracks,path_to_he_tracks,
+ & z_match_limit, METISSE_verbose
+ LOGICAL bcm_err
+ COMMON/ ER_FLAGS/ bcm_err
+
*
diff --git a/src/cosmic/src/deltat.f b/src/cosmic/src/deltat.f
index d7afeecee..eb63fce37 100644
--- a/src/cosmic/src/deltat.f
+++ b/src/cosmic/src/deltat.f
@@ -1,62 +1,18 @@
-***
- SUBROUTINE deltat(kw,age,tm,tn,tscls,dt,dtr)
+ SUBROUTINE deltat(kw,age,tm,tn,tscls,dt,dtr,id)
IMPLICIT NONE
INCLUDE 'const_bse.h'
-*
- INTEGER kw
+
+ INTEGER kw,id
REAL*8 age,tm,tn,tscls(20)
REAL*8 dt,dtr
-*
-* Base new time scale for changes in radius & mass on stellar type.
-*
- if(kw.le.1)then
- dt = pts1*tm
- dtr = tm - age
- elseif(kw.eq.2)then
- dt = pts1*(tscls(1) - tm)
- dtr = tscls(1) - age
- elseif(kw.eq.3)then
- if(age.lt.tscls(6))then
- dt = pts2*(tscls(4) - age)
- else
- dt = pts2*(tscls(5) - age)
- endif
- dtr = MIN(tscls(2),tn) - age
- elseif(kw.eq.4)then
- dt = pts2*tscls(3)
- dtr = MIN(tn,tscls(2) + tscls(3)) - age
- elseif(kw.eq.5)then
- if(age.lt.tscls(9))then
- dt = pts3*(tscls(7) - age)
- else
- dt = pts3*(tscls(8) - age)
- endif
- dtr = MIN(tn,tscls(13)) - age
- elseif(kw.eq.6)then
- if(age.lt.tscls(12))then
- dt = pts3*(tscls(10) - age)
- else
- dt = pts3*(tscls(11) - age)
- endif
- dt = MIN(dt,0.005d0)
- dtr = tn - age
- elseif(kw.eq.7)then
- dt = pts1*tm
- dtr = tm - age
- elseif(kw.eq.8.or.kw.eq.9)then
- if(age.lt.tscls(6))then
- dt = pts2*(tscls(4) - age)
- else
- dt = pts2*(tscls(5) - age)
- endif
- dtr = tn - age
- else
-* dt = MAX(0.1d0,age*10.d0)
- dt = MAX(0.1d0,dt*10.d0)
- dt = MIN(dt,5.0d+02)
- dtr = dt
+
+ if (using_METISSE.eq.1) then
+ !WRITE(*,*) 'Calling METISSE_deltat'
+ CALL METISSE_deltat(id,age,dt,dtr)
+
+ elseif (using_SSE.eq.1) then
+ !WRITE(*,*) 'Calling SSE_deltat'
+ CALL SSE_deltat(kw,age,tm,tn,tscls,dt,dtr)
endif
-*
- RETURN
+
END
-***
diff --git a/src/cosmic/src/evolv2.f b/src/cosmic/src/evolv2.f
index b57eb9705..4de09f462 100644
--- a/src/cosmic/src/evolv2.f
+++ b/src/cosmic/src/evolv2.f
@@ -167,9 +167,9 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
REAL*8 mass1_bpp,mass2_bpp
REAL*8 rad(2),rol(2),rol0(2),rdot(2),radc(2),renv(2),radx(2)
REAL*8 lumin(2),k2str(2),q(2),dms(2),dmr(2),dmt(2)
- REAL*8 dml,vorb2,vwind2,omv2,ivsqm,lacc,kick_info(2,17)
+ REAL*8 dml,vorb2,vwind2,omv2,ivsqm,lacc,kick_info(2,18)
REAL*8 bkick(20)
- REAL*8 kick_info_out(2,17)
+ REAL*8 kick_info_out(2,18)
REAL*8 sep,dr,tb,dme,tdyn,taum,dm1,dm2,dmchk,qc,dt,pd,rlperi
REAL*8 m1ce,m2ce,mch,tmsnew,dm22,mew
PARAMETER(mch=1.44d0)
@@ -178,7 +178,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
REAL*8 acc1,tiny
PARAMETER(acc1=3.920659d+08,tiny=1.0d-14)
REAL*8 ecc,ecc1,tc,tcirc,ttid,ecc2,omecc2,sqome2,sqome3,sqome5
- REAL*8 f1,f2,f3,f4,f5,f,raa2,raa6,eqspin,rg2,tcqr
+ REAL*8 f1,f2,f3,f4,f5,f,raa2,raa6,eqspin,rg2,tcqr,gammadisc
REAL*8 k3,mr23yr,twopi
PARAMETER(k3=0.21d0,mr23yr=0.4311d0)
REAL*8 jspin(2),ospin(2),jorb,oorb,jspbru,ospbru
@@ -216,6 +216,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
*
REAL*8 qc_fixed
LOGICAL switchedCE,disrupt
+ integer err
Cf2py intent(in) kstar
Cf2py intent(in) mass
@@ -249,7 +250,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
if(using_cmc.eq.0)then
CALL instar
endif
-
+
*
* Save the initial state.
*
@@ -333,9 +334,21 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
*
* Set the collision matrix.
*
+ err = 0
if(using_cmc.eq.0)then
- CALL zcnsts(z,zpars)
+ if(using_METISSE.eq.1) CALL initialize_front_end('cosmic')
+* for SSE path_to_tracks and path_to_he_tracks are empty ('')
+ CALL zcnsts(z,zpars)
+ if(using_METISSE.eq.1) then
+ call check_error(err)
+ if (err>0) then
+ bpp_index_out = -1
+ return
+ endif
+ endif
endif
+
+ if(using_METISSE.eq.1) call allocate_track(2,mass0)
kmin = 1
kmax = 2
@@ -409,7 +422,8 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
age = tphys - epoch(k)
mc = massc(k)
rc = radc(k)
- CALL star(kstar(k),mass0(k),mass(k),tm,tn,tscls,lums,GB,zpars)
+ CALL star(kstar(k),mass0(k),mass(k),tm,tn,tscls,lums,GB,zpars,
+ & dtm,k)
CALL hrdiag(mass0(k),age,mass(k),tm,tn,tscls,lums,GB,zpars,
& rm,lum,kstar(k),mc,rc,me,re,k2,bhspin(k),k)
aj(k) = age
@@ -550,7 +564,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
if(neta.gt.tiny .and. kstar(k)<15)then
rlperi = rol(k)*(1.d0-ecc)
dmr(k) = mlwind(kstar(k),lumin(k),rad(k),mass(k),
- & massc(k),rlperi,z)
+ & massc(k),rlperi,z,k)
*
* Calculate how much of wind mass loss from companion will be
* accreted (Boffin & Jorissen, A&A 1988, 205, 155).
@@ -758,7 +772,6 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
dt = MIN(dt,dtj)
if(output) write(*,*)'mb1:',tphys,dt,djmb,djt
endif
-*
if(kstar(k).eq.13.and.pulsar.gt.0)then
*
* NS(pulsar) magnetic braking. PK.
@@ -916,7 +929,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
if(neta.gt.tiny .and. kstar(k)<15)then
rlperi = 0.d0
dmr(k) = mlwind(kstar(k),lumin(k),rad(k),mass(k),
- & massc(k),rlperi,z)
+ & massc(k),rlperi,z,k)
else
dmr(k) = 0.d0
endif
@@ -1133,8 +1146,9 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
m0 = mass0(k)
mass0(k) = mass(k)
CALL star(kstar(k),mass0(k),mass(k),tm,tn,tscls,
- & lums,GB,zpars)
+ & lums,GB,zpars,dtm,k)
if(kstar(k).eq.2)then
+ if (using_SSE.eq.1) then
if(GB(9).lt.massc(k).or.m0.gt.zpars(3))then
mass0(k) = m0
else
@@ -1142,6 +1156,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& (tbgb(k) - tms(k))
epoch(k) = tphys - epoch(k)
endif
+ endif
else
epoch(k) = tphys - aj(k)*tm/tms(k)
endif
@@ -1213,7 +1228,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
* goto 140
endif
*
- CALL star(kw,m0,mt,tm,tn,tscls,lums,GB,zpars)
+ CALL star(kw,m0,mt,tm,tn,tscls,lums,GB,zpars,dtm,k)
CALL hrdiag(m0,age,mt,tm,tn,tscls,lums,GB,zpars,
& rm,lum,kw,mc,rc,me,re,k2,bhspin(k),k)
*
@@ -1328,7 +1343,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
else
b02_bcm = B(2)
endif
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass(1),mass(2),kstar(1),kstar(2),
& sep,tb,ecc,rrl1,rrl2,
& aj(1),aj(2),tms(1),tms(2),
@@ -1338,7 +1353,9 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& menv(1),menv(2),renv(1),renv(2),
& ospin(1),ospin(2),b01_bcm,b02_bcm,
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin(1),bhspin(2))
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bpp')
CALL kick(kw,mass(k),mt,0.d0,0.d0,-1.d0,0.d0,vk,k,
& 0.d0,fallback,sigmahold,kick_info,disrupt,bkick)
@@ -1366,7 +1383,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
b02_bcm = B(2)
endif
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass(1),mass(2),kstar(1),kstar(2),
& sep,tb,ecc,rrl1,rrl2,
& aj(1),aj(2),tms(1),tms(2),
@@ -1376,7 +1393,9 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& menv(1),menv(2),renv(1),renv(2),
& ospin(1),ospin(2),b01_bcm,b02_bcm,
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin(1),bhspin(2))
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bpp')
CALL kick(kw,mass(k),mt,mass(3-k),ecc,sep,jorb,vk,k,
& rad(3-k),fallback,sigmahold,kick_info,disrupt,bkick)
@@ -1507,7 +1526,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
* Base new time scale for changes in radius & mass on stellar type.
*
dt = dtmi(k)
- CALL deltat(kw,age,tm,tn,tscls,dt,dtr)
+ CALL deltat(kw,age,tm,tn,tscls,dt,dtr,k)
if(output) write(*,*)'post deltat:',tphys,dt,dtr,kw,
& age,intpol,iter,k,kmin,kmax
*
@@ -1580,7 +1599,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
b02_bcm = B(2)
endif
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass(1),mass(2),kstar(1),kstar(2),sep,
& tb,ecc,rrl1,rrl2,
& aj(1),aj(2),tms(1),tms(2),
@@ -1590,7 +1609,9 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& menv(1),menv(2),renv(1),renv(2),
& ospin(1),ospin(2),b01_bcm,b02_bcm,
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin(1),bhspin(2))
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bpp')
if(snova)then
bpp(jp,11) = 2.0
dtm = 0.d0
@@ -1642,14 +1663,20 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
if(pisn_track(1).ne.0) formation(1) = pisn_track(1)
if(pisn_track(2).ne.0) formation(2) = pisn_track(2)
- CALL writebcm(ip,tphys,kstar(1),mass0(1),mass(1),
- & lumin(1),rad(1),teff1,massc(1),
- & radc(1),menv(1),renv(1),epoch(1),
- & ospin(1),deltam1_bcm,rrl1,kstar(2),mass0(2),
- & mass(2),lumin(2),rad(2),teff2,massc(2),
- & radc(2),menv(2),renv(2),epoch(2),ospin(2),
- & deltam2_bcm,rrl2,tb,sep,ecc,b01_bcm,b02_bcm,
- & formation(1),formation(2),binstate,mergertype)
+ CALL writetab(ip,tphys,evolve_type,
+ & mass(1),mass(2),kstar(1),kstar(2),
+ & sep,tb,ecc,rrl1,rrl2,
+ & aj(1),aj(2),tms(1),tms(2),
+ & massc(1),massc(2),rad(1),rad(2),
+ & mass0(1),mass0(2),lumin(1),lumin(2),
+ & teff1,teff2,radc(1),radc(2),
+ & menv(1),menv(2),renv(1),renv(2),
+ & ospin(1),ospin(2),b01_bcm,b02_bcm,
+ & bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bcm')
+ if (bcm_err) goto 150
if(isave) tsave = tsave + dtp
if(output) write(*,*)'bcm1',kstar(1),kstar(2),mass(1),
& mass(2),rad(1),rad(2),ospin(1),ospin(2),jspin(1)
@@ -1685,6 +1712,10 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
* Test whether Roche lobe overflow has begun.
*
if(rad(j1).gt.rol(j1))then
+ if (using_METISSE.eq.1 .and. (rad(j1).lt.1.05d0*rol(j1))) then
+ if(tphys.ge.tphysf) goto 140
+ goto 7
+ endif
*
* Interpolate back until the primary is just filling its Roche lobe.
*
@@ -1749,6 +1780,8 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
prec = .true.
endif
tphys0 = tphys
+ if(using_METISSE.eq.1 .and. (dtm.le.1.0d-10))
+ & dtm = max(ABS(dtm),dtmi(j1))
endif
endif
*
@@ -1785,7 +1818,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
b02_bcm = B(2)
endif
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass(1),mass(2),kstar(1),kstar(2),sep,
& tb,ecc,rrl1,rrl2,
& aj(1),aj(2),tms(1),tms(2),
@@ -1795,7 +1828,9 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& menv(1),menv(2),renv(1),renv(2),
& ospin(1),ospin(2),b01_bcm,b02_bcm,
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin(1),bhspin(2))
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bpp')
endif
*
iter = iter + 1
@@ -1870,7 +1905,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
b02_bcm = B(2)
endif
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass(1),mass(2),kstar(1),kstar(2),sep,
& tb,ecc,rrl1,rrl2,
& aj(1),aj(2),tms(1),tms(2),
@@ -1880,7 +1915,9 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& menv(1),menv(2),renv(1),renv(2),
& ospin(1),ospin(2),b01_bcm,b02_bcm,
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin(1),bhspin(2))
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bpp')
*
if(check_dtp.eq.1)then
CALL checkstate(dtp,dtp_original,tsave,tphys,tphysf,
@@ -1924,14 +1961,20 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
* Check if PISN occurred, and if so overwrite formation
if(pisn_track(1).ne.0) formation(1) = pisn_track(1)
if(pisn_track(2).ne.0) formation(2) = pisn_track(2)
- CALL writebcm(ip,tphys,kstar(1),mass0(1),mass(1),
- & lumin(1),rad(1),teff1,massc(1),
- & radc(1),menv(1),renv(1),epoch(1),
- & ospin(1),deltam1_bcm,rrl1,kstar(2),mass0(2),
- & mass(2),lumin(2),rad(2),teff2,massc(2),
- & radc(2),menv(2),renv(2),epoch(2),ospin(2),
- & deltam2_bcm,rrl2,tb,sep,ecc,b01_bcm,b02_bcm,
- & formation(1),formation(2),binstate,mergertype)
+ CALL writetab(ip,tphys,evolve_type,
+ & mass(1),mass(2),kstar(1),kstar(2),
+ & sep,tb,ecc,rrl1,rrl2,
+ & aj(1),aj(2),tms(1),tms(2),
+ & massc(1),massc(2),rad(1),rad(2),
+ & mass0(1),mass0(2),lumin(1),lumin(2),
+ & teff1,teff2,radc(1),radc(2),
+ & menv(1),menv(2),renv(1),renv(2),
+ & ospin(1),ospin(2),b01_bcm,b02_bcm,
+ & bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bcm')
+ if (bcm_err) goto 150
if(output) write(*,*)'bcm2:',kstar(1),kstar(2),mass(1),
& mass(2),rad(1),rad(2),ospin(1),ospin(2),jspin(1)
* & mass(2),rad(1),rad(2),ospin(1),ospin(2),b01_bcm,b02_bcm,jspin(1)
@@ -2253,7 +2296,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
*
mass0(j2) = mass(j2)
CALL star(kstar(j2),mass0(j2),mass(j2),tmsnew,tn,
- & tscls,lums,GB,zpars)
+ & tscls,lums,GB,zpars,dtm,j2)
* If the star has no convective core then the effective age decreases,
* otherwise it will become younger still.
if(mass(j2).lt.0.35d0.or.mass(j2).gt.1.25d0)then
@@ -2270,8 +2313,9 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
mass(j2) = mass(j2) + dm2
if(kstar(j2).eq.2)then
mass0(j2) = mass(j2)
+ if (using_METISSE.eq.1) call set_star_type(j2)
CALL star(kstar(j2),mass0(j2),mass(j2),tmsnew,tn,tscls,
- & lums,GB,zpars)
+ & lums,GB,zpars,dtm,j2)
aj(j2) = tmsnew + tscls(1)*(aj(j2)-tms(j2))/tbgb(j2)
epoch(j2) = tphys - aj(j2)
endif
@@ -2294,10 +2338,11 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
kst = kstar(j1)
mass(j1) = mass(j2) + dm2
mass(j2) = 0.d0
+ if (using_METISSE.eq.1) call set_star_type(j1)
else
mass(j2) = mass(j2) + dm2
CALL gntage(massc(j2),mass(j2),kst,zpars,
- & mass0(j2),aj(j2))
+ & mass0(j2),aj(j2),j2)
epoch(j2) = tphys - aj(j2)
endif
kstar(j2) = kst
@@ -2359,7 +2404,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
b02_bcm = B(2)
endif
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass(1),mass(2),
& kstar(1),kstar(2),sep,
& tb,ecc,rrl1,rrl2,
@@ -2370,7 +2415,9 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& menv(1),menv(2),renv(1),renv(2),
& ospin(1),ospin(2),b01_bcm,b02_bcm,
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin(1),bhspin(2))
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bpp')
CALL comenv(mass0(j1),mass(j1),massc(j1),aj(j1),jspin(j1),
& kstar(j1),mass0(j2),mass(j2),massc(j2),aj(j2),
@@ -2378,7 +2425,34 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& vk,kick_info,formation(j1),formation(j2),sigmahold,
& bhspin(j1),bhspin(j2),binstate,mergertype,
& jp,tphys,switchedCE,rad,tms,evolve_type,disrupt,
- & lumin,B_0,bacc,tacc,epoch,menv,renv,bkick)
+ & lumin,B_0,bacc,tacc,epoch,menv,renv,bkick,
+ & deltam1_bcm,deltam2_bcm,dtm)
+ if(j1.eq.2.and.kcomp2.eq.13.and.kstar(j2).eq.15.and.
+ & kstar(j1).eq.13)then !PK.
+* In CE the NS got switched around. Do same to formation.
+ formation(j1) = formation(j2)
+ endif
+ if(j1.eq.1.and.kcomp2.eq.13.and.kstar(j2).eq.15.and.
+ & kstar(j1).eq.13)then !PK.
+* In CE the NS got switched around. Do same to formation.
+ formation(j1) = formation(j2)
+ endif
+ com = .true.
+ if(com.and..not.coel.and..not.disrupt)then
+* if it went through common envelope
+* did not disrupt (from one of the objects going SN)
+* and did not merge in common envelope
+* then system is still in binary
+ binstate = 0
+ mergertype = -1
+ elseif(com.and..not.coel.and.disrupt)then
+* if it went through common envelope
+* and did disrupt (from one of the objects going SN)
+* and did not merge in common envelope
+* then system should be marked as disrupted
+ binstate = 2
+ mergertype = -1
+ endif
if(binstate.eq.1.d0)then
sep = 0.d0
tb = 0.d0
@@ -2424,7 +2498,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
b02_bcm = B(2)
endif
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass1_bpp,mass2_bpp,
& kstar(1),kstar(2),sep,
& tb,ecc,rrl1,rrl2,
@@ -2435,7 +2509,9 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& menv(1),menv(2),renv(1),renv(2),
& ospin(1),ospin(2),b01_bcm,b02_bcm,
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin(1),bhspin(2))
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bpp')
*
epoch(j1) = tphys - aj(j1)
if(coel)then
@@ -2502,7 +2578,8 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
*
kst = 9
if(kstar(j2).eq.10) massc(j2) = dm2
- CALL gntage(massc(j2),mass(j2),kst,zpars,mass0(j2),aj(j2))
+ CALL gntage(massc(j2),mass(j2),kst,zpars,
+ & mass0(j2),aj(j2),j2)
kstar(j2) = kst
epoch(j2) = tphys - aj(j2)
elseif(kstar(j2).le.12)then
@@ -2636,7 +2713,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
formation(1) = 11
formation(2) = 11
endif
- CALL mix(mass0,mass,aj,kstar,zpars,bhspin)
+ CALL mix(mass0,mass,aj,kstar,zpars,bhspin,dtm)
dm1 = m1ce - mass(j1)
dm2 = mass(j2) - m2ce
*
@@ -2701,7 +2778,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
endif
rlperi = rol(k)*(1.d0-ecc)
dmr(k) = mlwind(kstar(k),lumin(k),radx(k),
- & mass(k),massc(k),rlperi,z)
+ & mass(k),massc(k),rlperi,z,k)
vwind2 = 2.d0*beta*acc1*mass(k)/radx(k)
omv2 = (1.d0 + vorb2/vwind2)**(3.d0/2.d0)
dmt(3-k) = ivsqm*acc2*dmr(k)*((acc1*mass(3-k)/vwind2)**2)
@@ -2738,7 +2815,12 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
* Take the stellar evolution timestep into account but don't let it
* be overly restrictive for long lived phases.
*
- if(iter.le.1000) dtm = MIN(dtm,dtmi(1),dtmi(2))
+
+* NOTE: This can cause NaN values! If you get NaNs, check what happens
+* when you increase `loop` (see PR #647) - TW
+*
+ if(iter.le.loop) dtm = MIN(dtm,dtmi(1),dtmi(2))
+
dtm = MIN(dtm,tsave-tphys)
dt = dtm*1.0d+06
km = dt/tb
@@ -2770,12 +2852,12 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
if(kstar(j2).le.2.or.kstar(j2).eq.4)then
- if(acc_lim.eq.-1.or.acc_lim.eq.-3)then
+ if(acc_lim(j2).eq.-1.or.acc_lim(j2).eq.-3)then
dm2 = MIN(1.d0,10.d0*taum/tkh(j2))*dm1
- elseif(acc_lim.eq.-2.or.acc_lim.eq.-4)then
+ elseif(acc_lim(j2).eq.-2.or.acc_lim(j2).eq.-4)then
dm2 = MIN(1.d0,taum/tkh(j2))*dm1
- elseif(acc_lim.ge.0.d0)then
- dm2 = acc_lim*dm1
+ elseif(acc_lim(j2).ge.0.d0)then
+ dm2 = acc_lim(j2)*dm1
endif
elseif(kstar(j2).ge.7.and.kstar(j2).le.9)then
*
@@ -2783,18 +2865,18 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
* or SAGB star unless the primary is also a helium star.
*
if(kstar(j1).ge.7)then
- if(acc_lim.eq.-1.or.acc_lim.eq.-3)then
+ if(acc_lim(j2).eq.-1.or.acc_lim(j2).eq.-3)then
dm2 = MIN(1.d0,10.d0*taum/tkh(j2))*dm1
- elseif(acc_lim.eq.-2.or.acc_lim.eq.-4)then
+ elseif(acc_lim(j2).eq.-2.or.acc_lim(j2).eq.-4)then
dm2 = MIN(1.d0,taum/tkh(j2))*dm1
- elseif(acc_lim.ge.0.d0)then
- dm2 = acc_lim*dm1
+ elseif(acc_lim(j2).ge.0.d0)then
+ dm2 = acc_lim(j2)*dm1
endif
else
- if(acc_lim.lt.0.d0)then
+ if(acc_lim(j2).lt.0.d0)then
dm2 = dm1
- elseif(acc_lim.ge.0.d0)then
- dm2 = acc_lim*dm1
+ elseif(acc_lim(j2).ge.0.d0)then
+ dm2 = acc_lim(j2)*dm1
endif
dmchk = dm2 - 1.05d0*dms(j2)
if(dmchk.gt.0.d0.and.dm2/mass(j2).gt.1.0d-04)then
@@ -2806,7 +2888,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
mcx = massc(j2)
endif
mt2 = mass(j2) + km*(dm2 - dms(j2))
- CALL gntage(mcx,mt2,kst,zpars,mass0(j2),aj(j2))
+ CALL gntage(mcx,mt2,kst,zpars,mass0(j2),aj(j2),j2)
epoch(j2) = tphys + dtm - aj(j2)
endif
endif
@@ -2821,32 +2903,32 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
* Accrete until a nova explosion blows away most of the accreted material.
*
novae = .true.
- if(acc_lim.lt.0.d0)then
+ if(acc_lim(j2).lt.0.d0)then
dm2 = MIN(dm1,dme)
if(dm2.lt.dm1) supedd = .true.
- elseif(acc_lim.ge.0.d0)then
- dm2 = MIN(dm2,acc_lim*dm1)
- if(dm2.lt.acc_lim*dm1) supedd = .true.
+ elseif(acc_lim(j2).ge.0.d0)then
+ dm2 = MIN(dm2,acc_lim(j2)*dm1)
+ if(dm2.lt.acc_lim(j2)*dm1) supedd = .true.
endif
dm22 = epsnov*dm2
else
*
* Steady burning at the surface
*
- if(acc_lim.lt.0.d0)then
+ if(acc_lim(j2).lt.0.d0)then
dm2 = dm1
- elseif(acc_lim.ge.0.d0)then
- dm2 = acc_lim*dm1
+ elseif(acc_lim(j2).ge.0.d0)then
+ dm2 = acc_lim(j2)*dm1
endif
endif
else
*
* Make a new giant envelope.
*
- if(acc_lim.lt.0.d0)then
+ if(acc_lim(j2).lt.0.d0)then
dm2 = dm1
- elseif(acc_lim.ge.0.d0)then
- dm2 = MIN(dm2,acc_lim*dm1)
+ elseif(acc_lim(j2).ge.0.d0)then
+ dm2 = MIN(dm2,acc_lim(j2)*dm1)
endif
*
* Check for planets or low-mass WDs.
@@ -2854,10 +2936,12 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
if((kstar(j2).eq.10.and.mass(j2).lt.0.05d0).or.
& (kstar(j2).ge.11.and.mass(j2).lt.0.5d0))then
kst = kstar(j2)
+ if (using_METISSE.eq.1) call set_star_type(j2)
else
kst = MIN(6,3*kstar(j2)-27)
mt2 = mass(j2) + km*(dm2 - dms(j2))
- CALL gntage(massc(j2),mt2,kst,zpars,mass0(j2),aj(j2))
+ CALL gntage(massc(j2),mt2,kst,zpars,
+ & mass0(j2),aj(j2),j2)
epoch(j2) = tphys + dtm - aj(j2)
*
endif
@@ -2866,14 +2950,14 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
elseif(kstar(j2).eq.3.or.kstar(j2).eq.5.or.kstar(j2).eq.6)then
* We have a giant w/ kstar(j2) = 3,5,6
*
- if(acc_lim.eq.-1.or.acc_lim.eq.-2)then
+ if(acc_lim(j2).eq.-1.or.acc_lim(j2).eq.-2)then
dm2 = dm1
- elseif(acc_lim.eq.-3)then
+ elseif(acc_lim(j2).eq.-3)then
dm2 = MIN(1.d0,10*taum/tkh(j2))*dm1
- elseif(acc_lim.eq.-4)then
+ elseif(acc_lim(j2).eq.-4)then
dm2 = MIN(1.d0,taum/tkh(j2))*dm1
- elseif(acc_lim.ge.0.d0)then
- dm2 = MIN(dm2,acc_lim*dm1)
+ elseif(acc_lim(j2).ge.0.d0)then
+ dm2 = MIN(dm2,acc_lim(j2)*dm1)
endif
endif
@@ -2882,7 +2966,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
* Impose the Eddington limit.
*
if(kstar(j2).ge.10)then
- if(acc_lim.lt.0.d0)then
+ if(acc_lim(j2).lt.0.d0)then
*
* If there is wind accretion the total amount of mass change is
* dms(j2) = dmr(j2) - dmt(j2), where dmt(j2) is the accretion
@@ -2896,20 +2980,20 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
*
if(supedd.eqv..true.) dm2 = 0.d0
if(dm2.lt.dm1) supedd = .true.
- elseif(acc_lim.ge.0.d0)then
+ elseif(acc_lim(j2).ge.0.d0)then
*
* If there is wind accretion the total amount of mass change is
* dms(j2) = dmr(j2) - dmt(j2), where dmt(j2) is the accretion
* from the companion. We should limit to the Eddington limit minus
* the amount of accretion that is already coming in from Winds
*
- dm2 = MIN(acc_lim*dm1,dme + dms(j2))
+ dm2 = MIN(acc_lim(j2)*dm1,dme + dms(j2))
*
* If we already hit supereddington wind accretion, don't add
* any more mass through RLO
*
if(supedd.eqv..true.) dm2 = 0.d0
- if(dm2.lt.acc_lim*dm1) supedd = .true.
+ if(dm2.lt.acc_lim(j2)*dm1) supedd = .true.
endif
*
@@ -2985,22 +3069,30 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& (mass(1)+mass(2))**2
djorb = djorb*dt
*
-* For super-Eddington mass transfer rates, for gamma = -2.0,
+* For super-Eddington mass transfer rates, for gamma == -2,
* and for novae systems, assume that material is lost from
* the system as if a wind from the secondary.
-* If gamma = -1.0 then assume the lost material carries with it
-* the specific angular momentum of the primary and for all
-* gamma > 0.0 assume that it takes away a fraction gamma of
-* the orbital angular momentum.
*
- if(supedd.or.novae.or.gamma.lt.-1.5d0)then
+ if(supedd.or.novae.or.int(gamma).eq.-2)then
djorb = djorb + (dm1 - dm22)*mass(j1)*mass(j1)/
& (mass(1)+mass(2))**2
- elseif(gamma.ge.0.d0)then
- djorb = djorb + gamma*(dm1 - dm2)
- else
+* If gamma == -3: Assume mass is lost through the outer
+* Lagrangian point, forming a circumbinary disk. See
+* Zapartas+17 Eq. 9 and Artymowicz & Lubow (1994).
+* Set rmin=2a, which is consistent with A&L94 simulations.
+ elseif(int(gamma).eq.-3)then
+ gammadisc = (mass(1) + mass(2))**2
+ & / (mass(1) * mass(2)) * sqrt(2.d0)
+ djorb = djorb + gammadisc * (dm1 - dm2)
+* If gamma == -1 then assume the lost material carries with it
+* the specific angular momentum of the primary and for all
+ elseif(int(gamma).eq.-1) then
djorb = djorb + (dm1 - dm2)*mass(j2)*mass(j2)/
& (mass(1)+mass(2))**2
+* gamma > 0.0 assume that it takes away a fraction gamma of
+* the orbital angular momentum.
+ elseif(gamma.ge.0.d0)then
+ djorb = djorb + gamma*(dm1 - dm2)
endif
*
ecc2 = ecc*ecc
@@ -3372,7 +3464,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
m0 = mass0(j1)
mass0(j1) = mass(j1)
CALL star(kstar(j1),mass0(j1),mass(j1),tmsnew,tn,tscls,
- & lums,GB,zpars)
+ & lums,GB,zpars,dtm,j1)
if(GB(9).lt.massc(j1))then
mass0(j1) = m0
endif
@@ -3381,7 +3473,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
m0 = mass0(j2)
mass0(j2) = mass(j2)
CALL star(kstar(j2),mass0(j2),mass(j2),tmsnew,tn,tscls,
- & lums,GB,zpars)
+ & lums,GB,zpars,dtm,j2)
if(GB(9).lt.massc(j2))then
mass0(j2) = m0
endif
@@ -3415,10 +3507,10 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
*
if(kstar(j1).le.2.or.kstar(j1).eq.7)then
CALL star(kstar(j1),mass0(j1),mass(j1),tmsnew,tn,tscls,
- & lums,GB,zpars)
+ & lums,GB,zpars,dtm,j1)
if(kstar(j1).eq.2)then
- aj(j1) = tmsnew + (tscls(1) - tmsnew)*(aj(j1)-tms(j1))/
- & (tbgb(j1) - tms(j1))
+ if (using_SSE.eq.1) aj(j1) = tmsnew + (tscls(1) - tmsnew)*
+ & (aj(j1)-tms(j1))/(tbgb(j1) - tms(j1))
else
aj(j1) = tmsnew/tms(j1)*aj(j1)
endif
@@ -3427,10 +3519,10 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
*
if(kstar(j2).le.2.or.kstar(j2).eq.7)then
CALL star(kstar(j2),mass0(j2),mass(j2),tmsnew,tn,tscls,
- & lums,GB,zpars)
+ & lums,GB,zpars,dtm,j2)
if(kstar(j2).eq.2)then
- aj(j2) = tmsnew + (tscls(1) - tmsnew)*(aj(j2)-tms(j2))/
- & (tbgb(j2) - tms(j2))
+ if (using_SSE.eq.1) aj(j2) = tmsnew + (tscls(1) - tmsnew)*
+ & (aj(j2)-tms(j2))/(tbgb(j2) - tms(j2))
elseif((mass(j2).lt.0.35d0.or.mass(j2).gt.1.25d0).
& and.kstar(j2).ne.7)then
aj(j2) = tmsnew/tms(j2)*aj(j2)*(mass(j2) - dm22)/mass(j2)
@@ -3458,7 +3550,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
* goto 140
endif
kw = kstar(k)
- CALL star(kw,m0,mt,tm,tn,tscls,lums,GB,zpars)
+ CALL star(kw,m0,mt,tm,tn,tscls,lums,GB,zpars,dtm,k)
CALL hrdiag(m0,age,mt,tm,tn,tscls,lums,GB,zpars,
& rm,lum,kw,mc,rc,me,re,k2,bhspin(k),k)
*
@@ -3525,7 +3617,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
else
b02_bcm = B(2)
endif
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass(1),mass(2),kstar(1),kstar(2),
& sep,tb,ecc,rrl1,rrl2,
& aj(1),aj(2),tms(1),tms(2),
@@ -3535,7 +3627,9 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& menv(1),menv(2),renv(1),renv(2),
& ospin(1),ospin(2),b01_bcm,b02_bcm,
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin(1),bhspin(2))
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bpp')
CALL kick(kw,mass(k),mt,mass(3-k),ecc,sep,jorb,vk,k,
& rad(3-k),fallback,sigmahold,kick_info,disrupt,bkick)
sigma = sigmahold !reset sigma after possible ECSN kick dist. Remove this if u want some kick link to the intial pulsar values...
@@ -3578,7 +3672,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
* Determine stellar evolution timescale for nuclear burning types.
*
if(kw.le.9)then
- CALL deltat(kw,age,tm,tn,tscls,dt,dtr)
+ CALL deltat(kw,age,tm,tn,tscls,dt,dtr,k)
dtmi(k) = MIN(dt,dtr)
* dtmi(k) = dtr
dtmi(k) = MAX(1.0d-07,dtmi(k))
@@ -3664,14 +3758,20 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
* Check if PISN occurred, and if so overwrite formation
if(pisn_track(1).ne.0) formation(1) = pisn_track(1)
if(pisn_track(2).ne.0) formation(2) = pisn_track(2)
- CALL writebcm(ip,tphys,kstar(1),mass0(1),mass(1),
- & lumin(1),rad(1),teff1,massc(1),
- & radc(1),menv(1),renv(1),epoch(1),
- & ospin(1),deltam1_bcm,rrl1,kstar(2),mass0(2),
- & mass(2),lumin(2),rad(2),teff2,massc(2),
- & radc(2),menv(2),renv(2),epoch(2),ospin(2),
- & deltam2_bcm,rrl2,tb,sep,ecc,b01_bcm,b02_bcm,
- & formation(1),formation(2),binstate,mergertype)
+ CALL writetab(ip,tphys,evolve_type,
+ & mass(1),mass(2),kstar(1),kstar(2),
+ & sep,tb,ecc,rrl1,rrl2,
+ & aj(1),aj(2),tms(1),tms(2),
+ & massc(1),massc(2),rad(1),rad(2),
+ & mass0(1),mass0(2),lumin(1),lumin(2),
+ & teff1,teff2,radc(1),radc(2),
+ & menv(1),menv(2),renv(1),renv(2),
+ & ospin(1),ospin(2),b01_bcm,b02_bcm,
+ & bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bcm')
+ if (bcm_err) goto 150
if(isave) tsave = tsave + dtp
if(output) write(*,*)'bcm3:',kstar(1),kstar(2),mass(1),
& mass(2),rad(1),rad(2),ospin(1),ospin(2),jspin(1)
@@ -3704,7 +3804,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
b02_bcm = B(2)
endif
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass(1),mass(2),kstar(1),kstar(2),
& sep,tb,ecc,rrl1,rrl2,
& aj(1),aj(2),tms(1),tms(2),
@@ -3714,7 +3814,9 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& menv(1),menv(2),renv(1),renv(2),
& ospin(1),ospin(2),b01_bcm,b02_bcm,
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin(1),bhspin(2))
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bpp')
endif
*
@@ -3750,7 +3852,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
b02_bcm = B(2)
endif
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass(1),mass(2),kstar(1),kstar(2),sep,
& tb,ecc,rrl1,rrl2,
& aj(1),aj(2),tms(1),tms(2),
@@ -3760,7 +3862,9 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& menv(1),menv(2),renv(1),renv(2),
& ospin(1),ospin(2),b01_bcm,b02_bcm,
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin(1),bhspin(2))
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bpp')
dtm = 0.d0
goto 4
endif
@@ -3799,7 +3903,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
else
b02_bcm = B(2)
endif
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass(1),mass(2),kstar(1),kstar(2),sep,
& tb,ecc,rrl1,rrl2,
& aj(1),aj(2),tms(1),tms(2),
@@ -3809,7 +3913,9 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& menv(1),menv(2),renv(1),renv(2),
& ospin(1),ospin(2),b01_bcm,b02_bcm,
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin(1),bhspin(2))
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bpp')
*
kcomp1 = kstar(j1)
kcomp2 = kstar(j2)
@@ -3843,7 +3949,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
b02_bcm = B(2)
endif
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass(1),mass(2),
& kstar(1),kstar(2),sep,
& tb,ecc,rrl1,rrl2,
@@ -3854,14 +3960,17 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& menv(1),menv(2),renv(1),renv(2),
& ospin(1),ospin(2),b01_bcm,b02_bcm,
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin(1),bhspin(2))
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bpp')
CALL comenv(mass0(j1),mass(j1),massc(j1),aj(j1),jspin(j1),
& kstar(j1),mass0(j2),mass(j2),massc(j2),aj(j2),
& jspin(j2),kstar(j2),zpars,ecc,sep,jorb,coel,j1,j2,
& vk,kick_info,formation(j1),formation(j2),sigmahold,
& bhspin(j1),bhspin(j2),binstate,mergertype,
& jp,tphys,switchedCE,rad,tms,evolve_type,disrupt,
- & lumin,B_0,bacc,tacc,epoch,menv,renv,bkick)
+ & lumin,B_0,bacc,tacc,epoch,menv,renv,bkick,
+ & deltam1_bcm,deltam2_bcm,dtm)
if(output) write(*,*)'coal1:',tphys,kstar(j1),kstar(j2),coel,
& mass(j1),mass(j2)
if(j1.eq.2.and.kcomp2.eq.13.and.kstar(j2).eq.15.and.
@@ -3924,7 +4033,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
b02_bcm = B(2)
endif
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass(1),mass(2),
& kstar(1),kstar(2),sep,
& tb,ecc,rrl1,rrl2,
@@ -3935,14 +4044,17 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& menv(1),menv(2),renv(1),renv(2),
& ospin(1),ospin(2),b01_bcm,b02_bcm,
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin(1),bhspin(2))
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bpp')
CALL comenv(mass0(j2),mass(j2),massc(j2),aj(j2),jspin(j2),
& kstar(j2),mass0(j1),mass(j1),massc(j1),aj(j1),
& jspin(j1),kstar(j1),zpars,ecc,sep,jorb,coel,j2,j1,
& vk,kick_info,formation(j2),formation(j1),sigmahold,
& bhspin(j2),bhspin(j1),binstate,mergertype,
& jp,tphys,switchedCE,rad,tms,evolve_type,disrupt,
- & lumin,B_0,bacc,tacc,epoch,menv,renv,bkick)
+ & lumin,B_0,bacc,tacc,epoch,menv,renv,bkick,
+ & deltam1_bcm,deltam2_bcm,dtm)
if(output) write(*,*)'coal2:',tphys,kstar(j1),kstar(j2),coel,
& mass(j1),mass(j2)
if(j2.eq.2.and.kcomp1.eq.13.and.kstar(j1).eq.15.and.
@@ -3980,7 +4092,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
tb = -1.d0
endif
else
- CALL mix(mass0,mass,aj,kstar,zpars,bhspin)
+ CALL mix(mass0,mass,aj,kstar,zpars,bhspin,dtm)
endif
if(com)then
@@ -4010,7 +4122,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
b02_bcm = B(2)
endif
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass1_bpp,mass2_bpp,
& kstar(1),kstar(2),sep,
& tb,ecc,rrl1,rrl2,
@@ -4021,7 +4133,9 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& menv(1),menv(2),renv(1),renv(2),
& ospin(1),ospin(2),b01_bcm,b02_bcm,
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin(1),bhspin(2))
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bpp')
endif
epoch(1) = tphys - aj(1)
epoch(2) = tphys - aj(2)
@@ -4066,7 +4180,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
b02_bcm = B(2)
endif
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass(1),mass(2),kstar(1),kstar(2),sep,
& tb,ecc,rrl1,rrl2,
& aj(1),aj(2),tms(1),tms(2),
@@ -4076,7 +4190,9 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& menv(1),menv(2),renv(1),renv(2),
& ospin(1),ospin(2),b01_bcm,b02_bcm,
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin(1),bhspin(2))
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bpp')
dtm = 0.d0
*
* Reset orbital parameters as separation may have changed.
@@ -4136,7 +4252,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
else
b02_bcm = B(2)
endif
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass1_bpp,mass2_bpp,
& kstar(1),kstar(2),0.d0,
& 0.d0,-1.d0,0.d0,ngtv,
@@ -4147,7 +4263,9 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& menv(1),menv(2),renv(1),renv(2),
& ospin(1),ospin(2),b01_bcm,b02_bcm,
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin(1),bhspin(2))
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bpp')
elseif(ecc.gt.1.d0)then
*
* Binary dissolved by a supernova or tides.
@@ -4176,7 +4294,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
else
b02_bcm = B(2)
endif
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass1_bpp,mass2_bpp,
& kstar(1),kstar(2),sep,
& tb,ecc,0.d0,ngtv2,
@@ -4187,7 +4305,9 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& menv(1),menv(2),renv(1),renv(2),
& ospin(1),ospin(2),b01_bcm,b02_bcm,
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin(1),bhspin(2))
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bpp')
else
evolve_type = 9.0
teff1 = 1000.d0*((1130.d0*lumin(1)/
@@ -4208,7 +4328,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
else
b02_bcm = B(2)
endif
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass1_bpp,mass2_bpp,
& kstar(1),kstar(2),0.d0,
& 0.d0,0.d0,0.d0,ngtv,
@@ -4219,17 +4339,27 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& menv(1),menv(2),renv(1),renv(2),
& ospin(1),ospin(2),b01_bcm,b02_bcm,
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin(1),bhspin(2))
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bpp')
endif
endif
if(kstar(2).eq.15)then
kmax = 1
rol(2) = -1.d0*rad(2)
dtmi(2) = tphysf
+ CALL hrdiag(mass0(2),aj(2),mass(2),tms(2),tn,tscls,lums,GB,
+ & zpars,rad(2),lumin(2),kstar(2),massc(2),radc(2),
+ & menv(2),renv(2),k2str(2),bhspin(2),2)
+
+
elseif(kstar(1).eq.15)then
kmin = 2
rol(1) = -1.d0*rad(1)
dtmi(1) = tphysf
+ CALL hrdiag(mass0(1),aj(1),mass(1),tms(1),tn,tscls,lums,GB,
+ & zpars,rad(1),lumin(1),kstar(1),massc(1),radc(1),
+ & menv(1),renv(1),k2str(1),bhspin(1),1)
endif
* Makes sure coalesced NSs are reset. PK.
if(kstar(1).eq.13.and.ecc.le.1.d0.and.pulsar.gt.0.and.
@@ -4289,7 +4419,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
b02_bcm = B(2)
endif
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass(1),mass(2),kstar(1),kstar(2),sep,
& tb,ecc,rrl1,rrl2,
& aj(1),aj(2),tms(1),tms(2),
@@ -4299,7 +4429,9 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& menv(1),menv(2),renv(1),renv(2),
& ospin(1),ospin(2),b01_bcm,b02_bcm,
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin(1),bhspin(2))
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bpp')
endif
* if(kstar(1).eq.15.and.bpp(jp,4).lt.15.0)then
@@ -4330,7 +4462,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
else
b02_bcm = B(2)
endif
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass1_bpp,mass2_bpp,
& kstar(1),kstar(2),0.d0,
& 0.d0,-1.d0,0.d0,ngtv,
@@ -4341,7 +4473,9 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& menv(1),menv(2),renv(1),renv(2),
& ospin(1),ospin(2),b01_bcm,b02_bcm,
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin(1),bhspin(2))
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bpp')
elseif(kstar(1).eq.15.and.kstar(2).eq.15)then
*
* Cases of accretion induced supernova or single star supernova.
@@ -4366,7 +4500,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
else
b02_bcm = B(2)
endif
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass1_bpp,mass2_bpp,
& kstar(1),kstar(2),0.d0,
& 0.d0,0.d0,0.d0,ngtv2,
@@ -4377,11 +4511,17 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& menv(1),menv(2),renv(1),renv(2),
& ospin(1),ospin(2),b01_bcm,b02_bcm,
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin(1),bhspin(2))
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bpp')
else
evolve_type = 10.0
!added by PA for systems that stop evolving halfway
if(iter.ge.loop) evolve_type = 100.0
+ if (using_METISSE.eq.1) then
+ call check_error(err)
+ if (err>0) evolve_type = 101.0
+ end if
rrl1 = rad(1)/rol(1)
rrl2 = rad(2)/rol(2)
teff1 = 1000.d0*((1130.d0*lumin(1)/
@@ -4402,7 +4542,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
else
b02_bcm = B(2)
endif
- CALL writebpp(jp,tphys,evolve_type,
+ CALL writetab(jp,tphys,evolve_type,
& mass1_bpp,mass2_bpp,
& kstar(1),kstar(2),sep,
& tb,ecc,rrl1,rrl2,
@@ -4413,7 +4553,9 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
& menv(1),menv(2),renv(1),renv(2),
& ospin(1),ospin(2),b01_bcm,b02_bcm,
& bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
- & epoch(2),bhspin(1),bhspin(2))
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bpp')
endif
endif
*
@@ -4462,14 +4604,21 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
* Check if PISN occurred, and if so overwrite formation
if(pisn_track(1).ne.0) formation(1) = pisn_track(1)
if(pisn_track(2).ne.0) formation(2) = pisn_track(2)
- CALL writebcm(ip,tphys,kstar(1),mass0(1),mass(1),
- & lumin(1),rad(1),teff1,massc(1),
- & radc(1),menv(1),renv(1),epoch(1),
- & ospin(1),deltam1_bcm,rrl1,kstar(2),mass0(2),
- & mass(2),lumin(2),rad(2),teff2,massc(2),
- & radc(2),menv(2),renv(2),epoch(2),ospin(2),
- & deltam2_bcm,rrl2,tb,sep,ecc,b01_bcm,b02_bcm,
- & formation(1),formation(2),binstate,mergertype)
+ CALL writetab(ip,tphys,evolve_type,
+ & mass(1),mass(2),kstar(1),kstar(2),
+ & sep,tb,ecc,rrl1,rrl2,
+ & aj(1),aj(2),tms(1),tms(2),
+ & massc(1),massc(2),rad(1),rad(2),
+ & mass0(1),mass0(2),lumin(1),lumin(2),
+ & teff1,teff2,radc(1),radc(2),
+ & menv(1),menv(2),renv(1),renv(2),
+ & ospin(1),ospin(2),b01_bcm,b02_bcm,
+ & bacc(1),bacc(2),tacc(1),tacc(2),epoch(1),
+ & epoch(2),bhspin(1),bhspin(2),
+ & deltam1_bcm,deltam2_bcm,formation(1),
+ & formation(2),binstate,mergertype,'bcm')
+ if (bcm_err) goto 150
+
if(output) write(*,*)'bcm4:',kstar(1),kstar(2),mass(1),
& mass(2),rad(1),rad(2),ospin(1),ospin(2),jspin(1),
& tphys,tphysf
@@ -4487,6 +4636,8 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
evolve_type = 10.0
goto 135
endif
+ 150 continue
+
tphysfhold = tphysf
tphysf = tphys
if(sgl)then
@@ -4501,6 +4652,8 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
* STOP
elseif(jp.ge.40)then
WRITE(99,*)' EVOLV2 ARRAY WARNING ',mass1i,mass2i,tbi,ecci,jp
+ elseif (IP+1>SIZE(BCM,1)) then
+ WRITE(99,*)'IP>SIZE(BCM)',IP, size(bcm,1)
endif
if(iter.ge.loop)then
WRITE(99,*)'ITER>=LOOP:',jp,tphys,tphysfhold,dtp,kstar,age,kst,
@@ -4508,6 +4661,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
* CALL exit(0)
* STOP
endif
+
bcm(ip+1,1) = -1.0
bpp(jp+1,1) = -1.0
@@ -4516,6 +4670,8 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
bpp_index_out = jp
kick_info_out = kick_info
endif
+ if (using_METISSE.eq.1) call dealloc_track()
+
*
END SUBROUTINE evolv2
diff --git a/src/cosmic/src/bse.f b/src/cosmic/src/extra/bse.f
similarity index 100%
rename from src/cosmic/src/bse.f
rename to src/cosmic/src/extra/bse.f
diff --git a/src/cosmic/src/evolv1.f b/src/cosmic/src/extra/evolv1.f
similarity index 100%
rename from src/cosmic/src/evolv1.f
rename to src/cosmic/src/extra/evolv1.f
diff --git a/src/cosmic/src/sse.f b/src/cosmic/src/extra/sse.f
similarity index 100%
rename from src/cosmic/src/sse.f
rename to src/cosmic/src/extra/sse.f
diff --git a/src/cosmic/src/gntage.f b/src/cosmic/src/gntage.f
index f5c6609e4..aac109066 100644
--- a/src/cosmic/src/gntage.f
+++ b/src/cosmic/src/gntage.f
@@ -1,300 +1,17 @@
-***
- SUBROUTINE gntage(mc,mt,kw,zpars,m0,aj)
+ SUBROUTINE gntage(mc,mt,kw,zpars,m0,aj,id)
IMPLICIT NONE
INCLUDE 'const_bse.h'
-*
-* A routine to determine the age of a giant from its core mass and type.
-*
-* Author : C. A. Tout
-* Date : 24th September 1996
-* Revised: 21st February 1997 to include core-helium-burning stars
-*
-* Rewritten: 2nd January 1998 by J. R. Hurley to be compatible with
-* the new evolution routines and to include new stellar
-* types.
-*
-*
- integer kw
- integer j,jmax
- parameter(jmax=30)
-*
- real*8 mc,mt,m0,aj,tm,tn
- real*8 tscls(20),lums(10),GB(10),zpars(20)
- real*8 mmin,mmax,mmid,dm,f,fmid,dell,derl,lum
- real*8 macc,lacc,tiny
- parameter(macc=0.00001d0,lacc=0.0001d0,tiny=1.0d-14)
- real*8 mcx,mcy
-*
- real*8 mcheif,mcagbf,mheif,mbagbf,mcgbf,lmcgbf,lbgbf,lbgbdf
- external mcheif,mcagbf,mheif,mbagbf,mcgbf,lmcgbf,lbgbf,lbgbdf
-*
-* This should only be entered with KW = 3, 4, 5, 6 or 9
-*
-* First we check that we don't have a CheB star
-* with too small a core mass.
- if(kw.eq.4)then
-* Set the minimum CHeB core mass using M = Mflash
- mcy = mcheif(zpars(2),zpars(2),zpars(10))
- if(mc.le.mcy) kw = 3
-* if(mc.le.mcy) WRITE(66,*)' GNTAGE4: changed to 3'
- endif
-*
-* Next we check that we don't have a GB star for M => Mfgb
- if(kw.eq.3)then
-* Set the maximum GB core mass using M = Mfgb
- mcy = mcheif(zpars(3),zpars(2),zpars(9))
- if(mc.ge.mcy)then
- kw = 4
- aj = 0.d0
-* WRITE(66,*)' GNTAGE3: changed to 4'
- endif
- endif
-*
- if(kw.eq.6)then
-*
-* We try to start the star from the start of the SAGB by
-* setting Mc = Mc,TP.
-*
- mcy = 0.44d0*2.25d0 + 0.448d0
- if(mc.gt.mcy)then
-* A type 6 with this sized core mass cannot exist as it should
-* already have become a NS or BH as a type 5.
-* We set it up so that it will.
- mcx = (mc + 0.35d0)/0.773d0
- elseif(mc.ge.0.8d0)then
- mcx = (mc - 0.448d0)/0.44d0
- else
- mcx = mc
- endif
- m0 = mbagbf(mcx)
- if(m0.lt.tiny)then
-* Carbon core mass is less then the minimum for the start of SAGB.
-* This must be the case of a low-mass C/O or O/Ne WD with only a
-* very small envelope added or possibly the merger of a helium star
-* with a main sequence star. We will set m0 = mt and then reset the
-* core mass to allow for some helium to be added to the C/O core.
- kw = 14
-* WRITE(66,*)' GNTAGE6: changed to 4'
- else
- CALL star(kw,m0,mt,tm,tn,tscls,lums,GB,zpars)
- aj = tscls(13) + 2.d0*tiny
- endif
- endif
-*
- if(kw.eq.5)then
-*
-* We fit a Helium core mass at the base of the AGB.
-*
- m0 = mbagbf(mc)
- if(m0.lt.tiny)then
-* Helium core mass is less then the BAGB minimum.
- kw = 14
-* WRITE(66,*)' GNTAGE5: changed to 4'
- else
- CALL star(kw,m0,mt,tm,tn,tscls,lums,GB,zpars)
- aj = tscls(2) + tscls(3) + 2.d0*tiny
- endif
- endif
-*
-*
- if(kw.eq.4)then
-*
-* The supplied age is actually the fractional age, fage, of CHeB lifetime
-* that has been completed, ie. 0 <= aj <= 1.
-*
- if(aj.lt.0.d0.or.aj.gt.1.d0)then
-* WRITE(99,*)' FATAL ERROR! GNTAGE4: fage out of bounds '
-* WRITE(99,*)' FAGE ',aj
-* WRITE(*,*)' STOP: FATAL ERROR '
-* CALL exit(0)
-* STOP
- aj = 0.d0
- endif
-* Get the minimum, fage=1, and maximum, fage=0, allowable masses
- mcy = mcagbf(zpars(2))
- if(mc.ge.mcy)then
- mmin = mbagbf(mc)
- else
- mmin = zpars(2)
- endif
- mmax = mheif(mc,zpars(2),zpars(10))
- if(aj.lt.tiny)then
- m0 = mmax
- goto 20
- elseif(aj.ge.1.d0)then
- m0 = mmin
- goto 20
- endif
-* Use the bisection method to find m0
- fmid = (1.d0-aj)*mcheif(mmax,zpars(2),zpars(10)) +
- & aj*mcagbf(mmax) - mc
- f = (1.d0-aj)*mcheif(mmin,zpars(2),zpars(10)) +
- & aj*mcagbf(mmin) - mc
- if(f*fmid.ge.0.d0)then
-* This will probably occur if mc is just greater than the minimum
-* allowed mass for a CHeB star and fage > 0.
- kw = 3
-* WRITE(66,*)' GNTAGE4: changed to 3'
- goto 90
- endif
- m0 = mmin
- dm = mmax - mmin
- do 10 , j = 1,jmax
- dm = 0.5d0*dm
- mmid = m0 + dm
- fmid = (1.d0-aj)*mcheif(mmid,zpars(2),zpars(10)) +
- & aj*mcagbf(mmid) - mc
- if(fmid.lt.0.d0) m0 = mmid
- if(ABS(dm).lt.macc.or.ABS(fmid).lt.tiny) goto 20
- if(j.eq.jmax)then
-* WRITE(99,*)' FATAL ERROR! GNTAGE4: root not found '
-* WRITE(*,*)' STOP: FATAL ERROR '
-* CALL exit(0)
-* STOP
- m0 = mt
- aj = 0.d0
- endif
- 10 continue
- 20 continue
-*
- CALL star(kw,m0,mt,tm,tn,tscls,lums,GB,zpars)
- aj = tscls(2) + aj*tscls(3)
-*
- endif
-*
- 90 continue
-*
- if(kw.eq.3)then
-*
-* First we double check that we don't have a GB star for M => Mfgb
- mcy = mcheif(zpars(3),zpars(2),zpars(9))
- if(mc.ge.mcy)then
-* WRITE(99,*)' GNTAGE3: star too big for GB '
-* WRITE(*,*)' STOP: FATAL ERROR '
-* CALL exit(0)
-* STOP
- mc = 0.99d0*mcy
- endif
-* Next we find an m0 so as to place the star at the BGB
- mcx = mcheif(zpars(2),zpars(2),zpars(9))
- if(mc.gt.mcx)then
- m0 = mheif(mc,zpars(2),zpars(9))
- else
-* Use Newton-Raphson to find m0 from Lbgb
- m0 = zpars(2)
- CALL star(kw,m0,mt,tm,tn,tscls,lums,GB,zpars)
- lum = lmcgbf(mc,GB)
- j = 0
- 30 continue
- dell = lbgbf(m0) - lum
- if(ABS(dell/lum).le.lacc) goto 40
- derl = lbgbdf(m0)
- m0 = m0 - dell/derl
- j = j + 1
- if(j.eq.jmax)then
-* WRITE(99,*)' FATAL ERROR! GNTAGE3: root not found '
-* WRITE(*,*)' STOP: FATAL ERROR '
-* CALL exit(0)
-* STOP
- m0 = zpars(2)
- m0 = MAX(m0,mt)
- goto 40
- endif
- goto 30
- 40 continue
- endif
- CALL star(kw,m0,mt,tm,tn,tscls,lums,GB,zpars)
- aj = tscls(1) + 1.0d-06*(tscls(2) - tscls(1))
-*
- endif
-*
- if(kw.eq.8.or.kw.eq.9)then
-*
-* We make a post-MS naked helium star.
-* To make things easier we put the star at the TMS point
-* so it actually begins as type 8.
-*
- kw = 8
- mmin = mc
- CALL star(kw,mmin,mc,tm,tn,tscls,lums,GB,zpars)
- mcx = mcgbf(lums(2),GB,lums(6))
- if(mcx.ge.mc)then
-* WRITE(99,*)' FATAL ERROR! GNTAGE9: mmin too big '
-* WRITE(*,*)' STOP: FATAL ERROR '
-* CALL exit(0)
-* STOP
- m0 = mt
- goto 80
- endif
- f = mcx - mc
- mmax = mt
- do 50 , j = 1,jmax
- CALL star(kw,mmax,mc,tm,tn,tscls,lums,GB,zpars)
- mcy = mcgbf(lums(2),GB,lums(6))
- if(mcy.gt.mc) goto 60
- mmax = 2.d0*mmax
- if(j.eq.jmax)then
-* WRITE(99,*)' FATAL ERROR! GNTAGE9: mmax not found '
-* WRITE(*,*)' STOP: FATAL ERROR '
-* CALL exit(0)
-* STOP
- m0 = mt
- goto 80
- endif
- 50 continue
- 60 continue
- fmid = mcy - mc
-* Use the bisection method to find m0
- if(f*fmid.ge.0.d0)then
-* WRITE(99,*)' FATAL ERROR! GNTAGE9: root not bracketed '
-* WRITE(*,*)' STOP: FATAL ERROR '
-* CALL exit(0)
-* STOP
- m0 = mt
- goto 80
- endif
- m0 = mmin
- dm = mmax - mmin
- do 70 , j = 1,jmax
- dm = 0.5d0*dm
- mmid = m0 + dm
- CALL star(kw,mmid,mc,tm,tn,tscls,lums,GB,zpars)
- mcy = mcgbf(lums(2),GB,lums(6))
- fmid = mcy - mc
- if(fmid.lt.0.d0) m0 = mmid
- if(ABS(dm).lt.macc.or.ABS(fmid).lt.tiny) goto 80
- if(j.eq.jmax)then
-* WRITE(99,*)' FATAL ERROR! GNTAGE9: root not found '
-* WRITE(*,*)' STOP: FATAL ERROR '
-* CALL exit(0)
-* STOP
- m0 = mt
- goto 80
- endif
- 70 continue
- 80 continue
-*
- CALL star(kw,m0,mt,tm,tn,tscls,lums,GB,zpars)
- aj = tm + 1.0d-10*tm
-*
- endif
-*
- if(kw.eq.14)then
-*
- kw = 4
- m0 = mt
- mcy = mcagbf(m0)
- aj = mc/mcy
- CALL star(kw,m0,mt,tm,tn,tscls,lums,GB,zpars)
- if(m0.le.zpars(2))then
- mcx = mcgbf(lums(4),GB,lums(6))
- else
- mcx = mcheif(m0,zpars(2),zpars(10))
- end if
- mc = mcx + (mcy - mcx)*aj
- aj = tscls(2) + aj*tscls(3)
- endif
-*
- RETURN
+
+ real*8 mc,mt,zpars,m0,aj
+ integer kw ,id
+
+ if (using_METISSE.eq.1) then
+ !WRITE(*,*) 'Calling METISSE_gntage'
+ CALL METISSE_gntage(mc,mt,kw,zpars,m0,aj,id)
+
+ elseif (using_SSE.eq.1) then
+ !WRITE(*,*) 'Calling SSE_gntage'
+ CALL SSE_gntage(mc,mt,kw,zpars,m0,aj,id)
+ endif
+
END
-***
diff --git a/src/cosmic/src/hrdiag.f b/src/cosmic/src/hrdiag.f
index e554ef695..02d437ec1 100644
--- a/src/cosmic/src/hrdiag.f
+++ b/src/cosmic/src/hrdiag.f
@@ -1,615 +1,28 @@
-***
SUBROUTINE hrdiag(mass,aj,mt,tm,tn,tscls,lums,GB,zpars,
& r,lum,kw,mc,rc,menv,renv,k2,
- & bhspin,kidx)
+ & bhspin,id)
IMPLICIT NONE
INCLUDE 'const_bse.h'
+
+ integer kw,id
*
-*
-* H-R diagram for population I stars.
-* -----------------------------------
-*
-* Computes the new mass, luminosity, radius & stellar type.
-* Input (MASS, AJ, TM, TN, LUMS & TSCLS) supplied by routine STAR.
-* Ref: P.P. Eggleton, M.J. Fitchett & C.A. Tout (1989) Ap.J. 347, 998.
-*
-* Revised 27th March 1995 by C. A. Tout;
-* 24th October 1995 to include metallicity;
-* 14th November 1996 to include naked helium stars;
-* 28th February 1997 to allow accretion induced supernovae.
-*
-* Revised 5th April 1997 by J. R. Hurley
-* to include Z=0.001 as well as Z=0.02, convective overshooting,
-* MS hook and more elaborate CHeB
-*
-*
- integer kw,kwp,kidx
-*
- real*8 mass,aj,mt,tm,tn,tscls(20),lums(10),GB(10),zpars(20),met
+ real*8 mass,aj,mt,tm,tn,tscls(20),lums(10),GB(10),zpars(20)
real*8 bhspin
- real*8 r,lum,mc,rc,menv,renv,k2
- real*8 mch,mlp,tiny
-* parameter(mch=1.44d0,mlp=12.d0,tiny=1.0d-14)
- parameter(mlp=12.d0,tiny=1.0d-14)
- real*8 mass0,mt0,mtc
- common /fall/fallback
- REAL*8 fallback
- REAL ran3
- EXTERNAL ran3
-*
-* real*8 mchold
-*
-* real*8 avar,bvar
- real*8 thook,thg,tbagb,tau,tloop,taul,tauh,tau1,tau2,dtau,texp
- real*8 lx,ly,dell,alpha,betahrdiag,eta
- real*8 rx,ry,delr,rzams,rtms,gammahrdiag,rmin,taumin,rg
- parameter(taumin=5.0d-08)
- real*8 mcmax,mcx,mcy,mcbagb,lambdahrdiag
-* real*8 frac,kappa,sappa,alphap,polyfit
- real*8 am,xx,fac,rdgen,mew,lum0,kap,zeta,ahe,aco
- parameter(lum0=7.0d+04,kap=-0.5d0,ahe=4.d0,aco=16.d0)
-*
- real*8 thookf,tblf
- real*8 lalphf,lbetaf,lnetaf,lhookf,lgbtf,lmcgbf,lzhef,lpertf
- real*8 rzamsf,rtmsf,ralphf,rbetaf,rgammf,rhookf
- real*8 rgbf,rminf,ragbf,rzahbf,rzhef,rhehgf,rhegbf,rpertf
- real*8 mctmsf,mcgbtf,mcgbf,mcheif,mcagbf,lzahbf
-* real*8 mrem
- external thookf,tblf
- external lalphf,lbetaf,lnetaf,lhookf,lgbtf,lmcgbf,lzhef,lpertf
- external rzamsf,rtmsf,ralphf,rbetaf,rgammf,rhookf
- external rgbf,rminf,ragbf,rzahbf,rzhef,rhehgf,rhegbf,rpertf
- external mctmsf,mcgbtf,mcgbf,mcheif,mcagbf,lzahbf
-*
-*
-* ---------------------------------------------------------------------
-* MASS Stellar mass in solar units (input: old; output: new value).
-* AJ Current age in Myr.
-* MT Current mass in solar units (used for R).
-* TM Main sequence time.
-* TN Nuclear burning time.
-* TSCLS Time scale for different stages.
-* LUMS Characteristic luminosity.
-* GB Giant Branch parameters
-* ZPARS Parameters for distinguishing various mass intervals.
-* R Stellar radius in solar units.
-* TE Effective temperature (suppressed).
-* KW Classification type (0 - 15).
-* MC Core mass.
-* ---------------------------------------------------------------------
-*
-*
-* Make evolutionary changes to stars that have not reached KW > 5.
-*
- mch = 1.44d0 !set here owing to AIC ECSN model.
-*
- mass0 = mass
-C if(mass0.gt.100.d0) mass = 100.d0
- mt0 = mt
-C if(mt0.gt.100.d0) mt = 100.d0
-*
- if(kw.gt.6) goto 90
-*
- tbagb = tscls(2) + tscls(3)
- thg = tscls(1) - tm
-*
- rzams = rzamsf(mass)
-* calculate metallicity using the zpars(14) parameter.
- met = 10**(LOG10(zpars(14))/0.4)
- rtms = rtmsf(mass, met)
-*
- if(aj.lt.tscls(1))then
-*
-* Either on MS or HG
-*
- rg = rgbf(mt,lums(3))
-*
- if(aj.lt.tm)then
-*
-* Main sequence star.
-*
- mc = 0.d0
- tau = aj/tm
- thook = thookf(mass)*tscls(1)
- zeta = 0.01d0
- tau1 = MIN(1.d0,aj/thook)
- tau2 = MAX(0.d0,
- & MIN(1.d0,(aj-(1.d0-zeta)*thook)/(zeta*thook)))
-*
- dell = lhookf(mass,zpars(1))
- dtau = tau1**2 - tau2**2
- alpha = lalphf(mass)
- betahrdiag = lbetaf(mass)
- eta = lnetaf(mass)
- lx = LOG10(lums(2)/lums(1))
- if(tau.gt.taumin)then
- xx = alpha*tau + betahrdiag*tau**eta +
- & (lx - alpha - betahrdiag)*tau**2 - dell*dtau
- else
- xx = alpha*tau + (lx - alpha)*tau**2 - dell*dtau
- endif
- lum = lums(1)*10.d0**xx
-*
- delr = rhookf(mass,zpars(1))
- dtau = tau1**3 - tau2**3
- alpha = ralphf(mass)
- betahrdiag = rbetaf(mass)
- gammahrdiag = rgammf(mass)
- rx = LOG10(rtms/rzams)
-* Note that the use of taumin is a slightly pedantic attempt to
-* avoid floating point underflow. It IS overkill!
- if(tau.gt.taumin)then
- xx = alpha*tau + betahrdiag*tau**10 +
- & gammahrdiag*tau**40 + (rx - alpha - betahrdiag -
- & gammahrdiag)*tau**3 - delr*dtau
- else
- xx = alpha*tau + (rx - alpha)*tau**3 - delr*dtau
- endif
- r = rzams*10.d0**xx
-*
- if(mass.lt.(zpars(1)-0.3d0))then
- kw = 0
-* This following is given by Chris for low mass MS stars which will be
-* substantially degenerate. We need the Hydrogen abundance, X, which we
-* calculate from Z assuming that the helium abundance, Y, is calculated
-* according to Y = 0.24 + 2*Z
- rdgen = 0.0258d0*((1.d0+zpars(11))**(5.d0/3.d0))*
- & (mass**(-1.d0/3.d0))
- r = MAX(rdgen,r)
- else
- kw = 1
- endif
-* planets
- if(mass.lt.0.005d0.and.mass.ge.tiny)then
- r = 0.16d0
- endif
-*
- else
-*
-* Star is on the HG
-*
- mcx = mc
- if(mass.le.zpars(2))then
- mc = mcgbf(lums(3),GB,lums(6))
- elseif(mass.le.zpars(3))then
- mc = mcheif(mass,zpars(2),zpars(9))
- else
- mc = mcheif(mass,zpars(2),zpars(10))
- endif
- eta = mctmsf(mass)
- tau = (aj - tm)/thg
- mc = ((1.d0 - tau)*eta + tau)*mc
- mc = MAX(mc,mcx)
-*
-* Test whether core mass has reached total mass.
-*
- if(mc.ge.mt)then
- aj = 0.d0
- if(mass.gt.zpars(2))then
-*
-* Zero-age helium star
-*
- mc = 0.d0
- mass = mt
- kw = 7
- CALL star(kw,mass,mt,tm,tn,tscls,lums,GB,zpars)
- else
-*
-* Zero-age helium white dwarf.
-*
- mc = mt
- mass = mt
- kw = 10
- endif
- else
- lum = lums(2)*(lums(3)/lums(2))**tau
- if(mass.le.zpars(3))then
- rx = rg
- else
-* He-ignition and end of HG occur at Rmin
- rmin = rminf(mass)
- ry = ragbf(mt,lums(4),zpars(2))
- rx = MIN(rmin,ry)
- if(mass.le.mlp)then
- texp = log(mass/mlp)/log(zpars(3)/mlp)
- rx = rg
- rx = rmin*(rx/rmin)**texp
- endif
- tau2 = tblf(mass,zpars(2),zpars(3))
- if(tau2.lt.tiny) rx = ry
- endif
- r = rtms*(rx/rtms)**tau
- kw = 2
- endif
-*
- endif
-*
-* Now the GB, CHeB and AGB evolution.
-*
- elseif(aj.lt.tscls(2))then
-*
-* Red Giant.
-*
- kw = 3
- lum = lgbtf(aj,GB(1),GB,tscls(4),tscls(5),tscls(6))
- if(mass.le.zpars(2))then
-* Star has a degenerate He core which grows on the GB
- mc = mcgbf(lum,GB,lums(6))
- else
-* Star has a non-degenerate He core which may grow, but
-* only slightly, on the GB
- tau = (aj - tscls(1))/(tscls(2) - tscls(1))
- mcx = mcheif(mass,zpars(2),zpars(9))
- mcy = mcheif(mass,zpars(2),zpars(10))
- mc = mcx + (mcy - mcx)*tau
- endif
- r = rgbf(mt,lum)
- rg = r
- if(mc.ge.mt)then
- aj = 0.d0
- if(mass.gt.zpars(2))then
-*
-* Zero-age helium star
-*
- mc = 0.d0
- mass = mt
- kw = 7
- CALL star(kw,mass,mt,tm,tn,tscls,lums,GB,zpars)
- else
-*
-* Zero-age helium white dwarf.
-*
- mc = mt
- mass = mt
- kw = 10
- endif
- endif
-*
- elseif(aj.lt.tbagb)then
-*
-* Core helium burning star.
-*
- if(kw.eq.3.and.mass.le.zpars(2))then
- mass = mt
- CALL star(kw,mass,mt,tm,tn,tscls,lums,GB,zpars)
- aj = tscls(2)
- endif
- if(mass.le.zpars(2))then
- mcx = mcgbf(lums(4),GB,lums(6))
- else
- mcx = mcheif(mass,zpars(2),zpars(10))
- endif
- tau = (aj - tscls(2))/tscls(3)
- mc = mcx + (mcagbf(mass) - mcx)*tau
-*
- if(mass.le.zpars(2))then
- lx = lums(5)
- ly = lums(7)
- rx = rzahbf(mt,mc,zpars(2))
- rg = rgbf(mt,lx)
- rmin = rg*zpars(13)**(mass/zpars(2))
- texp = MIN(MAX(0.4d0,rmin/rx),2.5d0)
- ry = ragbf(mt,ly,zpars(2))
- if(rmin.lt.rx)then
- taul = (log(rx/rmin))**(1.d0/3.d0)
- else
- rmin = rx
- taul = 0.d0
- endif
- tauh = (log(ry/rmin))**(1.d0/3.d0)
- tau2 = taul*(tau - 1.d0) + tauh*tau
- r = rmin*exp(abs(tau2)**3)
- rg = rg + tau*(ry - rg)
- lum = lx*(ly/lx)**(tau**texp)
- elseif(mass.gt.zpars(3))then
-*
-* For HM stars He-ignition takes place at Rmin in the HG, and CHeB
-* consists of a blue phase (before tloop) and a RG phase (after tloop).
-*
- tau2 = tblf(mass,zpars(2),zpars(3))
- tloop = tscls(2) + tau2*tscls(3)
- rmin = rminf(mass)
- rg = rgbf(mt,lums(4))
- rx = ragbf(mt,lums(4),zpars(2))
- rmin = MIN(rmin, rx)
- if(mass.le.mlp) then
- texp = log(mass/mlp)/log(zpars(3)/mlp)
- rx = rg
- rx = rmin*(rx/rmin)**texp
- else
- rx = rmin
- endif
- texp = MIN(MAX(0.4d0,rmin/rx),2.5d0)
- lum = lums(4)*(lums(7)/lums(4))**(tau**texp)
- if(aj.lt.tloop)then
- ly = lums(4)*(lums(7)/lums(4))**(tau2**texp)
- ry = ragbf(mt,ly,zpars(2))
- taul = 0.d0
- if(ABS(rmin-rx).gt.tiny)then
- taul = (log(rx/rmin))**(1.d0/3.d0)
- endif
- tauh = 0.d0
- if(ry.gt.rmin) tauh = (log(ry/rmin))**(1.d0/3.d0)
- tau = (aj - tscls(2))/(tau2*tscls(3))
- tau2 = taul*(tau - 1.d0) + tauh*tau
- r = rmin*exp(abs(tau2)**3)
- rg = rg + tau*(ry - rg)
- else
- r = ragbf(mt,lum,zpars(2))
- rg = r
- endif
- else
-*
-* For IM stars CHeB consists of a RG phase (before tloop) and a blue
-* loop (after tloop).
-*
- tau2 = 1.d0 - tblf(mass,zpars(2),zpars(3))
- tloop = tscls(2) + tau2*tscls(3)
- if(aj.lt.tloop)then
- tau = (tloop - aj)/(tau2*tscls(3))
- lum = lums(5)*(lums(4)/lums(5))**(tau**3)
- r = rgbf(mt,lum)
- rg = r
- else
- lx = lums(5)
- ly = lums(7)
- rx = rgbf(mt,lx)
- rmin = rminf(mt)
- texp = MIN(MAX(0.4d0,rmin/rx),2.5d0)
- ry = ragbf(mt,ly,zpars(2))
- if(rmin.lt.rx)then
- taul = (log(rx/rmin))**(1.d0/3.d0)
- else
- rmin = rx
- taul = 0.d0
- endif
- tauh = (log(ry/rmin))**(1.d0/3.d0)
- tau = (aj - tloop)/(tscls(3) - (tloop - tscls(2)))
- tau2 = taul*(tau - 1.d0) + tauh*tau
- r = rmin*exp(abs(tau2)**3)
- rg = rx + tau*(ry - rx)
- lum = lx*(ly/lx)**(tau**texp)
- endif
- endif
-*
-* Test whether core mass exceeds total mass.
-*
- if(mc.ge.mt)then
-*
-* Evolved MS naked helium star.
-*
- kw = 7
- xx = (aj - tscls(2))/tscls(3)
- mass = mt
- CALL star(kw,mass,mt,tm,tn,tscls,lums,GB,zpars)
- aj = xx*tm
- else
- kw = 4
- endif
-*
- else
-*
-* Asymptotic Red Giant.
-*
-* On the AGB the He core mass remains constant until at Ltp it
-* is caught by the C core mass and they grow together.
-*
- mcbagb = mcagbf(mass)
- mcx = mcgbtf(tbagb,GB(8),GB,tscls(7),tscls(8),tscls(9))
- mcmax = MAX(MAX(mch,0.773d0*mcbagb-0.35d0),1.05d0*mcx)
-*
- if(aj.lt.tscls(13))then
- mcx = mcgbtf(aj,GB(8),GB,tscls(7),tscls(8),tscls(9))
- mc = mcbagb
- lum = lmcgbf(mcx,GB)
- if(mt.le.mc)then
-*
-* Evolved naked helium star as the envelope is lost but the
-* star has not completed its interior burning. The star becomes
-* a post-HeMS star.
-*
- kw = 9
- mt = mc
- mass = mt
- mc = mcx
- CALL star(kw,mass,mt,tm,tn,tscls,lums,GB,zpars)
- if(mc.le.GB(7))then
- aj = tscls(4) - (1.d0/((GB(5)-1.d0)*GB(8)*GB(4)))*
- & (mc**(1.d0-GB(5)))
- else
- aj = tscls(5) - (1.d0/((GB(6)-1.d0)*GB(8)*GB(3)))*
- & (mc**(1.d0-GB(6)))
- endif
- aj = MAX(aj,tm)
- goto 90
- else
- kw = 5
- endif
- else
- kw = 6
- mc = mcgbtf(aj,GB(2),GB,tscls(10),tscls(11),tscls(12))
- lum = lmcgbf(mc,GB)
-*
-* Approximate 3rd Dredge-up on AGB by limiting Mc.
-*
- lambdahrdiag = MIN(0.9d0,0.3d0+0.001d0*mass**5)
- tau = tscls(13)
- mcx = mcgbtf(tau,GB(2),GB,tscls(10),tscls(11),tscls(12))
- mcy = mc
- mc = mc - lambdahrdiag*(mcy-mcx)
- mcx = mc
- mcmax = MIN(mt,mcmax)
- endif
- r = ragbf(mt,lum,zpars(2))
- rg = r
-*
-* Mc,x represents the C core mass and we now test whether it
-* exceeds either the total mass or the maximum allowed core mass.
-*
- if(mcmax-mcx.lt.tiny)then
- aj = 0.d0
- mc = mcmax
- call assign_remnant(zpars,mc,mcbagb,mass,mt,kw,bhspin,kidx)
- endif
-*
- endif
-*
- 90 continue
-*
- if(kw.ge.7.and.kw.le.9)then
-*
-* Naked Helium Star
-*
- rzams = rzhef(mt)
- rx = rzams
- if(aj.lt.tm)then
-*
-* Main Sequence
-*
- kw = 7
- tau = aj/tm
- am = MAX(0.d0,0.85d0-0.08d0*mass)
- lum = lums(1)*(1.d0+0.45d0*tau+am*tau**2)
- am = MAX(0.d0,0.4d0-0.22d0*LOG10(mt))
- r = rx*(1.d0+am*(tau-tau**6))
- rg = rx
-* Star has no core mass and hence no memory of its past
-* which is why we subject mass and mt to mass loss for
-* this phase.
- mc = 0.d0
- if(mt.lt.zpars(10)) kw = 10
- else
-*
-* Helium Shell Burning
-*
- kw = 8
- lum = lgbtf(aj,GB(8),GB,tscls(4),tscls(5),tscls(6))
- r = rhehgf(mt,lum,rx,lums(2))
- rg = rhegbf(lum)
- if(r.ge.rg)then
- kw = 9
- r = rg
- endif
- mc = mcgbf(lum,GB,lums(6))
- mtc = MIN(mt,1.45d0*mt-0.31d0)
- mcmax = MIN(mtc,MAX(mch,0.773d0*mass-0.35d0))
- if(mcmax-mc.lt.tiny)then
- aj = 0.d0
- mc = mcmax
- mcbagb = mass
- call assign_remnant(zpars,mc,mcbagb,mass,
- & mt,kw,bhspin,kidx)
-
- if(kw.eq.11) mt = MAX(mc,(mc+0.31d0)/1.45d0)
- endif
- endif
- endif
-*
- call hrdiag_remnant(zpars,mt,mc,lum,r,aj,kw)
-*
-* Calculate the core radius and the luminosity and radius of the
-* remnant that the star will become.
-*
- tau = 0.d0
- if(kw.le.1.or.kw.eq.7)then
- rc = 0.d0
- elseif(kw.le.3)then
- if(mass.gt.zpars(2))then
- lx = lzhef(mc)
- rx = rzhef(mc)
- rc = rx
- else
- if(wdflag.eq.0)then
- lx = 635.d0*mc*zpars(14)/((ahe*0.1d0)**1.4d0)
- elseif(wdflag.ge.1)then
- lx = 300.d0*mc*zpars(14)/((ahe*0.1d0)**1.18d0)
- endif
- rx = 0.0115d0*SQRT(MAX(1.48204d-06,
- & (mch/mc)**(2.d0/3.d0)-(mc/mch)**(2.d0/3.d0)))
- rc = 5.d0*rx
- endif
- elseif(kw.eq.4)then
- tau = (aj - tscls(2))/tscls(3)
- kwp = 7
- CALL star(kwp,mc,mc,tm,tn,tscls,lums,GB,zpars)
- am = MAX(0.d0,0.85d0-0.08d0*mc)
- lx = lums(1)*(1.d0+0.45d0*tau+am*tau**2)
- rx = rzhef(mc)
- am = MAX(0.d0,0.4d0-0.22d0*LOG10(mc))
- rx = rx*(1.d0+am*(tau-tau**6))
- CALL star(kw,mass,mt,tm,tn,tscls,lums,GB,zpars)
- rc = rx
- elseif(kw.eq.5)then
- kwp = 9
- if(tn.gt.tbagb) tau = 3.d0*(aj-tbagb)/(tn-tbagb)
- CALL star(kwp,mc,mc,tm,tn,tscls,lums,GB,zpars)
- lx = lmcgbf(mcx,GB)
- if(tau.lt.1.d0) lx = lums(2)*(lx/lums(2))**tau
- rx = rzhef(mc)
- rx = MIN(rhehgf(mc,lx,rx,lums(2)),rhegbf(lx))
- CALL star(kw,mass,mt,tm,tn,tscls,lums,GB,zpars)
- rc = rx
- elseif(kw.le.9)then
- if(wdflag.eq.0)then
- lx = 635.d0*mc*zpars(14)/((aco*0.1d0)**1.4d0)
- elseif(wdflag.ge.1)then
- lx = 300.d0*mc*zpars(14)/((aco*0.1d0)**1.18d0)
- endif
- rx = 0.0115d0*SQRT(MAX(1.48204d-06,
- & (mch/mc)**(2.d0/3.d0) - (mc/mch)**(2.d0/3.d0)))
- rc = 5.d0*rx
- else
- rc = r
- menv = 1.0d-10
- renv = 1.0d-10
- k2 = 0.21d0
- endif
-*
-* Perturb the luminosity and radius due to small envelope mass.
-*
- if(kw.ge.2.and.kw.le.9.and.kw.ne.7)then
- mew = ((mt-mc)/mt)*MIN(5.d0,MAX(1.2d0,(lum/lum0)**kap))
- if(kw.ge.8) mew = ((mtc-mc)/mtc)*5.d0
- if(mew.lt.1.d0)then
- xx = lpertf(mt,mew)
- lum = lx*(lum/lx)**xx
- if(r.le.rx)then
- xx = 0.d0
- else
- xx = rpertf(mt,mew,r,rx)
- endif
- r = rx*(r/rx)**xx
- endif
- rc = MIN(rc,r)
- endif
-*
-* Calculate mass and radius of convective envelope, and envelope
-* gyration radius.
-*
- if(kw.lt.10)then
- CALL mrenv(kw,mass,mt,mc,lum,r,rc,aj,tm,lums(2),lums(3),
- & lums(4),rzams,rtms,rg,menv,renv,k2)
- endif
-*
- if(ST_tide.gt.0)then
- if(kw.le.2.or.kw.eq.7.or.kw.ge.10)then
- if(mt.le.1.d0)then
- k2 = 0.205d0
- else
- k2 = 0.075d0
- endif
- else
- k2 = 0.1d0
- endif
+ real*8 r,lum,mc,rc,menv,renv,k2,mcx
+
+ if (using_METISSE.eq.1) then
+ !WRITE(*,*) 'Calling METISSE_hrdiag'
+ CALL METISSE_hrdiag(mass,aj,mt,tm,tn,tscls,lums,GB,zpars,
+ & r,lum,kw,mc,rc,menv,renv,k2,
+ & mcx,id)
+ ! get_bhspin is defined in assign_commons_cosmic.f90
+ if (kw==14) CALL get_bhspin(bhspin,id)
+
+ elseif (using_SSE.eq.1) then
+ !WRITE(*,*) 'Calling SSE_hrdiag'
+ CALL SSE_hrdiag(mass,aj,mt,tm,tn,tscls,lums,GB,zpars,
+ & r,lum,kw,mc,rc,menv,renv,k2,
+ & bhspin,id)
endif
-*
-C if(mass.gt.99.99d0)then
-C mass = mass0
-C endif
-C if(mt.gt.99.99d0)then
-C mt = mt0
-C endif
-*
- return
- end
-***
+
+ END
diff --git a/src/cosmic/src/kick.f b/src/cosmic/src/kick.f
index 6e761dcce..b9a2b40a1 100644
--- a/src/cosmic/src/kick.f
+++ b/src/cosmic/src/kick.f
@@ -1,9 +1,764 @@
-***
- SUBROUTINE kick(kw,m1,m1n,m2,ecc,sep,jorb,vk,snstar,
+ SUBROUTINE kick(kw,m1,m1n,m2,ecc,sep,jorb,vk,sn,
& r2,fallback,sigmahold,kick_info,disrupt,bkick)
IMPLICIT NONE
INCLUDE 'const_bse.h'
*
+* Variables
+* ---------
+* kw: integer
+* Stellar type of the exploding star
+* m1: real*8
+* Mass of the exploding star
+* m1n: real*8
+* Mass of the compact remnant post-SN
+* m2: real*8
+* Mass of the companion star
+* ecc: real*8
+* Eccentricity of the binary pre-SN
+* sep: real*8
+* Semi-major axis of the binary pre-SN
+* sn: integer
+* Which star is going supernova (1 or 2)
+* r2: real*8
+* Radius of the companion star
+* fallback: real*8
+* Fallback mass fraction
+* sigmahold: real*8
+* Original sigma value for the kick
+* kick_info: real*8
+* Array with information about the supernova kicks (details below)
+* bkick: real*8
+* Array with information about the kicks for CMC (details below)
+* jorb: real*8, output
+* Total orbital angular momentum of the binary
+* vk: real*8, output
+* Magnitude of the natal kick
+* disrupt: logical, output
+* Whether the system is disrupted by the supernova
+
+ integer kw,sn
+ real*8 m1,m2,m1n,ecc,sep,jorb,vk,r2,fallback,sigmahold
+ real*8 kick_info(2,18), bkick(20)
+ logical disrupt
+
+* Use one of the two kick prescriptions based on the kickflag
+ if(kickflag.lt.0)then
+* Original Kiel & Hurley 2009 prescription
+ call kick_kiel(kw,m1,m1n,m2,ecc,sep,jorb,vk,sn,
+ & r2,fallback,sigmahold,kick_info,disrupt,bkick)
+ else
+* New Pfahl et al. 2002 prescription
+ call kick_pfahl(kw,m1,m1n,m2,ecc,sep,jorb,vk,sn,
+ & r2,fallback,sigmahold,kick_info,disrupt,bkick)
+ end if
+ RETURN
+ END
+
+
+ SUBROUTINE kick_pfahl(kw,m1,m1n,m2,ecc,sep,jorb,vk,sn,r2,
+ & fallback,sigmahold,kick_info,disrupt,bkick)
+ IMPLICIT NONE
+ INCLUDE 'const_bse.h'
+*
+* This function is implements an entirely new kick prescription based
+* on Appendix B of Pfahl et al. 2002
+* https://ui.adsabs.harvard.edu/abs/2002ApJ...573..283P/abstract
+* instead of Kiel & Hurley 2009.
+*
+* This prescription better accounts for how secondary stars are ejected
+* from disrupted binaries and also corrects a few minor bugs in the
+* implementation of K&H09.
+*
+* Specific kick magnitudes, angles, eccentric anomaly, and random seeds
+* can be supplied in the initialization file with natal_kick_array, a
+* (2,5) array with the first row being for sn=1 and second for sn=2
+*
+* kick_info[i,1]: sn of exploding star
+* kick_info[i,2]: disrupted (0=no, 1=yes)
+* kick_info[i,3]: magnitude of the natal kick
+* kick_info[i,4-5]: phi and theta (in the frame of the exploding star)
+* kick_info[i,6]: eccentric anamoly
+* kick_info[i,7-9]: change in 3D systemic velocity of the binary, or the
+* change in 3D velocity of sn=1 if the system is disrupted
+* kick_info[i,10]: magnitude of systemic velocity of the binary if bound
+* or magnitude of total velocity of sn=1 if disrupted,
+* accounting for both SNe
+* kick_info[i,11-13]: change in 3D velocity of the sn=2 if system
+* is disrupted
+* kick_info[i,14]: magnitude of velocity of sn=2 if disrupted,
+* accounting for both SNe
+* kick_info[i,15]: First Euler angle of rotation of orbital plane after each SN
+* kick_info[i,16]: Second Euler angle of rotation of orbital plane after each SN
+* kick_info[i,17]: Third Euler angle of rotation of orbital plane after each SN
+* kick_info[i,18]: random seed at the start of call to kick.f
+*
+* For cmc kick_info array is zero, not negative.
+ integer kw,k,sn,safety,abskickflag
+
+ real*8 m1,m2,m1n
+ real*8 ecc,ecc_2,sep
+ real*8 pi,twopi,yearsc,rsunkm,G_const
+ parameter(yearsc=3.1557d+07,rsunkm=6.96d+05)
+ real*8 mean_anom,ecc_anom,dif,der,del
+ real*8 u1,u2,vk,vk2,v(4),s,sigmah
+ real*8 theta,phi,sin_phi,cos_phi,sin_theta,cos_theta
+ real*8 fallback,sigmahold,bound
+ real*8 mean_mns,mean_mej,alphakick,betakick
+ real*8 bkick(20),r2,jorb
+ real*8 ecc_prev,a_prev,mtot,mtot_prev
+ real*8 natal_kick(3), sep_vec(3), v_rel(3), v_rel_prev(3)
+ real*8 a_prev_2, a_prev_3, cos_ecc_anom, sin_ecc_anom
+ real*8 sqrt_1m_ecc_prev_2, sep_prev, prefactor, omega
+ real*8 h_prev(3),h(3), h_hat(3), h_mag
+ real*8 LRL_prev(3), LRL(3), e_hat(3)
+ real*8 v_cm(3), v_sn(3), v_comp(3), v_inf_vec(3), v_inf
+ real*8 v_sn_rot(3), v_comp_rot(3), v_cm_rot(3)
+ real*8 h_cross_e_hat(3)
+ real*8 thetaE, phiE, psiE
+ real*8 psiplusphi, orbital_pivot_axis(3), unsigned_phi
+ real*8 LRL_prev_dot_h, LRL_dot_h_prev, unsigned_psi
+ real*8 disberg_mean
+ integer i
+ logical ECSN_or_USSN
+* Output
+ logical output,disrupt,collide
+*
+ real*8 kick_info(2,18)
+ real ran3,xx
+ external ran3
+*
+ output = .false. !useful for debugging...
+ collide = .false.
+ ECSN_or_USSN = .false.
+ safety = 0
+ abskickflag = ABS(kickflag)
+
+* ----------------------------------------------------------------------
+* -------------- Initialise variables and constants --------------------
+* ----------------------------------------------------------------------
+
+* Set up empty arrays and constants
+ u1 = 0.d0
+ u2 = 0.d0
+ vk = 0.d0
+ disberg_mean = 5.60d0
+ pi = ACOS(-1.d0)
+ twopi = 2.d0*pi
+* Gravitational constant in units of km^3 / (Msun * s^2)
+ G_const = 1.3271244d+11
+
+* Set values for mean NS mass and mean ejecta as in Giacobbo & Mapelli 2020
+ mean_mns = 1.2d0
+ mean_mej = 9.0d0
+* Set values for alpha and beta as in Bray & Eldridge 2016
+ alphakick = 70.0d0
+ betakick = 120.0d0
+
+ if(using_cmc.eq.0)then
+* check if we have supplied a randomseed for this SN from kick_info
+* already
+ if(natal_kick_array(sn,5).gt.0.d0)then
+* if we have we need to run ran3 enough times until
+* we are at the same state of the random number generator
+* as we were before
+ do while (natal_kick_array(sn,5).ne.idum1
+ & .and.safety.le.20)
+ xx = RAN3(idum1)
+ safety = safety + 1
+ end do
+ endif
+ endif
+* save the current idum1
+ natal_kick_array(sn,5) = idum1
+ kick_info(sn,18) = idum1
+
+* set the sn of the exploding object in the kick_info array
+ kick_info(sn,1) = sn
+
+* if the system was disrupted from the first supernova, marked as disrupted
+ if(kick_info(1,2).eq.1) kick_info(2,2)=1
+
+* sigma is negative for ECSN
+ if((sigma.lt.0.d0).and.(abskickflag.eq.1.or.abskickflag.eq.5))then
+ sigma = -1.d0*sigma
+ ECSN_or_USSN = .true.
+* for kick prescriptions other than default, revert to original sigma
+ elseif((sigma.lt.0.d0).and.(abskickflag.gt.1))then
+ sigma = sigmahold
+ endif
+ sigmah = sigma
+
+* scale down BH kicks if bhsigmafrac is specified
+ if(abskickflag.eq.1.or.abskickflag.eq.5)then
+ if(kw.eq.14.or.(kw.eq.13.and.(m1n.ge.mxns)))then
+ sigma = sigmah*bhsigmafrac
+ disberg_mean = disberg_mean * bhsigmafrac
+ endif
+ endif
+
+
+* ----------------------------------------------------------------------
+* ----- Draw and scale a natal kick magnitude based on input dists -----
+* ----------------------------------------------------------------------
+
+* Before we draw the kick from the maxwellian and then scale it
+* as desired, let us see if a pre-supplied natal kick magnitude
+* was passed.
+ if(natal_kick_array(sn,1).ge.0.d0)then
+ vk = natal_kick_array(sn,1)
+ vk2 = vk*vk
+* per supplied kick value we mimic a call to random number generator
+ xx = RAN3(idum1)
+ xx = RAN3(idum1)
+ xx = RAN3(idum1)
+ xx = RAN3(idum1)
+ else
+* If no pre-supplied kick magnitude, we draw a kick from a distribution
+* If the kickflag is 5 then use the log-normal distribution described
+* by Disberg & Mandel 2025
+ if(abskickflag.eq.5.and..not.ECSN_or_USSN)then
+ call RandomLogNormal(disberg_mean,0.69d0,vk,idum1,twopi)
+ vk2 = vk*vk
+ else
+* Otherwise use the Hobbs et al. 2005 Maxwellian distribution
+* Generate Kick Velocity using Maxwellian Distribution (Phinney 1992).
+* Use Henon's method for pairwise components (Douglas Heggie 22/5/97).
+ do 25 k = 1,2
+ u1 = RAN3(idum1)
+ u2 = RAN3(idum1)
+ if(u1.gt.0.9999d0) u1 = 0.9999d0
+ if(u2.gt.1.d0) u2 = 1.d0
+* Generate two velocities from polar coordinates S & THETA.
+ s = -2.d0*LOG(1.d0 - u1)
+ s = sigma*SQRT(s)
+ theta = twopi*u2
+ v(2*k-1) = s*COS(theta)
+ v(2*k) = s*SIN(theta)
+25 continue
+ vk2 = v(1)*v(1) + v(2)*v(2) + v(3)*v(3)
+ vk = SQRT(vk2)
+ endif
+
+ if(abskickflag.eq.1.or.abskickflag.eq.5)then
+* Limit BH kick with fallback mass fraction.
+ if(kw.eq.14.and.bhflag.eq.0)then
+ vk2 = 0.d0
+ vk = 0.d0
+ elseif(kw.eq.14.and.bhflag.eq.1)then
+ fallback = MIN(fallback,1.d0)
+ vk = MAX((1.d0-fallback)*vk,0.d0)
+ vk2 = vk*vk
+ elseif(kw.eq.14.and.bhflag.eq.2)then
+ vk = vk * mxns / m1n
+ vk2 = vk*vk
+ endif
+ elseif(abskickflag.eq.2)then
+* Use kick scaling from Giacobbo & Mapelli 2020, Eq. 1
+ vk = vk * ((m1-m1n)/mean_mej) * (mean_mns/m1n)
+ vk2 = vk*vk
+ elseif(abskickflag.eq.3)then
+* Use kick scaling from Giacobbo & Mapelli 2020, Eq. 2
+ vk = vk * ((m1-m1n)/mean_mej)
+ vk2 = vk*vk
+ elseif(abskickflag.eq.4)then
+* Use kick scaling from Bray & Eldridge 2016, Eq. 1
+ vk = alphakick * ((m1-m1n)/m1n) + betakick
+ vk2 = vk*vk
+ endif
+
+ endif
+ sigma = sigmah
+
+* save natal kick velocity in the kick_info array and natal_kick_array
+ kick_info(sn,3) = vk
+ if(using_cmc.eq.0)then
+ natal_kick_array(sn,1) = vk
+ endif
+
+* ----------------------------------------------------------------------
+* --------- Now input or draw supernova natal kick angles --------------
+* ----------------------------------------------------------------------
+
+* Before we randomly draw a phi and theta for the natal kick,
+* see if a pre-supplied set of phi/theta is passed
+ if((natal_kick_array(sn,2).ge.(-90.d0)).and.
+ & (natal_kick_array(sn,2).le.(90.d0)))then
+ phi = natal_kick_array(sn,2)*pi/180.d0
+ sin_phi = SIN(phi)
+* per supplied kick value we mimic a call to random number generator
+ xx = RAN3(idum1)
+ xx = RAN3(idum1)
+ else
+* CLR - Allow for a restricted opening angle for SN kicks
+* Only relevant for binaries, obviously
+* Default value for polar_kick_angle = 90.0
+ bound = SIN((90.d0 - polar_kick_angle)*pi/180.d0)
+ sin_phi = (1.d0-bound)*ran3(idum1) + bound
+ phi = ASIN(sin_phi)
+* MJZ - The constrained kick will hit at either the north
+* or south pole, so randomly choose the hemisphere
+ if(RAN3(idum1).ge.0.5)then
+ phi = -phi
+ sin_phi = SIN(phi)
+ endif
+ endif
+ cos_phi = COS(phi)
+
+ if((natal_kick_array(sn,3).ge.(0.d0)).and.
+ & (natal_kick_array(sn,3).le.(360.d0)))then
+ theta = natal_kick_array(sn,3)*pi/180.d0
+* per supplied kick value we mimic a call to random number generator
+ xx = RAN3(idum1)
+ else
+ theta = twopi*ran3(idum1)
+ endif
+ sin_theta = SIN(theta)
+ cos_theta = COS(theta)
+
+* save theta and phi in the kick_info and
+* natal_kick_array
+ kick_info(sn,4) = phi*180/pi
+ kick_info(sn,5) = theta*180/pi
+ if(using_cmc.eq.0)then
+ natal_kick_array(sn,2) = phi*180/pi
+ natal_kick_array(sn,3) = theta*180/pi
+ endif
+
+* create a vector for the natal kick
+ natal_kick(1) = vk * cos_phi * cos_theta
+ natal_kick(2) = vk * cos_phi * sin_theta
+ natal_kick(3) = vk * sin_phi
+
+* ----------------------------------------------------------------------
+* ----- Natal kick all done, check for pre-disruption as quick exit ----
+* ----------------------------------------------------------------------
+
+* Check if the system is already not a bound binary
+ if((sn.eq.2.and.kick_info(1,2).eq.1)
+ & .or.sep.le.0.or.ecc.lt.0)then
+* if so, only apply kick to the current star
+ disrupt = .true.
+ kick_info(sn,2) = 1
+ if(sn.eq.1)then
+ kick_info(sn,7) = natal_kick(1)
+ kick_info(sn,8) = natal_kick(2)
+ kick_info(sn,9) = natal_kick(3)
+ elseif(sn.eq.2)then
+ kick_info(sn,11) = natal_kick(1)
+ kick_info(sn,12) = natal_kick(2)
+ kick_info(sn,13) = natal_kick(3)
+ endif
+ goto 78
+ endif
+
+* ----------------------------------------------------------------------
+* ------ Draw or input mean anomaly, solve for eccentric anomaly -------
+* ----------------------------------------------------------------------
+
+* Find the initial separation by randomly choosing a mean anomaly.
+* check is user supplied mean anomaly
+ xx = RAN3(idum1)
+ if((natal_kick_array(sn,4).ge.(0.d0)).and.
+ & (natal_kick_array(sn,4).le.(360.d0)))then
+
+ mean_anom = natal_kick_array(sn,4) * pi / 180.d0
+ else
+ mean_anom = xx * twopi
+ endif
+* Solve Kepler's equation for the eccentric anomaly from mean anomaly
+* https://en.wikipedia.org/wiki/Eccentric_anomaly
+ ecc_anom = mean_anom
+
+ if(mean_anom.eq.0.d0) goto 8
+
+ 9 dif = ecc_anom - ecc * SIN(ecc_anom) - mean_anom
+ if(ABS(dif / mean_anom).le.1.0d-04) goto 8
+ der = 1.d0 - ecc * COS(ecc_anom)
+ del = dif/der
+ ecc_anom = ecc_anom - del
+ goto 9
+
+ 8 continue
+
+* ----------------------------------------------------------------------
+* ------ Calculate whether system disrupts and CM velocity change ------
+* ----------------------------------------------------------------------
+
+* Some helper variables for calculations below
+ mtot_prev = m1 + m2
+ mtot = m1n + m2
+ ecc_prev = ecc
+* Convert the separation to km
+ a_prev = sep * rsunkm
+ a_prev_2 = a_prev * a_prev
+ a_prev_3 = a_prev_2 * a_prev
+ cos_ecc_anom = COS(ecc_anom)
+ sin_ecc_anom = SIN(ecc_anom)
+ sqrt_1m_ecc_prev_2 = SQRT(1.d0 - ecc_prev * ecc_prev)
+
+* Orbital frequency pre-SN (in 1/s)
+ omega = SQRT(G_const * mtot_prev / a_prev_3)
+
+* Separation vector before the supernova (in km)
+ sep_vec(1) = a_prev * (cos_ecc_anom - ecc_prev)
+ sep_vec(2) = a_prev * sqrt_1m_ecc_prev_2 * sin_ecc_anom
+ sep_vec(3) = 0.d0
+ call VectorMagnitude(sep_vec, sep_prev)
+
+* Relative velocity vector before the supernova (in km/s)
+ prefactor = omega * a_prev_2 / sep_prev
+ v_rel_prev(1) = -prefactor * sin_ecc_anom
+ v_rel_prev(2) = prefactor * sqrt_1m_ecc_prev_2 * cos_ecc_anom
+ v_rel_prev(3) = 0.d0
+
+* Specific angular momentum vector pre-SN (in km^2/s)
+ call CrossProduct(sep_vec, v_rel_prev, h_prev)
+
+* Laplace-Runge-Lenz vector pre-SN (unitless)
+ call CrossProduct(v_rel_prev, h_prev, LRL_prev)
+ do i = 1, 3
+ LRL_prev(i) = LRL_prev(i) / (G_const * mtot_prev)
+ & - sep_vec(i) / sep_prev
+ end do
+
+* Calculate the new systemic velocity of the center of mass (in km/s)
+ do i = 1, 3
+ v_cm(i) = (-m2 * (m1 - m1n) / mtot_prev / mtot)
+ & * v_rel_prev(i)
+ & + (m1n / mtot * natal_kick(i))
+ end do
+
+* New velocity vectors after SN (in km/s)
+ v_rel(1) = v_rel_prev(1) + natal_kick(1)
+ v_rel(2) = v_rel_prev(2) + natal_kick(2)
+ v_rel(3) = v_rel_prev(3) + natal_kick(3)
+
+* Updated specific orbital angular momentum vector (in km^2/s)
+ call CrossProduct(sep_vec, v_rel, h)
+
+* Updated Laplace-Runge-Lenz vector (unitless)
+ call CrossProduct(v_rel, h, LRL)
+ DO i = 1, 3
+ LRL(i) = LRL(i) / (G_const * mtot)
+ & - sep_vec(i) / sep_prev
+ END DO
+
+* Get the Euler angles from previous kick for the rotation matrix
+ thetaE = kick_info(1,15) * pi / 180.d0
+ phiE = kick_info(1,16) * pi / 180.d0
+ psiE = kick_info(1,17) * pi / 180.d0
+
+* Get the new eccentricity
+ call VectorMagnitude(LRL, ecc)
+ ecc_2 = ecc * ecc
+
+* Set the new semi-major axis (back in Rsun now)
+ call VectorMagnitude(h, h_mag)
+ sep = h_mag * h_mag / (G_const * mtot * (1 - ecc_2)) / rsunkm
+
+* ----------------------------------------------------------------------
+* -------- Split based on whether this kick disrupts the system --------
+* ----------------------------------------------------------------------
+
+ if(ecc.gt.1.d0)then
+* System is now disrupted
+ disrupt = .true.
+* Set that it is disrupted in the kick_info array
+ kick_info(sn,2) = 1
+ call VectorHat(LRL, ecc, e_hat)
+ call VectorHat(h, h_mag, h_hat)
+ call CrossProduct(h_hat, e_hat, h_cross_e_hat)
+
+* Velocity at infinity (in km/s)
+ v_inf = G_const * mtot / h_mag * sqrt(ecc_2 - 1.d0)
+ do i = 1, 3
+ v_inf_vec(i) = v_inf * ((-1.d0 * e_hat(i) / ecc)
+ & + SQRT(1 - 1.d0 / ecc_2) * h_cross_e_hat(i))
+ end do
+
+* Velocity of the star going supernova post-SN (in km/s)
+ do i = 1, 3
+ v_sn(i) = (m2 / mtot) * v_inf_vec(i) + v_cm(i)
+ end do
+
+* Velocity of the companion star post-SN (in km/s)
+ do i = 1, 3
+ v_comp(i) = -(m1n / mtot) * v_inf_vec(i) + v_cm(i)
+ end do
+
+* if second supernova, need to change basis to the original orbital plane
+ if(sn.eq.2)then
+ call ChangeBasis(v_sn, thetaE, phiE, psiE, v_sn_rot)
+ call ChangeBasis(v_comp, thetaE, phiE, psiE, v_comp_rot)
+ else
+ v_sn_rot = v_sn
+ v_comp_rot = v_comp
+ endif
+
+* save the velocities to the kick_info table
+ if(sn.eq.1)then
+ kick_info(sn,7) = v_sn_rot(1)
+ kick_info(sn,8) = v_sn_rot(2)
+ kick_info(sn,9) = v_sn_rot(3)
+ kick_info(sn,11) = v_comp_rot(1)
+ kick_info(sn,12) = v_comp_rot(2)
+ kick_info(sn,13) = v_comp_rot(3)
+
+ bkick(1) = float(sn)
+ bkick(2) = kick_info(sn,7)
+ bkick(3) = kick_info(sn,8)
+ bkick(4) = kick_info(sn,9)
+ bkick(5) = float(sn)
+ bkick(6) = kick_info(sn,11)
+ bkick(7) = kick_info(sn,12)
+ bkick(8) = kick_info(sn,13)
+*
+ elseif(sn.eq.2)then
+ kick_info(sn,11) = v_sn_rot(1)
+ kick_info(sn,12) = v_sn_rot(2)
+ kick_info(sn,13) = v_sn_rot(3)
+ kick_info(sn,7) = v_comp_rot(1)
+ kick_info(sn,8) = v_comp_rot(2)
+ kick_info(sn,9) = v_comp_rot(3)
+
+ bkick(5) = float(sn)
+ bkick(6) = kick_info(sn,11)
+ bkick(7) = kick_info(sn,12)
+ bkick(8) = kick_info(sn,13)
+ bkick(9) = float(sn)
+ bkick(10) = kick_info(sn,7)
+ bkick(11) = kick_info(sn,8)
+ bkick(12) = kick_info(sn,9)
+ endif
+
+* lastly, check if this supernova results in a collision between stars
+ call CollisionCheck(sep_vec, v_sn_rot, v_comp_rot, r2, collide)
+* if it does, assume the supernova star plows right through the
+* companion and obliterates it
+ if(collide)then
+ kick_info(sn,7) = v_sn_rot(1)
+ kick_info(sn,8) = v_sn_rot(2)
+ kick_info(sn,9) = v_sn_rot(3)
+ kick_info(sn,11) = 0.d0
+ kick_info(sn,12) = 0.d0
+ kick_info(sn,13) = 0.d0
+ bkick(6) = v_sn_rot(1)
+ bkick(7) = v_sn_rot(2)
+ bkick(8) = v_sn_rot(3)
+ bkick(10) = 0.d0
+ bkick(11) = 0.d0
+ bkick(12) = 0.d0
+ m2 = -1.d0*m2
+ endif
+
+ call AngleBetweenVectors(h, h_prev, thetaE)
+ phiE = ran3(idum1) * twopi
+ psiE = ran3(idum1) * twopi
+
+* ----------------------------------------------------------------------
+* The system is still bound
+ else
+* Record the mean anomaly in the arrays
+ kick_info(sn,6) = mean_anom * 180 / pi
+ if (using_cmc.eq.0) then
+ natal_kick_array(sn,4) = mean_anom * 180 / pi
+ endif
+
+* Update the total orbital angular momentum (in Msun Rsun^2/yr)
+ jorb = m1n * m2 / mtot * h_mag / rsunkm / rsunkm * yearsc
+
+ if (sn.eq.2) then
+ call ChangeBasis(v_cm, thetaE, phiE, psiE, v_cm_rot)
+ else
+ v_cm_rot = v_cm
+ endif
+
+*
+* If system survives the SN, save the components of the change in
+* centre-of-mass velocity
+ kick_info(sn,7) = v_cm_rot(1)
+ kick_info(sn,8) = v_cm_rot(2)
+ kick_info(sn,9) = v_cm_rot(3)
+ kick_info(sn,11) = 0
+ kick_info(sn,12) = 0
+ kick_info(sn,13) = 0
+
+* 1st time with kick.
+ if(bkick(1).le.0.d0)then
+ bkick(1) = float(sn)
+ bkick(2) = v_cm_rot(1)
+ bkick(3) = v_cm_rot(2)
+ bkick(4) = v_cm_rot(3)
+* 2nd time with kick.
+ elseif(bkick(5).le.0.d0)then
+ bkick(5) = float(sn)
+ bkick(6) = v_cm_rot(1)
+ bkick(7) = v_cm_rot(2)
+ bkick(8) = v_cm_rot(3)
+* 2nd time with kick if already disrupted.
+* MJZ - would this if statement ever be hit?
+ elseif(bkick(5).gt.0.d0)then
+ bkick(9) = float(sn)
+ bkick(10) = v_cm_rot(1)
+ bkick(11) = v_cm_rot(2)
+ bkick(12) = v_cm_rot(3)
+ endif
+* In the impossible chance that the system is exactly parabolic...
+ if(ecc.eq.1.d0.and.sn.eq.1)then
+ kick_info(sn,7) = v_cm_rot(1)
+ kick_info(sn,8) = v_cm_rot(2)
+ kick_info(sn,9) = v_cm_rot(3)
+ kick_info(sn,11) = -v_cm_rot(1)
+ kick_info(sn,12) = -v_cm_rot(2)
+ kick_info(sn,13) = -v_cm_rot(3)
+ bkick(1) = float(sn)
+ bkick(2) = v_cm_rot(1)
+ bkick(3) = v_cm_rot(2)
+ bkick(4) = v_cm_rot(3)
+ bkick(5) = float(sn)
+ bkick(6) = -v_cm_rot(1)
+ bkick(7) = -v_cm_rot(2)
+ bkick(8) = -v_cm_rot(3)
+ elseif(ecc.eq.1.d0.and.sn.eq.2)then
+ kick_info(sn,7) = -v_cm_rot(1)
+ kick_info(sn,8) = -v_cm_rot(2)
+ kick_info(sn,9) = -v_cm_rot(3)
+ kick_info(sn,11) = v_cm_rot(1)
+ kick_info(sn,12) = v_cm_rot(2)
+ kick_info(sn,13) = v_cm_rot(3)
+ bkick(5) = float(sn)
+ bkick(6) = v_cm_rot(1)
+ bkick(7) = v_cm_rot(2)
+ bkick(8) = v_cm_rot(3)
+ bkick(9) = float(sn)
+ bkick(10) = -v_cm_rot(1)
+ bkick(11) = -v_cm_rot(2)
+ bkick(12) = -v_cm_rot(3)
+ endif
+
+* Update the Euler angles for the orbital plane rotation
+ call AngleBetweenVectors(h, h_prev, thetaE)
+
+* first two special cases for orbital A.M. remaining unchanged in angle
+* since the cross product is not well defined in this case
+ if(thetaE.eq.0.d0)then
+ xx = ran3(idum1)
+ phiE = twopi * xx
+ xx = ran3(idum1)
+* we can only calculate the angle if the eccentricity is nonzero
+ if (ecc_prev.gt.0.d0.and.ecc.gt.0.d0)then
+ call AngleBetweenVectors(LRL, LRL_prev, psiPlusPhi)
+ psiE = psiPlusPhi - phiE
+ else
+ psiE = twopi * xx
+ end if
+ else if(thetaE.eq.pi)then
+ xx = ran3(idum1)
+ phiE = twopi * xx
+ xx = ran3(idum1)
+* we can only calculate the angle if the eccentricity is nonzero
+ if (ecc_prev.gt.0.d0.and.ecc.gt.0.d0)then
+ call AngleBetweenVectors(LRL, LRL_prev, psiPlusPhi)
+ psiE = phiE + psiPlusPhi
+ else
+ psiE = twopi * xx
+ end if
+* now we can actually use the cross product to get the pivot axis
+ else
+ call CrossProduct(h_prev, h, orbital_pivot_axis)
+
+* first handled phiE, need to check ecc_prev is nonzero
+* since otherwise LRL_prev is not well-defined
+ xx = ran3(idum1)
+ if(ecc_prev.eq.0.d0)then
+ phiE = twopi * xx
+ else
+ call DotProduct(LRL_prev, h, LRL_prev_dot_h)
+ call AngleBetweenVectors(LRL_prev, orbital_pivot_axis,
+ & unsigned_phi)
+ if (LRL_prev_dot_h.ge.0.d0) then
+ phiE = unsigned_phi
+ else
+ phiE = -unsigned_phi
+ endif
+ endif
+
+* repeat for psi, now focusing on ecc instead of ecc_prev
+ xx = ran3(idum1)
+ if(ecc.eq.0.d0)then
+ psiE = twopi * xx
+ else
+ call DotProduct(LRL, h_prev, LRL_dot_h_prev)
+ call AngleBetweenVectors(LRL, orbital_pivot_axis,
+ & unsigned_psi)
+ if (LRL_dot_h_prev.ge.0.d0) then
+ psiE = unsigned_psi
+ else
+ psiE = -unsigned_psi
+ endif
+ endif
+ endif
+ endif
+
+* TODO: Does Katie want to randomise the Psi angle same as COMPAS?
+
+* save Euler angles in the kick_info array
+ kick_info(sn,15) = thetaE * 180 / pi
+ kick_info(sn,16) = phiE * 180 / pi
+ kick_info(sn,17) = psiE * 180 / pi
+
+* For systems that were distrupted in the first SN, skip to here
+ 78 continue
+*
+* Set systemic velocity magnitudes in the kick_info array
+* For first SN, this should be identical to the magnitude
+* of the three component vectors. For the second SN, this
+* will be the systemic velocity relative to the initial frame.
+ if(sn.eq.1)then
+ kick_info(sn,10) = SQRT(kick_info(sn,7)*kick_info(sn,7) +
+ & kick_info(sn,8)*kick_info(sn,8) +
+ & kick_info(sn,9)*kick_info(sn,9))
+ kick_info(sn,14) = SQRT(kick_info(sn,11)*kick_info(sn,11) +
+ & kick_info(sn,12)*kick_info(sn,12) +
+ & kick_info(sn,13)*kick_info(sn,13))
+ elseif(sn.eq.2)then
+ kick_info(sn,10) = SQRT(
+ & (kick_info(1,7)+kick_info(2,7))*
+ & (kick_info(1,7)+kick_info(2,7)) +
+ & (kick_info(1,8)+kick_info(2,8))*
+ & (kick_info(1,8)+kick_info(2,8)) +
+ & (kick_info(1,9)+kick_info(2,9))*
+ & (kick_info(1,9)+kick_info(2,9)))
+ kick_info(sn,14) = SQRT(
+ & (kick_info(1,11)+kick_info(2,11))*
+ & (kick_info(1,11)+kick_info(2,11)) +
+ & (kick_info(1,12)+kick_info(2,12))*
+ & (kick_info(1,12)+kick_info(2,12)) +
+ & (kick_info(1,13)+kick_info(2,13))*
+ & (kick_info(1,13)+kick_info(2,13)))
+ endif
+
+ RETURN
+ END
+
+* ======================================================================
+* ================== Old kick routine follows ==========================
+* ======================================================================
+***
+ SUBROUTINE kick_kiel(kw,m1,m1n,m2,ecc,sep,jorb,vk,snstar,r2,
+ & fallback,sigmahold,kick_info,disrupt,bkick)
+ IMPLICIT NONE
+ INCLUDE 'const_bse.h'
+*
+* WARNINGS (from Tom Wagg)
+* ------------------------
+* Here there be dragons...this prescription seems to have some issues.
+* 1. Natal kick strongly affects ejection velocity of secondaries
+* 2. Some coordinate transformations seem to be incorrect
+* 3. Criteria for collisions are a little peculiar
+* I recommend that the kick_pfahl routine be used instead
+* ----------------------------------------------------------------------
+*
* Updated JRH kick routine by PDK (see Kiel & Hurley 2009).
*
* Here theta is the \omega angle within the HTP02 paper (thus phi is phi).
@@ -49,10 +804,10 @@ SUBROUTINE kick(kw,m1,m1n,m2,ecc,sep,jorb,vk,snstar,
* kick_info[i,15]: (total) tilt of the orbital plane after each SN
* w.r.t. the original angular momentum axis after each SN
* kick_info[i,16]: azimuthal angle of the orbital plane w.r.t. spins
-* kick_info[i,17]: random seed at the start of call to kick.f
+* kick_info[i,18]: random seed at the start of call to kick.f
*
* For cmc kick_info array is zero, not negative.
- integer kw,k,snstar,sn,safety
+ integer kw,k,snstar,sn,safety,abskickflag
real*8 m1,m2,m1n,mbi,mbf,mdif
real*8 ecc,sep,sepn,jorb,ecc2
@@ -77,12 +832,13 @@ SUBROUTINE kick(kw,m1,m1n,m2,ecc,sep,jorb,vk,snstar,
* Output
logical output,disrupt
*
- real*8 kick_info(2,17)
+ real*8 kick_info(2,18)
real ran3,xx
external ran3
*
output = .false. !useful for debugging...
safety = 0
+ abskickflag = ABS(kickflag)
* Set up empty arrays and constants
do k = 1,3
@@ -129,7 +885,9 @@ SUBROUTINE kick(kw,m1,m1n,m2,ecc,sep,jorb,vk,snstar,
endif
* save the current idum1
natal_kick_array(snstar,5) = idum1
- kick_info(sn,17) = idum1
+ kick_info(sn,18) = idum1
+* add a blank column (not used in this prescription)
+ kick_info(sn,17) = 0.d0
* set the SNstar of the exploding object in the kick_info array
kick_info(sn,1) = snstar
@@ -138,16 +896,16 @@ SUBROUTINE kick(kw,m1,m1n,m2,ecc,sep,jorb,vk,snstar,
if(kick_info(1,2).eq.1) kick_info(2,2)=1
* sigma is negative for ECSN
- if((sigma.lt.0.d0).and.(kickflag.eq.0))then
+ if((sigma.lt.0.d0).and.(abskickflag.eq.1))then
sigma = -1.d0*sigma
* for kick prescriptions other than default, revert to original sigma
- elseif((sigma.lt.0.d0).and.(kickflag.lt.0))then
+ elseif((sigma.lt.0.d0).and.(abskickflag.gt.1))then
sigma = sigmahold
endif
sigmah = sigma
* scale down BH kicks if bhsigmafrac is specified
- if(kickflag.eq.0)then
+ if(abskickflag.eq.1)then
if(kw.eq.14.or.(kw.eq.13.and.(m1n.ge.mxns)))then
sigma = sigmah*bhsigmafrac
endif
@@ -233,7 +991,7 @@ SUBROUTINE kick(kw,m1,m1n,m2,ecc,sep,jorb,vk,snstar,
vk2 = v(1)*v(1) + v(2)*v(2) + v(3)*v(3)
vk = SQRT(vk2)
- if(kickflag.eq.0)then
+ if(abskickflag.eq.1)then
* Limit BH kick with fallback mass fraction.
if(kw.eq.14.and.bhflag.eq.0)then
vk2 = 0.d0
@@ -246,15 +1004,15 @@ SUBROUTINE kick(kw,m1,m1n,m2,ecc,sep,jorb,vk,snstar,
vk = vk * mxns / m1n
vk2 = vk*vk
endif
- elseif(kickflag.eq.-1)then
+ elseif(abskickflag.eq.2)then
* Use kick scaling from Giacobbo & Mapelli 2020, Eq. 1
vk = vk * ((m1-m1n)/mean_mej) * (mean_mns/m1n)
vk2 = vk*vk
- elseif(kickflag.eq.-2)then
+ elseif(abskickflag.eq.3)then
* Use kick scaling from Giacobbo & Mapelli 2020, Eq. 2
vk = vk * ((m1-m1n)/mean_mej)
vk2 = vk*vk
- elseif(kickflag.eq.-3)then
+ elseif(abskickflag.eq.4)then
* Use kick scaling from Bray & Eldridge 2016, Eq. 1
vk = alphakick * ((m1-m1n)/m1n) + betakick
vk2 = vk*vk
@@ -768,3 +1526,212 @@ SUBROUTINE randomness3(idum,vx1,vy1,vz1,vx2,vy2,vz2)
RETURN
END
*
+
+
+
+* ======================================================================
+* ================== Vector helper functions follow ====================
+* ======================================================================
+
+ SUBROUTINE ChangeBasis(Vector, ThetaE, PhiE, PsiE, Result)
+* Redefine a vector from one coordinate basis to another using Euler Angles
+* Vector is the input vector in the new basis (X', Y', Z')
+* Result is the transformed vector in the original basis (X, Y, Z)
+* ThetaE, PhiE, PsiE are the Euler angles
+
+ real*8 Vector(3), Result(3)
+ real*8 ThetaE, PhiE, PsiE
+ real*8 cTheta, cPhi, cPsi, sTheta, sPhi, sPsi
+ real*8 rotationMatrix(3,3)
+ integer i, j
+
+* define trigonometric values
+ cTheta = COS(ThetaE)
+ sTheta = SIN(ThetaE)
+ cPhi = COS(PhiE)
+ sPhi = SIN(PhiE)
+ cPsi = COS(PsiE)
+ sPsi = SIN(PsiE)
+
+* define the Rotation Matrix
+ rotationMatrix(1,1) = cPhi * cPsi - sPhi * cTheta * sPsi
+ rotationMatrix(1,2) = -cPhi * sPsi - sPhi * cTheta * cPsi
+ rotationMatrix(1,3) = sTheta * sPhi
+ rotationMatrix(2,1) = sPhi * cPsi + cPhi * cTheta * sPsi
+ rotationMatrix(2,2) = -sPhi * sPsi + cPhi * cTheta * cPsi
+ rotationMatrix(2,3) = -sTheta * cPhi
+ rotationMatrix(3,1) = sTheta * sPsi
+ rotationMatrix(3,2) = sTheta * cPsi
+ rotationMatrix(3,3) = cTheta
+
+* initialize the result to zero
+ DO i = 1, 3
+ Result(i) = 0.0D0
+ END DO
+
+* apply rotation to the vector
+ DO i = 1, 3
+ DO j = 1, 3
+ Result(i) = Result(i) + Vector(j) * rotationMatrix(i, j)
+ END DO
+ END DO
+
+ RETURN
+ END
+
+
+ SUBROUTINE CrossProduct(A, B, C)
+* This function computes the cross product of two vectors A and B
+* A, B are input vectors of dimension 3
+* C is the resulting vector, also of dimension 3
+
+ real*8 A(3), B(3), C(3)
+
+* Calculate each component of the cross product
+ C(1) = A(2) * B(3) - A(3) * B(2)
+ C(2) = A(3) * B(1) - A(1) * B(3)
+ C(3) = A(1) * B(2) - A(2) * B(1)
+
+ RETURN
+ END
+
+
+
+ SUBROUTINE VectorMagnitude(A, magnitude)
+* This function computes the magnitude of a vector A
+* A is the input vector of dimension 3
+
+ real*8 A(3)
+ real*8 magnitude
+
+* Calculate the magnitude of the vector
+ magnitude = SQRT(A(1) * A(1) + A(2) * A(2) + A(3) * A(3))
+
+ RETURN
+ END
+
+ SUBROUTINE VectorHat(A, A_mag, A_hat)
+* This function computes the unit vector of a vector A
+* A is the input vector of dimension 3
+* A_mag is the magnitude of the vector A
+* A_hat is the resulting unit vector, also of dimension 3
+
+ real*8 A(3), A_hat(3), A_mag
+
+* Calculate the unit vector
+ A_hat(1) = A(1) / A_mag
+ A_hat(2) = A(2) / A_mag
+ A_hat(3) = A(3) / A_mag
+
+ RETURN
+ END
+
+ SUBROUTINE DotProduct(A, B, dot)
+* This function computes the dot product of two vectors A and B
+* A, B are input vectors of dimension 3
+* dot is the resulting scalar
+
+ real*8 A(3), B(3), dot
+
+* Calculate the dot product
+ dot = A(1) * B(1) + A(2) * B(2) + A(3) * B(3)
+
+ RETURN
+ END
+
+ SUBROUTINE AngleBetweenVectors(A, B, angle)
+* This function computes the angle between two vectors A and B
+* A, B are input vectors of dimension 3
+* angle is the resulting angle in radians
+
+ real*8 A(3), B(3), angle
+ real*8 dot, magA, magB
+
+* Calculate the dot product of the two vectors
+ call DotProduct(A, B, dot)
+
+* Calculate the magnitudes of the two vectors
+ call VectorMagnitude(A, magA)
+ call VectorMagnitude(B, magB)
+
+* Calculate the angle between the two vectors
+ angle = ACOS(dot / (magA * magB))
+
+ RETURN
+ END
+
+
+ SUBROUTINE CollisionCheck(sep_vec, v1, v2, r2, collide)
+* This function checks if two stars collide
+* It assumes that the compact object is a point mass, that the
+* velocities are constant and the secondary star is a sphere, radius r2
+*
+* Method
+* ------
+* This result comes from constructing two vectors:
+* r1 = v1 * t, the position of the primary star
+* r2 = sep_vec + v2 * t, the position of the secondary star
+* The difference between these vectors is
+* d = sep_vec + (v2 - v1) * t
+* If the magnitude of d is less than r2, the stars collide.
+* So to find the time of collision, we solve for t when minimising d^2
+* (squared because then we can use the quadratic formula) and just plug
+* it in.
+*
+* Variables
+* ---------
+* sep_vec is the separation vector between the two stars (in km)
+* v1 is the velocity of the primary star (in km/s)
+* v2 is the velocity of the secondary star (in km/s)
+* r2 is the radius of the secondary star (in rsun)
+* collide is whether the stars collide (logical)
+
+ real*8 sep_vec(3), v1(3), v2(3), v_dif(3), r2, r2km
+ real*8 r_dot_v_dif, v_dif_dot, t_min, d_min, d_min_vec(3)
+ logical collide
+ integer i
+
+ do i = 1, 3
+ v_dif(i) = v2(i) - v1(i)
+ end do
+
+ call DotProduct(sep_vec, v_dif, r_dot_v_dif)
+ call DotProduct(v_dif, v_dif, v_dif_dot)
+ t_min = -r_dot_v_dif / v_dif_dot
+
+ if (t_min.lt.0) then
+ collide = .false.
+ else
+ do i = 1, 3
+ d_min_vec(i) = sep_vec(i) + v_dif(i) * t_min
+ end do
+ call VectorMagnitude(d_min_vec, d_min)
+ r2km = r2 * rsunkm
+ if (d_min.lt.r2km) then
+ collide = .true.
+ else
+ collide = .false.
+ end if
+ end if
+
+ RETURN
+ END
+
+ SUBROUTINE RandomLogNormal(mean, sigma, result, idum1, twopi)
+* This function generates a random number from a log-normal distribution
+* following the Box-Muller transform method.
+* http://en.wikipedia.org/wiki/Box-Muller_transform
+
+ real*8 mean, sigma, result, twopi
+ real*8 u1, u2, z0
+
+ u1 = ran3(idum1)
+ u2 = ran3(idum1)
+
+ if (u1.le.0.d0) u1 = 1.0E-10 ! Avoid log(0)
+
+ Z0 = SQRT(-2.0d0 * LOG(u1)) * COS(twopi * u2)
+ result = EXP(mean + sigma * Z0)
+
+ RETURN
+ END
\ No newline at end of file
diff --git a/src/cosmic/src/mix.f b/src/cosmic/src/mix.f
index 77e44a32d..ca9182253 100644
--- a/src/cosmic/src/mix.f
+++ b/src/cosmic/src/mix.f
@@ -1,5 +1,5 @@
***
- SUBROUTINE MIX(M0,M,AJ,KS,ZPARS,bhspin)
+ SUBROUTINE MIX(M0,M,AJ,KS,ZPARS,bhspin,dtm)
IMPLICIT NONE
INCLUDE 'const_bse.h'
*
@@ -11,7 +11,7 @@ SUBROUTINE MIX(M0,M,AJ,KS,ZPARS,bhspin)
*
*
INTEGER KS(2),I1,I2,K1,K2,KW,ICASE
- REAL*8 M0(2),M(2),AJ(2),ZPARS(20),bhspin(2)
+ REAL*8 M0(2),M(2),AJ(2),ZPARS(20),bhspin(2),dtm
REAL*8 TSCLS(20),LUMS(10),GB(10),TMS1,TMS2,TMS3,TN
REAL*8 M01,M02,M03,M1,M2,M3,AGE1,AGE2,AGE3,MC3,MCH
REAL*8 M_CORE_BGB_1,M_CORE_BGB_2,M_CORE_BGB_3,HE_3_current
@@ -37,7 +37,7 @@ SUBROUTINE MIX(M0,M,AJ,KS,ZPARS,bhspin)
M01 = M0(I1)
M1 = M(I1)
AGE1 = AJ(I1)
- CALL star(K1,M01,M1,TMS1,TN,TSCLS,LUMS,GB,ZPARS)
+ CALL star(K1,M01,M1,TMS1,TN,TSCLS,LUMS,GB,ZPARS,dtm,I1)
IF(REJUVFLAG.EQ.1.AND.KS(1).LE.2.0.AND.KS(2).LE.2.0)THEN
M_CORE_BGB_1 = GB(9)
ENDIF
@@ -46,7 +46,7 @@ SUBROUTINE MIX(M0,M,AJ,KS,ZPARS,bhspin)
M02 = M0(I2)
M2 = M(I2)
AGE2 = AJ(I2)
- CALL star(K2,M02,M2,TMS2,TN,TSCLS,LUMS,GB,ZPARS)
+ CALL star(K2,M02,M2,TMS2,TN,TSCLS,LUMS,GB,ZPARS,dtm,I2)
IF(REJUVFLAG.EQ.1.AND.KS(1).LE.2.0.AND.KS(2).LE.2.0)THEN
M_CORE_BGB_2 = GB(9)
ENDIF
@@ -90,7 +90,8 @@ SUBROUTINE MIX(M0,M,AJ,KS,ZPARS,bhspin)
* mixing. We will now make it a parameter so that it can
* be partial mixing.
IF(K1.EQ.7) KW = 7
- CALL star(KW,M03,M3,TMS3,TN,TSCLS,LUMS,GB,ZPARS)
+ if (using_METISSE.eq.1) call set_star_type(1)
+ CALL star(KW,M03,M3,TMS3,TN,TSCLS,LUMS,GB,ZPARS,dtm,1)
IF(REJUVFLAG.EQ.1.AND.KS(1).LE.2.0.AND.KS(2).LE.2.0)THEN
M_CORE_BGB_3 = GB(9)
HE_3_current =AGE1*M_CORE_BGB_1/TMS1+AGE2*M_CORE_BGB_2/TMS2
@@ -100,13 +101,14 @@ SUBROUTINE MIX(M0,M,AJ,KS,ZPARS,bhspin)
ENDIF
ELSEIF(ICASE.EQ.3.OR.ICASE.EQ.6.OR.ICASE.EQ.9)THEN
MC3 = M1
- CALL gntage(MC3,M3,KW,ZPARS,M03,AGE3)
+ CALL gntage(MC3,M3,KW,ZPARS,M03,AGE3,1)
ELSEIF(ICASE.EQ.4)THEN
MC3 = M1
AGE3 = AGE1/TMS1
- CALL gntage(MC3,M3,KW,ZPARS,M03,AGE3)
+ CALL gntage(MC3,M3,KW,ZPARS,M03,AGE3,1)
ELSEIF(ICASE.EQ.7)THEN
- CALL star(KW,M03,M3,TMS3,TN,TSCLS,LUMS,GB,ZPARS)
+ if (using_METISSE.eq.1) call set_star_type(1)
+ CALL star(KW,M03,M3,TMS3,TN,TSCLS,LUMS,GB,ZPARS,dtm,1)
AGE3 = TMS3*(AGE2*M2/TMS2)/M3
ELSEIF(ICASE.LE.12)THEN
* Ensure that a new WD has the initial mass set correctly.
diff --git a/src/cosmic/src/mlwind.f b/src/cosmic/src/mlwind.f
index 2f514747e..e6b277316 100644
--- a/src/cosmic/src/mlwind.f
+++ b/src/cosmic/src/mlwind.f
@@ -1,249 +1,20 @@
-***
- real*8 FUNCTION mlwind(kw,lum,r,mt,mc,rl,z)
+ real*8 FUNCTION mlwind(kw,lum,r,mt,mc,rl,z,id)
IMPLICIT NONE
INCLUDE 'const_bse.h'
- integer kw,testflag
- real*8 lum,r,mt,mc,rl,z,teff,alpha
- real*8 dml,dms,dmt,p0,x,mew,lum0,kap
- real*8 MLalpha
- external MLalpha
- parameter(lum0=7.0d+04,kap=-0.5d0)
-*
-* windflag = 0 !BSE=0, startrack08=1, vink=2, vink+LBV for all
-* stars=3.
-* Must be one of these values or mlwind will cause problem with code,
-* i.e. mlwind not set (see last line of main if statement...).
-
- if(windflag.eq.0)then
-* BSE
-*
-* Calculate stellar wind mass loss.
-*
-* Apply mass loss of Nieuwenhuijzen & de Jager, A&A, 1990, 231, 134,
-* for massive stars over the entire HRD.
- dms = 0.d0
- if(lum.gt.4000.d0)then
- x = MIN(1.d0,(lum-4000.d0)/500.d0)
- dms = 9.6d-15*x*(r**0.81d0)*(lum**1.24d0)*(mt**0.16d0)
- alpha = 0.5d0
- dms = dms*(z/zsun)**(alpha)
- endif
- if(kw.ge.2.and.kw.le.9)then
-* 'Reimers' mass loss
- dml = neta*4.0d-13*r*lum/mt
- if(rl.gt.0.d0) dml =
- & dml*(1.d0 + bwind*(MIN(0.5d0,(r/rl)))**6)
-* Apply mass loss of Vassiliadis & Wood, ApJ, 1993, 413, 641,
-* for high pulsation periods on AGB.
- if(kw.eq.5.or.kw.eq.6)then
- p0 = -2.07d0 - 0.9d0*log10(mt) + 1.94d0*log10(r)
- p0 = 10.d0**p0
- p0 = MIN(p0,2000.d0)
- dmt = -11.4d0+0.0125d0*(p0-100.d0*MAX(mt-2.5d0,0.d0))
- dmt = 10.d0**dmt
- dmt = 1.d0*MIN(dmt,1.36d-09*lum)
- dml = MAX(dml,dmt)
- endif
- if(kw.gt.6)then
- dms = MAX(dml,1.0d-13*hewind*lum**(3.d0/2.d0))
- else
- dms = MAX(dml,dms)
- mew = ((mt-mc)/mt)*MIN(5.d0,MAX(1.2d0,(lum/lum0)**kap))
-* reduced WR-like mass loss for small H-envelope mass
- if(mew.lt.1.d0)then
- dml = 1.0d-13*lum**(3.d0/2.d0)*(1.d0 - mew)
- dms = MAX(dml,dms)
- endif
-* LBV-like mass loss beyond the Humphreys-Davidson limit.
- x = 1.0d-5*r*sqrt(lum)
- if(lum.gt.6.0d+05.and.x.gt.1.d0)then
- dml = 0.1d0*(x-1.d0)**3*(lum/6.0d+05-1.d0)
- dms = dms + dml
- endif
- endif
- endif
-*
- mlwind = dms
- elseif(windflag.eq.1)then
-* StarTrack (Beclzynski+08)
-*
-* Calculate stellar wind mass loss.
-*
-* Apply mass loss of Nieuwenhuijzen & de Jager, A&A, 1990, 231, 134,
-* for massive stars over the entire HRD, with no luminosity limit
-* according to Belczynsk+08 pp. 174.
-*
-* This may not be what is actually assumed in StarTrack (see the windf1 function).
-*
-*
- dms = 0.d0
- if(lum.gt.4000.d0.or.(kw.ge.0.and.kw.le.1))then
- if(lum.gt.4000.d0)then
- x = MIN(1.d0,(lum-4000.d0)/500.d0)
- else
- x = 0.1d0/500.d0
- endif !or is it simply x = Min(1, lum/500)?
- dms = 9.6d-15*x*(r**0.81d0)*(lum**1.24d0)*(mt**0.16d0)
- alpha = 0.5d0
- dms = dms*(z/zsun)**(alpha)
- endif
- if(kw.ge.2.and.kw.le.9)then
-* 'Reimers' mass loss
- dml = neta*4.0d-13*r*lum/mt
- if(rl.gt.0.d0) dml =
- & dml*(1.d0 + bwind*(MIN(0.5d0,(r/rl)))**6)
-* Apply mass loss of Vassiliadis & Wood, ApJ, 1993, 413, 641,
-* for high pulsation periods on AGB.
- if(kw.eq.5.or.kw.eq.6)then
- p0 = -2.07d0 - 0.9d0*log10(mt) + 1.94d0*log10(r)
- p0 = 10.d0**p0
- p0 = MIN(p0,2000.d0)
- dmt = -11.4d0+0.0125d0*(p0-100.d0*MAX(mt-2.5d0,0.d0))
- dmt = 10.d0**dmt
- dmt = 1.d0*MIN(dmt,1.36d-09*lum)
- dml = MAX(dml,dmt)
- endif
- if(kw.gt.6)then
- dms = MAX(dml,1.0d-13*lum**(3.d0/2.d0)) !hewind here for KH06, not included for StarTrack...
- else
- dms = MAX(dml,dms)
- mew = ((mt-mc)/mt)*MIN(5.d0,MAX(1.2d0,(lum/lum0)**kap))
-* reduced WR-like mass loss for small H-envelope mass
- if(mew.lt.1.d0)then
- dml = 1.0d-13*lum**(3.d0/2.d0)*(1.d0 - mew)
- dms = MAX(dml,dms)
- endif
-* LBV-like mass loss beyond the Humphreys-Davidson limit.
- x = 1.0d-5*r*sqrt(lum)
- if(lum.gt.6.0d+05.and.x.gt.1.d0)then
- dml = 0.1d0*(x-1.d0)**3*(lum/6.0d+05-1.d0)
- dms = dms + dml
- endif
- endif
- endif
-*
- mlwind = dms
- elseif(windflag.eq.2.or.windflag.eq.3)then
-* Vink winds etc according to as implemented following
-* Belczynski, Bulik, Fryer, Ruiter, Valsecchi, Vink & Hurley 2010.
-*
-* Firstly implement BSE 'old' winds that cover all other stars not
-* accounted for by Vink winds (see Belczynski+09). Then implement
-* Vink et al. winds.
-*
-* We also include the option for a variable metallicity-dependent mass
-* loss parameter which eddlimflag is set, which makes the metallicity
-* dependence become weaker as the star approaches the electron-scattering
-* Eddington limit (Grafener & Hamann 2008, Giacobbo et al. 2018)
-*
- teff = 1000.d0*((1130.d0*lum/(r**2.d0))**(1.d0/4.d0))
- dms = 0.d0
- if(lum.gt.4000.d0)then
-* Apply mass loss of Nieuwenhuijzen & de Jager, A&A, 1990, 231, 134,
-* for massive stars over the entire HRD after OB stars accounted for.
- x = MIN(1.d0,(lum-4000.d0)/500.d0)
- dms = 9.6d-15*x*(r**0.81d0)*(lum**1.24d0)*(mt**0.16d0)
- alpha = 0.5d0
- dms = dms*(z/zsun)**(alpha)
- testflag = 1
- endif
- if(kw.ge.2.and.kw.le.6)then
-* 'Reimers' mass loss
- dml = neta*4.0d-13*r*lum/mt
- if(rl.gt.0.d0) dml =
- & dml*(1.d0 + bwind*(MIN(0.5d0,(r/rl)))**6)
-* Apply mass loss of Vassiliadis & Wood, ApJ, 1993, 413, 641,
-* for high pulsation periods on AGB.
- if(kw.eq.5.or.kw.eq.6)then
- p0 = -2.07d0 - 0.9d0*log10(mt) + 1.94d0*log10(r)
- p0 = 10.d0**p0
- p0 = MIN(p0,2000.d0)
- dmt = -11.4d0+0.0125d0*(p0-100.d0*MAX(mt-2.5d0,0.d0))
- dmt = 10.d0**dmt
- dmt = 1.d0*MIN(dmt,1.36d-09*lum)
- dml = MAX(dml,dmt)
- endif
- dms = MAX(dms,dml)
- endif
-* Apply Vink, de Koter & Lamers (2001) OB star winds.
-* Next check if hot massive H-rich O/B star in appropriate temperature ranges.
- if(teff.ge.12500.and.teff.le.25000)then
- if(eddlimflag.eq.0) alpha = 0.85d0
- if(eddlimflag.eq.1) alpha = MLalpha(mt,lum,kw)
- dms = -6.688d0 + 2.210d0*LOG10(lum/1.0d+05) -
- & 1.339d0*LOG10(mt/30.d0) - 1.601d0*LOG10(1.3d0/2.d0) +
- & alpha*LOG10(z/zsun) + 1.07d0*LOG10(teff/2.0d+04)
- dms = 10.d0**dms
- testflag = 2
- elseif(teff.gt.25000.)then
-* Although Vink et al. formulae are only defined until Teff=50000K,
-* we follow the Dutch prescription of MESA, and extend to higher Teff
- dms = -6.697d0 + 2.194d0*LOG10(lum/1.0d+05) -
- & 1.313d0*LOG10(mt/30.d0) - 1.226d0*LOG10(2.6d0/2.d0) +
- & alpha*LOG10(z/zsun) +0.933d0*LOG10(teff/4.0d+04) -
- & 10.92d0*(LOG10(teff/4.0d+04)**2)
- dms = 10.d0**dms
- testflag = 2
- endif
-
- if((windflag.eq.3.or.kw.ge.2).and.kw.le.6)then
-* LBV-like mass loss beyond the Humphreys-Davidson limit.
-* Optional flag (windflag=3) to use for every non-degenerate star
-* past the limit, rather than just for giant, evolved stars
- x = 1.0d-5*r*sqrt(lum)
- if(lum.gt.6.0d+05.and.x.gt.1.d0)then
- if(eddlimflag.eq.0) alpha = 0.d0
- if(eddlimflag.eq.1) alpha = MLalpha(mt,lum,kw)
- dms = 1.5d0*1.0d-04*((z/zsun)**alpha)
- testflag = 3
- endif
- elseif(kw.ge.7.and.kw.le.9)then !WR (naked helium stars)
-* If naked helium use Hamann & Koesterke (1998) WR winds reduced by factor of
-* 10 (Yoon & Langer 2005), with Vink & de Koter (2005) metallicity dependence
- if(eddlimflag.eq.0) alpha = 0.86d0
- if(eddlimflag.eq.1) alpha = MLalpha(mt,lum,kw)
- dms = 1.0d-13*(lum**1.5d0)*((z/zsun)**alpha)
- testflag = 4
- endif
-*
- mlwind = dms
- elseif(windflag.eq.4)then
-*
-* Calculate stellar wind mass loss following MIST as closely as possible
-*
- dms = 0.d0
- if(kw.ge.0.and.kw.le.9)then
-* 'Reimers' mass loss over the whole HRD
- dml = 0.1*4.0d-13*r*lum/mt
- if(rl.gt.0.d0) dml =
- & dml*(1.d0 + bwind*(MIN(0.5d0,(r/rl)))**6)
-* Apply mass loss of Blocker 1995 for AGB.
- if(kw.eq.5.or.kw.eq.6)then
- dml = 4.83d-9*0.2*dml/0.1*((lum)**2.7)/((mt)**2.1)
- endif
- if(kw.gt.6)then
- dms = MAX(dml,1.0d-13*hewind*lum**(3.d0/2.d0))
- else
- dms = MAX(dml,dms)
- mew = ((mt-mc)/mt)*MIN(5.d0,MAX(1.2d0,(lum/lum0)**kap))
-* reduced WR-like mass loss for small H-envelope mass
- if(mew.lt.1.d0)then
- dml = 1.0d-13*lum**(3.d0/2.d0)*(1.d0 - mew)
- dms = MAX(dml,dms)
- endif
-* LBV-like mass loss beyond the Humphreys-Davidson limit.
- x = 1.0d-5*r*sqrt(lum)
- if(lum.gt.6.0d+05.and.x.gt.1.d0)then
- dml = 0.1d0*(x-1.d0)**3*(lum/6.0d+05-1.d0)
- dms = dms + dml
- endif
- endif
- endif
-*
- mlwind = dms
+ integer kw,id
+ real*8 lum,r,mt,mc,rl,z
+
+ real*8 SSE_mlwind, METISSE_mlwind
+ external SSE_mlwind, METISSE_mlwind
+
+ if (using_METISSE.eq.1) then
+ !WRITE(*,*) 'Calling METISSE_mlwind'
+ mlwind = METISSE_mlwind(kw,lum,r,mt,mc,rl,z,id)
+
+ elseif (using_SSE.eq.1) then
+ !WRITE(*,*) 'Calling SSE_mlwind'
+ mlwind = SSE_mlwind(kw,lum,r,mt,mc,rl,z)
endif
- return
- end
-***
+ END
diff --git a/src/cosmic/src/star.f b/src/cosmic/src/star.f
index 0913d049b..d22f7f702 100644
--- a/src/cosmic/src/star.f
+++ b/src/cosmic/src/star.f
@@ -1,365 +1,17 @@
-***
- SUBROUTINE star(kw,mass,mt,tm,tn,tscls,lums,GB,zpars)
+ SUBROUTINE star(kw,mass,mt,tm,tn,tscls,lums,GB,zpars,dtm,id)
IMPLICIT NONE
INCLUDE 'const_bse.h'
-*
-*
-* Stellar luminosity & evolution time.
-* ------------------------------------
-*
-*
- integer kw
-*
- real*8 mass,mt,tm,tn,tscls(20),lums(10),GB(10),zpars(20)
- real*8 tgb,tbagb,mch,mcmax,mc1,mc2,mcbagb,dx,am
- real*8 lambdastar,tau,mtc,mass0
- parameter(mch=1.44d0)
-*
- real*8 lzamsf,lzahbf,lzhef
- real*8 tbgbf,thookf,tHef,themsf,mcgbf,mcagbf,mcheif,mcgbtf
- real*8 ltmsf,lbgbf,lHeIf,lHef,lbagbf,lmcgbf
- external lzamsf,lzahbf,lzhef
- external tbgbf,thookf,tHef,themsf,mcgbf,mcagbf,mcheif,mcgbtf
- external ltmsf,lbgbf,lHeIf,lHef,lbagbf,lmcgbf
-*
-* Computes the characteristic luminosities at different stages (LUMS),
-* and various timescales (TSCLS).
-* Ref: P.P. Eggleton, M.J. Fitchett & C.A. Tout (1989) Ap.J. 347, 998.
-*
-* Revised 27th March 1995 by C. A. Tout
-* and 24th October 1995 to include metallicity
-* and 13th December 1996 to include naked helium stars
-*
-* Revised 5th April 1997 by J. R. Hurley
-* to include Z=0.001 as well as Z=0.02, convective overshooting,
-* MS hook and more elaborate CHeB. It now also sets the Giant
-* Branch parameters relevant to the mass of the star.
-*
-* ------------------------------------------------------------
-* Times: 1; BGB 2; He ignition 3; He burning
-* 4; Giant t(inf1) 5; Giant t(inf2) 6; Giant t(Mx)
-* 7; FAGB t(inf1) 8; FAGB t(inf2) 9; FAGB t(Mx)
-* 10; SAGB t(inf1) 11; SAGB t(inf2) 12; SAGB t(Mx)
-* 13; TP 14; t(Mcmax)
-*
-* LUMS: 1; ZAMS 2; End MS 3; BGB
-* 4; He ignition 5; He burning 6; L(Mx)
-* 7; BAGB 8; TP
-*
-* GB: 1; effective A(H) 2; A(H,He) 3; B
-* 4; D 5; p 6; q
-* 7; Mx 8; A(He) 9; Mc,BGB
-*
-* ------------------------------------------------------------
-*
-*
- mass0 = mass
-C if(mass0.gt.100.d0) mass = 100.d0
-*
- if(kw.ge.7.and.kw.le.9) goto 90
- if(kw.ge.10) goto 95
-*
-* MS and BGB times
-*
- tscls(1) = tbgbf(mass)
- tm = MAX(zpars(8),thookf(mass))*tscls(1)
-*
-* Zero- and terminal age main sequence luminosity
-*
- lums(1) = lzamsf(mass)
- lums(2) = ltmsf(mass)
-*
-* Set the GB parameters
-*
- GB(1) = MAX(-4.8d0,MIN(-5.7d0+0.8d0*mass,-4.1d0+0.14d0*mass))
- GB(1) = 10.d0**GB(1)
- GB(2) = 1.27d-05
- GB(8) = 8.0d-05
- GB(3) = MAX(3.0d+04,500.d0 + 1.75d+04*mass**0.6d0)
- if(mass.le.2.0)then
- GB(4) = zpars(6)
- GB(5) = 6.d0
- GB(6) = 3.d0
- elseif(mass.lt.2.5)then
- dx = zpars(6) - (0.975d0*zpars(6) - 0.18d0*2.5d0)
- GB(4) = zpars(6) - dx*(mass - 2.d0)/(0.5d0)
- GB(5) = 6.d0 - (mass - 2.d0)/(0.5d0)
- GB(6) = 3.d0 - (mass - 2.d0)/(0.5d0)
- else
- GB(4) = MAX(-1.d0,0.5d0*zpars(6) - 0.06d0*mass)
- GB(4) = MAX(GB(4),0.975d0*zpars(6) - 0.18d0*mass)
- GB(5) = 5.d0
- GB(6) = 2.d0
- endif
- GB(4) = 10.d0**GB(4)
- GB(7) = (GB(3)/GB(4))**(1.d0/(GB(5)-GB(6)))
-*
-* Change in slope of giant L-Mc relation.
- lums(6) = GB(4)*GB(7)**GB(5)
-*
-* HeI ignition luminosity
- lums(4) = lHeIf(mass,zpars(2))
- lums(7) = lbagbf(mass,zpars(2))
-*
- if(mass.lt.0.1d0.and.kw.le.1)then
- tscls(2) = 1.1d0*tscls(1)
- tscls(3) = 0.1d0*tscls(1)
- lums(3) = lbgbf(mass)
- goto 96
- endif
-*
- if(mass.le.zpars(3))then
-* Base of the giant branch luminosity
- lums(3) = lbgbf(mass)
-* Set GB timescales
- tscls(4) = tscls(1) + (1.d0/((GB(5)-1.d0)*GB(1)*GB(4)))*
- & ((GB(4)/lums(3))**((GB(5)-1.d0)/GB(5)))
- tscls(6) = tscls(4) - (tscls(4) - tscls(1))*((lums(3)/lums(6))
- & **((GB(5)-1.d0)/GB(5)))
- tscls(5) = tscls(6) + (1.d0/((GB(6)-1.d0)*GB(1)*GB(3)))*
- & ((GB(3)/lums(6))**((GB(6)-1.d0)/GB(6)))
-* Set Helium ignition time
- if(lums(4).le.lums(6))then
- tscls(2) = tscls(4) - (1.d0/((GB(5)-1.d0)*GB(1)*GB(4)))*
- & ((GB(4)/lums(4))**((GB(5)-1.d0)/GB(5)))
- else
- tscls(2) = tscls(5) - (1.d0/((GB(6)-1.d0)*GB(1)*GB(3)))*
- & ((GB(3)/lums(4))**((GB(6)-1.d0)/GB(6)))
- endif
- tgb = tscls(2) - tscls(1)
- if(mass.le.zpars(2))then
- mc1 = mcgbf(lums(4),GB,lums(6))
- mc2 = mcagbf(mass)
- lums(5) = lzahbf(mass,mc1,zpars(2))
- tscls(3) = tHef(mass,mc1,zpars(2))
- else
- lums(5) = lHef(mass)*lums(4)
- tscls(3) = tHef(mass,1.d0,zpars(2))*tscls(1)
- endif
- else
-* Note that for M>zpars(3) there is no GB as the star goes from
-* HG -> CHeB -> AGB. So in effect tscls(1) refers to the time of
-* Helium ignition and not the BGB.
- tscls(2) = tscls(1)
- tscls(3) = tHef(mass,1.d0,zpars(2))*tscls(1)
-* This now represents the luminosity at the end of CHeB, ie. BAGB
- lums(5) = lums(7)
-* We set lums(3) to be the luminosity at the end of the HG
- lums(3) = lums(4)
- endif
-*
-* Set the core mass at the BGB.
-*
- if(mass.le.zpars(2))then
- GB(9) = mcgbf(lums(3),GB,lums(6))
- elseif(mass.le.zpars(3))then
- GB(9) = mcheif(mass,zpars(2),zpars(9))
- else
- GB(9) = mcheif(mass,zpars(2),zpars(10))
- endif
-*
-* FAGB time parameters
-*
- tbagb = tscls(2) + tscls(3)
- tscls(7) = tbagb + (1.d0/((GB(5)-1.d0)*GB(8)*GB(4)))*
- & ((GB(4)/lums(7))**((GB(5)-1.d0)/GB(5)))
- tscls(9) = tscls(7) - (tscls(7) - tbagb)*((lums(7)/lums(6))
- & **((GB(5)-1.d0)/GB(5)))
- tscls(8) = tscls(9) + (1.d0/((GB(6)-1.d0)*GB(8)*GB(3)))*
- & ((GB(3)/lums(6))**((GB(6)-1.d0)/GB(6)))
-*
-* Now to find Ltp and ttp using Mc,He,tp
-*
- mcbagb = mcagbf(mass)
- mc1 = mcbagb
- if(mc1.ge.0.8d0.and.mc1.lt.2.25d0)then
-* The star undergoes dredge-up at Ltp causing a decrease in Mc,He
- mc1 = 0.44d0*mc1 + 0.448d0
- endif
- lums(8) = lmcgbf(mc1,GB)
- if(mc1.le.GB(7))then
- tscls(13) = tscls(7) - (1.d0/((GB(5)-1.d0)*GB(8)*GB(4)))*
- & (mc1**(1.d0-GB(5)))
- else
- tscls(13) = tscls(8) - (1.d0/((GB(6)-1.d0)*GB(8)*GB(3)))*
- & (mc1**(1.d0-GB(6)))
- endif
-*
-* SAGB time parameters
-*
- if(mc1.le.GB(7))then
- tscls(10) = tscls(13) + (1.d0/((GB(5)-1.d0)*GB(2)*GB(4)))*
- & ((GB(4)/lums(8))**((GB(5)-1.d0)/GB(5)))
- tscls(12) = tscls(10) - (tscls(10) - tscls(13))*
- & ((lums(8)/lums(6))**((GB(5)-1.d0)/GB(5)))
- tscls(11) = tscls(12) + (1.d0/((GB(6)-1.d0)*GB(2)*GB(3)))*
- & ((GB(3)/lums(6))**((GB(6)-1.d0)/GB(6)))
- else
- tscls(10) = tscls(7)
- tscls(12) = tscls(9)
- tscls(11) = tscls(13) + (1.d0/((GB(6)-1.d0)*GB(2)*GB(3)))*
- & ((GB(3)/lums(8))**((GB(6)-1.d0)/GB(6)))
- endif
-*
-* Get an idea of when Mc,C = Mc,C,max on the AGB
- tau = tscls(2) + tscls(3)
- mc2 = mcgbtf(tau,GB(8),GB,tscls(7),tscls(8),tscls(9))
- mcmax = MAX(MAX(mch,0.773d0*mcbagb - 0.35d0),1.05d0*mc2)
-*
- if(mcmax.le.mc1)then
- if(mcmax.le.GB(7))then
- tscls(14) = tscls(7) - (1.d0/((GB(5)-1.d0)*GB(8)*GB(4)))*
- & (mcmax**(1.d0-GB(5)))
- else
- tscls(14) = tscls(8) - (1.d0/((GB(6)-1.d0)*GB(8)*GB(3)))*
- & (mcmax**(1.d0-GB(6)))
- endif
- else
-* Star is on SAGB and we need to increase mcmax if any 3rd
-* dredge-up has occurred.
- lambdastar = MIN(0.9d0,0.3d0+0.001d0*mass**5)
- mcmax = (mcmax - lambdastar*mc1)/(1.d0 - lambdastar)
- if(mcmax.le.GB(7))then
- tscls(14) = tscls(10) - (1.d0/((GB(5)-1.d0)*GB(2)*GB(4)))*
- & (mcmax**(1.d0-GB(5)))
- else
- tscls(14) = tscls(11) - (1.d0/((GB(6)-1.d0)*GB(2)*GB(3)))*
- & (mcmax**(1.d0-GB(6)))
- endif
- endif
- tscls(14) = MAX(tbagb,tscls(14))
-C if(mass.ge.100.d0)then
-C tn = tscls(2)
-C goto 100
-C endif
-*
-* Calculate the nuclear timescale - the time of exhausting
-* nuclear fuel without further mass loss.
-* This means we want to find when Mc = Mt which defines Tn and will
-* be used in determining the timestep required. Note that after some
-* stars reach Mc = Mt there will be a Naked Helium Star lifetime
-* which is also a nuclear burning period but is not included in Tn.
-*
- if(ABS(mt-mcbagb).lt.1.0d-14.and.kw.lt.5)then
- tn = tbagb
- else
-* Note that the only occurence of Mc being double-valued is for stars
-* that have a dredge-up. If Mt = Mc where Mc could be the value taken
-* from CHeB or from the AGB we need to check the current stellar type.
- if(mt.gt.mcbagb.or.(mt.ge.mc1.and.kw.gt.4))then
- if(kw.eq.6)then
- lambdastar = MIN(0.9d0,0.3d0+0.001d0*mass**5)
- mc1 = (mt - lambdastar*mc1)/(1.d0 - lambdastar)
- else
- mc1 = mt
- endif
- if(mc1.le.GB(7))then
- tn = tscls(10) - (1.d0/((GB(5)-1.d0)*GB(2)*GB(4)))*
- & (mc1**(1.d0-GB(5)))
- else
- tn = tscls(11) - (1.d0/((GB(6)-1.d0)*GB(2)*GB(3)))*
- & (mc1**(1.d0-GB(6)))
- endif
- else
- if(mass.gt.zpars(3))then
- mc1 = mcheif(mass,zpars(2),zpars(10))
- if(mt.le.mc1)then
- tn = tscls(2)
- else
- tn = tscls(2) + tscls(3)*((mt - mc1)/(mcbagb - mc1))
- endif
- elseif(mass.le.zpars(2))then
- mc1 = mcgbf(lums(3),GB,lums(6))
- mc2 = mcgbf(lums(4),GB,lums(6))
- if(mt.le.mc1)then
- tn = tscls(1)
- elseif(mt.le.mc2)then
- if(mt.le.GB(7))then
- tn = tscls(4) - (1.d0/((GB(5)-1.d0)*GB(1)*GB(4)))*
- & (mt**(1.d0-GB(5)))
- else
- tn = tscls(5) - (1.d0/((GB(6)-1.d0)*GB(1)*GB(3)))*
- & (mt**(1.d0-GB(6)))
- endif
- else
- tn = tscls(2) + tscls(3)*((mt - mc2)/(mcbagb - mc2))
- endif
- else
- mc1 = mcheif(mass,zpars(2),zpars(9))
- mc2 = mcheif(mass,zpars(2),zpars(10))
- if(mt.le.mc1)then
- tn = tscls(1)
- elseif(mt.le.mc2)then
- tn = tscls(1) + tgb*((mt - mc1)/(mc2 - mc1))
- else
- tn = tscls(2) + tscls(3)*((mt - mc2)/(mcbagb - mc2))
- endif
- endif
- endif
- endif
- tn = MIN(tn,tscls(14))
-*
- goto 100
-*
- 90 continue
-*
-* Calculate Helium star Main Sequence lifetime.
-*
- tm = themsf(mass)
- tscls(1) = tm
-*
-* Zero- and terminal age Helium star main sequence luminosity
-*
- lums(1) = lzhef(mass)
- am = MAX(0.d0,0.85d0-0.08d0*mass)
- lums(2) = lums(1)*(1.d0+0.45d0+am)
-*
-* Set the Helium star GB parameters
-*
- GB(8) = 8.0d-05
- GB(3) = 4.1d+04
- GB(4) = 5.5d+04/(1.d0+0.4d0*mass**4)
- GB(5) = 5.d0
- GB(6) = 3.d0
- GB(7) = (GB(3)/GB(4))**(1.d0/(GB(5)-GB(6)))
-* Change in slope of giant L-Mc relation.
- lums(6) = GB(4)*GB(7)**GB(5)
-*
-*** Set Helium star GB timescales
-*
- mc1 = mcgbf(lums(2),GB,lums(6))
- tscls(4) = tm + (1.d0/((GB(5)-1.d0)*GB(8)*GB(4)))*
- & mc1**(1.d0-GB(5))
- tscls(6) = tscls(4) - (tscls(4) - tm)*((GB(7)/mc1)
- & **(1.d0-GB(5)))
- tscls(5) = tscls(6) + (1.d0/((GB(6)-1.d0)*GB(8)*GB(3)))*
- & GB(7)**(1.d0-GB(6))
-*
-* Get an idea of when Mc = MIN(Mt,Mc,C,max) on the GB
- mtc = MIN(mt,1.45d0*mt-0.31d0)
- if(mtc.le.0.d0) mtc = mt
- mcmax = MIN(mtc,MAX(mch,0.773d0*mass-0.35d0))
- if(mcmax.le.GB(7))then
- tscls(14) = tscls(4) - (1.d0/((GB(5)-1.d0)*GB(8)*GB(4)))*
- & (mcmax**(1.d0-GB(5)))
- else
- tscls(14) = tscls(5) - (1.d0/((GB(6)-1.d0)*GB(8)*GB(3)))*
- & (mcmax**(1.d0-GB(6)))
- endif
- tscls(14) = MAX(tscls(14),tm)
- tn = tscls(14)
-*
- goto 100
-*
- 95 continue
- tm = 1.0d+10
- tscls(1) = tm
- 96 continue
- tn = 1.0d+10
-*
- 100 continue
- mass = mass0
-*
- return
- end
-***
+
+ real*8 mass,mt,tm,tn,tscls(20),lums(10),GB(10),zpars(20),dtm
+ integer kw ,id
+
+ if (using_METISSE.eq.1) then
+ !WRITE(*,*) 'Calling METISSE_star'
+ CALL METISSE_star(kw,mass,mt,tm,tn,tscls,lums,GB,zpars,dtm,id)
+
+ elseif (using_SSE.eq.1) then
+ !WRITE(*,*) 'Calling SSE_star'
+ CALL SSE_star(kw,mass,mt,tm,tn,tscls,lums,GB,zpars)
+ endif
+
+ END
diff --git a/src/cosmic/src/test_bse.f b/src/cosmic/src/test_bse.f
new file mode 100644
index 000000000..643fec443
--- /dev/null
+++ b/src/cosmic/src/test_bse.f
@@ -0,0 +1,323 @@
+***
+ PROGRAM bse
+***
+*
+* Evolves a binary by calling evolv2.f
+* (see header of subroutine for algorithm description).
+*
+* Required input is described below.
+***
+* See Tout et al., MNRAS, 1997, 291, 732 for a description of many of the
+* processes in this code as well as the relevant references mentioned
+* within the code.
+* Updated reference is:
+* Hurley J.R., Tout C.A., & Pols O.R., 2002, MNRAS, 329, 897
+* (please use this one).
+***
+* For single star evolution see Hurley, Pols & Tout, 2000, MNRAS, 315, 543.
+* or Hurley, 2000, PhD Thesis, University of Cambridge (Chapter 2).
+* The binary evolution algorithm is described in Chapter 3 of the thesis.
+***
+*
+* B I N A R Y
+* ***********
+*
+* Roche lobe overflow.
+* --------------------
+*
+* Developed by Jarrod Hurley, IOA, Cambridge.
+* .........................................................
+*
+* Advice by Christopher Tout, Onno Pols & Sverre Aarseth.
+* ++++++++++++++++++++++++++++++++++++++++++++++++++
+***
+ implicit none
+*
+ INCLUDE 'const_bse.h'
+*
+ integer i,kw,kw2,kstar(2),j,k,time,idum
+ integer bpp_index_out, bcm_index_out
+ real*8 kick_info_out(2,17)
+*
+ real*8 mass0(2),mass(2),z,zpars(20),vs(3),kick_info(2,18)
+ real*8 epoch(2),tms(2),tphys,tphysf,dtp,aj
+ real*8 rad(2),lum(2),ospin(2)
+ real*8 massc(2),radc(2),menv(2),renv(2)
+ real*8 tb,ecc,yearsc
+ real*8 B_0(2),bacc(2),tacc(2),bhspin(2),bkick(20)
+ PARAMETER(yearsc=3.1557d+07)
+ CHARACTER*8 label(16)
+*
+************************************************************************
+* Input:
+*
+* mass is in solar units.
+* tphysf is the maximum evolution time in Myr.
+* tb is the orbital period in days.
+* kstar is the stellar type: 0 or 1 on the ZAMS - unless in evolved state.
+* z is metallicity in the range 0.0001 -> 0.03 where 0.02 is Population I.
+* eccentricity can be anywhere in the range 0.0 -> 1.0.
+*
+* neta is the Reimers mass-loss coefficent (neta*4x10^-13: 0.5 normally).
+* bwind is the binary enhanced mass loss parameter (inactive for single).
+* hewind is a helium star mass loss factor (1.0 normally).
+* alpha1 is the common-envelope efficiency parameter (1.0).
+* lambda is the binding energy factor for common envelope evolution (0.5).
+*
+* ceflag = 0 activates spin-energy correction in common-envelope (0).
+* ceflag = 1 activates de Kool common-envelope model (0).
+* tflag > 0 activates tidal circularisation (1).
+* ifflag > 0 uses WD IFMR of HPE, 1995, MNRAS, 272, 800 (0).
+* wdflag > 0 uses modified-Mestel cooling for WDs (0).
+* bhflag > 0 allows velocity kick at BH formation (0).
+* rtmsflag > 0 uses rtms from simulation data (1=[Boost], 2=[Bpass]) (0)
+* remnantflag > 0 takes NS/BH mass from Belczynski et al. 2002, ApJ, 572, 407 (1).
+* mxns is the maximum NS mass (1.8, remnantflag=0; 3.0, remnantflag=1).
+* idum is the random number seed used by the kick routine.
+*
+* Next come the parameters that determine the timesteps chosen in each
+* evolution phase:
+* pts1 - MS (0.05)
+* pts2 - GB, CHeB, AGB, HeGB (0.01)
+* pts3 - HG, HeMS (0.02)
+* as decimal fractions of the time taken in that phase.
+*
+* sigma is the dispersion in the Maxwellian for the SN kick speed (190 km/s).
+* beta is wind velocity factor: proportional to vwind**2 (1/8).
+* xi is the wind accretion efficiency factor (1.0).
+* acc2 is the Bondi-Hoyle wind accretion factor (3/2).
+* epsnov is the fraction of accreted matter retained in nova eruption (0.001).
+* eddfac is Eddington limit factor for mass transfer (1.0).
+* gamma is the angular momentum factor for mass lost during Roche (-1.0).
+*
+* If you enter a negative kstar then parameters for an evolved star are
+* required in the order of:
+* current age, initial mass and spin rate,
+* otherwise the star will start on the ZAMS.
+*
+ OPEN(22,file='binary.in', status='old')
+ READ(22,*)mass0(1),mass0(2),tphysf,tb,kstar(1),kstar(2),z,ecc
+ READ(22,*)neta,bwind,hewind,alpha1,lambdaf,windflag,rtmsflag
+ READ(22,*)ceflag,tflag,ifflag,wdflag,bhflag,remnantflag,mxns,idum
+ READ(22,*)pts1,pts2,pts3
+ READ(22,*)sigma,beta,xi,acc2,epsnov,eddfac,gamma
+ if(kstar(1).lt.0.or.kstar(2).lt.0)then
+ READ(22,*)tphys
+ READ(22,*)aj,mass(1),ospin(1)
+ epoch(1) = tphys - aj
+ kstar(1) = ABS(kstar(1))
+ READ(22,*)aj,mass(2),ospin(2)
+ epoch(2) = tphys - aj
+ kstar(2) = ABS(kstar(2))
+ else
+
+ WRITE(*,*)mass0(1),mass0(2),tphysf,tb,kstar(1),kstar(2),z,ecc
+ WRITE(*,*)neta,bwind,hewind,alpha1,lambdaf,windflag,rtmsflag
+ WRITE(*,*)ceflag,tflag,ifflag,wdflag,bhflag,remnantflag,mxns,idum
+ WRITE(*,*)pts1,pts2,pts3
+ WRITE(*,*)sigma,beta,xi,acc2,epsnov,eddfac,gamma
+*
+* Initialize the parameters.
+* Set the initial spin of the stars. If ospin is zero (actually < 0.001)
+* at time zero then evolv2 will set an appropriate ZAMS spin. If
+* ospin is greater than zero then it will start with that spin regardless
+* of the time. If you want to start at time zero with negligible spin
+* then I suggest using a negligible value (but greater than 0.001).
+* If ospin is negative then the stars will be in co-rotation with the orbit.
+*
+ tphys = 0.d0
+ mass(1) = mass0(1)
+ epoch(1) = 0.d0
+ ospin(1) = 0.d0
+ mass(2) = mass0(2)
+ epoch(2) = 0.d0
+ ospin(2) = 0.d0
+
+ B_0(1) = 0.d0
+ B_0(2) = 0.d0
+ bacc(1) = 0.d0
+ bacc(2) = 0.d0
+ tacc(1) = 0.d0
+ tacc(2) = 0.d0
+ bhspin(1) = 0.d0
+ bhspin(2) = 0.d0
+ tms(1) = 0.d0
+ tms(2) = 0.d0
+*
+* NOTE: The following parameters are set to current default values (v3.4.10).
+* They should really be included in binary.in and copied from an initC
+* file. This is a temporary measure until the input file is updated.
+*
+ pisn = 45.d0
+ cekickflag = 2
+ cehestarflag = 0
+ grflag = 1
+ bhms_coll_flag = 0
+ wd_mass_lim = 1
+ ecsn = 2.25
+ ecsn_mlow = 1.6
+ aic = 1
+ ussn = 0
+ sigmadiv = -20
+ bhsigmafrac = 1.0
+ polar_kick_angle = 90
+ do i = 1,4
+ do j = 1,2
+ natal_kick_array(j, i) = -100.d0
+ enddo
+ enddo
+ natal_kick_array(1,5) = 0.0
+ natal_kick_array(2,5) = 0.0
+ do i = 1,8
+ qcrit_array(i) = 0.0
+ enddo
+ don_lim = -1
+ acc_lim = -1
+ bdecayfac = 1
+ bconst = 3000
+ ck = 1000
+ qcflag = 5
+ eddlimflag = 0
+ do i = 1,16
+ fprimc_array(i) = 2.0/21.0
+ enddo
+ bhspinflag = 0
+ bhspinmag = 0.0
+ rejuv_fac = 1.0
+ rejuvflag = 0
+ htpmb = 1
+ st_cr = 1
+ st_tide = 1
+ rembar_massloss = 0.5
+ zsun = 0.014
+ kickflag = -1
+ using_cmc = 0
+
+
+ do i=1,20
+ bkick(i) = 0.d0
+ enddo
+
+
+ endif
+ do i=1,17
+ do j=1,2
+ kick_info(j,i) = 0.d0
+ enddo
+ enddo
+* If you would like to enter the seperation as input in place of the binary
+* orbital period uncomment these lines (depending upon which units you wish
+* to use).
+* tb = sqrt((tb/aursun)**3/(mass0(1)+mass0(2))) !if input was separation [Rsun] use this line.
+* tb = sqrt((tb)**3/(mass0(1)+mass0(2))) !if input was separation [AU] use this line.
+* tb = tb*yeardy
+ if(idum.gt.0) idum = -idum
+ CLOSE(22)
+ WRITE(*,*)
+*
+* Note that this routine can be used to evolve a single star if you
+* simply set mass(2) = 0.0 or tb = 0.0 (setting both is advised as
+* well as some dummy value for ecc).
+*
+************************************************************************
+*
+* Set parameters which depend on the metallicity
+*
+ CALL zcnsts(z,zpars)
+*
+* Set the collision matrix.
+*
+ CALL instar
+*
+ label(1) = 'INITIAL '
+ label(2) = 'KW CHNGE'
+ label(3) = 'BEG RCHE'
+ label(4) = 'END RCHE'
+ label(5) = 'CONTACT '
+ label(6) = 'COELESCE'
+ label(7) = 'COMENV '
+ label(8) = 'GNTAGE '
+ label(9) = 'NO REMNT'
+ label(10) = 'MAX TIME'
+ label(11) = 'DISRUPT '
+ label(12) = 'BEG SYMB'
+ label(13) = 'END SYMB'
+ label(14) = 'BEG BSS'
+ label(15) = 'SN PRIM'
+ label(16) = 'SN SEC'
+*
+* Set the data-save parameter. If dtp is zero then the parameters of the
+* star will be stored in the bcm array at each timestep otherwise they
+* will be stored at intervals of dtp. Setting dtp equal to tphysf will
+* store data only at the start and end while a value of dtp greater than
+* tphysf will mean that no data is stored.
+*
+ dtp = 0
+*
+* Evolve the binary.
+*
+ CALL evolv2(kstar,mass,tb,ecc,z,tphysf,dtp,mass0,rad,lum,
+ & massc,radc,menv,renv,ospin,B_0,bacc,tacc,
+ & epoch,tms,bhspin,tphys,zpars,bkick,kick_info,
+ & bcm_index_out,bpp_index_out,kick_info_out)
+*
+************************************************************************
+* Output:
+* First check that bcm is not empty.
+*
+ if(bcm(1,1).lt.0.0) goto 50
+*
+* The bcm array stores the stellar and orbital parameters at the
+* specified output times. The parameters are (in order of storage):
+*
+* Time,
+* [stellar type, initial mass, current mass, log10(L), log10(r),
+* log10(Teff), core mass, core radius, mass of any convective
+* envelope, radius of the envelope, epoch, spin, mass loss rate and
+* ratio of radius to roche lobe radius (repeated for secondary)],
+* period, separation, eccentricity.
+*
+ OPEN(23,file='binary.dat', status='unknown')
+ j = 0
+ 30 j = j + 1
+ if(bcm(j,1).lt.0.0)then
+ bcm(j-1,1) = bcm(j,1)
+ j = j - 1
+ endif
+ kw = INT(bcm(j,2))
+ kw2 = INT(bcm(j,16))
+ WRITE(23,99)bcm(j,1),kw,kw2,bcm(j,4),bcm(j,18),
+ & bcm(j,8),bcm(j,22),
+ & bcm(j,6),bcm(j,20),bcm(j,15),bcm(j,29),
+ & bcm(j,5),bcm(j,19),bcm(j,13),bcm(j,27),
+ & bcm(j,14),bcm(j,28),
+ & bcm(j,31),bcm(j,32)
+ if(bcm(j,1).ge.0.0) goto 30
+ CLOSE(23)
+ 99 FORMAT(g30.18,2i3,10g30.18,5e30.18,g30.18)
+ 999 FORMAT(g30.18,2g30.18,1p,2e30.18)
+*
+* The bpp array acts as a log, storing parameters at each change
+* of evolution stage.
+*
+ 50 j = 0
+ WRITE(*,*)' TIME M1 M2 K1 K2 SEP ECC',
+ & ' R1/ROL1 R2/ROL2 TYPE'
+ 52 j = j + 1
+ if(bpp(j,1).lt.0.0) goto 60
+ kstar(1) = INT(bpp(j,4))
+ kstar(2) = INT(bpp(j,5))
+ kw = INT(bpp(j,11))
+ WRITE(*,100)(bpp(j,k),k=1,3),kstar,(bpp(j,k),k=6,9),label(kw)
+ goto 52
+ 60 continue
+ 100 FORMAT(g30.18,2g30.18,2i3,g30.18,g30.18,2g30.18,2x,a8)
+ WRITE(*,*)
+*
+************************************************************************
+*
+ WRITE(*,*) bcm(2,31), bpp(j, 6)
+
+ STOP
+ END
+***
diff --git a/src/cosmic/src/zcnsts.f b/src/cosmic/src/zcnsts.f
index 6605dc14a..083a03c30 100644
--- a/src/cosmic/src/zcnsts.f
+++ b/src/cosmic/src/zcnsts.f
@@ -1,383 +1,18 @@
-***
SUBROUTINE zcnsts(z,zpars)
IMPLICIT NONE
INCLUDE 'const_bse.h'
-*
- integer kw
-*
+
real*8 z,zpars(20)
- real*8 tm,tn,tscls(20),lums(10),GB(10)
- real*8 lzs,dlzs,lz,lzd,dum1,m1,m2,rr,rb,mhefl,lhefl,thefl,lx
- real*8 tbgbf,thef,lbagbf,lheif,lhef,lzahbf
- real*8 rgbf,ragbf,rminf,mcgbf
- external tbgbf,thef,lbagbf,lheif,lhef,lzahbf
- external rgbf,ragbf,rminf,mcgbf
-*
- include 'zdata.h'
- real*8 msp(200),gbp(200),c(5)
- common /MSCFF/ msp
- common /GBCFF/ gbp
- data c /3.040581d-01, 8.049509d-02, 8.967485d-02,
- & 8.780198d-02, 2.219170d-02/
-*
-* ------------------------------------------------------------
-*
-* zpars: 1; M below which hook doesn't appear on MS, Mhook.
-* 2; M above which He ignition occurs non-degenerately, Mhef.
-* 3; M above which He ignition occurs on the HG, Mfgb.
-* 4; M below which C/O ignition doesn't occur, Mup.
-* 5; M above which C ignites in the centre, Mec.
-* 6; value of log D for M<= zpars(3)
-* 7; value of x for Rgb propto M^(-x)
-* 8; value of x for tMS = MAX(tHOOK,x*tBGB)
-* 9; constant for McHeIf when computing Mc,BGB, mchefl.
-* 10; constant for McHeIf when computing Mc,HeI, mchefl.
-* 11; hydrogen abundance.
-* 12; helium abundance.
-* 13; constant x in rmin = rgb*x**y used by LM CHeB.
-* 14; z**0.4 to be used for WD L formula.
-*
-* ------------------------------------------------------------
-*
- lzs = log10(z/zsun)
- dlzs = 1.d0/(z*log(10.d0))
- lz = log10(z)
- lzd = lzs + 1.d0
-*
- zpars(1) = 1.0185d0 + lzs*(0.16015d0 + lzs*0.0892d0)
- zpars(2) = 1.995d0 + lzs*(0.25d0 + lzs*0.087d0)
- zpars(3) = 16.5d0*z**0.06d0/(1.d0 + (1.0d-04/z)**1.27d0)
- zpars(4) = MAX(6.11044d0 + 1.02167d0*lzs, 5.d0)
- zpars(5) = zpars(4) + 1.8d0
- zpars(6) = 5.37d0 + lzs*0.135d0
- zpars(7) = c(1) + lzs*(c(2) + lzs*(c(3) + lzs*(c(4) + lzs*c(5))))
- zpars(8) = MAX(0.95d0,MAX(0.95d0-(10.d0/3.d0)*(z-0.01d0),
- & MIN(0.99d0,0.98d0-(100.d0/7.d0)*(z-0.001d0))))
-***
-* Lzams
- msp(1) = xz(1)+lzs*(xz(2)+lzs*(xz(3)+lzs*(xz(4)+lzs*xz(5))))
- msp(2) = xz(6)+lzs*(xz(7)+lzs*(xz(8)+lzs*(xz(9)+lzs*xz(10))))
- msp(3) = xz(11)+lzs*(xz(12)+lzs*(xz(13)+lzs*(xz(14)+lzs*xz(15))))
- msp(4) = xz(16)+lzs*(xz(17)+lzs*(xz(18)+lzs*(xz(19)+lzs*xz(20))))
- msp(5) = xz(21)+lzs*(xz(22)+lzs*(xz(23)+lzs*(xz(24)+lzs*xz(25))))
- msp(6) = xz(26)+lzs*(xz(27)+lzs*(xz(28)+lzs*(xz(29)+lzs*xz(30))))
- msp(7) = xz(31)+lzs*(xz(32)+lzs*(xz(33)+lzs*(xz(34)+lzs*xz(35))))
-* Rzams
- msp(8) = xz(36)+lzs*(xz(37)+lzs*(xz(38)+lzs*(xz(39)+lzs*xz(40))))
- msp(9) = xz(41)+lzs*(xz(42)+lzs*(xz(43)+lzs*(xz(44)+lzs*xz(45))))
- msp(10) = xz(46)+lzs*(xz(47)+lzs*(xz(48)+lzs*(xz(49)+lzs*xz(50))))
- msp(11) = xz(51)+lzs*(xz(52)+lzs*(xz(53)+lzs*(xz(54)+lzs*xz(55))))
- msp(12) = xz(56)+lzs*(xz(57)+lzs*(xz(58)+lzs*(xz(59)+lzs*xz(60))))
- msp(13) = xz(61)
- msp(14) = xz(62)+lzs*(xz(63)+lzs*(xz(64)+lzs*(xz(65)+lzs*xz(66))))
- msp(15) = xz(67)+lzs*(xz(68)+lzs*(xz(69)+lzs*(xz(70)+lzs*xz(71))))
- msp(16) = xz(72)+lzs*(xz(73)+lzs*(xz(74)+lzs*(xz(75)+lzs*xz(76))))
-* Tbgb
- msp(17) = xt(1)+lzs*(xt(2)+lzs*(xt(3)+lzs*xt(4)))
- msp(18) = xt(5)+lzs*(xt(6)+lzs*(xt(7)+lzs*xt(8)))
- msp(19) = xt(9)+lzs*(xt(10)+lzs*(xt(11)+lzs*xt(12)))
- msp(20) = xt(13)+lzs*(xt(14)+lzs*(xt(15)+lzs*xt(16)))
- msp(21) = xt(17)
-* dTbgb/dz
- msp(117) = dlzs*(xt(2)+lzs*(2.d0*xt(3)+3.d0*lzs*xt(4)))
- msp(118) = dlzs*(xt(6)+lzs*(2.d0*xt(7)+3.d0*lzs*xt(8)))
- msp(119) = dlzs*(xt(10)+lzs*(2.d0*xt(11)+3.d0*lzs*xt(12)))
- msp(120) = dlzs*(xt(14)+lzs*(2.d0*xt(15)+3.d0*lzs*xt(16)))
-* Thook
- msp(22) = xt(18)+lzs*(xt(19)+lzs*(xt(20)+lzs*xt(21)))
- msp(23) = xt(22)
- msp(24) = xt(23)+lzs*(xt(24)+lzs*(xt(25)+lzs*xt(26)))
- msp(25) = xt(27)+lzs*(xt(28)+lzs*(xt(29)+lzs*xt(30)))
- msp(26) = xt(31)
-* Ltms
- msp(27) = xl(1)+lzs*(xl(2)+lzs*(xl(3)+lzs*(xl(4)+lzs*xl(5))))
- msp(28) = xl(6)+lzs*(xl(7)+lzs*(xl(8)+lzs*(xl(9)+lzs*xl(10))))
- msp(29) = xl(11)+lzs*(xl(12)+lzs*(xl(13)+lzs*xl(14)))
- msp(30) = xl(15)+lzs*(xl(16)+lzs*(xl(17)+lzs*(xl(18)+lzs*xl(19))))
- msp(27) = msp(27)*msp(30)
- msp(28) = msp(28)*msp(30)
- msp(31) = xl(20)+lzs*(xl(21)+lzs*(xl(22)+lzs*xl(23)))
- msp(32) = xl(24)+lzs*(xl(25)+lzs*(xl(26)+lzs*xl(27)))
-* Lalpha
- m2 = 2.d0
- msp(33) = xl(28)+lzs*(xl(29)+lzs*(xl(30)+lzs*xl(31)))
- msp(34) = xl(32)+lzs*(xl(33)+lzs*(xl(34)+lzs*xl(35)))
- msp(35) = xl(36)+lzs*(xl(37)+lzs*(xl(38)+lzs*xl(39)))
- msp(36) = xl(40)+lzs*(xl(41)+lzs*(xl(42)+lzs*xl(43)))
- msp(37) = MAX(0.9d0,1.1064d0+lzs*(0.415d0+0.18d0*lzs))
- msp(38) = MAX(1.d0,1.19d0+lzs*(0.377d0+0.176d0*lzs))
- if(z.gt.0.01d0)then
- msp(37) = MIN(msp(37),1.d0)
- msp(38) = MIN(msp(38),1.1d0)
+ integer :: ierr
+
+ if (using_METISSE.eq.1) then
+ !WRITE(*,*) 'Calling METISSE_zcnsts',using_METISSE
+ CALL METISSE_zcnsts(z,zpars,ierr)
+ if (ierr/=0) call assign_error()
+
+ elseif (using_SSE.eq.1) then
+ !WRITE(*,*) 'Calling SSE_zcnsts'
+ CALL SSE_zcnsts(z,zpars)
endif
- msp(39) = MAX(0.145d0,0.0977d0-lzs*(0.231d0+0.0753d0*lzs))
- msp(40) = MIN(0.24d0+lzs*(0.18d0+0.595d0*lzs),0.306d0+0.053d0*lzs)
- msp(41) = MIN(0.33d0+lzs*(0.132d0+0.218d0*lzs),
- & 0.3625d0+0.062d0*lzs)
- msp(42) = (msp(33)+msp(34)*m2**msp(36))/
- & (m2**0.4d0+msp(35)*m2**1.9d0)
-* Lbeta
- msp(43) = xl(44)+lzs*(xl(45)+lzs*(xl(46)+lzs*(xl(47)+lzs*xl(48))))
- msp(44) = xl(49)+lzs*(xl(50)+lzs*(xl(51)+lzs*(xl(52)+lzs*xl(53))))
- msp(45) = xl(54)+lzs*(xl(55)+lzs*xl(56))
- msp(46) = MIN(1.4d0,1.5135d0+0.3769d0*lzs)
- msp(46) = MAX(0.6355d0-0.4192d0*lzs,MAX(1.25d0,msp(46)))
-* Lhook
- msp(47) = xl(57)+lzs*(xl(58)+lzs*(xl(59)+lzs*xl(60)))
- msp(48) = xl(61)+lzs*(xl(62)+lzs*(xl(63)+lzs*xl(64)))
- msp(49) = xl(65)+lzs*(xl(66)+lzs*(xl(67)+lzs*xl(68)))
- msp(50) = xl(69)+lzs*(xl(70)+lzs*(xl(71)+lzs*xl(72)))
- msp(51) = MIN(1.4d0,1.5135d0+0.3769d0*lzs)
- msp(51) = MAX(0.6355d0-0.4192d0*lzs,MAX(1.25d0,msp(51)))
-* Rtms
- msp(52) = xr(1)+lzs*(xr(2)+lzs*(xr(3)+lzs*(xr(4)+lzs*xr(5))))
- msp(53) = xr(6)+lzs*(xr(7)+lzs*(xr(8)+lzs*(xr(9)+lzs*xr(10))))
- msp(54) = xr(11)+lzs*(xr(12)+lzs*(xr(13)+lzs*(xr(14)+lzs*xr(15))))
- msp(55) = xr(16)+lzs*(xr(17)+lzs*(xr(18)+lzs*xr(19)))
- msp(56) = xr(20)+lzs*(xr(21)+lzs*(xr(22)+lzs*xr(23)))
- msp(52) = msp(52)*msp(54)
- msp(53) = msp(53)*msp(54)
- msp(57) = xr(24)
- msp(58) = xr(25)+lzs*(xr(26)+lzs*(xr(27)+lzs*xr(28)))
- msp(59) = xr(29)+lzs*(xr(30)+lzs*(xr(31)+lzs*xr(32)))
- msp(60) = xr(33)+lzs*(xr(34)+lzs*(xr(35)+lzs*xr(36)))
- msp(61) = xr(37)+lzs*(xr(38)+lzs*(xr(39)+lzs*xr(40)))
-*
- msp(62) = MAX(0.097d0-0.1072d0*(lz+3.d0),MAX(0.097d0,MIN(0.1461d0,
- & 0.1461d0+0.1237d0*(lz+2.d0))))
- msp(62) = 10.d0**msp(62)
- m2 = msp(62) + 0.1d0
- msp(63) = (msp(52)+msp(53)*msp(62)**msp(55))/
- & (msp(54)+msp(62)**msp(56))
- msp(64) = (msp(57)*m2**3+msp(58)*m2**msp(61)+
- & msp(59)*m2**(msp(61)+1.5d0))/(msp(60)+m2**5)
-* Ralpha
- msp(65) = xr(41)+lzs*(xr(42)+lzs*(xr(43)+lzs*xr(44)))
- msp(66) = xr(45)+lzs*(xr(46)+lzs*(xr(47)+lzs*xr(48)))
- msp(67) = xr(49)+lzs*(xr(50)+lzs*(xr(51)+lzs*xr(52)))
- msp(68) = xr(53)+lzs*(xr(54)+lzs*(xr(55)+lzs*xr(56)))
- msp(69) = xr(57)+lzs*(xr(58)+lzs*(xr(59)+lzs*(xr(60)+lzs*xr(61))))
- msp(70) = MAX(0.9d0,MIN(1.d0,1.116d0+0.166d0*lzs))
- msp(71) = MAX(1.477d0+0.296d0*lzs,MIN(1.6d0,-0.308d0-1.046d0*lzs))
- msp(71) = MAX(0.8d0,MIN(0.8d0-2.d0*lzs,msp(71)))
- msp(72) = xr(62)+lzs*(xr(63)+lzs*xr(64))
- msp(73) = MAX(0.065d0,0.0843d0-lzs*(0.0475d0+0.0352d0*lzs))
- msp(74) = 0.0736d0+lzs*(0.0749d0+0.04426d0*lzs)
- if(z.lt.0.004d0) msp(74) = MIN(0.055d0,msp(74))
- msp(75) = MAX(0.091d0,MIN(0.121d0,0.136d0+0.0352d0*lzs))
- msp(76) = (msp(65)*msp(71)**msp(67))/(msp(66) + msp(71)**msp(68))
- if(msp(70).gt.msp(71))then
- msp(70) = msp(71)
- msp(75) = msp(76)
- endif
-* Rbeta
- msp(77) = xr(65)+lzs*(xr(66)+lzs*(xr(67)+lzs*xr(68)))
- msp(78) = xr(69)+lzs*(xr(70)+lzs*(xr(71)+lzs*xr(72)))
- msp(79) = xr(73)+lzs*(xr(74)+lzs*(xr(75)+lzs*xr(76)))
- msp(80) = xr(77)+lzs*(xr(78)+lzs*(xr(79)+lzs*xr(80)))
- msp(81) = xr(81)+lzs*(xr(82)+lzs*lzs*xr(83))
- if(z.gt.0.01d0) msp(81) = MAX(msp(81),0.95d0)
- msp(82) = MAX(1.4d0,MIN(1.6d0,1.6d0+lzs*(0.764d0+0.3322d0*lzs)))
-* Rgamma
- msp(83) = MAX(xr(84)+lzs*(xr(85)+lzs*(xr(86)+lzs*xr(87))),
- & xr(96)+lzs*(xr(97)+lzs*xr(98)))
- msp(84) = MIN(0.d0,xr(88)+lzs*(xr(89)+lzs*(xr(90)+lzs*xr(91))))
- msp(84) = MAX(msp(84),xr(99)+lzs*(xr(100)+lzs*xr(101)))
- msp(85) = xr(92)+lzs*(xr(93)+lzs*(xr(94)+lzs*xr(95)))
- msp(85) = MAX(0.d0,MIN(msp(85),7.454d0+9.046d0*lzs))
- msp(86) = MIN(xr(102)+lzs*xr(103),MAX(2.d0,-13.3d0-18.6d0*lzs))
- msp(87) = MIN(1.5d0,MAX(0.4d0,2.493d0+1.1475d0*lzs))
- msp(88) = MAX(1.d0,MIN(1.27d0,0.8109d0-0.6282d0*lzs))
- msp(88) = MAX(msp(88),0.6355d0-0.4192d0*lzs)
- msp(89) = MAX(5.855420d-02,-0.2711d0-lzs*(0.5756d0+0.0838d0*lzs))
-* Rhook
- msp(90) = xr(104)+lzs*(xr(105)+lzs*(xr(106)+lzs*xr(107)))
- msp(91) = xr(108)+lzs*(xr(109)+lzs*(xr(110)+lzs*xr(111)))
- msp(92) = xr(112)+lzs*(xr(113)+lzs*(xr(114)+lzs*xr(115)))
- msp(93) = xr(116)+lzs*(xr(117)+lzs*(xr(118)+lzs*xr(119)))
- msp(94) = MIN(1.25d0,
- & MAX(1.1d0,1.9848d0+lzs*(1.1386d0+0.3564d0*lzs)))
- msp(95) = 0.063d0 + lzs*(0.0481d0 + 0.00984d0*lzs)
- msp(96) = MIN(1.3d0,MAX(0.45d0,1.2d0+2.45d0*lzs))
-* Lneta
- if(z.gt.0.0009d0)then
- msp(97) = 10.d0
- else
- msp(97) = 20.d0
- endif
-* Lbgb
- gbp(1) = xg(1)+lzs*(xg(2)+lzs*(xg(3)+lzs*xg(4)))
- gbp(2) = xg(5)+lzs*(xg(6)+lzs*(xg(7)+lzs*xg(8)))
- gbp(3) = xg(9)+lzs*(xg(10)+lzs*(xg(11)+lzs*xg(12)))
- gbp(4) = xg(13)+lzs*(xg(14)+lzs*(xg(15)+lzs*xg(16)))
- gbp(5) = xg(17)+lzs*(xg(18)+lzs*xg(19))
- gbp(6) = xg(20)+lzs*(xg(21)+lzs*xg(22))
- gbp(3) = gbp(3)**gbp(6)
- gbp(7) = xg(23)
- gbp(8) = xg(24)
-* Lbagb
-* set gbp(16) = 1.d0 until it is reset later with an initial
-* call to Lbagbf using mass = zpars(2) and mhefl = 0.0
- gbp(9) = xg(25) + lzs*(xg(26) + lzs*xg(27))
- gbp(10) = xg(28) + lzs*(xg(29) + lzs*xg(30))
- gbp(11) = 15.d0
- gbp(12) = xg(31)+lzs*(xg(32)+lzs*(xg(33)+lzs*xg(34)))
- gbp(13) = xg(35)+lzs*(xg(36)+lzs*(xg(37)+lzs*xg(38)))
- gbp(14) = xg(39)+lzs*(xg(40)+lzs*(xg(41)+lzs*xg(42)))
- gbp(15) = xg(43)+lzs*xg(44)
- gbp(12) = gbp(12)**gbp(15)
- gbp(14) = gbp(14)**gbp(15)
- gbp(16) = 1.d0
-* Rgb
- gbp(17) = -4.6739d0-0.9394d0*lz
- gbp(17) = 10.d0**gbp(17)
- gbp(17) = MAX(gbp(17),-0.04167d0+55.67d0*z)
- gbp(17) = MIN(gbp(17),0.4771d0-9329.21d0*z**2.94d0)
- gbp(18) = MIN(0.54d0,0.397d0+lzs*(0.28826d0+0.5293d0*lzs))
- gbp(19) = MAX(-0.1451d0,-2.2794d0-lz*(1.5175d0+0.254d0*lz))
- gbp(19) = 10.d0**gbp(19)
- if(z.gt.0.004d0)then
- gbp(19) = MAX(gbp(19),0.7307d0+14265.1d0*z**3.395d0)
- endif
- gbp(20) = xg(45)+lzs*(xg(46)+lzs*(xg(47)+lzs*(xg(48)+
- & lzs*(xg(49)+lzs*xg(50)))))
- gbp(21) = xg(51)+lzs*(xg(52)+lzs*(xg(53)+lzs*(xg(54)+lzs*xg(55))))
- gbp(22) = xg(56)+lzs*(xg(57)+lzs*(xg(58)+lzs*(xg(59)+
- & lzs*(xg(60)+lzs*xg(61)))))
- gbp(23) = xg(62)+lzs*(xg(63)+lzs*(xg(64)+lzs*(xg(65)+lzs*xg(66))))
-* Ragb
- gbp(24) = MIN(0.99164d0-743.123d0*z**2.83d0,
- & 1.0422d0+lzs*(0.13156d0+0.045d0*lzs))
- gbp(25) = xg(67)+lzs*(xg(68)+lzs*(xg(69)+lzs*(xg(70)+
- & lzs*(xg(71)+lzs*xg(72)))))
- gbp(26) = xg(73)+lzs*(xg(74)+lzs*(xg(75)+lzs*(xg(76)+lzs*xg(77))))
- gbp(27) = xg(78)+lzs*(xg(79)+lzs*(xg(80)+lzs*(xg(81)+
- & lzs*(xg(82)+lzs*xg(83)))))
- gbp(28) = xg(84)+lzs*(xg(85)+lzs*(xg(86)+lzs*(xg(87)+lzs*xg(88))))
- gbp(29) = xg(89)+lzs*(xg(90)+lzs*(xg(91)+lzs*(xg(92)+
- & lzs*(xg(93)+lzs*xg(94)))))
- gbp(30) = xg(95)+lzs*(xg(96)+lzs*(xg(97)+lzs*(xg(98)+
- & lzs*(xg(99)+lzs*xg(100)))))
- m1 = zpars(2) - 0.2d0
- gbp(31) = gbp(29) + gbp(30)*m1
- gbp(32) = MIN(gbp(25)/zpars(2)**gbp(26),gbp(27)/zpars(2)**gbp(28))
-* Mchei
- gbp(33) = xg(101)**4
- gbp(34) = xg(102)*4.d0
-* Mcagb
- gbp(35) = xg(103)+lzs*(xg(104)+lzs*(xg(105)+lzs*xg(106)))
- gbp(36) = xg(107)+lzs*(xg(108)+lzs*(xg(109)+lzs*xg(110)))
- gbp(37) = xg(111)+lzs*xg(112)
- gbp(35) = gbp(35)**4
- gbp(36) = gbp(36)*4.d0
- gbp(37) = gbp(37)**4
-* Lhei
-* set gbp(41) = -1.d0 until it is reset later with an initial
-* call to Lheif using mass = zpars(2) and mhefl = 0.0
- gbp(38) = xh(1)+lzs*xh(2)
- gbp(39) = xh(3)+lzs*xh(4)
- gbp(40) = xh(5)
- gbp(41) = -1.d0
- gbp(42) = xh(6)+lzs*(xh(7)+lzs*xh(8))
- gbp(43) = xh(9)+lzs*(xh(10)+lzs*xh(11))
- gbp(44) = xh(12)+lzs*(xh(13)+lzs*xh(14))
- gbp(42) = gbp(42)**2
- gbp(44) = gbp(44)**2
-* Lhe
- gbp(45) = xh(15)+lzs*(xh(16)+lzs*xh(17))
- if(lzs.gt.-1.d0)then
- gbp(46) = 1.d0 - xh(19)*(lzs+1.d0)**xh(18)
- else
- gbp(46) = 1.d0
- endif
- gbp(47) = xh(20)+lzs*(xh(21)+lzs*xh(22))
- gbp(48) = xh(23)+lzs*(xh(24)+lzs*xh(25))
- gbp(45) = gbp(45)**gbp(48)
- gbp(47) = gbp(47)**gbp(48)
- gbp(46) = gbp(46)/zpars(3)**0.1d0+(gbp(46)*gbp(47)-gbp(45))/
- & zpars(3)**(gbp(48)+0.1d0)
-* Rmin
- gbp(49) = xh(26)+lzs*(xh(27)+lzs*(xh(28)+lzs*xh(29)))
- gbp(50) = xh(30)+lzs*(xh(31)+lzs*(xh(32)+lzs*xh(33)))
- gbp(51) = xh(34)+lzs*(xh(35)+lzs*(xh(36)+lzs*xh(37)))
- gbp(52) = 5.d0+xh(38)*z**xh(39)
- gbp(53) = xh(40)+lzs*(xh(41)+lzs*(xh(42)+lzs*xh(43)))
- gbp(49) = gbp(49)**gbp(53)
- gbp(51) = gbp(51)**(2.d0*gbp(53))
-* The
-* set gbp(57) = -1.d0 until it is reset later with an initial
-* call to Thef using mass = zpars(2), mc = 0.0 and mhefl = 0.0
- gbp(54) = xh(44)+lzs*(xh(45)+lzs*(xh(46)+lzs*xh(47)))
- gbp(55) = xh(48)+lzs*(xh(49)+lzs*xh(50))
- gbp(55) = MAX(gbp(55),1.d0)
- gbp(56) = xh(51)
- gbp(57) = -1.d0
- gbp(58) = xh(52)+lzs*(xh(53)+lzs*(xh(54)+lzs*xh(55)))
- gbp(59) = xh(56)+lzs*(xh(57)+lzs*(xh(58)+lzs*xh(59)))
- gbp(60) = xh(60)+lzs*(xh(61)+lzs*(xh(62)+lzs*xh(63)))
- gbp(61) = xh(64)+lzs*xh(65)
- gbp(58) = gbp(58)**gbp(61)
- gbp(60) = gbp(60)**5
-* Tbl
- dum1 = zpars(2)/zpars(3)
- gbp(62) = xh(66)+lzs*xh(67)
- gbp(62) = -gbp(62)*log10(dum1)
- gbp(63) = xh(68)
- if(lzd.gt.0.d0) then
- gbp(64) = 1.d0-lzd*(xh(69)+lzd*(xh(70)+lzd*xh(71)))
- else
- gbp(64) = 1.d0
- end if
- gbp(65) = 1.d0-gbp(64)*dum1**gbp(63)
- gbp(66) = 1.d0 - lzd*(xh(77) + lzd*(xh(78) + lzd*xh(79)))
- gbp(67) = xh(72) + lzs*(xh(73) + lzs*(xh(74) + lzs*xh(75)))
- gbp(68) = xh(76)
-* Lzahb
- gbp(69) = xh(80) + lzs*(xh(81) + lzs*xh(82))
- gbp(70) = xh(83) + lzs*(xh(84) + lzs*xh(85))
- gbp(71) = 15.d0
- gbp(72) = xh(86)
- gbp(73) = xh(87)
-* Rzahb
- gbp(75) = xh(88) + lzs*(xh(89) + lzs*(xh(90) + lzs*xh(91)))
- gbp(76) = xh(92) + lzs*(xh(93) + lzs*(xh(94) + lzs*xh(95)))
- gbp(77) = xh(96) + lzs*(xh(97) + lzs*(xh(98) + lzs*xh(99)))
-***
-* finish Lbagb
- mhefl = 0.d0
- lx = lbagbf(zpars(2),mhefl)
- gbp(16) = lx
-* finish LHeI
- dum1 = 0.d0
- lhefl = lheif(zpars(2),mhefl)
- gbp(41) = (gbp(38)*zpars(2)**gbp(39)-lhefl)/
- & (EXP(zpars(2)*gbp(40))*lhefl)
-* finish THe
- thefl = thef(zpars(2),dum1,mhefl)*tbgbf(zpars(2))
- gbp(57) = (thefl-gbp(54))/(gbp(54)*EXP(gbp(56)*zpars(2)))
-* finish Tblf
- rb = ragbf(zpars(3),lheif(zpars(3),zpars(2)),mhefl)
- rr = 1.d0 - rminf(zpars(3))/rb
- rr = MAX(rr,1.0d-12)
- gbp(66) = gbp(66)/(zpars(3)**gbp(67)*rr**gbp(68))
-* finish Lzahb
- gbp(74) = lhefl*lHef(zpars(2))
-***
- kw = 0
- tm = 0.d0
- tn = 0.d0
- CALL star(kw,zpars(2),zpars(2),tm,tn,tscls,lums,GB,zpars)
- zpars(9) = mcgbf(lums(3),GB,lums(6))
- zpars(10) = mcgbf(lums(4),GB,lums(6))
-* set the hydrogen and helium abundances
- zpars(11) = 0.76d0 - 3.d0*z
- zpars(12) = 0.24d0 + 2.d0*z
-* set constant for low-mass CHeB stars
- zpars(13) = rminf(zpars(2))/
- & rgbf(zpars(2),lzahbf(zpars(2),zpars(9),zpars(2)))
-*
- zpars(14) = z**0.4d0
-*
- return
- end
-***
+
+ END
diff --git a/src/cosmic/tests/data/Params.ini b/src/cosmic/tests/data/Params.ini
index 712dfb8eb..c97c6eecf 100644
--- a/src/cosmic/tests/data/Params.ini
+++ b/src/cosmic/tests/data/Params.ini
@@ -74,6 +74,29 @@ bcm_bpp_initCond_filter = False
seed = 42
+[sse]
+
+; stellar_engine specifies which engine to use for individual single star
+; evolution. There are two choices: metisse and sse where sse uses the
+; 'Hurley' tracks fits to the Pols+1998 grid. All results run with COSMIC
+; prior to version 3.5 are equivalent to using sse as the enine
+
+stellar_engine = 'sse'
+
+; path_to_tracks specifies the path to hydrogen rich stellar evolution tracks
+; specified as EEPs (equivalent evolutionary points). If stellar_engine is not
+; metisse, leave the path as an empty string
+
+path_to_tracks = ''
+
+; path_to_tracks specifies the path to helium-star stellar evolution tracks
+; specified as EEPs (equivalent evolutionary points). If stellar_engine is not
+; metisse, leave the path as an empty string
+
+path_to_he_tracks = ''
+
+
+
[bse]
;;;;;;;;;;;;;;;;;;;;;;
@@ -154,8 +177,10 @@ acc2=1.5
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; alpha1 is the common-envelope efficiency parameter
-; default=1.0
-alpha1 = 1.0
+; It is a list so we can specify a different ejection efficiencies
+; for the primary and secondary
+; default=[1.0, 1.0]
+alpha1 = [1.0, 1.0]
; lambdaf is the binding energy factor for common envelope evolution
; lambdaf>0.0 uses variable lambda prescription written by Onno Pols
@@ -210,16 +235,19 @@ qcrit_array=[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]
;;;;;;;;;;;;;;;;;;
; kickflag sets the particular kick prescription to use
-; kickflag=0 uses the standard kick prescription, where kicks are drawn from a bimodal
+; kickflag=1 uses the standard kick prescription, where kicks are drawn from a bimodal
; distribution based on whether they go through FeCCSN or ECSN/USSN
-; kickflag=-1 uses the prescription from Giacobbo & Mapelli 2020 (Eq. 1); with their default parameters (=1.2 Msun, =9 Msun)
-; kickflag=-2 uses the prescription from Giacobbo & Mapelli 2020 (Eq. 2),
+; kickflag=2 uses the prescription from Giacobbo & Mapelli 2020 (Eq. 1)
+; with their default parameters (=1.2 Msun, =9 Msun)
+; kickflag=3 uses the prescription from Giacobbo & Mapelli 2020 (Eq. 2),
; which does not scale the kick by
-; kickflag=-3 uses the prescription from Bray & Eldridge 2016 (Eq. 1)
+; kickflag=4 uses the prescription from Bray & Eldridge 2016 (Eq. 1)
; with their default parameters (alpha=70 km/s, beta=120 km/s)
-; Note: sigmadiv, bhflag, bhsigmafrac, aic, and ussn are only used when kickflag=0
-; default = 0
-kickflag = 0
+; negative kickflags are the same as their positive counterparts, but using the Kiel & Hurley 2009
+; kick implementation instead of the default Pfahl et al. 2002
+; Note: sigmadiv, bhflag, bhsigmafrac, aic, and ussn are only used when abs(kickflag)=1
+; default = 1
+kickflag = -1
; sigma sets is the dispersion in the Maxwellian for the SN kick velocity in km/s
; default=265.0
@@ -366,7 +394,8 @@ don_lim = -1
; acc_lim = -2: assumes the accretion is limited to tkh_acc for MS/CHeB
; acc_lim = -3: assumes the accretion is limited by 10*tkh_acc for all fusing stars
; acc_lim = -4: assumes the accretion is limited by tkh_for all fusing stars
-acc_lim = -1
+; it is a list so we can specify different accretion limits for the primary and secondary
+acc_lim = [-1, -1]
;;;;;;;;;;;;;;;;;;;
;;; TIDES FLAGS ;;;
diff --git a/src/cosmic/tests/data/initial_conditions_for_testing.hdf5 b/src/cosmic/tests/data/initial_conditions_for_testing.hdf5
index dee882902..bf865ac20 100644
Binary files a/src/cosmic/tests/data/initial_conditions_for_testing.hdf5 and b/src/cosmic/tests/data/initial_conditions_for_testing.hdf5 differ
diff --git a/src/cosmic/tests/data/kick_initial_conditions.h5 b/src/cosmic/tests/data/kick_initial_conditions.h5
new file mode 100644
index 000000000..932893b04
Binary files /dev/null and b/src/cosmic/tests/data/kick_initial_conditions.h5 differ
diff --git a/src/cosmic/tests/meson.build b/src/cosmic/tests/meson.build
new file mode 100644
index 000000000..7cd621809
--- /dev/null
+++ b/src/cosmic/tests/meson.build
@@ -0,0 +1,11 @@
+python_sources = [
+ 'test_evolve.py',
+ 'test_match.py',
+ 'test_sample.py',
+ 'test_utils.py'
+]
+
+py3.install_sources(
+ python_sources,
+ subdir: 'cosmic'
+)
\ No newline at end of file
diff --git a/src/cosmic/tests/test_evolve.py b/src/cosmic/tests/test_evolve.py
index 4d040d7fb..f904372fa 100644
--- a/src/cosmic/tests/test_evolve.py
+++ b/src/cosmic/tests/test_evolve.py
@@ -19,9 +19,9 @@
TEST_DATA_DIR = os.path.join(os.path.split(__file__)[0], 'data')
PARAMS_INI = os.path.join(TEST_DATA_DIR,'Params.ini')
INIT_CONDITIONS = pd.read_hdf(os.path.join(TEST_DATA_DIR, 'initial_conditions_for_testing.hdf5'), key='initC')
+KICK_INITC = pd.read_hdf(os.path.join(TEST_DATA_DIR, 'kick_initial_conditions.h5'), key='initC')
init_conds_columns = initialbinarytable.INITIAL_CONDITIONS_COLUMNS_ALL
-
INIT_CONDITIONS_NO_BSE_COLUMNS = INIT_CONDITIONS[init_conds_columns]
BPP_DF = pd.read_hdf(os.path.join(TEST_DATA_DIR, 'unit_tests_results.hdf5'), key='bpp')
BCM_DF = pd.read_hdf(os.path.join(TEST_DATA_DIR, 'unit_tests_results.hdf5'), key='bcm')
@@ -34,24 +34,26 @@
2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0]
BSEDict['grflag'] = 1
BSEDict['don_lim'] = -1
-BSEDict['acc_lim'] = -1
+BSEDict['acc_lim'] = [-1, -1]
BSEDict['wd_mass_lim'] = 0
+SSEDict = {'stellar_engine': 'sse'}
+BSEDict['kickflag'] = -1
class TestEvolve(unittest.TestCase):
"""`TestCase` for the cosmic
"""
- def test_single_evolve_with_table(self):
+ #def test_single_evolve_with_table(self):
# Check that the sample_primary function samples mass correctly
- EvolvedBinaryBPP, EvolvedBinaryBCM, initCond, kick_info = Evolve.evolve(
- initialbinarytable=INIT_CONDITIONS, randomseed=523574)
+ # EvolvedBinaryBPP, EvolvedBinaryBCM, initCond, kick_info = Evolve.evolve(
+ # initialbinarytable=INIT_CONDITIONS, randomseed=523574)
- pd.testing.assert_frame_equal(EvolvedBinaryBPP, BPP_DF, check_dtype=False, check_exact=False)
- pd.testing.assert_frame_equal(EvolvedBinaryBCM, BCM_DF, check_dtype=False, check_exact=False)
+ # pd.testing.assert_frame_equal(EvolvedBinaryBPP, BPP_DF, check_dtype=False, check_exact=False)
+ # pd.testing.assert_frame_equal(EvolvedBinaryBCM, BCM_DF, check_dtype=False, check_exact=False)
def test_single_evolve_with_dict(self):
EvolvedBinaryBPP, EvolvedBinaryBCM, initCond, kick_info = Evolve.evolve(
- initialbinarytable=INIT_CONDITIONS_NO_BSE_COLUMNS, BSEDict=BSEDict, randomseed=523574)
+ initialbinarytable=INIT_CONDITIONS_NO_BSE_COLUMNS, BSEDict=BSEDict, SSEDict=SSEDict, randomseed=523574)
pd.testing.assert_frame_equal(EvolvedBinaryBPP, BPP_DF, check_dtype=False, check_exact=False)
pd.testing.assert_frame_equal(EvolvedBinaryBCM, BCM_DF, check_dtype=False, check_exact=False)
@@ -65,22 +67,22 @@ def test_single_evolve_with_inifile(self):
def test_single_evolve_with_dict_and_table(self):
EvolvedBinaryBPP, EvolvedBinaryBCM, initCond, kick_info = Evolve.evolve(
- initialbinarytable=INIT_CONDITIONS, BSEDict=BSEDict, randomseed=523574)
+ initialbinarytable=INIT_CONDITIONS, BSEDict=BSEDict, SSEDict=SSEDict, randomseed=523574)
pd.testing.assert_frame_equal(EvolvedBinaryBPP, BPP_DF, check_dtype=False, check_exact=False)
pd.testing.assert_frame_equal(EvolvedBinaryBCM, BCM_DF, check_dtype=False, check_exact=False)
- def test_multi_evolve_with_table(self):
+ #def test_multi_evolve_with_table(self):
# Check that the sample_primary function samples mass correctly
- EvolvedBinaryBPP, EvolvedBinaryBCM, initCond, kick_info = Evolve.evolve(
- initialbinarytable=INIT_CONDITIONS, n_per_block=100)
+ # EvolvedBinaryBPP, EvolvedBinaryBCM, initCond, kick_info = Evolve.evolve(
+ # initialbinarytable=INIT_CONDITIONS, n_per_block=100)
- pd.testing.assert_frame_equal(EvolvedBinaryBPP, BPP_DF, check_dtype=False, check_exact=False)
- pd.testing.assert_frame_equal(EvolvedBinaryBCM, BCM_DF, check_dtype=False, check_exact=False)
+ # pd.testing.assert_frame_equal(EvolvedBinaryBPP, BPP_DF, check_dtype=False, check_exact=False)
+ # pd.testing.assert_frame_equal(EvolvedBinaryBCM, BCM_DF, check_dtype=False, check_exact=False)
def test_multi_evolve_with_dict(self):
EvolvedBinaryBPP, EvolvedBinaryBCM, initCond, kick_info = Evolve.evolve(
- initialbinarytable=INIT_CONDITIONS_NO_BSE_COLUMNS, BSEDict=BSEDict, randomseed=523574, n_per_block=100)
+ initialbinarytable=INIT_CONDITIONS_NO_BSE_COLUMNS, BSEDict=BSEDict, SSEDict=SSEDict, randomseed=523574, n_per_block=100)
pd.testing.assert_frame_equal(EvolvedBinaryBPP, BPP_DF, check_dtype=False, check_exact=False)
pd.testing.assert_frame_equal(EvolvedBinaryBCM, BCM_DF, check_dtype=False, check_exact=False)
@@ -94,7 +96,13 @@ def test_multi_evolve_with_inifile(self):
def test_multi_evolve_with_dict_and_table(self):
EvolvedBinaryBPP, EvolvedBinaryBCM, initCond, kick_info = Evolve.evolve(
- initialbinarytable=INIT_CONDITIONS, BSEDict=BSEDict, randomseed=523574, n_per_block=100)
+ initialbinarytable=INIT_CONDITIONS, BSEDict=BSEDict, SSEDict=SSEDict, randomseed=523574, n_per_block=100)
pd.testing.assert_frame_equal(EvolvedBinaryBPP, BPP_DF, check_dtype=False, check_exact=False)
pd.testing.assert_frame_equal(EvolvedBinaryBCM, BCM_DF, check_dtype=False, check_exact=False)
+
+ #def test_ejection_velocity_pfahl(self):
+ # EvolvedBinaryBPP, EvolvedBinaryBCM, initCond, kick_info = Evolve.evolve(
+ # initialbinarytable=KICK_INITC, SSEDict=SSEDict)
+
+ # self.assertAlmostEqual(kick_info['vsys_2_total'].iloc[0], 17.322114, places=5)
diff --git a/src/cosmic/tests/test_kick.py b/src/cosmic/tests/test_kick.py
new file mode 100644
index 000000000..c4241cab4
--- /dev/null
+++ b/src/cosmic/tests/test_kick.py
@@ -0,0 +1,92 @@
+"""Unit test for cosmic kick routine
+"""
+
+__author__ = 'Tom Wagg '
+
+import os
+import unittest
+import numpy as np
+from scipy.stats import maxwell, norm
+import pandas as pd
+
+from cosmic.sample.initialbinarytable import InitialBinaryTable, INITIAL_CONDITIONS_COLUMNS_ALL
+from cosmic.evolve import Evolve, INITIAL_BINARY_TABLE_SAVE_COLUMNS
+
+import warnings
+warnings.filterwarnings("ignore")
+
+
+TEST_DATA_DIR = os.path.join(os.path.split(__file__)[0], 'data')
+INIT_CONDITIONS = pd.read_hdf(os.path.join(TEST_DATA_DIR, 'initial_conditions_for_testing.hdf5'), key='initC')
+BSEFlag_columns = list(set(INITIAL_BINARY_TABLE_SAVE_COLUMNS) - set(INITIAL_CONDITIONS_COLUMNS_ALL))
+BSEDict = INIT_CONDITIONS[BSEFlag_columns].to_dict(orient='index')[0]
+BSEDict['qcrit_array'] = [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]
+BSEDict['natal_kick_array'] = [[-100.0,-100.0,-100.0,-100.0,0.0], [-100.0,-100.0,-100.0,-100.0,0.0]]
+BSEDict['fprimc_array'] = [2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,
+ 2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,
+ 2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0]
+BSEDict['grflag'] = 1
+BSEDict['don_lim'] = -1
+BSEDict['acc_lim'] = -1
+BSEDict['wd_mass_lim'] = 0
+
+# avoid using the same randomseed
+del BSEDict["bin_num"], BSEDict["randomseed"]
+
+
+class TestKick(unittest.TestCase):
+ """`TestCase` for the cosmic kick routine
+ """
+
+ def test_disberg(self):
+ """Test the Disberg kick routine
+ """
+ # define a simple single star that will result in a kick
+ single_star = InitialBinaryTable.InitialBinaries(
+ m1=20 + np.random.rand() * 0.01, m2=0.0, porb=0,
+ ecc=-1, tphysf=100.0, kstar1=1, kstar2=15,
+ metallicity=0.02
+ )
+ N = 10000
+ ibt = single_star.loc[single_star.index.repeat(N)].reset_index()
+
+ # turn off ECSN and bh fallback
+ BSEDict["ecsn"] = 0
+ BSEDict["ecsn_mlow"] = 0
+ BSEDict["bhflag"] = 3
+
+ # evolve using disberg
+ BSEDict["kickflag"] = 5
+ _, _, _, kick_info = Evolve.evolve(initialbinarytable=ibt, BSEDict=BSEDict, nproc=1)
+ natal_kicks_disberg = kick_info['natal_kick'][kick_info['natal_kick'] != 0.0]
+
+ # fit a lognormal distribution and ensure it matches the expected values
+ mu_d, sigma_d = norm.fit(np.log(natal_kicks_disberg))
+ self.assertTrue(np.round(mu_d, 2) == 5.61)
+ self.assertTrue(np.round(sigma_d, 2) == 0.69)
+
+ def test_hobbs(self):
+ """Test the Hobbs kick routine
+ """
+ # define a simple single star that will result in a kick
+ single_star = InitialBinaryTable.InitialBinaries(
+ m1=20 + np.random.rand() * 0.01, m2=0.0, porb=0,
+ ecc=-1, tphysf=100.0, kstar1=1, kstar2=15,
+ metallicity=0.02
+ )
+ N = 10000
+ ibt = single_star.loc[single_star.index.repeat(N)].reset_index()
+
+ # turn off ECSN and bh fallback
+ BSEDict["ecsn"] = 0
+ BSEDict["ecsn_mlow"] = 0
+ BSEDict["bhflag"] = 3
+
+ # evolve using hobbs
+ BSEDict["kickflag"] = 1
+ _, _, _, kick_info = Evolve.evolve(initialbinarytable=ibt, BSEDict=BSEDict, nproc=1)
+ natal_kicks = kick_info['natal_kick'][kick_info['natal_kick'] != 0.0]
+
+ # fit a maxwellian to the hobbs natal kicks and ensure it matches the expected values
+ _, s_hobbs = maxwell.fit(natal_kicks, floc=0.0)
+ self.assertTrue(np.round(s_hobbs, -1) == 260)
diff --git a/src/cosmic/tests/test_sample.py b/src/cosmic/tests/test_sample.py
index e811d9451..f87016816 100644
--- a/src/cosmic/tests/test_sample.py
+++ b/src/cosmic/tests/test_sample.py
@@ -42,6 +42,9 @@
N_BINARY_SELECT = 85
VANHAAFTEN_BINFRAC_MAX = 0.9989087986493874
VANHAAFTEN_BINFRAC_MIN = 0.6192803136799157
+OFFNER_MASS_RANGES = [(0.075,0.15), (0.15,0.30), (0.3,0.6), (0.75,1.00), (0.85,1.25), (1.00,1.25), (1.6,2.4), (3,5), (5,8), (8,17), (17,50)]
+OFFNER_DATA = [0.19, 0.23, 0.30, 0.42, 0.47, 0.50, 0.68, 0.81, 0.89, 0.93, 0.96]
+OFFNER_ERRORS = [0.03, 0.02, 0.02, 0.03, 0.03, 0.04, 0.07, 0.06, 0.05, 0.04, 0.04]
MULTIDIM_BINFRAC_MAX = 0.6146916774140262
MULTIDIM_BINFRAC_MIN = 0.13786300908773025
CONST_SFR_SUM = 460028.2453521937
@@ -189,6 +192,16 @@ def test_sample_secondary(self):
slope = linear_fit(q)
self.assertEqual(np.round(slope, 1), FLAT_SLOPE)
+ def test_sample_q(self):
+ """Test you can sample different mass ratio distributions"""
+ np.random.seed(2)
+ mass1, total_mass = SAMPLECLASS.sample_primary(primary_model='kroupa01', size=10000000)
+ for slope in [0, 1, 2]:
+ mass2 = SAMPLECLASS.sample_secondary(primary_mass=mass1, q_power_law=slope, qmin=0.0)
+ q = mass2 / mass1
+ fit_slope = power_law_fit(q)
+ self.assertEqual(np.round(fit_slope, 1), slope)
+
def test_binary_select(self):
np.random.seed(2)
# Check that the binary select function chooses binarity properly
@@ -207,6 +220,34 @@ def test_binary_fraction(self):
m1_b, m1_s, binfrac, bin_index = SAMPLECLASS.binary_select(primary_mass=np.arange(1,100), binfrac_model='vanHaaften')
self.assertEqual(binfrac.max(), VANHAAFTEN_BINFRAC_MAX)
self.assertEqual(binfrac.min(), VANHAAFTEN_BINFRAC_MIN)
+ test_fracs = []
+ test_errs = []
+ primary_mass = np.array([float(x) for x in np.logspace(np.log10(0.08), np.log10(150), num=100000)])
+ m1_b, m1_s, binfrac, bin_index = SAMPLECLASS.binary_select(primary_mass=primary_mass, binfrac_model='offner22')
+ for i in range(len(OFFNER_MASS_RANGES)):
+ low, high = OFFNER_MASS_RANGES[i][0], OFFNER_MASS_RANGES[i][1]
+ offner_value = OFFNER_DATA[i]
+ offner_error = OFFNER_ERRORS[i]
+ bins_count = len(m1_b[(m1_b >= low) & (m1_b <= high)])
+ singles_count = len(m1_s[(m1_s >= low) & (m1_s <= high)])
+ bin_frac = bins_count / (bins_count + singles_count)
+ error = abs(offner_value - bin_frac)
+ self.assertLess(error, offner_error)
+
+
+ test_fracs = []
+ test_errs = []
+ primary_mass = np.array([float(x) for x in np.logspace(np.log10(0.08), np.log10(150), num=100000)])
+ m1_b, m1_s, binfrac, bin_index = SAMPLECLASS.binary_select(primary_mass=primary_mass, binfrac_model='offner22')
+ for i in range(len(OFFNER_MASS_RANGES)):
+ low, high = OFFNER_MASS_RANGES[i][0], OFFNER_MASS_RANGES[i][1]
+ offner_value = OFFNER_DATA[i]
+ offner_error = OFFNER_ERRORS[i]
+ bins_count = len(m1_b[(m1_b >= low) & (m1_b <= high)])
+ singles_count = len(m1_s[(m1_s >= low) & (m1_s <= high)])
+ bin_frac = bins_count / (bins_count + singles_count)
+ error = abs(offner_value - bin_frac)
+ self.assertLess(error, offner_error)
def test_msort(self):
np.random.seed(2)
@@ -236,12 +277,23 @@ def test_sample_porb(self):
mass2 = SAMPLECLASS.sample_secondary(primary_mass = mass1, qmin=0.1)
rad1 = SAMPLECLASS.set_reff(mass=mass1, metallicity=0.02)
rad2 = SAMPLECLASS.set_reff(mass=mass2, metallicity=0.02)
+ print(rad1,rad2)
porb,aRL_over_a = SAMPLECLASS.sample_porb(
mass1, mass2, rad1, rad2, 'sana12', size=mass1.size
)
power_slope = power_law_fit(np.log10(porb))
self.assertEqual(np.round(power_slope, 2), SANA12_PORB_POWER_LAW)
+ # now some custom power laws
+ for slope in [-0.5, 0.5, 1]:
+ porb,aRL_over_a = SAMPLECLASS.sample_porb(
+ mass1, mass2, rad1, rad2, porb_model={
+ "min": 0.15, "max": 5, "slope": slope
+ }, size=mass1.size
+ )
+ power_slope = power_law_fit(np.log10(porb))
+ self.assertEqual(np.round(power_slope, 1), slope)
+
np.random.seed(5)
# next do Renzo+19
m1_high = mass1+15
diff --git a/src/cosmic/tests/test_utils.py b/src/cosmic/tests/test_utils.py
index 8938a44c4..4dd6ee592 100644
--- a/src/cosmic/tests/test_utils.py
+++ b/src/cosmic/tests/test_utils.py
@@ -144,14 +144,15 @@ def test_binwidth_selector(self):
self.assertTrue(bw.round(3) == BW_KNUTH)
def test_error_check(self):
- BSEDict = {'xi': 0.5, 'bhflag': 1, 'neta': 0.5, 'windflag': 3, 'rtmsflag' : 0, 'wdflag': 0, 'alpha1': 1.0, 'pts1': 0.05, 'pts3': 0.02, 'pts2': 0.01, 'epsnov': 0.001, 'hewind': 1.0, 'ck': 1000, 'bwind': 0.0, 'lambdaf': 0.5, 'mxns': 3.0, 'beta': -1.0, 'tflag': 1, 'acc2': 1.5, 'nsflag': 4, 'ceflag': 0, 'eddfac': 1.0, 'ifflag': 0, 'bconst': 3000, 'sigma': 265.0, 'gamma': -2.0, 'pisn': 45.0, 'natal_kick_array' :[[-100.0,-100.0,-100.0,-100.0,0.0], [-100.0,-100.0,-100.0,-100.0,0.0]], 'bhsigmafrac' : 1.0, 'polar_kick_angle' : 90, 'qcrit_array' : [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0], 'cekickflag' : 2, 'cehestarflag' : 0, 'cemergeflag' : 0, 'ecsn' : 2.5, 'ecsn_mlow' : 1.4, 'aic' : 1, 'ussn' : 0, 'sigmadiv' :-20.0, 'qcflag' : 3, 'eddlimflag' : 0, 'fprimc_array' : [2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0], 'rembar_massloss' : 0.5, 'zsun' : 0.02, 'kickflag' : 0, 'grflag' : 1, 'acc_lim' : -1, 'don_lim' : -1}
+ BSEDict = {'xi': 0.5, 'bhflag': 1, 'neta': 0.5, 'windflag': 3, 'rtmsflag' : 0, 'wdflag': 0, 'alpha1': [1.0, 1.0], 'pts1': 0.05, 'pts3': 0.02, 'pts2': 0.01, 'epsnov': 0.001, 'hewind': 1.0, 'ck': 1000, 'bwind': 0.0, 'lambdaf': 0.5, 'mxns': 3.0, 'beta': -1.0, 'tflag': 1, 'acc2': 1.5, 'nsflag': 4, 'ceflag': 0, 'eddfac': 1.0, 'ifflag': 0, 'bconst': 3000, 'sigma': 265.0, 'gamma': -2.0, 'pisn': 45.0, 'natal_kick_array' :[[-100.0,-100.0,-100.0,-100.0,0.0], [-100.0,-100.0,-100.0,-100.0,0.0]], 'bhsigmafrac' : 1.0, 'polar_kick_angle' : 90, 'qcrit_array' : [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0], 'cekickflag' : 2, 'cehestarflag' : 0, 'cemergeflag' : 0, 'ecsn' : 2.5, 'ecsn_mlow' : 1.4, 'aic' : 1, 'ussn' : 0, 'sigmadiv' :-20.0, 'qcflag' : 3, 'eddlimflag' : 0, 'fprimc_array' : [2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0], 'rembar_massloss' : 0.5, 'zsun' : 0.02, 'kickflag' : -1, 'grflag' : 1, 'acc_lim' : [-1, -1], 'don_lim' : -1}
+ SSEDict = {'stellar_engine': 'sse'}
filters = {'binary_state': [0], 'timestep_conditions' : 'dtp=None'}
convergence = {'convergence_params': ['mass_1', 'mass_2', 'sep', 'ecc'], 'pop_select': 'formation',\
'match': -5.0, 'convergence_limits' : {"sep" : [0,1000]}, 'match' : -3.0,\
'apply_convergence_limits' : True}
sampling = {'sampling_method': 'multidim', 'SF_start': '13700.0', 'SF_duration' : 0.0, 'metallicity': 0.02, 'keep_singles': False}
- utils.error_check(BSEDict,filters,convergence,sampling)
- utils.error_check(BSEDict)
+ utils.error_check(BSEDict,SSEDict,filters,convergence,sampling)
+ utils.error_check(BSEDict,SSEDict)
assert 1==1
def test_warning_check(self):
@@ -160,7 +161,7 @@ def test_warning_check(self):
def test_no_RL_check_for_singles(self):
"""Make sure you don't get a divide by zero error when checking for Roche Lobe Overflow"""
- BSEDict = {'xi': 1.0, 'bhflag': 1, 'neta': 0.5, 'windflag': 3, 'wdflag': 1, 'alpha1': 1.0,
+ BSEDict = {'xi': 1.0, 'bhflag': 1, 'neta': 0.5, 'windflag': 3, 'wdflag': 1, 'alpha1': [1.0,1.0],
'pts1': 0.001, 'pts3': 0.02, 'pts2': 0.01, 'epsnov': 0.001, 'hewind': 0.5,
'ck': 1000, 'bwind': 0.0, 'lambdaf': 0.0, 'mxns': 3.0, 'beta': -1.0, 'tflag': 1,
'acc2': 1.5, 'grflag': 1, 'remnantflag': 4, 'ceflag': 0, 'eddfac': 1.0,
@@ -176,9 +177,11 @@ def test_no_RL_check_for_singles(self):
2.0/21.0, 2.0/21.0, 2.0/21.0, 2.0/21.0,
2.0/21.0, 2.0/21.0, 2.0/21.0, 2.0/21.0],
'bhspinflag': 0, 'bhspinmag': 0.0, 'rejuv_fac': 1.0, 'rejuvflag': 0, 'htpmb': 1,
- 'ST_cr': 1, 'ST_tide': 1, 'bdecayfac': 1, 'rembar_massloss': 0.5, 'kickflag': 0,
- 'zsun': 0.014, 'bhms_coll_flag': 0, 'don_lim': -1, 'acc_lim': -1,
+ 'ST_cr': 1, 'ST_tide': 1, 'bdecayfac': 1, 'rembar_massloss': 0.5, 'kickflag': -1,
+ 'zsun': 0.014, 'bhms_coll_flag': 0, 'don_lim': -1, 'acc_lim': [-1,-1],
'rtmsflag': 0, 'wd_mass_lim': 1}
+
+ SSEDict = {'stellar_engine': 'sse'}
initial_binaries = InitialBinaryTable.sampler('independent', np.linspace(0, 15, 16), np.linspace(0, 15, 16),
binfrac_model=0.5, SF_start=10.0,
@@ -188,7 +191,7 @@ def test_no_RL_check_for_singles(self):
with warnings.catch_warnings():
warnings.simplefilter("error")
- Evolve.evolve(initialbinarytable=initial_binaries, BSEDict=BSEDict)
+ Evolve.evolve(initialbinarytable=initial_binaries, BSEDict=BSEDict, SSEDict=SSEDict)
def test_convert_kstar_evol_type(self):
# convert to string
diff --git a/src/cosmic/utils.py b/src/cosmic/utils.py
index eae256cae..b01439236 100644
--- a/src/cosmic/utils.py
+++ b/src/cosmic/utils.py
@@ -29,6 +29,7 @@
import json
import itertools
import os.path
+import glob
from configparser import ConfigParser
from .bse_utils.zcnsts import zcnsts
@@ -653,6 +654,8 @@ def rndm(a, b, g, size):
fixed by inputs
"""
+ if g == -1:
+ raise ValueError("Power law index cannot be exactly -1")
r = np.random.random(size=size)
ag, bg = a ** (g + 1), b ** (g + 1)
return (ag + (bg - ag) * r) ** (1.0 / (g + 1))
@@ -855,7 +858,7 @@ def get_porb_norm(Z, close_logP=4.0, wide_logP=6.0, binfrac_tot_solar=0.66, Z_su
normalization factor for kde for wide binaries
'''
from scipy.stats import norm
- from scipy.integrate import trapz
+ from scipy.integrate import trapezoid
from scipy.interpolate import interp1d
# fix to values used in Moe+19
@@ -866,7 +869,7 @@ def get_porb_norm(Z, close_logP=4.0, wide_logP=6.0, binfrac_tot_solar=0.66, Z_su
logP_pdf = norm.pdf(log_P, loc=4.9, scale=2.3)
# set up the wide binary fraction inflection point
- norm_wide = binfrac_tot_solar/trapz(logP_pdf, log_P)
+ norm_wide = binfrac_tot_solar/trapezoid(logP_pdf, log_P)
# set up the close binary fraction inflection point
FeHclose = np.linspace(-3.0, 0.5, 100)
@@ -877,7 +880,7 @@ def get_porb_norm(Z, close_logP=4.0, wide_logP=6.0, binfrac_tot_solar=0.66, Z_su
fclose_interp = interp1d(Zclose, fclose)
fclose_Z = fclose_interp(Z)
- norm_close = fclose_Z/trapz(logP_pdf[log_P < close_logP], log_P[log_P < close_logP])
+ norm_close = fclose_Z/trapezoid(logP_pdf[log_P < close_logP], log_P[log_P < close_logP])
return norm_wide, norm_close
@@ -904,7 +907,7 @@ def get_met_dep_binfrac(met):
neval = 5000
from scipy.interpolate import interp1d
- from scipy.integrate import trapz
+ from scipy.integrate import trapezoid
from scipy.stats import norm
norm_wide, norm_close = get_porb_norm(met)
@@ -919,15 +922,18 @@ def get_met_dep_binfrac(met):
np.linspace(wide_logP, logP_hi_lim, neval),])
y_dat = np.hstack([prob_close, prob_interp_int(np.linspace(close_logP, wide_logP, neval)), prob_wide])
- binfrac = trapz(y_dat, x_dat)/0.66 * 0.5
+ binfrac = trapezoid(y_dat, x_dat)/0.66 * 0.5
return float(np.round(binfrac, 2))
-def error_check(BSEDict, filters=None, convergence=None, sampling=None):
- """Checks that values in BSEDict, filters, and convergence are viable"""
+def error_check(BSEDict, SSEDict, filters=None, convergence=None, sampling=None):
+ """Checks that values in BSEDict, SSEDict,filters, and convergence are viable"""
if not isinstance(BSEDict, dict):
raise ValueError("BSE flags must be supplied via a dictionary")
+ if not isinstance(SSEDict, dict):
+ raise ValueError("SSE flags must be supplied via a dictionary")
+
if filters is not None:
if not isinstance(filters, dict):
raise ValueError("Filters criteria must be supplied via a dictionary")
@@ -1087,6 +1093,65 @@ def error_check(BSEDict, filters=None, convergence=None, sampling=None):
)
)
+ # SSEDict
+ flag = "stellar_engine"
+ acceptable_stellar_engines = ["sse", "metisse"]
+ if flag in SSEDict.keys():
+ if SSEDict[flag] not in acceptable_stellar_engines:
+ raise ValueError(
+ "{0} needs to be one of 'sse', 'metisse' (you set it to {1})".format(
+ flag, SSEDict[flag]
+ )
+ )
+
+ flag = "path_to_tracks"
+ if "stellar_engine" in SSEDict.keys():
+ if SSEDict["stellar_engine"] == "metisse":
+ if SSEDict[flag] == '':
+ raise ValueError(
+ "If you want to use METISSE as the stellar engine, {0} needs to be a non-empty string".format (
+ flag
+ )
+ )
+ elif SSEDict[flag] == None:
+ raise ValueError(
+ "If you want to use METISSE as the stellar engine, {0} needs to be a non-empty string".format (
+ flag
+ )
+ )
+ else:
+ metallicity_file = glob.glob(SSEDict[flag]+'/*_metallicity.in')
+ if metallicity_file == []:
+ raise ValueError(
+ "No metallicity file found in {0}. Make sure that {1} is valid".format (
+ SSEDict[flag], flag
+ )
+ )
+
+ flag = "path_to_he_tracks"
+ if "stellar_engine" in SSEDict.keys():
+ if SSEDict["stellar_engine"] == "metisse":
+ if SSEDict[flag] == '':
+ warnings.warn(
+ "If you want to use METISSE as the stellar engine,{0} needs to be a non-empty string, otheriwse SSE formulae will be used for helium stars".format (
+ flag
+ )
+ )
+ elif SSEDict[flag] == None:
+ raise ValueError(
+ "If you want to use METISSE as the stellar engine, {0} needs to be a non-empty string".format (
+ flag
+ )
+ )
+ else:
+ metallicity_file = glob.glob(SSEDict[flag]+'/*_metallicity.in')
+ if metallicity_file == []:
+ raise ValueError(
+ "No metallicity file for helium star tracks found in {0}. Make sure that {1} is valid".format (
+ SSEDict[flag], flag
+ )
+ )
+
# BSEDict
flag = "dtp"
if flag in BSEDict.keys():
@@ -1204,12 +1269,13 @@ def error_check(BSEDict, filters=None, convergence=None, sampling=None):
flag = "alpha1"
if flag in BSEDict.keys():
- if BSEDict[flag] <= 0:
- raise ValueError(
- "'{0:s}' needs to be greater than 0 (you set it to '{1:0.2f}')".format(
- flag, BSEDict[flag]
+ for f in BSEDict[flag]:
+ if f <= 0:
+ raise ValueError(
+ "'{0:s}' needs to be greater than 0 (you set it to '{1:0.2f}')".format(
+ flag, BSEDict[flag]
+ )
)
- )
flag = "lambdaf"
# --- all numbers are valid
flag = "ceflag"
@@ -1278,9 +1344,9 @@ def error_check(BSEDict, filters=None, convergence=None, sampling=None):
flag = "kickflag"
if flag in BSEDict.keys():
- if BSEDict[flag] not in [0, -1, -2, -3]:
+ if abs(BSEDict[flag]) not in [1, 2, 3, 4, 5]:
raise ValueError(
- "'{0:s}' needs to be set to either 0, -1, -2, or -3 (you set it to '{1:d}')".format(
+ "abs('{0:s}') needs to be set to value in 1 - 5 inclusive (you set it to '{1:d}')".format(
flag, BSEDict[flag]
)
)
@@ -1424,9 +1490,9 @@ def error_check(BSEDict, filters=None, convergence=None, sampling=None):
)
flag = "gamma"
if flag in BSEDict.keys():
- if (BSEDict[flag] < 0) and (BSEDict[flag] != -1) and (BSEDict[flag] != -2):
+ if (BSEDict[flag] < 0) and (BSEDict[flag] != -1) and (BSEDict[flag] != -2) and (BSEDict[flag] != -3):
raise ValueError(
- "'{0:s}' needs to either be set to -2, -1, or a positive number (you set it to '{1:0.2f}')".format(
+ "'{0:s}' needs to either be set to -3, -2, -1, or a positive number (you set it to '{1:0.2f}')".format(
flag, BSEDict[flag]
)
)
@@ -1568,13 +1634,14 @@ def error_check(BSEDict, filters=None, convergence=None, sampling=None):
)
flag = "acc_lim"
if flag in BSEDict.keys():
- if BSEDict[flag] not in [-1, -2, -3, -4]:
- if BSEDict[flag] < 0.0:
- raise ValueError(
- "'{0:s}' needs to be set to -1, -2, -3, -4 or be >=0 (you set it to '{1:0.2f}')".format(
- flag, BSEDict[flag]
+ for f in BSEDict[flag]:
+ if f not in [-1, -2, -3, -4]:
+ if f < 0.0:
+ raise ValueError(
+ "'{0:s}' needs to be set to -1, -2, -3, -4 or be >=0 (you set it to '{1:0.2f}')".format(
+ flag, BSEDict[flag]
+ )
)
- )
flag = "wd_mass_lim"
if flag in BSEDict.keys():
@@ -1594,7 +1661,8 @@ def check_initial_conditions(full_initial_binary_table):
Only warning provided right now is if star begins in Roche lobe
overflow
"""
-
+ #from cosmic import _evolvebin
+
def rzamsf(m):
"""A function to evaluate Rzams
( from Tout et al., 1996, MNRAS, 281, 257 ).
@@ -1624,7 +1692,7 @@ def rzamsf(m):
else:
rzams1 = rzamsf(mass1)
rzams2 = rzamsf(mass2)
-
+
# assume some time step in order to calculate sep
yeardy = 365.24
aursun = 214.95
@@ -1699,7 +1767,8 @@ def convert_kstar_evol_type(bpp):
14: "blue straggler",
15: "supernova of primary",
16: "supernova of secondary",
- 100: "RLOF interpolation timeout error"
+ 100: "RLOF interpolation timeout error",
+ 101: "METISSE error"
}
evolve_type_string_to_int_dict = {
@@ -1814,6 +1883,8 @@ def _eval(node):
dictionary["convergence"] = 0
if "sampling" not in dictionary.keys():
dictionary["sampling"] = 0
+ if "sse" not in dictionary.keys():
+ dictionary["sse"] = 0
continue
dictionary[section] = {}
for option in cp.options(section):
@@ -1829,14 +1900,15 @@ def _eval(node):
finally:
if option not in dictionary[section].keys():
raise ValueError("We have detected an error in your inifile. The folloiwng parameter failed to be read correctly: {0}".format(option))
-
+
+ SSEDict = dictionary["sse"]
BSEDict = dictionary["bse"]
seed_int = int(dictionary["rand_seed"]["seed"])
filters = dictionary["filters"]
convergence = dictionary["convergence"]
sampling = dictionary["sampling"]
- return BSEDict, seed_int, filters, convergence, sampling
+ return BSEDict, SSEDict, seed_int, filters, convergence, sampling
class VariableKey(object):