I would like with a custom MCMC code to set a very small amount of Cold Dark Matter in Hi-CLASS wrapper code.

Here is an attempt to run with :

Code: Select all

```
# Initializing Planck's likelihood
planck_likelihood = clik.clik(path_to_planck_likelihood)
lmax = planck_likelihood.get_lmax()[0]
A_planck = 1.0
params = {
'Omega_Lambda' : '0.0',
'Omega_fld' : '0.0',
'Omega_smg' : '-1.0',
'gravity_model' : 'brans dicke',
'parameters_smg' : '0.0, 800, 1.0, 1e-3',
'M_pl_today_smg' : '1.0',
'lensing': 'yes',
'l_max_scalars': str(lmax),
'a_min_stability_test_smg' : '3e-13',
'output_background_smg': '10',
'write parameters': 'no',
'write background': 'no',
'write thermodynamics': 'no',
'input_verbose' : '0',
'background_verbose' : '0',
'output_verbose' : '0',
'thermodynamics_verbose' : '0',
'perturbations_verbose' : '0',
'spectra_verbose' : '0',
'omega_b' : '0.022032',
'omega_cdm' : '1e-6',
'gauge' : 'Synchronous',
'YHe': '0.245',
'H0' : '67.4',
'output': 'tCl, pCl, lCl, mPk',
'pert_ic_tolerance_smg': '1e-6',
}
def get_spectrum(Omega_m, Omega_k, H0, Psi, dPsi_dt, omega_BD):
params['parameters_smg'] = f"0.0, {omega_BD:.5f}, {Psi:.5f}, {dPsi_dt:.5f}"
params['H0'] = H0
params['omega_b'] = Omega_m * (H0/100)**2 - float(params['omega_cdm'])
# Set up and run CLASS
cosmology = Class()
cosmology.set(params)
cosmology.compute()
# CHECK small Omegam
derived = cosmology.get_current_derived_parameters(['Omega_m'])
print('Omega_m = ', derived)
# Obtain the relevant spectra
cl = cosmology.lensed_cl(lmax)
tt = cl["tt"] * 10**12 * 2.7255**2
cosmology.struct_cleanup()
cosmology.empty()
return tt
```

Code: Select all

```
param_names = ["Omega_m", "Omega_k", "H0", "Psi_0", "F0", "log10_omega_BD"]
lower_boundaries = np.array([[0.03, -1e-2, 60.0, 0.9, 0, np.log10(4e4)]])
upper_boundaries = np.array([[0.06, 1e-2, 80.0, 1.1, 1e-2, 8]])
```

Indeed, unfortunately, I get instabilities with [math] computation.

With this cosmo input block of parameters, I get after few iterations of MCMC the following error :

that makes stop the MCMC code. I tried to play onError in Class: background_init(L:746) :error in background_solve(ppr,pba);

=>background_solve(L:2282) :condition (pba->min_cs2_smg < -fabs(pba->cs2_safe_smg)) is true; Gradient instability for scalar field perturbations with minimum c_s^2=-297.892

Code: Select all

`a_min_stability_test_smg' : '3e-13',`

Code: Select all

`pert_ic_tolerance_smg': '1e-6',`

There are surely other parameters of integration / solving for Hi-CLASS that may work to get a reliable code that don't stop with this error.

From another point of view, maybe I have not set the right values for these 2 previous parameters.

Any help is welcome.

Regards