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

Fix compilation errors

parent 1d63d6e1
......@@ -38,6 +38,7 @@
#include <lal/LALInferenceReadData.h>
#include <lal/LALInferenceInit.h>
#include <lal/LALInferenceCalibrationErrors.h>
#include <lal/LALSimNeutronStar.h>
static int checkParamInList(const char *list, const char *param);
static int checkParamInList(const char *list, const char *param)
......@@ -1351,9 +1352,9 @@ LALInferenceModel *LALInferenceInitCBCModel(LALInferenceRunState *state) {
}
if((~~LALInferenceGetProcParamVal(commandLine,"--tidalT") + ~~LALInferenceGetProcParamVal(commandLine,"--tidal")
+~~LALInferenceGetProcParamVal(commandLine,"--4PolyEOS") + ~~LALInferenceGetProcParamVal(commandLine,"--4SpectralDecomp")
+~~LALInferenceGetProcParamVal(commandLine,"--eos")) > 1 )
if((!!LALInferenceGetProcParamVal(commandLine,"--tidalT") + !!LALInferenceGetProcParamVal(commandLine,"--tidal")
+ !!LALInferenceGetProcParamVal(commandLine,"--4PolyEOS") + !!LALInferenceGetProcParamVal(commandLine,"--4SpectralDecomp")
+ !!LALInferenceGetProcParamVal(commandLine,"--eos")) > 1 )
{
XLALPrintError("Error: cannot use more than one of --tidalT, --tidal, --4PolyEOS, --4SpectralDecomp and --eos.\n");
XLAL_ERROR_NULL(XLAL_EINVAL);
......@@ -1382,11 +1383,11 @@ LALInferenceModel *LALInferenceInitCBCModel(LALInferenceRunState *state) {
else if((ppt=LALInferenceGetProcParamVal(commandLine,"--eos")))
{
LALSimNeutronStarEOS *eos=NULL;
INT4 errnum=XLAL_SUCCESS;
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_t, LALINFERENCE_PARAM_FIXED);
LALInferenceAddVariable(model->params, "ns_eos", eos, LALINFERENCE_void_ptr_t, LALINFERENCE_PARAM_FIXED);
}
LALSimInspiralSpinOrder spinO = LAL_SIM_INSPIRAL_SPIN_ORDER_ALL;
......
......@@ -40,6 +40,7 @@
#include <lal/LALSimInspiral.h>
#include <lal/LALInferenceTemplate.h>
#include <lal/LALInferenceMultibanding.h>
#include <lal/LALSimNeutronStar.h>
/* LIB imports*/
#include <lal/LALInferenceBurstRoutines.h>
......@@ -807,30 +808,34 @@ void LALInferenceTemplateXLALSimInspiralChooseWaveform(LALInferenceModel *model)
if(LALInferenceCheckVariable(model->params, "ns_eos"))
{
LALSimNeutronStarFamily *eos_fam = XLALCreateSimNeutronStarFamily((LALSimNeutronStarEOS *)LALInferenceGetVariable(model->params, "ns_eos"));
REAL8 r1=0, r2=0, k2_1=0, k2_2=0;
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;
if(m1<mass_max && m1>mass_min)
{
/* Compute l1, l2 from mass and EOS */
r1 = XLALSimNeutronStarRadius(mass1*LAL_MSUN_SI, eos_fam);
k2_1 = XLALSimNeutronStarLoveNumberK2(mass1*LAL_MSUN_SI, eos_fam);
lambda1 = (2./3.)*k2_1 * pow(r1/(mass1*LAL_MRSUN_SI), 5.0);
r1 = XLALSimNeutronStarRadius(m1*LAL_MSUN_SI, eos_fam);
k2_1 = XLALSimNeutronStarLoveNumberK2(m1*LAL_MSUN_SI, eos_fam);
lambda1 = (2./3.)*k2_1 * pow(r1/(m1*LAL_MRSUN_SI), 5.0);
}
if(m2<mass_max && m2>mass_min)
{
r2 = XLALSimNeutronStarRadius(mass2*LAL_MSUN_SI, eos_fam);
k2_2 = XLALSimNeutronStarLoveNumberK2(mass2*LAL_MSUN_SI, eos_fam);
lambda2 = (2./3.)*k2_2 * pow(r2/(mass2*LAL_MRSUN_SI), 5.0);
r2 = XLALSimNeutronStarRadius(m2*LAL_MSUN_SI, eos_fam);
k2_2 = XLALSimNeutronStarLoveNumberK2(m2*LAL_MSUN_SI, eos_fam);
lambda2 = (2./3.)*k2_2 * pow(r2/(m2*LAL_MRSUN_SI), 5.0);
}
/* Set waveform params */
XLALSimInspiralWaveformParamsInsertTidalLambda1(model->LALpars, lambda1);
XLALSimInspiralWaveformParamsInsertTidalLambda2(model->LALpars, lambda2);
/* Add derived quantities for output */
LALInferenceAddVariable(model->params, "radius1", &r1, LALINFERENCE_REAL8_t, LALINFERENCE_PARAM_OUTPUT);
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);
/* ClLean up */
/* Clean up */
if(eos_fam) XLALDestroySimNeutronStarFamily(eos_fam);
}
......
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