From e856c6a27065eb9b2b64dd480f1200020937e276 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Tue, 5 Apr 2022 13:24:18 -0500 Subject: [PATCH] Correction to maxwell dist sampling --- openmc/stats/univariate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openmc/stats/univariate.py b/openmc/stats/univariate.py index ea8c9f9432..72a5568aa3 100644 --- a/openmc/stats/univariate.py +++ b/openmc/stats/univariate.py @@ -452,13 +452,13 @@ class Maxwell(Univariate): def sample(self, n_samples=1, seed=None): np.random.seed(seed) - self.sample_maxwell(self.theta, n_samples) + return self.sample_maxwell(self.theta, n_samples) @staticmethod def sample_maxwell(t, n_samples): r1, r2, r3 = np.random.rand(3, n_samples) c = np.power(np.cos(0.5 * np.pi * r3), 2) - return t * (np.log(r1) + np.log(r2) * c) + return -t * (np.log(r1) + np.log(r2) * c) def to_xml_element(self, element_name): """Return XML representation of the Maxwellian distribution