CosmoCoffee Forum Index CosmoCoffee

 
 FAQFAQ   SearchSearch  MemberlistSmartFeed   MemberlistMemberlist    RegisterRegister 
   ProfileProfile   Log inLog in 
Arxiv New Filter | Bookmarks & clubs | Arxiv ref/author:

cosmomc: n_t error when adding new parameter unrelated to n_t/inflation
 
Post new topic   Reply to topic    CosmoCoffee Forum Index -> Computers and software
View previous topic :: View next topic  
Author Message
Sofie Marie Koksbang



Joined: 27 Feb 2017
Posts: 9
Affiliation: Aarhus University

PostPosted: February 27 2017  Reply with quote

Hi,

I have added a new parameter to CAMB and cosmoMC (Nov2016 version). CAMB runs fine, but when I try to run cosmoMC, it stops with the following error message:

Fast divided into 1 blocks
21 parameters ( 7 slow (0 semi-slow), 14 fast (0 semi-fast) )
Starting Monte-Carlo
Error: inflation_consistency but n_t not set to zero
MpiStop: 0

I have not altered any inflation-settings, so e.g. in the /batch2/params_CMB_defaults.ini, inflation_consistency is set to T and nt = 0 is also set (although a comment notifies that this will be ignored when inflation_consistency is set to T).
The new parameter has nothing to do with inflation or nt, so I really don’t understand why this error occurs.

I would greatly appreciate any ideas as to why this error occurs.

P.S. When adding the new parameter, I follow the description given in http://cosmocoffee.info/viewtopic.php?t=1149&postdays=0&postorder=asc&start=15 . I have made no other changes to cosmoMC and the changes I have made in CAMB are not related to inflation or nt.
Back to top
View user's profile  
Antony Lewis



Joined: 23 Sep 2004
Posts: 1243
Affiliation: University of Sussex

PostPosted: February 27 2017  Reply with quote

I expect the mapping between parameter array indices and physical parameters got mixed up when adding your new parameter, e.g. check your CosmologyParameterizations.f90
Back to top
View user's profile [ Hidden ] Visit poster's website
Sofie Marie Koksbang



Joined: 27 Feb 2017
Posts: 9
Affiliation: Aarhus University

PostPosted: February 27 2017  Reply with quote

Hi,

Thank you for the quick reply.
Yes, this could very well be the case, because I am a little confused about the .paramnames file: I keep simply using the params_CMB.paramnames and add my new parameter, aswitch, at the bottom of this file. This makes it parameter number 47 in this file. But before adding aswitch, there were only 16 theory-parameters (line 74 in CosmologyParameterizations.f90). I change this to 17 and have tried adding aswitch in SetForH both as "CMB%a_switch = Params(17)" and "CMB%a_switch = Params(47)" (I have also tried adding aswitch as a real(mcp) in SetForH and then simply setting "aswitch = Params(17)" or "aswitch = Params(47)" because this is what is done in the posting I linked to before). I get the same error regardless of which I choose, but maybe I am missing some important detail of how to work with the .paramnames file?
Back to top
View user's profile  
Antony Lewis



Joined: 23 Sep 2004
Posts: 1243
Affiliation: University of Sussex

PostPosted: February 27 2017  Reply with quote

If you are adding a theory parameter you want to add it in the corresponding place in the paramnames file (line 17).
Back to top
View user's profile [ Hidden ] Visit poster's website
Sofie Marie Koksbang



Joined: 27 Feb 2017
Posts: 9
Affiliation: Aarhus University

PostPosted: February 27 2017  Reply with quote

Ok, I have made sure that aswitch is added in line 17 of params_CMB.paramnames and that it is entered as Params(17) in SetForH. The error message is different now, and is as follows:

.
.
.
Computing tensors: F
max_eta_k = 14000.00
transfer kmax = 5.000000
SetTheoryParameterNumbers: parameter numbers do not match
MpiStop 0

I have already changed line 74 in CosmologyParameterizations.f90 to include 17 instead of 16 parameters (i.e. the line now reads "call this%SetTheoryParameterNumbers(17,last_power_index)"), so this should not be the problem. Are there other places where I have to change such numbers to let cosmoMC know that there has been added a parameter?
Back to top
View user's profile  
Erick Almaraz



Joined: 10 Jun 2012
Posts: 24
Affiliation: University of Mexico

PostPosted: February 27 2017  Reply with quote

I don't know if this is mandatory, but in my case I declared the extra parameter in

Code:
Type, extends(TTheoryParams) :: CMBParams


in CosmologyTypes.f90
Back to top
View user's profile [ Hidden ]
Sofie Marie Koksbang



Joined: 27 Feb 2017
Posts: 9
Affiliation: Aarhus University

PostPosted: February 28 2017  Reply with quote

Hi,

I'm pretty sure this is mandatory and I have already done it, but thank you anyway.
Back to top
View user's profile  
Sofie Marie Koksbang



Joined: 27 Feb 2017
Posts: 9
Affiliation: Aarhus University

PostPosted: February 28 2017  Reply with quote

Hi,

I looked a little more in source/CosmologyTypes.f90 and tried adding "+1" in line 141 so that it now reads:

num_initpower = semi_slow_num+1

The code runs without errors now, but this change was not mentioned in the topic I linked to in my initial post (i.e. in http://cosmocoffee.info/viewtopic.php?t=1149&postdays=0&postorder=asc&start=15 ) so I am a little unsure if I am doing the correct thing, or if I have added my new parameter incorrectly somehow.

I would really appreciate any thoughts on whether or not it seems reasonable that I had to change num_initpower.
Back to top
View user's profile  
Antony Lewis



Joined: 23 Sep 2004
Posts: 1243
Affiliation: University of Sussex

PostPosted: February 28 2017  Reply with quote

You shouldn't have to change that. It sounds as though your .paramnames is still inconsistent, make sure the number of lines in params_CMB.paramnames matches the sum of the arguments you are passing to SetTheoryParameterNumbers.
Back to top
View user's profile [ Hidden ] Visit poster's website
Sofie Marie Koksbang



Joined: 27 Feb 2017
Posts: 9
Affiliation: Aarhus University

PostPosted: February 28 2017  Reply with quote

Hi,

Thank you for letting me know that the "solution" is NOT a solution!

Originally (before I changed anything in the code), line 74 in sources/CosmologyParameterization.f90 read:

call this%SetTheoryParameteNumbers(16,last_power_index)

I added aswitch as line 17 in paramnames/params_CMB.paramnames and therefore changed the above line to:

call this%SetTheoryParameteNumbers(17,last_power_index)

I.e. I changed "16" to "17" after adding a single parameter. Should I have done it differently?

P.S. paramnames/params_CMB.paramnames is entirely unaltered compared to its original version except that I add aSwitch in line 17 (there seems to be some parameters in the file that aren't used, but I haven't deleted any because I don't want to accidentally delete a line that is in fact used somewhere...)
Back to top
View user's profile  
Sofie Marie Koksbang



Joined: 27 Feb 2017
Posts: 9
Affiliation: Aarhus University

PostPosted: February 28 2017  Reply with quote

Could it be that I am supposed to change lines 12−13 in sources/CosmologyTypes.f90? Those lines currently read:

integer, parameter :: As_index=1, ns_index=2, nrun_index=3, nrunrun_index =4, amp_ratio_index = 5, &
& nt_index = 6, ntrun_index = 7, Aphiphi_index = 8, last_power_index = Aphiphi_index

Do I need to change these indexes now that I have inserted aswitch in line 17 in paramnames/params_CM.paramnames such that As, ns, nrun etc. have all been moved down one line in paramnames/params_CM.paramnames?..."last_power_index" is used as the second input in SetTheoryParameterNumbers in source/CosmologyParameterizations.f90, so if Aphiphi_index and hence last_power_index need to be changed, this could be why SetTheoryParameterNumbers gives the error?

As it is currently, SetTheoryParemeterNumbers gets the inputs "17" and "last_power_index" = "Aphiphi_index" = 8, i.e. the total number is 17+8 = 25 which is the number of lines with theory parameters (parameters without a "*") in paramnames/params_CMB.paramnames.
Back to top
View user's profile  
Sofie Marie Koksbang



Joined: 27 Feb 2017
Posts: 9
Affiliation: Aarhus University

PostPosted: February 28 2017  Reply with quote

Hi Antony and Erick,

I think the problem is fixed now: I removed the paramnames file and copied a new one from a cosmoMC-version that I haven't altered at all. Then I added aSwitch in line 17 of the paramnames-file and now it's running. So, it seems that the problem was originally my misplacement of aswitch in params_CMB.paramnames and then before that got fixed, I must have messed up something in the file or entire directory (I sometimes accidentally "vim" into directories and start typing before I realize my mistake - maybe that has messed up the paramnames-directory...)

Thank you both for your suggestions and your time.
Back to top
View user's profile  
Display posts from previous:   
Post new topic   Reply to topic    CosmoCoffee Forum Index -> Computers and software All times are GMT + 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group. Sponsored by WordWeb online dictionary and dictionary software.