Make use of ENERGY_ and VIRIAL_ constants
This commit is contained in:
@ -64,23 +64,23 @@ void PairHybridKokkos::compute(int eflag, int vflag)
|
||||
int i,j,m,n;
|
||||
|
||||
// if no_virial_fdotr_compute is set and global component of
|
||||
// incoming vflag = 2, then
|
||||
// reset vflag as if global component were 1
|
||||
// incoming vflag = VIRIAL_FDOTR, then
|
||||
// reset vflag as if global component were VIRIAL_PAIR
|
||||
// necessary since one or more sub-styles cannot compute virial as F dot r
|
||||
|
||||
int neighflag = lmp->kokkos->neighflag;
|
||||
if (neighflag == FULL) no_virial_fdotr_compute = 1;
|
||||
|
||||
if (no_virial_fdotr_compute && vflag % 4 == 2) vflag = 1 + vflag/4 * 4;
|
||||
if (no_virial_fdotr_compute && vflag & VIRIAL_FDOTR) vflag = VIRIAL_PAIR | (vflag & ~VIRIAL_FDOTR);
|
||||
|
||||
ev_init(eflag,vflag);
|
||||
|
||||
// check if global component of incoming vflag = 2
|
||||
// if so, reset vflag passed to substyle as if it were 0
|
||||
// check if global component of incoming vflag = VIRIAL_FDOTR
|
||||
// if so, reset vflag passed to substyle as if it were VIRIAL_NONE
|
||||
// necessary so substyle will not invoke virial_fdotr_compute()
|
||||
|
||||
int vflag_substyle;
|
||||
if (vflag % 4 == 2) vflag_substyle = vflag/4 * 4;
|
||||
if (vflag & VIRIAL_FDOTR) vflag_substyle = VIRIAL_NONE | (vflag & ~VIRIAL_FDOTR);
|
||||
else vflag_substyle = vflag;
|
||||
|
||||
double *saved_special = save_special();
|
||||
|
||||
@ -3640,12 +3640,12 @@ void PairReaxCKokkos<DeviceType>::ev_setup(int eflag, int vflag, int)
|
||||
evflag = 1;
|
||||
|
||||
eflag_either = eflag;
|
||||
eflag_global = eflag % 2;
|
||||
eflag_atom = eflag / 2;
|
||||
eflag_global = eflag & ENERGY_GLOBAL;
|
||||
eflag_atom = eflag & ENERGY_ATOM;
|
||||
|
||||
vflag_either = vflag;
|
||||
vflag_global = vflag % 4;
|
||||
vflag_atom = vflag / 4;
|
||||
vflag_global = vflag & (VIRIAL_PAIR | VIRIAL_FDOTR);
|
||||
vflag_atom = vflag / 4; // TODO
|
||||
|
||||
// reallocate per-atom arrays if necessary
|
||||
|
||||
|
||||
@ -502,7 +502,7 @@ enum {TIME_PACK, TIME_HOST_NEIGHBOR, TIME_HOST_PAIR, TIME_OFFLOAD_NEIGHBOR,
|
||||
acc_t *f_scalar = &f_start[0].x; \
|
||||
int f_stride4 = f_stride * 4; \
|
||||
int t; \
|
||||
if (vflag == 2) t = 4; else t = 1; \
|
||||
if (vflag == VIRIAL_FDOTR) t = 4; else t = 1; \
|
||||
acc_t *f_scalar2 = f_scalar + f_stride4 * t; \
|
||||
for ( ; t < nthreads; t++) { \
|
||||
_use_simd_pragma("vector aligned") \
|
||||
@ -512,7 +512,7 @@ enum {TIME_PACK, TIME_HOST_NEIGHBOR, TIME_HOST_PAIR, TIME_OFFLOAD_NEIGHBOR,
|
||||
f_scalar2 += f_stride4; \
|
||||
} \
|
||||
\
|
||||
if (vflag == 2) { \
|
||||
if (vflag == VIRIAL_FDOTR) { \
|
||||
int nt_min = MIN(4,nthreads); \
|
||||
IP_PRE_fdotr_acc_force_l5(iifrom, iito, minlocal, nt_min, f_start, \
|
||||
f_stride, pos, ov0, ov1, ov2, ov3, ov4, \
|
||||
|
||||
@ -245,7 +245,7 @@ void PairBuckCoulCutIntel::eval(const int offload, const int vflag,
|
||||
fxtmp = fytmp = fztmp = (acc_t)0;
|
||||
if (EFLAG) fwtmp = sevdwl = secoul = (acc_t)0;
|
||||
if (NEWTON_PAIR == 0)
|
||||
if (vflag==1) sv0 = sv1 = sv2 = sv3 = sv4 = sv5 = (acc_t)0;
|
||||
if (vflag == VIRIAL_PAIR) sv0 = sv1 = sv2 = sv3 = sv4 = sv5 = (acc_t)0;
|
||||
|
||||
#if defined(LMP_SIMD_COMPILER)
|
||||
#pragma vector aligned
|
||||
|
||||
@ -227,7 +227,7 @@ void PairBuckIntel::eval(const int offload, const int vflag,
|
||||
fxtmp = fytmp = fztmp = (acc_t)0;
|
||||
if (EFLAG) fwtmp = sevdwl = (acc_t)0;
|
||||
if (NEWTON_PAIR == 0)
|
||||
if (vflag==1) sv0 = sv1 = sv2 = sv3 = sv4 = sv5 = (acc_t)0;
|
||||
if (vflag == VIRIAL_PAIR) sv0 = sv1 = sv2 = sv3 = sv4 = sv5 = (acc_t)0;
|
||||
|
||||
#if defined(LMP_SIMD_COMPILER)
|
||||
#pragma vector aligned
|
||||
|
||||
@ -265,7 +265,7 @@ void PairDPDIntel::eval(const int offload, const int vflag,
|
||||
fxtmp = fytmp = fztmp = (acc_t)0;
|
||||
if (EFLAG) fwtmp = sevdwl = (acc_t)0;
|
||||
if (NEWTON_PAIR == 0)
|
||||
if (vflag==1) sv0 = sv1 = sv2 = sv3 = sv4 = sv5 = (acc_t)0;
|
||||
if (vflag == VIRIAL_PAIR) sv0 = sv1 = sv2 = sv3 = sv4 = sv5 = (acc_t)0;
|
||||
|
||||
if (rngi + jnum > rng_size) {
|
||||
#ifdef LMP_USE_MKL_RNG
|
||||
|
||||
@ -481,7 +481,7 @@ void PairEAMIntel::eval(const int offload, const int vflag,
|
||||
fxtmp = fytmp = fztmp = (acc_t)0;
|
||||
if (EFLAG) fwtmp = sevdwl = (acc_t)0;
|
||||
if (NEWTON_PAIR == 0)
|
||||
if (vflag==1) sv0 = sv1 = sv2 = sv3 = sv4 = sv5 = (acc_t)0;
|
||||
if (vflag == VIRIAL_PAIR) sv0 = sv1 = sv2 = sv3 = sv4 = sv5 = (acc_t)0;
|
||||
|
||||
int ej = 0;
|
||||
#if defined(LMP_SIMD_COMPILER)
|
||||
|
||||
@ -399,7 +399,7 @@ void PairGayBerneIntel::eval(const int offload, const int vflag,
|
||||
|
||||
if (EFLAG) fwtmp = sevdwl = (acc_t)0.0;
|
||||
if (NEWTON_PAIR == 0)
|
||||
if (vflag==1) sv0 = sv1 = sv2 = sv3 = sv4 = sv5 = (acc_t)0.0;
|
||||
if (vflag == VIRIAL_PAIR) sv0 = sv1 = sv2 = sv3 = sv4 = sv5 = (acc_t)0.0;
|
||||
|
||||
bool multiple_forms = false;
|
||||
int packed_j = 0;
|
||||
|
||||
@ -265,7 +265,7 @@ void PairLJCharmmCoulCharmmIntel::eval(const int offload, const int vflag,
|
||||
fxtmp = fytmp = fztmp = (acc_t)0;
|
||||
if (EFLAG) fwtmp = sevdwl = secoul = (acc_t)0;
|
||||
if (NEWTON_PAIR == 0)
|
||||
if (vflag==1) sv0 = sv1 = sv2 = sv3 = sv4 = sv5 = (acc_t)0;
|
||||
if (vflag == VIRIAL_PAIR) sv0 = sv1 = sv2 = sv3 = sv4 = sv5 = (acc_t)0;
|
||||
|
||||
int ej = 0;
|
||||
#if defined(LMP_SIMD_COMPILER)
|
||||
|
||||
@ -282,7 +282,7 @@ void PairLJCharmmCoulLongIntel::eval(const int offload, const int vflag,
|
||||
fxtmp = fytmp = fztmp = (acc_t)0;
|
||||
if (EFLAG) fwtmp = sevdwl = secoul = (acc_t)0;
|
||||
if (NEWTON_PAIR == 0)
|
||||
if (vflag==1) sv0 = sv1 = sv2 = sv3 = sv4 = sv5 = (acc_t)0;
|
||||
if (vflag == VIRIAL_PAIR) sv0 = sv1 = sv2 = sv3 = sv4 = sv5 = (acc_t)0;
|
||||
|
||||
int ej = 0;
|
||||
#if defined(LMP_SIMD_COMPILER)
|
||||
|
||||
@ -275,7 +275,7 @@ void PairLJCutCoulLongIntel::eval(const int offload, const int vflag,
|
||||
fxtmp = fytmp = fztmp = (acc_t)0;
|
||||
if (EFLAG) fwtmp = sevdwl = secoul = (acc_t)0;
|
||||
if (NEWTON_PAIR == 0)
|
||||
if (vflag==1) sv0 = sv1 = sv2 = sv3 = sv4 = sv5 = (acc_t)0;
|
||||
if (vflag == VIRIAL_PAIR) sv0 = sv1 = sv2 = sv3 = sv4 = sv5 = (acc_t)0;
|
||||
|
||||
int ej = 0;
|
||||
#if defined(LMP_SIMD_COMPILER)
|
||||
|
||||
@ -233,7 +233,7 @@ void PairLJCutIntel::eval(const int offload, const int vflag,
|
||||
fxtmp = fytmp = fztmp = (acc_t)0;
|
||||
if (EFLAG) fwtmp = sevdwl = (acc_t)0;
|
||||
if (NEWTON_PAIR == 0)
|
||||
if (vflag==1) sv0 = sv1 = sv2 = sv3 = sv4 = sv5 = (acc_t)0;
|
||||
if (vflag == VIRIAL_PAIR) sv0 = sv1 = sv2 = sv3 = sv4 = sv5 = (acc_t)0;
|
||||
|
||||
#if defined(LMP_SIMD_COMPILER)
|
||||
#pragma vector aligned nog2s
|
||||
|
||||
@ -70,20 +70,20 @@ void ThrOMP::ev_setup_thr(int eflag, int vflag, int nall, double *eatom,
|
||||
if (tid == 0) thr_error = 0;
|
||||
|
||||
if (thr_style & THR_PAIR) {
|
||||
if (eflag & 2) {
|
||||
if (eflag & ENERGY_ATOM) {
|
||||
thr->eatom_pair = eatom + tid*nall;
|
||||
if (nall > 0)
|
||||
memset(&(thr->eatom_pair[0]),0,nall*sizeof(double));
|
||||
}
|
||||
// per-atom virial and per-atom centroid virial are the same for two-body
|
||||
// many-body pair styles not yet implemented
|
||||
if (vflag & 12) {
|
||||
if (vflag & (VIRIAL_ATOM | VIRIAL_CENTROID)) {
|
||||
thr->vatom_pair = vatom + tid*nall;
|
||||
if (nall > 0)
|
||||
memset(&(thr->vatom_pair[0][0]),0,nall*6*sizeof(double));
|
||||
}
|
||||
// check cvatom_pair, because can't access centroidstressflag
|
||||
if ((vflag & 8) && cvatom) {
|
||||
if ((vflag & VIRIAL_CENTROID) && cvatom) {
|
||||
thr->cvatom_pair = cvatom + tid*nall;
|
||||
if (nall > 0)
|
||||
memset(&(thr->cvatom_pair[0][0]),0,nall*9*sizeof(double));
|
||||
@ -94,13 +94,13 @@ void ThrOMP::ev_setup_thr(int eflag, int vflag, int nall, double *eatom,
|
||||
}
|
||||
|
||||
if (thr_style & THR_BOND) {
|
||||
if (eflag & 2) {
|
||||
if (eflag & ENERGY_ATOM) {
|
||||
thr->eatom_bond = eatom + tid*nall;
|
||||
if (nall > 0)
|
||||
memset(&(thr->eatom_bond[0]),0,nall*sizeof(double));
|
||||
}
|
||||
// per-atom virial and per-atom centroid virial are the same for bonds
|
||||
if (vflag & 12) {
|
||||
if (vflag & (VIRIAL_ATOM | VIRIAL_CENTROID)) {
|
||||
thr->vatom_bond = vatom + tid*nall;
|
||||
if (nall > 0)
|
||||
memset(&(thr->vatom_bond[0][0]),0,nall*6*sizeof(double));
|
||||
@ -108,17 +108,17 @@ void ThrOMP::ev_setup_thr(int eflag, int vflag, int nall, double *eatom,
|
||||
}
|
||||
|
||||
if (thr_style & THR_ANGLE) {
|
||||
if (eflag & 2) {
|
||||
if (eflag & ENERGY_ATOM) {
|
||||
thr->eatom_angle = eatom + tid*nall;
|
||||
if (nall > 0)
|
||||
memset(&(thr->eatom_angle[0]),0,nall*sizeof(double));
|
||||
}
|
||||
if (vflag & 4) {
|
||||
if (vflag & VIRIAL_ATOM) {
|
||||
thr->vatom_angle = vatom + tid*nall;
|
||||
if (nall > 0)
|
||||
memset(&(thr->vatom_angle[0][0]),0,nall*6*sizeof(double));
|
||||
}
|
||||
if (vflag & 8) {
|
||||
if (vflag & VIRIAL_CENTROID) {
|
||||
thr->cvatom_angle = cvatom + tid*nall;
|
||||
if (nall > 0)
|
||||
memset(&(thr->cvatom_angle[0][0]),0,nall*9*sizeof(double));
|
||||
@ -126,17 +126,17 @@ void ThrOMP::ev_setup_thr(int eflag, int vflag, int nall, double *eatom,
|
||||
}
|
||||
|
||||
if (thr_style & THR_DIHEDRAL) {
|
||||
if (eflag & 2) {
|
||||
if (eflag & ENERGY_ATOM) {
|
||||
thr->eatom_dihed = eatom + tid*nall;
|
||||
if (nall > 0)
|
||||
memset(&(thr->eatom_dihed[0]),0,nall*sizeof(double));
|
||||
}
|
||||
if (vflag & 4) {
|
||||
if (vflag & VIRIAL_ATOM) {
|
||||
thr->vatom_dihed = vatom + tid*nall;
|
||||
if (nall > 0)
|
||||
memset(&(thr->vatom_dihed[0][0]),0,nall*6*sizeof(double));
|
||||
}
|
||||
if (vflag & 8) {
|
||||
if (vflag & VIRIAL_CENTROID) {
|
||||
thr->cvatom_dihed = cvatom + tid*nall;
|
||||
if (nall > 0)
|
||||
memset(&(thr->cvatom_dihed[0][0]),0,nall*9*sizeof(double));
|
||||
@ -144,17 +144,17 @@ void ThrOMP::ev_setup_thr(int eflag, int vflag, int nall, double *eatom,
|
||||
}
|
||||
|
||||
if (thr_style & THR_IMPROPER) {
|
||||
if (eflag & 2) {
|
||||
if (eflag & ENERGY_ATOM) {
|
||||
thr->eatom_imprp = eatom + tid*nall;
|
||||
if (nall > 0)
|
||||
memset(&(thr->eatom_imprp[0]),0,nall*sizeof(double));
|
||||
}
|
||||
if (vflag & 4) {
|
||||
if (vflag & VIRIAL_ATOM) {
|
||||
thr->vatom_imprp = vatom + tid*nall;
|
||||
if (nall > 0)
|
||||
memset(&(thr->vatom_imprp[0][0]),0,nall*6*sizeof(double));
|
||||
}
|
||||
if (vflag & 8) {
|
||||
if (vflag & VIRIAL_CENTROID) {
|
||||
thr->cvatom_imprp = cvatom + tid*nall;
|
||||
if (nall > 0)
|
||||
memset(&(thr->cvatom_imprp[0][0]),0,nall*9*sizeof(double));
|
||||
@ -222,29 +222,29 @@ void ThrOMP::reduce_thr(void *style, const int eflag, const int vflag,
|
||||
#pragma omp critical
|
||||
#endif
|
||||
{
|
||||
if (eflag & 1) {
|
||||
if (eflag & ENERGY_GLOBAL) {
|
||||
pair->eng_vdwl += thr->eng_vdwl;
|
||||
pair->eng_coul += thr->eng_coul;
|
||||
thr->eng_vdwl = 0.0;
|
||||
thr->eng_coul = 0.0;
|
||||
}
|
||||
if (vflag & 3)
|
||||
if (vflag & (VIRIAL_PAIR | VIRIAL_FDOTR))
|
||||
for (int i=0; i < 6; ++i) {
|
||||
pair->virial[i] += thr->virial_pair[i];
|
||||
thr->virial_pair[i] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
if (eflag & 2) {
|
||||
if (eflag & ENERGY_ATOM) {
|
||||
data_reduce_thr(&(pair->eatom[0]), nall, nthreads, 1, tid);
|
||||
}
|
||||
// per-atom virial and per-atom centroid virial are the same for two-body
|
||||
// many-body pair styles not yet implemented
|
||||
if (vflag & 12) {
|
||||
if (vflag & (VIRIAL_ATOM | VIRIAL_CENTROID)) {
|
||||
data_reduce_thr(&(pair->vatom[0][0]), nall, nthreads, 6, tid);
|
||||
}
|
||||
// check cvatom_pair, because can't access centroidstressflag
|
||||
if ((vflag & 8) && thr->cvatom_pair) {
|
||||
if ((vflag & VIRIAL_CENTROID) && thr->cvatom_pair) {
|
||||
data_reduce_thr(&(pair->cvatom[0][0]), nall, nthreads, 9, tid);
|
||||
}
|
||||
}
|
||||
@ -259,12 +259,12 @@ void ThrOMP::reduce_thr(void *style, const int eflag, const int vflag,
|
||||
#pragma omp critical
|
||||
#endif
|
||||
{
|
||||
if (eflag & 1) {
|
||||
if (eflag & ENERGY_GLOBAL) {
|
||||
bond->energy += thr->eng_bond;
|
||||
thr->eng_bond = 0.0;
|
||||
}
|
||||
|
||||
if (vflag & 3) {
|
||||
if (vflag & (VIRIAL_PAIR | VIRIAL_FDOTR)) {
|
||||
for (int i=0; i < 6; ++i) {
|
||||
bond->virial[i] += thr->virial_bond[i];
|
||||
thr->virial_bond[i] = 0.0;
|
||||
@ -272,11 +272,11 @@ void ThrOMP::reduce_thr(void *style, const int eflag, const int vflag,
|
||||
}
|
||||
}
|
||||
|
||||
if (eflag & 2) {
|
||||
if (eflag & ENERGY_ATOM) {
|
||||
data_reduce_thr(&(bond->eatom[0]), nall, nthreads, 1, tid);
|
||||
}
|
||||
// per-atom virial and per-atom centroid virial are the same for bonds
|
||||
if (vflag & 12) {
|
||||
if (vflag & (VIRIAL_ATOM | VIRIAL_CENTROID)) {
|
||||
data_reduce_thr(&(bond->vatom[0][0]), nall, nthreads, 6, tid);
|
||||
}
|
||||
|
||||
@ -291,12 +291,12 @@ void ThrOMP::reduce_thr(void *style, const int eflag, const int vflag,
|
||||
#pragma omp critical
|
||||
#endif
|
||||
{
|
||||
if (eflag & 1) {
|
||||
if (eflag & ENERGY_GLOBAL) {
|
||||
angle->energy += thr->eng_angle;
|
||||
thr->eng_angle = 0.0;
|
||||
}
|
||||
|
||||
if (vflag & 3) {
|
||||
if (vflag & (VIRIAL_PAIR | VIRIAL_FDOTR)) {
|
||||
for (int i=0; i < 6; ++i) {
|
||||
angle->virial[i] += thr->virial_angle[i];
|
||||
thr->virial_angle[i] = 0.0;
|
||||
@ -304,13 +304,13 @@ void ThrOMP::reduce_thr(void *style, const int eflag, const int vflag,
|
||||
}
|
||||
}
|
||||
|
||||
if (eflag & 2) {
|
||||
if (eflag & ENERGY_ATOM) {
|
||||
data_reduce_thr(&(angle->eatom[0]), nall, nthreads, 1, tid);
|
||||
}
|
||||
if (vflag & 4) {
|
||||
if (vflag & VIRIAL_ATOM) {
|
||||
data_reduce_thr(&(angle->vatom[0][0]), nall, nthreads, 6, tid);
|
||||
}
|
||||
if (vflag & 8) {
|
||||
if (vflag & VIRIAL_CENTROID) {
|
||||
data_reduce_thr(&(angle->cvatom[0][0]), nall, nthreads, 9, tid);
|
||||
}
|
||||
|
||||
@ -325,12 +325,12 @@ void ThrOMP::reduce_thr(void *style, const int eflag, const int vflag,
|
||||
#pragma omp critical
|
||||
#endif
|
||||
{
|
||||
if (eflag & 1) {
|
||||
if (eflag & ENERGY_GLOBAL) {
|
||||
dihedral->energy += thr->eng_dihed;
|
||||
thr->eng_dihed = 0.0;
|
||||
}
|
||||
|
||||
if (vflag & 3) {
|
||||
if (vflag & (VIRIAL_PAIR | VIRIAL_FDOTR)) {
|
||||
for (int i=0; i < 6; ++i) {
|
||||
dihedral->virial[i] += thr->virial_dihed[i];
|
||||
thr->virial_dihed[i] = 0.0;
|
||||
@ -338,13 +338,13 @@ void ThrOMP::reduce_thr(void *style, const int eflag, const int vflag,
|
||||
}
|
||||
}
|
||||
|
||||
if (eflag & 2) {
|
||||
if (eflag & ENERGY_ATOM) {
|
||||
data_reduce_thr(&(dihedral->eatom[0]), nall, nthreads, 1, tid);
|
||||
}
|
||||
if (vflag & 4) {
|
||||
if (vflag & VIRIAL_ATOM) {
|
||||
data_reduce_thr(&(dihedral->vatom[0][0]), nall, nthreads, 6, tid);
|
||||
}
|
||||
if (vflag & 8) {
|
||||
if (vflag & VIRIAL_CENTROID) {
|
||||
data_reduce_thr(&(dihedral->cvatom[0][0]), nall, nthreads, 9, tid);
|
||||
}
|
||||
|
||||
@ -360,7 +360,7 @@ void ThrOMP::reduce_thr(void *style, const int eflag, const int vflag,
|
||||
#pragma omp critical
|
||||
#endif
|
||||
{
|
||||
if (eflag & 1) {
|
||||
if (eflag & ENERGY_GLOBAL) {
|
||||
dihedral->energy += thr->eng_dihed;
|
||||
pair->eng_vdwl += thr->eng_vdwl;
|
||||
pair->eng_coul += thr->eng_coul;
|
||||
@ -369,7 +369,7 @@ void ThrOMP::reduce_thr(void *style, const int eflag, const int vflag,
|
||||
thr->eng_coul = 0.0;
|
||||
}
|
||||
|
||||
if (vflag & 3) {
|
||||
if (vflag & (VIRIAL_PAIR | VIRIAL_FDOTR)) {
|
||||
for (int i=0; i < 6; ++i) {
|
||||
dihedral->virial[i] += thr->virial_dihed[i];
|
||||
pair->virial[i] += thr->virial_pair[i];
|
||||
@ -379,23 +379,23 @@ void ThrOMP::reduce_thr(void *style, const int eflag, const int vflag,
|
||||
}
|
||||
}
|
||||
|
||||
if (eflag & 2) {
|
||||
if (eflag & ENERGY_ATOM) {
|
||||
data_reduce_thr(&(dihedral->eatom[0]), nall, nthreads, 1, tid);
|
||||
data_reduce_thr(&(pair->eatom[0]), nall, nthreads, 1, tid);
|
||||
}
|
||||
if (vflag & 4) {
|
||||
if (vflag & VIRIAL_ATOM) {
|
||||
data_reduce_thr(&(dihedral->vatom[0][0]), nall, nthreads, 6, tid);
|
||||
}
|
||||
if (vflag & 8) {
|
||||
if (vflag & VIRIAL_CENTROID) {
|
||||
data_reduce_thr(&(dihedral->cvatom[0][0]), nall, nthreads, 9, tid);
|
||||
}
|
||||
// per-atom virial and per-atom centroid virial are the same for two-body
|
||||
// many-body pair styles not yet implemented
|
||||
if (vflag & 12) {
|
||||
if (vflag & (VIRIAL_ATOM | VIRIAL_CENTROID)) {
|
||||
data_reduce_thr(&(pair->vatom[0][0]), nall, nthreads, 6, tid);
|
||||
}
|
||||
// check cvatom_pair, because can't access centroidstressflag
|
||||
if ((vflag & 8) && thr->cvatom_pair) {
|
||||
if ((vflag & VIRIAL_CENTROID) && thr->cvatom_pair) {
|
||||
data_reduce_thr(&(pair->cvatom[0][0]), nall, nthreads, 9, tid);
|
||||
}
|
||||
}
|
||||
@ -409,12 +409,12 @@ void ThrOMP::reduce_thr(void *style, const int eflag, const int vflag,
|
||||
#pragma omp critical
|
||||
#endif
|
||||
{
|
||||
if (eflag & 1) {
|
||||
if (eflag & ENERGY_GLOBAL) {
|
||||
improper->energy += thr->eng_imprp;
|
||||
thr->eng_imprp = 0.0;
|
||||
}
|
||||
|
||||
if (vflag & 3) {
|
||||
if (vflag & (VIRIAL_PAIR | VIRIAL_FDOTR)) {
|
||||
for (int i=0; i < 6; ++i) {
|
||||
improper->virial[i] += thr->virial_imprp[i];
|
||||
thr->virial_imprp[i] = 0.0;
|
||||
@ -422,13 +422,13 @@ void ThrOMP::reduce_thr(void *style, const int eflag, const int vflag,
|
||||
}
|
||||
}
|
||||
|
||||
if (eflag & 2) {
|
||||
if (eflag & ENERGY_ATOM) {
|
||||
data_reduce_thr(&(improper->eatom[0]), nall, nthreads, 1, tid);
|
||||
}
|
||||
if (vflag & 4) {
|
||||
if (vflag & VIRIAL_ATOM) {
|
||||
data_reduce_thr(&(improper->vatom[0][0]), nall, nthreads, 6, tid);
|
||||
}
|
||||
if (vflag & 8) {
|
||||
if (vflag & VIRIAL_CENTROID) {
|
||||
data_reduce_thr(&(improper->cvatom[0][0]), nall, nthreads, 9, tid);
|
||||
}
|
||||
|
||||
|
||||
@ -94,12 +94,12 @@ void Angle::ev_setup(int eflag, int vflag, int alloc)
|
||||
evflag = 1;
|
||||
|
||||
eflag_either = eflag;
|
||||
eflag_global = eflag % 2;
|
||||
eflag_atom = eflag / 2;
|
||||
eflag_global = eflag & ENERGY_GLOBAL;
|
||||
eflag_atom = eflag & ENERGY_ATOM;
|
||||
|
||||
vflag_global = vflag % 4;
|
||||
vflag_atom = vflag & 4;
|
||||
cvflag_atom = vflag & 8;
|
||||
vflag_global = vflag & (VIRIAL_PAIR | VIRIAL_FDOTR);
|
||||
vflag_atom = vflag & VIRIAL_ATOM;
|
||||
cvflag_atom = vflag & VIRIAL_CENTROID;
|
||||
vflag_either = vflag_global || vflag_atom;
|
||||
|
||||
// reallocate per-atom arrays if necessary
|
||||
|
||||
@ -98,13 +98,13 @@ void Bond::ev_setup(int eflag, int vflag, int alloc)
|
||||
evflag = 1;
|
||||
|
||||
eflag_either = eflag;
|
||||
eflag_global = eflag % 2;
|
||||
eflag_atom = eflag / 2;
|
||||
eflag_global = eflag & ENERGY_GLOBAL;
|
||||
eflag_atom = eflag & ENERGY_ATOM;
|
||||
|
||||
vflag_either = vflag;
|
||||
vflag_global = vflag % 4;
|
||||
vflag_global = vflag & (VIRIAL_PAIR | VIRIAL_FDOTR);
|
||||
// per-atom virial and per-atom centroid virial are the same for bonds
|
||||
vflag_atom = vflag / 4;
|
||||
vflag_atom = vflag & (VIRIAL_ATOM | VIRIAL_CENTROID);
|
||||
|
||||
// reallocate per-atom arrays if necessary
|
||||
|
||||
|
||||
@ -93,12 +93,12 @@ void Dihedral::ev_setup(int eflag, int vflag, int alloc)
|
||||
evflag = 1;
|
||||
|
||||
eflag_either = eflag;
|
||||
eflag_global = eflag % 2;
|
||||
eflag_atom = eflag / 2;
|
||||
eflag_global = eflag & ENERGY_GLOBAL;
|
||||
eflag_atom = eflag & ENERGY_ATOM;
|
||||
|
||||
vflag_global = vflag % 4;
|
||||
vflag_atom = vflag & 4;
|
||||
cvflag_atom = vflag & 8;
|
||||
vflag_global = vflag & (VIRIAL_PAIR | VIRIAL_FDOTR);
|
||||
vflag_atom = vflag & VIRIAL_ATOM;
|
||||
cvflag_atom = vflag & VIRIAL_CENTROID;
|
||||
vflag_either = vflag_global || vflag_atom;
|
||||
|
||||
// reallocate per-atom arrays if necessary
|
||||
|
||||
12
src/fix.cpp
12
src/fix.cpp
@ -189,12 +189,12 @@ void Fix::ev_setup(int eflag, int vflag)
|
||||
evflag = 1;
|
||||
|
||||
eflag_either = eflag;
|
||||
eflag_global = eflag % 2;
|
||||
eflag_atom = eflag / 2;
|
||||
eflag_global = eflag % 2; // TODO
|
||||
eflag_atom = eflag / 2; // TODO
|
||||
|
||||
vflag_either = vflag;
|
||||
vflag_global = vflag % 4;
|
||||
vflag_atom = vflag / 4;
|
||||
vflag_global = vflag % 4; // TODO
|
||||
vflag_atom = vflag / 4; // TODO
|
||||
|
||||
// reallocate per-atom arrays if necessary
|
||||
|
||||
@ -250,8 +250,8 @@ void Fix::v_setup(int vflag)
|
||||
|
||||
evflag = 1;
|
||||
|
||||
vflag_global = vflag % 4;
|
||||
vflag_atom = vflag / 4;
|
||||
vflag_global = vflag % 4; // TODO
|
||||
vflag_atom = vflag / 4; // TODO
|
||||
|
||||
// reallocate per-atom array if necessary
|
||||
|
||||
|
||||
@ -91,12 +91,12 @@ void Improper::ev_setup(int eflag, int vflag, int alloc)
|
||||
evflag = 1;
|
||||
|
||||
eflag_either = eflag;
|
||||
eflag_global = eflag % 2;
|
||||
eflag_atom = eflag / 2;
|
||||
eflag_global = eflag & ENERGY_GLOBAL;
|
||||
eflag_atom = eflag & ENERGY_ATOM;
|
||||
|
||||
vflag_global = vflag % 4;
|
||||
vflag_atom = vflag & 4;
|
||||
cvflag_atom = vflag & 8;
|
||||
vflag_global = vflag & (VIRIAL_PAIR | VIRIAL_FDOTR);
|
||||
vflag_atom = vflag & VIRIAL_ATOM;
|
||||
cvflag_atom = vflag & VIRIAL_CENTROID;
|
||||
vflag_either = vflag_global || vflag_atom;
|
||||
|
||||
// reallocate per-atom arrays if necessary
|
||||
|
||||
@ -232,12 +232,12 @@ void KSpace::ev_setup(int eflag, int vflag, int alloc)
|
||||
evflag = 1;
|
||||
|
||||
eflag_either = eflag;
|
||||
eflag_global = eflag % 2;
|
||||
eflag_atom = eflag / 2;
|
||||
eflag_global = eflag & ENERGY_GLOBAL;
|
||||
eflag_atom = eflag & ENERGY_ATOM;
|
||||
|
||||
vflag_either = vflag;
|
||||
vflag_global = vflag % 4;
|
||||
vflag_atom = vflag / 4;
|
||||
vflag_global = vflag & (VIRIAL_PAIR | VIRIAL_FDOTR);
|
||||
vflag_atom = vflag / 4; // TODO
|
||||
|
||||
if (eflag_atom || vflag_atom) evflag_atom = 1;
|
||||
else evflag_atom = 0;
|
||||
|
||||
@ -798,6 +798,8 @@ void Min::ev_setup()
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
TODO: comment
|
||||
|
||||
set eflag,vflag for current iteration
|
||||
invoke matchstep() on all timestep-dependent computes to clear their arrays
|
||||
eflag/vflag based on computes that need info on this ntimestep
|
||||
@ -829,7 +831,7 @@ void Min::ev_set(bigint ntimestep)
|
||||
int eflag_atom = 0;
|
||||
for (i = 0; i < nelist_atom; i++)
|
||||
if (elist_atom[i]->matchstep(ntimestep)) flag = 1;
|
||||
if (flag) eflag_atom = 2;
|
||||
if (flag) eflag_atom = ENERGY_ATOM;
|
||||
|
||||
if (eflag_global) update->eflag_global = update->ntimestep;
|
||||
if (eflag_atom) update->eflag_atom = update->ntimestep;
|
||||
@ -845,13 +847,13 @@ void Min::ev_set(bigint ntimestep)
|
||||
int vflag_atom = 0;
|
||||
for (i = 0; i < nvlist_atom; i++)
|
||||
if (vlist_atom[i]->matchstep(ntimestep)) flag = 1;
|
||||
if (flag) vflag_atom = 4;
|
||||
if (flag) vflag_atom = VIRIAL_ATOM;
|
||||
|
||||
flag = 0;
|
||||
int cvflag_atom = 0;
|
||||
for (i = 0; i < ncvlist_atom; i++)
|
||||
if (cvlist_atom[i]->matchstep(ntimestep)) flag = 1;
|
||||
if (flag) cvflag_atom = 8;
|
||||
if (flag) cvflag_atom = VIRIAL_CENTROID;
|
||||
|
||||
if (vflag_global) update->vflag_global = update->ntimestep;
|
||||
if (vflag_atom || cvflag_atom) update->vflag_atom = update->ntimestep;
|
||||
|
||||
@ -82,10 +82,10 @@ PairHybrid::~PairHybrid()
|
||||
/* ----------------------------------------------------------------------
|
||||
call each sub-style's compute() or compute_outer() function
|
||||
accumulate sub-style global/peratom energy/virial in hybrid
|
||||
for global vflag = 1:
|
||||
for global vflag = VIRIAL_PAIR:
|
||||
each sub-style computes own virial[6]
|
||||
sum sub-style virial[6] to hybrid's virial[6]
|
||||
for global vflag = 2:
|
||||
for global vflag = VIRIAL_FDOTR:
|
||||
call sub-style with adjusted vflag to prevent it calling
|
||||
virial_fdotr_compute()
|
||||
hybrid calls virial_fdotr_compute() on final accumulated f
|
||||
@ -96,20 +96,20 @@ void PairHybrid::compute(int eflag, int vflag)
|
||||
int i,j,m,n;
|
||||
|
||||
// if no_virial_fdotr_compute is set and global component of
|
||||
// incoming vflag = 2, then
|
||||
// reset vflag as if global component were 1
|
||||
// incoming vflag = VIRIAL_FDOTR, then
|
||||
// reset vflag as if global component were VIRIAL_PAIR
|
||||
// necessary since one or more sub-styles cannot compute virial as F dot r
|
||||
|
||||
if (no_virial_fdotr_compute && vflag % 4 == 2) vflag = 1 + vflag/4 * 4;
|
||||
if (no_virial_fdotr_compute && (vflag & VIRIAL_FDOTR)) vflag = VIRIAL_PAIR | (vflag & ~VIRIAL_FDOTR);
|
||||
|
||||
ev_init(eflag,vflag);
|
||||
|
||||
// check if global component of incoming vflag = 2
|
||||
// if so, reset vflag passed to substyle as if it were 0
|
||||
// check if global component of incoming vflag = VIRIAL_FDOTR
|
||||
// if so, reset vflag passed to substyle as if it were VIRIAL_NONE
|
||||
// necessary so substyle will not invoke virial_fdotr_compute()
|
||||
|
||||
int vflag_substyle;
|
||||
if (vflag % 4 == 2) vflag_substyle = vflag/4 * 4;
|
||||
if (vflag & VIRIAL_FDOTR) vflag_substyle = vflag & ~VIRIAL_FDOTR;
|
||||
else vflag_substyle = vflag;
|
||||
|
||||
double *saved_special = save_special();
|
||||
|
||||
Reference in New Issue
Block a user