Cobaya + CAMB: Modified Quintessence Module: H0 is not affecting theoretical theta

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Post Reply
Stuart Storm
Posts: 3
Joined: March 13 2021
Affiliation: Vanderbilt University

Cobaya + CAMB: Modified Quintessence Module: H0 is not affecting theoretical theta

Post by Stuart Storm » March 16 2021

Hello All,

I intend to modify the quintessence code in CAMB to produce two-dimensional contours and one-dimensional probability distributions for cubic potential model parameters. Before I implement my cubic potential model, I am first attempting to reproduce similar results as in the LCDM model so that I know that my implementation is working properly. Therefore, I have made my own quintessence class in Fortran derived from the base Quintessence class, as suggested in the CAMB "Read the Docs" page. My class is based on the "EarlyQuintessence" class, but I removed anything relating to the properties m, f, and zc, while keeping the same lines of code that generate the interpolation table. The potential model implemented is simply a parameterized constant for the zeroth derivative, and the parameter is being initialized in Fortran and passed properly through Python, and all greater derivatives are zero. The parameter for the potential constant is centered at 1e-7 1/Mpc^-2, and I have also parameterized the initial_phi, centered on 0.155 for now. The rest of the parameters are the default from using "cobaya-cosmo-generator" set to "Planck 2018 with CAMB". The VofPhi method of my quintessence class is as follows:

Code: Select all

    if (deriv==0) then
        Vofphi = this%V0const
    else if (deriv ==1) then
        Vofphi = 0
    else if (deriv ==2) then
        Vofphi = 0
    end if
My issue is that in "model.py", in the "set_H0_for_theta" method of "CAMBparams", the root-finding "brentq" algorithm sees that f(a) and f(b) are the same value when I run this quintessence class with the constant potential. This is because altering the value of H0 does not change the "theta_test" variable regardless of whether or not "cosmomc_approx" is set to True. This causes the following errors that halt the run (where the first line is the explicit error from "brentq"):

Code: Select all

f(a) and f(b) must have different signs
 2021-03-16 10:50:50,413 [camb] Out of bounds parameters. Assigning 0 likelihood and going on.
 2021-03-16 10:50:50,413 [model] Calculation failed, skipping rest of calculations
 2021-03-16 10:50:50,413 [model] Computed derived parameters: {'As': 2.1130229582959047e-09, 'H0': nan, 'omegam': nan, 'omegamh2': nan, 'omega_de': nan, 'YHe': nan, 'Y_p': nan, 'DHBBN': nan, 'zre': nan, 'sigma8': nan, 's8h5': nan, 's8omegamp5': nan, 's8omegamp25': nan, 'A': 2.113022958295905, 'clamp': 1.8660655819230805, 'age': nan, 'rdrag': nan, 'chi2__CMB': nan}
 2021-03-16 10:50:50,413 [model] *ERROR* Could not find random point giving finite likelihood after 1160 tries
It might help to know that in the quintessence results, grhob, grhoc, and grhov are all slightly different from the LCDM results at the same H0 values (and grho_no_de and grhov_t are different at the same a values), although this could be from my approximation of the potential constant.

Could someone please help me find why my "theta_test" variable is not changing with H0? I can share all portions of the code that I modified in case this helps see what I missed, although I have changed several files to accommodate my new class and parameters, so this might be tedious to look through.

Thank you for your time.

Respectfully,
S. David Storm

Antony Lewis
Posts: 1936
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

Re: Cobaya + CAMB: Modified Quintessence Module: H0 is not affecting theoretical theta

Post by Antony Lewis » March 17 2021

Make sure you set the dark energy model and parameters before setting theta (since theta->H0 depends on them). Does it work in CAMB directly from python? If so, then the issue may be in Cobaya (are you using latest CAMB and Cobaya version?).

Stuart Storm
Posts: 3
Joined: March 13 2021
Affiliation: Vanderbilt University

Re: Cobaya + CAMB: Modified Quintessence Module: H0 is not affecting theoretical theta

Post by Stuart Storm » March 23 2021

Hi Dr. Lewis,

The dark energy model is being called before calculating theta, and I've verified that the model parameters are being set prior to calculating theta, as well. I am using cobaya 3.0.3 and CAMB 1.3.2 on Ubuntu 20.04.

The issue is able to be reproduced in Python when using the "planck_2018.ini" file modified to use my dark energy model and parameters. Running the set_H0_for_theta function of a CAMBParams instance also produces the brentq error shown in the first post. In addition, varying only H0 (set from 40 to 100) between consecutive runs of the following code does not result in a change in the value of theta:

Code: Select all

pars=camb.read_ini('planck_2018.ini')
data = camb.CAMBdata()
data.calc_background_no_thermo(pars)
print('theta:',data.cosmomc_theta())
Respectfully,
S. David Storm

Antony Lewis
Posts: 1936
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

Re: Cobaya + CAMB: Modified Quintessence Module: H0 is not affecting theoretical theta

Post by Antony Lewis » March 25 2021

Perhaps you're not matching your quintessence parameters to give the value of Omega_de required by the the model input parameters (in the example implementation, the returned Vofphi depends on the current parameter this%State%grhov giving the target density today).

Stuart Storm
Posts: 3
Joined: March 13 2021
Affiliation: Vanderbilt University

Re: Cobaya + CAMB: Modified Quintessence Module: H0 is not affecting theoretical theta

Post by Stuart Storm » March 27 2021

Hi Dr. Lewis,

That was the problem. After making Vofphi depend on this%State%grhov, the set_H0_for_theta method works as expected. Thank you for your time and assistance.

Respectfully,
S. David Storm

Post Reply