Commit 60d52445 authored by lucienPan's avatar lucienPan
Browse files

Remove the const of costh12, costh13 costh23 in KOKKOS class dihedral

parent b606e953
Loading
Loading
Loading
Loading
+9 −15
Original line number Diff line number Diff line
@@ -243,26 +243,20 @@ void DihedralClass2Kokkos<DeviceType>::operator()(TagDihedralClass2Compute<NEWTO
  const F_FLOAT sb3 = 1.0/r3mag2;
  const F_FLOAT rb3 = 1.0/r3;

  const F_FLOAT c0 = (vb1x*vb3x + vb1y*vb3y + vb1z*vb3z) * rb1*rb3;
  F_FLOAT c0 = (vb1x*vb3x + vb1y*vb3y + vb1z*vb3z) * rb1*rb3;

  // 1st and 2nd angle

  const F_FLOAT r12c1 = rb1*rb2;
  const F_FLOAT r12c2 = rb2*rb3;
  const F_FLOAT costh12 = (vb1x*vb2x + vb1y*vb2y + vb1z*vb2z) * r12c1;
  const F_FLOAT costh13 = c0;
  const F_FLOAT costh23 = (vb2xm*vb3x + vb2ym*vb3y + vb2zm*vb3z) * r12c2;

  {
    F_FLOAT& ctmp12 = const_cast<F_FLOAT&>(costh12);
    F_FLOAT& ctmp13 = const_cast<F_FLOAT&>(costh13);
    F_FLOAT& ctmp23 = const_cast<F_FLOAT&>(costh23);
    F_FLOAT& ctmp0  = const_cast<F_FLOAT&>(c0);
    ctmp12 = MAX(MIN(costh12, 1.0), -1.0);
    ctmp13 = MAX(MIN(costh13, 1.0), -1.0);
    ctmp23 = MAX(MIN(costh23, 1.0), -1.0);
    ctmp0  = costh13;
  }
  F_FLOAT costh12 = (vb1x*vb2x + vb1y*vb2y + vb1z*vb2z) * r12c1;
  F_FLOAT costh13 = c0;
  F_FLOAT costh23 = (vb2xm*vb3x + vb2ym*vb3y + vb2zm*vb3z) * r12c2;

  costh12 = MAX(MIN(costh12, 1.0), -1.0);
  costh13 = MAX(MIN(costh13, 1.0), -1.0);
  costh23 = MAX(MIN(costh23, 1.0), -1.0);
  c0 = costh13;

  // cos and sin of 2 angles and final c