initial version of AMOEBA/HIPPO force field files
This commit is contained in:
138
src/angle.cpp
138
src/angle.cpp
@ -25,6 +25,8 @@
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace MathConst;
|
||||
|
||||
#define FOURTH 0.25
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
Angle::Angle(LAMMPS *lmp) : Pointers(lmp)
|
||||
@ -221,30 +223,16 @@ void Angle::ev_tally(int i, int j, int k, int nlocal, int newton_bond,
|
||||
virial[4] += v[4];
|
||||
virial[5] += v[5];
|
||||
} else {
|
||||
if (i < nlocal) {
|
||||
virial[0] += THIRD*v[0];
|
||||
virial[1] += THIRD*v[1];
|
||||
virial[2] += THIRD*v[2];
|
||||
virial[3] += THIRD*v[3];
|
||||
virial[4] += THIRD*v[4];
|
||||
virial[5] += THIRD*v[5];
|
||||
}
|
||||
if (j < nlocal) {
|
||||
virial[0] += THIRD*v[0];
|
||||
virial[1] += THIRD*v[1];
|
||||
virial[2] += THIRD*v[2];
|
||||
virial[3] += THIRD*v[3];
|
||||
virial[4] += THIRD*v[4];
|
||||
virial[5] += THIRD*v[5];
|
||||
}
|
||||
if (k < nlocal) {
|
||||
virial[0] += THIRD*v[0];
|
||||
virial[1] += THIRD*v[1];
|
||||
virial[2] += THIRD*v[2];
|
||||
virial[3] += THIRD*v[3];
|
||||
virial[4] += THIRD*v[4];
|
||||
virial[5] += THIRD*v[5];
|
||||
}
|
||||
double prefactor = 0.0;
|
||||
if (i < nlocal) prefactor += 1.0;
|
||||
if (j < nlocal) prefactor += 1.0;
|
||||
if (k < nlocal) prefactor += 1.0;
|
||||
virial[0] += prefactor*THIRD*v[0];
|
||||
virial[1] += prefactor*THIRD*v[1];
|
||||
virial[2] += prefactor*THIRD*v[2];
|
||||
virial[3] += prefactor*THIRD*v[3];
|
||||
virial[4] += prefactor*THIRD*v[4];
|
||||
virial[5] += prefactor*THIRD*v[5];
|
||||
}
|
||||
}
|
||||
|
||||
@ -277,6 +265,7 @@ void Angle::ev_tally(int i, int j, int k, int nlocal, int newton_bond,
|
||||
}
|
||||
|
||||
// per-atom centroid virial
|
||||
|
||||
if (cvflag_atom) {
|
||||
|
||||
// r0 = (r1+r2+r3)/3
|
||||
@ -303,6 +292,7 @@ void Angle::ev_tally(int i, int j, int k, int nlocal, int newton_bond,
|
||||
cvatom[i][7] += a1[2]*f1[0];
|
||||
cvatom[i][8] += a1[2]*f1[1];
|
||||
}
|
||||
|
||||
if (newton_bond || j < nlocal) {
|
||||
double a2[3];
|
||||
double f2[3];
|
||||
@ -326,6 +316,7 @@ void Angle::ev_tally(int i, int j, int k, int nlocal, int newton_bond,
|
||||
cvatom[j][7] += a2[2]*f2[0];
|
||||
cvatom[j][8] += a2[2]*f2[1];
|
||||
}
|
||||
|
||||
if (newton_bond || k < nlocal) {
|
||||
double a3[3];
|
||||
|
||||
@ -347,6 +338,105 @@ void Angle::ev_tally(int i, int j, int k, int nlocal, int newton_bond,
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
tally energy and virial into global and per-atom accumulators
|
||||
virial = r1F1 + r2F2 + r3F3 + r4F4
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Angle::ev_tally4(int i, int j, int k, int m, int nlocal, int newton_bond,
|
||||
double eangle,
|
||||
double *f1, double *f2, double *f3, double *f4)
|
||||
{
|
||||
double eanglefourth,v[6];
|
||||
|
||||
if (eflag_either) {
|
||||
if (eflag_global) {
|
||||
if (newton_bond) energy += eangle;
|
||||
else {
|
||||
eanglefourth = FOURTH*eangle;
|
||||
if (i < nlocal) energy += eanglefourth;
|
||||
if (j < nlocal) energy += eanglefourth;
|
||||
if (k < nlocal) energy += eanglefourth;
|
||||
}
|
||||
}
|
||||
if (eflag_atom) {
|
||||
eanglefourth = FOURTH*eangle;
|
||||
if (newton_bond || i < nlocal) eatom[i] += eanglefourth;
|
||||
if (newton_bond || j < nlocal) eatom[j] += eanglefourth;
|
||||
if (newton_bond || k < nlocal) eatom[k] += eanglefourth;
|
||||
if (newton_bond || m < nlocal) eatom[m] += eanglefourth;
|
||||
}
|
||||
}
|
||||
|
||||
if (vflag_either) {
|
||||
double **x = atom->x;
|
||||
v[0] = x[i][0]*f1[0] + x[j][0]*f2[0] + x[k][0]*f3[0] + x[m][0]*f4[0];
|
||||
v[1] = x[i][1]*f1[1] + x[j][1]*f2[1] + x[k][1]*f3[1] + x[m][1]*f4[1];
|
||||
v[2] = x[i][2]*f1[2] + x[j][2]*f2[2] + x[k][2]*f3[2] + x[m][2]*f4[2];
|
||||
v[3] = x[i][0]*f1[1] + x[j][0]*f2[1] + x[k][0]*f3[1] + x[m][0]*f4[1];
|
||||
v[4] = x[i][0]*f1[2] + x[j][0]*f2[2] + x[k][0]*f3[2] + x[m][0]*f4[2];
|
||||
v[5] = x[i][1]*f1[2] + x[j][1]*f2[2] + x[k][1]*f3[2] + x[m][1]*f4[2];
|
||||
|
||||
if (vflag_global) {
|
||||
if (newton_bond) {
|
||||
virial[0] += v[0];
|
||||
virial[1] += v[1];
|
||||
virial[2] += v[2];
|
||||
virial[3] += v[3];
|
||||
virial[4] += v[4];
|
||||
virial[5] += v[5];
|
||||
} else {
|
||||
double prefactor = 0.0;
|
||||
if (i < nlocal) prefactor += 1.0;
|
||||
if (j < nlocal) prefactor += 1.0;
|
||||
if (k < nlocal) prefactor += 1.0;
|
||||
if (m < nlocal) prefactor += 1.0;
|
||||
virial[0] += prefactor*FOURTH*v[0];
|
||||
virial[1] += prefactor*FOURTH*v[1];
|
||||
virial[2] += prefactor*FOURTH*v[2];
|
||||
virial[3] += prefactor*FOURTH*v[3];
|
||||
virial[4] += prefactor*FOURTH*v[4];
|
||||
virial[5] += prefactor*FOURTH*v[5];
|
||||
}
|
||||
}
|
||||
|
||||
if (vflag_atom) {
|
||||
if (newton_bond || i < nlocal) {
|
||||
vatom[i][0] += FOURTH*v[0];
|
||||
vatom[i][1] += FOURTH*v[1];
|
||||
vatom[i][2] += FOURTH*v[2];
|
||||
vatom[i][3] += FOURTH*v[3];
|
||||
vatom[i][4] += FOURTH*v[4];
|
||||
vatom[i][5] += FOURTH*v[5];
|
||||
}
|
||||
if (newton_bond || j < nlocal) {
|
||||
vatom[j][0] += FOURTH*v[0];
|
||||
vatom[j][1] += FOURTH*v[1];
|
||||
vatom[j][2] += FOURTH*v[2];
|
||||
vatom[j][3] += FOURTH*v[3];
|
||||
vatom[j][4] += FOURTH*v[4];
|
||||
vatom[j][5] += FOURTH*v[5];
|
||||
}
|
||||
if (newton_bond || k < nlocal) {
|
||||
vatom[k][0] += FOURTH*v[0];
|
||||
vatom[k][1] += FOURTH*v[1];
|
||||
vatom[k][2] += FOURTH*v[2];
|
||||
vatom[k][3] += FOURTH*v[3];
|
||||
vatom[k][4] += FOURTH*v[4];
|
||||
vatom[k][5] += FOURTH*v[5];
|
||||
}
|
||||
if (newton_bond || m < nlocal) {
|
||||
vatom[m][0] += FOURTH*v[0];
|
||||
vatom[m][1] += FOURTH*v[1];
|
||||
vatom[m][2] += FOURTH*v[2];
|
||||
vatom[m][3] += FOURTH*v[3];
|
||||
vatom[m][4] += FOURTH*v[4];
|
||||
vatom[m][5] += FOURTH*v[5];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double Angle::memory_usage()
|
||||
|
||||
Reference in New Issue
Block a user