diff --git a/src/pair.cpp b/src/pair.cpp index e108c712a1..eafcf652ce 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -522,6 +522,59 @@ void Pair::ev_tally_xyz(int i, int j, int nlocal, int newton_pair, } } +/* ---------------------------------------------------------------------- + tally eng_vdwl and virial into global and per-atom accumulators + for virial, have delx,dely,delz and fx,fy,fz + called when using full neighbor lists +------------------------------------------------------------------------- */ + +void Pair::ev_tally_xyz_full(int i, double evdwl, double ecoul, + double fx, double fy, double fz, + double delx, double dely, double delz) +{ + double evdwlhalf,ecoulhalf,epairhalf,v[6]; + + if (eflag_either) { + if (eflag_global) { + evdwlhalf = 0.5*evdwl; + ecoulhalf = 0.5*ecoul; + eng_vdwl += evdwlhalf; + eng_coul += ecoulhalf; + } + if (eflag_atom) { + epairhalf = 0.5 * (evdwl + ecoul); + eatom[i] += epairhalf; + } + } + + if (vflag_either) { + v[0] = delx*fx; + v[1] = dely*fy; + v[2] = delz*fz; + v[3] = delx*fy; + v[4] = delx*fz; + v[5] = dely*fz; + } + + if (vflag_global) { + virial[0] += 0.5*v[0]; + virial[1] += 0.5*v[1]; + virial[2] += 0.5*v[2]; + virial[3] += 0.5*v[3]; + virial[4] += 0.5*v[4]; + virial[5] += 0.5*v[5]; + } + + if (vflag_atom) { + vatom[i][0] += 0.5*v[0]; + vatom[i][1] += 0.5*v[1]; + vatom[i][2] += 0.5*v[2]; + vatom[i][3] += 0.5*v[3]; + vatom[i][4] += 0.5*v[4]; + vatom[i][5] += 0.5*v[5]; + } +} + /* ---------------------------------------------------------------------- tally eng_vdwl and virial into global and per-atom accumulators called by SW potential, newton_pair is always on diff --git a/src/pair.h b/src/pair.h index 3b3e3f9f36..9f1a10cfea 100644 --- a/src/pair.h +++ b/src/pair.h @@ -126,6 +126,8 @@ class Pair : protected Pointers { void ev_tally_full(int, double, double, double, double, double, double); void ev_tally_xyz(int, int, int, int, double, double, double, double, double, double, double, double); + void ev_tally_xyz_full(int, double, double, + double, double, double, double, double, double); void ev_tally3(int, int, int, double, double, double *, double *, double *, double *); void ev_tally4(int, int, int, int, double,