From 2febfbefaf996d81fd139c9243863fbc13a96fa2 Mon Sep 17 00:00:00 2001 From: lesgourg Date: Mon, 7 Oct 2024 12:57:28 +0200 Subject: [PATCH] v3.2.5, negative m_ncdm forbidden --- external/RealSpaceInterface/README | 2 +- include/common.h | 2 +- source/input.c | 14 ++++++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/external/RealSpaceInterface/README b/external/RealSpaceInterface/README index 975f58989..83b3ca585 100644 --- a/external/RealSpaceInterface/README +++ b/external/RealSpaceInterface/README @@ -1,7 +1,7 @@ CLASS real space interface 07.2015: started by Max Beutelspacher 09.2018: improved by Georgios Samaras and released in class v2.7.0 -10.2025: for v3.2.5: made compatible with python 3, credits Thimothy Morton and Mowen Zhao +10.2025: for v3.2.5: made compatible with python 3, credits Timothy Morton and Mowen Zhao For installation of python packages, run diff --git a/include/common.h b/include/common.h index 2100f1cb6..699fcd18c 100644 --- a/include/common.h +++ b/include/common.h @@ -15,7 +15,7 @@ #ifndef __COMMON__ #define __COMMON__ -#define _VERSION_ "v3.2.4" +#define _VERSION_ "v3.2.5" /* @cond INCLUDE_WITH_DOXYGEN */ diff --git a/source/input.c b/source/input.c index 954311d6f..f35aa82cc 100644 --- a/source/input.c +++ b/source/input.c @@ -2560,18 +2560,28 @@ int input_read_parameters_species(struct file_content * pfc, errmsg, errmsg); - /** 5.d) Mass or Omega of each ncdm species */ + /** 5.d) Mass and/or Omega of each ncdm species */ /* Read */ class_read_list_of_doubles_or_default("m_ncdm",pba->m_ncdm_in_eV,0.0,N_ncdm); + for (n=0; nm_ncdm_in_eV[n]<0, + errmsg, + "You entered a negative non-CDM mass m_ncdm[%d], which makes no sense. This error was not caught in previous CLASS versions because the mass is always squared in the code, so CLASS returned the exact same results form +m_ncdm and -m_ncdm. If you want to define an 'effective negative neutrino mass' in the sense of e.g. 2405.00836 or 2407.10965, you can implement it in a python script following e.g. eq.(3) of 2407.10965",n); + } + class_read_list_of_doubles_or_default("Omega_ncdm",pba->Omega0_ncdm,0.0,N_ncdm); + // the name M_ncdm is borrowed temporarily to store omega_ncdm class_read_list_of_doubles_or_default("omega_ncdm",pba->M_ncdm,0.0,N_ncdm); for (n=0; nM_ncdm[n]!=0.0){ /* Test */ class_test(pba->Omega0_ncdm[n]!=0,errmsg, "You can only enter one of 'Omega_ncdm' or 'omega_ncdm' for ncdm species %d.",n); - /* Complete set of parameters */ + /* Complete set of parameters: if the user passed either + Omega_ncdm or omega_ncdm, now it's stored anyway as + Omega_0_ncdm */ pba->Omega0_ncdm[n] = pba->M_ncdm[n]/pba->h/pba->h; + // the name M_ncdm is now available for its real destination } /* Set default value this is the right place for passing the default value of the mass