git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@1372 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -71,28 +71,29 @@ PairLJCutCoulLongTIP4P::~PairLJCutCoulLongTIP4P()
|
|||||||
void PairLJCutCoulLongTIP4P::compute(int eflag, int vflag)
|
void PairLJCutCoulLongTIP4P::compute(int eflag, int vflag)
|
||||||
{
|
{
|
||||||
int i,j,ii,jj,inum,jnum,itype,jtype,itable;
|
int i,j,ii,jj,inum,jnum,itype,jtype,itable;
|
||||||
|
int n,vlist[6];
|
||||||
|
int iH1,iH2,jH1,jH2;
|
||||||
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair;
|
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair;
|
||||||
double fraction,table;
|
double fraction,table;
|
||||||
double delx1,dely1,delz1,delx2,dely2,delz2,delx3,dely3,delz3;
|
double delx1,dely1,delz1,delx2,dely2,delz2,delx3,dely3,delz3;
|
||||||
double r,r2inv,r6inv,forcecoul,forcelj,cforce,negforce;
|
double r,r2inv,r6inv,forcecoul,forcelj,cforce,negforce;
|
||||||
double factor_coul,factor_lj;
|
double factor_coul,factor_lj;
|
||||||
double grij,expm2,prefactor,t,erfc;
|
double grij,expm2,prefactor,t,erfc;
|
||||||
int iH1,iH2,jH1,jH2;
|
double xiM[3],xjM[3],fO[3],fH[3],v[6];
|
||||||
double xiM[3],xjM[3];
|
|
||||||
double *x1,*x2;
|
double *x1,*x2;
|
||||||
double fO[3],fH[3];
|
|
||||||
int *ilist,*jlist,*numneigh,**firstneigh;
|
int *ilist,*jlist,*numneigh,**firstneigh;
|
||||||
float rsq;
|
float rsq;
|
||||||
int *int_rsq = (int *) &rsq;
|
int *int_rsq = (int *) &rsq;
|
||||||
|
|
||||||
|
// if vflag_global = 2, reset vflag as if vflag_global = 1
|
||||||
|
// necessary since TIP4P cannot compute virial as F dot r
|
||||||
|
// due to find_M() finding bonded H atoms which are not near O atom
|
||||||
|
|
||||||
|
if (vflag % 4 == 2) vflag = 1 + vflag/4 * 4;
|
||||||
|
|
||||||
evdwl = ecoul = 0.0;
|
evdwl = ecoul = 0.0;
|
||||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||||
else evflag = vflag_fdotr = 0;
|
else evflag = 0;
|
||||||
|
|
||||||
// error check (for now)
|
|
||||||
|
|
||||||
if (eflag_atom || vflag_atom)
|
|
||||||
error->all("Pair style lj/cut/coul/long/tip4p does not yet support peratom energy/virial");
|
|
||||||
|
|
||||||
double **f = atom->f;
|
double **f = atom->f;
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
@ -105,23 +106,6 @@ void PairLJCutCoulLongTIP4P::compute(int eflag, int vflag)
|
|||||||
int newton_pair = force->newton_pair;
|
int newton_pair = force->newton_pair;
|
||||||
double qqrd2e = force->qqrd2e;
|
double qqrd2e = force->qqrd2e;
|
||||||
|
|
||||||
// grow and zero temporary force array if necessary
|
|
||||||
|
|
||||||
if (vflag && atom->nmax > nmax) {
|
|
||||||
memory->destroy_2d_double_array(ftmp);
|
|
||||||
nmax = atom->nmax;
|
|
||||||
ftmp = memory->create_2d_double_array(nmax,3,"pair:ftmp");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vflag) {
|
|
||||||
for (i = 0; i < 6; i++) virialtmp[i] = 0.0;
|
|
||||||
for (i = 0; i < nall; i++) {
|
|
||||||
ftmp[i][0] = 0.0;
|
|
||||||
ftmp[i][1] = 0.0;
|
|
||||||
ftmp[i][2] = 0.0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inum = list->inum;
|
inum = list->inum;
|
||||||
ilist = list->ilist;
|
ilist = list->ilist;
|
||||||
numneigh = list->numneigh;
|
numneigh = list->numneigh;
|
||||||
@ -179,8 +163,11 @@ void PairLJCutCoulLongTIP4P::compute(int eflag, int vflag)
|
|||||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) -
|
evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) -
|
||||||
offset[itype][jtype];
|
offset[itype][jtype];
|
||||||
evdwl *= factor_lj;
|
evdwl *= factor_lj;
|
||||||
}
|
} else evdwl = 0.0;
|
||||||
} else evdwl = 0.0;
|
|
||||||
|
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
||||||
|
evdwl,0.0,forcelj,delx,dely,delz);
|
||||||
|
}
|
||||||
|
|
||||||
// adjust rsq for off-site O charge(s)
|
// adjust rsq for off-site O charge(s)
|
||||||
|
|
||||||
@ -227,27 +214,25 @@ void PairLJCutCoulLongTIP4P::compute(int eflag, int vflag)
|
|||||||
cforce = forcecoul * r2inv;
|
cforce = forcecoul * r2inv;
|
||||||
|
|
||||||
// if i,j are not O atoms, force is applied directly
|
// if i,j are not O atoms, force is applied directly
|
||||||
// if i or j are O atoms, force is on fictitious atoms
|
// if i or j are O atoms, force is on fictitious atom
|
||||||
// spread force to all 3 atoms in water molecule
|
// and is thus spread to all 3 atoms in water molecule
|
||||||
// formulas due to Feenstra et al, J Comp Chem, 20, 786 (1999)
|
// formulas due to Feenstra et al, J Comp Chem, 20, 786 (1999)
|
||||||
|
|
||||||
|
n = 0;
|
||||||
|
|
||||||
if (itype != typeO) {
|
if (itype != typeO) {
|
||||||
if (vflag == 0) {
|
f[i][0] += delx * cforce;
|
||||||
f[i][0] += delx * cforce;
|
f[i][1] += dely * cforce;
|
||||||
f[i][1] += dely * cforce;
|
f[i][2] += delz * cforce;
|
||||||
f[i][2] += delz * cforce;
|
|
||||||
|
|
||||||
} else {
|
if (vflag) {
|
||||||
ftmp[i][0] += delx * cforce;
|
v[0] = 0.5 * delx * delx * cforce;
|
||||||
ftmp[i][1] += dely * cforce;
|
v[1] = 0.5 * dely * dely * cforce;
|
||||||
ftmp[i][2] += delz * cforce;
|
v[2] = 0.5 * delz * delz * cforce;
|
||||||
|
v[3] = 0.5 * delx * dely * cforce;
|
||||||
virialtmp[0] += 0.5 * delx * delx * cforce;
|
v[4] = 0.5 * delx * delz * cforce;
|
||||||
virialtmp[1] += 0.5 * dely * dely * cforce;
|
v[5] = 0.5 * dely * delz * cforce;
|
||||||
virialtmp[2] += 0.5 * delz * delz * cforce;
|
vlist[n++] = i;
|
||||||
virialtmp[3] += 0.5 * dely * delx * cforce;
|
|
||||||
virialtmp[4] += 0.5 * delz * delx * cforce;
|
|
||||||
virialtmp[5] += 0.5 * delz * dely * cforce;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -259,32 +244,19 @@ void PairLJCutCoulLongTIP4P::compute(int eflag, int vflag)
|
|||||||
fH[1] = alpha * (dely*cforce);
|
fH[1] = alpha * (dely*cforce);
|
||||||
fH[2] = alpha * (delz*cforce);
|
fH[2] = alpha * (delz*cforce);
|
||||||
|
|
||||||
if (vflag == 0) {
|
f[i][0] += fO[0];
|
||||||
f[i][0] += fO[0];
|
f[i][1] += fO[1];
|
||||||
f[i][1] += fO[1];
|
f[i][2] += fO[2];
|
||||||
f[i][2] += fO[2];
|
|
||||||
|
|
||||||
f[iH1][0] += fH[0];
|
f[iH1][0] += fH[0];
|
||||||
f[iH1][1] += fH[1];
|
f[iH1][1] += fH[1];
|
||||||
f[iH1][2] += fH[2];
|
f[iH1][2] += fH[2];
|
||||||
|
|
||||||
f[iH2][0] += fH[0];
|
f[iH2][0] += fH[0];
|
||||||
f[iH2][1] += fH[1];
|
f[iH2][1] += fH[1];
|
||||||
f[iH2][2] += fH[2];
|
f[iH2][2] += fH[2];
|
||||||
|
|
||||||
} else {
|
|
||||||
ftmp[i][0] += fO[0];
|
|
||||||
ftmp[i][1] += fO[1];
|
|
||||||
ftmp[i][2] += fO[2];
|
|
||||||
|
|
||||||
ftmp[iH1][0] += fH[0];
|
|
||||||
ftmp[iH1][1] += fH[1];
|
|
||||||
ftmp[iH1][2] += fH[2];
|
|
||||||
|
|
||||||
ftmp[iH2][0] += fH[0];
|
|
||||||
ftmp[iH2][1] += fH[1];
|
|
||||||
ftmp[iH2][2] += fH[2];
|
|
||||||
|
|
||||||
|
if (vflag) {
|
||||||
delx1 = x[i][0] - x2[0];
|
delx1 = x[i][0] - x2[0];
|
||||||
dely1 = x[i][1] - x2[1];
|
dely1 = x[i][1] - x2[1];
|
||||||
delz1 = x[i][2] - x2[2];
|
delz1 = x[i][2] - x2[2];
|
||||||
@ -300,32 +272,33 @@ void PairLJCutCoulLongTIP4P::compute(int eflag, int vflag)
|
|||||||
delz3 = x[iH2][2] - x2[2];
|
delz3 = x[iH2][2] - x2[2];
|
||||||
domain->minimum_image(delx3,dely3,delz3);
|
domain->minimum_image(delx3,dely3,delz3);
|
||||||
|
|
||||||
virialtmp[0] += 0.5 * (delx1 * fO[0] + (delx2 + delx3) * fH[0]);
|
v[0] = 0.5 * (delx1 * fO[0] + (delx2 + delx3) * fH[0]);
|
||||||
virialtmp[1] += 0.5 * (dely1 * fO[1] + (dely2 + dely3) * fH[1]);
|
v[1] = 0.5 * (dely1 * fO[1] + (dely2 + dely3) * fH[1]);
|
||||||
virialtmp[2] += 0.5 * (delz1 * fO[2] + (delz2 + delz3) * fH[2]);
|
v[2] = 0.5 * (delz1 * fO[2] + (delz2 + delz3) * fH[2]);
|
||||||
virialtmp[3] += 0.5 * (dely1 * fO[0] + (dely2 + dely3) * fH[0]);
|
v[3] = 0.5 * (dely1 * fO[0] + (dely2 + dely3) * fH[0]);
|
||||||
virialtmp[4] += 0.5 * (delz1 * fO[0] + (delz2 + delz3) * fH[0]);
|
v[4] = 0.5 * (delz1 * fO[0] + (delz2 + delz3) * fH[0]);
|
||||||
virialtmp[5] += 0.5 * (delz1 * fO[1] + (delz2 + delz3) * fH[1]);
|
v[5] = 0.5 * (delz1 * fO[1] + (delz2 + delz3) * fH[1]);
|
||||||
|
|
||||||
|
vlist[n++] = i;
|
||||||
|
vlist[n++] = iH1;
|
||||||
|
vlist[n++] = iH2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jtype != typeO) {
|
if (jtype != typeO) {
|
||||||
if (vflag == 0) {
|
f[j][0] -= delx * cforce;
|
||||||
f[j][0] -= delx * cforce;
|
f[j][1] -= dely * cforce;
|
||||||
f[j][1] -= dely * cforce;
|
f[j][2] -= delz * cforce;
|
||||||
f[j][2] -= delz * cforce;
|
|
||||||
|
|
||||||
} else {
|
if (vflag) {
|
||||||
ftmp[j][0] -= delx * cforce;
|
v[0] += 0.5 * delx * delx * cforce;
|
||||||
ftmp[j][1] -= dely * cforce;
|
v[1] += 0.5 * dely * dely * cforce;
|
||||||
ftmp[j][2] -= delz * cforce;
|
v[2] += 0.5 * delz * delz * cforce;
|
||||||
|
v[3] += 0.5 * delx * dely * cforce;
|
||||||
|
v[4] += 0.5 * delx * delz * cforce;
|
||||||
|
v[5] += 0.5 * dely * delz * cforce;
|
||||||
|
|
||||||
virialtmp[0] += 0.5 * delx * delx * cforce;
|
vlist[n++] = j;
|
||||||
virialtmp[1] += 0.5 * dely * dely * cforce;
|
|
||||||
virialtmp[2] += 0.5 * delz * delz * cforce;
|
|
||||||
virialtmp[3] += 0.5 * dely * delx * cforce;
|
|
||||||
virialtmp[4] += 0.5 * delz * delx * cforce;
|
|
||||||
virialtmp[5] += 0.5 * delz * dely * cforce;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -339,32 +312,19 @@ void PairLJCutCoulLongTIP4P::compute(int eflag, int vflag)
|
|||||||
fH[1] = alpha * (dely*negforce);
|
fH[1] = alpha * (dely*negforce);
|
||||||
fH[2] = alpha * (delz*negforce);
|
fH[2] = alpha * (delz*negforce);
|
||||||
|
|
||||||
if (vflag != 2) {
|
f[j][0] += fO[0];
|
||||||
f[j][0] += fO[0];
|
f[j][1] += fO[1];
|
||||||
f[j][1] += fO[1];
|
f[j][2] += fO[2];
|
||||||
f[j][2] += fO[2];
|
|
||||||
|
|
||||||
f[jH1][0] += fH[0];
|
f[jH1][0] += fH[0];
|
||||||
f[jH1][1] += fH[1];
|
f[jH1][1] += fH[1];
|
||||||
f[jH1][2] += fH[2];
|
f[jH1][2] += fH[2];
|
||||||
|
|
||||||
f[jH2][0] += fH[0];
|
f[jH2][0] += fH[0];
|
||||||
f[jH2][1] += fH[1];
|
f[jH2][1] += fH[1];
|
||||||
f[jH2][2] += fH[2];
|
f[jH2][2] += fH[2];
|
||||||
|
|
||||||
} else {
|
|
||||||
ftmp[j][0] += fO[0];
|
|
||||||
ftmp[j][1] += fO[1];
|
|
||||||
ftmp[j][2] += fO[2];
|
|
||||||
|
|
||||||
ftmp[jH1][0] += fH[0];
|
|
||||||
ftmp[jH1][1] += fH[1];
|
|
||||||
ftmp[jH1][2] += fH[2];
|
|
||||||
|
|
||||||
ftmp[jH2][0] += fH[0];
|
|
||||||
ftmp[jH2][1] += fH[1];
|
|
||||||
ftmp[jH2][2] += fH[2];
|
|
||||||
|
|
||||||
|
if (vflag) {
|
||||||
delx1 = x[j][0] - x1[0];
|
delx1 = x[j][0] - x1[0];
|
||||||
dely1 = x[j][1] - x1[1];
|
dely1 = x[j][1] - x1[1];
|
||||||
delz1 = x[j][2] - x1[2];
|
delz1 = x[j][2] - x1[2];
|
||||||
@ -380,12 +340,16 @@ void PairLJCutCoulLongTIP4P::compute(int eflag, int vflag)
|
|||||||
delz3 = x[jH2][2] - x1[2];
|
delz3 = x[jH2][2] - x1[2];
|
||||||
domain->minimum_image(delx3,dely3,delz3);
|
domain->minimum_image(delx3,dely3,delz3);
|
||||||
|
|
||||||
virialtmp[0] += 0.5 * (delx1 * fO[0] + (delx2 + delx3) * fH[0]);
|
v[0] += 0.5 * (delx1 * fO[0] + (delx2 + delx3) * fH[0]);
|
||||||
virialtmp[1] += 0.5 * (dely1 * fO[1] + (dely2 + dely3) * fH[1]);
|
v[1] += 0.5 * (dely1 * fO[1] + (dely2 + dely3) * fH[1]);
|
||||||
virialtmp[2] += 0.5 * (delz1 * fO[2] + (delz2 + delz3) * fH[2]);
|
v[2] += 0.5 * (delz1 * fO[2] + (delz2 + delz3) * fH[2]);
|
||||||
virialtmp[3] += 0.5 * (dely1 * fO[0] + (dely2 + dely3) * fH[0]);
|
v[3] += 0.5 * (dely1 * fO[0] + (dely2 + dely3) * fH[0]);
|
||||||
virialtmp[4] += 0.5 * (delz1 * fO[0] + (delz2 + delz3) * fH[0]);
|
v[4] += 0.5 * (delz1 * fO[0] + (delz2 + delz3) * fH[0]);
|
||||||
virialtmp[5] += 0.5 * (delz1 * fO[1] + (delz2 + delz3) * fH[1]);
|
v[5] += 0.5 * (delz1 * fO[1] + (delz2 + delz3) * fH[1]);
|
||||||
|
|
||||||
|
vlist[n++] = j;
|
||||||
|
vlist[n++] = jH1;
|
||||||
|
vlist[n++] = jH2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -397,24 +361,13 @@ void PairLJCutCoulLongTIP4P::compute(int eflag, int vflag)
|
|||||||
ecoul = qtmp*q[j] * table;
|
ecoul = qtmp*q[j] * table;
|
||||||
}
|
}
|
||||||
if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor;
|
if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor;
|
||||||
}
|
} else ecoul = 0.0;
|
||||||
} else ecoul = 0.0;
|
|
||||||
|
|
||||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
if (evflag) ev_tally_list(n,vlist,ecoul,v);
|
||||||
evdwl,ecoul,fpair,delx,dely,delz);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vflag_fdotr) {
|
|
||||||
virial_compute();
|
|
||||||
for (int i = 0; i < 6; i++) virial[i] += virialtmp[i];
|
|
||||||
for (int i = 0; i < nall; i++) {
|
|
||||||
f[i][0] += ftmp[i][0];
|
|
||||||
f[i][1] += ftmp[i][1];
|
|
||||||
f[i][2] += ftmp[i][2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -459,68 +412,14 @@ void PairLJCutCoulLongTIP4P::init_style()
|
|||||||
error->all("Pair style lj/cut/coul/long/tip4p requires newton pair on");
|
error->all("Pair style lj/cut/coul/long/tip4p requires newton pair on");
|
||||||
if (!atom->q_flag)
|
if (!atom->q_flag)
|
||||||
error->all("Pair style lj/cut/coul/long/tip4p requires atom attribute q");
|
error->all("Pair style lj/cut/coul/long/tip4p requires atom attribute q");
|
||||||
|
if (strcmp(force->kspace_style,"pppm/tip4p") != 0)
|
||||||
// request regular or rRESPA neighbor lists
|
|
||||||
|
|
||||||
int irequest;
|
|
||||||
|
|
||||||
if (update->whichflag == 0 && strcmp(update->integrate_style,"respa") == 0) {
|
|
||||||
int respa = 0;
|
|
||||||
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
|
||||||
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
|
||||||
|
|
||||||
if (respa == 0) irequest = neighbor->request(this);
|
|
||||||
else if (respa == 1) {
|
|
||||||
irequest = neighbor->request(this);
|
|
||||||
neighbor->requests[irequest]->id = 1;
|
|
||||||
neighbor->requests[irequest]->half = 0;
|
|
||||||
neighbor->requests[irequest]->respainner = 1;
|
|
||||||
irequest = neighbor->request(this);
|
|
||||||
neighbor->requests[irequest]->id = 3;
|
|
||||||
neighbor->requests[irequest]->half = 0;
|
|
||||||
neighbor->requests[irequest]->respaouter = 1;
|
|
||||||
} else {
|
|
||||||
irequest = neighbor->request(this);
|
|
||||||
neighbor->requests[irequest]->id = 1;
|
|
||||||
neighbor->requests[irequest]->half = 0;
|
|
||||||
neighbor->requests[irequest]->respainner = 1;
|
|
||||||
irequest = neighbor->request(this);
|
|
||||||
neighbor->requests[irequest]->id = 2;
|
|
||||||
neighbor->requests[irequest]->half = 0;
|
|
||||||
neighbor->requests[irequest]->respamiddle = 1;
|
|
||||||
irequest = neighbor->request(this);
|
|
||||||
neighbor->requests[irequest]->id = 3;
|
|
||||||
neighbor->requests[irequest]->half = 0;
|
|
||||||
neighbor->requests[irequest]->respaouter = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else irequest = neighbor->request(this);
|
|
||||||
|
|
||||||
cut_coulsq = cut_coul * cut_coul;
|
|
||||||
|
|
||||||
// set & error check interior rRESPA cutoffs
|
|
||||||
|
|
||||||
if (strcmp(update->integrate_style,"respa") == 0) {
|
|
||||||
if (((Respa *) update->integrate)->level_inner >= 0) {
|
|
||||||
cut_respa = ((Respa *) update->integrate)->cutoff;
|
|
||||||
for (i = 1; i <= atom->ntypes; i++)
|
|
||||||
for (j = i; j <= atom->ntypes; j++)
|
|
||||||
if (MIN(cut_lj[i][j],cut_coul) < cut_respa[3])
|
|
||||||
error->all("Pair cutoff < Respa interior cutoff");
|
|
||||||
}
|
|
||||||
} else cut_respa = NULL;
|
|
||||||
|
|
||||||
// insure use of correct KSpace long-range solver, set g_ewald
|
|
||||||
|
|
||||||
if (force->kspace == NULL)
|
|
||||||
error->all("Pair style is incompatible with KSpace style");
|
error->all("Pair style is incompatible with KSpace style");
|
||||||
if (strcmp(force->kspace_style,"pppm/tip4p") == 0)
|
if (force->bond == NULL)
|
||||||
g_ewald = force->kspace->g_ewald;
|
error->all("Must use a bond style with TIP4P potential");
|
||||||
else error->all("Pair style is incompatible with KSpace style");
|
if (force->angle == NULL)
|
||||||
|
error->all("Must use an angle style with TIP4P potential");
|
||||||
|
|
||||||
// setup force tables
|
PairLJCutCoulLong::init_style();
|
||||||
|
|
||||||
if (ncoultablebits) init_tables();
|
|
||||||
|
|
||||||
// set alpha parameter
|
// set alpha parameter
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -82,9 +82,9 @@ class PairAIREBO : public Pair {
|
|||||||
void FLJ(int, int);
|
void FLJ(int, int);
|
||||||
void TORSION(int, int);
|
void TORSION(int, int);
|
||||||
|
|
||||||
double bondorder(int, int, double *, double, double, double **);
|
double bondorder(int, int, double *, double, double, double **, int);
|
||||||
double bondorderLJ(int, int, double *, double, double,
|
double bondorderLJ(int, int, double *, double, double,
|
||||||
double *, double, double **);
|
double *, double, double **, int);
|
||||||
|
|
||||||
double Sp(double, double, double, double &);
|
double Sp(double, double, double, double &);
|
||||||
double Sp2(double, double, double, double &);
|
double Sp2(double, double, double, double &);
|
||||||
|
|||||||
@ -226,7 +226,7 @@ void PairTersoff::compute(int eflag, int vflag)
|
|||||||
f[k][1] += fk[1];
|
f[k][1] += fk[1];
|
||||||
f[k][2] += fk[2];
|
f[k][2] += fk[2];
|
||||||
|
|
||||||
if (evflag) ev_tally3(i,j,k,0.0,0.0,fj,fk,delr1,delr2);
|
if (vflag_atom) v_tally3(i,j,k,fj,fk,delr1,delr2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,7 +54,6 @@ PairMEAM::PairMEAM(LAMMPS *lmp) : Pair(lmp)
|
|||||||
rho = rho0 = rho1 = rho2 = rho3 = frhop = NULL;
|
rho = rho0 = rho1 = rho2 = rho3 = frhop = NULL;
|
||||||
gamma = dgamma1 = dgamma2 = dgamma3 = arho2b = NULL;
|
gamma = dgamma1 = dgamma2 = dgamma3 = arho2b = NULL;
|
||||||
arho1 = arho2 = arho3 = arho3b = t_ave = NULL;
|
arho1 = arho2 = arho3 = arho3b = t_ave = NULL;
|
||||||
strssa = NULL;
|
|
||||||
|
|
||||||
maxneigh = 0;
|
maxneigh = 0;
|
||||||
scrfcn = dscrfcn = fcpair = NULL;
|
scrfcn = dscrfcn = fcpair = NULL;
|
||||||
@ -96,8 +95,6 @@ PairMEAM::~PairMEAM()
|
|||||||
memory->destroy_2d_double_array(arho3b);
|
memory->destroy_2d_double_array(arho3b);
|
||||||
memory->destroy_2d_double_array(t_ave);
|
memory->destroy_2d_double_array(t_ave);
|
||||||
|
|
||||||
memory->destroy_3d_double_array(strssa);
|
|
||||||
|
|
||||||
memory->sfree(scrfcn);
|
memory->sfree(scrfcn);
|
||||||
memory->sfree(dscrfcn);
|
memory->sfree(dscrfcn);
|
||||||
memory->sfree(fcpair);
|
memory->sfree(fcpair);
|
||||||
@ -127,11 +124,6 @@ void PairMEAM::compute(int eflag, int vflag)
|
|||||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||||
else evflag = vflag_fdotr = 0;
|
else evflag = vflag_fdotr = 0;
|
||||||
|
|
||||||
// error check (for now)
|
|
||||||
|
|
||||||
if (eflag_atom || vflag_atom)
|
|
||||||
error->all("Pair style meam does not yet support peratom energy/virial");
|
|
||||||
|
|
||||||
int newton_pair = force->newton_pair;
|
int newton_pair = force->newton_pair;
|
||||||
|
|
||||||
// grow local arrays if necessary
|
// grow local arrays if necessary
|
||||||
@ -153,7 +145,6 @@ void PairMEAM::compute(int eflag, int vflag)
|
|||||||
memory->destroy_2d_double_array(arho3);
|
memory->destroy_2d_double_array(arho3);
|
||||||
memory->destroy_2d_double_array(arho3b);
|
memory->destroy_2d_double_array(arho3b);
|
||||||
memory->destroy_2d_double_array(t_ave);
|
memory->destroy_2d_double_array(t_ave);
|
||||||
memory->destroy_3d_double_array(strssa);
|
|
||||||
|
|
||||||
nmax = atom->nmax;
|
nmax = atom->nmax;
|
||||||
|
|
||||||
@ -173,7 +164,6 @@ void PairMEAM::compute(int eflag, int vflag)
|
|||||||
arho3 = memory->create_2d_double_array(nmax,10,"pair:arho3");
|
arho3 = memory->create_2d_double_array(nmax,10,"pair:arho3");
|
||||||
arho3b = memory->create_2d_double_array(nmax,3,"pair:arho3b");
|
arho3b = memory->create_2d_double_array(nmax,3,"pair:arho3b");
|
||||||
t_ave = memory->create_2d_double_array(nmax,3,"pair:t_ave");
|
t_ave = memory->create_2d_double_array(nmax,3,"pair:t_ave");
|
||||||
strssa = memory->create_3d_double_array(nmax,3,3,"pair:strssa");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// neighbor list info
|
// neighbor list info
|
||||||
@ -238,7 +228,7 @@ void PairMEAM::compute(int eflag, int vflag)
|
|||||||
for (ii = 0; ii < inum_half; ii++) {
|
for (ii = 0; ii < inum_half; ii++) {
|
||||||
i = ilist_half[ii];
|
i = ilist_half[ii];
|
||||||
ifort = i+1;
|
ifort = i+1;
|
||||||
meam_dens_init_(&ifort,&nmax,&eflag,&evdwl,&ntype,type,fmap,&x[0][0],
|
meam_dens_init_(&ifort,&nmax,&ntype,type,fmap,&x[0][0],
|
||||||
&numneigh_half[i],firstneigh_half[i],
|
&numneigh_half[i],firstneigh_half[i],
|
||||||
&numneigh_full[i],firstneigh_full[i],
|
&numneigh_full[i],firstneigh_full[i],
|
||||||
&scrfcn[offset],&dscrfcn[offset],&fcpair[offset],
|
&scrfcn[offset],&dscrfcn[offset],&fcpair[offset],
|
||||||
@ -252,10 +242,10 @@ void PairMEAM::compute(int eflag, int vflag)
|
|||||||
offset += numneigh_half[i];
|
offset += numneigh_half[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
reverse_flag = 0;
|
|
||||||
comm->reverse_comm_pair(this);
|
comm->reverse_comm_pair(this);
|
||||||
|
|
||||||
meam_dens_final_(&nlocal,&nmax,&eflag,&evdwl,&ntype,type,fmap,
|
meam_dens_final_(&nlocal,&nmax,&eflag_either,&eflag_global,&eflag_atom,
|
||||||
|
&eng_vdwl,eatom,&ntype,type,fmap,
|
||||||
&arho1[0][0],&arho2[0][0],arho2b,&arho3[0][0],
|
&arho1[0][0],&arho2[0][0],arho2b,&arho3[0][0],
|
||||||
&arho3b[0][0],&t_ave[0][0],gamma,dgamma1,
|
&arho3b[0][0],&t_ave[0][0],gamma,dgamma1,
|
||||||
dgamma2,dgamma3,rho,rho0,rho1,rho2,rho3,frhop,&errorflag);
|
dgamma2,dgamma3,rho,rho0,rho1,rho2,rho3,frhop,&errorflag);
|
||||||
@ -269,16 +259,24 @@ void PairMEAM::compute(int eflag, int vflag)
|
|||||||
|
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
|
||||||
|
// vptr is first value in vatom if it will be used by meam_force()
|
||||||
|
// else vatom may not exist, so pass dummy ptr
|
||||||
|
|
||||||
|
double *vptr;
|
||||||
|
if (vflag_atom) vptr = &vatom[0][0];
|
||||||
|
else vptr = &cutmax;
|
||||||
|
|
||||||
for (ii = 0; ii < inum_half; ii++) {
|
for (ii = 0; ii < inum_half; ii++) {
|
||||||
i = ilist_half[ii];
|
i = ilist_half[ii];
|
||||||
ifort = i+1;
|
ifort = i+1;
|
||||||
meam_force_(&ifort,&nmax,&eflag,&evdwl,&ntype,type,fmap,&x[0][0],
|
meam_force_(&ifort,&nmax,&eflag_either,&eflag_global,&eflag_atom,
|
||||||
|
&vflag_atom,&eng_vdwl,eatom,&ntype,type,fmap,&x[0][0],
|
||||||
&numneigh_half[i],firstneigh_half[i],
|
&numneigh_half[i],firstneigh_half[i],
|
||||||
&numneigh_full[i],firstneigh_full[i],
|
&numneigh_full[i],firstneigh_full[i],
|
||||||
&scrfcn[offset],&dscrfcn[offset],&fcpair[offset],
|
&scrfcn[offset],&dscrfcn[offset],&fcpair[offset],
|
||||||
dgamma1,dgamma2,dgamma3,rho0,rho1,rho2,rho3,frhop,
|
dgamma1,dgamma2,dgamma3,rho0,rho1,rho2,rho3,frhop,
|
||||||
&arho1[0][0],&arho2[0][0],arho2b,&arho3[0][0],&arho3b[0][0],
|
&arho1[0][0],&arho2[0][0],arho2b,&arho3[0][0],&arho3b[0][0],
|
||||||
&t_ave[0][0],&f[0][0],&strssa[0][0][0],&errorflag);
|
&t_ave[0][0],&f[0][0],vptr,&errorflag);
|
||||||
if (errorflag) {
|
if (errorflag) {
|
||||||
char str[128];
|
char str[128];
|
||||||
sprintf(str,"MEAM library error %d",errorflag);
|
sprintf(str,"MEAM library error %d",errorflag);
|
||||||
@ -287,17 +285,11 @@ void PairMEAM::compute(int eflag, int vflag)
|
|||||||
offset += numneigh_half[i];
|
offset += numneigh_half[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
reverse_flag = 1;
|
|
||||||
comm->reverse_comm_pair(this);
|
|
||||||
|
|
||||||
// change neighbor list indices back to C indexing
|
// change neighbor list indices back to C indexing
|
||||||
|
|
||||||
neigh_f2c(inum_half,ilist_half,numneigh_half,firstneigh_half);
|
neigh_f2c(inum_half,ilist_half,numneigh_half,firstneigh_half);
|
||||||
neigh_f2c(inum_half,ilist_half,numneigh_full,firstneigh_full);
|
neigh_f2c(inum_half,ilist_half,numneigh_full,firstneigh_full);
|
||||||
|
|
||||||
// just sum global energy (for now)
|
|
||||||
|
|
||||||
if (evflag) ev_tally(0,0,nlocal,newton_pair,evdwl,0.0,0.0,0.0,0.0,0.0);
|
|
||||||
if (vflag_fdotr) virial_compute();
|
if (vflag_fdotr) virial_compute();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -811,45 +803,28 @@ int PairMEAM::pack_reverse_comm(int n, int first, double *buf)
|
|||||||
|
|
||||||
m = 0;
|
m = 0;
|
||||||
last = first + n;
|
last = first + n;
|
||||||
if (reverse_flag == 0) {
|
for (i = first; i < last; i++) {
|
||||||
for (i = first; i < last; i++) {
|
buf[m++] = rho0[i];
|
||||||
buf[m++] = rho0[i];
|
buf[m++] = arho2b[i];
|
||||||
buf[m++] = arho2b[i];
|
buf[m++] = arho1[i][0];
|
||||||
buf[m++] = arho1[i][0];
|
buf[m++] = arho1[i][1];
|
||||||
buf[m++] = arho1[i][1];
|
buf[m++] = arho1[i][2];
|
||||||
buf[m++] = arho1[i][2];
|
buf[m++] = arho2[i][0];
|
||||||
buf[m++] = arho2[i][0];
|
buf[m++] = arho2[i][1];
|
||||||
buf[m++] = arho2[i][1];
|
buf[m++] = arho2[i][2];
|
||||||
buf[m++] = arho2[i][2];
|
buf[m++] = arho2[i][3];
|
||||||
buf[m++] = arho2[i][3];
|
buf[m++] = arho2[i][4];
|
||||||
buf[m++] = arho2[i][4];
|
buf[m++] = arho2[i][5];
|
||||||
buf[m++] = arho2[i][5];
|
for (k = 0; k < 10; k++) buf[m++] = arho3[i][k];
|
||||||
for (k = 0; k < 10; k++) buf[m++] = arho3[i][k];
|
buf[m++] = arho3b[i][0];
|
||||||
buf[m++] = arho3b[i][0];
|
buf[m++] = arho3b[i][1];
|
||||||
buf[m++] = arho3b[i][1];
|
buf[m++] = arho3b[i][2];
|
||||||
buf[m++] = arho3b[i][2];
|
buf[m++] = t_ave[i][0];
|
||||||
buf[m++] = t_ave[i][0];
|
buf[m++] = t_ave[i][1];
|
||||||
buf[m++] = t_ave[i][1];
|
buf[m++] = t_ave[i][2];
|
||||||
buf[m++] = t_ave[i][2];
|
|
||||||
}
|
|
||||||
size = 27;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
for (i = first; i < last; i++) {
|
|
||||||
buf[m++] = strssa[i][0][0];
|
|
||||||
buf[m++] = strssa[i][0][1];
|
|
||||||
buf[m++] = strssa[i][0][2];
|
|
||||||
buf[m++] = strssa[i][1][0];
|
|
||||||
buf[m++] = strssa[i][1][1];
|
|
||||||
buf[m++] = strssa[i][1][2];
|
|
||||||
buf[m++] = strssa[i][2][0];
|
|
||||||
buf[m++] = strssa[i][2][1];
|
|
||||||
buf[m++] = strssa[i][2][2];
|
|
||||||
}
|
|
||||||
size = 9;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return size;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -859,42 +834,26 @@ void PairMEAM::unpack_reverse_comm(int n, int *list, double *buf)
|
|||||||
int i,j,k,m;
|
int i,j,k,m;
|
||||||
|
|
||||||
m = 0;
|
m = 0;
|
||||||
if (reverse_flag == 0) {
|
for (i = 0; i < n; i++) {
|
||||||
for (i = 0; i < n; i++) {
|
j = list[i];
|
||||||
j = list[i];
|
rho0[j] += buf[m++];
|
||||||
rho0[j] += buf[m++];
|
arho2b[j] += buf[m++];
|
||||||
arho2b[j] += buf[m++];
|
arho1[j][0] += buf[m++];
|
||||||
arho1[j][0] += buf[m++];
|
arho1[j][1] += buf[m++];
|
||||||
arho1[j][1] += buf[m++];
|
arho1[j][2] += buf[m++];
|
||||||
arho1[j][2] += buf[m++];
|
arho2[j][0] += buf[m++];
|
||||||
arho2[j][0] += buf[m++];
|
arho2[j][1] += buf[m++];
|
||||||
arho2[j][1] += buf[m++];
|
arho2[j][2] += buf[m++];
|
||||||
arho2[j][2] += buf[m++];
|
arho2[j][3] += buf[m++];
|
||||||
arho2[j][3] += buf[m++];
|
arho2[j][4] += buf[m++];
|
||||||
arho2[j][4] += buf[m++];
|
arho2[j][5] += buf[m++];
|
||||||
arho2[j][5] += buf[m++];
|
for (k = 0; k < 10; k++) arho3[j][k] += buf[m++];
|
||||||
for (k = 0; k < 10; k++) arho3[j][k] += buf[m++];
|
arho3b[j][0] += buf[m++];
|
||||||
arho3b[j][0] += buf[m++];
|
arho3b[j][1] += buf[m++];
|
||||||
arho3b[j][1] += buf[m++];
|
arho3b[j][2] += buf[m++];
|
||||||
arho3b[j][2] += buf[m++];
|
t_ave[j][0] += buf[m++];
|
||||||
t_ave[j][0] += buf[m++];
|
t_ave[j][1] += buf[m++];
|
||||||
t_ave[j][1] += buf[m++];
|
t_ave[j][2] += buf[m++];
|
||||||
t_ave[j][2] += buf[m++];
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
for (i = 0; i < n; i++) {
|
|
||||||
j = list[i];
|
|
||||||
strssa[j][0][0] += buf[m++];
|
|
||||||
strssa[j][0][1] += buf[m++];
|
|
||||||
strssa[j][0][2] += buf[m++];
|
|
||||||
strssa[j][1][0] += buf[m++];
|
|
||||||
strssa[j][1][1] += buf[m++];
|
|
||||||
strssa[j][1][2] += buf[m++];
|
|
||||||
strssa[j][2][0] += buf[m++];
|
|
||||||
strssa[j][2][1] += buf[m++];
|
|
||||||
strssa[j][2][2] += buf[m++];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -906,7 +865,6 @@ double PairMEAM::memory_usage()
|
|||||||
{
|
{
|
||||||
double bytes = 11 * nmax * sizeof(double);
|
double bytes = 11 * nmax * sizeof(double);
|
||||||
bytes += (3 + 6 + 10 + 3 + 3) * nmax * sizeof(double);
|
bytes += (3 + 6 + 10 + 3 + 3) * nmax * sizeof(double);
|
||||||
bytes += 3*3 * nmax * sizeof(double);
|
|
||||||
bytes += 3 * maxneigh * sizeof(double);
|
bytes += 3 * maxneigh * sizeof(double);
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,20 +22,22 @@ extern "C" {
|
|||||||
void meam_setup_param_(int *, double *, int *, int *, int *);
|
void meam_setup_param_(int *, double *, int *, int *, int *);
|
||||||
void meam_setup_done_(double *);
|
void meam_setup_done_(double *);
|
||||||
|
|
||||||
void meam_dens_init_(int *, int *, int *, double *, int *, int *, int *,
|
void meam_dens_init_(int *, int *, int *, int *, int *,
|
||||||
double *, int *, int *, int *, int *,
|
double *, int *, int *, int *, int *,
|
||||||
double *, double *, double *, double *,
|
double *, double *, double *, double *,
|
||||||
double *, double *,
|
double *, double *,
|
||||||
double *, double *, double *, double *, int *);
|
double *, double *, double *, double *, int *);
|
||||||
|
|
||||||
void meam_dens_final_(int *, int *, int *, double *, int *, int *, int *,
|
void meam_dens_final_(int *, int *, int *, int *, int *, double *, double *,
|
||||||
|
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 *, double *, double *, double *, int *);
|
double *, double *, double *, double *, int *);
|
||||||
|
|
||||||
void meam_force_(int *, int *, int *, double *, int *, int *, int *,
|
void meam_force_(int *, int *, int *, int *, int *, int *,
|
||||||
|
double *, double *, int *, int *, int *,
|
||||||
double *, int *, int *, int *, int *, double *, double *,
|
double *, 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 *, double *,
|
||||||
@ -71,7 +73,6 @@ class PairMEAM : public Pair {
|
|||||||
int nelements; // # of unique elements
|
int nelements; // # of unique elements
|
||||||
char **elements; // names of unique elements
|
char **elements; // names of unique elements
|
||||||
double *mass; // mass of each element
|
double *mass; // mass of each element
|
||||||
int reverse_flag; // which pass of reverse comm is being done
|
|
||||||
|
|
||||||
int *map; // mapping from atom types to elements
|
int *map; // mapping from atom types to elements
|
||||||
int *fmap; // Fortran version of map array for MEAM lib
|
int *fmap; // Fortran version of map array for MEAM lib
|
||||||
@ -83,7 +84,6 @@ class PairMEAM : public Pair {
|
|||||||
double *rho,*rho0,*rho1,*rho2,*rho3,*frhop;
|
double *rho,*rho0,*rho1,*rho2,*rho3,*frhop;
|
||||||
double *gamma,*dgamma1,*dgamma2,*dgamma3,*arho2b;
|
double *gamma,*dgamma1,*dgamma2,*dgamma3,*arho2b;
|
||||||
double **arho1,**arho2,**arho3,**arho3b,**t_ave;
|
double **arho1,**arho2,**arho3,**arho3b,**t_ave;
|
||||||
double ***strssa;
|
|
||||||
|
|
||||||
void allocate();
|
void allocate();
|
||||||
void read_files(char *, char *);
|
void read_files(char *, char *);
|
||||||
|
|||||||
@ -57,6 +57,7 @@ FixPOEMS::FixPOEMS(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
rigid_flag = 1;
|
rigid_flag = 1;
|
||||||
virial_flag = 1;
|
virial_flag = 1;
|
||||||
|
|
||||||
MPI_Comm_rank(world,&me);
|
MPI_Comm_rank(world,&me);
|
||||||
|
|
||||||
// perform initial allocation of atom-based arrays
|
// perform initial allocation of atom-based arrays
|
||||||
@ -254,10 +255,6 @@ FixPOEMS::FixPOEMS(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
fprintf(logfile,"%d clusters, %d bodies, %d joints, %d atoms\n",
|
fprintf(logfile,"%d clusters, %d bodies, %d joints, %d atoms\n",
|
||||||
ncluster,nbody,njoint,nsum);
|
ncluster,nbody,njoint,nsum);
|
||||||
}
|
}
|
||||||
|
|
||||||
// zero fix_poems virial in case pressure uses it before 1st fix_poems call
|
|
||||||
|
|
||||||
for (int n = 0; n < 6; n++) virial[n] = 0.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -346,14 +343,6 @@ void FixPOEMS::init()
|
|||||||
error->all("POEMS fix must come before NPT/NPH fix");
|
error->all("POEMS fix must come before NPT/NPH fix");
|
||||||
}
|
}
|
||||||
|
|
||||||
// compute poems contribution to virial every step if fix NPT,NPH exists
|
|
||||||
|
|
||||||
pressure_flag = 0;
|
|
||||||
for (int i = 0; i < modify->nfix; i++) {
|
|
||||||
if (strcmp(modify->fix[i]->style,"npt") == 0) pressure_flag = 1;
|
|
||||||
if (strcmp(modify->fix[i]->style,"nph") == 0) pressure_flag = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// timestep info
|
// timestep info
|
||||||
|
|
||||||
dtv = update->dt;
|
dtv = update->dt;
|
||||||
@ -597,9 +586,9 @@ void FixPOEMS::init()
|
|||||||
make setup call to POEMS
|
make setup call to POEMS
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixPOEMS::setup()
|
void FixPOEMS::setup(int vflag)
|
||||||
{
|
{
|
||||||
int i,j,ibody;
|
int i,j,n,ibody;
|
||||||
|
|
||||||
// vcm = velocity of center-of-mass of each rigid body
|
// vcm = velocity of center-of-mass of each rigid body
|
||||||
// angmom = angular momentum of each rigid body
|
// angmom = angular momentum of each rigid body
|
||||||
@ -654,29 +643,31 @@ void FixPOEMS::setup()
|
|||||||
angmom[ibody][2] = all[ibody][5];
|
angmom[ibody][2] = all[ibody][5];
|
||||||
}
|
}
|
||||||
|
|
||||||
// set omega from angmom
|
// virial setup before call to set_v
|
||||||
|
|
||||||
|
if (vflag) v_setup(vflag);
|
||||||
|
else evflag = 0;
|
||||||
|
|
||||||
|
// set velocities from angmom & omega
|
||||||
|
|
||||||
for (ibody = 0; ibody < nbody; ibody++)
|
for (ibody = 0; ibody < nbody; ibody++)
|
||||||
omega_from_mq(angmom[ibody],ex_space[ibody],ey_space[ibody],
|
omega_from_mq(angmom[ibody],ex_space[ibody],ey_space[ibody],
|
||||||
ez_space[ibody],inertia[ibody],omega[ibody]);
|
ez_space[ibody],inertia[ibody],omega[ibody]);
|
||||||
|
set_v();
|
||||||
|
|
||||||
// reset velocities from omega
|
|
||||||
// guestimate virial as 2x the set_v contribution
|
// guestimate virial as 2x the set_v contribution
|
||||||
// since post_force doesn't compute virial
|
|
||||||
|
|
||||||
for (int n = 0; n < 6; n++) virial[n] = 0.0;
|
if (vflag_global)
|
||||||
set_v(1);
|
for (n = 0; n < 6; n++) virial[n] *= 2.0;
|
||||||
for (int n = 0; n < 6; n++) virial[n] *= 2.0;
|
if (vflag_atom) {
|
||||||
|
for (i = 0; i < nlocal; i++)
|
||||||
double ke = 0.0;
|
for (n = 0; n < 6; n++)
|
||||||
for (i = 0; i < nlocal; i++)
|
vatom[i][n] *= 2.0;
|
||||||
if (natom2body[i])
|
}
|
||||||
ke += mass[atom->type[i]] *
|
|
||||||
(v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]);
|
|
||||||
|
|
||||||
// use post_force() to compute initial fcm & torque
|
// use post_force() to compute initial fcm & torque
|
||||||
|
|
||||||
post_force(1);
|
post_force(vflag);
|
||||||
|
|
||||||
// setup for POEMS
|
// setup for POEMS
|
||||||
|
|
||||||
@ -691,17 +682,20 @@ void FixPOEMS::setup()
|
|||||||
set x,v of body atoms accordingly
|
set x,v of body atoms accordingly
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixPOEMS::initial_integrate()
|
void FixPOEMS::initial_integrate(int vflag)
|
||||||
{
|
{
|
||||||
// perform POEMS integration
|
// perform POEMS integration
|
||||||
|
|
||||||
poems->LobattoOne(xcm,vcm,omega,torque,fcm,ex_space,ey_space,ez_space);
|
poems->LobattoOne(xcm,vcm,omega,torque,fcm,ex_space,ey_space,ez_space);
|
||||||
|
|
||||||
// set coords and velocities of atoms in rigid bodies
|
// virial setup before call to set_xv
|
||||||
|
|
||||||
int vflag = 0;
|
if (vflag) v_setup(vflag);
|
||||||
if (pressure_flag || output->next_thermo == update->ntimestep) vflag = 1;
|
else evflag = 0;
|
||||||
set_xv(vflag);
|
|
||||||
|
// set coords and velocities of atoms in rigid bodies
|
||||||
|
|
||||||
|
set_xv();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -712,6 +706,8 @@ void FixPOEMS::initial_integrate()
|
|||||||
void FixPOEMS::post_force(int vflag)
|
void FixPOEMS::post_force(int vflag)
|
||||||
{
|
{
|
||||||
int i,j,ibody;
|
int i,j,ibody;
|
||||||
|
int xbox,ybox,zbox;
|
||||||
|
double dx,dy,dz;
|
||||||
|
|
||||||
int *image = atom->image;
|
int *image = atom->image;
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
@ -722,8 +718,6 @@ void FixPOEMS::post_force(int vflag)
|
|||||||
double yprd = domain->yprd;
|
double yprd = domain->yprd;
|
||||||
double zprd = domain->zprd;
|
double zprd = domain->zprd;
|
||||||
|
|
||||||
int xbox,ybox,zbox;
|
|
||||||
double dx,dy,dz;
|
|
||||||
for (ibody = 0; ibody < nbody; ibody++)
|
for (ibody = 0; ibody < nbody; ibody++)
|
||||||
for (i = 0; i < 6; i++) sum[ibody][i] = 0.0;
|
for (i = 0; i < 6; i++) sum[ibody][i] = 0.0;
|
||||||
|
|
||||||
@ -772,15 +766,14 @@ void FixPOEMS::final_integrate()
|
|||||||
poems->LobattoTwo(vcm,omega,torque,fcm);
|
poems->LobattoTwo(vcm,omega,torque,fcm);
|
||||||
|
|
||||||
// set velocities of atoms in rigid bodies
|
// set velocities of atoms in rigid bodies
|
||||||
|
// virial is already setup from initial_integrate
|
||||||
|
|
||||||
int vflag = 0;
|
set_v();
|
||||||
if (pressure_flag || output->next_thermo == update->ntimestep) vflag = 1;
|
|
||||||
set_v(vflag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixPOEMS::initial_integrate_respa(int ilevel, int flag)
|
void FixPOEMS::initial_integrate_respa(int vflag, int ilevel, int flag)
|
||||||
{
|
{
|
||||||
if (flag) return; // only used by NPT,NPH
|
if (flag) return; // only used by NPT,NPH
|
||||||
|
|
||||||
@ -788,7 +781,7 @@ void FixPOEMS::initial_integrate_respa(int ilevel, int flag)
|
|||||||
dtf = 0.5 * step_respa[ilevel] * force->ftm2v;
|
dtf = 0.5 * step_respa[ilevel] * force->ftm2v;
|
||||||
dthalf = 0.5 * step_respa[ilevel];
|
dthalf = 0.5 * step_respa[ilevel];
|
||||||
|
|
||||||
if (ilevel == 0) initial_integrate();
|
if (ilevel == 0) initial_integrate(vflag);
|
||||||
else final_integrate();
|
else final_integrate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1344,30 +1337,26 @@ void FixPOEMS::omega_from_mq(double *m, double *ex, double *ey, double *ez,
|
|||||||
v = Vcm + (W cross (x - Xcm))
|
v = Vcm + (W cross (x - Xcm))
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixPOEMS::set_xv(int vflag)
|
void FixPOEMS::set_xv()
|
||||||
{
|
{
|
||||||
|
int ibody;
|
||||||
|
int xbox,ybox,zbox;
|
||||||
|
double x0,x1,x2,v0,v1,v2,fc0,fc1,fc2,massone;
|
||||||
|
double vr[6];
|
||||||
|
|
||||||
int *image = atom->image;
|
int *image = atom->image;
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
double **v = atom->v;
|
double **v = atom->v;
|
||||||
|
double **f = atom->f;
|
||||||
|
double *mass = atom->mass;
|
||||||
|
int *type = atom->type;
|
||||||
int nlocal = atom->nlocal;
|
int nlocal = atom->nlocal;
|
||||||
|
|
||||||
double xprd = domain->xprd;
|
double xprd = domain->xprd;
|
||||||
double yprd = domain->yprd;
|
double yprd = domain->yprd;
|
||||||
double zprd = domain->zprd;
|
double zprd = domain->zprd;
|
||||||
|
|
||||||
int ibody;
|
// set x and v of each atom
|
||||||
int xbox,ybox,zbox;
|
|
||||||
|
|
||||||
double vold0,vold1,vold2,fc0,fc1,fc2,massone,x0,x1,x2;
|
|
||||||
double *mass = atom->mass;
|
|
||||||
double **f = atom->f;
|
|
||||||
int *type = atom->type;
|
|
||||||
|
|
||||||
// zero out fix_poems virial
|
|
||||||
|
|
||||||
if (vflag) for (int n = 0; n < 6; n++) virial[n] = 0.0;
|
|
||||||
|
|
||||||
// set x and v
|
|
||||||
// only set joint atoms for 1st rigid body they belong to
|
// only set joint atoms for 1st rigid body they belong to
|
||||||
|
|
||||||
for (int i = 0; i < nlocal; i++) {
|
for (int i = 0; i < nlocal; i++) {
|
||||||
@ -1378,18 +1367,21 @@ void FixPOEMS::set_xv(int vflag)
|
|||||||
ybox = (image[i] >> 10 & 1023) - 512;
|
ybox = (image[i] >> 10 & 1023) - 512;
|
||||||
zbox = (image[i] >> 20) - 512;
|
zbox = (image[i] >> 20) - 512;
|
||||||
|
|
||||||
// save old positions and velocities for virial contribution
|
// save old positions and velocities for virial
|
||||||
|
|
||||||
if (vflag) {
|
if (evflag) {
|
||||||
x0 = x[i][0] + xbox*xprd;
|
x0 = x[i][0] + xbox*xprd;
|
||||||
x1 = x[i][1] + ybox*yprd;
|
x1 = x[i][1] + ybox*yprd;
|
||||||
x2 = x[i][2] + zbox*zprd;
|
x2 = x[i][2] + zbox*zprd;
|
||||||
|
|
||||||
vold0 = v[i][0];
|
v0 = v[i][0];
|
||||||
vold1 = v[i][1];
|
v1 = v[i][1];
|
||||||
vold2 = v[i][2];
|
v2 = v[i][2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// x = displacement from center-of-mass, based on body orientation
|
||||||
|
// v = vcm + omega around center-of-mass
|
||||||
|
|
||||||
x[i][0] = ex_space[ibody][0]*displace[i][0] +
|
x[i][0] = ex_space[ibody][0]*displace[i][0] +
|
||||||
ey_space[ibody][0]*displace[i][1] +
|
ey_space[ibody][0]*displace[i][1] +
|
||||||
ez_space[ibody][0]*displace[i][2];
|
ez_space[ibody][0]*displace[i][2];
|
||||||
@ -1407,24 +1399,33 @@ void FixPOEMS::set_xv(int vflag)
|
|||||||
v[i][2] = omega[ibody][0]*x[i][1] - omega[ibody][1]*x[i][0] +
|
v[i][2] = omega[ibody][0]*x[i][1] - omega[ibody][1]*x[i][0] +
|
||||||
vcm[ibody][2];
|
vcm[ibody][2];
|
||||||
|
|
||||||
|
// add center of mass to displacement
|
||||||
|
// map back into periodic box via xbox,ybox,zbox
|
||||||
|
|
||||||
x[i][0] += xcm[ibody][0] - xbox*xprd;
|
x[i][0] += xcm[ibody][0] - xbox*xprd;
|
||||||
x[i][1] += xcm[ibody][1] - ybox*yprd;
|
x[i][1] += xcm[ibody][1] - ybox*yprd;
|
||||||
x[i][2] += xcm[ibody][2] - zbox*zprd;
|
x[i][2] += xcm[ibody][2] - zbox*zprd;
|
||||||
|
|
||||||
// compute body constraint forces for virial
|
// virial = unwrapped coords dotted into body constraint force
|
||||||
|
// body constraint force = implied force due to v change minus f external
|
||||||
|
// assume f does not include forces internal to body
|
||||||
|
// 1/2 factor b/c final_integrate contributes other half
|
||||||
|
// assume per-atom contribution is due to constraint force on that atom
|
||||||
|
|
||||||
if (vflag) {
|
if (evflag) {
|
||||||
massone = mass[type[i]];
|
massone = mass[type[i]];
|
||||||
fc0 = massone*(v[i][0] - vold0)/dtf - f[i][0];
|
fc0 = massone*(v[i][0] - v0)/dtf - f[i][0];
|
||||||
fc1 = massone*(v[i][1] - vold1)/dtf - f[i][1];
|
fc1 = massone*(v[i][1] - v1)/dtf - f[i][1];
|
||||||
fc2 = massone*(v[i][2] - vold2)/dtf - f[i][2];
|
fc2 = massone*(v[i][2] - v2)/dtf - f[i][2];
|
||||||
|
|
||||||
virial[0] += 0.5*fc0*x0;
|
vr[0] = 0.5*fc0*x0;
|
||||||
virial[1] += 0.5*fc1*x1;
|
vr[1] = 0.5*fc1*x1;
|
||||||
virial[2] += 0.5*fc2*x2;
|
vr[2] = 0.5*fc2*x2;
|
||||||
virial[3] += 0.5*fc1*x0;
|
vr[3] = 0.5*fc1*x0;
|
||||||
virial[4] += 0.5*fc2*x0;
|
vr[4] = 0.5*fc2*x0;
|
||||||
virial[5] += 0.5*fc2*x1;
|
vr[5] = 0.5*fc2*x1;
|
||||||
|
|
||||||
|
v_tally(1,&i,1.0,vr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1434,26 +1435,27 @@ void FixPOEMS::set_xv(int vflag)
|
|||||||
v = Vcm + (W cross (x - Xcm))
|
v = Vcm + (W cross (x - Xcm))
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixPOEMS::set_v(int vflag)
|
void FixPOEMS::set_v()
|
||||||
{
|
{
|
||||||
double **v = atom->v;
|
|
||||||
int nlocal = atom->nlocal;
|
|
||||||
|
|
||||||
int ibody;
|
int ibody;
|
||||||
|
int xbox,ybox,zbox;
|
||||||
double dx,dy,dz;
|
double dx,dy,dz;
|
||||||
|
double x0,x1,x2,v0,v1,v2,fc0,fc1,fc2,massone;
|
||||||
|
double vr[6];
|
||||||
|
|
||||||
double vold0,vold1,vold2,fc0,fc1,fc2,massone,x0,x1,x2;
|
|
||||||
double *mass = atom->mass;
|
double *mass = atom->mass;
|
||||||
double **f = atom->f;
|
double **f = atom->f;
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
|
double **v = atom->v;
|
||||||
int *type = atom->type;
|
int *type = atom->type;
|
||||||
int *image = atom->image;
|
int *image = atom->image;
|
||||||
|
int nlocal = atom->nlocal;
|
||||||
|
|
||||||
double xprd = domain->xprd;
|
double xprd = domain->xprd;
|
||||||
double yprd = domain->yprd;
|
double yprd = domain->yprd;
|
||||||
double zprd = domain->zprd;
|
double zprd = domain->zprd;
|
||||||
int xbox,ybox,zbox;
|
|
||||||
|
|
||||||
// set v
|
// set v of each atom
|
||||||
// only set joint atoms for 1st rigid body they belong to
|
// only set joint atoms for 1st rigid body they belong to
|
||||||
|
|
||||||
for (int i = 0; i < nlocal; i++) {
|
for (int i = 0; i < nlocal; i++) {
|
||||||
@ -1472,24 +1474,27 @@ void FixPOEMS::set_v(int vflag)
|
|||||||
|
|
||||||
// save old velocities for virial
|
// save old velocities for virial
|
||||||
|
|
||||||
if (vflag) {
|
if (evflag) {
|
||||||
vold0 = v[i][0];
|
v0 = v[i][0];
|
||||||
vold1 = v[i][1];
|
v1 = v[i][1];
|
||||||
vold2 = v[i][2];
|
v2 = v[i][2];
|
||||||
}
|
}
|
||||||
|
|
||||||
v[i][0] = omega[ibody][1]*dz - omega[ibody][2]*dy + vcm[ibody][0];
|
v[i][0] = omega[ibody][1]*dz - omega[ibody][2]*dy + vcm[ibody][0];
|
||||||
v[i][1] = omega[ibody][2]*dx - omega[ibody][0]*dz + vcm[ibody][1];
|
v[i][1] = omega[ibody][2]*dx - omega[ibody][0]*dz + vcm[ibody][1];
|
||||||
v[i][2] = omega[ibody][0]*dy - omega[ibody][1]*dx + vcm[ibody][2];
|
v[i][2] = omega[ibody][0]*dy - omega[ibody][1]*dx + vcm[ibody][2];
|
||||||
|
|
||||||
// compute body constraint forces for virial
|
// virial = unwrapped coords dotted into body constraint force
|
||||||
// use unwrapped atom positions
|
// body constraint force = implied force due to v change minus f external
|
||||||
|
// assume f does not include forces internal to body
|
||||||
|
// 1/2 factor b/c initial_integrate contributes other half
|
||||||
|
// assume per-atom contribution is due to constraint force on that atom
|
||||||
|
|
||||||
if (vflag) {
|
if (evflag) {
|
||||||
massone = mass[type[i]];
|
massone = mass[type[i]];
|
||||||
fc0 = massone*(v[i][0] - vold0)/dtf - f[i][0];
|
fc0 = massone*(v[i][0] - v0)/dtf - f[i][0];
|
||||||
fc1 = massone*(v[i][1] - vold1)/dtf - f[i][1];
|
fc1 = massone*(v[i][1] - v1)/dtf - f[i][1];
|
||||||
fc2 = massone*(v[i][2] - vold2)/dtf - f[i][2];
|
fc2 = massone*(v[i][2] - v2)/dtf - f[i][2];
|
||||||
|
|
||||||
xbox = (image[i] & 1023) - 512;
|
xbox = (image[i] & 1023) - 512;
|
||||||
ybox = (image[i] >> 10 & 1023) - 512;
|
ybox = (image[i] >> 10 & 1023) - 512;
|
||||||
@ -1499,12 +1504,14 @@ void FixPOEMS::set_v(int vflag)
|
|||||||
x1 = x[i][1] + ybox*yprd;
|
x1 = x[i][1] + ybox*yprd;
|
||||||
x2 = x[i][2] + zbox*zprd;
|
x2 = x[i][2] + zbox*zprd;
|
||||||
|
|
||||||
virial[0] += 0.5*fc0*x0;
|
vr[0] = 0.5*fc0*x0;
|
||||||
virial[1] += 0.5*fc1*x1;
|
vr[1] = 0.5*fc1*x1;
|
||||||
virial[2] += 0.5*fc2*x2;
|
vr[2] = 0.5*fc2*x2;
|
||||||
virial[3] += 0.5*fc1*x0;
|
vr[3] = 0.5*fc1*x0;
|
||||||
virial[4] += 0.5*fc2*x0;
|
vr[4] = 0.5*fc2*x0;
|
||||||
virial[5] += 0.5*fc2*x1;
|
vr[5] = 0.5*fc2*x1;
|
||||||
|
|
||||||
|
v_tally(1,&i,1.0,vr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,11 +24,11 @@ class FixPOEMS : public Fix {
|
|||||||
~FixPOEMS();
|
~FixPOEMS();
|
||||||
int setmask();
|
int setmask();
|
||||||
void init();
|
void init();
|
||||||
void setup();
|
void setup(int);
|
||||||
void initial_integrate();
|
void initial_integrate(int);
|
||||||
void post_force(int);
|
void post_force(int);
|
||||||
void final_integrate();
|
void final_integrate();
|
||||||
void initial_integrate_respa(int, int);
|
void initial_integrate_respa(int, int, int);
|
||||||
void post_force_respa(int, int, int);
|
void post_force_respa(int, int, int);
|
||||||
void final_integrate_respa(int);
|
void final_integrate_respa(int);
|
||||||
|
|
||||||
@ -48,7 +48,6 @@ class FixPOEMS : public Fix {
|
|||||||
double dtv,dtf,dthalf;
|
double dtv,dtf,dthalf;
|
||||||
double *step_respa;
|
double *step_respa;
|
||||||
int nlevels_respa;
|
int nlevels_respa;
|
||||||
int pressure_flag;
|
|
||||||
double total_ke;
|
double total_ke;
|
||||||
|
|
||||||
// atom assignment to rigid bodies
|
// atom assignment to rigid bodies
|
||||||
@ -100,8 +99,8 @@ class FixPOEMS : public Fix {
|
|||||||
void rotate(double **, int, int, int, int, double, double);
|
void rotate(double **, int, int, int, int, double, double);
|
||||||
void omega_from_mq(double *, double *, double *, double *,
|
void omega_from_mq(double *, double *, double *, double *,
|
||||||
double *, double *);
|
double *, double *);
|
||||||
void set_v(int);
|
void set_v();
|
||||||
void set_xv(int);
|
void set_xv();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -117,7 +117,7 @@ void ComputeStressAtom::compute_peratom()
|
|||||||
stress[i][j] = 0.0;
|
stress[i][j] = 0.0;
|
||||||
|
|
||||||
// add in per-atom contributions from each force
|
// add in per-atom contributions from each force
|
||||||
|
|
||||||
if (pairflag && force->pair) {
|
if (pairflag && force->pair) {
|
||||||
double **vatom = force->pair->vatom;
|
double **vatom = force->pair->vatom;
|
||||||
for (i = 0; i < npair; i++)
|
for (i = 0; i < npair; i++)
|
||||||
|
|||||||
@ -296,14 +296,6 @@ void FixRigid::init()
|
|||||||
error->all("Rigid fix must come before NPT/NPH fix");
|
error->all("Rigid fix must come before NPT/NPH fix");
|
||||||
}
|
}
|
||||||
|
|
||||||
// compute rigid contribution to virial every step if fix NPT,NPH exists
|
|
||||||
|
|
||||||
pressure_flag = 0;
|
|
||||||
for (int i = 0; i < modify->nfix; i++) {
|
|
||||||
if (strcmp(modify->fix[i]->style,"npt") == 0) pressure_flag = 1;
|
|
||||||
if (strcmp(modify->fix[i]->style,"nph") == 0) pressure_flag = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// timestep info
|
// timestep info
|
||||||
|
|
||||||
dtv = update->dt;
|
dtv = update->dt;
|
||||||
@ -720,7 +712,7 @@ void FixRigid::initial_integrate(int vflag)
|
|||||||
if (vflag) v_setup(vflag);
|
if (vflag) v_setup(vflag);
|
||||||
else evflag = 0;
|
else evflag = 0;
|
||||||
|
|
||||||
// set coords and velocities if atoms in rigid bodies
|
// set coords and velocities of atoms in rigid bodies
|
||||||
// from quarternion and omega
|
// from quarternion and omega
|
||||||
|
|
||||||
set_xv();
|
set_xv();
|
||||||
@ -1240,6 +1232,9 @@ void FixRigid::set_xv()
|
|||||||
int *image = atom->image;
|
int *image = atom->image;
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
double **v = atom->v;
|
double **v = atom->v;
|
||||||
|
double **f = atom->f;
|
||||||
|
double *mass = atom->mass;
|
||||||
|
int *type = atom->type;
|
||||||
int nlocal = atom->nlocal;
|
int nlocal = atom->nlocal;
|
||||||
|
|
||||||
double xprd = domain->xprd;
|
double xprd = domain->xprd;
|
||||||
@ -1251,10 +1246,8 @@ void FixRigid::set_xv()
|
|||||||
xz = domain->xz;
|
xz = domain->xz;
|
||||||
yz = domain->yz;
|
yz = domain->yz;
|
||||||
}
|
}
|
||||||
|
|
||||||
double *mass = atom->mass;
|
// set x and v of each atom
|
||||||
double **f = atom->f;
|
|
||||||
int *type = atom->type;
|
|
||||||
|
|
||||||
for (int i = 0; i < nlocal; i++) {
|
for (int i = 0; i < nlocal; i++) {
|
||||||
if (body[i] < 0) continue;
|
if (body[i] < 0) continue;
|
||||||
@ -1340,7 +1333,7 @@ void FixRigid::set_xv()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
set space-frame velocity of each atom in rigid body
|
set space-frame velocity of each atom in a rigid body
|
||||||
v = Vcm + (W cross (x - Xcm))
|
v = Vcm + (W cross (x - Xcm))
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
@ -1348,7 +1341,7 @@ void FixRigid::set_v()
|
|||||||
{
|
{
|
||||||
int ibody;
|
int ibody;
|
||||||
int xbox,ybox,zbox;
|
int xbox,ybox,zbox;
|
||||||
double xunwrap,yunwrap,zunwrap,dx,dy,dz;
|
double dx,dy,dz;
|
||||||
double x0,x1,x2,v0,v1,v2,fc0,fc1,fc2,massone;
|
double x0,x1,x2,v0,v1,v2,fc0,fc1,fc2,massone;
|
||||||
double xy,xz,yz;
|
double xy,xz,yz;
|
||||||
double vr[6];
|
double vr[6];
|
||||||
@ -1370,6 +1363,8 @@ void FixRigid::set_v()
|
|||||||
yz = domain->yz;
|
yz = domain->yz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set v of each atom
|
||||||
|
|
||||||
for (int i = 0; i < nlocal; i++) {
|
for (int i = 0; i < nlocal; i++) {
|
||||||
if (body[i] < 0) continue;
|
if (body[i] < 0) continue;
|
||||||
ibody = body[i];
|
ibody = body[i];
|
||||||
|
|||||||
@ -44,7 +44,6 @@ class FixRigid : public Fix {
|
|||||||
private:
|
private:
|
||||||
double dtv,dtf,dtq;
|
double dtv,dtf,dtq;
|
||||||
double *step_respa;
|
double *step_respa;
|
||||||
int pressure_flag;
|
|
||||||
int triclinic;
|
int triclinic;
|
||||||
|
|
||||||
int nbody; // # of rigid bodies
|
int nbody; // # of rigid bodies
|
||||||
|
|||||||
@ -44,6 +44,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator)
|
|||||||
memory = new Memory(this);
|
memory = new Memory(this);
|
||||||
error = new Error(this);
|
error = new Error(this);
|
||||||
universe = new Universe(this,communicator);
|
universe = new Universe(this,communicator);
|
||||||
|
output = NULL;
|
||||||
|
|
||||||
// parse input switches
|
// parse input switches
|
||||||
|
|
||||||
|
|||||||
169
src/pair.cpp
169
src/pair.cpp
@ -485,13 +485,12 @@ void Pair::ev_tally_xyz(int i, int j, int nlocal, int newton_pair,
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
tally eng_vdwl and virial into global and per-atom accumulators
|
tally eng_vdwl and virial into global and per-atom accumulators
|
||||||
called by SW and Tersoff potentials, newton_pair is always on
|
called by SW potential, newton_pair is always on
|
||||||
virial = riFi + rjFj + rkFk = (rj-ri) Fj + (rk-ri) Fk = drij*fj + drik*fk
|
virial = riFi + rjFj + rkFk = (rj-ri) Fj + (rk-ri) Fk = drji*fj + drki*fk
|
||||||
could just pass ri,rj,rk since coords are already unwrapped by PBC
|
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void Pair::ev_tally3(int i, int j, int k, double evdwl, double ecoul,
|
void Pair::ev_tally3(int i, int j, int k, double evdwl, double ecoul,
|
||||||
double *fj, double *fk, double *drij, double *drik)
|
double *fj, double *fk, double *drji, double *drki)
|
||||||
{
|
{
|
||||||
double epairthird,v[6];
|
double epairthird,v[6];
|
||||||
|
|
||||||
@ -509,12 +508,12 @@ void Pair::ev_tally3(int i, int j, int k, double evdwl, double ecoul,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (vflag_atom) {
|
if (vflag_atom) {
|
||||||
v[0] = THIRD * (drij[0]*fj[0] + drik[0]*fk[0]);
|
v[0] = THIRD * (drji[0]*fj[0] + drki[0]*fk[0]);
|
||||||
v[1] = THIRD * (drij[1]*fj[1] + drik[1]*fk[1]);
|
v[1] = THIRD * (drji[1]*fj[1] + drki[1]*fk[1]);
|
||||||
v[2] = THIRD * (drij[2]*fj[2] + drik[2]*fk[2]);
|
v[2] = THIRD * (drji[2]*fj[2] + drki[2]*fk[2]);
|
||||||
v[3] = THIRD * (drij[0]*fj[1] + drik[0]*fk[1]);
|
v[3] = THIRD * (drji[0]*fj[1] + drki[0]*fk[1]);
|
||||||
v[4] = THIRD * (drij[0]*fj[2] + drik[0]*fk[2]);
|
v[4] = THIRD * (drji[0]*fj[2] + drki[0]*fk[2]);
|
||||||
v[5] = THIRD * (drij[1]*fj[2] + drik[1]*fk[2]);
|
v[5] = THIRD * (drji[1]*fj[2] + drki[1]*fk[2]);
|
||||||
|
|
||||||
vatom[i][0] += v[0]; vatom[i][1] += v[1]; vatom[i][2] += v[2];
|
vatom[i][0] += v[0]; vatom[i][1] += v[1]; vatom[i][2] += v[2];
|
||||||
vatom[i][3] += v[3]; vatom[i][4] += v[4]; vatom[i][5] += v[5];
|
vatom[i][3] += v[3]; vatom[i][4] += v[4]; vatom[i][5] += v[5];
|
||||||
@ -525,23 +524,134 @@ void Pair::ev_tally3(int i, int j, int k, double evdwl, double ecoul,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
tally eng_vdwl and virial into global and per-atom accumulators
|
||||||
|
called by AIREBO potential, newton_pair is always on
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void Pair::ev_tally4(int i, int j, int k, int m, double evdwl,
|
||||||
|
double *fi, double *fj, double *fk,
|
||||||
|
double *drim, double *drjm, double *drkm)
|
||||||
|
{
|
||||||
|
double epairfourth,v[6];
|
||||||
|
|
||||||
|
if (eflag_either) {
|
||||||
|
if (eflag_global) eng_vdwl += evdwl;
|
||||||
|
if (eflag_atom) {
|
||||||
|
epairfourth = 0.25 * evdwl;
|
||||||
|
eatom[i] += epairfourth;
|
||||||
|
eatom[j] += epairfourth;
|
||||||
|
eatom[k] += epairfourth;
|
||||||
|
eatom[m] += epairfourth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vflag_atom) {
|
||||||
|
v[0] = 0.25 * (drim[0]*fi[0] + drjm[0]*fj[0] + drkm[0]*fk[0]);
|
||||||
|
v[1] = 0.25 * (drim[1]*fi[1] + drjm[1]*fj[1] + drkm[1]*fk[1]);
|
||||||
|
v[2] = 0.25 * (drim[2]*fi[2] + drjm[2]*fj[2] + drkm[2]*fk[2]);
|
||||||
|
v[3] = 0.25 * (drim[0]*fi[1] + drjm[0]*fj[1] + drkm[0]*fk[1]);
|
||||||
|
v[4] = 0.25 * (drim[0]*fi[2] + drjm[0]*fj[2] + drkm[0]*fk[2]);
|
||||||
|
v[5] = 0.25 * (drim[1]*fi[2] + drjm[1]*fj[2] + drkm[1]*fk[2]);
|
||||||
|
|
||||||
|
vatom[i][0] += v[0]; vatom[i][1] += v[1]; vatom[i][2] += v[2];
|
||||||
|
vatom[i][3] += v[3]; vatom[i][4] += v[4]; vatom[i][5] += v[5];
|
||||||
|
vatom[j][0] += v[0]; vatom[j][1] += v[1]; vatom[j][2] += v[2];
|
||||||
|
vatom[j][3] += v[3]; vatom[j][4] += v[4]; vatom[j][5] += v[5];
|
||||||
|
vatom[k][0] += v[0]; vatom[k][1] += v[1]; vatom[k][2] += v[2];
|
||||||
|
vatom[k][3] += v[3]; vatom[k][4] += v[4]; vatom[k][5] += v[5];
|
||||||
|
vatom[m][0] += v[0]; vatom[m][1] += v[1]; vatom[m][2] += v[2];
|
||||||
|
vatom[m][3] += v[3]; vatom[m][4] += v[4]; vatom[m][5] += v[5];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
tally ecoul and virial into each of n atoms in list
|
||||||
|
called by TIP4P potential, newton_pair is always on
|
||||||
|
changes v values by dividing by n
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void Pair::ev_tally_list(int n, int *list, double ecoul, double *v)
|
||||||
|
{
|
||||||
|
int i,j;
|
||||||
|
|
||||||
|
if (eflag_either) {
|
||||||
|
if (eflag_global) eng_coul += ecoul;
|
||||||
|
if (eflag_atom) {
|
||||||
|
double epairatom = ecoul/n;
|
||||||
|
for (i = 0; i < n; i++) eatom[list[i]] += epairatom;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vflag_either) {
|
||||||
|
if (vflag_global) {
|
||||||
|
virial[0] += v[0];
|
||||||
|
virial[1] += v[1];
|
||||||
|
virial[2] += v[2];
|
||||||
|
virial[3] += v[3];
|
||||||
|
virial[4] += v[4];
|
||||||
|
virial[5] += v[5];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vflag_atom) {
|
||||||
|
v[0] /= n;
|
||||||
|
v[1] /= n;
|
||||||
|
v[2] /= n;
|
||||||
|
v[3] /= n;
|
||||||
|
v[4] /= n;
|
||||||
|
v[5] /= n;
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
|
j = list[i];
|
||||||
|
vatom[j][0] += v[0];
|
||||||
|
vatom[j][1] += v[1];
|
||||||
|
vatom[j][2] += v[2];
|
||||||
|
vatom[j][3] += v[3];
|
||||||
|
vatom[j][4] += v[4];
|
||||||
|
vatom[j][5] += v[5];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
tally virial into per-atom accumulators
|
tally virial into per-atom accumulators
|
||||||
called by airebo potential, newton_pair is always on
|
called by AIREBO potential, newton_pair is always on
|
||||||
could just pass ri,rj,rk since coords are already unwrapped by PBC
|
fpair is magnitude of force on atom I
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void Pair::v_tally3(int i, int j, int k,
|
void Pair::v_tally2(int i, int j, double fpair, double *drij)
|
||||||
double f1, double f2, double *drik, double *drkj)
|
|
||||||
{
|
{
|
||||||
double v[6];
|
double v[6];
|
||||||
|
|
||||||
v[0] = 0.0;
|
v[0] = 0.5 * drij[0]*drij[0]*fpair;
|
||||||
v[1] = 0.0;
|
v[1] = 0.5 * drij[1]*drij[1]*fpair;
|
||||||
v[2] = 0.0;
|
v[2] = 0.5 * drij[2]*drij[2]*fpair;
|
||||||
v[3] = 0.0;
|
v[3] = 0.5 * drij[0]*drij[1]*fpair;
|
||||||
v[4] = 0.0;
|
v[4] = 0.5 * drij[0]*drij[2]*fpair;
|
||||||
v[5] = 0.0;
|
v[5] = 0.5 * drij[1]*drij[2]*fpair;
|
||||||
|
|
||||||
|
vatom[i][0] += v[0]; vatom[i][1] += v[1]; vatom[i][2] += v[2];
|
||||||
|
vatom[i][3] += v[3]; vatom[i][4] += v[4]; vatom[i][5] += v[5];
|
||||||
|
vatom[j][0] += v[0]; vatom[j][1] += v[1]; vatom[j][2] += v[2];
|
||||||
|
vatom[j][3] += v[3]; vatom[j][4] += v[4]; vatom[j][5] += v[5];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
tally virial into per-atom accumulators
|
||||||
|
called by AIREBO and Tersoff potential, newton_pair is always on
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void Pair::v_tally3(int i, int j, int k,
|
||||||
|
double *fi, double *fj, double *drik, double *drjk)
|
||||||
|
{
|
||||||
|
double v[6];
|
||||||
|
|
||||||
|
v[0] = THIRD * (drik[0]*fi[0] + drjk[0]*fj[0]);
|
||||||
|
v[1] = THIRD * (drik[1]*fi[1] + drjk[1]*fj[1]);
|
||||||
|
v[2] = THIRD * (drik[2]*fi[2] + drjk[2]*fj[2]);
|
||||||
|
v[3] = THIRD * (drik[0]*fi[1] + drjk[0]*fj[1]);
|
||||||
|
v[4] = THIRD * (drik[0]*fi[2] + drjk[0]*fj[2]);
|
||||||
|
v[5] = THIRD * (drik[1]*fi[2] + drjk[1]*fj[2]);
|
||||||
|
|
||||||
vatom[i][0] += v[0]; vatom[i][1] += v[1]; vatom[i][2] += v[2];
|
vatom[i][0] += v[0]; vatom[i][1] += v[1]; vatom[i][2] += v[2];
|
||||||
vatom[i][3] += v[3]; vatom[i][4] += v[4]; vatom[i][5] += v[5];
|
vatom[i][3] += v[3]; vatom[i][4] += v[4]; vatom[i][5] += v[5];
|
||||||
@ -553,22 +663,21 @@ void Pair::v_tally3(int i, int j, int k,
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
tally virial into per-atom accumulators
|
tally virial into per-atom accumulators
|
||||||
called by airebo potential, newton_pair is always on
|
called by AIREBO potential, newton_pair is always on
|
||||||
could just pass ri,rj,rk,rm since coords are already unwrapped by PBC
|
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void Pair::v_tally4(int i, int j, int k, int m,
|
void Pair::v_tally4(int i, int j, int k, int m,
|
||||||
double f1, double f2, double f3,
|
double *fi, double *fj, double *fk,
|
||||||
double *drik, double *drkm, double *drmj)
|
double *drim, double *drjm, double *drkm)
|
||||||
{
|
{
|
||||||
double v[6];
|
double v[6];
|
||||||
|
|
||||||
v[0] = 0.0;
|
v[0] = 0.25 * (drim[0]*fi[0] + drjm[0]*fj[0] + drkm[0]*fk[0]);
|
||||||
v[1] = 0.0;
|
v[1] = 0.25 * (drim[1]*fi[1] + drjm[1]*fj[1] + drkm[1]*fk[1]);
|
||||||
v[2] = 0.0;
|
v[2] = 0.25 * (drim[2]*fi[2] + drjm[2]*fj[2] + drkm[2]*fk[2]);
|
||||||
v[3] = 0.0;
|
v[3] = 0.25 * (drim[0]*fi[1] + drjm[0]*fj[1] + drkm[0]*fk[1]);
|
||||||
v[4] = 0.0;
|
v[4] = 0.25 * (drim[0]*fi[2] + drjm[0]*fj[2] + drkm[0]*fk[2]);
|
||||||
v[5] = 0.0;
|
v[5] = 0.25 * (drim[1]*fi[2] + drjm[1]*fj[2] + drkm[1]*fk[2]);
|
||||||
|
|
||||||
vatom[i][0] += v[0]; vatom[i][1] += v[1]; vatom[i][2] += v[2];
|
vatom[i][0] += v[0]; vatom[i][1] += v[1]; vatom[i][2] += v[2];
|
||||||
vatom[i][3] += v[3]; vatom[i][4] += v[4]; vatom[i][5] += v[5];
|
vatom[i][3] += v[3]; vatom[i][4] += v[4]; vatom[i][5] += v[5];
|
||||||
|
|||||||
@ -119,8 +119,12 @@ class Pair : protected Pointers {
|
|||||||
double, double, double, double, double, double);
|
double, double, double, double, double, double);
|
||||||
void ev_tally3(int, int, int, double, double,
|
void ev_tally3(int, int, int, double, double,
|
||||||
double *, double *, double *, double *);
|
double *, double *, double *, double *);
|
||||||
void v_tally3(int, int, int, double, double, double *, double *);
|
void ev_tally4(int, int, int, int, double,
|
||||||
void v_tally4(int, int, int, int, double, double, double,
|
double *, double *, double *, double *, double *, double *);
|
||||||
|
void ev_tally_list(int, int *, double, double *);
|
||||||
|
void v_tally2(int, int, double, double *);
|
||||||
|
void v_tally3(int, int, int, double *, double *, double *, double *);
|
||||||
|
void v_tally4(int, int, int, int, double *, double *, double *,
|
||||||
double *, double *, double *);
|
double *, double *, double *);
|
||||||
void virial_compute();
|
void virial_compute();
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,20 +0,0 @@
|
|||||||
/* ----------------------------------------------------------------------
|
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
|
||||||
http://lammps.sandia.gov, Sandia National Laboratories
|
|
||||||
Steve Plimpton, sjplimp@sandia.gov
|
|
||||||
|
|
||||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
|
||||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
|
||||||
certain rights in this software. This software is distributed under
|
|
||||||
the GNU General Public License.
|
|
||||||
|
|
||||||
See the README file in the top-level LAMMPS directory.
|
|
||||||
------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#ifdef ComputeInclude
|
|
||||||
#include "compute_ackland_atom.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ComputeClass
|
|
||||||
ComputeStyle(ackland/atom,ComputeAcklandAtom)
|
|
||||||
#endif
|
|
||||||
|
|||||||
@ -1,30 +0,0 @@
|
|||||||
/* ----------------------------------------------------------------------
|
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
|
||||||
http://lammps.sandia.gov, Sandia National Laboratories
|
|
||||||
Steve Plimpton, sjplimp@sandia.gov
|
|
||||||
|
|
||||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
|
||||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
|
||||||
certain rights in this software. This software is distributed under
|
|
||||||
the GNU General Public License.
|
|
||||||
|
|
||||||
See the README file in the top-level LAMMPS directory.
|
|
||||||
------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#ifdef KSpaceInclude
|
|
||||||
#include "ewald_n.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef KSpaceClass
|
|
||||||
KSpaceStyle(ewald/n,EwaldN)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PairInclude
|
|
||||||
#include "pair_buck_coul.h"
|
|
||||||
#include "pair_lj_coul.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PairClass
|
|
||||||
PairStyle(buck/coul,PairBuckCoul)
|
|
||||||
PairStyle(lj/coul,PairLJCoul)
|
|
||||||
#endif
|
|
||||||
|
|||||||
@ -256,7 +256,7 @@ void Thermo::init()
|
|||||||
int ivariable;
|
int ivariable;
|
||||||
for (i = 0; i < nvariable; i++) {
|
for (i = 0; i < nvariable; i++) {
|
||||||
ivariable = input->variable->find(id_variable[i]);
|
ivariable = input->variable->find(id_variable[i]);
|
||||||
if (ivariable < 0) error->all("Could not find thermo variable name");
|
if (ivariable < 0) error->all("Could not find thermo custom variable name");
|
||||||
variables[i] = ivariable;
|
variables[i] = ivariable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1094,7 +1094,7 @@ double Variable::eval_tree(Tree *tree, int i)
|
|||||||
return exp(eval_tree(tree->left,i));
|
return exp(eval_tree(tree->left,i));
|
||||||
if (tree->type == LN) {
|
if (tree->type == LN) {
|
||||||
double arg = eval_tree(tree->left,i);
|
double arg = eval_tree(tree->left,i);
|
||||||
if (arg <= 0.0) error->all("Log of negative/zero in variable formula");
|
if (arg <= 0.0) error->all("Log of zero/negative in variable formula");
|
||||||
return log(arg);
|
return log(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user