; COSMIC INI file
[filters]
; binary_state determines which types of binaries endstates to retain
; 0 alive today, 1 merged, 2 disrupted
; default = [0,1,2]
binary_state = [0,1]

; timestep_conditions allow a user to pick specific time resolutions
; to print at targetted stages of the binary evolution
; This is used in conjuction with the [bse] section value dtp to determine the resolution
; at which thing are printed into the so called bcm array
; For example, if you only want dtp set to a value while the system is
; intact i.e. has not merged or been disrupted you could do so with the following
; timestep_conditions =[['binstate==0', 'dtp=1.0']]
; Special examples include
; timestep_conditions = 'dtp=None', only the final time step is printed to the bcm array
; timestep_conditions = 'dtp=1.0', a single timestep applied to all evolutionary stages of the binary
timestep_conditions = 'dtp=None'

[sampling]
; Specify if you would like to sample initial conditions via
; the independent method (independent) or would like to sample
; initial conditions follow Moe & Di Stefano (2017) (multidim)
sampling_method = multidim

; If the sampling_method is independent, there are different
; models available for the inital eccentricity, orbital period,
; primary mass and binary fraction

; Selects the primary mass model: salpeter55, kroupa93, kroupa01
;primary_model = kroupa01

; Selects the orbital period model from: 
;   sana12, log_uniform, renzo19, raghavan10, moe19
;porb_model = sana12

; Selects the eccentricity model: thermal, uniform, sana12
;ecc_model = sana12

; kwarg which sets the minimum mass ratio for sampling the secondary
; where the mass ratio distribution is flat in q
; if q > 0, qmin sets the minimum mass ratio
; q = -1, this limits the minimum mass ratio to be set 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
; if qmin < 0.
; Note that if qmin is specified then m2_min should not be specified
;qmin = -1

; kwarg which sets the minimum secondary mass for sampling
; the secondary as uniform in mass_2 between m2_min and mass_1
; Note that if m2_min is specified then qmin should not be specified
;m2_min = 0.1

; Selects the binary fraction
;binfrac_model = 0.5

; Sets the time in the past when star formation initiates in Myr
SF_start = 13700.0

; Sets the duration of constant star formation in Myr
SF_duration = 0.0

; Metallicity of the population of initial binaries
metallicity = 0.014

; Also evolve single stars that come out of the sampler
keep_singles = False

[convergence]

; pop_select tells cosmic-pop which sub-population to select
; from the evolved population. It is used in combination 
; with the specified final_kstar1 and final_kstar2 values
; to select the binary stars of interest from the
; evolved population (which includes the bcm, bpp, initC,
; and kick_info dataframes)

; formation computes convergence on binary properties
; at formation with user-specified final kstars

; 1_SN computes convergence on binary properties
; just before the first supernova for the population with
; user-specified final kstars

; 2_SN computes convergence on binary properties
; just before the second supernova for the population with
; user-specified final kstars

; disruption computes convergence on binary properties
; just before disruption of the population with
; user-specified final kstars

; final_state computes convergence on binary properties
; after the full evolution specified by the user-supplied evolution time
; and with the user specified final kstars

; XRB_form computes convergence on binary properties
; at the start of RLO following the first supernova on the population with
; user-specified final kstars
pop_select = formation

; convergence_params specifies the list of parameters for which you
; would like to track the distribution shapes
; Options include mass_1, mass_2, sep, porb, ecc, massc_1, massc_2
; rad_1, rad_2
convergence_params = [mass_1,mass_2,porb,ecc]

; convergence_limits is a dictionary that can contain limits for convergence params
; convergence_limits = {"mass_1" : [0, 20], "sep" : [0,5000]}
convergence_limits = {}

; apply_convergence_limits filters the evolved binary population 
; to only the binaries that satisfy the convergence limits
; selection criteria if True
apply_convergence_limits = False

; match provides the tolerance for the convergence calculation
; and is calculated as match = log10(1-convergence)
; default = -5.0
match = -5.0


[rand_seed]
; random seed int
seed = 42


[bse]

;;;;;;;;;;;;;;;;;;;;;;
;;; SAMPLING FLAGS ;;;
;;;;;;;;;;;;;;;;;;;;;;

; pts1,pts2,pts3 determine the timesteps chosen in each
; evolution phase as decimal fractions of the time taken in that phase:
;                 pts1 - MS                  (default = 0.001, see Banerjee+2019) 
pts1 = 0.001
;                 pts2 - GB, CHeB, AGB, HeGB (default = 0.01)
pts2 = 0.01
;                 pts3 - HG, HeMS            (default = 0.02)
pts3 = 0.02


;;;;;;;;;;;;;;;;;;;;;;;;;
;;; METALLICITY FLAGS ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;
; specify the value for Solar metallicity, which primarily affects
; winds in BSE Note that our wind prescriptions apply a 
; fixed zsun parameter: zsun_wind = 0.019 because the wind 
; prescriptions are calibrated to this value as described in Vink+2001
; default = 0.014 (Asplund+2009)
zsun = 0.014


;;;;;;;;;;;;;;;;;;
;;; WIND FLAGS ;;;
;;;;;;;;;;;;;;;;;;

; windflag sets the wind prescription
; windflag = 0: stock BSE; windflag = 1: StarTrack 2008
; windflag = 2: Vink+2001; windflag = 3: Vink+2005 (Vink plus LBV winds)
; default = 3
windflag = 3

; eddlimflag turns on metallicity dependence on winds, affecting the
; mass-loss rate of low-metallicity stars near the Eddington limit
; (see Grafener et al. 2011, Giacobbo et al. 2018)
; default = 0
eddlimflag = 0

; neta is the Reimers mass-loss coefficent
; for more information, see Kudritzki & Reimers 1978, A&A 70, 227
; default = 0.5
neta = 0.5

; bwind is the binary enhanced mass loss parameter
; bwind it is always inactive for single stars
; default = 0.0
bwind = 0.0

; hewind is a helium star mass loss factor, between 0 and 1
; only applies if windflag=0, otherwise it is overwritten
; default = 0.5
hewind = 0.5

; beta is wind velocity factor: proportional to vwind^2
; beta<0: follows StarTrack 2008; beta=0.125: stock BSE
; default = -1
beta = -1

; xi is the 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
; default = 0.5
xi = 0.5

; acc2 sets the Bondi-Hoyle wind accretion factor onto companion
; default = 1.5
acc2 = 1.5



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; COMMON ENVELOPE FLAGS ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; alpha1 is the common-envelope efficiency parameter
; default = 1.0
alpha1 = 1.0

; lambdaf is the binding energy factor for common envelope evolution
; lambdaf>=0.0 uses variable lambda prescription written by Onno Pols,
; where lambdaf is the fraction of the ionization energy that can go into ejecting
; the envelope; to use this prescription w/o extra ionization energy, set lambdaf=0
; lambdaf<0 uses fixes lambda to a value of -1.0*lambdaf
; default = 0.0
lambdaf = 0.0

; ceflag=1 used the method from de Kool 1990 for setting the initial orbital energy
; ceflag=0 does not use this method (uses the core mass to calculate initial orbital energy)
; default = 1
ceflag = 1

; cekickflag determined the prescription for calling kick.f in comenv.f
; 0: default BSE
; 1: uses pre-CE mass and sep values
; 2: uses post-CE mass and sep
; default = 2
cekickflag = 2

; cemergeflag determines whether stars without a core-envelope boundary automatically lead to merger in CE
; cemergeflag=1 turns this on (causes these systems to merge)
; Note that while the best choice is cemergeflag=1,
; cemergeflag=0 allows for both options where the systems which would merge if
; cemergeflag=1 can be treated in post processing.
; default = 1
cemergeflag = 1

; cehestarflag uses fitting formulae from TLP, 2015, MNRAS, 451 for evolving RLO systems
; with a helium star donor and compact object accretor
; this flag will override choice made by cekickflag if set
; 0: off
; 1: fits for final period only
; 2: fits for both final mass and final period
; default = 0
cehestarflag = 0

; qcflag is an integer flag that sets the model to determine which critical mass ratios to use for
; the onset of unstable mass transfer and/or a common envelope.
; NOTE: this is overridden by qcrit_array if any of the values are non-zero.
; 0: standard BSE
; 1: BSE but with Hjellming & Webbink, 1987, ApJ, 318, 794 GB/AGB stars
; 2: following binary_c from Claeys+2014 Table 2
; 3: following binary_c from Claeys+2014 Table 2 but with Hjellming & Webbink, 1987, ApJ, 318, 794 GB/AGB stars
; 4: following StarTrack from Belczynski+2008 Section 5.1. WD donors follow standard BSE
; 5: following COMPAS from Neijssel+2020 Section 2.3. Stripped stars are always dynamically stable
; default = 1
qcflag = 1

; qcrit_array is a 16-length array for 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 prescription of the qcflag for that kstar
; default = [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]
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]



;;;;;;;;;;;;;;;;;;
;;; KICK FLAGS ;;;
;;;;;;;;;;;;;;;;;;

; kickflag sets the particular kick prescription to use
; 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=2 uses the prescription from Giacobbo & Mapelli 2020 (Eq. 1)
; with their default parameters (<m_ns>=1.2 Msun, <m_ej>=9 Msun)
; kickflag=3 uses the prescription from Giacobbo & Mapelli 2020 (Eq. 2),
; which does not scale the kick by <m_ns>
; kickflag=4 uses the prescription from Bray & Eldridge 2016 (Eq. 1)
; with their default parameters (alpha=70 km/s, beta=120 km/s)
; 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
sigma = 265.0

; bhflag != 0 allows velocity kick at BH formation
; bhflag=0: no BH kicks; bhflag=1: fallback-modulated kicks
; bhflag=2: mass-weighted (proportional) kicks; bhflag=3: full NS kicks
; default = 1
bhflag = 1

; bhsigmafrac sets the fractional modification used for scaling down the sigma for BHs
; this works in addition to whatever is chosen for bhflag, and is applied to the sigma beforehand these prescriptions are implemented
; default = 1.0
bhsigmafrac = 1.0

; sigmadiv sets the modified ECSN kick
; negative values sets the ECSN sigma value, positive values divide sigma above by sigmadiv
; default = -20.0
sigmadiv = -20.0

; ecsn>0 turns on ECSN and also sets the maximum ECSN mass range (at the time of the SN)
; stock BSE and StarTrack: ecsn=2.25; Podsiadlowski+2004: ecsn=2.5)
; default = 2.25
ecsn = 2.25

; ecsn_mlow sets the low end of the ECSN mass range
; stock BSE:1.6; StarTrack:1.85; Podsiadlowski+2004:1.4)
; default = 1.6
ecsn_mlow = 1.6

; aic=1 turns on low kicks for accretion induced collapse
; works even if ecsn=0
; default = 1
aic = 1

; ussn=1 uses reduced kicks (drawn from the sigmadiv distritbuion) for ultra-stripped supernovae
; these happen whenever a He-star undergoes a CE with a compact companion
; default = 1
ussn = 1

; pisn>0 allows for (pulsational) pair instability supernovae
; and sets the maximum mass of the remnant
; pisn=-1 uses the formulae from Spera+Mapelli 2017 for the mass
; pisn=-2 uses a polynomial fit to Table 1 Marchant 2018
; pisn=-3 uses a polynomial fit to Table 5 in Woosley 2019
; pisn=0 turns off (pulsational) pair instability supernovae
; default = -2
pisn = -2

; polar_kick_angle sets the opening angle of the kick relative to the pole of the exploding star
; this can range from 0 (strictly polar kicks) to 90 (fully isotropic kicks)
; default = 90.0
polar_kick_angle = 90.0

; natal_kick_array is a (2,5) array for user-input values for the SN natal kick
; The first and second row specify the natal kick information for the first and second star, and columns are formatted as: (vk, phi, theta, eccentric anomaly, rand_seed)
; vk is valid on the range [0, inf], phi are the co-lateral polar angles (in degrees) valid from [-90.0, 90.0], theta are azimuthal angles (in degrees) valid from [0, 360], and eccentric anomaly are the eccentric anomaly of the orbit at the time of SN (in degrees) valid from [0, 360]
; any number outside of these ranges will be sampled in the standard way in kick.f
; rand_seed is for reproducing a supernova if the the system is started mid-evolution, set to 0 if starting binary from the beginning
; default = [[-100.0,-100.0,-100.0,-100.0,0],[-100.0,-100.0,-100.0,-100.0,0.0]]
natal_kick_array = [[-100.0,-100.0,-100.0,-100.0,0],[-100.0,-100.0,-100.0,-100.0,0.0]]



;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; REMNANT MASS FLAGS ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;

; remnantflag determines the remnant mass prescription used
; remnantflag=0: default BSE
; remnantflag=1: Belczynski et al. 2002, ApJ, 572, 407
; remnantflag=2: Belczynski et al. 2008
; remnantflag=3: rapid prescription (Fryer+ 2012), updated as in Giacobbo & Mapelli 2020
; remnantflag=4: delayed prescription (Fryer+ 2012)
; default = 4
remnantflag = 4

; mxns sets the maximum NS mass
; default = 3.0
mxns = 3.0

; rembar_massloss determines the mass conversion from baryonic to 
; gravitational mass
; rembar_massloss >= 0: sets the maximum amount of mass loss
; -1 < rembar_massloss < 0: uses the prescription from Fryer et al. 2012, 
; assuming for BHs Mrem = (1+rembar_massloss)*Mrem,bar for negative rembar_massloss
; default = 0.5
rembar_massloss = 0.5

; wd_mass_lim determines if the maximum white dwarf mass is limited to
; the chandraekhar mass during merger induced collapse. 
; 1 implements the limit, while 0 does not
; default = 1
wd_mass_lim = 1

;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; REMNANT SPIN FLAGS ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;

; bhspinflag uses different prescriptions for BH spin after formation 
; bhspinflag=0; sets all BH spins to bhspinmag
; bhspinflag=1; draws a random BH spin between 0 and bhspinmag for every BH
; bhspinflag=2; core-mass dependent BH spin (based on Belczynski+2017; 1706.07053, v1)
; default = 0 
bhspinflag = 0

; bhspinmag sets either the spin of all BHs or the upper limit of the uniform 
; distribution for BH spins 
; default = 0.0
bhspinmag = 0.0



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; GR ORBITAL DECAY FLAG ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; grflag turns on or off orbital decay due to gravitational wave radiation
; grflag=0; no orbital decay due to GR
; grflag=1; orbital decay due to GR is included
; default = 1
grflag = 1



;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; MASS TRANSFER FLAGS ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;

; eddfac is Eddington limit factor for mass transfer, which can be 1 for Eddington-limited, >1 for super-Eddington, and 
; <1 for sub-Eddington
; default = 1.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
; Note that in RLO the primary is defined as the donor, and the secondary the accretor
; default = -2
gamma = -2

; don_lim is a flag which determines how much mass is lost during thermal timescale MT
; don_lim = -1: assumes standard BSE choice as outlined in Hurley+2002
; don_lim = -2: Follows Claeys+2014
; default = -1
don_lim = -1

; acc_lim is a flag which determines how much mass is accreted from the donor
; if acc_lim >= 0: this provides the fraction of mass accreted
; acc_lim = -1: assumes standard BSE choice as outlined in Hurley+2002 which limits to 10*tkh_acc for MS/CHeB
; 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



;;;;;;;;;;;;;;;;;;;
;;; TIDES FLAGS ;;;
;;;;;;;;;;;;;;;;;;;

; tflag=1 activates tidal circularisation
; default = 1
tflag = 1

; ST_tide sets which tidal method to use. 0=Hurley+2002, 1=StarTrack: Belczynski+2008
; Note, here 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 = 1
ST_tide = 1

; fprimc_array controls the scaling factor for convective tides
; each item is set individually for its associated kstar
; The releveant equation is Equation 21 from the BSE paper
; The default is to send the same coefficient (2/21) as is in the equation
; for every kstar
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]



;;;;;;;;;;;;;;;;;;;;;;;;;
;;; WHITE DWARF FLAGS ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;

; ifflag > 0 uses WD IFMR of HPE, 1995, MNRAS, 272, 800
; default = 0
ifflag = 0

; wdflag > 0 uses modified-Mestel cooling for WDs
; default = 1
wdflag = 1

; epsnov is the fraction of accreted matter retained in nova eruptions
; default = 0.001
epsnov = 0.001



;;;;;;;;;;;;;;;;;;;;
;;; PULSAR FLAGS ;;;
;;;;;;;;;;;;;;;;;;;;

; bdecayfac determines which accretion induced field decay method to 
; use from Kiel+2008: 0=exp, 1=inverse
; default = 1
bdecayfac = 1 

; bconst is the exponential decay timescale for magnetic
; field evolution of pulsars, in Myr (see Kiel+2008, Eq. 2)
; default = 3000
bconst = 3000

; ck is the exponential scaling parameter that determines the
; magnetic field rate of decay based on the amount of mass
; accreted (see Kiel+2008, Eq. 8)
; default = 1000
ck = 1000



;;;;;;;;;;;;;;;;;;;;;;;;
;;; MIXING VARIABLES ;;;
;;;;;;;;;;;;;;;;;;;;;;;;

; rejuv_fac allows different mixing factors in Equation 80 from the BSE
; paper. This was originally hard coded to 0.1, which leads massive 
; stars to potentially have extended main sequence lifetimes. 
; default = 1.0
rejuv_fac = 1.0

; rejuvflag toggles between the original BSE prescription for MS mixing and 
; lifetimes of stars based on the mass of the MS stars (equation 80) or a
; prescription that uses the ratio of helium core mass of the pre-merger stars
; at the base of the first ascent of the giant branch to determine relative to the
; helium core mass of the merger product at the base of the giant branch
; default = 0
rejuvflag = 0

; bhms_coll_flag 
; If set to 1 then if BH+star collision and if Mstar > Mbh, do not destroy the star
; default = 0
bhms_coll_flag = 0



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; MAGNETIC BRAKING FLAGS ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; htpmb allows for different magnetic braking models. 
; 0=follows BSE paper Section 2.4
; 1=follows Ivanova & Taam 2003 method which kicks in later than the standard
; -1=turns off magnetic braking
; default = 1
htpmb = 1



;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; MISCELLANEOUS FLAGS ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;

; ST_cr sets which convective/radiative boundary to use
; 0=follows BSE paper
; 1=follows StarTrack (Belcyznski+2008)
; default = 1
ST_cr = 1


;rtmsflag
;rtmsflag = 0 (Cosmic with the M200 fix for z < 0.0008)
;rtmsflag = 1 (For BOOST data)
;rtmsflag = 2 (For BPASS data)
;default = 0
rtmsflag = 0
