Merge pull request #1784 from LucienPan0903/master

Patch of class2 dihedral in OMP and Kokkos
This commit is contained in:
Richard Berger 2019-12-01 08:11:58 -07:00 committed by GitHub
commit c5fc920881
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View File

@ -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

View File

@ -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);