Skip to content
Snippets Groups Projects
Commit 5c5b4ffa authored by sjplimp's avatar sjplimp Committed by GitHub
Browse files

Merge pull request #522 from akohlmey/tip4p-cleanup-refactor

Refactor and bugfix for some TIP4P pair styles
parents 30177c4e 2e728972
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
......@@ -104,7 +104,7 @@ void PairLJCutTIP4PLongOMP::compute(int eflag, int vflag)
thr->timer(Timer::START);
ev_setup_thr(eflag, vflag, nall, eatom, vatom, thr);
if (!ncoultablebits) {
if (ncoultablebits) {
if (evflag) {
if (eflag) {
if (vflag) eval<1,1,1,1>(ifrom, ito, thr);
......@@ -156,6 +156,7 @@ void PairLJCutTIP4PLongOMP::eval(int iifrom, int iito, ThrData * const thr)
dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0];
const double * _noalias const q = atom->q;
const int * _noalias const type = atom->type;
const tagint * _noalias const tag = atom->tag;
const int nlocal = atom->nlocal;
const double * _noalias const special_coul = force->special_coul;
const double * _noalias const special_lj = force->special_lj;
......@@ -187,8 +188,8 @@ void PairLJCutTIP4PLongOMP::eval(int iifrom, int iito, ThrData * const thr)
// will be the same, there is no race condition.
if (itype == typeO) {
if (hneigh_thr[i].a < 0) {
iH1 = atom->map(atom->tag[i] + 1);
iH2 = atom->map(atom->tag[i] + 2);
iH1 = atom->map(tag[i] + 1);
iH2 = atom->map(tag[i] + 2);
if (iH1 == -1 || iH2 == -1)
error->one(FLERR,"TIP4P hydrogen is missing");
if (atom->type[iH1] != typeH || atom->type[iH2] != typeH)
......@@ -267,8 +268,8 @@ void PairLJCutTIP4PLongOMP::eval(int iifrom, int iito, ThrData * const thr)
if (jtype == typeO) {
if (hneigh_thr[j].a < 0) {
jH1 = atom->map(atom->tag[j] + 1);
jH2 = atom->map(atom->tag[j] + 2);
jH1 = atom->map(tag[j] + 1);
jH2 = atom->map(tag[j] + 2);
if (jH1 == -1 || jH2 == -1)
error->one(FLERR,"TIP4P hydrogen is missing");
if (atom->type[jH1] != typeH || atom->type[jH2] != typeH)
......@@ -301,7 +302,7 @@ void PairLJCutTIP4PLongOMP::eval(int iifrom, int iito, ThrData * const thr)
if (rsq < cut_coulsq) {
r2inv = 1 / rsq;
if (CTABLE || rsq <= tabinnersq) {
if (!CTABLE || rsq <= tabinnersq) {
r = sqrt(rsq);
grij = g_ewald * r;
expm2 = exp(-grij*grij);
......@@ -337,7 +338,7 @@ void PairLJCutTIP4PLongOMP::eval(int iifrom, int iito, ThrData * const thr)
// virial = sum(r x F) where each water's atoms are near xi and xj
// vlist stores 2,4,6 atoms whose forces contribute to virial
if (EVFLAG) {
if (VFLAG) {
n = 0;
key = 0;
}
......@@ -354,11 +355,11 @@ void PairLJCutTIP4PLongOMP::eval(int iifrom, int iito, ThrData * const thr)
v[3] = x[i].x * dely * cforce;
v[4] = x[i].x * delz * cforce;
v[5] = x[i].y * delz * cforce;
vlist[n++] = i;
}
if (EVFLAG) vlist[n++] = i;
} else {
if (EVFLAG) key++;
if (VFLAG) key++;
fdx = delx*cforce;
fdy = dely*cforce;
......@@ -393,8 +394,6 @@ void PairLJCutTIP4PLongOMP::eval(int iifrom, int iito, ThrData * const thr)
v[3] = x[i].x*fOy + xH1.x*fHy + xH2.x*fHy;
v[4] = x[i].x*fOz + xH1.x*fHz + xH2.x*fHz;
v[5] = x[i].y*fOz + xH1.y*fHz + xH2.y*fHz;
}
if (EVFLAG) {
vlist[n++] = i;
vlist[n++] = iH1;
vlist[n++] = iH2;
......@@ -413,11 +412,11 @@ void PairLJCutTIP4PLongOMP::eval(int iifrom, int iito, ThrData * const thr)
v[3] -= x[j].x * dely * cforce;
v[4] -= x[j].x * delz * cforce;
v[5] -= x[j].y * delz * cforce;
vlist[n++] = j;
}
if (EVFLAG) vlist[n++] = j;
} else {
if (EVFLAG) key += 2;
if (VFLAG) key += 2;
fdx = -delx*cforce;
fdy = -dely*cforce;
......@@ -452,8 +451,6 @@ void PairLJCutTIP4PLongOMP::eval(int iifrom, int iito, ThrData * const thr)
v[3] += x[j].x*fOy + xH1.x*fHy + xH2.x*fHy;
v[4] += x[j].x*fOz + xH1.x*fHz + xH2.x*fHz;
v[5] += x[j].y*fOz + xH1.y*fHz + xH2.y*fHz;
}
if (EVFLAG) {
vlist[n++] = j;
vlist[n++] = jH1;
vlist[n++] = jH2;
......@@ -461,7 +458,7 @@ void PairLJCutTIP4PLongOMP::eval(int iifrom, int iito, ThrData * const thr)
}
if (EFLAG) {
if (CTABLE || rsq <= tabinnersq)
if (!CTABLE || rsq <= tabinnersq)
ecoul = prefactor*erfc;
else {
table = etable[itable] + fraction*detable[itable];
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment