use ev_init for angles

This commit is contained in:
Sebastian Hütter 2019-03-13 17:51:41 +01:00
parent c7af948dfc
commit 6e6f903818
43 changed files with 46 additions and 114 deletions

View File

@ -78,8 +78,7 @@ void AngleClass2::compute(int eflag, int vflag)
double vx11,vx12,vy11,vy12,vz11,vz12,vx21,vx22,vy21,vy22,vz21,vz22;
eangle = 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

@ -64,8 +64,7 @@ void AngleCharmmKokkos<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

@ -64,8 +64,7 @@ void AngleClass2Kokkos<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

@ -64,8 +64,7 @@ void AngleCosineKokkos<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

@ -64,8 +64,7 @@ void AngleHarmonicKokkos<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 AngleCharmm::compute(int eflag, int vflag)
double delxUB,delyUB,delzUB,rsqUB,rUB,dr,rk,forceUB;
eangle = 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

@ -52,8 +52,7 @@ void AngleCosine::compute(int eflag, int vflag)
double rsq1,rsq2,r1,r2,c,a,a11,a12,a22;
eangle = 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

@ -44,8 +44,7 @@ void AngleCosineDelta::compute(int eflag, int vflag)
double rsq1,rsq2,r1,r2,c,a,cot,a11,a12,a22,b11,b12,b22,c0,s0,s;
eangle = 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 AngleCosinePeriodic::compute(int eflag, int vflag)
double tn,tn_1,tn_2,un,un_1,un_2;
eangle = 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

@ -62,8 +62,7 @@ void AngleCosineSquared::compute(int eflag, int vflag)
double rsq1,rsq2,r1,r2,c,a,a11,a12,a22;
eangle = 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

@ -58,8 +58,7 @@ void AngleHarmonic::compute(int eflag, int vflag)
double rsq1,rsq2,r1,r2,c,s,a,a11,a12,a22;
eangle = 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

@ -72,8 +72,7 @@ void AngleTable::compute(int eflag, int vflag)
double theta,u,mdu; //mdu: minus du, -du/dx=f
eangle = 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

@ -68,8 +68,7 @@ void AngleSDK::compute(int eflag, int vflag)
double rsq1,rsq2,rsq3,r1,r2,c,s,a,a11,a12,a22;
eangle = 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

@ -78,8 +78,7 @@ void AngleCharmmIntel::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

@ -78,8 +78,7 @@ void AngleHarmonicIntel::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

@ -62,8 +62,7 @@ void AngleCosineShift::compute(int eflag, int vflag)
double rsq1,rsq2,r1,r2,c,s,cps,kcos,ksin,a11,a12,a22;
eangle = 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

@ -72,8 +72,7 @@ void AngleCosineShiftExp::compute(int eflag, int vflag)
double exp2,aa,uumin,cccpsss,cssmscc;
eangle = 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 AngleDipole::compute(int eflag, int vflag)
double r,cosGamma,deltaGamma,kdg,rmu;
eangle = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag);
else evflag = 0;
ev_init(eflag,vflag);
double **x = atom->x; // position vector
double **mu = atom->mu; // point-dipole components and moment magnitude

View File

@ -67,8 +67,7 @@ void AngleFourier::compute(int eflag, int vflag)
double rsq1,rsq2,r1,r2,c,c2,a,a11,a12,a22;
eangle = 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 AngleFourierSimple::compute(int eflag, int vflag)
double rsq1,rsq2,r1,r2,c,cn,th,nth,a,a11,a12,a22;
eangle = 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 AngleQuartic::compute(int eflag, int vflag)
double rsq1,rsq2,r1,r2,c,s,a,a11,a12,a22;
eangle = 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

@ -79,8 +79,7 @@ void AngleClass2P6::compute(int eflag, int vflag)
double vx11,vx12,vy11,vy12,vz11,vz12,vx21,vx22,vy21,vy22,vz21,vz22;
eangle = 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

@ -69,8 +69,7 @@ void AngleCosineBuck6d::compute(int eflag, int vflag)
double rcu,rqu,sme,smf;
eangle = evdwl = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag);
else evflag = 0;
ev_init(eflag,vflag);
// insure pair->ev_tally() will use 1-3 virial contribution

View File

@ -44,10 +44,7 @@ using namespace MathConst;
void AngleCharmmOMP::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

@ -44,10 +44,7 @@ AngleClass2OMP::AngleClass2OMP(class LAMMPS *lmp)
void AngleClass2OMP::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

@ -44,10 +44,7 @@ AngleCosineDeltaOMP::AngleCosineDeltaOMP(class LAMMPS *lmp)
void AngleCosineDeltaOMP::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

@ -44,10 +44,7 @@ AngleCosineOMP::AngleCosineOMP(class LAMMPS *lmp)
void AngleCosineOMP::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

@ -46,10 +46,7 @@ AngleCosinePeriodicOMP::AngleCosinePeriodicOMP(class LAMMPS *lmp)
void AngleCosinePeriodicOMP::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

@ -44,10 +44,7 @@ AngleCosineShiftExpOMP::AngleCosineShiftExpOMP(class LAMMPS *lmp)
void AngleCosineShiftExpOMP::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

@ -44,10 +44,7 @@ AngleCosineShiftOMP::AngleCosineShiftOMP(class LAMMPS *lmp)
void AngleCosineShiftOMP::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

@ -44,10 +44,7 @@ AngleCosineSquaredOMP::AngleCosineSquaredOMP(class LAMMPS *lmp)
void AngleCosineSquaredOMP::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 @@ AngleDipoleOMP::AngleDipoleOMP(class LAMMPS *lmp)
void AngleDipoleOMP::compute(int eflag, int vflag)
{
if (eflag || vflag) {
ev_setup(eflag,vflag);
} else evflag = 0;
ev_init(eflag,vflag);
if (!force->newton_bond)
error->all(FLERR,"'newton' flag for bonded interactions must be 'on'");

View File

@ -44,10 +44,7 @@ AngleFourierOMP::AngleFourierOMP(class LAMMPS *lmp)
void AngleFourierOMP::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

@ -44,10 +44,7 @@ AngleFourierSimpleOMP::AngleFourierSimpleOMP(class LAMMPS *lmp)
void AngleFourierSimpleOMP::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

@ -44,10 +44,7 @@ AngleHarmonicOMP::AngleHarmonicOMP(class LAMMPS *lmp)
void AngleHarmonicOMP::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

@ -44,10 +44,7 @@ AngleQuarticOMP::AngleQuarticOMP(class LAMMPS *lmp)
void AngleQuarticOMP::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

@ -46,10 +46,7 @@ AngleSDKOMP::AngleSDKOMP(class LAMMPS *lmp)
void AngleSDKOMP::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

@ -44,10 +44,7 @@ AngleTableOMP::AngleTableOMP(class LAMMPS *lmp)
void AngleTableOMP::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 AngleCross::compute(int eflag, int vflag)
double vx11,vx12,vy11,vy12,vz11,vz12,vx21,vx22,vy21,vy22,vz21,vz22;
eangle = 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 AngleMM3::compute(int eflag, int vflag)
double rsq1,rsq2,r1,r2,c,s,a,a11,a12,a22;
eangle = 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,6 +59,10 @@ class Angle : 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, double, double *, double *,
double, double, double, double, double, double);
};

View File

@ -103,8 +103,7 @@ void AngleHybrid::compute(int eflag, int vflag)
// set neighbor->anglelist to sub-style anglelist 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->nanglelist = nanglelist[m];

View File

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