Commit bb6bb351 authored by John Douglas Veitch's avatar John Douglas Veitch

Store EOS family in model structure

parent c81f2175
......@@ -61,6 +61,7 @@
#include <lal/LALString.h>
#include <lal/LALSimInspiral.h>
#include <lal/LALSimInspiralWaveformCache.h>
#include <lal/LALSimNeutronStar.h>
#include <lal/LALHashTbl.h>
#include <lal/SFTutils.h>
......@@ -467,7 +468,8 @@ typedef struct tagLALInferenceModel
REAL8Window *window; /** A window */
REAL8 padding; /** The padding of the above window */
struct tagLALInferenceROQModel *roq; /** ROQ data */
int roq_flag;
int roq_flag; /** Is ROQ enabled */
LALSimNeutronStarFamily *eos_fam; /** Neutron Star equation of state family */
} LALInferenceModel;
......
......@@ -1386,8 +1386,12 @@ LALInferenceModel *LALInferenceInitCBCModel(LALInferenceRunState *state) {
errnum=XLAL_SUCCESS;
XLAL_TRY(eos=XLALSimNeutronStarEOSByName(ppt->value), errnum);
if(errnum!=XLAL_SUCCESS)
XLAL_ERROR_NULL(errnum);
LALInferenceAddVariable(model->params, "ns_eos", eos, LALINFERENCE_void_ptr_t, LALINFERENCE_PARAM_FIXED);
XLAL_ERROR_NULL(errnum,"%s: %s",__func__,XLALErrorString(errnum));
XLAL_TRY(model->eos_fam = XLALCreateSimNeutronStarFamily(eos),errnum);
if(errnum!=XLAL_SUCCESS)
XLAL_ERROR_NULL(errnum,"%s: %s",__func__,XLALErrorString(errnum));
if(!model->eos_fam) XLAL_ERROR_NULL(XLAL_EINVAL, "Unable to initialise EOS family");
}
LALSimInspiralSpinOrder spinO = LAL_SIM_INSPIRAL_SPIN_ORDER_ALL;
......
......@@ -805,9 +805,9 @@ void LALInferenceTemplateXLALSimInspiralChooseWaveform(LALInferenceModel *model)
sym_mass_ratio_eta = m1*m2/((m1+m2)*(m1+m2));
LALInferenceLambdaTsEta2Lambdas(lambdaT,dLambdaT,sym_mass_ratio_eta,&lambda1,&lambda2);
}
if(LALInferenceCheckVariable(model->params, "ns_eos"))
if(model->eos_fam)
{
LALSimNeutronStarFamily *eos_fam = XLALCreateSimNeutronStarFamily((LALSimNeutronStarEOS *)LALInferenceGetVariable(model->params, "ns_eos"));
LALSimNeutronStarFamily *eos_fam = model->eos_fam;
REAL8 r1=0, r2=0, k2_1=0, k2_2=0, lambda1=0, lambda2=0;
REAL8 mass_max = XLALSimNeutronStarMaximumMass(eos_fam) / LAL_MSUN_SI;
REAL8 mass_min = XLALSimNeutronStarFamMinimumMass(eos_fam) / LAL_MSUN_SI;
......@@ -834,9 +834,6 @@ void LALInferenceTemplateXLALSimInspiralChooseWaveform(LALInferenceModel *model)
LALInferenceAddVariable(model->params, "radius2", &r2, LALINFERENCE_REAL8_t, LALINFERENCE_PARAM_OUTPUT);
LALInferenceAddVariable(model->params, "lambda1", &lambda1, LALINFERENCE_REAL8_t, LALINFERENCE_PARAM_OUTPUT);
LALInferenceAddVariable(model->params, "lambda2", &lambda2, LALINFERENCE_REAL8_t, LALINFERENCE_PARAM_OUTPUT);
/* Clean up */
if(eos_fam) XLALDestroySimNeutronStarFamily(eos_fam);
}
/* ==== 4-PIECE POLYTROPE EOS PARAMETERS ==== */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment