diff --git a/examples/main.c b/examples/main.c index d7e187857af6c568bda147a8e51bdca2b85e3c4f..d1a82bbdc38b865401ec7d71c0c85bd650abf9a2 100644 --- a/examples/main.c +++ b/examples/main.c @@ -633,7 +633,7 @@ int main(int argc, char *argv[]) { /* Initialise the gravity properties */ if (with_self_gravity) - gravity_props_init(&gravity_properties, params, &cosmo); + gravity_props_init(&gravity_properties, params, &cosmo, with_cosmology); /* Read particles and space information from (GADGET) ICs */ char ICfileName[200] = ""; diff --git a/src/gravity_properties.c b/src/gravity_properties.c index 84ce90f7270d1651f4ef33b9b716772125e71ab0..22856c25fbbaebd1dd74c5592ce8fd914e76b61c 100644 --- a/src/gravity_properties.c +++ b/src/gravity_properties.c @@ -39,7 +39,7 @@ #define gravity_props_default_rebuild_frequency 0.01f void gravity_props_init(struct gravity_props *p, struct swift_params *params, - const struct cosmology *cosmo) { + const struct cosmology *cosmo, int with_cosmology) { /* Tree updates */ p->rebuild_frequency = @@ -74,10 +74,16 @@ void gravity_props_init(struct gravity_props *p, struct swift_params *params, p->theta_crit_inv = 1. / p->theta_crit; /* Softening parameters */ - p->epsilon_comoving = - parser_get_param_double(params, "Gravity:comoving_softening"); - p->epsilon_max_physical = - parser_get_param_double(params, "Gravity:max_physical_softening"); + if (with_cosmology) { + p->epsilon_comoving = + parser_get_param_double(params, "Gravity:comoving_softening"); + p->epsilon_max_physical = + parser_get_param_double(params, "Gravity:max_physical_softening"); + } else { + p->epsilon_max_physical = + parser_get_param_double(params, "Gravity:max_physical_softening"); + p->epsilon_comoving = p->epsilon_max_physical; + } /* Set the softening to the current time */ gravity_update(p, cosmo); diff --git a/src/gravity_properties.h b/src/gravity_properties.h index 1d230b8c372a1503acc42515f8fbeb06445247db..62dbab3605fb2dcfc4ae65e54c0b5f913d714c16 100644 --- a/src/gravity_properties.h +++ b/src/gravity_properties.h @@ -88,7 +88,7 @@ struct gravity_props { void gravity_props_print(const struct gravity_props *p); void gravity_props_init(struct gravity_props *p, struct swift_params *params, - const struct cosmology *cosmo); + const struct cosmology *cosmo, int with_cosmology); void gravity_update(struct gravity_props *p, const struct cosmology *cosmo); #if defined(HAVE_HDF5)