Unverified Commit c5fc9208 authored by Richard Berger's avatar Richard Berger Committed by GitHub
Browse files

Merge pull request #1784 from LucienPan0903/master

Patch of class2 dihedral in OMP and Kokkos
parents a5be6e5c 60d52445
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -243,15 +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 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

+5 −0
Original line number Diff line number Diff line
@@ -159,6 +159,11 @@ void DihedralClass2OMP::eval(int nfrom, int nto, ThrData * const thr)
    costh13 = c0;
    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

    sin2 = MAX(1.0 - costh12*costh12,0.0);