star-line

Structure for accelerating line importance sampling
git clone git://git.meso-star.fr/star-line.git
Log | Files | Refs | README | LICENSE

commit 9faba14464e3f5a7f750353c8a2ba61c443eba73
parent 7ddf6f9a5f4959c8690ab4daeb68368407bee819
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Fri,  6 Feb 2026 11:35:39 +0100

Fix the way molecular concentrations are checked

The sum of concentrations is not necessarily equal to 1. We can assume
that there are other species with no radiative impact. As a result, the
sum of concentrations may be less than 1.

The test was actually correct when loading a mixture, but not when
constructing the tree.

Diffstat:
Msrc/sln_tree.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/sln_tree.c b/src/sln_tree.c @@ -46,9 +46,12 @@ check_molecule_concentration sum += args->molecules[i].concentration; } - if(!eq_eps(sum, 1, 1e-6)) { + /* The sum of molecular concentrations must be less than or equal to 1. It may + * be less than 1 if the remaining part of the mixture is (implicitly) defined + * as a radiatively inactive gas */ + if(sum > 1 && sum-1 > 1e-6) { ERROR(sln, - "%s: the sum of the concentrations of the molecules does not equal 1: %g.\n", + "%s: the sum of molecule concentrations is greater than 1: %g\n", caller, sum); return RES_BAD_ARG; }