Skip to content

Commit

Permalink
remove unnecessary limit check.
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinRayAngus committed Aug 28, 2024
1 parent 741d231 commit f2c0bbb
Showing 1 changed file with 12 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,33 +239,18 @@ void UpdateMomentumPerezElastic (
T_PR const p2fsz = -p1fsz;

// Transform from COM to lab frame
T_PR p1fx; T_PR p2fx;
T_PR p1fy; T_PR p2fy;
T_PR p1fz; T_PR p2fz;
if ( vcms > std::numeric_limits<T_PR>::min() )
{
T_PR const vcDp1fs = vcx*p1fsx + vcy*p1fsy + vcz*p1fsz;
T_PR const vcDp2fs = vcx*p2fsx + vcy*p2fsy + vcz*p2fsz;
/* factor = (gc-1.0)/vcms; Rewrite to avoid subtraction losing precision when gc is close to 1 */
T_PR const factor = gc*gc*inv_c2/(gc+T_PR(1.0));
T_PR const factor1 = factor*vcDp1fs + m1*g1s*gc;
T_PR const factor2 = factor*vcDp2fs + m2*g2s*gc;
p1fx = p1fsx + vcx * factor1;
p1fy = p1fsy + vcy * factor1;
p1fz = p1fsz + vcz * factor1;
p2fx = p2fsx + vcx * factor2;
p2fy = p2fsy + vcy * factor2;
p2fz = p2fsz + vcz * factor2;
}
else // If vcms = 0, don't do Lorentz-transform.
{
p1fx = p1fsx;
p1fy = p1fsy;
p1fz = p1fsz;
p2fx = p2fsx;
p2fy = p2fsy;
p2fz = p2fsz;
}
T_PR const vcDp1fs = vcx*p1fsx + vcy*p1fsy + vcz*p1fsz;
T_PR const vcDp2fs = vcx*p2fsx + vcy*p2fsy + vcz*p2fsz;
/* factor = (gc-1.0)/vcms; Rewrite to avoid subtraction losing precision when gc is close to 1 */
T_PR const factor = gc*gc*inv_c2/(gc+T_PR(1.0));
T_PR const factor1 = factor*vcDp1fs + m1*g1s*gc;
T_PR const factor2 = factor*vcDp2fs + m2*g2s*gc;
T_PR const p1fx = p1fsx + vcx * factor1;
T_PR const p1fy = p1fsy + vcy * factor1;
T_PR const p1fz = p1fsz + vcz * factor1;
T_PR const p2fx = p2fsx + vcx * factor2;
T_PR const p2fy = p2fsy + vcy * factor2;
T_PR const p2fz = p2fsz + vcz * factor2;

// Rejection method
r = amrex::Random(engine);
Expand Down

0 comments on commit f2c0bbb

Please sign in to comment.