CosmoMC: How H0 is calculated from theta/where is it saved?

Use of Healpix, camb, CLASS, cosmomc, compilers, etc.
Post Reply
Manuel Trashorras
Posts: 2
Joined: September 22 2014
Affiliation: UAM-CSIC

CosmoMC: How H0 is calculated from theta/where is it saved?

Post by Manuel Trashorras » September 22 2014

Hi all,

I’m a begginer with CosmoMC, trying inside the cosmoMC/source/MCMC.f90 source file to redefine parameter power spectrum spectral index in terms of w, Omega_DE, Omega_K, so I have an expression n_s(w,Ω_DE,Ω_K). Such expression is complicated, but not relevant to my question. I’ve checked:

I'm modifying the code inside the subroutine FastDragging subroutine.

I need Ω_DE, so to get Ω_DE I need the Hubble parameter h, since of course

Ω_DE = 1 - Ω_K - Ω_bh^2 / h^2 - Ω_ch^2 / h^2

My problem is, I can’t find where the Hubble parameter h is saved or
calculated. I’ve seen in this ( and this posts ( ... eta+hubble) that H0 is calculated from theta in the params_CMB.f90 through a binnary search, but I cannot find the specific part of the code that does so.

My questions are:

--- Is the variable H0 saved anywhere in MCMC.f90 with a variable name that I dont know?
--- Same question for Omega_DE?
--- Or what is the code/equation that calculates H0 or Omega_DE so I can use it inside MCMC.F90?

I've cheched that the variables names CurParams%P(...) in the FastDragging subroutine on MCM.f90 correspond to

n_s is in variable name CurParams%P(8)
w -> CurParams%P(16)
Ω_bh^2 -> CurParams%P(1)
Ω_ch^2 -> CurParams%P(2)
Ω_K -> CurParams%P(5)

I’ve been unable to find it on the code and
after looking everywhere I did not know where else to ask. If you could help
me I would very much appreciate it.

Thanks in advance

Jason Dossett
Posts: 97
Joined: March 19 2010
Affiliation: The University of Texas at Dallas

CosmoMC: How H0 is calculated from theta/where is it saved?

Post by Jason Dossett » September 22 2014

Hi Manuel,

I would caution against making the modifications you are wanting to make in MCMC.f90 and rather suggest that you make those changes where the params array is passed to the CMB data type. All of this is done in CosmologyParameterizations.f90 (that file replaced params_CMB.f90 in the OOP versions of CosmoMC). Of particular interest to you are the routines SetForH and SetFast.

Hope that helps.


yajing huang
Posts: 9
Joined: January 21 2015
Affiliation: Johns Hopkins University

CosmoMC: How H0 is calculated from theta/where is it saved?

Post by yajing huang » January 19 2016


I'm interested in this question too. I looked at subroutine "SetForH" in CosmologyParameterization.f90. It seems that "SetForH" just passes an input H0 to CMB%H0. And I'm still wondering how that H0 is calculated from the base parameters as they vary in the chains.

By the way, I'm also trying to understand the difference between setting a Gaussian prior for H0 using "H0_prior= mean std", and modifying "H0" and "H0_err" in HST.ini.



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

Re: CosmoMC: How H0 is calculated from theta/where is it sav

Post by Antony Lewis » January 19 2016

It does a binary search to find the H0 value that gives the required theta.

There's very little difference between the two H0 priors, though the latter includes a tiny correction for the observations not being at redshift zero.

Post Reply