------------------
==== ModeCode ====
------------------
February 17, 2011
M.J. Mortonson, H.V. Peiris, & R. Easther, arXiv:1007.4205
ModeCode computes the primordial scalar and tensor power spectra for
models of inflation. It can be run as a standalone code, or combined
with CAMB to compute CMB angular power spectra and CosmoMC to perform
likelihood analysis and constrain parameters of inflationary models.
Future updates will add features such as Bayesian evidence computation
using nested sampling.
The code and some sample MCMC parameter chains can be downloaded at:
http://zuserver2.star.ucl.ac.uk/~hiranya/ModeCode/
Version history:
----------------
February 17, 2011 - fixed bug with output of derived parameters when
sampling from priors, added params_modpk_F.paramnames for running code
with use_modpk=F.
February 10, 2011 - updated to January 2011 version of CAMB.
July 21, 2010 - initial release.
The currently available files are:
(1) modecode.tar.gz, including the following directories:
- cosmomc/ - sample files for running CosmoMC with ModeCode
- cosmomc/camb/ - sample driver for standalone code
(driver_modpk.f90), new files used by ModeCode, and modified CAMB files
- cosmomc/source/ - modified CosmoMC code
- Models/*/ - files for running CosmoMC with the 6 models included in
ModeCode (note that additional models can be easily added as described
below), where * = m2phi2 (quadratic potential), lphi4 (quartic), neq1
(n=1), neq2ov3 (n=2/3), natural, and hilltop. Covariance matrices from
previous MCMC runs are also included for each model: *_irh.covmat for
instant reheating models with WMAP7 data, *_grh.covmat for general
reheating models with WMAP7 data, and *_grh_cmb.covmat for general
reheating models with WMAP7+ACBAR+QUaD.
(2) chains.tar.gz:
- MCMC parameter chains for the 6 models with various reheating
assumptions and combinations of data as described above. For each
data/model combination there is one .tar.gz file in the ModelChains
directory that contains 6 chains. The file params_modpk.paramnames
lists the parameters in the order in which they appear in the chain
files.
Each of the *.tar.gz files can be unzipped and extracted using the
command 'tar -xzvf *.tar.gz'.
The current version of the code is based on the January 2011 version of
CAMB and CosmoMC. Only new or modified CAMB/CosmoMC files are provided
in the downloads, so any applications beyond using the standalone version
of ModeCode will require adding the downloaded files to an existing copy
of the basic CAMB and CosmoMC codes.
In each of the modified files, changes to the original code are marked
by 'MODIFIED P(K) ... END MODIFIED P(K)' so that they can be easily
located.
==== Setting up and compiling ModeCode ====
After extracting files from modecode.tar.gz, the ModeCode files must be
copied into existing versions of CAMB/CosmoMC for use with those codes.
One easy way to do this is to start in the cosmomc/ directory for the
ModeCode files, and use 'cp -r . cosmomc_target/' where cosmomc_target
is the base directory for the unmodified code.
*** Note that this will overwrite original versions of some of the
CAMB/CosmoMC files; if you do not want this to happen, rename the files
first before copying (they will also need to be renamed in the
Makefiles). ***
Once the new and modified code files have been copied into the
appropriate directories, the ModeCode versions of CAMB and CosmoMC can
be compiled with the usual Makefiles after making the following change:
in the last line of camb/Makefile and source/Makefile, change
'Makefile_main' to 'Makefile_main_modpk'.
To compile the sample driver program for the standalone version of
ModeCode without compiling CAMB or CosmoMC, run 'make powspec' in the
camb/ directory.
==== General description of ModeCode parameters and options ====
Inflationary models are described in ModeCode using an array of
parameters for the potential V(phi), vparams(i) for i = 1, 2, etc., and
the parameter N_pivot, which accounts for the uncertainty in the
post-inflationary epoch between the inflation and reheating. N_pivot is
the number of inflationary e-folds remaining when the mode of a given
scale k_pivot exits the horizon. The value of k_pivot can be specified
in units of Mpc^{-1}.
-----------------
ModeCode options:
-----------------
- use_modpk (logical): a general flag to turn ModeCode on or off.
Setting use_modpk=F recovers the original functionality of CAMB/CosmoMC.
When running the code with use_modpk=F, ParamNamesFile in params_modpk.ini
should be changed to params_modpk_F.paramnames.
- potential_choice (integer): specifies which inflationary model to use.
The translation between potential_choice and V(phi) is set in
camb/modpk_potential.f90. The models corresponding to different values
of potential_choice by default are listed below.
- vparams_num (integer): number of parameters needed to describe V(phi)
(for general reheating models, the total number of MCMC parameters is
vparams_num+1). The maximum number of parameters is set to 9 by default,
but can be increased in camb/modpk_modules.f90 by changing max_vparams.
- phi_init (real): starting guess for the initial value of phi; for all
models provided with the code, this setting is superceded by the
'initialphi' function in camb/modpk_potential.f90.
- k_pivot (real): ``pivot'' wavenumber for evaluating N_pivot, in
Mpc^{-1}.
- N_pivot (real): number of e-folds of inflation remaining after the
mode with wavenumber k_pivot leaves the horizon (note that in CosmoMC
N_pivot is treated as a parameter to be varied rather than a fixed
setting).
- instreheat (logical): whether or not to assume instant reheating,
which fixes the value of N_pivot; if instreheat=T, the values chosen for
k_pivot and N_pivot are ignored.
- slowroll_infl_end (logical): whether or not to determine when
inflation ends by the breakdown of slow roll conditions, i.e.
epsilon_H=1. If slowroll_infl_end=F, the end of inflation is assumed to
occur when phi=phi_infl_end.
- phi_infl_end (real): final value of phi during inflation for models
that do not end via slow roll violation (slowroll_infl_end=F). If
slowroll_infl_end=T, the value of this parameter is ignored.
- vnderivs (logical): whether to use numerical derivatives of the
potential (vnderivs=T) or analytic forms supplied in
camb/modpk_potential.f90 (vnderivs=F). The latter option is STRONGLY
recommended for all models for which the derivatives of V(phi) can be
computed and expressed analytically, as the use of numerical derivatives
may lead to inaccurate results for certain models.
---------------------------
Default models in ModeCode:
---------------------------
- potential_choice = 1: quadratic
V(phi) = m^2 phi^2 / 2
vparams(1) = log_10(m^2)
- potential_choice = 2: natural
V(phi) = Lambda^4 [1+cos(phi/f)]
vparams(1) = log_10(Lambda), vparams(2) = log_10(f)
- potential_choice = 3: quartic
V(phi) = lambda phi^4 / 4
vparams(1) = log_10(lambda)
- potential_choice = 4: linear
V(phi) = lambda phi
vparams(1) = log_10(lambda)
- potential_choice = 5: exponent n=2/3
V(phi) = (3/2) lambda phi^{2/3}
vparams(1) = log_10(lambda)
- potential_choice = 6: hilltop
V(phi) = Lambda^4 - lambda phi^4 / 4
vparams(1) = log_10(Lambda), vparams(2) = log_10(lambda)
==== Computing power spectra (standalone code) ====
The sample driver included with the code (camb/driver_modpk.f90) can be
run using the command 'powspec' in the camb/ directory. It is set up to
compute the scalar and tensor power spectra at 500 k values between
5x10^{-4} Mpc^{-1} and 5 Mpc^{-1} for a natural inflation model. The
code outputs (k, P_s(k), P_t(k)) and also computes the scalar and tensor
amplitudes and spectral tilts, as well as the running of the scalar
spectral index, at k_pivot = 0.05 Mpc^{-1}. This program can be easily
modified to compute the spectra for different models of inflation and/or
different values of k.
Warnings that phi_init is inconsistent and the value of phi_init is
being rescaled are a normal byproduct of the algorithm that searches for
self-consistent initial conditions for inflation. If there are an
excessive number of these warnings for each model evaluated, it may help
to change the user-supplied phi_init value or the function used in
'initialphi' in camb/modpk_potential.f90 for the inflationary model in
question.
Other warnings or errors produced by ModeCode typically indicate that
the chosen model parameters do not have a physically acceptable
inflationary solution.
==== Using ModeCode with CAMB ====
ModeCode can be used within CAMB by running 'camb params_modpk.ini' in
the camb/ directory. The ModeCode options and parameters are set in the
section of params_modpk.ini marked 'MODIFIED P(K)', which follows the
entries for the initial power spectrum parameters from the unmodified
version of CAMB. Note that these original spectral parameter values
(e.g. scalar_amp(1), scalar_spectral_index(1), etc.) are ignored if
use_modpk=T since the initial power spectra are entirely specified by
the values of N_pivot and the vparams array.
==== Using ModeCode with CosmoMC ====
The use of the ModeCode version of CosmoMC is unchanged from the
original version of the code except for the addition of the ModeCode
options in params_modpk.ini, which are marked by 'MODIFIED P(K)'.
Unlike CAMB and the standalone code, where N_pivot is specified by the
user, the implementation of ModeCode in CosmoMC assumes that N_pivot is
one of the chain parameters. If instant reheating is assumed
(instreheat=T), then N_pivot should be fixed by setting 'param[Npivot] =
50 50 50 0 0' in params_modpk.ini (the choice of 50 here is unimportant
since the code ignores this value for instant reheating models).
N_pivot and the vparams array (named vpar1, vpar2, etc. in CosmoMC) are
added on the end of the list of the usual CosmoMC parameters, following
A_SZ. Elements in the vparams array that are not used by a particular
inflationary model should be fixed in the MCMC analysis. If max_vparams
in camb/modpk_modules.f90 is changed to allow for models with more than
9 V(phi) parameters, the value of num_vpar in source/settings.f90 should
also be changed so that num_vpar=max_vparams+1.
The chain files output by the ModeCode version of CosmoMC have several
additional derived parameters which are listed at the end of
params_modpk.paramnames:
- modpk_Npivot; if instreheat=F, this should always be equal to the
chain parameter N_pivot, but if instreheat=T it will be the value of
N_pivot computed by the code to satisfy the matching equation for
instant reheating models.
- modpk_ns, modpk_nt (scalar and tensor spectral tilt)
- modpk_nrun (scalar spectral running dn_s/dlnk)
- modpk_logA (ln(10^{10}A_s), i.e. the usual CosmoMC scalar amplitude
parameter)
- modpk_r (tensor-to-scalar ratio)
Each of these spectral parameters is computed directly from the
primordial power spectra computed by ModeCode at the scale k_pivot.
==== Adding new inflationary models ====
Single field inflationary models beyond those provided can be simply
added to ModeCode by adding the following functions to
camb/modpk_potential.f90:
- V(phi) in the function pot(phi)
- the first derivative of V in the function dVdphi(phi)
- the second derivative of V in the function d2Vdphi2(phi)
- an approximate expression for phi(N_pivot) (e.g., derived using slow
roll relations) in the function initialphi; this is used to compute a
reasonable first guess for the initial conditions given the shape of
the potential
Although only specification of V(phi) is absolutely necessary (with
vnderivs=T the code will attempt to compute numerical derivatives of the
potential, and the function initialphi defaults to the set value of
phi_init if no phi(N_pivot) relation is given), the results of the code
are generally much more reliable if all four of these functions can be
provided.
The 6 models provided in the code can be used as templates for each of
these functions. For example, a new form of the potential corresponding
to potential_choice=7 would require adding a 'case(7)' statement to each
of the four functions described above with the V(phi) parameters and
functions specified following the examples provided.
==== Sampling from priors ====
The modified version of CosmoMC included with ModeCode contains a new
feature that allows the user to sample uniformly from the priors without
including constraints from data. This is useful, for example, for studying
the effects of flat priors on MCMC parameters (such as N_pivot and the
vparams array) on the distributions of derived parameters (such as n_s
and r). Isolating the effect of the priors in this way helps to determine
which constraints are truly coming from the data and which are merely
a consequence of the chosen priors.
The directories Models/natural/ and Models/hilltop/ each contain an example
file params_priors.ini with the settings needed to sample uniformly from
the priors for these inflationary models. The main changes to the usual
settings are the following:
- sampling_method = 7 (performs uniform sampling within the priors instead
of using Metropolis-Hastings sampling)
- use_x = F for all data sets x
- all parameters that do not affect the conversion between MCMC parameters
and derived parameters should be fixed; for example, if the derived
parameters are the power spectrum parameters A_s, n_s, r, etc., all
MCMC parameters other than the vparams array and N_pivot (for general
reheating) should be held fixed at some value
- additional options that are not necessary for prior sampling can be
turned off, e.g. bbn_consistency=F, compute_tensors=F (ModeCode will still
compute the derived parameters r and n_t in this case)