use ev_init for impropers

This commit is contained in:
Sebastian Hütter
2019-03-13 17:50:50 +01:00
parent 17c81295c2
commit c7af948dfc
25 changed files with 28 additions and 62 deletions

View File

@ -90,8 +90,7 @@ void ImproperClass2::compute(int eflag, int vflag)
double fabcd[4][3];
eimproper = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag);
else evflag = 0;
ev_init(eflag,vflag);
for (i = 0; i < 3; i++)
for (j = 0; j < 4; j++)

View File

@ -71,8 +71,7 @@ void ImproperClass2Kokkos<DeviceType>::compute(int eflag_in, int vflag_in)
eflag = eflag_in;
vflag = vflag_in;
if (eflag || vflag) ev_setup(eflag,vflag,0);
else evflag = 0;
ev_init(eflag,vflag,0);
// reallocate per-atom arrays if necessary

View File

@ -71,8 +71,7 @@ void ImproperHarmonicKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
eflag = eflag_in;
vflag = vflag_in;
if (eflag || vflag) ev_setup(eflag,vflag,0);
else evflag = 0;
ev_init(eflag,vflag,0);
// reallocate per-atom arrays if necessary

View File

@ -61,8 +61,7 @@ void ImproperCvff::compute(int eflag, int vflag)
double a33,a12,a13,a23,sx2,sy2,sz2;
eimproper = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag);
else evflag = 0;
ev_init(eflag,vflag);
double **x = atom->x;
double **f = atom->f;

View File

@ -61,8 +61,7 @@ void ImproperHarmonic::compute(int eflag, int vflag)
double sx2,sy2,sz2;
eimproper = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag);
else evflag = 0;
ev_init(eflag,vflag);
double **x = atom->x;
double **f = atom->f;

View File

@ -65,8 +65,7 @@ void ImproperUmbrella::compute(int eflag, int vflag)
double ax,ay,az,ra2,rh2,ra,rh,rar,rhr,arx,ary,arz,hrx,hry,hrz;
eimproper = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag);
else evflag = 0;
ev_init(eflag,vflag);
double **x = atom->x;
double **f = atom->f;

View File

@ -83,8 +83,7 @@ void ImproperCvffIntel::compute(int eflag, int vflag,
IntelBuffers<flt_t,acc_t> *buffers,
const ForceConst<flt_t> &fc)
{
if (eflag || vflag) ev_setup(eflag,vflag);
else evflag = 0;
ev_init(eflag,vflag);
if (evflag) {
if (vflag && !eflag) {

View File

@ -84,8 +84,7 @@ void ImproperHarmonicIntel::compute(int eflag, int vflag,
IntelBuffers<flt_t,acc_t> *buffers,
const ForceConst<flt_t> &fc)
{
if (eflag || vflag) ev_setup(eflag,vflag);
else evflag = 0;
ev_init(eflag,vflag);
if (evflag) {
if (vflag && !eflag) {

View File

@ -63,8 +63,7 @@ void ImproperCossq::compute(int eflag, int vflag)
eimproper = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag);
else evflag = 0;
ev_init(eflag,vflag);
double **x = atom->x;
double **f = atom->f;

View File

@ -67,8 +67,7 @@ void ImproperDistance::compute(int eflag, int vflag)
double domega,a;
eimproper = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag);
else evflag = 0;
ev_init(eflag,vflag);
double **x = atom->x;
double **f = atom->f;

View File

@ -59,8 +59,7 @@ void ImproperFourier::compute(int eflag, int vflag)
int i1,i2,i3,i4,n,type;
double vb1x,vb1y,vb1z,vb2x,vb2y,vb2z,vb3x,vb3y,vb3z;
if (eflag || vflag) ev_setup(eflag,vflag);
else evflag = 0;
ev_init(eflag,vflag);
double **x = atom->x;
int **improperlist = neighbor->improperlist;

View File

@ -95,8 +95,7 @@ void ImproperRing::compute(int eflag, int vflag)
double cjiji, ckjji, ckjkj, fix, fiy, fiz, fjx, fjy, fjz, fkx, fky, fkz;
eimproper = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag);
else evflag = 0;
ev_init(eflag,vflag);
/* References to simulation data. */
double **x = atom->x;

View File

@ -66,8 +66,7 @@ void ImproperInversionHarmonic::compute(int eflag, int vflag)
double vb1x,vb1y,vb1z,vb2x,vb2y,vb2z,vb3x,vb3y,vb3z;
double rrvb1,rrvb2,rrvb3,rr2vb1,rr2vb2,rr2vb3;
if (eflag || vflag) ev_setup(eflag,vflag);
else evflag = 0;
ev_init(eflag,vflag);
double **x = atom->x;
int **improperlist = neighbor->improperlist;

View File

@ -43,10 +43,7 @@ ImproperClass2OMP::ImproperClass2OMP(class LAMMPS *lmp)
void ImproperClass2OMP::compute(int eflag, int vflag)
{
if (eflag || vflag) {
ev_setup(eflag,vflag);
} else evflag = 0;
ev_init(eflag,vflag);
const int nall = atom->nlocal + atom->nghost;
const int nthreads = comm->nthreads;

View File

@ -43,10 +43,7 @@ ImproperCossqOMP::ImproperCossqOMP(class LAMMPS *lmp)
void ImproperCossqOMP::compute(int eflag, int vflag)
{
if (eflag || vflag) {
ev_setup(eflag,vflag);
} else evflag = 0;
ev_init(eflag,vflag);
const int nall = atom->nlocal + atom->nghost;
const int nthreads = comm->nthreads;

View File

@ -43,10 +43,7 @@ ImproperCvffOMP::ImproperCvffOMP(class LAMMPS *lmp)
void ImproperCvffOMP::compute(int eflag, int vflag)
{
if (eflag || vflag) {
ev_setup(eflag,vflag);
} else evflag = 0;
ev_init(eflag,vflag);
const int nall = atom->nlocal + atom->nghost;
const int nthreads = comm->nthreads;

View File

@ -43,10 +43,7 @@ ImproperFourierOMP::ImproperFourierOMP(class LAMMPS *lmp)
void ImproperFourierOMP::compute(int eflag, int vflag)
{
if (eflag || vflag) {
ev_setup(eflag,vflag);
} else evflag = 0;
ev_init(eflag,vflag);
const int nall = atom->nlocal + atom->nghost;
const int nthreads = comm->nthreads;

View File

@ -43,10 +43,7 @@ ImproperHarmonicOMP::ImproperHarmonicOMP(class LAMMPS *lmp)
void ImproperHarmonicOMP::compute(int eflag, int vflag)
{
if (eflag || vflag) {
ev_setup(eflag,vflag);
} else evflag = 0;
ev_init(eflag,vflag);
const int nall = atom->nlocal + atom->nghost;
const int nthreads = comm->nthreads;

View File

@ -45,10 +45,7 @@ ImproperRingOMP::ImproperRingOMP(class LAMMPS *lmp)
void ImproperRingOMP::compute(int eflag, int vflag)
{
if (eflag || vflag) {
ev_setup(eflag,vflag);
} else evflag = 0;
ev_init(eflag,vflag);
const int nall = atom->nlocal + atom->nghost;
const int nthreads = comm->nthreads;

View File

@ -43,10 +43,7 @@ ImproperUmbrellaOMP::ImproperUmbrellaOMP(class LAMMPS *lmp)
void ImproperUmbrellaOMP::compute(int eflag, int vflag)
{
if (eflag || vflag) {
ev_setup(eflag,vflag);
} else evflag = 0;
ev_init(eflag,vflag);
const int nall = atom->nlocal + atom->nghost;
const int nthreads = comm->nthreads;

View File

@ -67,8 +67,7 @@ void ImproperDistHarm::compute(int eflag, int vflag)
double domega,a;
eimproper = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag);
else evflag = 0;
ev_init(eflag,vflag);
double **x = atom->x;
double **f = atom->f;

View File

@ -67,8 +67,7 @@ void ImproperSQDistHarm::compute(int eflag, int vflag)
double domega,a;
eimproper = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag);
else evflag = 0;
ev_init(eflag,vflag);
double **x = atom->x;
double **f = atom->f;

View File

@ -57,6 +57,10 @@ class Improper : protected Pointers {
int maxeatom,maxvatom;
void ev_setup(int, int, int alloc = 1);
void ev_init(int eflag, int vflag, int alloc = 1) {
if (eflag||vflag) ev_setup(eflag, vflag, alloc);
else evflag = eflag_either = eflag_global = eflag_atom = vflag_either = vflag_global = vflag_atom = 0;
}
void ev_tally(int, int, int, int, int, int, double,
double *, double *, double *, double, double, double,
double, double, double, double, double, double);

View File

@ -104,8 +104,7 @@ void ImproperHybrid::compute(int eflag, int vflag)
// set neighbor->improperlist to sub-style improperlist before call
// accumulate sub-style global/peratom energy/virial in hybrid
if (eflag || vflag) ev_setup(eflag,vflag);
else evflag = eflag_global = vflag_global = eflag_atom = vflag_atom = 0;
ev_init(eflag,vflag);
for (m = 0; m < nstyles; m++) {
neighbor->nimproperlist = nimproperlist[m];

View File

@ -44,8 +44,7 @@ ImproperZero::~ImproperZero()
void ImproperZero::compute(int eflag, int vflag)
{
if (eflag || vflag) ev_setup(eflag,vflag);
else evflag = 0;
ev_init(eflag,vflag);
}
/* ---------------------------------------------------------------------- */