From 36123b06392d89897671fab8367c2fdf28b78209 Mon Sep 17 00:00:00 2001 From: Gordon McCann Date: Tue, 24 Jan 2023 18:37:28 -0500 Subject: [PATCH] Fix a bug in the kinematics calculation where angle was converted from degrees to radians twice --- spspy/SPSReaction.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spspy/SPSReaction.py b/spspy/SPSReaction.py index d4490bc..90147ee 100644 --- a/spspy/SPSReaction.py +++ b/spspy/SPSReaction.py @@ -58,8 +58,10 @@ class Reaction: if beamRxnEnergy < threshold: return INVALID_KINETIC_ENERGY - term1 = sqrt(self.params.projectile.mass * self.params.ejectile.mass * beamRxnEnergy) / (self.params.ejectile.mass + self.residual.mass) * cos(angleRads * self.DEG2RAD) + term1 = sqrt(self.params.projectile.mass * self.params.ejectile.mass * beamRxnEnergy) / (self.params.ejectile.mass + self.residual.mass) * cos(angleRads) term2 = (beamRxnEnergy * (self.residual.mass - self.params.projectile.mass) + self.residual.mass * rxnQ) / (self.params.ejectile.mass + self.residual.mass) + if(term1**2.0 + term2) < 0: + return INVALID_KINETIC_ENERGY ke1 = term1 + sqrt(term1**2.0 + term2) ke2 = term1 + sqrt(term1**2.0 + term2)