Page 1 of 1

External primordial power spectrum in CAMB

Posted: November 03 2020
by Hossein Moshafi 110
Hi,

I want to run CAMB with an external file as a primordial power spectrum, i.e. I don't use CAMB's ScalarPower function and I have two columned file (k, P(k)) and I want to run CAMB for this file.

How I can feed an external primordial power spectrum to CAMB?

I tried to write a piece of code in

Code: Select all

 function TInitialPowerLaw_ScalarPower(this, k) 
in the

Code: Select all

 InitialPower.f90
file like as follows but it doesn't return reliable answer:

Code: Select all

      open(unit=10,file="mypower.dat",status='old')

        nw_ppf=0
        do i=1,nwmax+1
            read(10,*,end=100)myk(i),mypk(i)

            nw_ppf=nw_ppf+1

        !        k=myk(i)
                TInitialPowerLaw_ScalarPower=mypk(i)

        enddo

        100     close(10)


Re: External primordial power spectrum in CAMB

Posted: November 04 2020
by Antony Lewis

Re: External primordial power spectrum in CAMB

Posted: November 04 2020
by Hossein Moshafi 110
Hi Antony,

Thanks for your reply. I'll check this.