use ev_init for dihedrals

This commit is contained in:
Sebastian Hütter
2019-03-13 17:53:22 +01:00
parent 6e6f903818
commit fbd600592b
35 changed files with 38 additions and 94 deletions

View File

@ -118,8 +118,7 @@ void DihedralClass2::compute(int eflag, int vflag)
double fabcd[4][3]; double fabcd[4][3];
edihedral = 0.0; edihedral = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag); ev_init(eflag,vflag);
else evflag = 0;
double **x = atom->x; double **x = atom->x;
double **f = atom->f; double **f = atom->f;

View File

@ -69,8 +69,7 @@ void DihedralCharmmKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
eflag = eflag_in; eflag = eflag_in;
vflag = vflag_in; vflag = vflag_in;
if (eflag || vflag) ev_setup(eflag,vflag,0); ev_init(eflag,vflag,0);
else evflag = 0;
// insure pair->ev_tally() will use 1-4 virial contribution // insure pair->ev_tally() will use 1-4 virial contribution

View File

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

View File

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

View File

@ -76,8 +76,7 @@ void DihedralCharmm::compute(int eflag, int vflag)
double forcecoul,forcelj,fpair,ecoul,evdwl; double forcecoul,forcelj,fpair,ecoul,evdwl;
edihedral = evdwl = ecoul = 0.0; edihedral = evdwl = ecoul = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag); ev_init(eflag,vflag);
else evflag = 0;
// insure pair->ev_tally() will use 1-4 virial contribution // insure pair->ev_tally() will use 1-4 virial contribution

View File

@ -79,8 +79,7 @@ void DihedralCharmmfsw::compute(int eflag, int vflag)
double forcecoul,forcelj,fpair,ecoul,evdwl; double forcecoul,forcelj,fpair,ecoul,evdwl;
edihedral = evdwl = ecoul = 0.0; edihedral = evdwl = ecoul = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag); ev_init(eflag,vflag);
else evflag = 0;
// insure pair->ev_tally() will use 1-4 virial contribution // insure pair->ev_tally() will use 1-4 virial contribution

View File

@ -67,8 +67,7 @@ void DihedralHarmonic::compute(int eflag, int vflag)
double c,s,p,sx2,sy2,sz2; double c,s,p,sx2,sy2,sz2;
edihedral = 0.0; edihedral = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag); ev_init(eflag,vflag);
else evflag = 0;
double **x = atom->x; double **x = atom->x;
double **f = atom->f; double **f = atom->f;

View File

@ -67,8 +67,7 @@ void DihedralHelix::compute(int eflag, int vflag)
double s2,cx,cy,cz,cmag,dx,phi,si,siinv,sin2; double s2,cx,cy,cz,cmag,dx,phi,si,siinv,sin2;
edihedral = 0.0; edihedral = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag); ev_init(eflag,vflag);
else evflag = 0;
double **x = atom->x; double **x = atom->x;
double **f = atom->f; double **f = atom->f;

View File

@ -64,8 +64,7 @@ void DihedralMultiHarmonic::compute(int eflag, int vflag)
double s2,sin2; double s2,sin2;
edihedral = 0.0; edihedral = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag); ev_init(eflag,vflag);
else evflag = 0;
double **x = atom->x; double **x = atom->x;
double **f = atom->f; double **f = atom->f;

View File

@ -67,8 +67,7 @@ void DihedralOPLS::compute(int eflag, int vflag)
double s2,cx,cy,cz,cmag,dx,phi,si,siinv,sin2; double s2,cx,cy,cz,cmag,dx,phi,si,siinv,sin2;
edihedral = 0.0; edihedral = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag); ev_init(eflag,vflag);
else evflag = 0;
double **x = atom->x; double **x = atom->x;
double **f = atom->f; double **f = atom->f;

View File

@ -84,9 +84,7 @@ void DihedralCharmmIntel::compute(int eflag, int vflag,
IntelBuffers<flt_t,acc_t> *buffers, IntelBuffers<flt_t,acc_t> *buffers,
const ForceConst<flt_t> &fc) const ForceConst<flt_t> &fc)
{ {
if (eflag || vflag) { ev_init(eflag,vflag);
ev_setup(eflag,vflag);
} else evflag = 0;
// insure pair->ev_tally() will use 1-4 virial contribution // insure pair->ev_tally() will use 1-4 virial contribution

View File

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

View File

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

View File

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

View File

@ -68,8 +68,7 @@ void DihedralCosineShiftExp::compute(int eflag, int vflag)
double cccpsss,cssmscc,exp2; double cccpsss,cssmscc,exp2;
edihedral = 0.0; edihedral = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag); ev_init(eflag,vflag);
else evflag = 0;
double **x = atom->x; double **x = atom->x;
double **f = atom->f; double **f = atom->f;

View File

@ -79,8 +79,7 @@ void DihedralFourier::compute(int eflag, int vflag)
double dtfx,dtfy,dtfz,dtgx,dtgy,dtgz,dthx,dthy,dthz; double dtfx,dtfy,dtfz,dtgx,dtgy,dtgz,dthx,dthy,dthz;
double c,s,p_,sx2,sy2,sz2; double c,s,p_,sx2,sy2,sz2;
if (eflag || vflag) ev_setup(eflag,vflag); ev_init(eflag,vflag);
else evflag = 0;
double **x = atom->x; double **x = atom->x;
double **f = atom->f; double **f = atom->f;

View File

@ -66,8 +66,7 @@ void DihedralNHarmonic::compute(int eflag, int vflag)
double s2,sin2; double s2,sin2;
edihedral = 0.0; edihedral = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag); ev_init(eflag,vflag);
else evflag = 0;
double **x = atom->x; double **x = atom->x;
double **f = atom->f; double **f = atom->f;

View File

@ -65,8 +65,7 @@ void DihedralQuadratic::compute(int eflag, int vflag)
double s2,cx,cy,cz,cmag,dx,phi,si,siinv,sin2; double s2,cx,cy,cz,cmag,dx,phi,si,siinv,sin2;
edihedral = 0.0; edihedral = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag); ev_init(eflag,vflag);
else evflag = 0;
double **x = atom->x; double **x = atom->x;
double **f = atom->f; double **f = atom->f;

View File

@ -213,8 +213,7 @@ void DihedralSpherical::compute(int eflag, int vflag)
// perp34on23[d] = v34[d] - proj34on23[d] // perp34on23[d] = v34[d] - proj34on23[d]
edihedral = 0.0; edihedral = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag); ev_init(eflag,vflag);
else evflag = 0;
for (n = 0; n < ndihedrallist; n++) { for (n = 0; n < ndihedrallist; n++) {

View File

@ -549,8 +549,7 @@ void DihedralTable::compute(int eflag, int vflag)
edihedral = 0.0; edihedral = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag); ev_init(eflag,vflag);
else evflag = 0;
for (n = 0; n < ndihedrallist; n++) { for (n = 0; n < ndihedrallist; n++) {

View File

@ -472,8 +472,7 @@ void DihedralTableCut::compute(int eflag, int vflag)
double fabcd[4][3]; double fabcd[4][3];
edihedral = 0.0; edihedral = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag); ev_init(eflag,vflag);
else evflag = 0;
double **x = atom->x; double **x = atom->x;
double **f = atom->f; double **f = atom->f;

View File

@ -45,10 +45,7 @@ DihedralCharmmOMP::DihedralCharmmOMP(class LAMMPS *lmp)
void DihedralCharmmOMP::compute(int eflag, int vflag) void DihedralCharmmOMP::compute(int eflag, int vflag)
{ {
ev_init(eflag,vflag);
if (eflag || vflag) {
ev_setup(eflag,vflag);
} else evflag = 0;
// insure pair->ev_tally() will use 1-4 virial contribution // insure pair->ev_tally() will use 1-4 virial contribution

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -57,6 +57,10 @@ class Dihedral : protected Pointers {
int maxeatom,maxvatom; int maxeatom,maxvatom;
void ev_setup(int, int, int alloc = 1); 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, void ev_tally(int, int, int, int, int, int, double,
double *, double *, double *, double, double, double, double *, double *, double *, double, double, double,
double, double, double, double, double, double); double, double, double, double, double, double);

View File

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

View File

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