Clip negative atom densities that result from CRAM (#3879)

Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
Perry 2026-04-21 13:24:53 -07:00 committed by GitHub
parent a1df5842e0
commit 1f7ac4215f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -738,6 +738,11 @@ class Integrator(ABC):
results = deplete(
self._solver, self.chain, n, rates, dt, i, matrix_func,
self.transfer_rates, self.external_source_rates)
# Clip unphysical negative number densities
for r in results:
r.clip(min=0.0, out=r)
return time.time() - start, results
@abstractmethod

View file

@ -24,7 +24,7 @@ DepletionSolutionTuple = namedtuple(
predictor_solution = DepletionSolutionTuple(
PredictorIntegrator, np.array([1.0, 2.46847546272295, 4.11525874568034]),
np.array([1.0, 0.986431226850467, -0.0581692232513460]))
np.array([1.0, 0.986431226850467, 0.0]))
cecm_solution = DepletionSolutionTuple(