forked from lijiext/lammps
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8226 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
f46eb9dedb
commit
ef9e700545
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -41,9 +41,9 @@ ComputeERotateAsphere(LAMMPS *lmp, int narg, char **arg) :
|
|||
avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid");
|
||||
avec_line = (AtomVecLine *) atom->style_match("line");
|
||||
avec_tri = (AtomVecTri *) atom->style_match("tri");
|
||||
if (!avec_ellipsoid && !avec_line && !avec_tri)
|
||||
if (!avec_ellipsoid && !avec_line && !avec_tri)
|
||||
error->all(FLERR,"Compute erotate/asphere requires "
|
||||
"atom style ellipsoid or line or tri");
|
||||
"atom style ellipsoid or line or tri");
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
@ -67,7 +67,7 @@ void ComputeERotateAsphere::init()
|
|||
if (line && line[i] >= 0) flag = 1;
|
||||
if (tri && tri[i] >= 0) flag = 1;
|
||||
if (!flag)
|
||||
error->one(FLERR,"Compute erotate/asphere requires extended particles");
|
||||
error->one(FLERR,"Compute erotate/asphere requires extended particles");
|
||||
}
|
||||
|
||||
pfactor = 0.5 * force->mvv2e;
|
||||
|
@ -106,53 +106,53 @@ double ComputeERotateAsphere::compute_scalar()
|
|||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) {
|
||||
if (ellipsoid && ellipsoid[i] >= 0) {
|
||||
shape = ebonus[ellipsoid[i]].shape;
|
||||
quat = ebonus[ellipsoid[i]].quat;
|
||||
shape = ebonus[ellipsoid[i]].shape;
|
||||
quat = ebonus[ellipsoid[i]].quat;
|
||||
|
||||
// principal moments of inertia
|
||||
|
||||
inertia[0] = rmass[i] * (shape[1]*shape[1]+shape[2]*shape[2]) / 5.0;
|
||||
inertia[1] = rmass[i] * (shape[0]*shape[0]+shape[2]*shape[2]) / 5.0;
|
||||
inertia[2] = rmass[i] * (shape[0]*shape[0]+shape[1]*shape[1]) / 5.0;
|
||||
|
||||
// wbody = angular velocity in body frame
|
||||
|
||||
MathExtra::quat_to_mat(quat,rot);
|
||||
MathExtra::transpose_matvec(rot,angmom[i],wbody);
|
||||
wbody[0] /= inertia[0];
|
||||
wbody[1] /= inertia[1];
|
||||
wbody[2] /= inertia[2];
|
||||
|
||||
erotate += inertia[0]*wbody[0]*wbody[0] +
|
||||
inertia[1]*wbody[1]*wbody[1] + inertia[2]*wbody[2]*wbody[2];
|
||||
// principal moments of inertia
|
||||
|
||||
inertia[0] = rmass[i] * (shape[1]*shape[1]+shape[2]*shape[2]) / 5.0;
|
||||
inertia[1] = rmass[i] * (shape[0]*shape[0]+shape[2]*shape[2]) / 5.0;
|
||||
inertia[2] = rmass[i] * (shape[0]*shape[0]+shape[1]*shape[1]) / 5.0;
|
||||
|
||||
// wbody = angular velocity in body frame
|
||||
|
||||
MathExtra::quat_to_mat(quat,rot);
|
||||
MathExtra::transpose_matvec(rot,angmom[i],wbody);
|
||||
wbody[0] /= inertia[0];
|
||||
wbody[1] /= inertia[1];
|
||||
wbody[2] /= inertia[2];
|
||||
|
||||
erotate += inertia[0]*wbody[0]*wbody[0] +
|
||||
inertia[1]*wbody[1]*wbody[1] + inertia[2]*wbody[2]*wbody[2];
|
||||
|
||||
} else if (line && line[i] >= 0) {
|
||||
length = lbonus[line[i]].length;
|
||||
length = lbonus[line[i]].length;
|
||||
|
||||
erotate += (omega[i][0]*omega[i][0] + omega[i][1]*omega[i][1] +
|
||||
omega[i][2]*omega[i][2]) * length*length*rmass[i] / 12.0;
|
||||
erotate += (omega[i][0]*omega[i][0] + omega[i][1]*omega[i][1] +
|
||||
omega[i][2]*omega[i][2]) * length*length*rmass[i] / 12.0;
|
||||
|
||||
} else if (tri && tri[i] >= 0) {
|
||||
|
||||
// principal moments of inertia
|
||||
// principal moments of inertia
|
||||
|
||||
inertia[0] = tbonus[tri[i]].inertia[0];
|
||||
inertia[1] = tbonus[tri[i]].inertia[1];
|
||||
inertia[2] = tbonus[tri[i]].inertia[2];
|
||||
inertia[0] = tbonus[tri[i]].inertia[0];
|
||||
inertia[1] = tbonus[tri[i]].inertia[1];
|
||||
inertia[2] = tbonus[tri[i]].inertia[2];
|
||||
|
||||
// wbody = angular velocity in body frame
|
||||
|
||||
MathExtra::quat_to_mat(tbonus[tri[i]].quat,rot);
|
||||
MathExtra::transpose_matvec(rot,angmom[i],wbody);
|
||||
wbody[0] /= inertia[0];
|
||||
wbody[1] /= inertia[1];
|
||||
wbody[2] /= inertia[2];
|
||||
|
||||
erotate += inertia[0]*wbody[0]*wbody[0] +
|
||||
inertia[1]*wbody[1]*wbody[1] + inertia[2]*wbody[2]*wbody[2];
|
||||
// wbody = angular velocity in body frame
|
||||
|
||||
MathExtra::quat_to_mat(tbonus[tri[i]].quat,rot);
|
||||
MathExtra::transpose_matvec(rot,angmom[i],wbody);
|
||||
wbody[0] /= inertia[0];
|
||||
wbody[1] /= inertia[1];
|
||||
wbody[2] /= inertia[2];
|
||||
|
||||
erotate += inertia[0]*wbody[0]*wbody[0] +
|
||||
inertia[1]*wbody[1]*wbody[1] + inertia[2]*wbody[2]*wbody[2];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MPI_Allreduce(&erotate,&scalar,1,MPI_DOUBLE,MPI_SUM,world);
|
||||
scalar *= pfactor;
|
||||
return scalar;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -76,7 +76,7 @@ ComputeTempAsphere::ComputeTempAsphere(LAMMPS *lmp, int narg, char **arg) :
|
|||
// error check
|
||||
|
||||
avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid");
|
||||
if (!avec)
|
||||
if (!avec)
|
||||
error->all(FLERR,"Compute temp/asphere requires atom style ellipsoid");
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ void ComputeTempAsphere::init()
|
|||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit)
|
||||
if (ellipsoid[i] < 0)
|
||||
error->one(FLERR,"Compute temp/asphere requires extended particles");
|
||||
error->one(FLERR,"Compute temp/asphere requires extended particles");
|
||||
|
||||
if (tempbias) {
|
||||
int i = modify->find_compute(id_bias);
|
||||
|
@ -154,7 +154,7 @@ void ComputeTempAsphere::dof_compute()
|
|||
int count = 0;
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit)
|
||||
if (tbias->dof_remove(i)) count++;
|
||||
if (tbias->dof_remove(i)) count++;
|
||||
int count_all;
|
||||
MPI_Allreduce(&count,&count_all,1,MPI_INT,MPI_SUM,world);
|
||||
dof -= nper*count_all;
|
||||
|
@ -187,7 +187,7 @@ double ComputeTempAsphere::compute_scalar()
|
|||
double *shape,*quat;
|
||||
double wbody[3],inertia[3];
|
||||
double rot[3][3];
|
||||
|
||||
|
||||
// sum translational and rotational energy for each particle
|
||||
// no point particles since divide by inertia
|
||||
|
||||
|
@ -196,52 +196,52 @@ double ComputeTempAsphere::compute_scalar()
|
|||
if (mode == ALL) {
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) {
|
||||
t += (v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]) * rmass[i];
|
||||
t += (v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]) * rmass[i];
|
||||
|
||||
// principal moments of inertia
|
||||
// principal moments of inertia
|
||||
|
||||
shape = bonus[ellipsoid[i]].shape;
|
||||
quat = bonus[ellipsoid[i]].quat;
|
||||
shape = bonus[ellipsoid[i]].shape;
|
||||
quat = bonus[ellipsoid[i]].quat;
|
||||
|
||||
inertia[0] = INERTIA*rmass[i] * (shape[1]*shape[1]+shape[2]*shape[2]);
|
||||
inertia[1] = INERTIA*rmass[i] * (shape[0]*shape[0]+shape[2]*shape[2]);
|
||||
inertia[2] = INERTIA*rmass[i] * (shape[0]*shape[0]+shape[1]*shape[1]);
|
||||
inertia[0] = INERTIA*rmass[i] * (shape[1]*shape[1]+shape[2]*shape[2]);
|
||||
inertia[1] = INERTIA*rmass[i] * (shape[0]*shape[0]+shape[2]*shape[2]);
|
||||
inertia[2] = INERTIA*rmass[i] * (shape[0]*shape[0]+shape[1]*shape[1]);
|
||||
|
||||
// wbody = angular velocity in body frame
|
||||
|
||||
MathExtra::quat_to_mat(quat,rot);
|
||||
MathExtra::transpose_matvec(rot,angmom[i],wbody);
|
||||
wbody[0] /= inertia[0];
|
||||
wbody[1] /= inertia[1];
|
||||
wbody[2] /= inertia[2];
|
||||
|
||||
t += inertia[0]*wbody[0]*wbody[0] +
|
||||
inertia[1]*wbody[1]*wbody[1] + inertia[2]*wbody[2]*wbody[2];
|
||||
// wbody = angular velocity in body frame
|
||||
|
||||
MathExtra::quat_to_mat(quat,rot);
|
||||
MathExtra::transpose_matvec(rot,angmom[i],wbody);
|
||||
wbody[0] /= inertia[0];
|
||||
wbody[1] /= inertia[1];
|
||||
wbody[2] /= inertia[2];
|
||||
|
||||
t += inertia[0]*wbody[0]*wbody[0] +
|
||||
inertia[1]*wbody[1]*wbody[1] + inertia[2]*wbody[2]*wbody[2];
|
||||
}
|
||||
|
||||
} else {
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) {
|
||||
|
||||
// principal moments of inertia
|
||||
// principal moments of inertia
|
||||
|
||||
shape = bonus[ellipsoid[i]].shape;
|
||||
quat = bonus[ellipsoid[i]].quat;
|
||||
shape = bonus[ellipsoid[i]].shape;
|
||||
quat = bonus[ellipsoid[i]].quat;
|
||||
|
||||
inertia[0] = INERTIA*rmass[i] * (shape[1]*shape[1]+shape[2]*shape[2]);
|
||||
inertia[1] = INERTIA*rmass[i] * (shape[0]*shape[0]+shape[2]*shape[2]);
|
||||
inertia[2] = INERTIA*rmass[i] * (shape[0]*shape[0]+shape[1]*shape[1]);
|
||||
inertia[0] = INERTIA*rmass[i] * (shape[1]*shape[1]+shape[2]*shape[2]);
|
||||
inertia[1] = INERTIA*rmass[i] * (shape[0]*shape[0]+shape[2]*shape[2]);
|
||||
inertia[2] = INERTIA*rmass[i] * (shape[0]*shape[0]+shape[1]*shape[1]);
|
||||
|
||||
// wbody = angular velocity in body frame
|
||||
|
||||
MathExtra::quat_to_mat(quat,rot);
|
||||
MathExtra::transpose_matvec(rot,angmom[i],wbody);
|
||||
wbody[0] /= inertia[0];
|
||||
wbody[1] /= inertia[1];
|
||||
wbody[2] /= inertia[2];
|
||||
|
||||
t += inertia[0]*wbody[0]*wbody[0] +
|
||||
inertia[1]*wbody[1]*wbody[1] + inertia[2]*wbody[2]*wbody[2];
|
||||
// wbody = angular velocity in body frame
|
||||
|
||||
MathExtra::quat_to_mat(quat,rot);
|
||||
MathExtra::transpose_matvec(rot,angmom[i],wbody);
|
||||
wbody[0] /= inertia[0];
|
||||
wbody[1] /= inertia[1];
|
||||
wbody[2] /= inertia[2];
|
||||
|
||||
t += inertia[0]*wbody[0]*wbody[0] +
|
||||
inertia[1]*wbody[1]*wbody[1] + inertia[2]*wbody[2]*wbody[2];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -287,71 +287,71 @@ void ComputeTempAsphere::compute_vector()
|
|||
if (mode == ALL) {
|
||||
for (i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) {
|
||||
massone = rmass[i];
|
||||
t[0] += massone * v[i][0]*v[i][0];
|
||||
t[1] += massone * v[i][1]*v[i][1];
|
||||
t[2] += massone * v[i][2]*v[i][2];
|
||||
t[3] += massone * v[i][0]*v[i][1];
|
||||
t[4] += massone * v[i][0]*v[i][2];
|
||||
t[5] += massone * v[i][1]*v[i][2];
|
||||
|
||||
// principal moments of inertia
|
||||
massone = rmass[i];
|
||||
t[0] += massone * v[i][0]*v[i][0];
|
||||
t[1] += massone * v[i][1]*v[i][1];
|
||||
t[2] += massone * v[i][2]*v[i][2];
|
||||
t[3] += massone * v[i][0]*v[i][1];
|
||||
t[4] += massone * v[i][0]*v[i][2];
|
||||
t[5] += massone * v[i][1]*v[i][2];
|
||||
|
||||
shape = bonus[ellipsoid[i]].shape;
|
||||
quat = bonus[ellipsoid[i]].quat;
|
||||
// principal moments of inertia
|
||||
|
||||
inertia[0] = INERTIA*massone * (shape[1]*shape[1]+shape[2]*shape[2]);
|
||||
inertia[1] = INERTIA*massone * (shape[0]*shape[0]+shape[2]*shape[2]);
|
||||
inertia[2] = INERTIA*massone * (shape[0]*shape[0]+shape[1]*shape[1]);
|
||||
|
||||
// wbody = angular velocity in body frame
|
||||
|
||||
MathExtra::quat_to_mat(quat,rot);
|
||||
MathExtra::transpose_matvec(rot,angmom[i],wbody);
|
||||
wbody[0] /= inertia[0];
|
||||
wbody[1] /= inertia[1];
|
||||
wbody[2] /= inertia[2];
|
||||
|
||||
// rotational kinetic energy
|
||||
|
||||
t[0] += inertia[0]*wbody[0]*wbody[0];
|
||||
t[1] += inertia[1]*wbody[1]*wbody[1];
|
||||
t[2] += inertia[2]*wbody[2]*wbody[2];
|
||||
t[3] += inertia[0]*wbody[0]*wbody[1];
|
||||
t[4] += inertia[1]*wbody[0]*wbody[2];
|
||||
t[5] += inertia[2]*wbody[1]*wbody[2];
|
||||
shape = bonus[ellipsoid[i]].shape;
|
||||
quat = bonus[ellipsoid[i]].quat;
|
||||
|
||||
inertia[0] = INERTIA*massone * (shape[1]*shape[1]+shape[2]*shape[2]);
|
||||
inertia[1] = INERTIA*massone * (shape[0]*shape[0]+shape[2]*shape[2]);
|
||||
inertia[2] = INERTIA*massone * (shape[0]*shape[0]+shape[1]*shape[1]);
|
||||
|
||||
// wbody = angular velocity in body frame
|
||||
|
||||
MathExtra::quat_to_mat(quat,rot);
|
||||
MathExtra::transpose_matvec(rot,angmom[i],wbody);
|
||||
wbody[0] /= inertia[0];
|
||||
wbody[1] /= inertia[1];
|
||||
wbody[2] /= inertia[2];
|
||||
|
||||
// rotational kinetic energy
|
||||
|
||||
t[0] += inertia[0]*wbody[0]*wbody[0];
|
||||
t[1] += inertia[1]*wbody[1]*wbody[1];
|
||||
t[2] += inertia[2]*wbody[2]*wbody[2];
|
||||
t[3] += inertia[0]*wbody[0]*wbody[1];
|
||||
t[4] += inertia[1]*wbody[0]*wbody[2];
|
||||
t[5] += inertia[2]*wbody[1]*wbody[2];
|
||||
}
|
||||
|
||||
} else {
|
||||
for (i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) {
|
||||
|
||||
// principal moments of inertia
|
||||
|
||||
shape = bonus[ellipsoid[i]].shape;
|
||||
quat = bonus[ellipsoid[i]].quat;
|
||||
massone = rmass[i];
|
||||
// principal moments of inertia
|
||||
|
||||
inertia[0] = INERTIA*massone * (shape[1]*shape[1]+shape[2]*shape[2]);
|
||||
inertia[1] = INERTIA*massone * (shape[0]*shape[0]+shape[2]*shape[2]);
|
||||
inertia[2] = INERTIA*massone * (shape[0]*shape[0]+shape[1]*shape[1]);
|
||||
|
||||
// wbody = angular velocity in body frame
|
||||
|
||||
MathExtra::quat_to_mat(quat,rot);
|
||||
MathExtra::transpose_matvec(rot,angmom[i],wbody);
|
||||
wbody[0] /= inertia[0];
|
||||
wbody[1] /= inertia[1];
|
||||
wbody[2] /= inertia[2];
|
||||
|
||||
// rotational kinetic energy
|
||||
|
||||
t[0] += inertia[0]*wbody[0]*wbody[0];
|
||||
t[1] += inertia[1]*wbody[1]*wbody[1];
|
||||
t[2] += inertia[2]*wbody[2]*wbody[2];
|
||||
t[3] += inertia[0]*wbody[0]*wbody[1];
|
||||
t[4] += inertia[1]*wbody[0]*wbody[2];
|
||||
t[5] += inertia[2]*wbody[1]*wbody[2];
|
||||
shape = bonus[ellipsoid[i]].shape;
|
||||
quat = bonus[ellipsoid[i]].quat;
|
||||
massone = rmass[i];
|
||||
|
||||
inertia[0] = INERTIA*massone * (shape[1]*shape[1]+shape[2]*shape[2]);
|
||||
inertia[1] = INERTIA*massone * (shape[0]*shape[0]+shape[2]*shape[2]);
|
||||
inertia[2] = INERTIA*massone * (shape[0]*shape[0]+shape[1]*shape[1]);
|
||||
|
||||
// wbody = angular velocity in body frame
|
||||
|
||||
MathExtra::quat_to_mat(quat,rot);
|
||||
MathExtra::transpose_matvec(rot,angmom[i],wbody);
|
||||
wbody[0] /= inertia[0];
|
||||
wbody[1] /= inertia[1];
|
||||
wbody[2] /= inertia[2];
|
||||
|
||||
// rotational kinetic energy
|
||||
|
||||
t[0] += inertia[0]*wbody[0]*wbody[0];
|
||||
t[1] += inertia[1]*wbody[1]*wbody[1];
|
||||
t[2] += inertia[2]*wbody[2]*wbody[2];
|
||||
t[3] += inertia[0]*wbody[0]*wbody[1];
|
||||
t[4] += inertia[1]*wbody[0]*wbody[2];
|
||||
t[5] += inertia[2]*wbody[1]*wbody[2];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -35,7 +35,7 @@ FixNHAsphere::FixNHAsphere(LAMMPS *lmp, int narg, char **arg) :
|
|||
FixNH(lmp, narg, arg)
|
||||
{
|
||||
avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid");
|
||||
if (!avec)
|
||||
if (!avec)
|
||||
error->all(FLERR,"Compute nvt/nph/npt asphere requires atom style ellipsoid");
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ void FixNHAsphere::init()
|
|||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit)
|
||||
if (ellipsoid[i] < 0)
|
||||
error->one(FLERR,"Fix nvt/nph/npt asphere requires extended particles");
|
||||
error->one(FLERR,"Fix nvt/nph/npt asphere requires extended particles");
|
||||
|
||||
FixNH::init();
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ void FixNHAsphere::nve_v()
|
|||
|
||||
// update angular momentum by 1/2 step for all particles
|
||||
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) {
|
||||
angmom[i][0] += dtf*torque[i][0];
|
||||
angmom[i][1] += dtf*torque[i][1];
|
||||
|
@ -127,7 +127,7 @@ void FixNHAsphere::nve_x()
|
|||
inertia[0] = rmass[i] * (shape[1]*shape[1]+shape[2]*shape[2]) / 5.0;
|
||||
inertia[1] = rmass[i] * (shape[0]*shape[0]+shape[2]*shape[2]) / 5.0;
|
||||
inertia[2] = rmass[i] * (shape[0]*shape[0]+shape[1]*shape[1]) / 5.0;
|
||||
|
||||
|
||||
// compute omega at 1/2 step from angmom at 1/2 step and current q
|
||||
// update quaternion a full step via Richardson iteration
|
||||
// returns new normalized quaternion
|
||||
|
@ -152,7 +152,7 @@ void FixNHAsphere::nh_v_temp()
|
|||
int nlocal = atom->nlocal;
|
||||
if (igroup == atom->firstgroup) nlocal = atom->nfirst;
|
||||
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) {
|
||||
angmom[i][0] *= factor_eta;
|
||||
angmom[i][1] *= factor_eta;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -38,7 +38,7 @@ FixNPHAsphere::FixNPHAsphere(LAMMPS *lmp, int narg, char **arg) :
|
|||
id_temp = new char[n];
|
||||
strcpy(id_temp,id);
|
||||
strcat(id_temp,"_temp");
|
||||
|
||||
|
||||
char **newarg = new char*[3];
|
||||
newarg[0] = id_temp;
|
||||
newarg[1] = (char *) "all";
|
||||
|
@ -56,7 +56,7 @@ FixNPHAsphere::FixNPHAsphere(LAMMPS *lmp, int narg, char **arg) :
|
|||
id_press = new char[n];
|
||||
strcpy(id_press,id);
|
||||
strcat(id_press,"_press");
|
||||
|
||||
|
||||
newarg = new char*[4];
|
||||
newarg[0] = id_press;
|
||||
newarg[1] = (char *) "all";
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -38,7 +38,7 @@ FixNPTAsphere::FixNPTAsphere(LAMMPS *lmp, int narg, char **arg) :
|
|||
id_temp = new char[n];
|
||||
strcpy(id_temp,id);
|
||||
strcat(id_temp,"_temp");
|
||||
|
||||
|
||||
char **newarg = new char*[3];
|
||||
newarg[0] = id_temp;
|
||||
newarg[1] = (char *) "all";
|
||||
|
@ -56,7 +56,7 @@ FixNPTAsphere::FixNPTAsphere(LAMMPS *lmp, int narg, char **arg) :
|
|||
id_press = new char[n];
|
||||
strcpy(id_press,id);
|
||||
strcat(id_press,"_press");
|
||||
|
||||
|
||||
newarg = new char*[4];
|
||||
newarg[0] = id_press;
|
||||
newarg[1] = (char *) "all";
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -34,11 +34,11 @@ using namespace FixConst;
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixNVEAsphere::FixNVEAsphere(LAMMPS *lmp, int narg, char **arg) :
|
||||
FixNVEAsphere::FixNVEAsphere(LAMMPS *lmp, int narg, char **arg) :
|
||||
FixNVE(lmp, narg, arg)
|
||||
{
|
||||
avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid");
|
||||
if (!avec)
|
||||
if (!avec)
|
||||
error->all(FLERR,"Compute nve/asphere requires atom style ellipsoid");
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ void FixNVEAsphere::init()
|
|||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit)
|
||||
if (ellipsoid[i] < 0)
|
||||
error->one(FLERR,"Fix nve/asphere requires extended particles");
|
||||
error->one(FLERR,"Fix nve/asphere requires extended particles");
|
||||
|
||||
FixNVE::init();
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ void FixNVEAsphere::initial_integrate(int vflag)
|
|||
x[i][2] += dtv * v[i][2];
|
||||
|
||||
// update angular momentum by 1/2 step
|
||||
|
||||
|
||||
angmom[i][0] += dtf * torque[i][0];
|
||||
angmom[i][1] += dtf * torque[i][1];
|
||||
angmom[i][2] += dtf * torque[i][2];
|
||||
|
@ -140,7 +140,7 @@ void FixNVEAsphere::final_integrate()
|
|||
v[i][0] += dtfm * f[i][0];
|
||||
v[i][1] += dtfm * f[i][1];
|
||||
v[i][2] += dtfm * f[i][2];
|
||||
|
||||
|
||||
angmom[i][0] += dtf * torque[i][0];
|
||||
angmom[i][1] += dtf * torque[i][1];
|
||||
angmom[i][2] += dtf * torque[i][2];
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -38,7 +38,7 @@ FixNVEAsphereNoforce::FixNVEAsphereNoforce(LAMMPS *lmp, int narg, char **arg) :
|
|||
// error check
|
||||
|
||||
avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid");
|
||||
if (!atom->ellipsoid_flag)
|
||||
if (!atom->ellipsoid_flag)
|
||||
error->all(FLERR,"Fix nve/asphere/noforce requires atom style ellipsoid");
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ void FixNVEAsphereNoforce::init()
|
|||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit)
|
||||
if (ellipsoid[i] < 0)
|
||||
error->one(FLERR,"Fix nve/asphere/noforce requires extended particles");
|
||||
error->one(FLERR,"Fix nve/asphere/noforce requires extended particles");
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
@ -94,15 +94,15 @@ void FixNVEAsphereNoforce::initial_integrate(int vflag)
|
|||
|
||||
shape = bonus[ellipsoid[i]].shape;
|
||||
quat = bonus[ellipsoid[i]].quat;
|
||||
|
||||
|
||||
inertia[0] = rmass[i] * (shape[1]*shape[1]+shape[2]*shape[2]) / 5.0;
|
||||
inertia[1] = rmass[i] * (shape[0]*shape[0]+shape[2]*shape[2]) / 5.0;
|
||||
inertia[2] = rmass[i] * (shape[0]*shape[0]+shape[1]*shape[1]) / 5.0;
|
||||
|
||||
|
||||
// compute omega at 1/2 step from angmom at 1/2 step and current q
|
||||
// update quaternion a full step via Richardson iteration
|
||||
// returns new normalized quaternion
|
||||
|
||||
|
||||
MathExtra::mq_to_omega(angmom[i],quat,inertia,omega);
|
||||
MathExtra::richardson(quat,angmom[i],omega,inertia,dtq);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -29,7 +29,7 @@ class FixNVEAsphereNoforce : public FixNVENoforce {
|
|||
FixNVEAsphereNoforce(class LAMMPS *, int, char **);
|
||||
void initial_integrate(int);
|
||||
void init();
|
||||
|
||||
|
||||
private:
|
||||
double dtq;
|
||||
class AtomVecEllipsoid *avec;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -155,7 +155,7 @@ void FixNVELine::final_integrate()
|
|||
dtfm = dtf / rmass[i];
|
||||
v[i][0] += dtfm * f[i][0];
|
||||
v[i][1] += dtfm * f[i][1];
|
||||
|
||||
|
||||
length = bonus[line[i]].length;
|
||||
dtirotate = dtfrotate / (length*length*rmass[i]);
|
||||
omega[i][2] += dtirotate * torque[i][2];
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -109,7 +109,7 @@ void FixNVETri::initial_integrate(int vflag)
|
|||
x[i][2] += dtv * v[i][2];
|
||||
|
||||
// update angular momentum by 1/2 step
|
||||
|
||||
|
||||
angmom[i][0] += dtf * torque[i][0];
|
||||
angmom[i][1] += dtf * torque[i][1];
|
||||
angmom[i][2] += dtf * torque[i][2];
|
||||
|
@ -119,9 +119,9 @@ void FixNVETri::initial_integrate(int vflag)
|
|||
// returns new normalized quaternion
|
||||
|
||||
MathExtra::mq_to_omega(angmom[i],bonus[tri[i]].quat,
|
||||
bonus[tri[i]].inertia,omega);
|
||||
bonus[tri[i]].inertia,omega);
|
||||
MathExtra::richardson(bonus[tri[i]].quat,angmom[i],omega,
|
||||
bonus[tri[i]].inertia,dtq);
|
||||
bonus[tri[i]].inertia,dtq);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ void FixNVETri::final_integrate()
|
|||
v[i][0] += dtfm * f[i][0];
|
||||
v[i][1] += dtfm * f[i][1];
|
||||
v[i][2] += dtfm * f[i][2];
|
||||
|
||||
|
||||
angmom[i][0] += dtf * torque[i][0];
|
||||
angmom[i][1] += dtf * torque[i][1];
|
||||
angmom[i][2] += dtf * torque[i][2];
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -37,7 +37,7 @@ FixNVTAsphere::FixNVTAsphere(LAMMPS *lmp, int narg, char **arg) :
|
|||
id_temp = new char[n];
|
||||
strcpy(id_temp,id);
|
||||
strcat(id_temp,"_temp");
|
||||
|
||||
|
||||
char **newarg = new char*[3];
|
||||
newarg[0] = id_temp;
|
||||
newarg[1] = group->names[igroup];
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -99,7 +99,7 @@ void PairGayBerne::compute(int eflag, int vflag)
|
|||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
|
||||
|
||||
// loop over neighbors of my atoms
|
||||
|
||||
for (ii = 0; ii < inum; ii++) {
|
||||
|
@ -135,81 +135,81 @@ void PairGayBerne::compute(int eflag, int vflag)
|
|||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
|
||||
switch (form[itype][jtype]) {
|
||||
case SPHERE_SPHERE:
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
forcelj *= -r2inv;
|
||||
if (eflag) one_eng =
|
||||
r6inv*(r6inv*lj3[itype][jtype]-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
fforce[0] = r12[0]*forcelj;
|
||||
fforce[1] = r12[1]*forcelj;
|
||||
fforce[2] = r12[2]*forcelj;
|
||||
ttor[0] = ttor[1] = ttor[2] = 0.0;
|
||||
rtor[0] = rtor[1] = rtor[2] = 0.0;
|
||||
break;
|
||||
switch (form[itype][jtype]) {
|
||||
case SPHERE_SPHERE:
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
forcelj *= -r2inv;
|
||||
if (eflag) one_eng =
|
||||
r6inv*(r6inv*lj3[itype][jtype]-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
fforce[0] = r12[0]*forcelj;
|
||||
fforce[1] = r12[1]*forcelj;
|
||||
fforce[2] = r12[2]*forcelj;
|
||||
ttor[0] = ttor[1] = ttor[2] = 0.0;
|
||||
rtor[0] = rtor[1] = rtor[2] = 0.0;
|
||||
break;
|
||||
|
||||
case SPHERE_ELLIPSE:
|
||||
jquat = bonus[ellipsoid[j]].quat;
|
||||
MathExtra::quat_to_mat_trans(jquat,a2);
|
||||
MathExtra::diag_times3(well[jtype],a2,temp);
|
||||
MathExtra::transpose_times3(a2,temp,b2);
|
||||
MathExtra::diag_times3(shape2[jtype],a2,temp);
|
||||
MathExtra::transpose_times3(a2,temp,g2);
|
||||
one_eng = gayberne_lj(j,i,a2,b2,g2,r12,rsq,fforce,rtor);
|
||||
ttor[0] = ttor[1] = ttor[2] = 0.0;
|
||||
break;
|
||||
jquat = bonus[ellipsoid[j]].quat;
|
||||
MathExtra::quat_to_mat_trans(jquat,a2);
|
||||
MathExtra::diag_times3(well[jtype],a2,temp);
|
||||
MathExtra::transpose_times3(a2,temp,b2);
|
||||
MathExtra::diag_times3(shape2[jtype],a2,temp);
|
||||
MathExtra::transpose_times3(a2,temp,g2);
|
||||
one_eng = gayberne_lj(j,i,a2,b2,g2,r12,rsq,fforce,rtor);
|
||||
ttor[0] = ttor[1] = ttor[2] = 0.0;
|
||||
break;
|
||||
|
||||
case ELLIPSE_SPHERE:
|
||||
one_eng = gayberne_lj(i,j,a1,b1,g1,r12,rsq,fforce,ttor);
|
||||
rtor[0] = rtor[1] = rtor[2] = 0.0;
|
||||
break;
|
||||
one_eng = gayberne_lj(i,j,a1,b1,g1,r12,rsq,fforce,ttor);
|
||||
rtor[0] = rtor[1] = rtor[2] = 0.0;
|
||||
break;
|
||||
|
||||
default:
|
||||
jquat = bonus[ellipsoid[j]].quat;
|
||||
MathExtra::quat_to_mat_trans(jquat,a2);
|
||||
MathExtra::diag_times3(well[jtype],a2,temp);
|
||||
MathExtra::transpose_times3(a2,temp,b2);
|
||||
MathExtra::diag_times3(shape2[jtype],a2,temp);
|
||||
MathExtra::transpose_times3(a2,temp,g2);
|
||||
one_eng = gayberne_analytic(i,j,a1,a2,b1,b2,g1,g2,r12,rsq,
|
||||
fforce,ttor,rtor);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
jquat = bonus[ellipsoid[j]].quat;
|
||||
MathExtra::quat_to_mat_trans(jquat,a2);
|
||||
MathExtra::diag_times3(well[jtype],a2,temp);
|
||||
MathExtra::transpose_times3(a2,temp,b2);
|
||||
MathExtra::diag_times3(shape2[jtype],a2,temp);
|
||||
MathExtra::transpose_times3(a2,temp,g2);
|
||||
one_eng = gayberne_analytic(i,j,a1,a2,b1,b2,g1,g2,r12,rsq,
|
||||
fforce,ttor,rtor);
|
||||
break;
|
||||
}
|
||||
|
||||
fforce[0] *= factor_lj;
|
||||
fforce[1] *= factor_lj;
|
||||
fforce[2] *= factor_lj;
|
||||
fforce[1] *= factor_lj;
|
||||
fforce[2] *= factor_lj;
|
||||
ttor[0] *= factor_lj;
|
||||
ttor[1] *= factor_lj;
|
||||
ttor[2] *= factor_lj;
|
||||
ttor[1] *= factor_lj;
|
||||
ttor[2] *= factor_lj;
|
||||
|
||||
f[i][0] += fforce[0];
|
||||
f[i][1] += fforce[1];
|
||||
f[i][2] += fforce[2];
|
||||
f[i][1] += fforce[1];
|
||||
f[i][2] += fforce[2];
|
||||
tor[i][0] += ttor[0];
|
||||
tor[i][1] += ttor[1];
|
||||
tor[i][2] += ttor[2];
|
||||
tor[i][1] += ttor[1];
|
||||
tor[i][2] += ttor[2];
|
||||
|
||||
if (newton_pair || j < nlocal) {
|
||||
rtor[0] *= factor_lj;
|
||||
rtor[1] *= factor_lj;
|
||||
rtor[2] *= factor_lj;
|
||||
rtor[1] *= factor_lj;
|
||||
rtor[2] *= factor_lj;
|
||||
f[j][0] -= fforce[0];
|
||||
f[j][1] -= fforce[1];
|
||||
f[j][2] -= fforce[2];
|
||||
f[j][1] -= fforce[1];
|
||||
f[j][2] -= fforce[2];
|
||||
tor[j][0] += rtor[0];
|
||||
tor[j][1] += rtor[1];
|
||||
tor[j][2] += rtor[2];
|
||||
tor[j][1] += rtor[1];
|
||||
tor[j][2] += rtor[2];
|
||||
}
|
||||
|
||||
if (eflag) evdwl = factor_lj*one_eng;
|
||||
|
||||
if (evflag) ev_tally_xyz(i,j,nlocal,newton_pair,
|
||||
evdwl,0.0,fforce[0],fforce[1],fforce[2],
|
||||
-r12[0],-r12[1],-r12[2]);
|
||||
if (evflag) ev_tally_xyz(i,j,nlocal,newton_pair,
|
||||
evdwl,0.0,fforce[0],fforce[1],fforce[2],
|
||||
-r12[0],-r12[1],-r12[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -263,14 +263,14 @@ void PairGayBerne::settings(int narg, char **arg)
|
|||
upsilon = force->numeric(arg[1])/2.0;
|
||||
mu = force->numeric(arg[2]);
|
||||
cut_global = force->numeric(arg[3]);
|
||||
|
||||
|
||||
// reset cutoffs that have been explicitly set
|
||||
|
||||
if (allocated) {
|
||||
int i,j;
|
||||
for (i = 1; i <= atom->ntypes; i++)
|
||||
for (j = i+1; j <= atom->ntypes; j++)
|
||||
if (setflag[i][j]) cut[i][j] = cut_global;
|
||||
if (setflag[i][j]) cut[i][j] = cut_global;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@ void PairGayBerne::coeff(int narg, char **arg)
|
|||
double eja_one = force->numeric(arg[7]);
|
||||
double ejb_one = force->numeric(arg[8]);
|
||||
double ejc_one = force->numeric(arg[9]);
|
||||
|
||||
|
||||
double cut_one = cut_global;
|
||||
if (narg == 11) cut_one = force->numeric(arg[10]);
|
||||
|
||||
|
@ -307,18 +307,18 @@ void PairGayBerne::coeff(int narg, char **arg)
|
|||
sigma[i][j] = sigma_one;
|
||||
cut[i][j] = cut_one;
|
||||
if (eia_one != 0.0 || eib_one != 0.0 || eic_one != 0.0) {
|
||||
well[i][0] = pow(eia_one,-1.0/mu);
|
||||
well[i][0] = pow(eia_one,-1.0/mu);
|
||||
well[i][1] = pow(eib_one,-1.0/mu);
|
||||
well[i][2] = pow(eic_one,-1.0/mu);
|
||||
if (eia_one == eib_one && eib_one == eic_one) setwell[i] = 2;
|
||||
else setwell[i] = 1;
|
||||
well[i][2] = pow(eic_one,-1.0/mu);
|
||||
if (eia_one == eib_one && eib_one == eic_one) setwell[i] = 2;
|
||||
else setwell[i] = 1;
|
||||
}
|
||||
if (eja_one != 0.0 || ejb_one != 0.0 || ejc_one != 0.0) {
|
||||
well[j][0] = pow(eja_one,-1.0/mu);
|
||||
well[j][0] = pow(eja_one,-1.0/mu);
|
||||
well[j][1] = pow(ejb_one,-1.0/mu);
|
||||
well[j][2] = pow(ejc_one,-1.0/mu);
|
||||
if (eja_one == ejb_one && ejb_one == ejc_one) setwell[j] = 2;
|
||||
else setwell[j] = 1;
|
||||
well[j][2] = pow(ejc_one,-1.0/mu);
|
||||
if (eja_one == ejb_one && ejb_one == ejc_one) setwell[j] = 2;
|
||||
else setwell[j] = 1;
|
||||
}
|
||||
setflag[i][j] = 1;
|
||||
count++;
|
||||
|
@ -349,7 +349,7 @@ void PairGayBerne::init_style()
|
|||
shape2[i][0] = shape1[i][0]*shape1[i][0];
|
||||
shape2[i][1] = shape1[i][1]*shape1[i][1];
|
||||
shape2[i][2] = shape1[i][2]*shape1[i][2];
|
||||
lshape[i] = (shape1[i][0]*shape1[i][1]+shape1[i][2]*shape1[i][2]) *
|
||||
lshape[i] = (shape1[i][0]*shape1[i][1]+shape1[i][2]*shape1[i][2]) *
|
||||
sqrt(shape1[i][0]*shape1[i][1]);
|
||||
}
|
||||
}
|
||||
|
@ -365,41 +365,41 @@ double PairGayBerne::init_one(int i, int j)
|
|||
|
||||
if (setflag[i][j] == 0) {
|
||||
epsilon[i][j] = mix_energy(epsilon[i][i],epsilon[j][j],
|
||||
sigma[i][i],sigma[j][j]);
|
||||
sigma[i][i],sigma[j][j]);
|
||||
sigma[i][j] = mix_distance(sigma[i][i],sigma[j][j]);
|
||||
cut[i][j] = mix_distance(cut[i][i],cut[j][j]);
|
||||
}
|
||||
|
||||
|
||||
lj1[i][j] = 48.0 * epsilon[i][j] * pow(sigma[i][j],12.0);
|
||||
lj2[i][j] = 24.0 * epsilon[i][j] * pow(sigma[i][j],6.0);
|
||||
lj3[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j],12.0);
|
||||
lj4[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j],6.0);
|
||||
|
||||
|
||||
if (offset_flag) {
|
||||
double ratio = sigma[i][j] / cut[i][j];
|
||||
offset[i][j] = 4.0 * epsilon[i][j] * (pow(ratio,12.0) - pow(ratio,6.0));
|
||||
} else offset[i][j] = 0.0;
|
||||
|
||||
int ishape = 0;
|
||||
if (shape1[i][0] != shape1[i][1] ||
|
||||
shape1[i][0] != shape1[i][2] ||
|
||||
if (shape1[i][0] != shape1[i][1] ||
|
||||
shape1[i][0] != shape1[i][2] ||
|
||||
shape1[i][1] != shape1[i][2]) ishape = 1;
|
||||
if (setwell[i] == 1) ishape = 1;
|
||||
int jshape = 0;
|
||||
if (shape1[j][0] != shape1[j][1] ||
|
||||
shape1[j][0] != shape1[j][2] ||
|
||||
if (shape1[j][0] != shape1[j][1] ||
|
||||
shape1[j][0] != shape1[j][2] ||
|
||||
shape1[j][1] != shape1[j][2]) jshape = 1;
|
||||
if (setwell[j] == 1) jshape = 1;
|
||||
|
||||
|
||||
if (ishape == 0 && jshape == 0)
|
||||
form[i][i] = form[j][j] = form[i][j] = form[j][i] = SPHERE_SPHERE;
|
||||
else if (ishape == 0) {
|
||||
form[i][i] = SPHERE_SPHERE; form[j][j] = ELLIPSE_ELLIPSE;
|
||||
form[i][j] = SPHERE_ELLIPSE; form[j][i] = ELLIPSE_SPHERE;
|
||||
form[i][j] = SPHERE_ELLIPSE; form[j][i] = ELLIPSE_SPHERE;
|
||||
} else if (jshape == 0) {
|
||||
form[j][j] = SPHERE_SPHERE; form[i][i] = ELLIPSE_ELLIPSE;
|
||||
form[j][i] = SPHERE_ELLIPSE; form[i][j] = ELLIPSE_SPHERE;
|
||||
} else
|
||||
form[j][i] = SPHERE_ELLIPSE; form[i][j] = ELLIPSE_SPHERE;
|
||||
} else
|
||||
form[i][i] = form[j][j] = form[i][j] = form[j][i] = ELLIPSE_ELLIPSE;
|
||||
|
||||
epsilon[j][i] = epsilon[i][j];
|
||||
|
@ -696,9 +696,9 @@ double PairGayBerne::gayberne_analytic(const int i,const int j,double a1[3][3],
|
|||
------------------------------------------------------------------------- */
|
||||
|
||||
double PairGayBerne::gayberne_lj(const int i,const int j,double a1[3][3],
|
||||
double b1[3][3],double g1[3][3],
|
||||
double b1[3][3],double g1[3][3],
|
||||
double *r12,const double rsq,double *fforce,
|
||||
double *ttor)
|
||||
double *ttor)
|
||||
{
|
||||
double tempv[3], tempv2[3];
|
||||
double temp[3][3];
|
||||
|
@ -713,9 +713,9 @@ double PairGayBerne::gayberne_lj(const int i,const int j,double a1[3][3],
|
|||
// compute distance of closest approach
|
||||
|
||||
double g12[3][3];
|
||||
g12[0][0] = g1[0][0]+shape2[type[j]][0];
|
||||
g12[1][1] = g1[1][1]+shape2[type[j]][0];
|
||||
g12[2][2] = g1[2][2]+shape2[type[j]][0];
|
||||
g12[0][0] = g1[0][0]+shape2[type[j]][0];
|
||||
g12[1][1] = g1[1][1]+shape2[type[j]][0];
|
||||
g12[2][2] = g1[2][2]+shape2[type[j]][0];
|
||||
g12[0][1] = g1[0][1]; g12[1][0] = g1[1][0];
|
||||
g12[0][2] = g1[0][2]; g12[2][0] = g1[2][0];
|
||||
g12[1][2] = g1[1][2]; g12[2][1] = g1[2][1];
|
||||
|
@ -750,9 +750,9 @@ double PairGayBerne::gayberne_lj(const int i,const int j,double a1[3][3],
|
|||
|
||||
double b12[3][3];
|
||||
double iota[3];
|
||||
b12[0][0] = b1[0][0] + well[type[j]][0];
|
||||
b12[1][1] = b1[1][1] + well[type[j]][0];
|
||||
b12[2][2] = b1[2][2] + well[type[j]][0];
|
||||
b12[0][0] = b1[0][0] + well[type[j]][0];
|
||||
b12[1][1] = b1[1][1] + well[type[j]][0];
|
||||
b12[2][2] = b1[2][2] + well[type[j]][0];
|
||||
b12[0][1] = b1[0][1]; b12[1][0] = b1[1][0];
|
||||
b12[0][2] = b1[0][2]; b12[2][0] = b1[2][0];
|
||||
b12[1][2] = b1[1][2]; b12[2][1] = b1[2][1];
|
||||
|
@ -853,58 +853,58 @@ void PairGayBerne::compute_eta_torque(double m[3][3], double m2[3][3],
|
|||
double den = m[1][0]*m[0][2]*m[2][1]-m[0][0]*m[1][2]*m[2][1]-
|
||||
m[0][2]*m[2][0]*m[1][1]+m[0][1]*m[2][0]*m[1][2]-
|
||||
m[1][0]*m[0][1]*m[2][2]+m[0][0]*m[1][1]*m[2][2];
|
||||
|
||||
|
||||
ans[0][0] = s[0]*(m[1][2]*m[0][1]*m2[0][2]+2.0*m[1][1]*m[2][2]*m2[0][0]-
|
||||
m[1][1]*m2[0][2]*m[0][2]-2.0*m[1][2]*m2[0][0]*m[2][1]+
|
||||
m2[0][1]*m[0][2]*m[2][1]-m2[0][1]*m[0][1]*m[2][2]-
|
||||
m[1][0]*m[2][2]*m2[0][1]+m[2][0]*m[1][2]*m2[0][1]+
|
||||
m[1][0]*m2[0][2]*m[2][1]-m2[0][2]*m[2][0]*m[1][1])/den;
|
||||
|
||||
m[1][1]*m2[0][2]*m[0][2]-2.0*m[1][2]*m2[0][0]*m[2][1]+
|
||||
m2[0][1]*m[0][2]*m[2][1]-m2[0][1]*m[0][1]*m[2][2]-
|
||||
m[1][0]*m[2][2]*m2[0][1]+m[2][0]*m[1][2]*m2[0][1]+
|
||||
m[1][0]*m2[0][2]*m[2][1]-m2[0][2]*m[2][0]*m[1][1])/den;
|
||||
|
||||
ans[0][1] = s[0]*(m[0][2]*m2[0][0]*m[2][1]-m[2][2]*m2[0][0]*m[0][1]+
|
||||
2.0*m[0][0]*m[2][2]*m2[0][1]-m[0][0]*m2[0][2]*m[1][2]-
|
||||
2.0*m[2][0]*m[0][2]*m2[0][1]+m2[0][2]*m[1][0]*m[0][2]-
|
||||
m[2][2]*m[1][0]*m2[0][0]+m[2][0]*m2[0][0]*m[1][2]+
|
||||
m[2][0]*m2[0][2]*m[0][1]-m2[0][2]*m[0][0]*m[2][1])/den;
|
||||
|
||||
2.0*m[0][0]*m[2][2]*m2[0][1]-m[0][0]*m2[0][2]*m[1][2]-
|
||||
2.0*m[2][0]*m[0][2]*m2[0][1]+m2[0][2]*m[1][0]*m[0][2]-
|
||||
m[2][2]*m[1][0]*m2[0][0]+m[2][0]*m2[0][0]*m[1][2]+
|
||||
m[2][0]*m2[0][2]*m[0][1]-m2[0][2]*m[0][0]*m[2][1])/den;
|
||||
|
||||
ans[0][2] = s[0]*(m[0][1]*m[1][2]*m2[0][0]-m[0][2]*m2[0][0]*m[1][1]-
|
||||
m[0][0]*m[1][2]*m2[0][1]+m[1][0]*m[0][2]*m2[0][1]-
|
||||
m2[0][1]*m[0][0]*m[2][1]-m[2][0]*m[1][1]*m2[0][0]+
|
||||
2.0*m[1][1]*m[0][0]*m2[0][2]-2.0*m[1][0]*m2[0][2]*m[0][1]+
|
||||
m[1][0]*m[2][1]*m2[0][0]+m[2][0]*m2[0][1]*m[0][1])/den;
|
||||
|
||||
m[0][0]*m[1][2]*m2[0][1]+m[1][0]*m[0][2]*m2[0][1]-
|
||||
m2[0][1]*m[0][0]*m[2][1]-m[2][0]*m[1][1]*m2[0][0]+
|
||||
2.0*m[1][1]*m[0][0]*m2[0][2]-2.0*m[1][0]*m2[0][2]*m[0][1]+
|
||||
m[1][0]*m[2][1]*m2[0][0]+m[2][0]*m2[0][1]*m[0][1])/den;
|
||||
|
||||
ans[1][0] = s[1]*(-m[1][1]*m2[1][2]*m[0][2]+2.0*m[1][1]*m[2][2]*m2[1][0]+
|
||||
m[1][2]*m[0][1]*m2[1][2]-2.0*m[1][2]*m2[1][0]*m[2][1]+
|
||||
m2[1][1]*m[0][2]*m[2][1]-m2[1][1]*m[0][1]*m[2][2]-
|
||||
m[1][0]*m[2][2]*m2[1][1]+m[2][0]*m[1][2]*m2[1][1]-
|
||||
m2[1][2]*m[2][0]*m[1][1]+m[1][0]*m2[1][2]*m[2][1])/den;
|
||||
|
||||
m[1][2]*m[0][1]*m2[1][2]-2.0*m[1][2]*m2[1][0]*m[2][1]+
|
||||
m2[1][1]*m[0][2]*m[2][1]-m2[1][1]*m[0][1]*m[2][2]-
|
||||
m[1][0]*m[2][2]*m2[1][1]+m[2][0]*m[1][2]*m2[1][1]-
|
||||
m2[1][2]*m[2][0]*m[1][1]+m[1][0]*m2[1][2]*m[2][1])/den;
|
||||
|
||||
ans[1][1] = s[1]*(m[0][2]*m2[1][0]*m[2][1]-m[0][1]*m[2][2]*m2[1][0]+
|
||||
2.0*m[2][2]*m[0][0]*m2[1][1]-m2[1][2]*m[0][0]*m[1][2]-
|
||||
2.0*m[2][0]*m2[1][1]*m[0][2]-m[1][0]*m[2][2]*m2[1][0]+
|
||||
m[2][0]*m[1][2]*m2[1][0]+m[1][0]*m2[1][2]*m[0][2]-
|
||||
m[0][0]*m2[1][2]*m[2][1]+m2[1][2]*m[0][1]*m[2][0])/den;
|
||||
|
||||
2.0*m[2][2]*m[0][0]*m2[1][1]-m2[1][2]*m[0][0]*m[1][2]-
|
||||
2.0*m[2][0]*m2[1][1]*m[0][2]-m[1][0]*m[2][2]*m2[1][0]+
|
||||
m[2][0]*m[1][2]*m2[1][0]+m[1][0]*m2[1][2]*m[0][2]-
|
||||
m[0][0]*m2[1][2]*m[2][1]+m2[1][2]*m[0][1]*m[2][0])/den;
|
||||
|
||||
ans[1][2] = s[1]*(m[0][1]*m[1][2]*m2[1][0]-m[0][2]*m2[1][0]*m[1][1]-
|
||||
m[0][0]*m[1][2]*m2[1][1]+m[1][0]*m[0][2]*m2[1][1]+
|
||||
2.0*m[1][1]*m[0][0]*m2[1][2]-m[0][0]*m2[1][1]*m[2][1]+
|
||||
m[0][1]*m[2][0]*m2[1][1]-m2[1][0]*m[2][0]*m[1][1]-
|
||||
2.0*m[1][0]*m[0][1]*m2[1][2]+m[1][0]*m2[1][0]*m[2][1])/den;
|
||||
|
||||
m[0][0]*m[1][2]*m2[1][1]+m[1][0]*m[0][2]*m2[1][1]+
|
||||
2.0*m[1][1]*m[0][0]*m2[1][2]-m[0][0]*m2[1][1]*m[2][1]+
|
||||
m[0][1]*m[2][0]*m2[1][1]-m2[1][0]*m[2][0]*m[1][1]-
|
||||
2.0*m[1][0]*m[0][1]*m2[1][2]+m[1][0]*m2[1][0]*m[2][1])/den;
|
||||
|
||||
ans[2][0] = s[2]*(-m[1][1]*m[0][2]*m2[2][2]+m[0][1]*m[1][2]*m2[2][2]+
|
||||
2.0*m[1][1]*m2[2][0]*m[2][2]-m[0][1]*m2[2][1]*m[2][2]+
|
||||
m[0][2]*m[2][1]*m2[2][1]-2.0*m2[2][0]*m[2][1]*m[1][2]-
|
||||
m[1][0]*m2[2][1]*m[2][2]+m[1][2]*m[2][0]*m2[2][1]-
|
||||
m[1][1]*m[2][0]*m2[2][2]+m[2][1]*m[1][0]*m2[2][2])/den;
|
||||
|
||||
2.0*m[1][1]*m2[2][0]*m[2][2]-m[0][1]*m2[2][1]*m[2][2]+
|
||||
m[0][2]*m[2][1]*m2[2][1]-2.0*m2[2][0]*m[2][1]*m[1][2]-
|
||||
m[1][0]*m2[2][1]*m[2][2]+m[1][2]*m[2][0]*m2[2][1]-
|
||||
m[1][1]*m[2][0]*m2[2][2]+m[2][1]*m[1][0]*m2[2][2])/den;
|
||||
|
||||
ans[2][1] = s[2]*-(m[0][1]*m[2][2]*m2[2][0]-m[0][2]*m2[2][0]*m[2][1]-
|
||||
2.0*m2[2][1]*m[0][0]*m[2][2]+m[1][2]*m2[2][2]*m[0][0]+
|
||||
2.0*m2[2][1]*m[0][2]*m[2][0]+m[1][0]*m2[2][0]*m[2][2]-
|
||||
m[1][0]*m[0][2]*m2[2][2]-m[1][2]*m[2][0]*m2[2][0]+
|
||||
m[0][0]*m2[2][2]*m[2][1]-m2[2][2]*m[0][1]*m[2][0])/den;
|
||||
|
||||
2.0*m2[2][1]*m[0][0]*m[2][2]+m[1][2]*m2[2][2]*m[0][0]+
|
||||
2.0*m2[2][1]*m[0][2]*m[2][0]+m[1][0]*m2[2][0]*m[2][2]-
|
||||
m[1][0]*m[0][2]*m2[2][2]-m[1][2]*m[2][0]*m2[2][0]+
|
||||
m[0][0]*m2[2][2]*m[2][1]-m2[2][2]*m[0][1]*m[2][0])/den;
|
||||
|
||||
ans[2][2] = s[2]*(m[0][1]*m[1][2]*m2[2][0]-m[0][2]*m2[2][0]*m[1][1]-
|
||||
m[0][0]*m[1][2]*m2[2][1]+m[1][0]*m[0][2]*m2[2][1]-
|
||||
m[1][1]*m[2][0]*m2[2][0]-m[2][1]*m2[2][1]*m[0][0]+
|
||||
2.0*m[1][1]*m2[2][2]*m[0][0]+m[2][1]*m[1][0]*m2[2][0]+
|
||||
m[2][0]*m[0][1]*m2[2][1]-2.0*m2[2][2]*m[1][0]*m[0][1])/den;
|
||||
m[0][0]*m[1][2]*m2[2][1]+m[1][0]*m[0][2]*m2[2][1]-
|
||||
m[1][1]*m[2][0]*m2[2][0]-m[2][1]*m2[2][1]*m[0][0]+
|
||||
2.0*m[1][1]*m2[2][2]*m[0][0]+m[2][1]*m[1][0]*m2[2][0]+
|
||||
m[2][0]*m[0][1]*m2[2][1]-2.0*m2[2][2]*m[1][0]*m[0][1])/den;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -60,12 +60,12 @@ class PairGayBerne : public Pair {
|
|||
void allocate();
|
||||
double gayberne_analytic(const int i, const int j, double a1[3][3],
|
||||
double a2[3][3], double b1[3][3], double b2[3][3],
|
||||
double g1[3][3], double g2[3][3], double *r12,
|
||||
const double rsq, double *fforce, double *ttor,
|
||||
double g1[3][3], double g2[3][3], double *r12,
|
||||
const double rsq, double *fforce, double *ttor,
|
||||
double *rtor);
|
||||
double gayberne_lj(const int i, const int j, double a1[3][3],
|
||||
double b1[3][3],double g1[3][3],double *r12,
|
||||
const double rsq, double *fforce, double *ttor);
|
||||
double b1[3][3],double g1[3][3],double *r12,
|
||||
const double rsq, double *fforce, double *ttor);
|
||||
void compute_eta_torque(double m[3][3], double m2[3][3],
|
||||
double *s, double ans[3][3]);
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -88,12 +88,12 @@ void PairLineLJ::compute(int eflag, int vflag)
|
|||
int nlocal = atom->nlocal;
|
||||
int nall = nlocal + atom->nghost;
|
||||
int newton_pair = force->newton_pair;
|
||||
|
||||
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
|
||||
|
||||
// grow discrete list if necessary and initialize
|
||||
|
||||
if (nall > nmax) {
|
||||
|
@ -116,7 +116,7 @@ void PairLineLJ::compute(int eflag, int vflag)
|
|||
itype = type[i];
|
||||
jlist = firstneigh[i];
|
||||
jnum = numneigh[i];
|
||||
|
||||
|
||||
for (jj = 0; jj < jnum; jj++) {
|
||||
j = jlist[jj];
|
||||
j &= NEIGHMASK;
|
||||
|
@ -126,179 +126,179 @@ void PairLineLJ::compute(int eflag, int vflag)
|
|||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
jtype = type[j];
|
||||
|
||||
|
||||
if (rsq >= cutsq[itype][jtype]) continue;
|
||||
|
||||
|
||||
// line/line interactions = NxN particles
|
||||
|
||||
|
||||
evdwl = 0.0;
|
||||
if (line[i] >= 0 && line[j] >= 0) {
|
||||
if (dnum[i] == 0) discretize(i,sigma[itype][itype]);
|
||||
npi = dnum[i];
|
||||
ifirst = dfirst[i];
|
||||
if (dnum[j] == 0) discretize(j,sigma[jtype][jtype]);
|
||||
npj = dnum[j];
|
||||
jfirst = dfirst[j];
|
||||
if (dnum[i] == 0) discretize(i,sigma[itype][itype]);
|
||||
npi = dnum[i];
|
||||
ifirst = dfirst[i];
|
||||
if (dnum[j] == 0) discretize(j,sigma[jtype][jtype]);
|
||||
npj = dnum[j];
|
||||
jfirst = dfirst[j];
|
||||
|
||||
for (ni = 0; ni < npi; ni++) {
|
||||
dxi = discrete[ifirst+ni].dx;
|
||||
dyi = discrete[ifirst+ni].dy;
|
||||
for (ni = 0; ni < npi; ni++) {
|
||||
dxi = discrete[ifirst+ni].dx;
|
||||
dyi = discrete[ifirst+ni].dy;
|
||||
|
||||
for (nj = 0; nj < npj; nj++) {
|
||||
dxj = discrete[jfirst+nj].dx;
|
||||
dyj = discrete[jfirst+nj].dy;
|
||||
for (nj = 0; nj < npj; nj++) {
|
||||
dxj = discrete[jfirst+nj].dx;
|
||||
dyj = discrete[jfirst+nj].dy;
|
||||
|
||||
xi[0] = x[i][0] + dxi;
|
||||
xi[1] = x[i][1] + dyi;
|
||||
xj[0] = x[j][0] + dxj;
|
||||
xj[1] = x[j][1] + dyj;
|
||||
xi[0] = x[i][0] + dxi;
|
||||
xi[1] = x[i][1] + dyi;
|
||||
xj[0] = x[j][0] + dxj;
|
||||
xj[1] = x[j][1] + dyj;
|
||||
|
||||
delx = xi[0] - xj[0];
|
||||
dely = xi[1] - xj[1];
|
||||
rsq = delx*delx + dely*dely;
|
||||
delx = xi[0] - xj[0];
|
||||
dely = xi[1] - xj[1];
|
||||
rsq = delx*delx + dely*dely;
|
||||
|
||||
sig = 0.5 * (discrete[ifirst+ni].sigma+discrete[jfirst+nj].sigma);
|
||||
sig3 = sig*sig*sig;
|
||||
term2 = 24.0*epsilon[itype][jtype] * sig3*sig3;
|
||||
term1 = 2.0 * term2 * sig3*sig3;
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (term1*r6inv - term2);
|
||||
fpair = forcelj*r2inv;
|
||||
sig = 0.5 * (discrete[ifirst+ni].sigma+discrete[jfirst+nj].sigma);
|
||||
sig3 = sig*sig*sig;
|
||||
term2 = 24.0*epsilon[itype][jtype] * sig3*sig3;
|
||||
term1 = 2.0 * term2 * sig3*sig3;
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (term1*r6inv - term2);
|
||||
fpair = forcelj*r2inv;
|
||||
|
||||
if (eflag) evdwl += r6inv*(term1/12.0*r6inv-term2/6.0);
|
||||
if (eflag) evdwl += r6inv*(term1/12.0*r6inv-term2/6.0);
|
||||
|
||||
fi[0] = delx*fpair;
|
||||
fi[1] = dely*fpair;
|
||||
f[i][0] += fi[0];
|
||||
f[i][1] += fi[1];
|
||||
torque[i][2] += dxi*fi[1] - dyi*fi[0];
|
||||
fi[0] = delx*fpair;
|
||||
fi[1] = dely*fpair;
|
||||
f[i][0] += fi[0];
|
||||
f[i][1] += fi[1];
|
||||
torque[i][2] += dxi*fi[1] - dyi*fi[0];
|
||||
|
||||
if (newton_pair || j < nlocal) {
|
||||
fj[0] = -delx*fpair;
|
||||
fj[1] = -dely*fpair;
|
||||
f[j][0] += fj[0];
|
||||
f[j][1] += fj[1];
|
||||
torque[j][2] += dxj*fj[1] - dyj*fj[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (newton_pair || j < nlocal) {
|
||||
fj[0] = -delx*fpair;
|
||||
fj[1] = -dely*fpair;
|
||||
f[j][0] += fj[0];
|
||||
f[j][1] += fj[1];
|
||||
torque[j][2] += dxj*fj[1] - dyj*fj[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// line/particle interaction = Nx1 particles
|
||||
// convert line into Np particles based on sigma and line length
|
||||
|
||||
} else if (line[i] >= 0) {
|
||||
if (dnum[i] == 0) discretize(i,sigma[itype][itype]);
|
||||
npi = dnum[i];
|
||||
ifirst = dfirst[i];
|
||||
if (dnum[i] == 0) discretize(i,sigma[itype][itype]);
|
||||
npi = dnum[i];
|
||||
ifirst = dfirst[i];
|
||||
|
||||
for (ni = 0; ni < npi; ni++) {
|
||||
dxi = discrete[ifirst+ni].dx;
|
||||
dyi = discrete[ifirst+ni].dy;
|
||||
for (ni = 0; ni < npi; ni++) {
|
||||
dxi = discrete[ifirst+ni].dx;
|
||||
dyi = discrete[ifirst+ni].dy;
|
||||
|
||||
xi[0] = x[i][0] + dxi;
|
||||
xi[1] = x[i][1] + dyi;
|
||||
xj[0] = x[j][0];
|
||||
xj[1] = x[j][1];
|
||||
xi[0] = x[i][0] + dxi;
|
||||
xi[1] = x[i][1] + dyi;
|
||||
xj[0] = x[j][0];
|
||||
xj[1] = x[j][1];
|
||||
|
||||
delx = xi[0] - xj[0];
|
||||
dely = xi[1] - xj[1];
|
||||
rsq = delx*delx + dely*dely;
|
||||
delx = xi[0] - xj[0];
|
||||
dely = xi[1] - xj[1];
|
||||
rsq = delx*delx + dely*dely;
|
||||
|
||||
sig = 0.5 * (discrete[ifirst+ni].sigma+sigma[jtype][jtype]);
|
||||
sig3 = sig*sig*sig;
|
||||
term2 = 24.0*epsilon[itype][jtype] * sig3*sig3;
|
||||
term1 = 2.0 * term2 * sig3*sig3;
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (term1*r6inv - term2);
|
||||
fpair = forcelj*r2inv;
|
||||
|
||||
if (eflag) evdwl += r6inv*(term1/12.0*r6inv-term2/6.0);
|
||||
sig = 0.5 * (discrete[ifirst+ni].sigma+sigma[jtype][jtype]);
|
||||
sig3 = sig*sig*sig;
|
||||
term2 = 24.0*epsilon[itype][jtype] * sig3*sig3;
|
||||
term1 = 2.0 * term2 * sig3*sig3;
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (term1*r6inv - term2);
|
||||
fpair = forcelj*r2inv;
|
||||
|
||||
fi[0] = delx*fpair;
|
||||
fi[1] = dely*fpair;
|
||||
f[i][0] += fi[0];
|
||||
f[i][1] += fi[1];
|
||||
torque[i][2] += dxi*fi[1] - dyi*fi[0];
|
||||
|
||||
if (newton_pair || j < nlocal) {
|
||||
fj[0] = -delx*fpair;
|
||||
fj[1] = -dely*fpair;
|
||||
f[j][0] += fj[0];
|
||||
f[j][1] += fj[1];
|
||||
}
|
||||
}
|
||||
if (eflag) evdwl += r6inv*(term1/12.0*r6inv-term2/6.0);
|
||||
|
||||
fi[0] = delx*fpair;
|
||||
fi[1] = dely*fpair;
|
||||
f[i][0] += fi[0];
|
||||
f[i][1] += fi[1];
|
||||
torque[i][2] += dxi*fi[1] - dyi*fi[0];
|
||||
|
||||
if (newton_pair || j < nlocal) {
|
||||
fj[0] = -delx*fpair;
|
||||
fj[1] = -dely*fpair;
|
||||
f[j][0] += fj[0];
|
||||
f[j][1] += fj[1];
|
||||
}
|
||||
}
|
||||
|
||||
// particle/line interaction = Nx1 particles
|
||||
// convert line into Np particles based on sigma and line length
|
||||
|
||||
} else if (line[j] >= 0) {
|
||||
if (dnum[j] == 0) discretize(j,sigma[jtype][jtype]);
|
||||
npj = dnum[j];
|
||||
jfirst = dfirst[j];
|
||||
if (dnum[j] == 0) discretize(j,sigma[jtype][jtype]);
|
||||
npj = dnum[j];
|
||||
jfirst = dfirst[j];
|
||||
|
||||
for (nj = 0; nj < npj; nj++) {
|
||||
dxj = discrete[jfirst+nj].dx;
|
||||
dyj = discrete[jfirst+nj].dy;
|
||||
for (nj = 0; nj < npj; nj++) {
|
||||
dxj = discrete[jfirst+nj].dx;
|
||||
dyj = discrete[jfirst+nj].dy;
|
||||
|
||||
xi[0] = x[i][0];
|
||||
xi[1] = x[i][1];
|
||||
xj[0] = x[j][0] + dxj;
|
||||
xj[1] = x[j][1] + dyj;
|
||||
xi[0] = x[i][0];
|
||||
xi[1] = x[i][1];
|
||||
xj[0] = x[j][0] + dxj;
|
||||
xj[1] = x[j][1] + dyj;
|
||||
|
||||
delx = xi[0] - xj[0];
|
||||
dely = xi[1] - xj[1];
|
||||
rsq = delx*delx + dely*dely;
|
||||
delx = xi[0] - xj[0];
|
||||
dely = xi[1] - xj[1];
|
||||
rsq = delx*delx + dely*dely;
|
||||
|
||||
sig = 0.5 * (sigma[itype][itype]+discrete[jfirst+nj].sigma);
|
||||
sig3 = sig*sig*sig;
|
||||
term2 = 24.0*epsilon[itype][jtype] * sig3*sig3;
|
||||
term1 = 2.0 * term2 * sig3*sig3;
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (term1*r6inv - term2);
|
||||
fpair = forcelj*r2inv;
|
||||
|
||||
if (eflag) evdwl += r6inv*(term1/12.0*r6inv-term2/6.0);
|
||||
sig = 0.5 * (sigma[itype][itype]+discrete[jfirst+nj].sigma);
|
||||
sig3 = sig*sig*sig;
|
||||
term2 = 24.0*epsilon[itype][jtype] * sig3*sig3;
|
||||
term1 = 2.0 * term2 * sig3*sig3;
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (term1*r6inv - term2);
|
||||
fpair = forcelj*r2inv;
|
||||
|
||||
if (eflag) evdwl += r6inv*(term1/12.0*r6inv-term2/6.0);
|
||||
|
||||
fi[0] = delx*fpair;
|
||||
fi[1] = dely*fpair;
|
||||
f[i][0] += fi[0];
|
||||
f[i][1] += fi[1];
|
||||
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] += fj[0];
|
||||
f[j][1] += fj[1];
|
||||
fj[0] = -delx*fpair;
|
||||
fj[1] = -dely*fpair;
|
||||
torque[j][2] += dxj*fj[1] - dyj*fj[0];
|
||||
}
|
||||
}
|
||||
|
||||
fi[0] = delx*fpair;
|
||||
fi[1] = dely*fpair;
|
||||
f[i][0] += fi[0];
|
||||
f[i][1] += fi[1];
|
||||
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] += fj[0];
|
||||
f[j][1] += fj[1];
|
||||
fj[0] = -delx*fpair;
|
||||
fj[1] = -dely*fpair;
|
||||
torque[j][2] += dxj*fj[1] - dyj*fj[0];
|
||||
}
|
||||
}
|
||||
|
||||
// particle/particle interaction = 1x1 particles
|
||||
|
||||
} else {
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
fpair = forcelj*r2inv;
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
fpair = forcelj*r2inv;
|
||||
|
||||
if (eflag)
|
||||
evdwl += r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]);
|
||||
if (eflag)
|
||||
evdwl += r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]);
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
}
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
}
|
||||
}
|
||||
|
||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
||||
evdwl,0.0,fpair,delx,dely,delz);
|
||||
evdwl,0.0,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -306,7 +306,7 @@ void PairLineLJ::compute(int eflag, int vflag)
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
allocate all arrays
|
||||
allocate all arrays
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLineLJ::allocate()
|
||||
|
@ -331,7 +331,7 @@ void PairLineLJ::allocate()
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
global settings
|
||||
global settings
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLineLJ::settings(int narg, char **arg)
|
||||
|
@ -346,7 +346,7 @@ void PairLineLJ::settings(int narg, char **arg)
|
|||
int i,j;
|
||||
for (i = 1; i <= atom->ntypes; i++)
|
||||
for (j = i+1; j <= atom->ntypes; j++)
|
||||
if (setflag[i][j]) cut[i][j] = cut_global;
|
||||
if (setflag[i][j]) cut[i][j] = cut_global;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -356,7 +356,7 @@ void PairLineLJ::settings(int narg, char **arg)
|
|||
|
||||
void PairLineLJ::coeff(int narg, char **arg)
|
||||
{
|
||||
if (narg < 4 || narg > 5)
|
||||
if (narg < 4 || narg > 5)
|
||||
error->all(FLERR,"Incorrect args for pair coefficients");
|
||||
if (!allocated) allocate();
|
||||
|
||||
|
@ -392,7 +392,7 @@ double PairLineLJ::init_one(int i, int j)
|
|||
{
|
||||
if (setflag[i][j] == 0) {
|
||||
epsilon[i][j] = mix_energy(epsilon[i][i],epsilon[j][j],
|
||||
sigma[i][i],sigma[j][j]);
|
||||
sigma[i][i],sigma[j][j]);
|
||||
sigma[i][j] = mix_distance(sigma[i][i],sigma[j][j]);
|
||||
cut[i][j] = mix_distance(cut[i][i],cut[j][j]);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -35,8 +35,8 @@ using namespace LAMMPS_NS;
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairRESquared::PairRESquared(LAMMPS *lmp) : Pair(lmp),
|
||||
b_alpha(45.0/56.0),
|
||||
PairRESquared::PairRESquared(LAMMPS *lmp) : Pair(lmp),
|
||||
b_alpha(45.0/56.0),
|
||||
cr60(pow(60.0,1.0/3.0))
|
||||
{
|
||||
avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid");
|
||||
|
@ -103,7 +103,7 @@ void PairRESquared::compute(int eflag, int vflag)
|
|||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
|
||||
|
||||
// loop over neighbors of my atoms
|
||||
|
||||
for (ii = 0; ii < inum; ii++) {
|
||||
|
@ -133,7 +133,7 @@ void PairRESquared::compute(int eflag, int vflag)
|
|||
// compute if less than cutoff
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
fforce[0] = fforce[1] = fforce[2] = 0.0;
|
||||
fforce[0] = fforce[1] = fforce[2] = 0.0;
|
||||
|
||||
switch (form[itype][jtype]) {
|
||||
|
||||
|
@ -197,9 +197,9 @@ void PairRESquared::compute(int eflag, int vflag)
|
|||
|
||||
if (eflag) evdwl = factor_lj*one_eng;
|
||||
|
||||
if (evflag) ev_tally_xyz(i,j,nlocal,newton_pair,
|
||||
evdwl,0.0,fforce[0],fforce[1],fforce[2],
|
||||
-r12[0],-r12[1],-r12[2]);
|
||||
if (evflag) ev_tally_xyz(i,j,nlocal,newton_pair,
|
||||
evdwl,0.0,fforce[0],fforce[1],fforce[2],
|
||||
-r12[0],-r12[1],-r12[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ void PairRESquared::settings(int narg, char **arg)
|
|||
if (narg != 1) error->all(FLERR,"Illegal pair_style command");
|
||||
|
||||
cut_global = force->numeric(arg[0]);
|
||||
|
||||
|
||||
// reset cutoffs that have been explicitly set
|
||||
|
||||
if (allocated) {
|
||||
|
@ -283,7 +283,7 @@ void PairRESquared::coeff(int narg, char **arg)
|
|||
double eja_one = force->numeric(arg[7]);
|
||||
double ejb_one = force->numeric(arg[8]);
|
||||
double ejc_one = force->numeric(arg[9]);
|
||||
|
||||
|
||||
double cut_one = cut_global;
|
||||
if (narg == 11) cut_one = force->numeric(arg[10]);
|
||||
|
||||
|
@ -348,12 +348,12 @@ double PairRESquared::init_one(int i, int j)
|
|||
error->all(FLERR,"Pair resquared epsilon a,b,c coeffs are not all set");
|
||||
|
||||
int ishape = 0;
|
||||
if (shape1[i][0] != 0.0 && shape1[i][1] != 0.0 && shape1[i][2] != 0.0)
|
||||
if (shape1[i][0] != 0.0 && shape1[i][1] != 0.0 && shape1[i][2] != 0.0)
|
||||
ishape = 1;
|
||||
int jshape = 0;
|
||||
if (shape1[j][0] != 0.0 && shape1[j][1] != 0.0 && shape1[j][2] != 0.0)
|
||||
if (shape1[j][0] != 0.0 && shape1[j][1] != 0.0 && shape1[j][2] != 0.0)
|
||||
jshape = 1;
|
||||
|
||||
|
||||
if (ishape == 0 && jshape == 0) {
|
||||
form[i][j] = SPHERE_SPHERE;
|
||||
form[j][i] = SPHERE_SPHERE;
|
||||
|
@ -384,12 +384,12 @@ double PairRESquared::init_one(int i, int j)
|
|||
sigma[i][j] = sigma[j][i];
|
||||
cut[i][j] = cut[j][i];
|
||||
}
|
||||
|
||||
|
||||
lj1[i][j] = 48.0 * epsilon[i][j] * pow(sigma[i][j],12.0);
|
||||
lj2[i][j] = 24.0 * epsilon[i][j] * pow(sigma[i][j],6.0);
|
||||
lj3[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j],12.0);
|
||||
lj4[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j],6.0);
|
||||
|
||||
|
||||
if (offset_flag) {
|
||||
double ratio = sigma[i][j] / cut[i][j];
|
||||
offset[i][j] = 4.0 * epsilon[i][j] * (pow(ratio,12.0) - pow(ratio,6.0));
|
||||
|
@ -513,7 +513,7 @@ void PairRESquared::precompute_i(const int i,RE2Vars &ws)
|
|||
MathExtra::plus3(ws.lAsa[i],ws.lAtwo[i],ws.lAsa[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
Compute the derivative of the determinant of m, using m and the
|
||||
derivative of m (m2)
|
||||
|
@ -545,7 +545,7 @@ double PairRESquared::resquared_analytic(const int i, const int j,
|
|||
double *rtor)
|
||||
{
|
||||
int *type = atom->type;
|
||||
|
||||
|
||||
// pair computations for energy, force, torque
|
||||
|
||||
double z1[3],z2[3]; // A1*rhat # don't need to store
|
||||
|
@ -568,7 +568,7 @@ double PairRESquared::resquared_analytic(const int i, const int j,
|
|||
double sigh; // sigma/h12
|
||||
double tprod; // eta*chi*sigh
|
||||
double Ua,Ur; // attractive/repulsive parts of potential
|
||||
|
||||
|
||||
// pair computations for force, torque
|
||||
|
||||
double sec; // sigma*eta*chi
|
||||
|
@ -593,7 +593,7 @@ double PairRESquared::resquared_analytic(const int i, const int j,
|
|||
double ddH; // derivative of det(H12)
|
||||
double deta,dchi,dh12; // derivatives of eta,chi,h12
|
||||
double dUr,dUa; // derivatives of Ua,Ur
|
||||
|
||||
|
||||
// pair computations for torque
|
||||
|
||||
double fwae[3]; // -fourw'*aTe
|
||||
|
@ -715,7 +715,7 @@ double PairRESquared::resquared_analytic(const int i, const int j,
|
|||
hsec = h12+3.0*sec;
|
||||
dspu = 1.0/h12-1.0/hsec+stemp;
|
||||
pbsu = 3.0*sigma[type[i]][type[j]]/hsec;
|
||||
|
||||
|
||||
stemp = 1.0/(shape1[type[i]][0]*cr60+h12)+
|
||||
1.0/(shape1[type[i]][1]*cr60+h12)+
|
||||
1.0/(shape1[type[i]][2]*cr60+h12)+
|
||||
|
@ -725,7 +725,7 @@ double PairRESquared::resquared_analytic(const int i, const int j,
|
|||
hsec = h12+b_alpha*sec;
|
||||
dspr = 7.0/h12-1.0/hsec+stemp;
|
||||
pbsr = b_alpha*sigma[type[i]][type[j]]/hsec;
|
||||
|
||||
|
||||
for (int i=0; i<3; i++) {
|
||||
u[0] = -rhat[i]*rhat[0];
|
||||
u[1] = -rhat[i]*rhat[1];
|
||||
|
@ -757,7 +757,7 @@ double PairRESquared::resquared_analytic(const int i, const int j,
|
|||
dUr = pbsr*(eta*dchi+deta*chi)-dh12*dspr;
|
||||
fforce[i]=dUr*Ur+dUa*Ua;
|
||||
}
|
||||
|
||||
|
||||
// torque on i
|
||||
|
||||
MathExtra::vecmat(fourw,wi.aTe,fwae);
|
||||
|
@ -787,7 +787,7 @@ double PairRESquared::resquared_analytic(const int i, const int j,
|
|||
dUr = pbsr*(eta*dchi + deta*chi)-dh12*dspr;
|
||||
ttor[i] = -(dUa*Ua+dUr*Ur);
|
||||
}
|
||||
|
||||
|
||||
// torque on j
|
||||
|
||||
if (!(force->newton_pair || j < atom->nlocal))
|
||||
|
@ -829,12 +829,12 @@ double PairRESquared::resquared_analytic(const int i, const int j,
|
|||
------------------------------------------------------------------------- */
|
||||
|
||||
double PairRESquared::resquared_lj(const int i, const int j,
|
||||
const RE2Vars &wi, const double *r,
|
||||
const double rsq, double *fforce,
|
||||
const RE2Vars &wi, const double *r,
|
||||
const double rsq, double *fforce,
|
||||
double *ttor, bool calc_torque)
|
||||
{
|
||||
int *type = atom->type;
|
||||
|
||||
|
||||
// pair computations for energy, force, torque
|
||||
|
||||
double rnorm; // L2 norm of r
|
||||
|
@ -847,7 +847,7 @@ double PairRESquared::resquared_lj(const int i, const int j,
|
|||
double sigh; // sigma/h12
|
||||
double tprod; // chi*sigh
|
||||
double Ua,Ur; // attractive/repulsive parts of potential
|
||||
|
||||
|
||||
// pair computations for force, torque
|
||||
|
||||
double sec; // sigma*chi
|
||||
|
@ -863,7 +863,7 @@ double PairRESquared::resquared_lj(const int i, const int j,
|
|||
double dchi,dh12; // derivatives of chi,h12
|
||||
double dUr,dUa; // derivatives of Ua,Ur
|
||||
double h12p3; // h12^3
|
||||
|
||||
|
||||
// pair computations for torque
|
||||
|
||||
double fwae[3]; // -fourw'*aTe
|
||||
|
@ -943,7 +943,7 @@ double PairRESquared::resquared_lj(const int i, const int j,
|
|||
hsec = h12+3.0*sec;
|
||||
dspu = 1.0/h12-1.0/hsec+stemp;
|
||||
pbsu = 3.0*sigma[type[i]][type[j]]/hsec;
|
||||
|
||||
|
||||
stemp = 1.0/(shape1[type[i]][0]*cr60+h12)+
|
||||
1.0/(shape1[type[i]][1]*cr60+h12)+
|
||||
1.0/(shape1[type[i]][2]*cr60+h12)+
|
||||
|
@ -951,7 +951,7 @@ double PairRESquared::resquared_lj(const int i, const int j,
|
|||
hsec = h12+b_alpha*sec;
|
||||
dspr = 7.0/h12-1.0/hsec+stemp;
|
||||
pbsr = b_alpha*sigma[type[i]][type[j]]/hsec;
|
||||
|
||||
|
||||
for (int i=0; i<3; i++) {
|
||||
u[0] = -rhat[i]*rhat[0];
|
||||
u[1] = -rhat[i]*rhat[1];
|
||||
|
@ -966,7 +966,7 @@ double PairRESquared::resquared_lj(const int i, const int j,
|
|||
dUr = pbsr*dchi-dh12*dspr;
|
||||
fforce[i]=dUr*Ur+dUa*Ua;
|
||||
}
|
||||
|
||||
|
||||
// torque on i
|
||||
|
||||
if (calc_torque) {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -64,7 +64,7 @@ class PairRESquared : public Pair {
|
|||
double A[3][3]; // Rotation matrix (lab->body)
|
||||
double aTe[3][3]; // A'*E
|
||||
double gamma[3][3]; // A'*S^2*A
|
||||
|
||||
|
||||
// per particle precomputations for torque
|
||||
|
||||
double sa[3][3]; // S^2*A;
|
||||
|
@ -72,7 +72,7 @@ class PairRESquared : public Pair {
|
|||
double lAtwo[3][3][3]; // A'*S^2*lA
|
||||
double lAsa[3][3][3]; // lAtwo+lA'*sa
|
||||
};
|
||||
|
||||
|
||||
void allocate();
|
||||
|
||||
void precompute_i(const int i,RE2Vars &ws);
|
||||
|
@ -82,8 +82,8 @@ class PairRESquared : public Pair {
|
|||
const double *r, const double rsq,
|
||||
double *fforce, double *ttor,
|
||||
double *rtor);
|
||||
double resquared_lj(const int i, const int j, const RE2Vars &wi,
|
||||
const double *r, const double rsq, double *fforce,
|
||||
double resquared_lj(const int i, const int j, const RE2Vars &wi,
|
||||
const double *r, const double rsq, double *fforce,
|
||||
double *ttor, bool calc_torque);
|
||||
|
||||
double cr60; // 60^1/3
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -92,12 +92,12 @@ void PairTriLJ::compute(int eflag, int vflag)
|
|||
int nlocal = atom->nlocal;
|
||||
int nall = nlocal + atom->nghost;
|
||||
int newton_pair = force->newton_pair;
|
||||
|
||||
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
|
||||
|
||||
// grow discrete list if necessary and initialize
|
||||
|
||||
if (nall > nmax) {
|
||||
|
@ -130,259 +130,259 @@ void PairTriLJ::compute(int eflag, int vflag)
|
|||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
jtype = type[j];
|
||||
|
||||
|
||||
if (rsq >= cutsq[itype][jtype]) continue;
|
||||
|
||||
|
||||
// tri/tri interactions = NxN particles
|
||||
// c1,c2,c3 = corner pts of triangle I or J
|
||||
|
||||
|
||||
evdwl = 0.0;
|
||||
if (tri[i] >= 0 && tri[j] >= 0) {
|
||||
if (dnum[i] == 0) {
|
||||
MathExtra::quat_to_mat(bonus[tri[i]].quat,p);
|
||||
MathExtra::matvec(p,bonus[tri[i]].c1,dc1);
|
||||
MathExtra::matvec(p,bonus[tri[i]].c2,dc2);
|
||||
MathExtra::matvec(p,bonus[tri[i]].c3,dc3);
|
||||
dfirst[i] = ndiscrete;
|
||||
discretize(i,sigma[itype][itype],dc1,dc2,dc3);
|
||||
dnum[i] = ndiscrete - dfirst[i];
|
||||
}
|
||||
npi = dnum[i];
|
||||
ifirst = dfirst[i];
|
||||
if (dnum[i] == 0) {
|
||||
MathExtra::quat_to_mat(bonus[tri[i]].quat,p);
|
||||
MathExtra::matvec(p,bonus[tri[i]].c1,dc1);
|
||||
MathExtra::matvec(p,bonus[tri[i]].c2,dc2);
|
||||
MathExtra::matvec(p,bonus[tri[i]].c3,dc3);
|
||||
dfirst[i] = ndiscrete;
|
||||
discretize(i,sigma[itype][itype],dc1,dc2,dc3);
|
||||
dnum[i] = ndiscrete - dfirst[i];
|
||||
}
|
||||
npi = dnum[i];
|
||||
ifirst = dfirst[i];
|
||||
|
||||
if (dnum[j] == 0) {
|
||||
MathExtra::quat_to_mat(bonus[tri[j]].quat,p);
|
||||
MathExtra::matvec(p,bonus[tri[j]].c1,dc1);
|
||||
MathExtra::matvec(p,bonus[tri[j]].c2,dc2);
|
||||
MathExtra::matvec(p,bonus[tri[j]].c3,dc3);
|
||||
dfirst[j] = ndiscrete;
|
||||
discretize(j,sigma[jtype][jtype],dc1,dc2,dc3);
|
||||
dnum[j] = ndiscrete - dfirst[j];
|
||||
}
|
||||
npj = dnum[j];
|
||||
jfirst = dfirst[j];
|
||||
if (dnum[j] == 0) {
|
||||
MathExtra::quat_to_mat(bonus[tri[j]].quat,p);
|
||||
MathExtra::matvec(p,bonus[tri[j]].c1,dc1);
|
||||
MathExtra::matvec(p,bonus[tri[j]].c2,dc2);
|
||||
MathExtra::matvec(p,bonus[tri[j]].c3,dc3);
|
||||
dfirst[j] = ndiscrete;
|
||||
discretize(j,sigma[jtype][jtype],dc1,dc2,dc3);
|
||||
dnum[j] = ndiscrete - dfirst[j];
|
||||
}
|
||||
npj = dnum[j];
|
||||
jfirst = dfirst[j];
|
||||
|
||||
for (ni = 0; ni < npi; ni++) {
|
||||
dxi = discrete[ifirst+ni].dx;
|
||||
dyi = discrete[ifirst+ni].dy;
|
||||
dzi = discrete[ifirst+ni].dz;
|
||||
for (ni = 0; ni < npi; ni++) {
|
||||
dxi = discrete[ifirst+ni].dx;
|
||||
dyi = discrete[ifirst+ni].dy;
|
||||
dzi = discrete[ifirst+ni].dz;
|
||||
|
||||
for (nj = 0; nj < npj; nj++) {
|
||||
dxj = discrete[jfirst+nj].dx;
|
||||
dyj = discrete[jfirst+nj].dy;
|
||||
dzj = discrete[jfirst+nj].dz;
|
||||
for (nj = 0; nj < npj; nj++) {
|
||||
dxj = discrete[jfirst+nj].dx;
|
||||
dyj = discrete[jfirst+nj].dy;
|
||||
dzj = discrete[jfirst+nj].dz;
|
||||
|
||||
xi[0] = x[i][0] + dxi;
|
||||
xi[1] = x[i][1] + dyi;
|
||||
xi[2] = x[i][2] + dzi;
|
||||
xj[0] = x[j][0] + dxj;
|
||||
xj[1] = x[j][1] + dyj;
|
||||
xj[2] = x[j][2] + dzj;
|
||||
xi[0] = x[i][0] + dxi;
|
||||
xi[1] = x[i][1] + dyi;
|
||||
xi[2] = x[i][2] + dzi;
|
||||
xj[0] = x[j][0] + dxj;
|
||||
xj[1] = x[j][1] + dyj;
|
||||
xj[2] = x[j][2] + dzj;
|
||||
|
||||
delx = xi[0] - xj[0];
|
||||
dely = xi[1] - xj[1];
|
||||
delz = xi[2] - xj[2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
|
||||
sig = 0.5 * (discrete[ifirst+ni].sigma+discrete[jfirst+nj].sigma);
|
||||
sig3 = sig*sig*sig;
|
||||
term2 = 24.0*epsilon[itype][jtype] * sig3*sig3;
|
||||
term1 = 2.0 * term2 * sig3*sig3;
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (term1*r6inv - term2);
|
||||
fpair = forcelj*r2inv;
|
||||
|
||||
if (eflag) evdwl += r6inv*(term1/12.0*r6inv-term2/6.0);
|
||||
delx = xi[0] - xj[0];
|
||||
dely = xi[1] - xj[1];
|
||||
delz = xi[2] - xj[2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
|
||||
fi[0] = delx*fpair;
|
||||
fi[1] = dely*fpair;
|
||||
fi[2] = delz*fpair;
|
||||
f[i][0] += fi[0];
|
||||
f[i][1] += fi[1];
|
||||
f[i][2] += fi[2];
|
||||
ti[0] = dyi*fi[2] - dzi*fi[1];
|
||||
ti[1] = dzi*fi[0] - dxi*fi[2];
|
||||
ti[2] = dxi*fi[1] - dyi*fi[0];
|
||||
torque[i][0] += ti[0];
|
||||
torque[i][1] += ti[1];
|
||||
torque[i][2] += ti[2];
|
||||
sig = 0.5 * (discrete[ifirst+ni].sigma+discrete[jfirst+nj].sigma);
|
||||
sig3 = sig*sig*sig;
|
||||
term2 = 24.0*epsilon[itype][jtype] * sig3*sig3;
|
||||
term1 = 2.0 * term2 * sig3*sig3;
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (term1*r6inv - term2);
|
||||
fpair = forcelj*r2inv;
|
||||
|
||||
if (newton_pair || j < nlocal) {
|
||||
fj[0] = -delx*fpair;
|
||||
fj[1] = -dely*fpair;
|
||||
fj[2] = -delz*fpair;
|
||||
f[j][0] += fj[0];
|
||||
f[j][1] += fj[1];
|
||||
f[j][2] += fj[2];
|
||||
tj[0] = dyj*fj[2] - dzj*fj[1];
|
||||
tj[1] = dzj*fj[0] - dxj*fj[2];
|
||||
tj[2] = dxj*fj[1] - dyj*fj[0];
|
||||
torque[j][0] += tj[0];
|
||||
torque[j][1] += tj[1];
|
||||
torque[j][2] += tj[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (eflag) evdwl += r6inv*(term1/12.0*r6inv-term2/6.0);
|
||||
|
||||
fi[0] = delx*fpair;
|
||||
fi[1] = dely*fpair;
|
||||
fi[2] = delz*fpair;
|
||||
f[i][0] += fi[0];
|
||||
f[i][1] += fi[1];
|
||||
f[i][2] += fi[2];
|
||||
ti[0] = dyi*fi[2] - dzi*fi[1];
|
||||
ti[1] = dzi*fi[0] - dxi*fi[2];
|
||||
ti[2] = dxi*fi[1] - dyi*fi[0];
|
||||
torque[i][0] += ti[0];
|
||||
torque[i][1] += ti[1];
|
||||
torque[i][2] += ti[2];
|
||||
|
||||
if (newton_pair || j < nlocal) {
|
||||
fj[0] = -delx*fpair;
|
||||
fj[1] = -dely*fpair;
|
||||
fj[2] = -delz*fpair;
|
||||
f[j][0] += fj[0];
|
||||
f[j][1] += fj[1];
|
||||
f[j][2] += fj[2];
|
||||
tj[0] = dyj*fj[2] - dzj*fj[1];
|
||||
tj[1] = dzj*fj[0] - dxj*fj[2];
|
||||
tj[2] = dxj*fj[1] - dyj*fj[0];
|
||||
torque[j][0] += tj[0];
|
||||
torque[j][1] += tj[1];
|
||||
torque[j][2] += tj[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// tri/particle interaction = Nx1 particles
|
||||
// c1,c2,c3 = corner pts of triangle I
|
||||
|
||||
} else if (tri[i] >= 0) {
|
||||
|
||||
if (dnum[i] == 0) {
|
||||
MathExtra::quat_to_mat(bonus[tri[i]].quat,p);
|
||||
MathExtra::matvec(p,bonus[tri[i]].c1,dc1);
|
||||
MathExtra::matvec(p,bonus[tri[i]].c2,dc2);
|
||||
MathExtra::matvec(p,bonus[tri[i]].c3,dc3);
|
||||
dfirst[i] = ndiscrete;
|
||||
discretize(i,sigma[itype][itype],dc1,dc2,dc3);
|
||||
dnum[i] = ndiscrete - dfirst[i];
|
||||
}
|
||||
npi = dnum[i];
|
||||
ifirst = dfirst[i];
|
||||
if (dnum[i] == 0) {
|
||||
MathExtra::quat_to_mat(bonus[tri[i]].quat,p);
|
||||
MathExtra::matvec(p,bonus[tri[i]].c1,dc1);
|
||||
MathExtra::matvec(p,bonus[tri[i]].c2,dc2);
|
||||
MathExtra::matvec(p,bonus[tri[i]].c3,dc3);
|
||||
dfirst[i] = ndiscrete;
|
||||
discretize(i,sigma[itype][itype],dc1,dc2,dc3);
|
||||
dnum[i] = ndiscrete - dfirst[i];
|
||||
}
|
||||
npi = dnum[i];
|
||||
ifirst = dfirst[i];
|
||||
|
||||
for (ni = 0; ni < npi; ni++) {
|
||||
dxi = discrete[ifirst+ni].dx;
|
||||
dyi = discrete[ifirst+ni].dy;
|
||||
dzi = discrete[ifirst+ni].dz;
|
||||
for (ni = 0; ni < npi; ni++) {
|
||||
dxi = discrete[ifirst+ni].dx;
|
||||
dyi = discrete[ifirst+ni].dy;
|
||||
dzi = discrete[ifirst+ni].dz;
|
||||
|
||||
xi[0] = x[i][0] + dxi;
|
||||
xi[1] = x[i][1] + dyi;
|
||||
xi[2] = x[i][2] + dzi;
|
||||
xj[0] = x[j][0];
|
||||
xj[1] = x[j][1];
|
||||
xj[2] = x[j][2];
|
||||
xi[0] = x[i][0] + dxi;
|
||||
xi[1] = x[i][1] + dyi;
|
||||
xi[2] = x[i][2] + dzi;
|
||||
xj[0] = x[j][0];
|
||||
xj[1] = x[j][1];
|
||||
xj[2] = x[j][2];
|
||||
|
||||
delx = xi[0] - xj[0];
|
||||
dely = xi[1] - xj[1];
|
||||
delz = xi[2] - xj[2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
delx = xi[0] - xj[0];
|
||||
dely = xi[1] - xj[1];
|
||||
delz = xi[2] - xj[2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
|
||||
sig = 0.5 * (discrete[ifirst+ni].sigma+sigma[jtype][jtype]);
|
||||
sig3 = sig*sig*sig;
|
||||
term2 = 24.0*epsilon[itype][jtype] * sig3*sig3;
|
||||
term1 = 2.0 * term2 * sig3*sig3;
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (term1*r6inv - term2);
|
||||
fpair = forcelj*r2inv;
|
||||
|
||||
if (eflag) evdwl += r6inv*(term1/12.0*r6inv-term2/6.0);
|
||||
sig = 0.5 * (discrete[ifirst+ni].sigma+sigma[jtype][jtype]);
|
||||
sig3 = sig*sig*sig;
|
||||
term2 = 24.0*epsilon[itype][jtype] * sig3*sig3;
|
||||
term1 = 2.0 * term2 * sig3*sig3;
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (term1*r6inv - term2);
|
||||
fpair = forcelj*r2inv;
|
||||
|
||||
fi[0] = delx*fpair;
|
||||
fi[1] = dely*fpair;
|
||||
fi[2] = delz*fpair;
|
||||
f[i][0] += fi[0];
|
||||
f[i][1] += fi[1];
|
||||
f[i][2] += fi[2];
|
||||
ti[0] = dyi*fi[2] - dzi*fi[1];
|
||||
ti[1] = dzi*fi[0] - dxi*fi[2];
|
||||
ti[2] = dxi*fi[1] - dyi*fi[0];
|
||||
torque[i][2] += ti[0];
|
||||
torque[i][1] += ti[1];
|
||||
torque[i][2] += ti[2];
|
||||
|
||||
if (newton_pair || j < nlocal) {
|
||||
fj[0] = -delx*fpair;
|
||||
fj[1] = -dely*fpair;
|
||||
fj[2] = -delz*fpair;
|
||||
f[j][0] += fj[0];
|
||||
f[j][1] += fj[1];
|
||||
f[j][2] += fj[2];
|
||||
}
|
||||
}
|
||||
if (eflag) evdwl += r6inv*(term1/12.0*r6inv-term2/6.0);
|
||||
|
||||
fi[0] = delx*fpair;
|
||||
fi[1] = dely*fpair;
|
||||
fi[2] = delz*fpair;
|
||||
f[i][0] += fi[0];
|
||||
f[i][1] += fi[1];
|
||||
f[i][2] += fi[2];
|
||||
ti[0] = dyi*fi[2] - dzi*fi[1];
|
||||
ti[1] = dzi*fi[0] - dxi*fi[2];
|
||||
ti[2] = dxi*fi[1] - dyi*fi[0];
|
||||
torque[i][2] += ti[0];
|
||||
torque[i][1] += ti[1];
|
||||
torque[i][2] += ti[2];
|
||||
|
||||
if (newton_pair || j < nlocal) {
|
||||
fj[0] = -delx*fpair;
|
||||
fj[1] = -dely*fpair;
|
||||
fj[2] = -delz*fpair;
|
||||
f[j][0] += fj[0];
|
||||
f[j][1] += fj[1];
|
||||
f[j][2] += fj[2];
|
||||
}
|
||||
}
|
||||
|
||||
// particle/tri interaction = Nx1 particles
|
||||
// c1,c2,c3 = corner pts of triangle J
|
||||
|
||||
} else if (tri[j] >= 0) {
|
||||
if (dnum[j] == 0) {
|
||||
MathExtra::quat_to_mat(bonus[tri[j]].quat,p);
|
||||
MathExtra::matvec(p,bonus[tri[j]].c1,dc1);
|
||||
MathExtra::matvec(p,bonus[tri[j]].c2,dc2);
|
||||
MathExtra::matvec(p,bonus[tri[j]].c3,dc3);
|
||||
dfirst[j] = ndiscrete;
|
||||
discretize(j,sigma[jtype][jtype],dc1,dc2,dc3);
|
||||
dnum[j] = ndiscrete - dfirst[j];
|
||||
}
|
||||
npj = dnum[j];
|
||||
jfirst = dfirst[j];
|
||||
if (dnum[j] == 0) {
|
||||
MathExtra::quat_to_mat(bonus[tri[j]].quat,p);
|
||||
MathExtra::matvec(p,bonus[tri[j]].c1,dc1);
|
||||
MathExtra::matvec(p,bonus[tri[j]].c2,dc2);
|
||||
MathExtra::matvec(p,bonus[tri[j]].c3,dc3);
|
||||
dfirst[j] = ndiscrete;
|
||||
discretize(j,sigma[jtype][jtype],dc1,dc2,dc3);
|
||||
dnum[j] = ndiscrete - dfirst[j];
|
||||
}
|
||||
npj = dnum[j];
|
||||
jfirst = dfirst[j];
|
||||
|
||||
for (nj = 0; nj < npj; nj++) {
|
||||
dxj = discrete[jfirst+nj].dx;
|
||||
dyj = discrete[jfirst+nj].dy;
|
||||
dzj = discrete[jfirst+nj].dz;
|
||||
for (nj = 0; nj < npj; nj++) {
|
||||
dxj = discrete[jfirst+nj].dx;
|
||||
dyj = discrete[jfirst+nj].dy;
|
||||
dzj = discrete[jfirst+nj].dz;
|
||||
|
||||
xi[0] = x[i][0];
|
||||
xi[1] = x[i][1];
|
||||
xi[2] = x[i][2];
|
||||
xj[0] = x[j][0] + dxj;
|
||||
xj[1] = x[j][1] + dyj;
|
||||
xj[2] = x[j][2] + dzj;
|
||||
xi[0] = x[i][0];
|
||||
xi[1] = x[i][1];
|
||||
xi[2] = x[i][2];
|
||||
xj[0] = x[j][0] + dxj;
|
||||
xj[1] = x[j][1] + dyj;
|
||||
xj[2] = x[j][2] + dzj;
|
||||
|
||||
delx = xi[0] - xj[0];
|
||||
dely = xi[1] - xj[1];
|
||||
delz = xi[2] - xj[2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
delx = xi[0] - xj[0];
|
||||
dely = xi[1] - xj[1];
|
||||
delz = xi[2] - xj[2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
|
||||
sig = 0.5 * (sigma[itype][itype]+discrete[jfirst+nj].sigma);
|
||||
sig3 = sig*sig*sig;
|
||||
term2 = 24.0*epsilon[itype][jtype] * sig3*sig3;
|
||||
term1 = 2.0 * term2 * sig3*sig3;
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (term1*r6inv - term2);
|
||||
fpair = forcelj*r2inv;
|
||||
|
||||
if (eflag) evdwl += r6inv*(term1/12.0*r6inv-term2/6.0);
|
||||
sig = 0.5 * (sigma[itype][itype]+discrete[jfirst+nj].sigma);
|
||||
sig3 = sig*sig*sig;
|
||||
term2 = 24.0*epsilon[itype][jtype] * sig3*sig3;
|
||||
term1 = 2.0 * term2 * sig3*sig3;
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (term1*r6inv - term2);
|
||||
fpair = forcelj*r2inv;
|
||||
|
||||
fi[0] = delx*fpair;
|
||||
fi[1] = dely*fpair;
|
||||
fi[2] = delz*fpair;
|
||||
f[i][0] += fi[0];
|
||||
f[i][1] += fi[1];
|
||||
f[i][2] += fi[2];
|
||||
|
||||
if (newton_pair || j < nlocal) {
|
||||
fj[0] = -delx*fpair;
|
||||
fj[1] = -dely*fpair;
|
||||
fj[2] = -delz*fpair;
|
||||
f[j][0] += fj[0];
|
||||
f[j][1] += fj[1];
|
||||
f[j][2] += fj[2];
|
||||
tj[0] = dyj*fj[2] - dzj*fj[1];
|
||||
tj[1] = dzj*fj[0] - dxj*fj[2];
|
||||
tj[2] = dxj*fj[1] - dyj*fj[0];
|
||||
torque[j][0] += tj[0];
|
||||
torque[j][1] += tj[1];
|
||||
torque[j][2] += tj[2];
|
||||
}
|
||||
}
|
||||
if (eflag) evdwl += r6inv*(term1/12.0*r6inv-term2/6.0);
|
||||
|
||||
fi[0] = delx*fpair;
|
||||
fi[1] = dely*fpair;
|
||||
fi[2] = delz*fpair;
|
||||
f[i][0] += fi[0];
|
||||
f[i][1] += fi[1];
|
||||
f[i][2] += fi[2];
|
||||
|
||||
if (newton_pair || j < nlocal) {
|
||||
fj[0] = -delx*fpair;
|
||||
fj[1] = -dely*fpair;
|
||||
fj[2] = -delz*fpair;
|
||||
f[j][0] += fj[0];
|
||||
f[j][1] += fj[1];
|
||||
f[j][2] += fj[2];
|
||||
tj[0] = dyj*fj[2] - dzj*fj[1];
|
||||
tj[1] = dzj*fj[0] - dxj*fj[2];
|
||||
tj[2] = dxj*fj[1] - dyj*fj[0];
|
||||
torque[j][0] += tj[0];
|
||||
torque[j][1] += tj[1];
|
||||
torque[j][2] += tj[2];
|
||||
}
|
||||
}
|
||||
|
||||
// particle/particle interaction = 1x1 particles
|
||||
|
||||
} else {
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
fpair = forcelj*r2inv;
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
fpair = forcelj*r2inv;
|
||||
|
||||
if (eflag)
|
||||
evdwl += r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]);
|
||||
if (eflag)
|
||||
evdwl += r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]);
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
}
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
}
|
||||
}
|
||||
|
||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
||||
evdwl,0.0,fpair,delx,dely,delz);
|
||||
evdwl,0.0,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -390,7 +390,7 @@ void PairTriLJ::compute(int eflag, int vflag)
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
allocate all arrays
|
||||
allocate all arrays
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairTriLJ::allocate()
|
||||
|
@ -415,7 +415,7 @@ void PairTriLJ::allocate()
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
global settings
|
||||
global settings
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairTriLJ::settings(int narg, char **arg)
|
||||
|
@ -430,7 +430,7 @@ void PairTriLJ::settings(int narg, char **arg)
|
|||
int i,j;
|
||||
for (i = 1; i <= atom->ntypes; i++)
|
||||
for (j = i+1; j <= atom->ntypes; j++)
|
||||
if (setflag[i][j]) cut[i][j] = cut_global;
|
||||
if (setflag[i][j]) cut[i][j] = cut_global;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -440,7 +440,7 @@ void PairTriLJ::settings(int narg, char **arg)
|
|||
|
||||
void PairTriLJ::coeff(int narg, char **arg)
|
||||
{
|
||||
if (narg < 4 || narg > 5)
|
||||
if (narg < 4 || narg > 5)
|
||||
error->all(FLERR,"Incorrect args for pair coefficients");
|
||||
if (!allocated) allocate();
|
||||
|
||||
|
@ -476,7 +476,7 @@ double PairTriLJ::init_one(int i, int j)
|
|||
{
|
||||
if (setflag[i][j] == 0) {
|
||||
epsilon[i][j] = mix_energy(epsilon[i][i],epsilon[j][j],
|
||||
sigma[i][i],sigma[j][j]);
|
||||
sigma[i][i],sigma[j][j]);
|
||||
sigma[i][j] = mix_distance(sigma[i][i],sigma[j][j]);
|
||||
cut[i][j] = mix_distance(cut[i][i],cut[j][j]);
|
||||
}
|
||||
|
@ -504,7 +504,7 @@ double PairTriLJ::init_one(int i, int j)
|
|||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairTriLJ::discretize(int i, double sigma,
|
||||
double *c1, double *c2, double *c3)
|
||||
double *c1, double *c2, double *c3)
|
||||
{
|
||||
double c1c2[3],c2c3[3],c1c3[3];
|
||||
|
||||
|
@ -529,7 +529,7 @@ void PairTriLJ::discretize(int i, double sigma,
|
|||
if (ndiscrete == dmax) {
|
||||
dmax += DELTA;
|
||||
discrete = (Discrete *)
|
||||
memory->srealloc(discrete,dmax*sizeof(Discrete),"pair:discrete");
|
||||
memory->srealloc(discrete,dmax*sizeof(Discrete),"pair:discrete");
|
||||
}
|
||||
discrete[ndiscrete].dx = centroid[0];
|
||||
discrete[ndiscrete].dy = centroid[1];
|
||||
|
@ -582,7 +582,7 @@ void PairTriLJ::discretize(int i, double sigma,
|
|||
|
||||
/*
|
||||
void PairTriLJ::discretize(int i, double sigma,
|
||||
double *c1, double *c2, double *c3)
|
||||
double *c1, double *c2, double *c3)
|
||||
{
|
||||
double centroid[3],dc1[3],dc2[3],dc3[3];
|
||||
|
||||
|
@ -605,7 +605,7 @@ void PairTriLJ::discretize(int i, double sigma,
|
|||
if (ndiscrete == dmax) {
|
||||
dmax += DELTA;
|
||||
discrete = (Discrete *)
|
||||
memory->srealloc(discrete,dmax*sizeof(Discrete),"pair:discrete");
|
||||
memory->srealloc(discrete,dmax*sizeof(Discrete),"pair:discrete");
|
||||
}
|
||||
discrete[ndiscrete].dx = centroid[0];
|
||||
discrete[ndiscrete].dy = centroid[1];
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -116,10 +116,10 @@ void AngleClass2::compute(int eflag, int vflag)
|
|||
|
||||
c = delx1*delx2 + dely1*dely2 + delz1*delz2;
|
||||
c /= r1*r2;
|
||||
|
||||
|
||||
if (c > 1.0) c = 1.0;
|
||||
if (c < -1.0) c = -1.0;
|
||||
|
||||
|
||||
s = sqrt(1.0 - c*c);
|
||||
if (s < SMALL) s = SMALL;
|
||||
s = 1.0/s;
|
||||
|
@ -131,14 +131,14 @@ void AngleClass2::compute(int eflag, int vflag)
|
|||
dtheta3 = dtheta2*dtheta;
|
||||
dtheta4 = dtheta3*dtheta;
|
||||
|
||||
de_angle = 2.0*k2[type]*dtheta + 3.0*k3[type]*dtheta2 +
|
||||
de_angle = 2.0*k2[type]*dtheta + 3.0*k3[type]*dtheta2 +
|
||||
4.0*k4[type]*dtheta3;
|
||||
|
||||
a = -de_angle*s;
|
||||
a11 = a*c / rsq1;
|
||||
a12 = -a / (r1*r2);
|
||||
a22 = a*c / rsq2;
|
||||
|
||||
|
||||
f1[0] = a11*delx1 + a12*delx2;
|
||||
f1[1] = a11*dely1 + a12*dely2;
|
||||
f1[2] = a11*delz1 + a12*delz2;
|
||||
|
@ -227,7 +227,7 @@ void AngleClass2::compute(int eflag, int vflag)
|
|||
}
|
||||
|
||||
if (evflag) ev_tally(i1,i2,i3,nlocal,newton_bond,eangle,f1,f3,
|
||||
delx1,dely1,delz1,delx2,dely2,delz2);
|
||||
delx1,dely1,delz1,delx2,dely2,delz2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -283,7 +283,7 @@ void AngleClass2::coeff(int narg, char **arg)
|
|||
double bb_k_one = force->numeric(arg[2]);
|
||||
double bb_r1_one = force->numeric(arg[3]);
|
||||
double bb_r2_one = force->numeric(arg[4]);
|
||||
|
||||
|
||||
for (int i = ilo; i <= ihi; i++) {
|
||||
bb_k[i] = bb_k_one;
|
||||
bb_r1[i] = bb_r1_one;
|
||||
|
@ -299,7 +299,7 @@ void AngleClass2::coeff(int narg, char **arg)
|
|||
double ba_k2_one = force->numeric(arg[3]);
|
||||
double ba_r1_one = force->numeric(arg[4]);
|
||||
double ba_r2_one = force->numeric(arg[5]);
|
||||
|
||||
|
||||
for (int i = ilo; i <= ihi; i++) {
|
||||
ba_k1[i] = ba_k1_one;
|
||||
ba_k2[i] = ba_k2_one;
|
||||
|
@ -316,7 +316,7 @@ void AngleClass2::coeff(int narg, char **arg)
|
|||
double k2_one = force->numeric(arg[2]);
|
||||
double k3_one = force->numeric(arg[3]);
|
||||
double k4_one = force->numeric(arg[4]);
|
||||
|
||||
|
||||
// convert theta0 from degrees to radians
|
||||
|
||||
for (int i = ilo; i <= ihi; i++) {
|
||||
|
@ -365,7 +365,7 @@ void AngleClass2::write_restart(FILE *fp)
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 reads coeffs from restart file, bcasts them
|
||||
proc 0 reads coeffs from restart file, bcasts them
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void AngleClass2::read_restart(FILE *fp)
|
||||
|
@ -381,7 +381,7 @@ void AngleClass2::read_restart(FILE *fp)
|
|||
fread(&bb_k[1],sizeof(double),atom->nangletypes,fp);
|
||||
fread(&bb_r1[1],sizeof(double),atom->nangletypes,fp);
|
||||
fread(&bb_r2[1],sizeof(double),atom->nangletypes,fp);
|
||||
|
||||
|
||||
fread(&ba_k1[1],sizeof(double),atom->nangletypes,fp);
|
||||
fread(&ba_k2[1],sizeof(double),atom->nangletypes,fp);
|
||||
fread(&ba_r1[1],sizeof(double),atom->nangletypes,fp);
|
||||
|
@ -427,7 +427,7 @@ double AngleClass2::single(int type, int i1, int i2, int i3)
|
|||
c /= r1*r2;
|
||||
if (c > 1.0) c = 1.0;
|
||||
if (c < -1.0) c = -1.0;
|
||||
|
||||
|
||||
double s = sqrt(1.0 - c*c);
|
||||
if (s < SMALL) s = SMALL;
|
||||
s = 1.0/s;
|
||||
|
@ -436,9 +436,9 @@ double AngleClass2::single(int type, int i1, int i2, int i3)
|
|||
double dtheta2 = dtheta*dtheta;
|
||||
double dtheta3 = dtheta2*dtheta;
|
||||
double dtheta4 = dtheta3*dtheta;
|
||||
|
||||
|
||||
double energy = k2[type]*dtheta2 + k3[type]*dtheta3 + k4[type]*dtheta4;
|
||||
|
||||
|
||||
double dr1 = r1 - bb_r1[type];
|
||||
double dr2 = r2 - bb_r2[type];
|
||||
energy += bb_k[type]*dr1*dr2;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -124,7 +124,7 @@ void BondClass2::allocate()
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
set coeffs from one line in input script or data file
|
||||
set coeffs from one line in input script or data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void BondClass2::coeff(int narg, char **arg)
|
||||
|
@ -154,7 +154,7 @@ void BondClass2::coeff(int narg, char **arg)
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
return an equilbrium bond length
|
||||
return an equilbrium bond length
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
double BondClass2::equilibrium_distance(int i)
|
||||
|
@ -163,7 +163,7 @@ double BondClass2::equilibrium_distance(int i)
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes out coeffs to restart file
|
||||
proc 0 writes out coeffs to restart file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void BondClass2::write_restart(FILE *fp)
|
||||
|
@ -175,7 +175,7 @@ void BondClass2::write_restart(FILE *fp)
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 reads coeffs from restart file, bcasts them
|
||||
proc 0 reads coeffs from restart file, bcasts them
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void BondClass2::read_restart(FILE *fp)
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -181,19 +181,19 @@ void DihedralClass2::compute(int eflag, int vflag)
|
|||
costh12 = (vb1x*vb2x + vb1y*vb2y + vb1z*vb2z) * r12c1;
|
||||
costh13 = c0;
|
||||
costh23 = (vb2xm*vb3x + vb2ym*vb3y + vb2zm*vb3z) * r12c2;
|
||||
|
||||
|
||||
// cos and sin of 2 angles and final c
|
||||
|
||||
sin2 = MAX(1.0 - costh12*costh12,0.0);
|
||||
sc1 = sqrt(sin2);
|
||||
if (sc1 < SMALL) sc1 = SMALL;
|
||||
sc1 = 1.0/sc1;
|
||||
|
||||
|
||||
sin2 = MAX(1.0 - costh23*costh23,0.0);
|
||||
sc2 = sqrt(sin2);
|
||||
if (sc2 < SMALL) sc2 = SMALL;
|
||||
sc2 = 1.0/sc2;
|
||||
|
||||
|
||||
s1 = sc1 * sc1;
|
||||
s2 = sc2 * sc2;
|
||||
s12 = sc1 * sc2;
|
||||
|
@ -205,19 +205,19 @@ void DihedralClass2::compute(int eflag, int vflag)
|
|||
int me;
|
||||
MPI_Comm_rank(world,&me);
|
||||
if (screen) {
|
||||
char str[128];
|
||||
sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " %d %d %d %d",
|
||||
me,update->ntimestep,
|
||||
atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]);
|
||||
error->warning(FLERR,str,0);
|
||||
fprintf(screen," 1st atom: %d %g %g %g\n",
|
||||
me,x[i1][0],x[i1][1],x[i1][2]);
|
||||
fprintf(screen," 2nd atom: %d %g %g %g\n",
|
||||
me,x[i2][0],x[i2][1],x[i2][2]);
|
||||
fprintf(screen," 3rd atom: %d %g %g %g\n",
|
||||
me,x[i3][0],x[i3][1],x[i3][2]);
|
||||
fprintf(screen," 4th atom: %d %g %g %g\n",
|
||||
me,x[i4][0],x[i4][1],x[i4][2]);
|
||||
char str[128];
|
||||
sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " %d %d %d %d",
|
||||
me,update->ntimestep,
|
||||
atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]);
|
||||
error->warning(FLERR,str,0);
|
||||
fprintf(screen," 1st atom: %d %g %g %g\n",
|
||||
me,x[i1][0],x[i1][1],x[i1][2]);
|
||||
fprintf(screen," 2nd atom: %d %g %g %g\n",
|
||||
me,x[i2][0],x[i2][1],x[i2][2]);
|
||||
fprintf(screen," 3rd atom: %d %g %g %g\n",
|
||||
me,x[i3][0],x[i3][1],x[i3][2]);
|
||||
fprintf(screen," 4th atom: %d %g %g %g\n",
|
||||
me,x[i4][0],x[i4][1],x[i4][2]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ void DihedralClass2::compute(int eflag, int vflag)
|
|||
a12 = r12c1 * (costh12*c*s1 + costh23*s12);
|
||||
a13 = rb1*rb3*s12;
|
||||
a23 = r12c2 * (-costh23*c*s2 - costh12*s12);
|
||||
|
||||
|
||||
sx1 = a11*vb1x + a12*vb2x + a13*vb3x;
|
||||
sx2 = a12*vb1x + a22*vb2x + a23*vb3x;
|
||||
sx12 = a13*vb1x + a23*vb2x + a33*vb3x;
|
||||
|
@ -263,18 +263,18 @@ void DihedralClass2::compute(int eflag, int vflag)
|
|||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = 0; j < 3; j++)
|
||||
dphidr[i][j] = -dcosphidr[i][j] / sinphi;
|
||||
dphidr[i][j] = -dcosphidr[i][j] / sinphi;
|
||||
|
||||
// energy
|
||||
|
||||
dphi1 = phi - phi1[type];
|
||||
dphi2 = 2.0*phi - phi2[type];
|
||||
dphi3 = 3.0*phi - phi3[type];
|
||||
|
||||
|
||||
if (eflag) edihedral = k1[type]*(1.0 - cos(dphi1)) +
|
||||
k2[type]*(1.0 - cos(dphi2)) +
|
||||
k3[type]*(1.0 - cos(dphi3));
|
||||
|
||||
k2[type]*(1.0 - cos(dphi2)) +
|
||||
k3[type]*(1.0 - cos(dphi3));
|
||||
|
||||
de_dihedral = k1[type]*sin(dphi1) + 2.0*k2[type]*sin(dphi2) +
|
||||
3.0*k3[type]*sin(dphi3);
|
||||
|
||||
|
@ -282,18 +282,18 @@ void DihedralClass2::compute(int eflag, int vflag)
|
|||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = 0; j < 3; j++)
|
||||
fabcd[i][j] = de_dihedral*dphidr[i][j];
|
||||
fabcd[i][j] = de_dihedral*dphidr[i][j];
|
||||
|
||||
// set up d(bond)/d(r) array
|
||||
// dbonddr(i,j,k) = bond i, atom j, coordinate k
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
for (j = 0; j < 4; j++)
|
||||
for (k = 0; k < 3; k++)
|
||||
dbonddr[i][j][k] = 0.0;
|
||||
|
||||
for (k = 0; k < 3; k++)
|
||||
dbonddr[i][j][k] = 0.0;
|
||||
|
||||
// bond1
|
||||
|
||||
|
||||
dbonddr[0][0][0] = vb1x / r1;
|
||||
dbonddr[0][0][1] = vb1y / r1;
|
||||
dbonddr[0][0][2] = vb1z / r1;
|
||||
|
@ -311,7 +311,7 @@ void DihedralClass2::compute(int eflag, int vflag)
|
|||
dbonddr[1][2][2] = -vb2z / r2;
|
||||
|
||||
// bond3
|
||||
|
||||
|
||||
dbonddr[2][2][0] = vb3x / r3;
|
||||
dbonddr[2][2][1] = vb3y / r3;
|
||||
dbonddr[2][2][2] = vb3z / r3;
|
||||
|
@ -324,71 +324,71 @@ void DihedralClass2::compute(int eflag, int vflag)
|
|||
|
||||
for (i = 0; i < 2; i++)
|
||||
for (j = 0; j < 4; j++)
|
||||
for (k = 0; k < 3; k++)
|
||||
dthetadr[i][j][k] = 0.0;
|
||||
|
||||
for (k = 0; k < 3; k++)
|
||||
dthetadr[i][j][k] = 0.0;
|
||||
|
||||
t1 = costh12 / r1mag2;
|
||||
t2 = costh23 / r2mag2;
|
||||
t3 = costh12 / r2mag2;
|
||||
t4 = costh23 / r3mag2;
|
||||
|
||||
|
||||
// angle12
|
||||
|
||||
|
||||
dthetadr[0][0][0] = sc1 * ((t1 * vb1x) - (vb2x * r12c1));
|
||||
dthetadr[0][0][1] = sc1 * ((t1 * vb1y) - (vb2y * r12c1));
|
||||
dthetadr[0][0][2] = sc1 * ((t1 * vb1z) - (vb2z * r12c1));
|
||||
|
||||
|
||||
dthetadr[0][1][0] = sc1 * ((-t1 * vb1x) + (vb2x * r12c1) +
|
||||
(-t3 * vb2x) + (vb1x * r12c1));
|
||||
(-t3 * vb2x) + (vb1x * r12c1));
|
||||
dthetadr[0][1][1] = sc1 * ((-t1 * vb1y) + (vb2y * r12c1) +
|
||||
(-t3 * vb2y) + (vb1y * r12c1));
|
||||
(-t3 * vb2y) + (vb1y * r12c1));
|
||||
dthetadr[0][1][2] = sc1 * ((-t1 * vb1z) + (vb2z * r12c1) +
|
||||
(-t3 * vb2z) + (vb1z * r12c1));
|
||||
|
||||
dthetadr[0][2][0] = sc1 * ((t3 * vb2x) - (vb1x * r12c1));
|
||||
(-t3 * vb2z) + (vb1z * r12c1));
|
||||
|
||||
dthetadr[0][2][0] = sc1 * ((t3 * vb2x) - (vb1x * r12c1));
|
||||
dthetadr[0][2][1] = sc1 * ((t3 * vb2y) - (vb1y * r12c1));
|
||||
dthetadr[0][2][2] = sc1 * ((t3 * vb2z) - (vb1z * r12c1));
|
||||
|
||||
|
||||
// angle23
|
||||
|
||||
|
||||
dthetadr[1][1][0] = sc2 * ((t2 * vb2x) + (vb3x * r12c2));
|
||||
dthetadr[1][1][1] = sc2 * ((t2 * vb2y) + (vb3y * r12c2));
|
||||
dthetadr[1][1][2] = sc2 * ((t2 * vb2z) + (vb3z * r12c2));
|
||||
|
||||
|
||||
dthetadr[1][2][0] = sc2 * ((-t2 * vb2x) - (vb3x * r12c2) +
|
||||
(t4 * vb3x) + (vb2x * r12c2));
|
||||
(t4 * vb3x) + (vb2x * r12c2));
|
||||
dthetadr[1][2][1] = sc2 * ((-t2 * vb2y) - (vb3y * r12c2) +
|
||||
(t4 * vb3y) + (vb2y * r12c2));
|
||||
(t4 * vb3y) + (vb2y * r12c2));
|
||||
dthetadr[1][2][2] = sc2 * ((-t2 * vb2z) - (vb3z * r12c2) +
|
||||
(t4 * vb3z) + (vb2z * r12c2));
|
||||
|
||||
(t4 * vb3z) + (vb2z * r12c2));
|
||||
|
||||
dthetadr[1][3][0] = -sc2 * ((t4 * vb3x) + (vb2x * r12c2));
|
||||
dthetadr[1][3][1] = -sc2 * ((t4 * vb3y) + (vb2y * r12c2));
|
||||
dthetadr[1][3][2] = -sc2 * ((t4 * vb3z) + (vb2z * r12c2));
|
||||
|
||||
|
||||
// mid-bond/torsion coupling
|
||||
// energy on bond2 (middle bond)
|
||||
|
||||
|
||||
cos2phi = cos(2.0*phi);
|
||||
cos3phi = cos(3.0*phi);
|
||||
|
||||
|
||||
bt1 = mbt_f1[type] * cosphi;
|
||||
bt2 = mbt_f2[type] * cos2phi;
|
||||
bt3 = mbt_f3[type] * cos3phi;
|
||||
sumbte = bt1 + bt2 + bt3;
|
||||
db = r2 - mbt_r0[type];
|
||||
if (eflag) edihedral += db * sumbte;
|
||||
|
||||
|
||||
// force on bond2
|
||||
|
||||
|
||||
bt1 = -mbt_f1[type] * sinphi;
|
||||
bt2 = -2.0 * mbt_f2[type] * sin(2.0*phi);
|
||||
bt3 = -3.0 * mbt_f3[type] * sin(3.0*phi);
|
||||
sumbtf = bt1 + bt2 + bt3;
|
||||
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = 0; j < 3; j++)
|
||||
fabcd[i][j] += db*sumbtf*dphidr[i][j] + sumbte*dbonddr[1][i][j];
|
||||
fabcd[i][j] += db*sumbtf*dphidr[i][j] + sumbte*dbonddr[1][i][j];
|
||||
|
||||
// end-bond/torsion coupling
|
||||
// energy on bond1 (first bond)
|
||||
|
@ -410,7 +410,7 @@ void DihedralClass2::compute(int eflag, int vflag)
|
|||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = 0; j < 3; j++)
|
||||
fabcd[i][j] -= db*sumbtf*dphidr[i][j] + sumbte*dbonddr[0][i][j];
|
||||
fabcd[i][j] -= db*sumbtf*dphidr[i][j] + sumbte*dbonddr[0][i][j];
|
||||
|
||||
// end-bond/torsion coupling
|
||||
// energy on bond3 (last bond)
|
||||
|
@ -432,7 +432,7 @@ void DihedralClass2::compute(int eflag, int vflag)
|
|||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = 0; j < 3; j++)
|
||||
fabcd[i][j] += db*sumbtf*dphidr[i][j] + sumbte*dbonddr[2][i][j];
|
||||
fabcd[i][j] += db*sumbtf*dphidr[i][j] + sumbte*dbonddr[2][i][j];
|
||||
|
||||
// angle/torsion coupling
|
||||
// energy on angle1
|
||||
|
@ -454,7 +454,7 @@ void DihedralClass2::compute(int eflag, int vflag)
|
|||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = 0; j < 3; j++)
|
||||
fabcd[i][j] -= da*sumbtf*dphidr[i][j] + sumbte*dthetadr[0][i][j];
|
||||
fabcd[i][j] -= da*sumbtf*dphidr[i][j] + sumbte*dthetadr[0][i][j];
|
||||
|
||||
// energy on angle2
|
||||
|
||||
|
@ -475,20 +475,20 @@ void DihedralClass2::compute(int eflag, int vflag)
|
|||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = 0; j < 3; j++)
|
||||
fabcd[i][j] += da*sumbtf*dphidr[i][j] + sumbte*dthetadr[1][i][j];
|
||||
fabcd[i][j] += da*sumbtf*dphidr[i][j] + sumbte*dthetadr[1][i][j];
|
||||
|
||||
// angle/angle/torsion coupling
|
||||
|
||||
da1 = acos(costh12) - aat_theta0_1[type];
|
||||
da2 = acos(costh23) - aat_theta0_2[type];
|
||||
|
||||
|
||||
if (eflag) edihedral += aat_k[type]*da1*da2*cosphi;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = 0; j < 3; j++)
|
||||
fabcd[i][j] -= aat_k[type] *
|
||||
(cosphi * (da2*dthetadr[0][i][j] - da1*dthetadr[1][i][j]) +
|
||||
sinphi * da1*da2*dphidr[i][j]);
|
||||
fabcd[i][j] -= aat_k[type] *
|
||||
(cosphi * (da2*dthetadr[0][i][j] - da1*dthetadr[1][i][j]) +
|
||||
sinphi * da1*da2*dphidr[i][j]);
|
||||
|
||||
// bond1/bond3 coupling
|
||||
|
||||
|
@ -502,7 +502,7 @@ void DihedralClass2::compute(int eflag, int vflag)
|
|||
tk2 = -bb13t_k[type] * dr2 / r1;
|
||||
|
||||
if (eflag) edihedral += bb13t_k[type]*dr1*dr2;
|
||||
|
||||
|
||||
fabcd[0][0] += tk2 * vb1x;
|
||||
fabcd[0][1] += tk2 * vb1y;
|
||||
fabcd[0][2] += tk2 * vb1z;
|
||||
|
@ -510,7 +510,7 @@ void DihedralClass2::compute(int eflag, int vflag)
|
|||
fabcd[1][0] -= tk2 * vb1x;
|
||||
fabcd[1][1] -= tk2 * vb1y;
|
||||
fabcd[1][2] -= tk2 * vb1z;
|
||||
|
||||
|
||||
fabcd[2][0] -= tk1 * vb3x;
|
||||
fabcd[2][1] -= tk1 * vb3y;
|
||||
fabcd[2][2] -= tk1 * vb3z;
|
||||
|
@ -548,8 +548,8 @@ void DihedralClass2::compute(int eflag, int vflag)
|
|||
|
||||
if (evflag)
|
||||
ev_tally(i1,i2,i3,i4,nlocal,newton_bond,edihedral,
|
||||
fabcd[0],fabcd[2],fabcd[3],
|
||||
vb1x,vb1y,vb1z,vb2x,vb2y,vb2z,vb3x,vb3y,vb3z);
|
||||
fabcd[0],fabcd[2],fabcd[3],
|
||||
vb1x,vb1y,vb1z,vb2x,vb2y,vb2z,vb3x,vb3y,vb3z);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -608,7 +608,7 @@ void DihedralClass2::allocate()
|
|||
memory->create(setflag_aat,n+1,"dihedral:setflag_aat");
|
||||
memory->create(setflag_bb13t,n+1,"dihedral:setflag_bb13t");
|
||||
for (int i = 1; i <= n; i++)
|
||||
setflag[i] = setflag_d[i] = setflag_mbt[i] = setflag_ebt[i] =
|
||||
setflag[i] = setflag_d[i] = setflag_mbt[i] = setflag_ebt[i] =
|
||||
setflag_at[i] = setflag_aat[i] = setflag_bb13t[i] = 0;
|
||||
}
|
||||
|
||||
|
@ -639,7 +639,7 @@ void DihedralClass2::coeff(int narg, char **arg)
|
|||
double f2_one = force->numeric(arg[3]);
|
||||
double f3_one = force->numeric(arg[4]);
|
||||
double r0_one = force->numeric(arg[5]);
|
||||
|
||||
|
||||
for (int i = ilo; i <= ihi; i++) {
|
||||
mbt_f1[i] = f1_one;
|
||||
mbt_f2[i] = f2_one;
|
||||
|
@ -660,7 +660,7 @@ void DihedralClass2::coeff(int narg, char **arg)
|
|||
double f3_2_one = force->numeric(arg[7]);
|
||||
double r0_1_one = force->numeric(arg[8]);
|
||||
double r0_2_one = force->numeric(arg[9]);
|
||||
|
||||
|
||||
for (int i = ilo; i <= ihi; i++) {
|
||||
ebt_f1_1[i] = f1_1_one;
|
||||
ebt_f2_1[i] = f2_1_one;
|
||||
|
@ -687,7 +687,7 @@ void DihedralClass2::coeff(int narg, char **arg)
|
|||
double theta0_2_one = force->numeric(arg[9]);
|
||||
|
||||
// convert theta0's from degrees to radians
|
||||
|
||||
|
||||
for (int i = ilo; i <= ihi; i++) {
|
||||
at_f1_1[i] = f1_1_one;
|
||||
at_f2_1[i] = f2_1_one;
|
||||
|
@ -709,7 +709,7 @@ void DihedralClass2::coeff(int narg, char **arg)
|
|||
double theta0_2_one = force->numeric(arg[4]);
|
||||
|
||||
// convert theta0's from degrees to radians
|
||||
|
||||
|
||||
for (int i = ilo; i <= ihi; i++) {
|
||||
aat_k[i] = k_one;
|
||||
aat_theta0_1[i] = theta0_1_one/180.0 * MY_PI;
|
||||
|
@ -724,7 +724,7 @@ void DihedralClass2::coeff(int narg, char **arg)
|
|||
double k_one = force->numeric(arg[2]);
|
||||
double r10_one = force->numeric(arg[3]);
|
||||
double r30_one = force->numeric(arg[4]);
|
||||
|
||||
|
||||
for (int i = ilo; i <= ihi; i++) {
|
||||
bb13t_k[i] = k_one;
|
||||
bb13t_r10[i] = r10_one;
|
||||
|
@ -742,7 +742,7 @@ void DihedralClass2::coeff(int narg, char **arg)
|
|||
double phi2_one = force->numeric(arg[4]);
|
||||
double k3_one = force->numeric(arg[5]);
|
||||
double phi3_one = force->numeric(arg[6]);
|
||||
|
||||
|
||||
// convert phi's from degrees to radians
|
||||
|
||||
for (int i = ilo; i <= ihi; i++) {
|
||||
|
@ -761,12 +761,12 @@ void DihedralClass2::coeff(int narg, char **arg)
|
|||
|
||||
for (int i = ilo; i <= ihi; i++)
|
||||
if (setflag_d[i] == 1 && setflag_mbt[i] == 1 && setflag_ebt[i] == 1 &&
|
||||
setflag_at[i] == 1 && setflag_aat[i] == 1 && setflag_bb13t[i] == 1)
|
||||
setflag_at[i] == 1 && setflag_aat[i] == 1 && setflag_bb13t[i] == 1)
|
||||
setflag[i] = 1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes out coeffs to restart file
|
||||
proc 0 writes out coeffs to restart file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void DihedralClass2::write_restart(FILE *fp)
|
||||
|
@ -813,7 +813,7 @@ void DihedralClass2::write_restart(FILE *fp)
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 reads coeffs from restart file, bcasts them
|
||||
proc 0 reads coeffs from restart file, bcasts them
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void DihedralClass2::read_restart(FILE *fp)
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -91,10 +91,10 @@ void ImproperClass2::compute(int eflag, int vflag)
|
|||
for (i = 0; i < 3; i++)
|
||||
for (j = 0; j < 4; j++)
|
||||
for (k = 0; k < 3; k++) {
|
||||
dthetadr[i][j][k] = 0.0;
|
||||
drAB[i][j][k] = 0.0;
|
||||
drCB[i][j][k] = 0.0;
|
||||
drDB[i][j][k] = 0.0;
|
||||
dthetadr[i][j][k] = 0.0;
|
||||
drAB[i][j][k] = 0.0;
|
||||
drCB[i][j][k] = 0.0;
|
||||
drDB[i][j][k] = 0.0;
|
||||
}
|
||||
|
||||
double **x = atom->x;
|
||||
|
@ -133,43 +133,43 @@ void ImproperClass2::compute(int eflag, int vflag)
|
|||
// bond lengths and associated values
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
rmag2[i] = delr[i][0]*delr[i][0] + delr[i][1]*delr[i][1] +
|
||||
delr[i][2]*delr[i][2];
|
||||
rmag2[i] = delr[i][0]*delr[i][0] + delr[i][1]*delr[i][1] +
|
||||
delr[i][2]*delr[i][2];
|
||||
rmag[i] = sqrt(rmag2[i]);
|
||||
rinvmag[i] = 1.0/rmag[i];
|
||||
}
|
||||
|
||||
// angle ABC, CBD, ABD
|
||||
|
||||
costheta[0] = (delr[0][0]*delr[1][0] + delr[0][1]*delr[1][1] +
|
||||
delr[0][2]*delr[1][2]) / (rmag[0]*rmag[1]);
|
||||
costheta[1] = (delr[1][0]*delr[2][0] + delr[1][1]*delr[2][1] +
|
||||
delr[1][2]*delr[2][2]) / (rmag[1]*rmag[2]);
|
||||
costheta[2] = (delr[0][0]*delr[2][0] + delr[0][1]*delr[2][1] +
|
||||
delr[0][2]*delr[2][2]) / (rmag[0]*rmag[2]);
|
||||
costheta[0] = (delr[0][0]*delr[1][0] + delr[0][1]*delr[1][1] +
|
||||
delr[0][2]*delr[1][2]) / (rmag[0]*rmag[1]);
|
||||
costheta[1] = (delr[1][0]*delr[2][0] + delr[1][1]*delr[2][1] +
|
||||
delr[1][2]*delr[2][2]) / (rmag[1]*rmag[2]);
|
||||
costheta[2] = (delr[0][0]*delr[2][0] + delr[0][1]*delr[2][1] +
|
||||
delr[0][2]*delr[2][2]) / (rmag[0]*rmag[2]);
|
||||
|
||||
// angle error check
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (costheta[i] == -1.0) {
|
||||
int me;
|
||||
MPI_Comm_rank(world,&me);
|
||||
if (screen) {
|
||||
char str[128];
|
||||
sprintf(str,
|
||||
"Improper problem: %d " BIGINT_FORMAT " %d %d %d %d",
|
||||
me,update->ntimestep,
|
||||
atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]);
|
||||
error->warning(FLERR,str,0);
|
||||
fprintf(screen," 1st atom: %d %g %g %g\n",
|
||||
me,x[i1][0],x[i1][1],x[i1][2]);
|
||||
fprintf(screen," 2nd atom: %d %g %g %g\n",
|
||||
me,x[i2][0],x[i2][1],x[i2][2]);
|
||||
fprintf(screen," 3rd atom: %d %g %g %g\n",
|
||||
me,x[i3][0],x[i3][1],x[i3][2]);
|
||||
fprintf(screen," 4th atom: %d %g %g %g\n",
|
||||
me,x[i4][0],x[i4][1],x[i4][2]);
|
||||
}
|
||||
int me;
|
||||
MPI_Comm_rank(world,&me);
|
||||
if (screen) {
|
||||
char str[128];
|
||||
sprintf(str,
|
||||
"Improper problem: %d " BIGINT_FORMAT " %d %d %d %d",
|
||||
me,update->ntimestep,
|
||||
atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]);
|
||||
error->warning(FLERR,str,0);
|
||||
fprintf(screen," 1st atom: %d %g %g %g\n",
|
||||
me,x[i1][0],x[i1][1],x[i1][2]);
|
||||
fprintf(screen," 2nd atom: %d %g %g %g\n",
|
||||
me,x[i2][0],x[i2][1],x[i2][2]);
|
||||
fprintf(screen," 3rd atom: %d %g %g %g\n",
|
||||
me,x[i3][0],x[i3][1],x[i3][2]);
|
||||
fprintf(screen," 4th atom: %d %g %g %g\n",
|
||||
me,x[i4][0],x[i4][1],x[i4][2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ void ImproperClass2::compute(int eflag, int vflag)
|
|||
|
||||
for (i = 0; i < 3; i++)
|
||||
for (j = 0; j < 4; j++)
|
||||
ddelr[i][j] = 0.0;
|
||||
ddelr[i][j] = 0.0;
|
||||
|
||||
ddelr[0][0] = 1.0;
|
||||
ddelr[0][1] = -1.0;
|
||||
|
@ -238,19 +238,19 @@ void ImproperClass2::compute(int eflag, int vflag)
|
|||
|
||||
for (i = 0; i < 3; i++)
|
||||
for (j = 0; j < 4; j++)
|
||||
for (k = 0; k < 3; k++) {
|
||||
dr[i][j][k] = delr[i][k] * ddelr[i][j] / rmag[i];
|
||||
dinvr[i][j][k] = -dr[i][j][k] / rmag2[i];
|
||||
}
|
||||
for (k = 0; k < 3; k++) {
|
||||
dr[i][j][k] = delr[i][k] * ddelr[i][j] / rmag[i];
|
||||
dinvr[i][j][k] = -dr[i][j][k] / rmag2[i];
|
||||
}
|
||||
|
||||
// compute d(1 / (|r_AB| * |r_CB| * |r_DB|) / dr
|
||||
// i = atom A/B/C/D, j = X/Y/Z
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = 0; j < 3; j++)
|
||||
dinv3r[i][j] = rinvmag[1] * (rinvmag[2] * dinvr[0][i][j] +
|
||||
rinvmag[0] * dinvr[2][i][j]) +
|
||||
rinvmag[2] * rinvmag[0] * dinvr[1][i][j];
|
||||
dinv3r[i][j] = rinvmag[1] * (rinvmag[2] * dinvr[0][i][j] +
|
||||
rinvmag[0] * dinvr[2][i][j]) +
|
||||
rinvmag[2] * rinvmag[0] * dinvr[1][i][j];
|
||||
|
||||
// compute d(theta)/d(r) for 3 angles
|
||||
// angleABC
|
||||
|
@ -259,30 +259,30 @@ void ImproperClass2::compute(int eflag, int vflag)
|
|||
tt3 = costheta[0] / rmag2[1];
|
||||
sc1 = 1.0 / sqrt(1.0 - cossqtheta[0]);
|
||||
|
||||
dthetadr[0][0][0] = sc1 * ((tt1 * delr[0][0]) -
|
||||
(delr[1][0] * rinvmag[0] * rinvmag[1]));
|
||||
dthetadr[0][0][1] = sc1 * ((tt1 * delr[0][1]) -
|
||||
(delr[1][1] * rinvmag[0] * rinvmag[1]));
|
||||
dthetadr[0][0][2] = sc1 * ((tt1 * delr[0][2]) -
|
||||
(delr[1][2] * rinvmag[0] * rinvmag[1]));
|
||||
dthetadr[0][1][0] = -sc1 * ((tt1 * delr[0][0]) -
|
||||
(delr[1][0] * rinvmag[0] * rinvmag[1]) +
|
||||
(tt3 * delr[1][0]) -
|
||||
(delr[0][0] * rinvmag[0] * rinvmag[1]));
|
||||
dthetadr[0][1][1] = -sc1 * ((tt1 * delr[0][1]) -
|
||||
(delr[1][1] * rinvmag[0] * rinvmag[1]) +
|
||||
(tt3 * delr[1][1]) -
|
||||
(delr[0][1] * rinvmag[0] * rinvmag[1]));
|
||||
dthetadr[0][1][2] = -sc1 * ((tt1 * delr[0][2]) -
|
||||
(delr[1][2] * rinvmag[0] * rinvmag[1]) +
|
||||
(tt3 * delr[1][2]) -
|
||||
(delr[0][2] * rinvmag[0] * rinvmag[1]));
|
||||
dthetadr[0][2][0] = sc1 * ((tt3 * delr[1][0]) -
|
||||
(delr[0][0] * rinvmag[0] * rinvmag[1]));
|
||||
dthetadr[0][2][1] = sc1 * ((tt3 * delr[1][1]) -
|
||||
(delr[0][1] * rinvmag[0] * rinvmag[1]));
|
||||
dthetadr[0][2][2] = sc1 * ((tt3 * delr[1][2]) -
|
||||
(delr[0][2] * rinvmag[0] * rinvmag[1]));
|
||||
dthetadr[0][0][0] = sc1 * ((tt1 * delr[0][0]) -
|
||||
(delr[1][0] * rinvmag[0] * rinvmag[1]));
|
||||
dthetadr[0][0][1] = sc1 * ((tt1 * delr[0][1]) -
|
||||
(delr[1][1] * rinvmag[0] * rinvmag[1]));
|
||||
dthetadr[0][0][2] = sc1 * ((tt1 * delr[0][2]) -
|
||||
(delr[1][2] * rinvmag[0] * rinvmag[1]));
|
||||
dthetadr[0][1][0] = -sc1 * ((tt1 * delr[0][0]) -
|
||||
(delr[1][0] * rinvmag[0] * rinvmag[1]) +
|
||||
(tt3 * delr[1][0]) -
|
||||
(delr[0][0] * rinvmag[0] * rinvmag[1]));
|
||||
dthetadr[0][1][1] = -sc1 * ((tt1 * delr[0][1]) -
|
||||
(delr[1][1] * rinvmag[0] * rinvmag[1]) +
|
||||
(tt3 * delr[1][1]) -
|
||||
(delr[0][1] * rinvmag[0] * rinvmag[1]));
|
||||
dthetadr[0][1][2] = -sc1 * ((tt1 * delr[0][2]) -
|
||||
(delr[1][2] * rinvmag[0] * rinvmag[1]) +
|
||||
(tt3 * delr[1][2]) -
|
||||
(delr[0][2] * rinvmag[0] * rinvmag[1]));
|
||||
dthetadr[0][2][0] = sc1 * ((tt3 * delr[1][0]) -
|
||||
(delr[0][0] * rinvmag[0] * rinvmag[1]));
|
||||
dthetadr[0][2][1] = sc1 * ((tt3 * delr[1][1]) -
|
||||
(delr[0][1] * rinvmag[0] * rinvmag[1]));
|
||||
dthetadr[0][2][2] = sc1 * ((tt3 * delr[1][2]) -
|
||||
(delr[0][2] * rinvmag[0] * rinvmag[1]));
|
||||
|
||||
// angleCBD
|
||||
|
||||
|
@ -290,30 +290,30 @@ void ImproperClass2::compute(int eflag, int vflag)
|
|||
tt3 = costheta[1] / rmag2[2];
|
||||
sc1 = 1.0 / sqrt(1.0 - cossqtheta[1]);
|
||||
|
||||
dthetadr[1][2][0] = sc1 * ((tt1 * delr[1][0]) -
|
||||
(delr[2][0] * rinvmag[1] * rinvmag[2]));
|
||||
dthetadr[1][2][1] = sc1 * ((tt1 * delr[1][1]) -
|
||||
(delr[2][1] * rinvmag[1] * rinvmag[2]));
|
||||
dthetadr[1][2][2] = sc1 * ((tt1 * delr[1][2]) -
|
||||
(delr[2][2] * rinvmag[1] * rinvmag[2]));
|
||||
dthetadr[1][1][0] = -sc1 * ((tt1 * delr[1][0]) -
|
||||
(delr[2][0] * rinvmag[1] * rinvmag[2]) +
|
||||
(tt3 * delr[2][0]) -
|
||||
(delr[1][0] * rinvmag[2] * rinvmag[1]));
|
||||
dthetadr[1][1][1] = -sc1 * ((tt1 * delr[1][1]) -
|
||||
(delr[2][1] * rinvmag[1] * rinvmag[2]) +
|
||||
(tt3 * delr[2][1]) -
|
||||
(delr[1][1] * rinvmag[2] * rinvmag[1]));
|
||||
dthetadr[1][1][2] = -sc1 * ((tt1 * delr[1][2]) -
|
||||
(delr[2][2] * rinvmag[1] * rinvmag[2]) +
|
||||
(tt3 * delr[2][2]) -
|
||||
(delr[1][2] * rinvmag[2] * rinvmag[1]));
|
||||
dthetadr[1][3][0] = sc1 * ((tt3 * delr[2][0]) -
|
||||
(delr[1][0] * rinvmag[2] * rinvmag[1]));
|
||||
dthetadr[1][3][1] = sc1 * ((tt3 * delr[2][1]) -
|
||||
(delr[1][1] * rinvmag[2] * rinvmag[1]));
|
||||
dthetadr[1][3][2] = sc1 * ((tt3 * delr[2][2]) -
|
||||
(delr[1][2] * rinvmag[2] * rinvmag[1]));
|
||||
dthetadr[1][2][0] = sc1 * ((tt1 * delr[1][0]) -
|
||||
(delr[2][0] * rinvmag[1] * rinvmag[2]));
|
||||
dthetadr[1][2][1] = sc1 * ((tt1 * delr[1][1]) -
|
||||
(delr[2][1] * rinvmag[1] * rinvmag[2]));
|
||||
dthetadr[1][2][2] = sc1 * ((tt1 * delr[1][2]) -
|
||||
(delr[2][2] * rinvmag[1] * rinvmag[2]));
|
||||
dthetadr[1][1][0] = -sc1 * ((tt1 * delr[1][0]) -
|
||||
(delr[2][0] * rinvmag[1] * rinvmag[2]) +
|
||||
(tt3 * delr[2][0]) -
|
||||
(delr[1][0] * rinvmag[2] * rinvmag[1]));
|
||||
dthetadr[1][1][1] = -sc1 * ((tt1 * delr[1][1]) -
|
||||
(delr[2][1] * rinvmag[1] * rinvmag[2]) +
|
||||
(tt3 * delr[2][1]) -
|
||||
(delr[1][1] * rinvmag[2] * rinvmag[1]));
|
||||
dthetadr[1][1][2] = -sc1 * ((tt1 * delr[1][2]) -
|
||||
(delr[2][2] * rinvmag[1] * rinvmag[2]) +
|
||||
(tt3 * delr[2][2]) -
|
||||
(delr[1][2] * rinvmag[2] * rinvmag[1]));
|
||||
dthetadr[1][3][0] = sc1 * ((tt3 * delr[2][0]) -
|
||||
(delr[1][0] * rinvmag[2] * rinvmag[1]));
|
||||
dthetadr[1][3][1] = sc1 * ((tt3 * delr[2][1]) -
|
||||
(delr[1][1] * rinvmag[2] * rinvmag[1]));
|
||||
dthetadr[1][3][2] = sc1 * ((tt3 * delr[2][2]) -
|
||||
(delr[1][2] * rinvmag[2] * rinvmag[1]));
|
||||
|
||||
// angleABD
|
||||
|
||||
|
@ -321,30 +321,30 @@ void ImproperClass2::compute(int eflag, int vflag)
|
|||
tt3 = costheta[2] / rmag2[2];
|
||||
sc1 = 1.0 / sqrt(1.0 - cossqtheta[2]);
|
||||
|
||||
dthetadr[2][0][0] = sc1 * ((tt1 * delr[0][0]) -
|
||||
(delr[2][0] * rinvmag[0] * rinvmag[2]));
|
||||
dthetadr[2][0][1] = sc1 * ((tt1 * delr[0][1]) -
|
||||
(delr[2][1] * rinvmag[0] * rinvmag[2]));
|
||||
dthetadr[2][0][2] = sc1 * ((tt1 * delr[0][2]) -
|
||||
(delr[2][2] * rinvmag[0] * rinvmag[2]));
|
||||
dthetadr[2][1][0] = -sc1 * ((tt1 * delr[0][0]) -
|
||||
(delr[2][0] * rinvmag[0] * rinvmag[2]) +
|
||||
(tt3 * delr[2][0]) -
|
||||
(delr[0][0] * rinvmag[2] * rinvmag[0]));
|
||||
dthetadr[2][1][1] = -sc1 * ((tt1 * delr[0][1]) -
|
||||
(delr[2][1] * rinvmag[0] * rinvmag[2]) +
|
||||
(tt3 * delr[2][1]) -
|
||||
(delr[0][1] * rinvmag[2] * rinvmag[0]));
|
||||
dthetadr[2][1][2] = -sc1 * ((tt1 * delr[0][2]) -
|
||||
(delr[2][2] * rinvmag[0] * rinvmag[2]) +
|
||||
(tt3 * delr[2][2]) -
|
||||
(delr[0][2] * rinvmag[2] * rinvmag[0]));
|
||||
dthetadr[2][3][0] = sc1 * ((tt3 * delr[2][0]) -
|
||||
(delr[0][0] * rinvmag[2] * rinvmag[0]));
|
||||
dthetadr[2][3][1] = sc1 * ((tt3 * delr[2][1]) -
|
||||
(delr[0][1] * rinvmag[2] * rinvmag[0]));
|
||||
dthetadr[2][3][2] = sc1 * ((tt3 * delr[2][2]) -
|
||||
(delr[0][2] * rinvmag[2] * rinvmag[0]));
|
||||
dthetadr[2][0][0] = sc1 * ((tt1 * delr[0][0]) -
|
||||
(delr[2][0] * rinvmag[0] * rinvmag[2]));
|
||||
dthetadr[2][0][1] = sc1 * ((tt1 * delr[0][1]) -
|
||||
(delr[2][1] * rinvmag[0] * rinvmag[2]));
|
||||
dthetadr[2][0][2] = sc1 * ((tt1 * delr[0][2]) -
|
||||
(delr[2][2] * rinvmag[0] * rinvmag[2]));
|
||||
dthetadr[2][1][0] = -sc1 * ((tt1 * delr[0][0]) -
|
||||
(delr[2][0] * rinvmag[0] * rinvmag[2]) +
|
||||
(tt3 * delr[2][0]) -
|
||||
(delr[0][0] * rinvmag[2] * rinvmag[0]));
|
||||
dthetadr[2][1][1] = -sc1 * ((tt1 * delr[0][1]) -
|
||||
(delr[2][1] * rinvmag[0] * rinvmag[2]) +
|
||||
(tt3 * delr[2][1]) -
|
||||
(delr[0][1] * rinvmag[2] * rinvmag[0]));
|
||||
dthetadr[2][1][2] = -sc1 * ((tt1 * delr[0][2]) -
|
||||
(delr[2][2] * rinvmag[0] * rinvmag[2]) +
|
||||
(tt3 * delr[2][2]) -
|
||||
(delr[0][2] * rinvmag[2] * rinvmag[0]));
|
||||
dthetadr[2][3][0] = sc1 * ((tt3 * delr[2][0]) -
|
||||
(delr[0][0] * rinvmag[2] * rinvmag[0]));
|
||||
dthetadr[2][3][1] = sc1 * ((tt3 * delr[2][1]) -
|
||||
(delr[0][1] * rinvmag[2] * rinvmag[0]));
|
||||
dthetadr[2][3][2] = sc1 * ((tt3 * delr[2][2]) -
|
||||
(delr[0][2] * rinvmag[2] * rinvmag[0]));
|
||||
|
||||
// compute d( 1 / sin(theta))/dr
|
||||
// i = angle, j = atom, k = direction
|
||||
|
@ -352,8 +352,8 @@ void ImproperClass2::compute(int eflag, int vflag)
|
|||
for (i = 0; i < 3; i++) {
|
||||
cossin2 = -costheta[i] / sinsqtheta[i];
|
||||
for (j = 0; j < 4; j++)
|
||||
for (k = 0; k < 3; k++)
|
||||
dinvsth[i][j][k] = cossin2 * dthetadr[i][j][k];
|
||||
for (k = 0; k < 3; k++)
|
||||
dinvsth[i][j][k] = cossin2 * dthetadr[i][j][k];
|
||||
}
|
||||
|
||||
// compute d(1 / sin(theta) * |r_AB| * |r_CB| * |r_DB|)/dr
|
||||
|
@ -361,12 +361,12 @@ void ImproperClass2::compute(int eflag, int vflag)
|
|||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = 0; j < 3; j++) {
|
||||
dinvs3r[0][i][j] = (invstheta[1] * dinv3r[i][j]) +
|
||||
(inv3r * dinvsth[1][i][j]);
|
||||
dinvs3r[1][i][j] = (invstheta[2] * dinv3r[i][j]) +
|
||||
(inv3r * dinvsth[2][i][j]);
|
||||
dinvs3r[2][i][j] = (invstheta[0] * dinv3r[i][j]) +
|
||||
(inv3r * dinvsth[0][i][j]);
|
||||
dinvs3r[0][i][j] = (invstheta[1] * dinv3r[i][j]) +
|
||||
(inv3r * dinvsth[1][i][j]);
|
||||
dinvs3r[1][i][j] = (invstheta[2] * dinv3r[i][j]) +
|
||||
(inv3r * dinvsth[2][i][j]);
|
||||
dinvs3r[2][i][j] = (invstheta[0] * dinv3r[i][j]) +
|
||||
(inv3r * dinvsth[0][i][j]);
|
||||
}
|
||||
|
||||
// drCB(i,j,k), etc
|
||||
|
@ -390,12 +390,12 @@ void ImproperClass2::compute(int eflag, int vflag)
|
|||
|
||||
for (i = 0; i < 3; i++)
|
||||
for (j = 0; j < 4; j++) {
|
||||
cross(delr[1],drDB[i][j],rCBxdrDB);
|
||||
cross(drCB[i][j],delr[2],drCBxrDB);
|
||||
for (k = 0; k < 3; k++) dd[k] = rCBxdrDB[k] + drCBxrDB[k];
|
||||
dot1 = dot(dd,delr[0]);
|
||||
dot2 = dot(rCBxrDB,drAB[i][j]);
|
||||
fdot[0][j][i] = dot1 + dot2;
|
||||
cross(delr[1],drDB[i][j],rCBxdrDB);
|
||||
cross(drCB[i][j],delr[2],drCBxrDB);
|
||||
for (k = 0; k < 3; k++) dd[k] = rCBxdrDB[k] + drCBxrDB[k];
|
||||
dot1 = dot(dd,delr[0]);
|
||||
dot2 = dot(rCBxrDB,drAB[i][j]);
|
||||
fdot[0][j][i] = dot1 + dot2;
|
||||
}
|
||||
|
||||
// d((r_DB x r_AB) dot r_CB)
|
||||
|
@ -407,12 +407,12 @@ void ImproperClass2::compute(int eflag, int vflag)
|
|||
|
||||
for (i = 0; i < 3; i++)
|
||||
for (j = 0; j < 4; j++) {
|
||||
cross(delr[2],drAB[i][j],rDBxdrAB);
|
||||
cross(drDB[i][j],delr[0],drDBxrAB);
|
||||
for (k = 0; k < 3; k++) dd[k] = rDBxdrAB[k] + drDBxrAB[k];
|
||||
dot1 = dot(dd,delr[1]);
|
||||
dot2 = dot(rDBxrAB,drCB[i][j]);
|
||||
fdot[1][j][i] = dot1 + dot2;
|
||||
cross(delr[2],drAB[i][j],rDBxdrAB);
|
||||
cross(drDB[i][j],delr[0],drDBxrAB);
|
||||
for (k = 0; k < 3; k++) dd[k] = rDBxdrAB[k] + drDBxrAB[k];
|
||||
dot1 = dot(dd,delr[1]);
|
||||
dot2 = dot(rDBxrAB,drCB[i][j]);
|
||||
fdot[1][j][i] = dot1 + dot2;
|
||||
}
|
||||
|
||||
// d((r_AB x r_CB) dot r_DB)
|
||||
|
@ -424,33 +424,33 @@ void ImproperClass2::compute(int eflag, int vflag)
|
|||
|
||||
for (i = 0; i < 3; i++)
|
||||
for (j = 0; j < 4; j++) {
|
||||
cross(delr[0],drCB[i][j],rABxdrCB);
|
||||
cross(drAB[i][j],delr[1],drABxrCB);
|
||||
for (k = 0; k < 3; k++) dd[k] = rABxdrCB[k] + drABxrCB[k];
|
||||
dot1 = dot(dd,delr[2]);
|
||||
dot2 = dot(rABxrCB,drDB[i][j]);
|
||||
fdot[2][j][i] = dot1 + dot2;
|
||||
cross(delr[0],drCB[i][j],rABxdrCB);
|
||||
cross(drAB[i][j],delr[1],drABxrCB);
|
||||
for (k = 0; k < 3; k++) dd[k] = rABxdrCB[k] + drABxrCB[k];
|
||||
dot1 = dot(dd,delr[2]);
|
||||
dot2 = dot(rABxrCB,drDB[i][j]);
|
||||
fdot[2][j][i] = dot1 + dot2;
|
||||
}
|
||||
|
||||
// force on each atom
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = 0; j < 3; j++) {
|
||||
ftmp = (fdot[0][i][j] * invs3r[0]) +
|
||||
(dinvs3r[0][i][j] * dotCBDBAB);
|
||||
dchi[0][i][j] = ftmp / cos(chiABCD);
|
||||
ftmp = (fdot[1][i][j] * invs3r[1]) +
|
||||
(dinvs3r[1][i][j] * dotDBABCB);
|
||||
dchi[1][i][j] = ftmp / cos(chiCBDA);
|
||||
ftmp = (fdot[2][i][j] * invs3r[2]) +
|
||||
(dinvs3r[2][i][j] * dotABCBDB);
|
||||
dchi[2][i][j] = ftmp / cos(chiDBAC);
|
||||
dtotalchi[i][j] = (dchi[0][i][j]+dchi[1][i][j]+dchi[2][i][j]) / 3.0;
|
||||
ftmp = (fdot[0][i][j] * invs3r[0]) +
|
||||
(dinvs3r[0][i][j] * dotCBDBAB);
|
||||
dchi[0][i][j] = ftmp / cos(chiABCD);
|
||||
ftmp = (fdot[1][i][j] * invs3r[1]) +
|
||||
(dinvs3r[1][i][j] * dotDBABCB);
|
||||
dchi[1][i][j] = ftmp / cos(chiCBDA);
|
||||
ftmp = (fdot[2][i][j] * invs3r[2]) +
|
||||
(dinvs3r[2][i][j] * dotABCBDB);
|
||||
dchi[2][i][j] = ftmp / cos(chiDBAC);
|
||||
dtotalchi[i][j] = (dchi[0][i][j]+dchi[1][i][j]+dchi[2][i][j]) / 3.0;
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = 0; j < 3; j++)
|
||||
fabcd[i][j] = -2.0*k0[type] * deltachi*dtotalchi[i][j];
|
||||
fabcd[i][j] = -2.0*k0[type] * deltachi*dtotalchi[i][j];
|
||||
|
||||
// apply force to each of 4 atoms
|
||||
|
||||
|
@ -480,11 +480,11 @@ void ImproperClass2::compute(int eflag, int vflag)
|
|||
|
||||
if (evflag)
|
||||
ev_tally(i1,i2,i3,i4,nlocal,newton_bond,eimproper,
|
||||
fabcd[0],fabcd[2],fabcd[3],
|
||||
delr[0][0],delr[0][1],delr[0][2],
|
||||
delr[1][0],delr[1][1],delr[1][2],
|
||||
delr[2][0]-delr[1][0],delr[2][1]-delr[1][1],
|
||||
delr[2][2]-delr[1][2]);
|
||||
fabcd[0],fabcd[2],fabcd[3],
|
||||
delr[0][0],delr[0][1],delr[0][2],
|
||||
delr[1][0],delr[1][1],delr[1][2],
|
||||
delr[2][0]-delr[1][0],delr[2][1]-delr[1][1],
|
||||
delr[2][2]-delr[1][2]);
|
||||
}
|
||||
|
||||
// compute angle-angle interactions
|
||||
|
@ -541,7 +541,7 @@ void ImproperClass2::coeff(int narg, char **arg)
|
|||
double theta0_1_one = force->numeric(arg[5]);
|
||||
double theta0_2_one = force->numeric(arg[6]);
|
||||
double theta0_3_one = force->numeric(arg[7]);
|
||||
|
||||
|
||||
// convert theta0's from degrees to radians
|
||||
|
||||
for (int i = ilo; i <= ihi; i++) {
|
||||
|
@ -578,7 +578,7 @@ void ImproperClass2::coeff(int narg, char **arg)
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes out coeffs to restart file
|
||||
proc 0 writes out coeffs to restart file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ImproperClass2::write_restart(FILE *fp)
|
||||
|
@ -595,7 +595,7 @@ void ImproperClass2::write_restart(FILE *fp)
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 reads coeffs from restart file, bcasts them
|
||||
proc 0 reads coeffs from restart file, bcasts them
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ImproperClass2::read_restart(FILE *fp)
|
||||
|
@ -681,7 +681,7 @@ void ImproperClass2::angleangle(int eflag, int vflag)
|
|||
rBC = sqrt(rBCmag2);
|
||||
rBDmag2 = delxBD*delxBD + delyBD*delyBD + delzBD*delzBD;
|
||||
rBD = sqrt(rBDmag2);
|
||||
|
||||
|
||||
// angle ABC, ABD, CBD
|
||||
|
||||
costhABC = (delxAB*delxBC + delyAB*delyBC + delzAB*delzBC) / (rAB * rBC);
|
||||
|
@ -705,17 +705,17 @@ void ImproperClass2::angleangle(int eflag, int vflag)
|
|||
|
||||
// energy
|
||||
|
||||
if (eflag) eimproper = aa_k2[type] * dthABC * dthABD +
|
||||
aa_k1[type] * dthABC * dthCBD +
|
||||
aa_k3[type] * dthABD * dthCBD;
|
||||
if (eflag) eimproper = aa_k2[type] * dthABC * dthABD +
|
||||
aa_k1[type] * dthABC * dthCBD +
|
||||
aa_k3[type] * dthABD * dthCBD;
|
||||
|
||||
// d(theta)/d(r) array
|
||||
// angle i, atom j, coordinate k
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
for (j = 0; j < 4; j++)
|
||||
for (k = 0; k < 3; k++)
|
||||
dthetadr[i][j][k] = 0.0;
|
||||
for (k = 0; k < 3; k++)
|
||||
dthetadr[i][j][k] = 0.0;
|
||||
|
||||
// angle ABC
|
||||
|
||||
|
@ -728,11 +728,11 @@ void ImproperClass2::angleangle(int eflag, int vflag)
|
|||
dthetadr[0][0][1] = sc1 * ((t1 * delyAB) - (delyBC * r12));
|
||||
dthetadr[0][0][2] = sc1 * ((t1 * delzAB) - (delzBC * r12));
|
||||
dthetadr[0][1][0] = sc1 * ((-t1 * delxAB) + (delxBC * r12) +
|
||||
(-t3 * delxBC) + (delxAB * r12));
|
||||
(-t3 * delxBC) + (delxAB * r12));
|
||||
dthetadr[0][1][1] = sc1 * ((-t1 * delyAB) + (delyBC * r12) +
|
||||
(-t3 * delyBC) + (delyAB * r12));
|
||||
(-t3 * delyBC) + (delyAB * r12));
|
||||
dthetadr[0][1][2] = sc1 * ((-t1 * delzAB) + (delzBC * r12) +
|
||||
(-t3 * delzBC) + (delzAB * r12));
|
||||
(-t3 * delzBC) + (delzAB * r12));
|
||||
dthetadr[0][2][0] = sc1 * ((t3 * delxBC) - (delxAB * r12));
|
||||
dthetadr[0][2][1] = sc1 * ((t3 * delyBC) - (delyAB * r12));
|
||||
dthetadr[0][2][2] = sc1 * ((t3 * delzBC) - (delzAB * r12));
|
||||
|
@ -748,11 +748,11 @@ void ImproperClass2::angleangle(int eflag, int vflag)
|
|||
dthetadr[1][2][1] = sc1 * ((t1 * delyBC) - (delyBD * r12));
|
||||
dthetadr[1][2][2] = sc1 * ((t1 * delzBC) - (delzBD * r12));
|
||||
dthetadr[1][1][0] = sc1 * ((-t1 * delxBC) + (delxBD * r12) +
|
||||
(-t3 * delxBD) + (delxBC * r12));
|
||||
(-t3 * delxBD) + (delxBC * r12));
|
||||
dthetadr[1][1][1] = sc1 * ((-t1 * delyBC) + (delyBD * r12) +
|
||||
(-t3 * delyBD) + (delyBC * r12));
|
||||
(-t3 * delyBD) + (delyBC * r12));
|
||||
dthetadr[1][1][2] = sc1 * ((-t1 * delzBC) + (delzBD * r12) +
|
||||
(-t3 * delzBD) + (delzBC * r12));
|
||||
(-t3 * delzBD) + (delzBC * r12));
|
||||
dthetadr[1][3][0] = sc1 * ((t3 * delxBD) - (delxBC * r12));
|
||||
dthetadr[1][3][1] = sc1 * ((t3 * delyBD) - (delyBC * r12));
|
||||
dthetadr[1][3][2] = sc1 * ((t3 * delzBD) - (delzBC * r12));
|
||||
|
@ -768,11 +768,11 @@ void ImproperClass2::angleangle(int eflag, int vflag)
|
|||
dthetadr[2][0][1] = sc1 * ((t1 * delyAB) - (delyBD * r12));
|
||||
dthetadr[2][0][2] = sc1 * ((t1 * delzAB) - (delzBD * r12));
|
||||
dthetadr[2][1][0] = sc1 * ((-t1 * delxAB) + (delxBD * r12) +
|
||||
(-t3 * delxBD) + (delxAB * r12));
|
||||
(-t3 * delxBD) + (delxAB * r12));
|
||||
dthetadr[2][1][1] = sc1 * ((-t1 * delyAB) + (delyBD * r12) +
|
||||
(-t3 * delyBD) + (delyAB * r12));
|
||||
(-t3 * delyBD) + (delyAB * r12));
|
||||
dthetadr[2][1][2] = sc1 * ((-t1 * delzAB) + (delzBD * r12) +
|
||||
(-t3 * delzBD) + (delzAB * r12));
|
||||
(-t3 * delzBD) + (delzAB * r12));
|
||||
dthetadr[2][3][0] = sc1 * ((t3 * delxBD) - (delxAB * r12));
|
||||
dthetadr[2][3][1] = sc1 * ((t3 * delyBD) - (delyAB * r12));
|
||||
dthetadr[2][3][2] = sc1 * ((t3 * delzBD) - (delzAB * r12));
|
||||
|
@ -781,13 +781,13 @@ void ImproperClass2::angleangle(int eflag, int vflag)
|
|||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = 0; j < 3; j++)
|
||||
fabcd[i][j] = -
|
||||
((aa_k1[type] *
|
||||
(dthABC*dthetadr[1][i][j] + dthCBD*dthetadr[0][i][j])) +
|
||||
(aa_k2[type] *
|
||||
(dthABC*dthetadr[2][i][j] + dthABD*dthetadr[0][i][j])) +
|
||||
(aa_k3[type] *
|
||||
(dthABD*dthetadr[1][i][j] + dthCBD*dthetadr[2][i][j])));
|
||||
fabcd[i][j] = -
|
||||
((aa_k1[type] *
|
||||
(dthABC*dthetadr[1][i][j] + dthCBD*dthetadr[0][i][j])) +
|
||||
(aa_k2[type] *
|
||||
(dthABC*dthetadr[2][i][j] + dthABD*dthetadr[0][i][j])) +
|
||||
(aa_k3[type] *
|
||||
(dthABD*dthetadr[1][i][j] + dthCBD*dthetadr[2][i][j])));
|
||||
|
||||
// apply force to each of 4 atoms
|
||||
|
||||
|
@ -817,8 +817,8 @@ void ImproperClass2::angleangle(int eflag, int vflag)
|
|||
|
||||
if (evflag)
|
||||
ev_tally(i1,i2,i3,i4,nlocal,newton_bond,eimproper,
|
||||
fabcd[0],fabcd[2],fabcd[3],
|
||||
delxAB,delyAB,delzAB,delxBC,delyBC,delzBC,delxBD,delyBD,delzBD);
|
||||
fabcd[0],fabcd[2],fabcd[3],
|
||||
delxAB,delyAB,delzAB,delxBC,delyBC,delzBC,delxBD,delyBD,delzBD);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -73,7 +73,7 @@ void PairLJClass2::compute(int eflag, int vflag)
|
|||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
|
||||
|
||||
// loop over neighbors of my atoms
|
||||
|
||||
for (ii = 0; ii < inum; ii++) {
|
||||
|
@ -97,30 +97,30 @@ void PairLJClass2::compute(int eflag, int vflag)
|
|||
jtype = type[j];
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r2inv = 1.0/rsq;
|
||||
rinv = sqrt(r2inv);
|
||||
r3inv = r2inv*rinv;
|
||||
r6inv = r3inv*r3inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]);
|
||||
fpair = factor_lj*forcelj*r2inv;
|
||||
r2inv = 1.0/rsq;
|
||||
rinv = sqrt(r2inv);
|
||||
r3inv = r2inv*rinv;
|
||||
r6inv = r3inv*r3inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]);
|
||||
fpair = factor_lj*forcelj*r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
}
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
}
|
||||
|
||||
if (eflag) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r3inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
}
|
||||
if (eflag) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r3inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
||||
evdwl,0.0,fpair,delx,dely,delz);
|
||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
||||
evdwl,0.0,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ void PairLJClass2::compute(int eflag, int vflag)
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
allocate all arrays
|
||||
allocate all arrays
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJClass2::allocate()
|
||||
|
@ -155,7 +155,7 @@ void PairLJClass2::allocate()
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
global settings
|
||||
global settings
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJClass2::settings(int narg, char **arg)
|
||||
|
@ -170,7 +170,7 @@ void PairLJClass2::settings(int narg, char **arg)
|
|||
int i,j;
|
||||
for (i = 1; i <= atom->ntypes; i++)
|
||||
for (j = i+1; j <= atom->ntypes; j++)
|
||||
if (setflag[i][j]) cut[i][j] = cut_global;
|
||||
if (setflag[i][j]) cut[i][j] = cut_global;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,9 +218,9 @@ double PairLJClass2::init_one(int i, int j)
|
|||
|
||||
if (setflag[i][j] == 0) {
|
||||
epsilon[i][j] = 2.0 * sqrt(epsilon[i][i]*epsilon[j][j]) *
|
||||
pow(sigma[i][i],3.0) * pow(sigma[j][j],3.0) /
|
||||
pow(sigma[i][i],3.0) * pow(sigma[j][j],3.0) /
|
||||
(pow(sigma[i][i],6.0) + pow(sigma[j][j],6.0));
|
||||
sigma[i][j] =
|
||||
sigma[i][j] =
|
||||
pow((0.5 * (pow(sigma[i][i],6.0) + pow(sigma[j][j],6.0))),1.0/6.0);
|
||||
cut[i][j] = mix_distance(cut[i][i],cut[j][j]);
|
||||
}
|
||||
|
@ -255,22 +255,22 @@ double PairLJClass2::init_one(int i, int j)
|
|||
if (type[k] == j) count[1] += 1.0;
|
||||
}
|
||||
MPI_Allreduce(count,all,2,MPI_DOUBLE,MPI_SUM,world);
|
||||
|
||||
|
||||
double sig3 = sigma[i][j]*sigma[i][j]*sigma[i][j];
|
||||
double sig6 = sig3*sig3;
|
||||
double rc3 = cut[i][j]*cut[i][j]*cut[i][j];
|
||||
double rc6 = rc3*rc3;
|
||||
etail_ij = 2.0*MY_PI*all[0]*all[1]*epsilon[i][j] *
|
||||
sig6 * (sig3 - 3.0*rc3) / (3.0*rc6);
|
||||
ptail_ij = 2.0*MY_PI*all[0]*all[1]*epsilon[i][j] *
|
||||
ptail_ij = 2.0*MY_PI*all[0]*all[1]*epsilon[i][j] *
|
||||
sig6 * (sig3 - 2.0*rc3) / rc6;
|
||||
}
|
||||
}
|
||||
|
||||
return cut[i][j];
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to restart file
|
||||
proc 0 writes to restart file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJClass2::write_restart(FILE *fp)
|
||||
|
@ -282,9 +282,9 @@ void PairLJClass2::write_restart(FILE *fp)
|
|||
for (j = i; j <= atom->ntypes; j++) {
|
||||
fwrite(&setflag[i][j],sizeof(int),1,fp);
|
||||
if (setflag[i][j]) {
|
||||
fwrite(&epsilon[i][j],sizeof(double),1,fp);
|
||||
fwrite(&sigma[i][j],sizeof(double),1,fp);
|
||||
fwrite(&cut[i][j],sizeof(double),1,fp);
|
||||
fwrite(&epsilon[i][j],sizeof(double),1,fp);
|
||||
fwrite(&sigma[i][j],sizeof(double),1,fp);
|
||||
fwrite(&cut[i][j],sizeof(double),1,fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -305,14 +305,14 @@ void PairLJClass2::read_restart(FILE *fp)
|
|||
if (me == 0) fread(&setflag[i][j],sizeof(int),1,fp);
|
||||
MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world);
|
||||
if (setflag[i][j]) {
|
||||
if (me == 0) {
|
||||
fread(&epsilon[i][j],sizeof(double),1,fp);
|
||||
fread(&sigma[i][j],sizeof(double),1,fp);
|
||||
fread(&cut[i][j],sizeof(double),1,fp);
|
||||
}
|
||||
MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world);
|
||||
if (me == 0) {
|
||||
fread(&epsilon[i][j],sizeof(double),1,fp);
|
||||
fread(&sigma[i][j],sizeof(double),1,fp);
|
||||
fread(&cut[i][j],sizeof(double),1,fp);
|
||||
}
|
||||
MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -348,8 +348,8 @@ void PairLJClass2::read_restart_settings(FILE *fp)
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairLJClass2::single(int i, int j, int itype, int jtype, double rsq,
|
||||
double factor_coul, double factor_lj,
|
||||
double &fforce)
|
||||
double factor_coul, double factor_lj,
|
||||
double &fforce)
|
||||
{
|
||||
double r2inv,rinv,r3inv,r6inv,forcelj,philj;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -81,7 +81,7 @@ void PairLJClass2CoulCut::compute(int eflag, int vflag)
|
|||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
|
||||
|
||||
// loop over neighbors of my atoms
|
||||
|
||||
for (ii = 0; ii < inum; ii++) {
|
||||
|
@ -107,43 +107,43 @@ void PairLJClass2CoulCut::compute(int eflag, int vflag)
|
|||
jtype = type[j];
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r2inv = 1.0/rsq;
|
||||
r2inv = 1.0/rsq;
|
||||
|
||||
if (rsq < cut_coulsq[itype][jtype])
|
||||
forcecoul = qqrd2e * qtmp*q[j]*sqrt(r2inv);
|
||||
else forcecoul = 0.0;
|
||||
if (rsq < cut_coulsq[itype][jtype])
|
||||
forcecoul = qqrd2e * qtmp*q[j]*sqrt(r2inv);
|
||||
else forcecoul = 0.0;
|
||||
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
rinv = sqrt(r2inv);
|
||||
r3inv = r2inv*rinv;
|
||||
r6inv = r3inv*r3inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]);
|
||||
} else forcelj = 0.0;
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
rinv = sqrt(r2inv);
|
||||
r3inv = r2inv*rinv;
|
||||
r6inv = r3inv*r3inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]);
|
||||
} else forcelj = 0.0;
|
||||
|
||||
fpair = (factor_coul*forcecoul + factor_lj*forcelj) * r2inv;
|
||||
fpair = (factor_coul*forcecoul + factor_lj*forcelj) * r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
}
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
}
|
||||
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq[itype][jtype])
|
||||
ecoul = factor_coul * qqrd2e * qtmp*q[j]*sqrt(r2inv);
|
||||
else ecoul = 0.0;
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r3inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
} else evdwl = 0.0;
|
||||
}
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq[itype][jtype])
|
||||
ecoul = factor_coul * qqrd2e * qtmp*q[j]*sqrt(r2inv);
|
||||
else ecoul = 0.0;
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r3inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
} else evdwl = 0.0;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
||||
evdwl,ecoul,fpair,delx,dely,delz);
|
||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
||||
evdwl,ecoul,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ void PairLJClass2CoulCut::compute(int eflag, int vflag)
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
allocate all arrays
|
||||
allocate all arrays
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJClass2CoulCut::allocate()
|
||||
|
@ -181,7 +181,7 @@ void PairLJClass2CoulCut::allocate()
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
global settings
|
||||
global settings
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJClass2CoulCut::settings(int narg, char **arg)
|
||||
|
@ -198,10 +198,10 @@ void PairLJClass2CoulCut::settings(int narg, char **arg)
|
|||
int i,j;
|
||||
for (i = 1; i <= atom->ntypes; i++)
|
||||
for (j = i+1; j <= atom->ntypes; j++)
|
||||
if (setflag[i][j]) {
|
||||
cut_lj[i][j] = cut_lj_global;
|
||||
cut_coul[i][j] = cut_coul_global;
|
||||
}
|
||||
if (setflag[i][j]) {
|
||||
cut_lj[i][j] = cut_lj_global;
|
||||
cut_coul[i][j] = cut_coul_global;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,9 +264,9 @@ double PairLJClass2CoulCut::init_one(int i, int j)
|
|||
|
||||
if (setflag[i][j] == 0) {
|
||||
epsilon[i][j] = 2.0 * sqrt(epsilon[i][i]*epsilon[j][j]) *
|
||||
pow(sigma[i][i],3.0) * pow(sigma[j][j],3.0) /
|
||||
pow(sigma[i][i],3.0) * pow(sigma[j][j],3.0) /
|
||||
(pow(sigma[i][i],6.0) + pow(sigma[j][j],6.0));
|
||||
sigma[i][j] =
|
||||
sigma[i][j] =
|
||||
pow((0.5 * (pow(sigma[i][i],6.0) + pow(sigma[j][j],6.0))),1.0/6.0);
|
||||
cut_lj[i][j] = mix_distance(cut_lj[i][i],cut_lj[j][j]);
|
||||
cut_coul[i][j] = mix_distance(cut_coul[i][i],cut_coul[j][j]);
|
||||
|
@ -308,22 +308,22 @@ double PairLJClass2CoulCut::init_one(int i, int j)
|
|||
if (type[k] == j) count[1] += 1.0;
|
||||
}
|
||||
MPI_Allreduce(count,all,2,MPI_DOUBLE,MPI_SUM,world);
|
||||
|
||||
|
||||
double sig3 = sigma[i][j]*sigma[i][j]*sigma[i][j];
|
||||
double sig6 = sig3*sig3;
|
||||
double rc3 = cut_lj[i][j]*cut_lj[i][j]*cut_lj[i][j];
|
||||
double rc6 = rc3*rc3;
|
||||
etail_ij = 2.0*MY_PI*all[0]*all[1]*epsilon[i][j] *
|
||||
sig6 * (sig3 - 3.0*rc3) / (3.0*rc6);
|
||||
ptail_ij = 2.0*MY_PI*all[0]*all[1]*epsilon[i][j] *
|
||||
ptail_ij = 2.0*MY_PI*all[0]*all[1]*epsilon[i][j] *
|
||||
sig6 * (sig3 - 2.0*rc3) / rc6;
|
||||
}
|
||||
}
|
||||
|
||||
return cut;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to restart file
|
||||
proc 0 writes to restart file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJClass2CoulCut::write_restart(FILE *fp)
|
||||
|
@ -335,10 +335,10 @@ void PairLJClass2CoulCut::write_restart(FILE *fp)
|
|||
for (j = i; j <= atom->ntypes; j++) {
|
||||
fwrite(&setflag[i][j],sizeof(int),1,fp);
|
||||
if (setflag[i][j]) {
|
||||
fwrite(&epsilon[i][j],sizeof(double),1,fp);
|
||||
fwrite(&sigma[i][j],sizeof(double),1,fp);
|
||||
fwrite(&cut_lj[i][j],sizeof(double),1,fp);
|
||||
fwrite(&cut_coul[i][j],sizeof(double),1,fp);
|
||||
fwrite(&epsilon[i][j],sizeof(double),1,fp);
|
||||
fwrite(&sigma[i][j],sizeof(double),1,fp);
|
||||
fwrite(&cut_lj[i][j],sizeof(double),1,fp);
|
||||
fwrite(&cut_coul[i][j],sizeof(double),1,fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -359,16 +359,16 @@ void PairLJClass2CoulCut::read_restart(FILE *fp)
|
|||
if (me == 0) fread(&setflag[i][j],sizeof(int),1,fp);
|
||||
MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world);
|
||||
if (setflag[i][j]) {
|
||||
if (me == 0) {
|
||||
fread(&epsilon[i][j],sizeof(double),1,fp);
|
||||
fread(&sigma[i][j],sizeof(double),1,fp);
|
||||
fread(&cut_lj[i][j],sizeof(double),1,fp);
|
||||
fread(&cut_coul[i][j],sizeof(double),1,fp);
|
||||
}
|
||||
MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut_lj[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut_coul[i][j],1,MPI_DOUBLE,0,world);
|
||||
if (me == 0) {
|
||||
fread(&epsilon[i][j],sizeof(double),1,fp);
|
||||
fread(&sigma[i][j],sizeof(double),1,fp);
|
||||
fread(&cut_lj[i][j],sizeof(double),1,fp);
|
||||
fread(&cut_coul[i][j],sizeof(double),1,fp);
|
||||
}
|
||||
MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut_lj[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut_coul[i][j],1,MPI_DOUBLE,0,world);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -406,9 +406,9 @@ void PairLJClass2CoulCut::read_restart_settings(FILE *fp)
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairLJClass2CoulCut::single(int i, int j, int itype, int jtype,
|
||||
double rsq,
|
||||
double factor_coul, double factor_lj,
|
||||
double &fforce)
|
||||
double rsq,
|
||||
double factor_coul, double factor_lj,
|
||||
double &fforce)
|
||||
{
|
||||
double r2inv,rinv,r3inv,r6inv,forcecoul,forcelj,phicoul,philj;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -90,7 +90,7 @@ void PairLJClass2CoulLong::compute(int eflag, int vflag)
|
|||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
|
||||
|
||||
// loop over neighbors of my atoms
|
||||
|
||||
for (ii = 0; ii < inum; ii++) {
|
||||
|
@ -116,51 +116,51 @@ void PairLJClass2CoulLong::compute(int eflag, int vflag)
|
|||
jtype = type[j];
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r2inv = 1.0/rsq;
|
||||
r2inv = 1.0/rsq;
|
||||
|
||||
if (rsq < cut_coulsq) {
|
||||
r = sqrt(rsq);
|
||||
grij = g_ewald * r;
|
||||
expm2 = exp(-grij*grij);
|
||||
t = 1.0 / (1.0 + EWALD_P*grij);
|
||||
erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2;
|
||||
prefactor = qqrd2e * qtmp*q[j]/r;
|
||||
forcecoul = prefactor * (erfc + EWALD_F*grij*expm2);
|
||||
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else forcecoul = 0.0;
|
||||
if (rsq < cut_coulsq) {
|
||||
r = sqrt(rsq);
|
||||
grij = g_ewald * r;
|
||||
expm2 = exp(-grij*grij);
|
||||
t = 1.0 / (1.0 + EWALD_P*grij);
|
||||
erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2;
|
||||
prefactor = qqrd2e * qtmp*q[j]/r;
|
||||
forcecoul = prefactor * (erfc + EWALD_F*grij*expm2);
|
||||
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else forcecoul = 0.0;
|
||||
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
rinv = sqrt(r2inv);
|
||||
r3inv = r2inv*rinv;
|
||||
r6inv = r3inv*r3inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]);
|
||||
} else forcelj = 0.0;
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
rinv = sqrt(r2inv);
|
||||
r3inv = r2inv*rinv;
|
||||
r6inv = r3inv*r3inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]);
|
||||
} else forcelj = 0.0;
|
||||
|
||||
fpair = (forcecoul + factor_lj*forcelj) * r2inv;
|
||||
fpair = (forcecoul + factor_lj*forcelj) * r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
}
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
}
|
||||
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq) {
|
||||
ecoul = prefactor*erfc;
|
||||
if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else ecoul = 0.0;
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r3inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
} else evdwl = 0.0;
|
||||
}
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq) {
|
||||
ecoul = prefactor*erfc;
|
||||
if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else ecoul = 0.0;
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r3inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
} else evdwl = 0.0;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
||||
evdwl,ecoul,fpair,delx,dely,delz);
|
||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
||||
evdwl,ecoul,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ void PairLJClass2CoulLong::compute(int eflag, int vflag)
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
allocate all arrays
|
||||
allocate all arrays
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJClass2CoulLong::allocate()
|
||||
|
@ -196,7 +196,7 @@ void PairLJClass2CoulLong::allocate()
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
global settings
|
||||
global settings
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJClass2CoulLong::settings(int narg, char **arg)
|
||||
|
@ -213,7 +213,7 @@ void PairLJClass2CoulLong::settings(int narg, char **arg)
|
|||
int i,j;
|
||||
for (i = 1; i <= atom->ntypes; i++)
|
||||
for (j = i+1; j <= atom->ntypes; j++)
|
||||
if (setflag[i][j]) cut_lj[i][j] = cut_lj_global;
|
||||
if (setflag[i][j]) cut_lj[i][j] = cut_lj_global;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,7 @@ void PairLJClass2CoulLong::init_style()
|
|||
|
||||
// insure use of KSpace long-range solver, set g_ewald
|
||||
|
||||
if (force->kspace == NULL)
|
||||
if (force->kspace == NULL)
|
||||
error->all(FLERR,"Pair style is incompatible with KSpace style");
|
||||
g_ewald = force->kspace->g_ewald;
|
||||
}
|
||||
|
@ -281,9 +281,9 @@ double PairLJClass2CoulLong::init_one(int i, int j)
|
|||
|
||||
if (setflag[i][j] == 0) {
|
||||
epsilon[i][j] = 2.0 * sqrt(epsilon[i][i]*epsilon[j][j]) *
|
||||
pow(sigma[i][i],3.0) * pow(sigma[j][j],3.0) /
|
||||
pow(sigma[i][i],3.0) * pow(sigma[j][j],3.0) /
|
||||
(pow(sigma[i][i],6.0) + pow(sigma[j][j],6.0));
|
||||
sigma[i][j] =
|
||||
sigma[i][j] =
|
||||
pow((0.5 * (pow(sigma[i][i],6.0) + pow(sigma[j][j],6.0))),1.0/6.0);
|
||||
cut_lj[i][j] = mix_distance(cut_lj[i][i],cut_lj[j][j]);
|
||||
}
|
||||
|
@ -322,22 +322,22 @@ double PairLJClass2CoulLong::init_one(int i, int j)
|
|||
if (type[k] == j) count[1] += 1.0;
|
||||
}
|
||||
MPI_Allreduce(count,all,2,MPI_DOUBLE,MPI_SUM,world);
|
||||
|
||||
|
||||
double sig3 = sigma[i][j]*sigma[i][j]*sigma[i][j];
|
||||
double sig6 = sig3*sig3;
|
||||
double rc3 = cut_lj[i][j]*cut_lj[i][j]*cut_lj[i][j];
|
||||
double rc6 = rc3*rc3;
|
||||
etail_ij = 2.0*MY_PI*all[0]*all[1]*epsilon[i][j] *
|
||||
sig6 * (sig3 - 3.0*rc3) / (3.0*rc6);
|
||||
ptail_ij = 2.0*MY_PI*all[0]*all[1]*epsilon[i][j] *
|
||||
ptail_ij = 2.0*MY_PI*all[0]*all[1]*epsilon[i][j] *
|
||||
sig6 * (sig3 - 2.0*rc3) / rc6;
|
||||
}
|
||||
}
|
||||
|
||||
return cut;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to restart file
|
||||
proc 0 writes to restart file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJClass2CoulLong::write_restart(FILE *fp)
|
||||
|
@ -349,9 +349,9 @@ void PairLJClass2CoulLong::write_restart(FILE *fp)
|
|||
for (j = i; j <= atom->ntypes; j++) {
|
||||
fwrite(&setflag[i][j],sizeof(int),1,fp);
|
||||
if (setflag[i][j]) {
|
||||
fwrite(&epsilon[i][j],sizeof(double),1,fp);
|
||||
fwrite(&sigma[i][j],sizeof(double),1,fp);
|
||||
fwrite(&cut_lj[i][j],sizeof(double),1,fp);
|
||||
fwrite(&epsilon[i][j],sizeof(double),1,fp);
|
||||
fwrite(&sigma[i][j],sizeof(double),1,fp);
|
||||
fwrite(&cut_lj[i][j],sizeof(double),1,fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -372,14 +372,14 @@ void PairLJClass2CoulLong::read_restart(FILE *fp)
|
|||
if (me == 0) fread(&setflag[i][j],sizeof(int),1,fp);
|
||||
MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world);
|
||||
if (setflag[i][j]) {
|
||||
if (me == 0) {
|
||||
fread(&epsilon[i][j],sizeof(double),1,fp);
|
||||
fread(&sigma[i][j],sizeof(double),1,fp);
|
||||
fread(&cut_lj[i][j],sizeof(double),1,fp);
|
||||
}
|
||||
MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut_lj[i][j],1,MPI_DOUBLE,0,world);
|
||||
if (me == 0) {
|
||||
fread(&epsilon[i][j],sizeof(double),1,fp);
|
||||
fread(&sigma[i][j],sizeof(double),1,fp);
|
||||
fread(&cut_lj[i][j],sizeof(double),1,fp);
|
||||
}
|
||||
MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut_lj[i][j],1,MPI_DOUBLE,0,world);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -417,9 +417,9 @@ void PairLJClass2CoulLong::read_restart_settings(FILE *fp)
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairLJClass2CoulLong::single(int i, int j, int itype, int jtype,
|
||||
double rsq,
|
||||
double factor_coul, double factor_lj,
|
||||
double &fforce)
|
||||
double rsq,
|
||||
double factor_coul, double factor_lj,
|
||||
double &fforce)
|
||||
{
|
||||
double r2inv,r,rinv,r3inv,r6inv,grij,expm2,t,erfc,prefactor;
|
||||
double forcecoul,forcelj,phicoul,philj;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -29,14 +29,14 @@ using namespace FixConst;
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixWallColloid::FixWallColloid(LAMMPS *lmp, int narg, char **arg) :
|
||||
FixWallColloid::FixWallColloid(LAMMPS *lmp, int narg, char **arg) :
|
||||
FixWall(lmp, narg, arg) {}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixWallColloid::init()
|
||||
{
|
||||
if (!atom->sphere_flag)
|
||||
if (!atom->sphere_flag)
|
||||
error->all(FLERR,"Fix wall/colloid requires atom style sphere");
|
||||
|
||||
// insure all particles in group are extended particles
|
||||
|
@ -101,8 +101,8 @@ void FixWallColloid::wall_particle(int m, int which, double coord)
|
|||
if (delta >= cutoff[m]) continue;
|
||||
rad = radius[i];
|
||||
if (rad >= delta) {
|
||||
onflag = 1;
|
||||
continue;
|
||||
onflag = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
new_coeff2 = coeff2[m]*rad*rad*rad;
|
||||
|
@ -116,9 +116,9 @@ void FixWallColloid::wall_particle(int m, int which, double coord)
|
|||
r4inv = r2inv*r2inv;
|
||||
r8inv = r4inv*r4inv;
|
||||
fwall = side * (coeff1[m]*(rad8*rad + 27.0*rad4*rad2*rad*pow(delta,2.0)
|
||||
+ 63.0*rad4*rad*pow(delta,4.0)
|
||||
+ 21.0*rad2*rad*pow(delta,6.0))*r8inv -
|
||||
new_coeff2*r2inv);
|
||||
+ 63.0*rad4*rad*pow(delta,4.0)
|
||||
+ 21.0*rad2*rad*pow(delta,6.0))*r8inv -
|
||||
new_coeff2*r2inv);
|
||||
f[i][dim] -= fwall;
|
||||
|
||||
r2 = rad - delta;
|
||||
|
@ -131,9 +131,9 @@ void FixWallColloid::wall_particle(int m, int which, double coord)
|
|||
r4inv3 = r2inv3*r2inv3;
|
||||
r6inv3 = r4inv3*r2inv3;
|
||||
ewall[0] += coeff3[m]*((-3.5*diam+delta)*r4inv2*r2inv2*rinv2
|
||||
+ (3.5*diam+delta)*r4inv3*r2inv3*rinv3) -
|
||||
coeff4[m]*((diam*delta-r2*r3*(log(-r2)-log(r3)))*
|
||||
(-rinv2)*rinv3);
|
||||
+ (3.5*diam+delta)*r4inv3*r2inv3*rinv3) -
|
||||
coeff4[m]*((diam*delta-r2*r3*(log(-r2)-log(r3)))*
|
||||
(-rinv2)*rinv3);
|
||||
|
||||
// offset depends on particle size
|
||||
|
||||
|
@ -147,9 +147,9 @@ void FixWallColloid::wall_particle(int m, int which, double coord)
|
|||
r4inv3 = r2inv3*r2inv3;
|
||||
r6inv3 = r4inv3*r2inv3;
|
||||
eoffset = coeff3[m]*((-3.5*diam+cutoff[m])*r4inv2*r2inv2*rinv2
|
||||
+ (3.5*diam+cutoff[m])*r4inv3*r2inv3*rinv3) -
|
||||
coeff4[m]*((diam*cutoff[m]-r2*r3*(log(-r2)-log(r3)))*
|
||||
(-rinv2)*rinv3);
|
||||
+ (3.5*diam+cutoff[m])*r4inv3*r2inv3*rinv3) -
|
||||
coeff4[m]*((diam*cutoff[m]-r2*r3*(log(-r2)-log(r3)))*
|
||||
(-rinv2)*rinv3);
|
||||
ewall[0] -= eoffset;
|
||||
|
||||
ewall[m+1] += fwall;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -50,7 +50,7 @@ PairColloid::~PairColloid()
|
|||
memory->destroy(a1);
|
||||
memory->destroy(a2);
|
||||
memory->destroy(diameter);
|
||||
memory->destroy(cut);
|
||||
memory->destroy(cut);
|
||||
memory->destroy(offset);
|
||||
memory->destroy(sigma3);
|
||||
memory->destroy(sigma6);
|
||||
|
@ -87,7 +87,7 @@ void PairColloid::compute(int eflag, int vflag)
|
|||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
|
||||
|
||||
// loop over neighbors of my atoms
|
||||
|
||||
for (ii = 0; ii < inum; ii++) {
|
||||
|
@ -103,7 +103,7 @@ void PairColloid::compute(int eflag, int vflag)
|
|||
j = jlist[jj];
|
||||
factor_lj = special_lj[sbmask(j)];
|
||||
j &= NEIGHMASK;
|
||||
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
|
@ -113,87 +113,87 @@ void PairColloid::compute(int eflag, int vflag)
|
|||
if (rsq >= cutsq[itype][jtype]) continue;
|
||||
|
||||
switch (form[itype][jtype]) {
|
||||
case SMALL_SMALL:
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
fpair = factor_lj*forcelj*r2inv;
|
||||
if (eflag) evdwl = r6inv*(r6inv*lj3[itype][jtype]-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
break;
|
||||
|
||||
case SMALL_SMALL:
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
fpair = factor_lj*forcelj*r2inv;
|
||||
if (eflag) evdwl = r6inv*(r6inv*lj3[itype][jtype]-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
break;
|
||||
|
||||
case SMALL_LARGE:
|
||||
c2 = a2[itype][jtype];
|
||||
K[1] = c2*c2;
|
||||
K[2] = rsq;
|
||||
K[0] = K[1] - rsq;
|
||||
K[4] = rsq*rsq;
|
||||
K[3] = K[1] - K[2];
|
||||
K[3] *= K[3]*K[3];
|
||||
K[6] = K[3]*K[3];
|
||||
fR = sigma3[itype][jtype]*a12[itype][jtype]*c2*K[1]/K[3];
|
||||
fpair = 4.0/15.0*fR*factor_lj *
|
||||
(2.0*(K[1]+K[2]) * (K[1]*(5.0*K[1]+22.0*K[2])+5.0*K[4]) *
|
||||
sigma6[itype][jtype]/K[6]-5.0) / K[0];
|
||||
if (eflag)
|
||||
evdwl = 2.0/9.0*fR *
|
||||
(1.0-(K[1]*(K[1]*(K[1]/3.0+3.0*K[2])+4.2*K[4])+K[2]*K[4]) *
|
||||
sigma6[itype][jtype]/K[6]) - offset[itype][jtype];
|
||||
if (rsq <= K[1]) error->one(FLERR,"Overlapping small/large in pair colloid");
|
||||
break;
|
||||
c2 = a2[itype][jtype];
|
||||
K[1] = c2*c2;
|
||||
K[2] = rsq;
|
||||
K[0] = K[1] - rsq;
|
||||
K[4] = rsq*rsq;
|
||||
K[3] = K[1] - K[2];
|
||||
K[3] *= K[3]*K[3];
|
||||
K[6] = K[3]*K[3];
|
||||
fR = sigma3[itype][jtype]*a12[itype][jtype]*c2*K[1]/K[3];
|
||||
fpair = 4.0/15.0*fR*factor_lj *
|
||||
(2.0*(K[1]+K[2]) * (K[1]*(5.0*K[1]+22.0*K[2])+5.0*K[4]) *
|
||||
sigma6[itype][jtype]/K[6]-5.0) / K[0];
|
||||
if (eflag)
|
||||
evdwl = 2.0/9.0*fR *
|
||||
(1.0-(K[1]*(K[1]*(K[1]/3.0+3.0*K[2])+4.2*K[4])+K[2]*K[4]) *
|
||||
sigma6[itype][jtype]/K[6]) - offset[itype][jtype];
|
||||
if (rsq <= K[1]) error->one(FLERR,"Overlapping small/large in pair colloid");
|
||||
break;
|
||||
|
||||
case LARGE_LARGE:
|
||||
r = sqrt(rsq);
|
||||
c1 = a1[itype][jtype];
|
||||
c2 = a2[itype][jtype];
|
||||
K[0] = c1*c2;
|
||||
K[1] = c1+c2;
|
||||
K[2] = c1-c2;
|
||||
K[3] = K[1]+r;
|
||||
K[4] = K[1]-r;
|
||||
K[5] = K[2]+r;
|
||||
K[6] = K[2]-r;
|
||||
K[7] = 1.0/(K[3]*K[4]);
|
||||
K[8] = 1.0/(K[5]*K[6]);
|
||||
g[0] = pow(K[3],-7.0);
|
||||
g[1] = pow(K[4],-7.0);
|
||||
g[2] = pow(K[5],-7.0);
|
||||
g[3] = pow(K[6],-7.0);
|
||||
h[0] = ((K[3]+5.0*K[1])*K[3]+30.0*K[0])*g[0];
|
||||
h[1] = ((K[4]+5.0*K[1])*K[4]+30.0*K[0])*g[1];
|
||||
h[2] = ((K[5]+5.0*K[2])*K[5]-30.0*K[0])*g[2];
|
||||
h[3] = ((K[6]+5.0*K[2])*K[6]-30.0*K[0])*g[3];
|
||||
g[0] *= 42.0*K[0]/K[3]+6.0*K[1]+K[3];
|
||||
g[1] *= 42.0*K[0]/K[4]+6.0*K[1]+K[4];
|
||||
g[2] *= -42.0*K[0]/K[5]+6.0*K[2]+K[5];
|
||||
g[3] *= -42.0*K[0]/K[6]+6.0*K[2]+K[6];
|
||||
|
||||
fR = a12[itype][jtype]*sigma6[itype][jtype]/r/37800.0;
|
||||
evdwl = fR * (h[0]-h[1]-h[2]+h[3]);
|
||||
dUR = evdwl/r + 5.0*fR*(g[0]+g[1]-g[2]-g[3]);
|
||||
dUA = -a12[itype][jtype]/3.0*r*((2.0*K[0]*K[7]+1.0)*K[7] +
|
||||
(2.0*K[0]*K[8]-1.0)*K[8]);
|
||||
fpair = factor_lj * (dUR+dUA)/r;
|
||||
if (eflag)
|
||||
evdwl += a12[itype][jtype]/6.0 *
|
||||
(2.0*K[0]*(K[7]+K[8])-log(K[8]/K[7])) - offset[itype][jtype];
|
||||
if (r <= K[1]) error->one(FLERR,"Overlapping large/large in pair colloid");
|
||||
break;
|
||||
r = sqrt(rsq);
|
||||
c1 = a1[itype][jtype];
|
||||
c2 = a2[itype][jtype];
|
||||
K[0] = c1*c2;
|
||||
K[1] = c1+c2;
|
||||
K[2] = c1-c2;
|
||||
K[3] = K[1]+r;
|
||||
K[4] = K[1]-r;
|
||||
K[5] = K[2]+r;
|
||||
K[6] = K[2]-r;
|
||||
K[7] = 1.0/(K[3]*K[4]);
|
||||
K[8] = 1.0/(K[5]*K[6]);
|
||||
g[0] = pow(K[3],-7.0);
|
||||
g[1] = pow(K[4],-7.0);
|
||||
g[2] = pow(K[5],-7.0);
|
||||
g[3] = pow(K[6],-7.0);
|
||||
h[0] = ((K[3]+5.0*K[1])*K[3]+30.0*K[0])*g[0];
|
||||
h[1] = ((K[4]+5.0*K[1])*K[4]+30.0*K[0])*g[1];
|
||||
h[2] = ((K[5]+5.0*K[2])*K[5]-30.0*K[0])*g[2];
|
||||
h[3] = ((K[6]+5.0*K[2])*K[6]-30.0*K[0])*g[3];
|
||||
g[0] *= 42.0*K[0]/K[3]+6.0*K[1]+K[3];
|
||||
g[1] *= 42.0*K[0]/K[4]+6.0*K[1]+K[4];
|
||||
g[2] *= -42.0*K[0]/K[5]+6.0*K[2]+K[5];
|
||||
g[3] *= -42.0*K[0]/K[6]+6.0*K[2]+K[6];
|
||||
|
||||
fR = a12[itype][jtype]*sigma6[itype][jtype]/r/37800.0;
|
||||
evdwl = fR * (h[0]-h[1]-h[2]+h[3]);
|
||||
dUR = evdwl/r + 5.0*fR*(g[0]+g[1]-g[2]-g[3]);
|
||||
dUA = -a12[itype][jtype]/3.0*r*((2.0*K[0]*K[7]+1.0)*K[7] +
|
||||
(2.0*K[0]*K[8]-1.0)*K[8]);
|
||||
fpair = factor_lj * (dUR+dUA)/r;
|
||||
if (eflag)
|
||||
evdwl += a12[itype][jtype]/6.0 *
|
||||
(2.0*K[0]*(K[7]+K[8])-log(K[8]/K[7])) - offset[itype][jtype];
|
||||
if (r <= K[1]) error->one(FLERR,"Overlapping large/large in pair colloid");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (eflag) evdwl *= factor_lj;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
||||
evdwl,0.0,fpair,delx,dely,delz);
|
||||
evdwl,0.0,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ void PairColloid::compute(int eflag, int vflag)
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
allocate all arrays
|
||||
allocate all arrays
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairColloid::allocate()
|
||||
|
@ -235,7 +235,7 @@ void PairColloid::allocate()
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
global settings
|
||||
global settings
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairColloid::settings(int narg, char **arg)
|
||||
|
@ -250,7 +250,7 @@ void PairColloid::settings(int narg, char **arg)
|
|||
int i,j;
|
||||
for (i = 1; i <= atom->ntypes; i++)
|
||||
for (j = i+1; j <= atom->ntypes; j++)
|
||||
if (setflag[i][j]) cut[i][j] = cut_global;
|
||||
if (setflag[i][j]) cut[i][j] = cut_global;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -275,7 +275,7 @@ void PairColloid::coeff(int narg, char **arg)
|
|||
double cut_one = cut_global;
|
||||
if (narg == 7) cut_one = force->numeric(arg[6]);
|
||||
|
||||
if (d1_one < 0.0 || d2_one < 0.0)
|
||||
if (d1_one < 0.0 || d2_one < 0.0)
|
||||
error->all(FLERR,"Invalid d1 or d2 value for pair colloid coeff");
|
||||
|
||||
int count = 0;
|
||||
|
@ -284,7 +284,7 @@ void PairColloid::coeff(int narg, char **arg)
|
|||
a12[i][j] = a12_one;
|
||||
sigma[i][j] = sigma_one;
|
||||
if (i == j && d1_one != d2_one)
|
||||
error->all(FLERR,"Invalid d1 or d2 value for pair colloid coeff");
|
||||
error->all(FLERR,"Invalid d1 or d2 value for pair colloid coeff");
|
||||
d1[i][j] = d1_one;
|
||||
d2[i][j] = d2_one;
|
||||
diameter[i][j] = 0.5*(d1_one+d2_one);
|
||||
|
@ -349,7 +349,7 @@ double PairColloid::init_one(int i, int j)
|
|||
offset[j][i] = offset[i][j] = 0.0;
|
||||
if (offset_flag) {
|
||||
double tmp;
|
||||
offset[j][i] = offset[i][j] =
|
||||
offset[j][i] = offset[i][j] =
|
||||
single(0,0,i,j,cut[i][j]*cut[i][j],0.0,1.0,tmp);
|
||||
}
|
||||
|
||||
|
@ -357,7 +357,7 @@ double PairColloid::init_one(int i, int j)
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to restart file
|
||||
proc 0 writes to restart file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairColloid::write_restart(FILE *fp)
|
||||
|
@ -369,11 +369,11 @@ void PairColloid::write_restart(FILE *fp)
|
|||
for (j = i; j <= atom->ntypes; j++) {
|
||||
fwrite(&setflag[i][j],sizeof(int),1,fp);
|
||||
if (setflag[i][j]) {
|
||||
fwrite(&a12[i][j],sizeof(double),1,fp);
|
||||
fwrite(&sigma[i][j],sizeof(double),1,fp);
|
||||
fwrite(&d1[i][j],sizeof(double),1,fp);
|
||||
fwrite(&d2[i][j],sizeof(double),1,fp);
|
||||
fwrite(&cut[i][j],sizeof(double),1,fp);
|
||||
fwrite(&a12[i][j],sizeof(double),1,fp);
|
||||
fwrite(&sigma[i][j],sizeof(double),1,fp);
|
||||
fwrite(&d1[i][j],sizeof(double),1,fp);
|
||||
fwrite(&d2[i][j],sizeof(double),1,fp);
|
||||
fwrite(&cut[i][j],sizeof(double),1,fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -394,18 +394,18 @@ void PairColloid::read_restart(FILE *fp)
|
|||
if (comm->me == 0) fread(&setflag[i][j],sizeof(int),1,fp);
|
||||
MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world);
|
||||
if (setflag[i][j]) {
|
||||
if (comm->me == 0) {
|
||||
fread(&a12[i][j],sizeof(double),1,fp);
|
||||
fread(&sigma[i][j],sizeof(double),1,fp);
|
||||
fread(&d1[i][j],sizeof(double),1,fp);
|
||||
fread(&d2[i][j],sizeof(double),1,fp);
|
||||
fread(&cut[i][j],sizeof(double),1,fp);
|
||||
}
|
||||
MPI_Bcast(&a12[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&d1[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&d2[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world);
|
||||
if (comm->me == 0) {
|
||||
fread(&a12[i][j],sizeof(double),1,fp);
|
||||
fread(&sigma[i][j],sizeof(double),1,fp);
|
||||
fread(&d1[i][j],sizeof(double),1,fp);
|
||||
fread(&d2[i][j],sizeof(double),1,fp);
|
||||
fread(&cut[i][j],sizeof(double),1,fp);
|
||||
}
|
||||
MPI_Bcast(&a12[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&d1[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&d2[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -441,8 +441,8 @@ void PairColloid::read_restart_settings(FILE *fp)
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairColloid::single(int i, int j, int itype, int jtype, double rsq,
|
||||
double factor_coul, double factor_lj,
|
||||
double &fforce)
|
||||
double factor_coul, double factor_lj,
|
||||
double &fforce)
|
||||
{
|
||||
double K[9],h[4],g[4];
|
||||
double r,r2inv,r6inv,forcelj,c1,c2,phi,fR,dUR,dUA;
|
||||
|
@ -467,11 +467,11 @@ double PairColloid::single(int i, int j, int itype, int jtype, double rsq,
|
|||
K[3] *= K[3]*K[3];
|
||||
K[6] = K[3]*K[3];
|
||||
fR = sigma3[itype][jtype]*a12[itype][jtype]*c2*K[1]/K[3];
|
||||
fforce = 4.0/15.0*fR*factor_lj *
|
||||
(2.0*(K[1]+K[2])*(K[1]*(5.0*K[1]+22.0*K[2])+5.0*K[4]) *
|
||||
fforce = 4.0/15.0*fR*factor_lj *
|
||||
(2.0*(K[1]+K[2])*(K[1]*(5.0*K[1]+22.0*K[2])+5.0*K[4]) *
|
||||
sigma6[itype][jtype]/K[6] - 5.0)/K[0];
|
||||
phi = 2.0/9.0*fR *
|
||||
(1.0-(K[1]*(K[1]*(K[1]/3.0+3.0*K[2])+4.2*K[4])+K[2]*K[4]) *
|
||||
phi = 2.0/9.0*fR *
|
||||
(1.0-(K[1]*(K[1]*(K[1]/3.0+3.0*K[2])+4.2*K[4])+K[2]*K[4]) *
|
||||
sigma6[itype][jtype]/K[6]) - offset[itype][jtype];
|
||||
break;
|
||||
|
||||
|
@ -500,14 +500,14 @@ double PairColloid::single(int i, int j, int itype, int jtype, double rsq,
|
|||
g[1] *= 42.0*K[0]/K[4]+6.0*K[1]+K[4];
|
||||
g[2] *= -42.0*K[0]/K[5]+6.0*K[2]+K[5];
|
||||
g[3] *= -42.0*K[0]/K[6]+6.0*K[2]+K[6];
|
||||
|
||||
|
||||
fR = a12[itype][jtype]*sigma6[itype][jtype]/r/37800.0;
|
||||
phi = fR * (h[0]-h[1]-h[2]+h[3]);
|
||||
dUR = phi/r + 5.0*fR*(g[0]+g[1]-g[2]-g[3]);
|
||||
dUA = -a12[itype][jtype]/3.0*r*((2.0*K[0]*K[7]+1.0)*K[7] +
|
||||
(2.0*K[0]*K[8]-1.0)*K[8]);
|
||||
dUA = -a12[itype][jtype]/3.0*r*((2.0*K[0]*K[7]+1.0)*K[7] +
|
||||
(2.0*K[0]*K[8]-1.0)*K[8]);
|
||||
fforce = factor_lj*(dUR+dUA)/r;
|
||||
phi += a12[itype][jtype]/6.0*(2.0*K[0]*(K[7]+K[8])-log(K[8]/K[7])) -
|
||||
phi += a12[itype][jtype]/6.0*(2.0*K[0]*(K[7]+K[8])-log(K[8]/K[7])) -
|
||||
offset[itype][jtype];
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -58,7 +58,7 @@ void PairYukawaColloid::compute(int eflag, int vflag)
|
|||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
|
||||
|
||||
// loop over neighbors of my atoms
|
||||
|
||||
for (ii = 0; ii < inum; ii++) {
|
||||
|
@ -82,32 +82,32 @@ void PairYukawaColloid::compute(int eflag, int vflag)
|
|||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
jtype = type[j];
|
||||
radj = radius[j];
|
||||
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r2inv = 1.0/rsq;
|
||||
r = sqrt(rsq);
|
||||
rinv = 1.0/r;
|
||||
screening = exp(-kappa*(r-(radi+radj)));
|
||||
forceyukawa = a[itype][jtype] * screening;
|
||||
r2inv = 1.0/rsq;
|
||||
r = sqrt(rsq);
|
||||
rinv = 1.0/r;
|
||||
screening = exp(-kappa*(r-(radi+radj)));
|
||||
forceyukawa = a[itype][jtype] * screening;
|
||||
|
||||
fpair = factor*forceyukawa * rinv;
|
||||
fpair = factor*forceyukawa * rinv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
}
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
}
|
||||
|
||||
if (eflag) {
|
||||
evdwl = a[itype][jtype]/kappa * screening - offset[itype][jtype];
|
||||
evdwl *= factor;
|
||||
}
|
||||
if (eflag) {
|
||||
evdwl = a[itype][jtype]/kappa * screening - offset[itype][jtype];
|
||||
evdwl *= factor;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
||||
evdwl,0.0,fpair,delx,dely,delz);
|
||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
||||
evdwl,0.0,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ void PairYukawaColloid::init_style()
|
|||
{
|
||||
if (!atom->sphere_flag)
|
||||
error->all(FLERR,"Pair yukawa/colloid requires atom style sphere");
|
||||
|
||||
|
||||
neighbor->request(this);
|
||||
|
||||
// require that atom radii are identical within each type
|
||||
|
@ -131,7 +131,7 @@ void PairYukawaColloid::init_style()
|
|||
for (int i = 1; i <= atom->ntypes; i++)
|
||||
if (!atom->radius_consistency(i,rad[i]))
|
||||
error->all(FLERR,"Pair yukawa/colloid requires atoms with same type "
|
||||
"have same radius");
|
||||
"have same radius");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -159,12 +159,12 @@ double PairYukawaColloid::init_one(int i, int j)
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairYukawaColloid::single(int i, int j, int itype, int jtype,
|
||||
double rsq,
|
||||
double factor_coul, double factor_lj,
|
||||
double &fforce)
|
||||
double rsq,
|
||||
double factor_coul, double factor_lj,
|
||||
double &fforce)
|
||||
{
|
||||
double r2inv,r,rinv,screening,forceyukawa,phi;
|
||||
|
||||
|
||||
r2inv = 1.0/rsq;
|
||||
r = sqrt(rsq);
|
||||
rinv = 1.0/r;
|
||||
|
@ -172,6 +172,6 @@ double PairYukawaColloid::single(int i, int j, int itype, int jtype,
|
|||
forceyukawa = a[itype][jtype] * screening;
|
||||
fforce = factor_lj*forceyukawa * rinv;
|
||||
|
||||
phi = a[itype][jtype]/kappa * screening - offset[itype][jtype];
|
||||
phi = a[itype][jtype]/kappa * screening - offset[itype][jtype];
|
||||
return factor_lj*phi;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -50,7 +50,7 @@ AtomVecDipole::AtomVecDipole(LAMMPS *lmp, int narg, char **arg) :
|
|||
/* ----------------------------------------------------------------------
|
||||
grow atom arrays
|
||||
n = 0 grows arrays by DELTA
|
||||
n > 0 allocates arrays to size n
|
||||
n > 0 allocates arrays to size n
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void AtomVecDipole::grow(int n)
|
||||
|
@ -73,7 +73,7 @@ void AtomVecDipole::grow(int n)
|
|||
mu = memory->grow(atom->mu,nmax,4,"atom:mu");
|
||||
|
||||
if (atom->nextra_grow)
|
||||
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
||||
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
||||
modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax);
|
||||
}
|
||||
|
||||
|
@ -113,14 +113,14 @@ void AtomVecDipole::copy(int i, int j, int delflag)
|
|||
mu[j][3] = mu[i][3];
|
||||
|
||||
if (atom->nextra_grow)
|
||||
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
||||
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
||||
modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int AtomVecDipole::pack_comm(int n, int *list, double *buf,
|
||||
int pbc_flag, int *pbc)
|
||||
int pbc_flag, int *pbc)
|
||||
{
|
||||
int i,j,m;
|
||||
double dx,dy,dz;
|
||||
|
@ -162,7 +162,7 @@ int AtomVecDipole::pack_comm(int n, int *list, double *buf,
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int AtomVecDipole::pack_comm_vel(int n, int *list, double *buf,
|
||||
int pbc_flag, int *pbc)
|
||||
int pbc_flag, int *pbc)
|
||||
{
|
||||
int i,j,m;
|
||||
double dx,dy,dz,dvx,dvy,dvz;
|
||||
|
@ -193,38 +193,38 @@ int AtomVecDipole::pack_comm_vel(int n, int *list, double *buf,
|
|||
}
|
||||
if (!deform_vremap) {
|
||||
for (i = 0; i < n; i++) {
|
||||
j = list[i];
|
||||
buf[m++] = x[j][0] + dx;
|
||||
buf[m++] = x[j][1] + dy;
|
||||
buf[m++] = x[j][2] + dz;
|
||||
buf[m++] = mu[j][0];
|
||||
buf[m++] = mu[j][1];
|
||||
buf[m++] = mu[j][2];
|
||||
buf[m++] = v[j][0];
|
||||
buf[m++] = v[j][1];
|
||||
buf[m++] = v[j][2];
|
||||
j = list[i];
|
||||
buf[m++] = x[j][0] + dx;
|
||||
buf[m++] = x[j][1] + dy;
|
||||
buf[m++] = x[j][2] + dz;
|
||||
buf[m++] = mu[j][0];
|
||||
buf[m++] = mu[j][1];
|
||||
buf[m++] = mu[j][2];
|
||||
buf[m++] = v[j][0];
|
||||
buf[m++] = v[j][1];
|
||||
buf[m++] = v[j][2];
|
||||
}
|
||||
} else {
|
||||
dvx = pbc[0]*h_rate[0] + pbc[5]*h_rate[5] + pbc[4]*h_rate[4];
|
||||
dvy = pbc[1]*h_rate[1] + pbc[3]*h_rate[3];
|
||||
dvz = pbc[2]*h_rate[2];
|
||||
for (i = 0; i < n; i++) {
|
||||
j = list[i];
|
||||
buf[m++] = x[j][0] + dx;
|
||||
buf[m++] = x[j][1] + dy;
|
||||
buf[m++] = x[j][2] + dz;
|
||||
buf[m++] = mu[j][0];
|
||||
buf[m++] = mu[j][1];
|
||||
buf[m++] = mu[j][2];
|
||||
if (mask[i] & deform_groupbit) {
|
||||
buf[m++] = v[j][0] + dvx;
|
||||
buf[m++] = v[j][1] + dvy;
|
||||
buf[m++] = v[j][2] + dvz;
|
||||
} else {
|
||||
buf[m++] = v[j][0];
|
||||
buf[m++] = v[j][1];
|
||||
buf[m++] = v[j][2];
|
||||
}
|
||||
j = list[i];
|
||||
buf[m++] = x[j][0] + dx;
|
||||
buf[m++] = x[j][1] + dy;
|
||||
buf[m++] = x[j][2] + dz;
|
||||
buf[m++] = mu[j][0];
|
||||
buf[m++] = mu[j][1];
|
||||
buf[m++] = mu[j][2];
|
||||
if (mask[i] & deform_groupbit) {
|
||||
buf[m++] = v[j][0] + dvx;
|
||||
buf[m++] = v[j][1] + dvy;
|
||||
buf[m++] = v[j][2] + dvz;
|
||||
} else {
|
||||
buf[m++] = v[j][0];
|
||||
buf[m++] = v[j][1];
|
||||
buf[m++] = v[j][2];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ void AtomVecDipole::unpack_reverse(int n, int *list, double *buf)
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int AtomVecDipole::pack_border(int n, int *list, double *buf,
|
||||
int pbc_flag, int *pbc)
|
||||
int pbc_flag, int *pbc)
|
||||
{
|
||||
int i,j,m;
|
||||
double dx,dy,dz;
|
||||
|
@ -388,7 +388,7 @@ int AtomVecDipole::pack_border(int n, int *list, double *buf,
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int AtomVecDipole::pack_border_vel(int n, int *list, double *buf,
|
||||
int pbc_flag, int *pbc)
|
||||
int pbc_flag, int *pbc)
|
||||
{
|
||||
int i,j,m;
|
||||
double dx,dy,dz,dvx,dvy,dvz;
|
||||
|
@ -424,48 +424,48 @@ int AtomVecDipole::pack_border_vel(int n, int *list, double *buf,
|
|||
}
|
||||
if (!deform_vremap) {
|
||||
for (i = 0; i < n; i++) {
|
||||
j = list[i];
|
||||
buf[m++] = x[j][0] + dx;
|
||||
buf[m++] = x[j][1] + dy;
|
||||
buf[m++] = x[j][2] + dz;
|
||||
buf[m++] = tag[j];
|
||||
buf[m++] = type[j];
|
||||
buf[m++] = mask[j];
|
||||
buf[m++] = q[j];
|
||||
buf[m++] = mu[j][0];
|
||||
buf[m++] = mu[j][1];
|
||||
buf[m++] = mu[j][2];
|
||||
buf[m++] = mu[j][3];
|
||||
buf[m++] = v[j][0];
|
||||
buf[m++] = v[j][1];
|
||||
buf[m++] = v[j][2];
|
||||
j = list[i];
|
||||
buf[m++] = x[j][0] + dx;
|
||||
buf[m++] = x[j][1] + dy;
|
||||
buf[m++] = x[j][2] + dz;
|
||||
buf[m++] = tag[j];
|
||||
buf[m++] = type[j];
|
||||
buf[m++] = mask[j];
|
||||
buf[m++] = q[j];
|
||||
buf[m++] = mu[j][0];
|
||||
buf[m++] = mu[j][1];
|
||||
buf[m++] = mu[j][2];
|
||||
buf[m++] = mu[j][3];
|
||||
buf[m++] = v[j][0];
|
||||
buf[m++] = v[j][1];
|
||||
buf[m++] = v[j][2];
|
||||
}
|
||||
} else {
|
||||
dvx = pbc[0]*h_rate[0] + pbc[5]*h_rate[5] + pbc[4]*h_rate[4];
|
||||
dvy = pbc[1]*h_rate[1] + pbc[3]*h_rate[3];
|
||||
dvz = pbc[2]*h_rate[2];
|
||||
for (i = 0; i < n; i++) {
|
||||
j = list[i];
|
||||
buf[m++] = x[j][0] + dx;
|
||||
buf[m++] = x[j][1] + dy;
|
||||
buf[m++] = x[j][2] + dz;
|
||||
buf[m++] = tag[j];
|
||||
buf[m++] = type[j];
|
||||
buf[m++] = mask[j];
|
||||
buf[m++] = q[j];
|
||||
buf[m++] = mu[j][0];
|
||||
buf[m++] = mu[j][1];
|
||||
buf[m++] = mu[j][2];
|
||||
buf[m++] = mu[j][3];
|
||||
if (mask[i] & deform_groupbit) {
|
||||
buf[m++] = v[j][0] + dvx;
|
||||
buf[m++] = v[j][1] + dvy;
|
||||
buf[m++] = v[j][2] + dvz;
|
||||
} else {
|
||||
buf[m++] = v[j][0];
|
||||
buf[m++] = v[j][1];
|
||||
buf[m++] = v[j][2];
|
||||
}
|
||||
j = list[i];
|
||||
buf[m++] = x[j][0] + dx;
|
||||
buf[m++] = x[j][1] + dy;
|
||||
buf[m++] = x[j][2] + dz;
|
||||
buf[m++] = tag[j];
|
||||
buf[m++] = type[j];
|
||||
buf[m++] = mask[j];
|
||||
buf[m++] = q[j];
|
||||
buf[m++] = mu[j][0];
|
||||
buf[m++] = mu[j][1];
|
||||
buf[m++] = mu[j][2];
|
||||
buf[m++] = mu[j][3];
|
||||
if (mask[i] & deform_groupbit) {
|
||||
buf[m++] = v[j][0] + dvx;
|
||||
buf[m++] = v[j][1] + dvy;
|
||||
buf[m++] = v[j][2] + dvz;
|
||||
} else {
|
||||
buf[m++] = v[j][0];
|
||||
buf[m++] = v[j][1];
|
||||
buf[m++] = v[j][2];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -585,7 +585,7 @@ int AtomVecDipole::pack_exchange(int i, double *buf)
|
|||
buf[m++] = mu[i][3];
|
||||
|
||||
if (atom->nextra_grow)
|
||||
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
||||
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
||||
m += modify->fix[atom->extra_grow[iextra]]->pack_exchange(i,&buf[m]);
|
||||
|
||||
buf[0] = m;
|
||||
|
@ -618,9 +618,9 @@ int AtomVecDipole::unpack_exchange(double *buf)
|
|||
mu[nlocal][3] = buf[m++];
|
||||
|
||||
if (atom->nextra_grow)
|
||||
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
||||
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
||||
m += modify->fix[atom->extra_grow[iextra]]->
|
||||
unpack_exchange(nlocal,&buf[m]);
|
||||
unpack_exchange(nlocal,&buf[m]);
|
||||
|
||||
atom->nlocal++;
|
||||
return m;
|
||||
|
@ -639,9 +639,9 @@ int AtomVecDipole::size_restart()
|
|||
int n = 16 * nlocal;
|
||||
|
||||
if (atom->nextra_restart)
|
||||
for (int iextra = 0; iextra < atom->nextra_restart; iextra++)
|
||||
for (int iextra = 0; iextra < atom->nextra_restart; iextra++)
|
||||
for (i = 0; i < nlocal; i++)
|
||||
n += modify->fix[atom->extra_restart[iextra]]->size_restart(i);
|
||||
n += modify->fix[atom->extra_restart[iextra]]->size_restart(i);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
@ -649,7 +649,7 @@ int AtomVecDipole::size_restart()
|
|||
/* ----------------------------------------------------------------------
|
||||
pack atom I's data for restart file including extra quantities
|
||||
xyz must be 1st 3 values, so that read_restart can test on them
|
||||
molecular types may be negative, but write as positive
|
||||
molecular types may be negative, but write as positive
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
int AtomVecDipole::pack_restart(int i, double *buf)
|
||||
|
@ -673,7 +673,7 @@ int AtomVecDipole::pack_restart(int i, double *buf)
|
|||
buf[m++] = mu[i][3];
|
||||
|
||||
if (atom->nextra_restart)
|
||||
for (int iextra = 0; iextra < atom->nextra_restart; iextra++)
|
||||
for (int iextra = 0; iextra < atom->nextra_restart; iextra++)
|
||||
m += modify->fix[atom->extra_restart[iextra]]->pack_restart(i,&buf[m]);
|
||||
|
||||
buf[0] = m;
|
||||
|
@ -778,9 +778,9 @@ void AtomVecDipole::data_atom(double *coord, int imagetmp, char **values)
|
|||
mu[nlocal][0] = atof(values[6]);
|
||||
mu[nlocal][1] = atof(values[7]);
|
||||
mu[nlocal][2] = atof(values[8]);
|
||||
mu[nlocal][3] = sqrt(mu[nlocal][0]*mu[nlocal][0] +
|
||||
mu[nlocal][1]*mu[nlocal][1] +
|
||||
mu[nlocal][2]*mu[nlocal][2]);
|
||||
mu[nlocal][3] = sqrt(mu[nlocal][0]*mu[nlocal][0] +
|
||||
mu[nlocal][1]*mu[nlocal][1] +
|
||||
mu[nlocal][2]*mu[nlocal][2]);
|
||||
|
||||
image[nlocal] = imagetmp;
|
||||
|
||||
|
@ -803,14 +803,14 @@ int AtomVecDipole::data_atom_hybrid(int nlocal, char **values)
|
|||
mu[nlocal][0] = atof(values[1]);
|
||||
mu[nlocal][1] = atof(values[2]);
|
||||
mu[nlocal][2] = atof(values[3]);
|
||||
mu[nlocal][3] = sqrt(mu[nlocal][0]*mu[nlocal][0] +
|
||||
mu[nlocal][1]*mu[nlocal][1] +
|
||||
mu[nlocal][2]*mu[nlocal][2]);
|
||||
mu[nlocal][3] = sqrt(mu[nlocal][0]*mu[nlocal][0] +
|
||||
mu[nlocal][1]*mu[nlocal][1] +
|
||||
mu[nlocal][2]*mu[nlocal][2]);
|
||||
return 4;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
return # of bytes of allocated memory
|
||||
return # of bytes of allocated memory
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
bigint AtomVecDipole::memory_usage()
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -86,7 +86,7 @@ void PairDipoleCut::compute(int eflag, int vflag)
|
|||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
|
||||
|
||||
// loop over neighbors of my atoms
|
||||
|
||||
for (ii = 0; ii < inum; ii++) {
|
||||
|
@ -112,142 +112,142 @@ void PairDipoleCut::compute(int eflag, int vflag)
|
|||
jtype = type[j];
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r2inv = 1.0/rsq;
|
||||
rinv = sqrt(r2inv);
|
||||
r2inv = 1.0/rsq;
|
||||
rinv = sqrt(r2inv);
|
||||
|
||||
// atom can have both a charge and dipole
|
||||
// i,j = charge-charge, dipole-dipole, dipole-charge, or charge-dipole
|
||||
// atom can have both a charge and dipole
|
||||
// i,j = charge-charge, dipole-dipole, dipole-charge, or charge-dipole
|
||||
|
||||
forcecoulx = forcecouly = forcecoulz = 0.0;
|
||||
tixcoul = tiycoul = tizcoul = 0.0;
|
||||
tjxcoul = tjycoul = tjzcoul = 0.0;
|
||||
|
||||
if (rsq < cut_coulsq[itype][jtype]) {
|
||||
forcecoulx = forcecouly = forcecoulz = 0.0;
|
||||
tixcoul = tiycoul = tizcoul = 0.0;
|
||||
tjxcoul = tjycoul = tjzcoul = 0.0;
|
||||
|
||||
if (qtmp != 0.0 && q[j] != 0.0) {
|
||||
if (rsq < cut_coulsq[itype][jtype]) {
|
||||
|
||||
if (qtmp != 0.0 && q[j] != 0.0) {
|
||||
r3inv = r2inv*rinv;
|
||||
pre1 = qtmp*q[j]*r3inv;
|
||||
pre1 = qtmp*q[j]*r3inv;
|
||||
|
||||
forcecoulx += pre1*delx;
|
||||
forcecouly += pre1*dely;
|
||||
forcecoulz += pre1*delz;
|
||||
}
|
||||
forcecoulx += pre1*delx;
|
||||
forcecouly += pre1*dely;
|
||||
forcecoulz += pre1*delz;
|
||||
}
|
||||
|
||||
if (mu[i][3] > 0.0 && mu[j][3] > 0.0) {
|
||||
if (mu[i][3] > 0.0 && mu[j][3] > 0.0) {
|
||||
r3inv = r2inv*rinv;
|
||||
r5inv = r3inv*r2inv;
|
||||
r7inv = r5inv*r2inv;
|
||||
r7inv = r5inv*r2inv;
|
||||
|
||||
pdotp = mu[i][0]*mu[j][0] + mu[i][1]*mu[j][1] + mu[i][2]*mu[j][2];
|
||||
pidotr = mu[i][0]*delx + mu[i][1]*dely + mu[i][2]*delz;
|
||||
pjdotr = mu[j][0]*delx + mu[j][1]*dely + mu[j][2]*delz;
|
||||
|
||||
pre1 = 3.0*r5inv*pdotp - 15.0*r7inv*pidotr*pjdotr;
|
||||
pre2 = 3.0*r5inv*pjdotr;
|
||||
pre3 = 3.0*r5inv*pidotr;
|
||||
pre4 = -1.0*r3inv;
|
||||
pre1 = 3.0*r5inv*pdotp - 15.0*r7inv*pidotr*pjdotr;
|
||||
pre2 = 3.0*r5inv*pjdotr;
|
||||
pre3 = 3.0*r5inv*pidotr;
|
||||
pre4 = -1.0*r3inv;
|
||||
|
||||
forcecoulx += pre1*delx + pre2*mu[i][0] + pre3*mu[j][0];
|
||||
forcecouly += pre1*dely + pre2*mu[i][1] + pre3*mu[j][1];
|
||||
forcecoulz += pre1*delz + pre2*mu[i][2] + pre3*mu[j][2];
|
||||
|
||||
crossx = pre4 * (mu[i][1]*mu[j][2] - mu[i][2]*mu[j][1]);
|
||||
crossy = pre4 * (mu[i][2]*mu[j][0] - mu[i][0]*mu[j][2]);
|
||||
crossz = pre4 * (mu[i][0]*mu[j][1] - mu[i][1]*mu[j][0]);
|
||||
forcecoulx += pre1*delx + pre2*mu[i][0] + pre3*mu[j][0];
|
||||
forcecouly += pre1*dely + pre2*mu[i][1] + pre3*mu[j][1];
|
||||
forcecoulz += pre1*delz + pre2*mu[i][2] + pre3*mu[j][2];
|
||||
|
||||
tixcoul += crossx + pre2 * (mu[i][1]*delz - mu[i][2]*dely);
|
||||
tiycoul += crossy + pre2 * (mu[i][2]*delx - mu[i][0]*delz);
|
||||
tizcoul += crossz + pre2 * (mu[i][0]*dely - mu[i][1]*delx);
|
||||
tjxcoul += -crossx + pre3 * (mu[j][1]*delz - mu[j][2]*dely);
|
||||
tjycoul += -crossy + pre3 * (mu[j][2]*delx - mu[j][0]*delz);
|
||||
tjzcoul += -crossz + pre3 * (mu[j][0]*dely - mu[j][1]*delx);
|
||||
}
|
||||
crossx = pre4 * (mu[i][1]*mu[j][2] - mu[i][2]*mu[j][1]);
|
||||
crossy = pre4 * (mu[i][2]*mu[j][0] - mu[i][0]*mu[j][2]);
|
||||
crossz = pre4 * (mu[i][0]*mu[j][1] - mu[i][1]*mu[j][0]);
|
||||
|
||||
if (mu[i][3] > 0.0 && q[j] != 0.0) {
|
||||
tixcoul += crossx + pre2 * (mu[i][1]*delz - mu[i][2]*dely);
|
||||
tiycoul += crossy + pre2 * (mu[i][2]*delx - mu[i][0]*delz);
|
||||
tizcoul += crossz + pre2 * (mu[i][0]*dely - mu[i][1]*delx);
|
||||
tjxcoul += -crossx + pre3 * (mu[j][1]*delz - mu[j][2]*dely);
|
||||
tjycoul += -crossy + pre3 * (mu[j][2]*delx - mu[j][0]*delz);
|
||||
tjzcoul += -crossz + pre3 * (mu[j][0]*dely - mu[j][1]*delx);
|
||||
}
|
||||
|
||||
if (mu[i][3] > 0.0 && q[j] != 0.0) {
|
||||
r3inv = r2inv*rinv;
|
||||
r5inv = r3inv*r2inv;
|
||||
pidotr = mu[i][0]*delx + mu[i][1]*dely + mu[i][2]*delz;
|
||||
pre1 = 3.0*q[j]*r5inv * pidotr;
|
||||
pre2 = q[j]*r3inv;
|
||||
pre1 = 3.0*q[j]*r5inv * pidotr;
|
||||
pre2 = q[j]*r3inv;
|
||||
|
||||
forcecoulx += pre2*mu[i][0] - pre1*delx;
|
||||
forcecoulx += pre2*mu[i][0] - pre1*delx;
|
||||
forcecouly += pre2*mu[i][1] - pre1*dely;
|
||||
forcecoulz += pre2*mu[i][2] - pre1*delz;
|
||||
tixcoul += pre2 * (mu[i][1]*delz - mu[i][2]*dely);
|
||||
tiycoul += pre2 * (mu[i][2]*delx - mu[i][0]*delz);
|
||||
tizcoul += pre2 * (mu[i][0]*dely - mu[i][1]*delx);
|
||||
}
|
||||
tixcoul += pre2 * (mu[i][1]*delz - mu[i][2]*dely);
|
||||
tiycoul += pre2 * (mu[i][2]*delx - mu[i][0]*delz);
|
||||
tizcoul += pre2 * (mu[i][0]*dely - mu[i][1]*delx);
|
||||
}
|
||||
|
||||
if (mu[j][3] > 0.0 && qtmp != 0.0) {
|
||||
if (mu[j][3] > 0.0 && qtmp != 0.0) {
|
||||
r3inv = r2inv*rinv;
|
||||
r5inv = r3inv*r2inv;
|
||||
pjdotr = mu[j][0]*delx + mu[j][1]*dely + mu[j][2]*delz;
|
||||
pre1 = 3.0*qtmp*r5inv * pjdotr;
|
||||
pre2 = qtmp*r3inv;
|
||||
pre1 = 3.0*qtmp*r5inv * pjdotr;
|
||||
pre2 = qtmp*r3inv;
|
||||
|
||||
forcecoulx += pre1*delx - pre2*mu[j][0];
|
||||
forcecoulx += pre1*delx - pre2*mu[j][0];
|
||||
forcecouly += pre1*dely - pre2*mu[j][1];
|
||||
forcecoulz += pre1*delz - pre2*mu[j][2];
|
||||
tjxcoul += -pre2 * (mu[j][1]*delz - mu[j][2]*dely);
|
||||
tjycoul += -pre2 * (mu[j][2]*delx - mu[j][0]*delz);
|
||||
tjzcoul += -pre2 * (mu[j][0]*dely - mu[j][1]*delx);
|
||||
}
|
||||
}
|
||||
tjxcoul += -pre2 * (mu[j][1]*delz - mu[j][2]*dely);
|
||||
tjycoul += -pre2 * (mu[j][2]*delx - mu[j][0]*delz);
|
||||
tjzcoul += -pre2 * (mu[j][0]*dely - mu[j][1]*delx);
|
||||
}
|
||||
}
|
||||
|
||||
// LJ interaction
|
||||
// LJ interaction
|
||||
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
forcelj *= factor_lj * r2inv;
|
||||
} else forcelj = 0.0;
|
||||
|
||||
// total force
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
forcelj *= factor_lj * r2inv;
|
||||
} else forcelj = 0.0;
|
||||
|
||||
fq = factor_coul*qqrd2e;
|
||||
fx = fq*forcecoulx + delx*forcelj;
|
||||
fy = fq*forcecouly + dely*forcelj;
|
||||
fz = fq*forcecoulz + delz*forcelj;
|
||||
|
||||
// force & torque accumulation
|
||||
// total force
|
||||
|
||||
f[i][0] += fx;
|
||||
f[i][1] += fy;
|
||||
f[i][2] += fz;
|
||||
torque[i][0] += fq*tixcoul;
|
||||
torque[i][1] += fq*tiycoul;
|
||||
torque[i][2] += fq*tizcoul;
|
||||
fq = factor_coul*qqrd2e;
|
||||
fx = fq*forcecoulx + delx*forcelj;
|
||||
fy = fq*forcecouly + dely*forcelj;
|
||||
fz = fq*forcecoulz + delz*forcelj;
|
||||
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= fx;
|
||||
f[j][1] -= fy;
|
||||
f[j][2] -= fz;
|
||||
torque[j][0] += fq*tjxcoul;
|
||||
torque[j][1] += fq*tjycoul;
|
||||
torque[j][2] += fq*tjzcoul;
|
||||
}
|
||||
// force & torque accumulation
|
||||
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq[itype][jtype]) {
|
||||
ecoul = qtmp*q[j]*rinv;
|
||||
if (mu[i][3] > 0.0 && mu[j][3] > 0.0)
|
||||
ecoul += r3inv*pdotp - 3.0*r5inv*pidotr*pjdotr;
|
||||
if (mu[i][3] > 0.0 && q[j] != 0.0)
|
||||
ecoul += -q[j]*r3inv*pidotr;
|
||||
if (mu[j][3] > 0.0 && qtmp != 0.0)
|
||||
ecoul += qtmp*r3inv*pjdotr;
|
||||
ecoul *= factor_coul*qqrd2e;
|
||||
} else ecoul = 0.0;
|
||||
f[i][0] += fx;
|
||||
f[i][1] += fy;
|
||||
f[i][2] += fz;
|
||||
torque[i][0] += fq*tixcoul;
|
||||
torque[i][1] += fq*tiycoul;
|
||||
torque[i][2] += fq*tizcoul;
|
||||
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
} else evdwl = 0.0;
|
||||
}
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= fx;
|
||||
f[j][1] -= fy;
|
||||
f[j][2] -= fz;
|
||||
torque[j][0] += fq*tjxcoul;
|
||||
torque[j][1] += fq*tjycoul;
|
||||
torque[j][2] += fq*tjzcoul;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally_xyz(i,j,nlocal,newton_pair,
|
||||
evdwl,ecoul,fx,fy,fz,delx,dely,delz);
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq[itype][jtype]) {
|
||||
ecoul = qtmp*q[j]*rinv;
|
||||
if (mu[i][3] > 0.0 && mu[j][3] > 0.0)
|
||||
ecoul += r3inv*pdotp - 3.0*r5inv*pidotr*pjdotr;
|
||||
if (mu[i][3] > 0.0 && q[j] != 0.0)
|
||||
ecoul += -q[j]*r3inv*pidotr;
|
||||
if (mu[j][3] > 0.0 && qtmp != 0.0)
|
||||
ecoul += qtmp*r3inv*pjdotr;
|
||||
ecoul *= factor_coul*qqrd2e;
|
||||
} else ecoul = 0.0;
|
||||
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
} else evdwl = 0.0;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally_xyz(i,j,nlocal,newton_pair,
|
||||
evdwl,ecoul,fx,fy,fz,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ void PairDipoleCut::compute(int eflag, int vflag)
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
allocate all arrays
|
||||
allocate all arrays
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairDipoleCut::allocate()
|
||||
|
@ -285,7 +285,7 @@ void PairDipoleCut::allocate()
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
global settings
|
||||
global settings
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairDipoleCut::settings(int narg, char **arg)
|
||||
|
@ -303,10 +303,10 @@ void PairDipoleCut::settings(int narg, char **arg)
|
|||
int i,j;
|
||||
for (i = 1; i <= atom->ntypes; i++)
|
||||
for (j = i+1; j <= atom->ntypes; j++)
|
||||
if (setflag[i][j]) {
|
||||
cut_lj[i][j] = cut_lj_global;
|
||||
cut_coul[i][j] = cut_coul_global;
|
||||
}
|
||||
if (setflag[i][j]) {
|
||||
cut_lj[i][j] = cut_lj_global;
|
||||
cut_coul[i][j] = cut_coul_global;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -316,7 +316,7 @@ void PairDipoleCut::settings(int narg, char **arg)
|
|||
|
||||
void PairDipoleCut::coeff(int narg, char **arg)
|
||||
{
|
||||
if (narg < 4 || narg > 6)
|
||||
if (narg < 4 || narg > 6)
|
||||
error->all(FLERR,"Incorrect args for pair coefficients");
|
||||
if (!allocated) allocate();
|
||||
|
||||
|
@ -367,7 +367,7 @@ double PairDipoleCut::init_one(int i, int j)
|
|||
{
|
||||
if (setflag[i][j] == 0) {
|
||||
epsilon[i][j] = mix_energy(epsilon[i][i],epsilon[j][j],
|
||||
sigma[i][i],sigma[j][j]);
|
||||
sigma[i][i],sigma[j][j]);
|
||||
sigma[i][j] = mix_distance(sigma[i][i],sigma[j][j]);
|
||||
cut_lj[i][j] = mix_distance(cut_lj[i][i],cut_lj[j][j]);
|
||||
cut_coul[i][j] = mix_distance(cut_coul[i][i],cut_coul[j][j]);
|
||||
|
@ -381,12 +381,12 @@ double PairDipoleCut::init_one(int i, int j)
|
|||
lj2[i][j] = 24.0 * epsilon[i][j] * pow(sigma[i][j],6.0);
|
||||
lj3[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j],12.0);
|
||||
lj4[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j],6.0);
|
||||
|
||||
|
||||
if (offset_flag) {
|
||||
double ratio = sigma[i][j] / cut_lj[i][j];
|
||||
offset[i][j] = 4.0 * epsilon[i][j] * (pow(ratio,12.0) - pow(ratio,6.0));
|
||||
} else offset[i][j] = 0.0;
|
||||
|
||||
|
||||
cut_ljsq[j][i] = cut_ljsq[i][j];
|
||||
cut_coulsq[j][i] = cut_coulsq[i][j];
|
||||
lj1[j][i] = lj1[i][j];
|
||||
|
@ -411,10 +411,10 @@ void PairDipoleCut::write_restart(FILE *fp)
|
|||
for (j = i; j <= atom->ntypes; j++) {
|
||||
fwrite(&setflag[i][j],sizeof(int),1,fp);
|
||||
if (setflag[i][j]) {
|
||||
fwrite(&epsilon[i][j],sizeof(double),1,fp);
|
||||
fwrite(&sigma[i][j],sizeof(double),1,fp);
|
||||
fwrite(&cut_lj[i][j],sizeof(double),1,fp);
|
||||
fwrite(&cut_coul[i][j],sizeof(double),1,fp);
|
||||
fwrite(&epsilon[i][j],sizeof(double),1,fp);
|
||||
fwrite(&sigma[i][j],sizeof(double),1,fp);
|
||||
fwrite(&cut_lj[i][j],sizeof(double),1,fp);
|
||||
fwrite(&cut_coul[i][j],sizeof(double),1,fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -436,16 +436,16 @@ void PairDipoleCut::read_restart(FILE *fp)
|
|||
if (me == 0) fread(&setflag[i][j],sizeof(int),1,fp);
|
||||
MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world);
|
||||
if (setflag[i][j]) {
|
||||
if (me == 0) {
|
||||
fread(&epsilon[i][j],sizeof(double),1,fp);
|
||||
fread(&sigma[i][j],sizeof(double),1,fp);
|
||||
fread(&cut_lj[i][j],sizeof(double),1,fp);
|
||||
fread(&cut_coul[i][j],sizeof(double),1,fp);
|
||||
}
|
||||
MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut_lj[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut_coul[i][j],1,MPI_DOUBLE,0,world);
|
||||
if (me == 0) {
|
||||
fread(&epsilon[i][j],sizeof(double),1,fp);
|
||||
fread(&sigma[i][j],sizeof(double),1,fp);
|
||||
fread(&cut_lj[i][j],sizeof(double),1,fp);
|
||||
fread(&cut_coul[i][j],sizeof(double),1,fp);
|
||||
}
|
||||
MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut_lj[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut_coul[i][j],1,MPI_DOUBLE,0,world);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -104,37 +104,37 @@ void PairBrownian::compute(int eflag, int vflag)
|
|||
if (flagVF) // Flag for volume fraction corrections
|
||||
if (flagdeform || flagwall == 2){ // Possible changes in volume fraction
|
||||
if (flagdeform && !flagwall)
|
||||
for (j = 0; j < 3; j++)
|
||||
dims[j] = domain->prd[j];
|
||||
for (j = 0; j < 3; j++)
|
||||
dims[j] = domain->prd[j];
|
||||
else if (flagwall == 2 || (flagdeform && flagwall == 1)){
|
||||
double wallhi[3], walllo[3];
|
||||
for (int j = 0; j < 3; j++){
|
||||
wallhi[j] = domain->prd[j];
|
||||
walllo[j] = 0;
|
||||
}
|
||||
for (int m = 0; m < wallfix->nwall; m++){
|
||||
int dim = wallfix->wallwhich[m] / 2;
|
||||
int side = wallfix->wallwhich[m] % 2;
|
||||
if (wallfix->wallstyle[m] == VARIABLE){
|
||||
wallcoord = input->variable->compute_equal(wallfix->varindex[m]);
|
||||
}
|
||||
else wallcoord = wallfix->coord0[m];
|
||||
if (side == 0) walllo[dim] = wallcoord;
|
||||
else wallhi[dim] = wallcoord;
|
||||
}
|
||||
for (int j = 0; j < 3; j++)
|
||||
dims[j] = wallhi[j] - walllo[j];
|
||||
double wallhi[3], walllo[3];
|
||||
for (int j = 0; j < 3; j++){
|
||||
wallhi[j] = domain->prd[j];
|
||||
walllo[j] = 0;
|
||||
}
|
||||
for (int m = 0; m < wallfix->nwall; m++){
|
||||
int dim = wallfix->wallwhich[m] / 2;
|
||||
int side = wallfix->wallwhich[m] % 2;
|
||||
if (wallfix->wallstyle[m] == VARIABLE){
|
||||
wallcoord = input->variable->compute_equal(wallfix->varindex[m]);
|
||||
}
|
||||
else wallcoord = wallfix->coord0[m];
|
||||
if (side == 0) walllo[dim] = wallcoord;
|
||||
else wallhi[dim] = wallcoord;
|
||||
}
|
||||
for (int j = 0; j < 3; j++)
|
||||
dims[j] = wallhi[j] - walllo[j];
|
||||
}
|
||||
double vol_T = dims[0]*dims[1]*dims[2];
|
||||
double vol_f = vol_P/vol_T;
|
||||
if (flaglog == 0) {
|
||||
R0 = 6*MY_PI*mu*rad*(1.0 + 2.16*vol_f);
|
||||
RT0 = 8*MY_PI*mu*pow(rad,3.0);
|
||||
//RS0 = 20.0/3.0*MY_PI*mu*pow(rad,3)*(1.0 + 3.33*vol_f + 2.80*vol_f*vol_f);
|
||||
R0 = 6*MY_PI*mu*rad*(1.0 + 2.16*vol_f);
|
||||
RT0 = 8*MY_PI*mu*pow(rad,3.0);
|
||||
//RS0 = 20.0/3.0*MY_PI*mu*pow(rad,3)*(1.0 + 3.33*vol_f + 2.80*vol_f*vol_f);
|
||||
} else {
|
||||
R0 = 6*MY_PI*mu*rad*(1.0 + 2.725*vol_f - 6.583*vol_f*vol_f);
|
||||
RT0 = 8*MY_PI*mu*pow(rad,3.0)*(1.0 + 0.749*vol_f - 2.469*vol_f*vol_f);
|
||||
//RS0 = 20.0/3.0*MY_PI*mu*pow(rad,3)*(1.0 + 3.64*vol_f - 6.95*vol_f*vol_f);
|
||||
R0 = 6*MY_PI*mu*rad*(1.0 + 2.725*vol_f - 6.583*vol_f*vol_f);
|
||||
RT0 = 8*MY_PI*mu*pow(rad,3.0)*(1.0 + 0.749*vol_f - 2.469*vol_f*vol_f);
|
||||
//RS0 = 20.0/3.0*MY_PI*mu*pow(rad,3)*(1.0 + 3.64*vol_f - 6.95*vol_f*vol_f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,8 +156,8 @@ void PairBrownian::compute(int eflag, int vflag)
|
|||
itype = type[i];
|
||||
radi = radius[i];
|
||||
jlist = firstneigh[i];
|
||||
jnum = numneigh[i];
|
||||
|
||||
jnum = numneigh[i];
|
||||
|
||||
// FLD contribution to force and torque due to isotropic terms
|
||||
|
||||
if (flagfld) {
|
||||
|
@ -165,12 +165,12 @@ void PairBrownian::compute(int eflag, int vflag)
|
|||
f[i][1] += prethermostat*sqrt(R0)*(random->uniform()-0.5);
|
||||
f[i][2] += prethermostat*sqrt(R0)*(random->uniform()-0.5);
|
||||
if (flaglog) {
|
||||
torque[i][0] += prethermostat*sqrt(RT0)*(random->uniform()-0.5);
|
||||
torque[i][1] += prethermostat*sqrt(RT0)*(random->uniform()-0.5);
|
||||
torque[i][2] += prethermostat*sqrt(RT0)*(random->uniform()-0.5);
|
||||
torque[i][0] += prethermostat*sqrt(RT0)*(random->uniform()-0.5);
|
||||
torque[i][1] += prethermostat*sqrt(RT0)*(random->uniform()-0.5);
|
||||
torque[i][2] += prethermostat*sqrt(RT0)*(random->uniform()-0.5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!flagHI) continue;
|
||||
|
||||
for (jj = 0; jj < jnum; jj++) {
|
||||
|
@ -184,25 +184,25 @@ void PairBrownian::compute(int eflag, int vflag)
|
|||
jtype = type[j];
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r = sqrt(rsq);
|
||||
|
||||
r = sqrt(rsq);
|
||||
|
||||
// scalar resistances a_sq and a_sh
|
||||
|
||||
h_sep = r - 2.0*radi;
|
||||
|
||||
|
||||
// check for overlaps
|
||||
|
||||
if (h_sep < 0.0) overlaps++;
|
||||
|
||||
|
||||
// if less than minimum gap, use minimum gap instead
|
||||
|
||||
if (r < cut_inner[itype][jtype])
|
||||
h_sep = cut_inner[itype][jtype] - 2.0*radi;
|
||||
|
||||
h_sep = cut_inner[itype][jtype] - 2.0*radi;
|
||||
|
||||
// scale h_sep by radi
|
||||
|
||||
h_sep = h_sep/radi;
|
||||
|
||||
|
||||
// scalar resistances
|
||||
|
||||
if (flaglog) {
|
||||
|
@ -211,70 +211,70 @@ void PairBrownian::compute(int eflag, int vflag)
|
|||
a_pu = 8.0*MY_PI*mu*pow(radi,3.0)*(3.0/160.0*log(1.0/h_sep));
|
||||
} else
|
||||
a_sq = 6.0*MY_PI*mu*radi*(1.0/4.0/h_sep);
|
||||
|
||||
|
||||
// generate the Pairwise Brownian Force: a_sq
|
||||
|
||||
Fbmag = prethermostat*sqrt(a_sq);
|
||||
|
||||
|
||||
// generate a random number
|
||||
|
||||
randr = random->uniform()-0.5;
|
||||
|
||||
|
||||
// contribution due to Brownian motion
|
||||
|
||||
fx = Fbmag*randr*delx/r;
|
||||
fy = Fbmag*randr*dely/r;
|
||||
fz = Fbmag*randr*delz/r;
|
||||
|
||||
|
||||
// add terms due to a_sh
|
||||
|
||||
if (flaglog) {
|
||||
|
||||
// generate two orthogonal vectors to the line of centers
|
||||
|
||||
p1[0] = delx/r; p1[1] = dely/r; p1[2] = delz/r;
|
||||
p1[0] = delx/r; p1[1] = dely/r; p1[2] = delz/r;
|
||||
set_3_orthogonal_vectors(p1,p2,p3);
|
||||
|
||||
|
||||
// magnitude
|
||||
|
||||
Fbmag = prethermostat*sqrt(a_sh);
|
||||
|
||||
Fbmag = prethermostat*sqrt(a_sh);
|
||||
|
||||
// force in each of the two directions
|
||||
|
||||
randr = random->uniform()-0.5;
|
||||
fx += Fbmag*randr*p2[0];
|
||||
fy += Fbmag*randr*p2[1];
|
||||
fz += Fbmag*randr*p2[2];
|
||||
|
||||
|
||||
randr = random->uniform()-0.5;
|
||||
fx += Fbmag*randr*p3[0];
|
||||
fy += Fbmag*randr*p3[1];
|
||||
fz += Fbmag*randr*p3[2];
|
||||
}
|
||||
|
||||
fz += Fbmag*randr*p3[2];
|
||||
}
|
||||
|
||||
// scale forces to appropriate units
|
||||
|
||||
fx = vxmu2f*fx;
|
||||
fy = vxmu2f*fy;
|
||||
fz = vxmu2f*fz;
|
||||
|
||||
|
||||
// sum to total force
|
||||
|
||||
f[i][0] -= fx;
|
||||
f[i][1] -= fy;
|
||||
f[i][2] -= fz;
|
||||
f[i][2] -= fz;
|
||||
|
||||
if (newton_pair || j < nlocal) {
|
||||
//randr = random->uniform()-0.5;
|
||||
//fx = Fbmag*randr*delx/r;
|
||||
//fy = Fbmag*randr*dely/r;
|
||||
//fz = Fbmag*randr*delz/r;
|
||||
if (newton_pair || j < nlocal) {
|
||||
//randr = random->uniform()-0.5;
|
||||
//fx = Fbmag*randr*delx/r;
|
||||
//fy = Fbmag*randr*dely/r;
|
||||
//fz = Fbmag*randr*delz/r;
|
||||
|
||||
f[j][0] += fx;
|
||||
f[j][1] += fy;
|
||||
f[j][2] += fz;
|
||||
}
|
||||
|
||||
f[j][0] += fx;
|
||||
f[j][1] += fy;
|
||||
f[j][2] += fz;
|
||||
}
|
||||
|
||||
// torque due to the Brownian Force
|
||||
|
||||
if (flaglog) {
|
||||
|
@ -284,56 +284,56 @@ void PairBrownian::compute(int eflag, int vflag)
|
|||
xl[0] = -delx/r*radi;
|
||||
xl[1] = -dely/r*radi;
|
||||
xl[2] = -delz/r*radi;
|
||||
|
||||
|
||||
// torque = xl_cross_F
|
||||
|
||||
tx = xl[1]*fz - xl[2]*fy;
|
||||
ty = xl[2]*fx - xl[0]*fz;
|
||||
tz = xl[0]*fy - xl[1]*fx;
|
||||
|
||||
tz = xl[0]*fy - xl[1]*fx;
|
||||
|
||||
// torque is same on both particles
|
||||
|
||||
torque[i][0] -= tx;
|
||||
torque[i][1] -= ty;
|
||||
torque[i][2] -= tz;
|
||||
|
||||
if (newton_pair || j < nlocal) {
|
||||
torque[j][0] -= tx;
|
||||
torque[j][1] -= ty;
|
||||
torque[j][2] -= tz;
|
||||
}
|
||||
torque[i][2] -= tz;
|
||||
|
||||
if (newton_pair || j < nlocal) {
|
||||
torque[j][0] -= tx;
|
||||
torque[j][1] -= ty;
|
||||
torque[j][2] -= tz;
|
||||
}
|
||||
|
||||
// torque due to a_pu
|
||||
|
||||
Fbmag = prethermostat*sqrt(a_pu);
|
||||
|
||||
Fbmag = prethermostat*sqrt(a_pu);
|
||||
|
||||
// force in each direction
|
||||
|
||||
randr = random->uniform()-0.5;
|
||||
tx = Fbmag*randr*p2[0];
|
||||
ty = Fbmag*randr*p2[1];
|
||||
tz = Fbmag*randr*p2[2];
|
||||
|
||||
|
||||
randr = random->uniform()-0.5;
|
||||
tx += Fbmag*randr*p3[0];
|
||||
ty += Fbmag*randr*p3[1];
|
||||
tz += Fbmag*randr*p3[2];
|
||||
|
||||
tz += Fbmag*randr*p3[2];
|
||||
|
||||
// torque has opposite sign on two particles
|
||||
|
||||
torque[i][0] -= tx;
|
||||
torque[i][1] -= ty;
|
||||
torque[i][2] -= tz;
|
||||
|
||||
if (newton_pair || j < nlocal) {
|
||||
torque[j][0] += tx;
|
||||
torque[j][1] += ty;
|
||||
torque[j][2] += tz;
|
||||
}
|
||||
torque[i][2] -= tz;
|
||||
|
||||
if (newton_pair || j < nlocal) {
|
||||
torque[j][0] += tx;
|
||||
torque[j][1] += ty;
|
||||
torque[j][2] += tz;
|
||||
}
|
||||
}
|
||||
|
||||
if (evflag) ev_tally_xyz(i,j,nlocal,newton_pair,
|
||||
0.0,0.0,-fx,-fy,-fz,delx,dely,delz);
|
||||
0.0,0.0,-fx,-fy,-fz,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ void PairBrownian::compute(int eflag, int vflag)
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
allocate all arrays
|
||||
allocate all arrays
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairBrownian::allocate()
|
||||
|
@ -366,7 +366,7 @@ void PairBrownian::allocate()
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
global settings
|
||||
global settings
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairBrownian::settings(int narg, char **arg)
|
||||
|
@ -374,12 +374,12 @@ void PairBrownian::settings(int narg, char **arg)
|
|||
if (narg != 7 && narg != 9) error->all(FLERR,"Illegal pair_style command");
|
||||
|
||||
mu = atof(arg[0]);
|
||||
flaglog = atoi(arg[1]);
|
||||
flagfld = atoi(arg[2]);
|
||||
cut_inner_global = atof(arg[3]);
|
||||
cut_global = atof(arg[4]);
|
||||
t_target = atof(arg[5]);
|
||||
seed = atoi(arg[6]);
|
||||
flaglog = atoi(arg[1]);
|
||||
flagfld = atoi(arg[2]);
|
||||
cut_inner_global = atof(arg[3]);
|
||||
cut_global = atof(arg[4]);
|
||||
t_target = atof(arg[5]);
|
||||
seed = atoi(arg[6]);
|
||||
|
||||
flagHI = flagVF = 1;
|
||||
if (narg == 9) {
|
||||
|
@ -389,9 +389,9 @@ void PairBrownian::settings(int narg, char **arg)
|
|||
|
||||
if (flaglog == 1 && flagHI == 0) {
|
||||
error->warning(FLERR,"Cannot include log terms without 1/r terms; "
|
||||
"setting flagHI to 1");
|
||||
"setting flagHI to 1");
|
||||
flagHI = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// initialize Marsaglia RNG with processor-unique seed
|
||||
|
||||
|
@ -427,7 +427,7 @@ void PairBrownian::coeff(int narg, char **arg)
|
|||
|
||||
double cut_inner_one = cut_inner_global;
|
||||
double cut_one = cut_global;
|
||||
|
||||
|
||||
if (narg == 4) {
|
||||
cut_inner_one = atof(arg[2]);
|
||||
cut_one = atof(arg[3]);
|
||||
|
@ -459,8 +459,8 @@ void PairBrownian::init_style()
|
|||
|
||||
if (force->newton_pair == 0 && comm->me == 0)
|
||||
error->warning(FLERR,
|
||||
"Pair brownian needs newton pair on for "
|
||||
"momentum conservation");
|
||||
"Pair brownian needs newton pair on for "
|
||||
"momentum conservation");
|
||||
|
||||
int irequest = neighbor->request(this);
|
||||
|
||||
|
@ -472,7 +472,7 @@ void PairBrownian::init_style()
|
|||
int nlocal = atom->nlocal;
|
||||
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (radius[i] == 0.0)
|
||||
if (radius[i] == 0.0)
|
||||
error->one(FLERR,"Pair brownian requires extended particles");
|
||||
|
||||
// require monodisperse system with same radii for all types
|
||||
|
@ -485,7 +485,7 @@ void PairBrownian::init_style()
|
|||
error->all(FLERR,"Pair brownian requires monodisperse particles");
|
||||
rad = radtype;
|
||||
}
|
||||
|
||||
|
||||
// set the isotropic constants that depend on the volume fraction
|
||||
// vol_T = total volume
|
||||
// check for fix deform, if exists it must use "remap v"
|
||||
|
@ -499,52 +499,52 @@ void PairBrownian::init_style()
|
|||
|
||||
flagdeform = flagwall = 0;
|
||||
for (int i = 0; i < modify->nfix; i++){
|
||||
if (strcmp(modify->fix[i]->style,"deform") == 0)
|
||||
if (strcmp(modify->fix[i]->style,"deform") == 0)
|
||||
flagdeform = 1;
|
||||
else if (strstr(modify->fix[i]->style,"wall") != NULL){
|
||||
flagwall = 1; // Walls exist
|
||||
if (((FixWall *) modify->fix[i])->varflag ) {
|
||||
flagwall = 2; // Moving walls exist
|
||||
wallfix = (FixWall *) modify->fix[i];
|
||||
flagwall = 2; // Moving walls exist
|
||||
wallfix = (FixWall *) modify->fix[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// set the isotropic constants depending on the volume fraction
|
||||
// vol_T = total volumeshearing = flagdeform = flagwall = 0;
|
||||
// vol_T = total volumeshearing = flagdeform = flagwall = 0;
|
||||
double vol_T, wallcoord;
|
||||
if (!flagwall) vol_T = domain->xprd*domain->yprd*domain->zprd;
|
||||
else {
|
||||
else {
|
||||
double wallhi[3], walllo[3];
|
||||
for (int j = 0; j < 3; j++){
|
||||
wallhi[j] = domain->prd[j];
|
||||
walllo[j] = 0;
|
||||
}
|
||||
}
|
||||
for (int m = 0; m < wallfix->nwall; m++){
|
||||
int dim = wallfix->wallwhich[m] / 2;
|
||||
int side = wallfix->wallwhich[m] % 2;
|
||||
if (wallfix->wallstyle[m] == VARIABLE){
|
||||
wallfix->varindex[m] = input->variable->find(wallfix->varstr[m]);
|
||||
// Since fix->wall->init happens after pair->init_style
|
||||
wallcoord = input->variable->compute_equal(wallfix->varindex[m]);
|
||||
wallfix->varindex[m] = input->variable->find(wallfix->varstr[m]);
|
||||
// Since fix->wall->init happens after pair->init_style
|
||||
wallcoord = input->variable->compute_equal(wallfix->varindex[m]);
|
||||
}
|
||||
|
||||
|
||||
else wallcoord = wallfix->coord0[m];
|
||||
|
||||
|
||||
if (side == 0) walllo[dim] = wallcoord;
|
||||
else wallhi[dim] = wallcoord;
|
||||
}
|
||||
vol_T = (wallhi[0] - walllo[0]) * (wallhi[1] - walllo[1]) *
|
||||
vol_T = (wallhi[0] - walllo[0]) * (wallhi[1] - walllo[1]) *
|
||||
(wallhi[2] - walllo[2]);
|
||||
}
|
||||
|
||||
|
||||
// vol_P = volume of particles, assuming mono-dispersity
|
||||
// vol_f = volume fraction
|
||||
|
||||
vol_P = atom->natoms*(4.0/3.0)*MY_PI*pow(rad,3.0);
|
||||
|
||||
|
||||
double vol_f = vol_P/vol_T;
|
||||
|
||||
|
||||
// set isotropic constants
|
||||
if (!flagVF) vol_f = 0;
|
||||
|
||||
|
@ -553,7 +553,7 @@ void PairBrownian::init_style()
|
|||
RT0 = 8*MY_PI*mu*pow(rad,3.0); // not actually needed
|
||||
} else {
|
||||
R0 = 6*MY_PI*mu*rad*(1.0 + 2.725*vol_f - 6.583*vol_f*vol_f);
|
||||
RT0 = 8*MY_PI*mu*pow(rad,3.0)*(1.0 + 0.749*vol_f - 2.469*vol_f*vol_f);
|
||||
RT0 = 8*MY_PI*mu*pow(rad,3.0)*(1.0 + 0.749*vol_f - 2.469*vol_f*vol_f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -574,7 +574,7 @@ double PairBrownian::init_one(int i, int j)
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to restart file
|
||||
proc 0 writes to restart file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairBrownian::write_restart(FILE *fp)
|
||||
|
@ -586,8 +586,8 @@ void PairBrownian::write_restart(FILE *fp)
|
|||
for (j = i; j <= atom->ntypes; j++) {
|
||||
fwrite(&setflag[i][j],sizeof(int),1,fp);
|
||||
if (setflag[i][j]) {
|
||||
fwrite(&cut_inner[i][j],sizeof(double),1,fp);
|
||||
fwrite(&cut[i][j],sizeof(double),1,fp);
|
||||
fwrite(&cut_inner[i][j],sizeof(double),1,fp);
|
||||
fwrite(&cut[i][j],sizeof(double),1,fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -608,12 +608,12 @@ void PairBrownian::read_restart(FILE *fp)
|
|||
if (me == 0) fread(&setflag[i][j],sizeof(int),1,fp);
|
||||
MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world);
|
||||
if (setflag[i][j]) {
|
||||
if (me == 0) {
|
||||
fread(&cut_inner[i][j],sizeof(double),1,fp);
|
||||
fread(&cut[i][j],sizeof(double),1,fp);
|
||||
}
|
||||
MPI_Bcast(&cut_inner[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world);
|
||||
if (me == 0) {
|
||||
fread(&cut_inner[i][j],sizeof(double),1,fp);
|
||||
fread(&cut[i][j],sizeof(double),1,fp);
|
||||
}
|
||||
MPI_Bcast(&cut_inner[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -678,11 +678,11 @@ void PairBrownian::read_restart_settings(FILE *fp)
|
|||
/* ----------------------------------------------------------------------*/
|
||||
|
||||
void PairBrownian::set_3_orthogonal_vectors(double p1[3],
|
||||
double p2[3], double p3[3])
|
||||
double p2[3], double p3[3])
|
||||
{
|
||||
double norm;
|
||||
int ix,iy,iz;
|
||||
|
||||
|
||||
// find the index of maximum magnitude and store it in iz
|
||||
|
||||
if (fabs(p1[0]) > fabs(p1[1])) {
|
||||
|
@ -694,7 +694,7 @@ void PairBrownian::set_3_orthogonal_vectors(double p1[3],
|
|||
ix=2;
|
||||
iy=0;
|
||||
}
|
||||
|
||||
|
||||
if (iz==0) {
|
||||
if (fabs(p1[0]) < fabs(p1[2])) {
|
||||
iz = 2;
|
||||
|
@ -708,24 +708,24 @@ void PairBrownian::set_3_orthogonal_vectors(double p1[3],
|
|||
iy = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// set p2 arbitrarily such that it's orthogonal to p1
|
||||
|
||||
p2[ix]=1.0;
|
||||
p2[iy]=1.0;
|
||||
p2[iy]=1.0;
|
||||
p2[iz] = -(p1[ix]*p2[ix] + p1[iy]*p2[iy])/p1[iz];
|
||||
|
||||
|
||||
// normalize p2
|
||||
|
||||
norm = sqrt(p2[0]*p2[0] + p2[1]*p2[1] + p2[2]*p2[2]);
|
||||
|
||||
|
||||
p2[0] = p2[0]/norm;
|
||||
p2[1] = p2[1]/norm;
|
||||
p2[2] = p2[2]/norm;
|
||||
|
||||
|
||||
// Set p3 by taking the cross product p3=p2xp1
|
||||
|
||||
p3[0] = p1[1]*p2[2] - p1[2]*p2[1];
|
||||
p3[1] = p1[2]*p2[0] - p1[0]*p2[2];
|
||||
p3[2] = p1[0]*p2[1] - p1[1]*p2[0];
|
||||
p3[2] = p1[0]*p2[1] - p1[1]*p2[0];
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -28,7 +28,7 @@ class PairBrownian : public Pair {
|
|||
public:
|
||||
PairBrownian(class LAMMPS *);
|
||||
virtual ~PairBrownian();
|
||||
virtual void compute(int, int);
|
||||
virtual void compute(int, int);
|
||||
void settings(int, char **);
|
||||
void coeff(int, char **);
|
||||
virtual double init_one(int, int);
|
||||
|
@ -36,7 +36,7 @@ class PairBrownian : public Pair {
|
|||
void write_restart(FILE *);
|
||||
void read_restart(FILE *);
|
||||
void write_restart_settings(FILE *);
|
||||
void read_restart_settings(FILE *);
|
||||
void read_restart_settings(FILE *);
|
||||
|
||||
protected:
|
||||
double cut_inner_global,cut_global;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -81,7 +81,7 @@ void PairBrownianPoly::compute(int eflag, int vflag)
|
|||
double prethermostat;
|
||||
double xl[3],a_sq,a_sh,a_pu,Fbmag;
|
||||
double p1[3],p2[3],p3[3];
|
||||
|
||||
|
||||
|
||||
// This section of code adjusts R0/RT0/RS0 if necessary due to changes
|
||||
// in the volume fraction as a result of fix deform or moving walls
|
||||
|
@ -90,37 +90,37 @@ void PairBrownianPoly::compute(int eflag, int vflag)
|
|||
if (flagVF) // Flag for volume fraction corrections
|
||||
if (flagdeform || flagwall == 2){ // Possible changes in volume fraction
|
||||
if (flagdeform && !flagwall)
|
||||
for (j = 0; j < 3; j++)
|
||||
dims[j] = domain->prd[j];
|
||||
for (j = 0; j < 3; j++)
|
||||
dims[j] = domain->prd[j];
|
||||
else if (flagwall == 2 || (flagdeform && flagwall == 1)){
|
||||
double wallhi[3], walllo[3];
|
||||
for (j = 0; j < 3; j++){
|
||||
wallhi[j] = domain->prd[j];
|
||||
walllo[j] = 0;
|
||||
}
|
||||
for (int m = 0; m < wallfix->nwall; m++){
|
||||
int dim = wallfix->wallwhich[m] / 2;
|
||||
int side = wallfix->wallwhich[m] % 2;
|
||||
if (wallfix->wallstyle[m] == VARIABLE){
|
||||
wallcoord = input->variable->compute_equal(wallfix->varindex[m]);
|
||||
}
|
||||
else wallcoord = wallfix->coord0[m];
|
||||
if (side == 0) walllo[dim] = wallcoord;
|
||||
else wallhi[dim] = wallcoord;
|
||||
}
|
||||
for (j = 0; j < 3; j++)
|
||||
dims[j] = wallhi[j] - walllo[j];
|
||||
double wallhi[3], walllo[3];
|
||||
for (j = 0; j < 3; j++){
|
||||
wallhi[j] = domain->prd[j];
|
||||
walllo[j] = 0;
|
||||
}
|
||||
for (int m = 0; m < wallfix->nwall; m++){
|
||||
int dim = wallfix->wallwhich[m] / 2;
|
||||
int side = wallfix->wallwhich[m] % 2;
|
||||
if (wallfix->wallstyle[m] == VARIABLE){
|
||||
wallcoord = input->variable->compute_equal(wallfix->varindex[m]);
|
||||
}
|
||||
else wallcoord = wallfix->coord0[m];
|
||||
if (side == 0) walllo[dim] = wallcoord;
|
||||
else wallhi[dim] = wallcoord;
|
||||
}
|
||||
for (j = 0; j < 3; j++)
|
||||
dims[j] = wallhi[j] - walllo[j];
|
||||
}
|
||||
double vol_T = dims[0]*dims[1]*dims[2];
|
||||
double vol_f = vol_P/vol_T;
|
||||
if (flaglog == 0) {
|
||||
R0 = 6*MY_PI*mu*rad*(1.0 + 2.16*vol_f);
|
||||
RT0 = 8*MY_PI*mu*pow(rad,3.0);
|
||||
//RS0 = 20.0/3.0*MY_PI*mu*pow(rad,3)*(1.0 + 3.33*vol_f + 2.80*vol_f*vol_f);
|
||||
R0 = 6*MY_PI*mu*rad*(1.0 + 2.16*vol_f);
|
||||
RT0 = 8*MY_PI*mu*pow(rad,3.0);
|
||||
//RS0 = 20.0/3.0*MY_PI*mu*pow(rad,3)*(1.0 + 3.33*vol_f + 2.80*vol_f*vol_f);
|
||||
} else {
|
||||
R0 = 6*MY_PI*mu*rad*(1.0 + 2.725*vol_f - 6.583*vol_f*vol_f);
|
||||
RT0 = 8*MY_PI*mu*pow(rad,3.0)*(1.0 + 0.749*vol_f - 2.469*vol_f*vol_f);
|
||||
//RS0 = 20.0/3.0*MY_PI*mu*pow(rad,3)*(1.0 + 3.64*vol_f - 6.95*vol_f*vol_f);
|
||||
R0 = 6*MY_PI*mu*rad*(1.0 + 2.725*vol_f - 6.583*vol_f*vol_f);
|
||||
RT0 = 8*MY_PI*mu*pow(rad,3.0)*(1.0 + 0.749*vol_f - 2.469*vol_f*vol_f);
|
||||
//RS0 = 20.0/3.0*MY_PI*mu*pow(rad,3)*(1.0 + 3.64*vol_f - 6.95*vol_f*vol_f);
|
||||
}
|
||||
}
|
||||
// scale factor for Brownian moments
|
||||
|
@ -142,8 +142,8 @@ void PairBrownianPoly::compute(int eflag, int vflag)
|
|||
itype = type[i];
|
||||
radi = radius[i];
|
||||
jlist = firstneigh[i];
|
||||
jnum = numneigh[i];
|
||||
|
||||
jnum = numneigh[i];
|
||||
|
||||
// FLD contribution to force and torque due to isotropic terms
|
||||
|
||||
if (flagfld) {
|
||||
|
@ -151,16 +151,16 @@ void PairBrownianPoly::compute(int eflag, int vflag)
|
|||
f[i][1] += prethermostat*sqrt(R0*radi)*(random->uniform()-0.5);
|
||||
f[i][2] += prethermostat*sqrt(R0*radi)*(random->uniform()-0.5);
|
||||
if (flaglog) {
|
||||
const double radi3 = radi*radi*radi;
|
||||
torque[i][0] += prethermostat*sqrt(RT0*radi3) *
|
||||
(random->uniform()-0.5);
|
||||
torque[i][1] += prethermostat*sqrt(RT0*radi3) *
|
||||
(random->uniform()-0.5);
|
||||
torque[i][2] += prethermostat*sqrt(RT0*radi3) *
|
||||
(random->uniform()-0.5);
|
||||
const double radi3 = radi*radi*radi;
|
||||
torque[i][0] += prethermostat*sqrt(RT0*radi3) *
|
||||
(random->uniform()-0.5);
|
||||
torque[i][1] += prethermostat*sqrt(RT0*radi3) *
|
||||
(random->uniform()-0.5);
|
||||
torque[i][2] += prethermostat*sqrt(RT0*radi3) *
|
||||
(random->uniform()-0.5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!flagHI) continue;
|
||||
|
||||
for (jj = 0; jj < jnum; jj++) {
|
||||
|
@ -175,99 +175,99 @@ void PairBrownianPoly::compute(int eflag, int vflag)
|
|||
radj = radius[j];
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r = sqrt(rsq);
|
||||
|
||||
r = sqrt(rsq);
|
||||
|
||||
// scalar resistances a_sq and a_sh
|
||||
|
||||
h_sep = r - radi-radj;
|
||||
|
||||
|
||||
// check for overlaps
|
||||
|
||||
if (h_sep < 0.0) overlaps++;
|
||||
|
||||
|
||||
// if less than minimum gap, use minimum gap instead
|
||||
|
||||
if (r < cut_inner[itype][jtype])
|
||||
h_sep = cut_inner[itype][jtype] - radi-radj;
|
||||
|
||||
|
||||
// scale h_sep by radi
|
||||
|
||||
h_sep = h_sep/radi;
|
||||
beta0 = radj/radi;
|
||||
beta1 = 1.0 + beta0;
|
||||
|
||||
|
||||
// scalar resistances
|
||||
|
||||
if (flaglog) {
|
||||
a_sq = beta0*beta0/beta1/beta1/h_sep +
|
||||
(1.0+7.0*beta0+beta0*beta0)/5.0/pow(beta1,3.0)*log(1.0/h_sep);
|
||||
a_sq += (1.0+18.0*beta0-29.0*beta0*beta0+18.0*pow(beta0,3.0) +
|
||||
pow(beta0,4.0))/21.0/pow(beta1,4.0)*h_sep*log(1.0/h_sep);
|
||||
a_sq = beta0*beta0/beta1/beta1/h_sep +
|
||||
(1.0+7.0*beta0+beta0*beta0)/5.0/pow(beta1,3.0)*log(1.0/h_sep);
|
||||
a_sq += (1.0+18.0*beta0-29.0*beta0*beta0+18.0*pow(beta0,3.0) +
|
||||
pow(beta0,4.0))/21.0/pow(beta1,4.0)*h_sep*log(1.0/h_sep);
|
||||
a_sq *= 6.0*MY_PI*mu*radi;
|
||||
a_sh = 4.0*beta0*(2.0+beta0+2.0*beta0*beta0)/15.0/pow(beta1,3.0) *
|
||||
log(1.0/h_sep);
|
||||
a_sh += 4.0*(16.0-45.0*beta0+58.0*beta0*beta0-45.0*pow(beta0,3.0) +
|
||||
16.0*pow(beta0,4.0))/375.0/pow(beta1,4.0) *
|
||||
h_sep*log(1.0/h_sep);
|
||||
a_sh = 4.0*beta0*(2.0+beta0+2.0*beta0*beta0)/15.0/pow(beta1,3.0) *
|
||||
log(1.0/h_sep);
|
||||
a_sh += 4.0*(16.0-45.0*beta0+58.0*beta0*beta0-45.0*pow(beta0,3.0) +
|
||||
16.0*pow(beta0,4.0))/375.0/pow(beta1,4.0) *
|
||||
h_sep*log(1.0/h_sep);
|
||||
a_sh *= 6.0*MY_PI*mu*radi;
|
||||
a_pu = beta0*(4.0+beta0)/10.0/beta1/beta1*log(1.0/h_sep);
|
||||
a_pu += (32.0-33.0*beta0+83.0*beta0*beta0+43.0 *
|
||||
pow(beta0,3.0))/250.0/pow(beta1,3.0)*h_sep*log(1.0/h_sep);
|
||||
a_pu += (32.0-33.0*beta0+83.0*beta0*beta0+43.0 *
|
||||
pow(beta0,3.0))/250.0/pow(beta1,3.0)*h_sep*log(1.0/h_sep);
|
||||
a_pu *= 8.0*MY_PI*mu*pow(radi,3.0);
|
||||
|
||||
} else a_sq = 6.0*MY_PI*mu*radi*(beta0*beta0/beta1/beta1/h_sep);
|
||||
|
||||
|
||||
// generate the Pairwise Brownian Force: a_sq
|
||||
|
||||
Fbmag = prethermostat*sqrt(a_sq);
|
||||
|
||||
|
||||
// generate a random number
|
||||
|
||||
randr = random->uniform()-0.5;
|
||||
|
||||
|
||||
// contribution due to Brownian motion
|
||||
|
||||
fx = Fbmag*randr*delx/r;
|
||||
fy = Fbmag*randr*dely/r;
|
||||
fz = Fbmag*randr*delz/r;
|
||||
|
||||
|
||||
// add terms due to a_sh
|
||||
|
||||
if (flaglog) {
|
||||
|
||||
// generate two orthogonal vectors to the line of centers
|
||||
|
||||
p1[0] = delx/r; p1[1] = dely/r; p1[2] = delz/r;
|
||||
p1[0] = delx/r; p1[1] = dely/r; p1[2] = delz/r;
|
||||
set_3_orthogonal_vectors(p1,p2,p3);
|
||||
|
||||
|
||||
// magnitude
|
||||
|
||||
Fbmag = prethermostat*sqrt(a_sh);
|
||||
|
||||
Fbmag = prethermostat*sqrt(a_sh);
|
||||
|
||||
// force in each of the two directions
|
||||
|
||||
randr = random->uniform()-0.5;
|
||||
fx += Fbmag*randr*p2[0];
|
||||
fy += Fbmag*randr*p2[1];
|
||||
fz += Fbmag*randr*p2[2];
|
||||
|
||||
|
||||
randr = random->uniform()-0.5;
|
||||
fx += Fbmag*randr*p3[0];
|
||||
fy += Fbmag*randr*p3[1];
|
||||
fz += Fbmag*randr*p3[2];
|
||||
}
|
||||
|
||||
fz += Fbmag*randr*p3[2];
|
||||
}
|
||||
|
||||
// scale forces to appropriate units
|
||||
|
||||
fx = vxmu2f*fx;
|
||||
fy = vxmu2f*fy;
|
||||
fz = vxmu2f*fz;
|
||||
|
||||
|
||||
// sum to total Force
|
||||
|
||||
f[i][0] -= fx;
|
||||
f[i][1] -= fy;
|
||||
f[i][2] -= fz;
|
||||
f[i][2] -= fz;
|
||||
|
||||
// torque due to the Brownian Force
|
||||
|
||||
|
@ -278,47 +278,47 @@ void PairBrownianPoly::compute(int eflag, int vflag)
|
|||
xl[0] = -delx/r*radi;
|
||||
xl[1] = -dely/r*radi;
|
||||
xl[2] = -delz/r*radi;
|
||||
|
||||
|
||||
// torque = xl_cross_F
|
||||
|
||||
tx = xl[1]*fz - xl[2]*fy;
|
||||
ty = xl[2]*fx - xl[0]*fz;
|
||||
tz = xl[0]*fy - xl[1]*fx;
|
||||
|
||||
tz = xl[0]*fy - xl[1]*fx;
|
||||
|
||||
// torque is same on both particles
|
||||
|
||||
torque[i][0] -= tx;
|
||||
torque[i][1] -= ty;
|
||||
torque[i][2] -= tz;
|
||||
|
||||
torque[i][2] -= tz;
|
||||
|
||||
// torque due to a_pu
|
||||
|
||||
Fbmag = prethermostat*sqrt(a_pu);
|
||||
|
||||
Fbmag = prethermostat*sqrt(a_pu);
|
||||
|
||||
// force in each direction
|
||||
|
||||
randr = random->uniform()-0.5;
|
||||
tx = Fbmag*randr*p2[0];
|
||||
ty = Fbmag*randr*p2[1];
|
||||
tz = Fbmag*randr*p2[2];
|
||||
|
||||
|
||||
randr = random->uniform()-0.5;
|
||||
tx += Fbmag*randr*p3[0];
|
||||
ty += Fbmag*randr*p3[1];
|
||||
tz += Fbmag*randr*p3[2];
|
||||
|
||||
tz += Fbmag*randr*p3[2];
|
||||
|
||||
// torque has opposite sign on two particles
|
||||
|
||||
torque[i][0] -= tx;
|
||||
torque[i][1] -= ty;
|
||||
torque[i][2] -= tz;
|
||||
|
||||
torque[i][2] -= tz;
|
||||
|
||||
}
|
||||
|
||||
// set j = nlocal so that only I gets tallied
|
||||
// set j = nlocal so that only I gets tallied
|
||||
|
||||
if (evflag) ev_tally_xyz(i,nlocal,nlocal,0,
|
||||
0.0,0.0,-fx,-fy,-fz,delx,dely,delz);
|
||||
0.0,0.0,-fx,-fy,-fz,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -343,61 +343,61 @@ void PairBrownianPoly::init_style()
|
|||
int nlocal = atom->nlocal;
|
||||
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (radius[i] == 0.0)
|
||||
if (radius[i] == 0.0)
|
||||
error->one(FLERR,"Pair brownian/poly requires extended particles");
|
||||
|
||||
int irequest = neighbor->request(this);
|
||||
neighbor->requests[irequest]->half = 0;
|
||||
neighbor->requests[irequest]->full = 1;
|
||||
|
||||
|
||||
// set the isotropic constants that depend on the volume fraction
|
||||
// vol_T = total volume
|
||||
double vol_T, wallcoord;
|
||||
if (!flagwall) vol_T = domain->xprd*domain->yprd*domain->zprd;
|
||||
else {
|
||||
else {
|
||||
double wallhi[3], walllo[3];
|
||||
for (int j = 0; j < 3; j++){
|
||||
wallhi[j] = domain->prd[j];
|
||||
walllo[j] = 0;
|
||||
}
|
||||
}
|
||||
for (int m = 0; m < wallfix->nwall; m++){
|
||||
int dim = wallfix->wallwhich[m] / 2;
|
||||
int side = wallfix->wallwhich[m] % 2;
|
||||
if (wallfix->wallstyle[m] == VARIABLE){
|
||||
wallfix->varindex[m] = input->variable->find(wallfix->varstr[m]);
|
||||
// Since fix->wall->init happens after pair->init_style
|
||||
wallcoord = input->variable->compute_equal(wallfix->varindex[m]);
|
||||
wallfix->varindex[m] = input->variable->find(wallfix->varstr[m]);
|
||||
// Since fix->wall->init happens after pair->init_style
|
||||
wallcoord = input->variable->compute_equal(wallfix->varindex[m]);
|
||||
}
|
||||
|
||||
|
||||
else wallcoord = wallfix->coord0[m];
|
||||
|
||||
|
||||
if (side == 0) walllo[dim] = wallcoord;
|
||||
else wallhi[dim] = wallcoord;
|
||||
}
|
||||
vol_T = (wallhi[0] - walllo[0]) * (wallhi[1] - walllo[1]) *
|
||||
vol_T = (wallhi[0] - walllo[0]) * (wallhi[1] - walllo[1]) *
|
||||
(wallhi[2] - walllo[2]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// vol_P = volume of particles, assuming mono-dispersity
|
||||
// vol_f = volume fraction
|
||||
|
||||
double volP = 0.0;
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
volP += (4.0/3.0)*MY_PI*pow(atom->radius[i],3.0);
|
||||
volP += (4.0/3.0)*MY_PI*pow(atom->radius[i],3.0);
|
||||
MPI_Allreduce(&volP,&vol_P,1,MPI_DOUBLE,MPI_SUM,world);
|
||||
|
||||
double vol_f = vol_P/vol_T;
|
||||
|
||||
if (!flagVF) vol_f = 0;
|
||||
// set isotropic constants
|
||||
|
||||
|
||||
if (flaglog == 0) {
|
||||
R0 = 6*MY_PI*mu*(1.0 + 2.16*vol_f);
|
||||
RT0 = 8*MY_PI*mu;
|
||||
} else {
|
||||
R0 = 6*MY_PI*mu*(1.0 + 2.725*vol_f - 6.583*vol_f*vol_f);
|
||||
RT0 = 8*MY_PI*mu*(1.0 + 0.749*vol_f - 2.469*vol_f*vol_f);
|
||||
RT0 = 8*MY_PI*mu*(1.0 + 0.749*vol_f - 2.469*vol_f*vol_f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -412,6 +412,6 @@ double PairBrownianPoly::init_one(int i, int j)
|
|||
cut[i][j] = mix_distance(cut[i][i],cut[j][j]);
|
||||
}
|
||||
|
||||
cut_inner[j][i] = cut_inner[i][j];
|
||||
cut_inner[j][i] = cut_inner[i][j];
|
||||
return cut[i][j];
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -28,7 +28,7 @@ class PairBrownianPoly : public PairBrownian {
|
|||
public:
|
||||
PairBrownianPoly(class LAMMPS *);
|
||||
~PairBrownianPoly() {}
|
||||
void compute(int, int);
|
||||
void compute(int, int);
|
||||
double init_one(int, int);
|
||||
void init_style();
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -84,7 +84,7 @@ void PairLubricate::compute(int eflag, int vflag)
|
|||
double xtmp,ytmp,ztmp,delx,dely,delz,fpair,fx,fy,fz,tx,ty,tz;
|
||||
double rsq,r,h_sep,radi,tfmag;
|
||||
double vr1,vr2,vr3,vnnr,vn1,vn2,vn3;
|
||||
double vt1,vt2,vt3,wt1,wt2,wt3,wdotn;
|
||||
double vt1,vt2,vt3,wt1,wt2,wt3,wdotn;
|
||||
double inertia,inv_inertia,vRS0;
|
||||
double vi[3],vj[3],wi[3],wj[3],xl[3];
|
||||
double a_sq,a_sh,a_pu,Fbmag,del,delmin,eta;
|
||||
|
@ -110,7 +110,7 @@ void PairLubricate::compute(int eflag, int vflag)
|
|||
int newton_pair = force->newton_pair;
|
||||
|
||||
int overlaps = 0;
|
||||
|
||||
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
|
@ -134,10 +134,10 @@ void PairLubricate::compute(int eflag, int vflag)
|
|||
i = ilist[ii];
|
||||
itype = type[i];
|
||||
radi = radius[i];
|
||||
|
||||
|
||||
domain->x2lamda(x[i],lamda);
|
||||
vstream[0] = h_rate[0]*lamda[0] + h_rate[5]*lamda[1] +
|
||||
h_rate[4]*lamda[2] + h_ratelo[0];
|
||||
vstream[0] = h_rate[0]*lamda[0] + h_rate[5]*lamda[1] +
|
||||
h_rate[4]*lamda[2] + h_ratelo[0];
|
||||
vstream[1] = h_rate[1]*lamda[1] + h_rate[3]*lamda[2] + h_ratelo[1];
|
||||
vstream[2] = h_rate[2]*lamda[2] + h_ratelo[2];
|
||||
v[i][0] -= vstream[0];
|
||||
|
@ -153,7 +153,7 @@ void PairLubricate::compute(int eflag, int vflag)
|
|||
|
||||
Ef[0][0] = h_rate[0]/domain->xprd;
|
||||
Ef[1][1] = h_rate[1]/domain->yprd;
|
||||
Ef[2][2] = h_rate[2]/domain->zprd;
|
||||
Ef[2][2] = h_rate[2]/domain->zprd;
|
||||
Ef[0][1] = Ef[1][0] = 0.5 * h_rate[5]/domain->yprd;
|
||||
Ef[0][2] = Ef[2][0] = 0.5 * h_rate[4]/domain->zprd;
|
||||
Ef[1][2] = Ef[2][1] = 0.5 * h_rate[3]/domain->zprd;
|
||||
|
@ -163,7 +163,7 @@ void PairLubricate::compute(int eflag, int vflag)
|
|||
|
||||
comm->forward_comm_pair(this);
|
||||
}
|
||||
|
||||
|
||||
// This section of code adjusts R0/RT0/RS0 if necessary due to changes
|
||||
// in the volume fraction as a result of fix deform or moving walls
|
||||
|
||||
|
@ -171,45 +171,45 @@ void PairLubricate::compute(int eflag, int vflag)
|
|||
if (flagVF) // Flag for volume fraction corrections
|
||||
if (flagdeform || flagwall == 2){ // Possible changes in volume fraction
|
||||
if (flagdeform && !flagwall)
|
||||
for (j = 0; j < 3; j++)
|
||||
dims[j] = domain->prd[j];
|
||||
for (j = 0; j < 3; j++)
|
||||
dims[j] = domain->prd[j];
|
||||
else if (flagwall == 2 || (flagdeform && flagwall == 1)){
|
||||
double wallhi[3], walllo[3];
|
||||
for (int j = 0; j < 3; j++){
|
||||
wallhi[j] = domain->prd[j];
|
||||
walllo[j] = 0;
|
||||
}
|
||||
for (int m = 0; m < wallfix->nwall; m++){
|
||||
int dim = wallfix->wallwhich[m] / 2;
|
||||
int side = wallfix->wallwhich[m] % 2;
|
||||
if (wallfix->wallstyle[m] == VARIABLE){
|
||||
wallcoord = input->variable->compute_equal(wallfix->varindex[m]);
|
||||
}
|
||||
else wallcoord = wallfix->coord0[m];
|
||||
if (side == 0) walllo[dim] = wallcoord;
|
||||
else wallhi[dim] = wallcoord;
|
||||
}
|
||||
for (int j = 0; j < 3; j++)
|
||||
dims[j] = wallhi[j] - walllo[j];
|
||||
double wallhi[3], walllo[3];
|
||||
for (int j = 0; j < 3; j++){
|
||||
wallhi[j] = domain->prd[j];
|
||||
walllo[j] = 0;
|
||||
}
|
||||
for (int m = 0; m < wallfix->nwall; m++){
|
||||
int dim = wallfix->wallwhich[m] / 2;
|
||||
int side = wallfix->wallwhich[m] % 2;
|
||||
if (wallfix->wallstyle[m] == VARIABLE){
|
||||
wallcoord = input->variable->compute_equal(wallfix->varindex[m]);
|
||||
}
|
||||
else wallcoord = wallfix->coord0[m];
|
||||
if (side == 0) walllo[dim] = wallcoord;
|
||||
else wallhi[dim] = wallcoord;
|
||||
}
|
||||
for (int j = 0; j < 3; j++)
|
||||
dims[j] = wallhi[j] - walllo[j];
|
||||
}
|
||||
double vol_T = dims[0]*dims[1]*dims[2];
|
||||
double vol_f = vol_P/vol_T;
|
||||
if (flaglog == 0) {
|
||||
R0 = 6*MY_PI*mu*rad*(1.0 + 2.16*vol_f);
|
||||
RT0 = 8*MY_PI*mu*pow(rad,3.0);
|
||||
RS0 = 20.0/3.0*MY_PI*mu*pow(rad,3.0)*
|
||||
(1.0 + 3.33*vol_f + 2.80*vol_f*vol_f);
|
||||
R0 = 6*MY_PI*mu*rad*(1.0 + 2.16*vol_f);
|
||||
RT0 = 8*MY_PI*mu*pow(rad,3.0);
|
||||
RS0 = 20.0/3.0*MY_PI*mu*pow(rad,3.0)*
|
||||
(1.0 + 3.33*vol_f + 2.80*vol_f*vol_f);
|
||||
} else {
|
||||
R0 = 6*MY_PI*mu*rad*(1.0 + 2.725*vol_f - 6.583*vol_f*vol_f);
|
||||
RT0 = 8*MY_PI*mu*pow(rad,3.0)*(1.0 + 0.749*vol_f - 2.469*vol_f*vol_f);
|
||||
RS0 = 20.0/3.0*MY_PI*mu*pow(rad,3.0)*
|
||||
(1.0 + 3.64*vol_f - 6.95*vol_f*vol_f);
|
||||
R0 = 6*MY_PI*mu*rad*(1.0 + 2.725*vol_f - 6.583*vol_f*vol_f);
|
||||
RT0 = 8*MY_PI*mu*pow(rad,3.0)*(1.0 + 0.749*vol_f - 2.469*vol_f*vol_f);
|
||||
RS0 = 20.0/3.0*MY_PI*mu*pow(rad,3.0)*
|
||||
(1.0 + 3.64*vol_f - 6.95*vol_f*vol_f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// end of R0 adjustment code
|
||||
|
||||
|
||||
|
||||
for (ii = 0; ii < inum; ii++) {
|
||||
i = ilist[ii];
|
||||
|
@ -219,30 +219,30 @@ void PairLubricate::compute(int eflag, int vflag)
|
|||
itype = type[i];
|
||||
radi = radius[i];
|
||||
jlist = firstneigh[i];
|
||||
jnum = numneigh[i];
|
||||
jnum = numneigh[i];
|
||||
|
||||
// angular velocity
|
||||
|
||||
wi[0] = omega[i][0];
|
||||
wi[1] = omega[i][1];
|
||||
wi[2] = omega[i][2];
|
||||
|
||||
wi[2] = omega[i][2];
|
||||
|
||||
// FLD contribution to force and torque due to isotropic terms
|
||||
// FLD contribution to stress from isotropic RS0
|
||||
|
||||
if (flagfld) {
|
||||
f[i][0] -= vxmu2f*R0*v[i][0];
|
||||
f[i][1] -= vxmu2f*R0*v[i][1];
|
||||
f[i][2] -= vxmu2f*R0*v[i][2];
|
||||
f[i][2] -= vxmu2f*R0*v[i][2];
|
||||
torque[i][0] -= vxmu2f*RT0*wi[0];
|
||||
torque[i][1] -= vxmu2f*RT0*wi[1];
|
||||
torque[i][2] -= vxmu2f*RT0*wi[2];
|
||||
torque[i][2] -= vxmu2f*RT0*wi[2];
|
||||
|
||||
if (shearing && vflag_either) {
|
||||
vRS0 = -vxmu2f * RS0;
|
||||
v_tally_tensor(i,i,nlocal,newton_pair,
|
||||
vRS0*Ef[0][0],vRS0*Ef[1][1],vRS0*Ef[2][2],
|
||||
vRS0*Ef[0][1],vRS0*Ef[0][2],vRS0*Ef[1][2]);
|
||||
vRS0 = -vxmu2f * RS0;
|
||||
v_tally_tensor(i,i,nlocal,newton_pair,
|
||||
vRS0*Ef[0][0],vRS0*Ef[1][1],vRS0*Ef[2][2],
|
||||
vRS0*Ef[0][1],vRS0*Ef[0][2],vRS0*Ef[1][2]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -259,20 +259,20 @@ void PairLubricate::compute(int eflag, int vflag)
|
|||
jtype = type[j];
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r = sqrt(rsq);
|
||||
|
||||
r = sqrt(rsq);
|
||||
|
||||
// angular momentum = I*omega = 2/5 * M*R^2 * omega
|
||||
|
||||
wj[0] = omega[j][0];
|
||||
wj[1] = omega[j][1];
|
||||
wj[2] = omega[j][2];
|
||||
|
||||
wj[0] = omega[j][0];
|
||||
wj[1] = omega[j][1];
|
||||
wj[2] = omega[j][2];
|
||||
|
||||
// xl = point of closest approach on particle i from its center
|
||||
|
||||
xl[0] = -delx/r*radi;
|
||||
xl[1] = -dely/r*radi;
|
||||
xl[2] = -delz/r*radi;
|
||||
|
||||
|
||||
// velocity at the point of closest approach on both particles
|
||||
// v = v + omega_cross_xl - Ef.xl
|
||||
|
||||
|
@ -280,41 +280,41 @@ void PairLubricate::compute(int eflag, int vflag)
|
|||
|
||||
vi[0] = v[i][0] + (wi[1]*xl[2] - wi[2]*xl[1])
|
||||
- (Ef[0][0]*xl[0] + Ef[0][1]*xl[1] + Ef[0][2]*xl[2]);
|
||||
|
||||
|
||||
vi[1] = v[i][1] + (wi[2]*xl[0] - wi[0]*xl[2])
|
||||
- (Ef[1][0]*xl[0] + Ef[1][1]*xl[1] + Ef[1][2]*xl[2]);
|
||||
|
||||
|
||||
vi[2] = v[i][2] + (wi[0]*xl[1] - wi[1]*xl[0])
|
||||
- (Ef[2][0]*xl[0] + Ef[2][1]*xl[1] + Ef[2][2]*xl[2]);
|
||||
|
||||
|
||||
// particle j
|
||||
|
||||
vj[0] = v[j][0] - (wj[1]*xl[2] - wj[2]*xl[1])
|
||||
+ (Ef[0][0]*xl[0] + Ef[0][1]*xl[1] + Ef[0][2]*xl[2]);
|
||||
|
||||
|
||||
vj[1] = v[j][1] - (wj[2]*xl[0] - wj[0]*xl[2])
|
||||
+ (Ef[1][0]*xl[0] + Ef[1][1]*xl[1] + Ef[1][2]*xl[2]);
|
||||
|
||||
|
||||
vj[2] = v[j][2] - (wj[0]*xl[1] - wj[1]*xl[0])
|
||||
+ (Ef[2][0]*xl[0] + Ef[2][1]*xl[1] + Ef[2][2]*xl[2]);
|
||||
|
||||
|
||||
// scalar resistances XA and YA
|
||||
|
||||
h_sep = r - 2.0*radi;
|
||||
|
||||
|
||||
// check for overlaps
|
||||
|
||||
if (h_sep < 0.0) overlaps++;
|
||||
|
||||
|
||||
// if less than the minimum gap use the minimum gap instead
|
||||
|
||||
if (r < cut_inner[itype][jtype])
|
||||
h_sep = cut_inner[itype][jtype] - 2.0*radi;
|
||||
|
||||
h_sep = cut_inner[itype][jtype] - 2.0*radi;
|
||||
|
||||
// scale h_sep by radi
|
||||
|
||||
h_sep = h_sep/radi;
|
||||
|
||||
|
||||
// scalar resistances
|
||||
|
||||
if (flaglog) {
|
||||
|
@ -323,14 +323,14 @@ void PairLubricate::compute(int eflag, int vflag)
|
|||
a_pu = 8.0*MY_PI*mu*pow(radi,3.0)*(3.0/160.0*log(1.0/h_sep));
|
||||
} else
|
||||
a_sq = 6.0*MY_PI*mu*radi*(1.0/4.0/h_sep);
|
||||
|
||||
|
||||
// relative velocity at the point of closest approach
|
||||
// includes fluid velocity
|
||||
// includes fluid velocity
|
||||
|
||||
vr1 = vi[0] - vj[0];
|
||||
vr2 = vi[1] - vj[1];
|
||||
vr3 = vi[2] - vj[2];
|
||||
|
||||
|
||||
// normal component (vr.n)n
|
||||
|
||||
vnnr = (vr1*delx + vr2*dely + vr3*delz)/r;
|
||||
|
@ -355,7 +355,7 @@ void PairLubricate::compute(int eflag, int vflag)
|
|||
if (flaglog) {
|
||||
fx = fx + a_sh*vt1;
|
||||
fy = fy + a_sh*vt2;
|
||||
fz = fz + a_sh*vt3;
|
||||
fz = fz + a_sh*vt3;
|
||||
}
|
||||
|
||||
// scale forces for appropriate units
|
||||
|
@ -363,65 +363,65 @@ void PairLubricate::compute(int eflag, int vflag)
|
|||
fx *= vxmu2f;
|
||||
fy *= vxmu2f;
|
||||
fz *= vxmu2f;
|
||||
|
||||
|
||||
// add to total force
|
||||
|
||||
f[i][0] -= fx;
|
||||
f[i][1] -= fy;
|
||||
f[i][2] -= fz;
|
||||
|
||||
f[i][2] -= fz;
|
||||
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] += fx;
|
||||
f[j][1] += fy;
|
||||
f[j][2] += fz;
|
||||
f[j][2] += fz;
|
||||
}
|
||||
|
||||
|
||||
// torque due to this force
|
||||
|
||||
if (flaglog) {
|
||||
tx = xl[1]*fz - xl[2]*fy;
|
||||
ty = xl[2]*fx - xl[0]*fz;
|
||||
tz = xl[0]*fy - xl[1]*fx;
|
||||
|
||||
tz = xl[0]*fy - xl[1]*fx;
|
||||
|
||||
torque[i][0] -= vxmu2f*tx;
|
||||
torque[i][1] -= vxmu2f*ty;
|
||||
torque[i][2] -= vxmu2f*tz;
|
||||
|
||||
torque[i][2] -= vxmu2f*tz;
|
||||
|
||||
if (newton_pair || j < nlocal) {
|
||||
torque[j][0] -= vxmu2f*tx;
|
||||
torque[j][1] -= vxmu2f*ty;
|
||||
torque[j][2] -= vxmu2f*tz;
|
||||
}
|
||||
|
||||
|
||||
// torque due to a_pu
|
||||
|
||||
wdotn = ((wi[0]-wj[0])*delx + (wi[1]-wj[1])*dely +
|
||||
(wi[2]-wj[2])*delz)/r;
|
||||
wdotn = ((wi[0]-wj[0])*delx + (wi[1]-wj[1])*dely +
|
||||
(wi[2]-wj[2])*delz)/r;
|
||||
wt1 = (wi[0]-wj[0]) - wdotn*delx/r;
|
||||
wt2 = (wi[1]-wj[1]) - wdotn*dely/r;
|
||||
wt3 = (wi[2]-wj[2]) - wdotn*delz/r;
|
||||
|
||||
|
||||
tx = a_pu*wt1;
|
||||
ty = a_pu*wt2;
|
||||
tz = a_pu*wt3;
|
||||
|
||||
|
||||
torque[i][0] -= vxmu2f*tx;
|
||||
torque[i][1] -= vxmu2f*ty;
|
||||
torque[i][2] -= vxmu2f*tz;
|
||||
|
||||
torque[i][2] -= vxmu2f*tz;
|
||||
|
||||
if (newton_pair || j < nlocal) {
|
||||
torque[j][0] += vxmu2f*tx;
|
||||
torque[j][1] += vxmu2f*ty;
|
||||
torque[j][2] += vxmu2f*tz;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (evflag) ev_tally_xyz(i,j,nlocal,newton_pair,
|
||||
0.0,0.0,-fx,-fy,-fz,delx,dely,delz);
|
||||
0.0,0.0,-fx,-fy,-fz,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// restore streaming component of velocity, omega, angmom
|
||||
|
||||
if (shearing) {
|
||||
|
@ -432,10 +432,10 @@ void PairLubricate::compute(int eflag, int vflag)
|
|||
i = ilist[ii];
|
||||
itype = type[i];
|
||||
radi = radius[i];
|
||||
|
||||
|
||||
domain->x2lamda(x[i],lamda);
|
||||
vstream[0] = h_rate[0]*lamda[0] + h_rate[5]*lamda[1] +
|
||||
h_rate[4]*lamda[2] + h_ratelo[0];
|
||||
vstream[0] = h_rate[0]*lamda[0] + h_rate[5]*lamda[1] +
|
||||
h_rate[4]*lamda[2] + h_ratelo[0];
|
||||
vstream[1] = h_rate[1]*lamda[1] + h_rate[3]*lamda[2] + h_ratelo[1];
|
||||
vstream[2] = h_rate[2]*lamda[2] + h_ratelo[2];
|
||||
v[i][0] += vstream[0];
|
||||
|
@ -457,12 +457,12 @@ void PairLubricate::compute(int eflag, int vflag)
|
|||
if (overlaps_all && comm->me == 0)
|
||||
printf("Number of overlaps = %d\n",overlaps);
|
||||
}
|
||||
|
||||
|
||||
if (vflag_fdotr) virial_fdotr_compute();
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
allocate all arrays
|
||||
allocate all arrays
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLubricate::allocate()
|
||||
|
@ -482,7 +482,7 @@ void PairLubricate::allocate()
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
global settings
|
||||
global settings
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLubricate::settings(int narg, char **arg)
|
||||
|
@ -503,9 +503,9 @@ void PairLubricate::settings(int narg, char **arg)
|
|||
|
||||
if (flaglog == 1 && flagHI == 0) {
|
||||
error->warning(FLERR,"Cannot include log terms without 1/r terms; "
|
||||
"setting flagHI to 1");
|
||||
"setting flagHI to 1");
|
||||
flagHI = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// reset cutoffs that have been explicitly set
|
||||
|
||||
|
@ -587,51 +587,51 @@ void PairLubricate::init_style()
|
|||
// due to walls, set volume appropriately; if walls will
|
||||
// move, set appropriate flag so that volume and v.f. corrections
|
||||
// are re-calculated at every step.
|
||||
|
||||
|
||||
shearing = flagdeform = flagwall = 0;
|
||||
for (int i = 0; i < modify->nfix; i++){
|
||||
if (strcmp(modify->fix[i]->style,"deform") == 0) {
|
||||
shearing = flagdeform = 1;
|
||||
if (((FixDeform *) modify->fix[i])->remapflag != V_REMAP)
|
||||
error->all(FLERR,"Using pair lubricate with inconsistent "
|
||||
"fix deform remap option");
|
||||
if (((FixDeform *) modify->fix[i])->remapflag != V_REMAP)
|
||||
error->all(FLERR,"Using pair lubricate with inconsistent "
|
||||
"fix deform remap option");
|
||||
}
|
||||
if (strstr(modify->fix[i]->style,"wall") != NULL){
|
||||
flagwall = 1; // Walls exist
|
||||
if (((FixWall *) modify->fix[i])->varflag ) {
|
||||
flagwall = 2; // Moving walls exist
|
||||
wallfix = (FixWall *) modify->fix[i];
|
||||
flagwall = 2; // Moving walls exist
|
||||
wallfix = (FixWall *) modify->fix[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// set the isotropic constants that depend on the volume fraction
|
||||
// vol_T = total volume
|
||||
|
||||
double vol_T;
|
||||
double wallcoord;
|
||||
if (!flagwall) vol_T = domain->xprd*domain->yprd*domain->zprd;
|
||||
else {
|
||||
else {
|
||||
double wallhi[3], walllo[3];
|
||||
for (int j = 0; j < 3; j++){
|
||||
wallhi[j] = domain->prd[j];
|
||||
walllo[j] = 0;
|
||||
}
|
||||
}
|
||||
for (int m = 0; m < wallfix->nwall; m++){
|
||||
int dim = wallfix->wallwhich[m] / 2;
|
||||
int side = wallfix->wallwhich[m] % 2;
|
||||
if (wallfix->wallstyle[m] == VARIABLE){
|
||||
wallfix->varindex[m] = input->variable->find(wallfix->varstr[m]);
|
||||
//Since fix->wall->init happens after pair->init_style
|
||||
wallcoord = input->variable->compute_equal(wallfix->varindex[m]);
|
||||
wallfix->varindex[m] = input->variable->find(wallfix->varstr[m]);
|
||||
//Since fix->wall->init happens after pair->init_style
|
||||
wallcoord = input->variable->compute_equal(wallfix->varindex[m]);
|
||||
}
|
||||
|
||||
else wallcoord = wallfix->coord0[m];
|
||||
|
||||
|
||||
if (side == 0) walllo[dim] = wallcoord;
|
||||
else wallhi[dim] = wallcoord;
|
||||
}
|
||||
vol_T = (wallhi[0] - walllo[0]) * (wallhi[1] - walllo[1]) *
|
||||
vol_T = (wallhi[0] - walllo[0]) * (wallhi[1] - walllo[1]) *
|
||||
(wallhi[2] - walllo[2]);
|
||||
}
|
||||
|
||||
|
@ -642,16 +642,16 @@ void PairLubricate::init_style()
|
|||
double vol_f = vol_P/vol_T;
|
||||
|
||||
if (!flagVF) vol_f = 0;
|
||||
|
||||
|
||||
// set isotropic constants for FLD
|
||||
|
||||
|
||||
if (flaglog == 0) {
|
||||
R0 = 6*MY_PI*mu*rad*(1.0 + 2.16*vol_f);
|
||||
RT0 = 8*MY_PI*mu*pow(rad,3.0);
|
||||
RS0 = 20.0/3.0*MY_PI*mu*pow(rad,3.0)*(1.0 + 3.33*vol_f + 2.80*vol_f*vol_f);
|
||||
} else {
|
||||
R0 = 6*MY_PI*mu*rad*(1.0 + 2.725*vol_f - 6.583*vol_f*vol_f);
|
||||
RT0 = 8*MY_PI*mu*pow(rad,3.0)*(1.0 + 0.749*vol_f - 2.469*vol_f*vol_f);
|
||||
RT0 = 8*MY_PI*mu*pow(rad,3.0)*(1.0 + 0.749*vol_f - 2.469*vol_f*vol_f);
|
||||
RS0 = 20.0/3.0*MY_PI*mu*pow(rad,3.0)*(1.0 + 3.64*vol_f - 6.95*vol_f*vol_f);
|
||||
}
|
||||
|
||||
|
@ -680,7 +680,7 @@ double PairLubricate::init_one(int i, int j)
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to restart file
|
||||
proc 0 writes to restart file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLubricate::write_restart(FILE *fp)
|
||||
|
@ -692,8 +692,8 @@ void PairLubricate::write_restart(FILE *fp)
|
|||
for (j = i; j <= atom->ntypes; j++) {
|
||||
fwrite(&setflag[i][j],sizeof(int),1,fp);
|
||||
if (setflag[i][j]) {
|
||||
fwrite(&cut_inner[i][j],sizeof(double),1,fp);
|
||||
fwrite(&cut[i][j],sizeof(double),1,fp);
|
||||
fwrite(&cut_inner[i][j],sizeof(double),1,fp);
|
||||
fwrite(&cut[i][j],sizeof(double),1,fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -714,12 +714,12 @@ void PairLubricate::read_restart(FILE *fp)
|
|||
if (me == 0) fread(&setflag[i][j],sizeof(int),1,fp);
|
||||
MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world);
|
||||
if (setflag[i][j]) {
|
||||
if (me == 0) {
|
||||
fread(&cut_inner[i][j],sizeof(double),1,fp);
|
||||
fread(&cut[i][j],sizeof(double),1,fp);
|
||||
}
|
||||
MPI_Bcast(&cut_inner[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world);
|
||||
if (me == 0) {
|
||||
fread(&cut_inner[i][j],sizeof(double),1,fp);
|
||||
fread(&cut[i][j],sizeof(double),1,fp);
|
||||
}
|
||||
MPI_Bcast(&cut_inner[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -757,7 +757,7 @@ void PairLubricate::read_restart_settings(FILE *fp)
|
|||
fread(&offset_flag,sizeof(int),1,fp);
|
||||
fread(&mix_flag,sizeof(int),1,fp);
|
||||
fread(&flagHI,sizeof(int),1,fp);
|
||||
fread(&flagVF,sizeof(int),1,fp);
|
||||
fread(&flagVF,sizeof(int),1,fp);
|
||||
}
|
||||
MPI_Bcast(&mu,1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&flaglog,1,MPI_INT,0,world);
|
||||
|
@ -773,7 +773,7 @@ void PairLubricate::read_restart_settings(FILE *fp)
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int PairLubricate::pack_comm(int n, int *list, double *buf,
|
||||
int pbc_flag, int *pbc)
|
||||
int pbc_flag, int *pbc)
|
||||
{
|
||||
int i,j,m;
|
||||
|
||||
|
@ -834,7 +834,7 @@ int PairLubricate::pre_adapt(char *name, int ilo, int ihi, int jlo, int jhi)
|
|||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLubricate::adapt(int which, int ilo, int ihi, int jlo, int jhi,
|
||||
double value)
|
||||
double value)
|
||||
{
|
||||
mu = value;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -69,7 +69,7 @@ void PairLubricatePoly::compute(int eflag, int vflag)
|
|||
double xtmp,ytmp,ztmp,delx,dely,delz,fpair,fx,fy,fz,tx,ty,tz;
|
||||
double rsq,r,h_sep,h_sepj,beta0,beta1,betaj,betaj1,radi,radj,tfmag;
|
||||
double vr1,vr2,vr3,vnnr,vn1,vn2,vn3;
|
||||
double vt1,vt2,vt3,wt1,wt2,wt3,wdotn;
|
||||
double vt1,vt2,vt3,wt1,wt2,wt3,wdotn;
|
||||
double inertia,inv_inertia,vRS0;
|
||||
double vi[3],vj[3],wi[3],wj[3],xl[3],jl[3];
|
||||
double a_sq,a_sh,a_pu,Fbmag,del,delmin,eta;
|
||||
|
@ -95,7 +95,7 @@ void PairLubricatePoly::compute(int eflag, int vflag)
|
|||
int newton_pair = force->newton_pair;
|
||||
|
||||
int overlaps = 0;
|
||||
|
||||
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
|
@ -120,8 +120,8 @@ void PairLubricatePoly::compute(int eflag, int vflag)
|
|||
itype = type[i];
|
||||
radi = radius[i];
|
||||
domain->x2lamda(x[i],lamda);
|
||||
vstream[0] = h_rate[0]*lamda[0] + h_rate[5]*lamda[1] +
|
||||
h_rate[4]*lamda[2] + h_ratelo[0];
|
||||
vstream[0] = h_rate[0]*lamda[0] + h_rate[5]*lamda[1] +
|
||||
h_rate[4]*lamda[2] + h_ratelo[0];
|
||||
vstream[1] = h_rate[1]*lamda[1] + h_rate[3]*lamda[2] + h_ratelo[1];
|
||||
vstream[2] = h_rate[2]*lamda[2] + h_ratelo[2];
|
||||
v[i][0] -= vstream[0];
|
||||
|
@ -137,7 +137,7 @@ void PairLubricatePoly::compute(int eflag, int vflag)
|
|||
|
||||
Ef[0][0] = h_rate[0]/domain->xprd;
|
||||
Ef[1][1] = h_rate[1]/domain->yprd;
|
||||
Ef[2][2] = h_rate[2]/domain->zprd;
|
||||
Ef[2][2] = h_rate[2]/domain->zprd;
|
||||
Ef[0][1] = Ef[1][0] = 0.5 * h_rate[5]/domain->yprd;
|
||||
Ef[0][2] = Ef[2][0] = 0.5 * h_rate[4]/domain->zprd;
|
||||
Ef[1][2] = Ef[2][1] = 0.5 * h_rate[3]/domain->zprd;
|
||||
|
@ -147,7 +147,7 @@ void PairLubricatePoly::compute(int eflag, int vflag)
|
|||
|
||||
comm->forward_comm_pair(this);
|
||||
}
|
||||
|
||||
|
||||
// This section of code adjusts R0/RT0/RS0 if necessary due to changes
|
||||
// in the volume fraction as a result of fix deform or moving walls
|
||||
|
||||
|
@ -155,43 +155,43 @@ void PairLubricatePoly::compute(int eflag, int vflag)
|
|||
if (flagVF) // Flag for volume fraction corrections
|
||||
if (flagdeform || flagwall == 2){ // Possible changes in volume fraction
|
||||
if (flagdeform && !flagwall)
|
||||
for (j = 0; j < 3; j++)
|
||||
dims[j] = domain->prd[j];
|
||||
for (j = 0; j < 3; j++)
|
||||
dims[j] = domain->prd[j];
|
||||
else if (flagwall == 2 || (flagdeform && flagwall == 1)){
|
||||
double wallhi[3], walllo[3];
|
||||
for (int j = 0; j < 3; j++){
|
||||
wallhi[j] = domain->prd[j];
|
||||
walllo[j] = 0;
|
||||
}
|
||||
for (int m = 0; m < wallfix->nwall; m++){
|
||||
int dim = wallfix->wallwhich[m] / 2;
|
||||
int side = wallfix->wallwhich[m] % 2;
|
||||
if (wallfix->wallstyle[m] == VARIABLE){
|
||||
wallcoord = input->variable->compute_equal(wallfix->varindex[m]);
|
||||
}
|
||||
else wallcoord = wallfix->coord0[m];
|
||||
if (side == 0) walllo[dim] = wallcoord;
|
||||
else wallhi[dim] = wallcoord;
|
||||
}
|
||||
for (int j = 0; j < 3; j++)
|
||||
dims[j] = wallhi[j] - walllo[j];
|
||||
double wallhi[3], walllo[3];
|
||||
for (int j = 0; j < 3; j++){
|
||||
wallhi[j] = domain->prd[j];
|
||||
walllo[j] = 0;
|
||||
}
|
||||
for (int m = 0; m < wallfix->nwall; m++){
|
||||
int dim = wallfix->wallwhich[m] / 2;
|
||||
int side = wallfix->wallwhich[m] % 2;
|
||||
if (wallfix->wallstyle[m] == VARIABLE){
|
||||
wallcoord = input->variable->compute_equal(wallfix->varindex[m]);
|
||||
}
|
||||
else wallcoord = wallfix->coord0[m];
|
||||
if (side == 0) walllo[dim] = wallcoord;
|
||||
else wallhi[dim] = wallcoord;
|
||||
}
|
||||
for (int j = 0; j < 3; j++)
|
||||
dims[j] = wallhi[j] - walllo[j];
|
||||
}
|
||||
double vol_T = dims[0]*dims[1]*dims[2];
|
||||
double vol_f = vol_P/vol_T;
|
||||
if (flaglog == 0) {
|
||||
R0 = 6*MY_PI*mu*(1.0 + 2.16*vol_f);
|
||||
RT0 = 8*MY_PI*mu;
|
||||
RS0 = 20.0/3.0*MY_PI*mu*(1.0 + 3.33*vol_f + 2.80*vol_f*vol_f);
|
||||
R0 = 6*MY_PI*mu*(1.0 + 2.16*vol_f);
|
||||
RT0 = 8*MY_PI*mu;
|
||||
RS0 = 20.0/3.0*MY_PI*mu*(1.0 + 3.33*vol_f + 2.80*vol_f*vol_f);
|
||||
} else {
|
||||
R0 = 6*MY_PI*mu*(1.0 + 2.725*vol_f - 6.583*vol_f*vol_f);
|
||||
RT0 = 8*MY_PI*mu*(1.0 + 0.749*vol_f - 2.469*vol_f*vol_f);
|
||||
RS0 = 20.0/3.0*MY_PI*mu*(1.0 + 3.64*vol_f - 6.95*vol_f*vol_f);
|
||||
R0 = 6*MY_PI*mu*(1.0 + 2.725*vol_f - 6.583*vol_f*vol_f);
|
||||
RT0 = 8*MY_PI*mu*(1.0 + 0.749*vol_f - 2.469*vol_f*vol_f);
|
||||
RS0 = 20.0/3.0*MY_PI*mu*(1.0 + 3.64*vol_f - 6.95*vol_f*vol_f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// end of R0 adjustment code
|
||||
|
||||
// end of R0 adjustment code
|
||||
|
||||
for (ii = 0; ii < inum; ii++) {
|
||||
i = ilist[ii];
|
||||
xtmp = x[i][0];
|
||||
|
@ -199,15 +199,15 @@ void PairLubricatePoly::compute(int eflag, int vflag)
|
|||
ztmp = x[i][2];
|
||||
itype = type[i];
|
||||
jlist = firstneigh[i];
|
||||
jnum = numneigh[i];
|
||||
jnum = numneigh[i];
|
||||
radi = radius[i];
|
||||
|
||||
// angular velocity
|
||||
|
||||
wi[0] = omega[i][0];
|
||||
wi[1] = omega[i][1];
|
||||
wi[2] = omega[i][2];
|
||||
|
||||
wi[2] = omega[i][2];
|
||||
|
||||
// FLD contribution to force and torque due to isotropic terms
|
||||
// FLD contribution to stress from isotropic RS0
|
||||
|
||||
|
@ -215,21 +215,21 @@ void PairLubricatePoly::compute(int eflag, int vflag)
|
|||
f[i][0] -= vxmu2f*R0*radi*v[i][0];
|
||||
f[i][1] -= vxmu2f*R0*radi*v[i][1];
|
||||
f[i][2] -= vxmu2f*R0*radi*v[i][2];
|
||||
const double radi3 = radi*radi*radi;
|
||||
const double radi3 = radi*radi*radi;
|
||||
torque[i][0] -= vxmu2f*RT0*radi3*wi[0];
|
||||
torque[i][1] -= vxmu2f*RT0*radi3*wi[1];
|
||||
torque[i][2] -= vxmu2f*RT0*radi3*wi[2];
|
||||
|
||||
torque[i][2] -= vxmu2f*RT0*radi3*wi[2];
|
||||
|
||||
if (shearing && vflag_either) {
|
||||
vRS0 = -vxmu2f * RS0*radi3;
|
||||
v_tally_tensor(i,i,nlocal,newton_pair,
|
||||
vRS0*Ef[0][0],vRS0*Ef[1][1],vRS0*Ef[2][2],
|
||||
vRS0*Ef[0][1],vRS0*Ef[0][2],vRS0*Ef[1][2]);
|
||||
vRS0 = -vxmu2f * RS0*radi3;
|
||||
v_tally_tensor(i,i,nlocal,newton_pair,
|
||||
vRS0*Ef[0][0],vRS0*Ef[1][1],vRS0*Ef[2][2],
|
||||
vRS0*Ef[0][1],vRS0*Ef[0][2],vRS0*Ef[1][2]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!flagHI) continue;
|
||||
|
||||
|
||||
for (jj = 0; jj < jnum; jj++) {
|
||||
j = jlist[jj];
|
||||
delx = xtmp - x[j][0];
|
||||
|
@ -240,13 +240,13 @@ void PairLubricatePoly::compute(int eflag, int vflag)
|
|||
radj = atom->radius[j];
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r = sqrt(rsq);
|
||||
|
||||
r = sqrt(rsq);
|
||||
|
||||
// angular momentum = I*omega = 2/5 * M*R^2 * omega
|
||||
|
||||
wj[0] = omega[j][0];
|
||||
wj[1] = omega[j][1];
|
||||
wj[2] = omega[j][2];
|
||||
wj[0] = omega[j][0];
|
||||
wj[1] = omega[j][1];
|
||||
wj[2] = omega[j][2];
|
||||
|
||||
// xl = point of closest approach on particle i from its center
|
||||
|
||||
|
@ -256,7 +256,7 @@ void PairLubricatePoly::compute(int eflag, int vflag)
|
|||
jl[0] = -delx/r*radj;
|
||||
jl[1] = -dely/r*radj;
|
||||
jl[2] = -delz/r*radj;
|
||||
|
||||
|
||||
// velocity at the point of closest approach on both particles
|
||||
// v = v + omega_cross_xl - Ef.xl
|
||||
|
||||
|
@ -264,71 +264,71 @@ void PairLubricatePoly::compute(int eflag, int vflag)
|
|||
|
||||
vi[0] = v[i][0] + (wi[1]*xl[2] - wi[2]*xl[1])
|
||||
- (Ef[0][0]*xl[0] + Ef[0][1]*xl[1] + Ef[0][2]*xl[2]);
|
||||
|
||||
|
||||
vi[1] = v[i][1] + (wi[2]*xl[0] - wi[0]*xl[2])
|
||||
- (Ef[1][0]*xl[0] + Ef[1][1]*xl[1] + Ef[1][2]*xl[2]);
|
||||
|
||||
|
||||
vi[2] = v[i][2] + (wi[0]*xl[1] - wi[1]*xl[0])
|
||||
- (Ef[2][0]*xl[0] + Ef[2][1]*xl[1] + Ef[2][2]*xl[2]);
|
||||
|
||||
|
||||
// particle j
|
||||
|
||||
vj[0] = v[j][0] - (wj[1]*jl[2] - wj[2]*jl[1])
|
||||
+ (Ef[0][0]*jl[0] + Ef[0][1]*jl[1] + Ef[0][2]*jl[2]);
|
||||
|
||||
|
||||
vj[1] = v[j][1] - (wj[2]*jl[0] - wj[0]*jl[2])
|
||||
+ (Ef[1][0]*jl[0] + Ef[1][1]*jl[1] + Ef[1][2]*jl[2]);
|
||||
|
||||
|
||||
vj[2] = v[j][2] - (wj[0]*jl[1] - wj[1]*jl[0])
|
||||
+ (Ef[2][0]*jl[0] + Ef[2][1]*jl[1] + Ef[2][2]*jl[2]);
|
||||
|
||||
|
||||
// scalar resistances XA and YA
|
||||
|
||||
h_sep = r - radi-radj;
|
||||
|
||||
|
||||
// check for overlaps
|
||||
|
||||
if (h_sep < 0.0) overlaps++;
|
||||
|
||||
|
||||
// if less than the minimum gap use the minimum gap instead
|
||||
|
||||
if (r < cut_inner[itype][jtype])
|
||||
h_sep = cut_inner[itype][jtype] - radi-radj;
|
||||
|
||||
h_sep = cut_inner[itype][jtype] - radi-radj;
|
||||
|
||||
// scale h_sep by radi
|
||||
|
||||
h_sep = h_sep/radi;
|
||||
beta0 = radj/radi;
|
||||
beta1 = 1.0 + beta0;
|
||||
|
||||
|
||||
// scalar resistances
|
||||
|
||||
if (flaglog) {
|
||||
a_sq = beta0*beta0/beta1/beta1/h_sep +
|
||||
(1.0+7.0*beta0+beta0*beta0)/5.0/pow(beta1,3.0)*log(1.0/h_sep);
|
||||
a_sq += (1.0+18.0*beta0-29.0*beta0*beta0+18.0 *
|
||||
pow(beta0,3.0)+pow(beta0,4.0))/21.0/pow(beta1,4.0) *
|
||||
h_sep*log(1.0/h_sep);
|
||||
a_sq = beta0*beta0/beta1/beta1/h_sep +
|
||||
(1.0+7.0*beta0+beta0*beta0)/5.0/pow(beta1,3.0)*log(1.0/h_sep);
|
||||
a_sq += (1.0+18.0*beta0-29.0*beta0*beta0+18.0 *
|
||||
pow(beta0,3.0)+pow(beta0,4.0))/21.0/pow(beta1,4.0) *
|
||||
h_sep*log(1.0/h_sep);
|
||||
a_sq *= 6.0*MY_PI*mu*radi;
|
||||
a_sh = 4.0*beta0*(2.0+beta0+2.0*beta0*beta0)/15.0/pow(beta1,3.0) *
|
||||
log(1.0/h_sep);
|
||||
a_sh += 4.0*(16.0-45.0*beta0+58.0*beta0*beta0-45.0*pow(beta0,3.0) +
|
||||
16.0*pow(beta0,4.0))/375.0/pow(beta1,4.0) *
|
||||
h_sep*log(1.0/h_sep);
|
||||
a_sh = 4.0*beta0*(2.0+beta0+2.0*beta0*beta0)/15.0/pow(beta1,3.0) *
|
||||
log(1.0/h_sep);
|
||||
a_sh += 4.0*(16.0-45.0*beta0+58.0*beta0*beta0-45.0*pow(beta0,3.0) +
|
||||
16.0*pow(beta0,4.0))/375.0/pow(beta1,4.0) *
|
||||
h_sep*log(1.0/h_sep);
|
||||
a_sh *= 6.0*MY_PI*mu*radi;
|
||||
a_pu = beta0*(4.0+beta0)/10.0/beta1/beta1*log(1.0/h_sep);
|
||||
a_pu += (32.0-33.0*beta0+83.0*beta0*beta0+43.0 *
|
||||
pow(beta0,3.0))/250.0/pow(beta1,3.0)*h_sep*log(1.0/h_sep);
|
||||
a_pu += (32.0-33.0*beta0+83.0*beta0*beta0+43.0 *
|
||||
pow(beta0,3.0))/250.0/pow(beta1,3.0)*h_sep*log(1.0/h_sep);
|
||||
a_pu *= 8.0*MY_PI*mu*pow(radi,3.0);
|
||||
} else a_sq = 6.0*MY_PI*mu*radi*(beta0*beta0/beta1/beta1/h_sep);
|
||||
|
||||
|
||||
// relative velocity at the point of closest approach
|
||||
// includes fluid velocity
|
||||
// includes fluid velocity
|
||||
|
||||
vr1 = vi[0] - vj[0];
|
||||
vr2 = vi[1] - vj[1];
|
||||
vr3 = vi[2] - vj[2];
|
||||
|
||||
|
||||
// normal component (vr.n)n
|
||||
|
||||
vnnr = (vr1*delx + vr2*dely + vr3*delz)/r;
|
||||
|
@ -353,7 +353,7 @@ void PairLubricatePoly::compute(int eflag, int vflag)
|
|||
if (flaglog) {
|
||||
fx = fx + a_sh*vt1;
|
||||
fy = fy + a_sh*vt2;
|
||||
fz = fz + a_sh*vt3;
|
||||
fz = fz + a_sh*vt3;
|
||||
}
|
||||
|
||||
// scale forces for appropriate units
|
||||
|
@ -361,50 +361,50 @@ void PairLubricatePoly::compute(int eflag, int vflag)
|
|||
fx *= vxmu2f;
|
||||
fy *= vxmu2f;
|
||||
fz *= vxmu2f;
|
||||
|
||||
|
||||
// add to total force
|
||||
|
||||
f[i][0] -= fx;
|
||||
f[i][1] -= fy;
|
||||
f[i][2] -= fz;
|
||||
|
||||
f[i][2] -= fz;
|
||||
|
||||
// torque due to this force
|
||||
|
||||
if (flaglog) {
|
||||
tx = xl[1]*fz - xl[2]*fy;
|
||||
ty = xl[2]*fx - xl[0]*fz;
|
||||
tz = xl[0]*fy - xl[1]*fx;
|
||||
|
||||
tz = xl[0]*fy - xl[1]*fx;
|
||||
|
||||
torque[i][0] -= vxmu2f*tx;
|
||||
torque[i][1] -= vxmu2f*ty;
|
||||
torque[i][2] -= vxmu2f*tz;
|
||||
torque[i][2] -= vxmu2f*tz;
|
||||
|
||||
// torque due to a_pu
|
||||
|
||||
wdotn = ((wi[0]-wj[0])*delx + (wi[1]-wj[1])*dely +
|
||||
(wi[2]-wj[2])*delz)/r;
|
||||
wdotn = ((wi[0]-wj[0])*delx + (wi[1]-wj[1])*dely +
|
||||
(wi[2]-wj[2])*delz)/r;
|
||||
wt1 = (wi[0]-wj[0]) - wdotn*delx/r;
|
||||
wt2 = (wi[1]-wj[1]) - wdotn*dely/r;
|
||||
wt3 = (wi[2]-wj[2]) - wdotn*delz/r;
|
||||
|
||||
|
||||
tx = a_pu*wt1;
|
||||
ty = a_pu*wt2;
|
||||
tz = a_pu*wt3;
|
||||
|
||||
|
||||
torque[i][0] -= vxmu2f*tx;
|
||||
torque[i][1] -= vxmu2f*ty;
|
||||
torque[i][2] -= vxmu2f*tz;
|
||||
torque[i][2] -= vxmu2f*tz;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// set j = nlocal so that only I gets tallied
|
||||
// set j = nlocal so that only I gets tallied
|
||||
|
||||
if (evflag) ev_tally_xyz(i,nlocal,nlocal,0,
|
||||
0.0,0.0,-fx,-fy,-fz,delx,dely,delz);
|
||||
0.0,0.0,-fx,-fy,-fz,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// restore streaming component of velocity, omega, angmom
|
||||
|
||||
if (shearing) {
|
||||
|
@ -415,10 +415,10 @@ void PairLubricatePoly::compute(int eflag, int vflag)
|
|||
i = ilist[ii];
|
||||
itype = type[i];
|
||||
radi = atom->radius[i];
|
||||
|
||||
|
||||
domain->x2lamda(x[i],lamda);
|
||||
vstream[0] = h_rate[0]*lamda[0] + h_rate[5]*lamda[1] +
|
||||
h_rate[4]*lamda[2] + h_ratelo[0];
|
||||
vstream[0] = h_rate[0]*lamda[0] + h_rate[5]*lamda[1] +
|
||||
h_rate[4]*lamda[2] + h_ratelo[0];
|
||||
vstream[1] = h_rate[1]*lamda[1] + h_rate[3]*lamda[2] + h_ratelo[1];
|
||||
vstream[2] = h_rate[2]*lamda[2] + h_ratelo[2];
|
||||
v[i][0] += vstream[0];
|
||||
|
@ -452,7 +452,7 @@ void PairLubricatePoly::init_style()
|
|||
error->all(FLERR,"Pair lubricate/poly requires newton pair off");
|
||||
if (comm->ghost_velocity == 0)
|
||||
error->all(FLERR,
|
||||
"Pair lubricate/poly requires ghost atoms store velocity");
|
||||
"Pair lubricate/poly requires ghost atoms store velocity");
|
||||
if (!atom->sphere_flag)
|
||||
error->all(FLERR,"Pair lubricate/poly requires atom style sphere");
|
||||
|
||||
|
@ -464,7 +464,7 @@ void PairLubricatePoly::init_style()
|
|||
int nlocal = atom->nlocal;
|
||||
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (radius[i] == 0.0)
|
||||
if (radius[i] == 0.0)
|
||||
error->one(FLERR,"Pair lubricate/poly requires extended particles");
|
||||
|
||||
int irequest = neighbor->request(this);
|
||||
|
@ -482,20 +482,20 @@ void PairLubricatePoly::init_style()
|
|||
// due to walls, set volume appropriately; if walls will
|
||||
// move, set appropriate flag so that volume and v.f. corrections
|
||||
// are re-calculated at every step.
|
||||
|
||||
|
||||
shearing = flagdeform = flagwall = 0;
|
||||
for (int i = 0; i < modify->nfix; i++){
|
||||
if (strcmp(modify->fix[i]->style,"deform") == 0) {
|
||||
shearing = flagdeform = 1;
|
||||
if (((FixDeform *) modify->fix[i])->remapflag != V_REMAP)
|
||||
error->all(FLERR,"Using pair lubricate with inconsistent "
|
||||
"fix deform remap option");
|
||||
if (((FixDeform *) modify->fix[i])->remapflag != V_REMAP)
|
||||
error->all(FLERR,"Using pair lubricate with inconsistent "
|
||||
"fix deform remap option");
|
||||
}
|
||||
if (strstr(modify->fix[i]->style,"wall") != NULL){
|
||||
flagwall = 1; // Walls exist
|
||||
if (((FixWall *) modify->fix[i])->varflag ) {
|
||||
flagwall = 2; // Moving walls exist
|
||||
wallfix = (FixWall *) modify->fix[i];
|
||||
flagwall = 2; // Moving walls exist
|
||||
wallfix = (FixWall *) modify->fix[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -503,26 +503,26 @@ void PairLubricatePoly::init_style()
|
|||
double vol_T;
|
||||
double wallcoord;
|
||||
if (!flagwall) vol_T = domain->xprd*domain->yprd*domain->zprd;
|
||||
else {
|
||||
else {
|
||||
double wallhi[3], walllo[3];
|
||||
for (int j = 0; j < 3; j++){
|
||||
wallhi[j] = domain->prd[j];
|
||||
walllo[j] = 0;
|
||||
}
|
||||
}
|
||||
for (int m = 0; m < wallfix->nwall; m++){
|
||||
int dim = wallfix->wallwhich[m] / 2;
|
||||
int side = wallfix->wallwhich[m] % 2;
|
||||
if (wallfix->wallstyle[m] == VARIABLE){
|
||||
wallfix->varindex[m] = input->variable->find(wallfix->varstr[m]);
|
||||
//Since fix->wall->init happens after pair->init_style
|
||||
wallcoord = input->variable->compute_equal(wallfix->varindex[m]);
|
||||
wallfix->varindex[m] = input->variable->find(wallfix->varstr[m]);
|
||||
//Since fix->wall->init happens after pair->init_style
|
||||
wallcoord = input->variable->compute_equal(wallfix->varindex[m]);
|
||||
}
|
||||
else wallcoord = wallfix->coord0[m];
|
||||
|
||||
|
||||
if (side == 0) walllo[dim] = wallcoord;
|
||||
else wallhi[dim] = wallcoord;
|
||||
}
|
||||
vol_T = (wallhi[0] - walllo[0]) * (wallhi[1] - walllo[1]) *
|
||||
vol_T = (wallhi[0] - walllo[0]) * (wallhi[1] - walllo[1]) *
|
||||
(wallhi[2] - walllo[2]);
|
||||
}
|
||||
|
||||
|
@ -534,16 +534,16 @@ void PairLubricatePoly::init_style()
|
|||
double vol_f = vol_P/vol_T;
|
||||
|
||||
if (!flagVF) vol_f = 0;
|
||||
|
||||
|
||||
// set isotropic constants
|
||||
|
||||
|
||||
if (flaglog == 0) {
|
||||
R0 = 6*MY_PI*mu*(1.0 + 2.16*vol_f);
|
||||
RT0 = 8*MY_PI*mu;
|
||||
RS0 = 20.0/3.0*MY_PI*mu*(1.0 + 3.33*vol_f + 2.80*vol_f*vol_f);
|
||||
} else {
|
||||
R0 = 6*MY_PI*mu*(1.0 + 2.725*vol_f - 6.583*vol_f*vol_f);
|
||||
RT0 = 8*MY_PI*mu*(1.0 + 0.749*vol_f - 2.469*vol_f*vol_f);
|
||||
RT0 = 8*MY_PI*mu*(1.0 + 0.749*vol_f - 2.469*vol_f*vol_f);
|
||||
RS0 = 20.0/3.0*MY_PI*mu*(1.0 + 3.64*vol_f - 6.95*vol_f*vol_f);
|
||||
}
|
||||
|
||||
|
@ -553,9 +553,9 @@ void PairLubricatePoly::init_style()
|
|||
for (int i = 0; i < modify->nfix; i++)
|
||||
if (strcmp(modify->fix[i]->style,"deform") == 0) {
|
||||
shearing = 1;
|
||||
if (((FixDeform *) modify->fix[i])->remapflag != V_REMAP)
|
||||
error->all(FLERR,"Using pair lubricate/poly with inconsistent "
|
||||
"fix deform remap option");
|
||||
if (((FixDeform *) modify->fix[i])->remapflag != V_REMAP)
|
||||
error->all(FLERR,"Using pair lubricate/poly with inconsistent "
|
||||
"fix deform remap option");
|
||||
}
|
||||
|
||||
// set Ef = 0 since used whether shearing or not
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -45,7 +45,7 @@ extern double lmp_gpu_forces(double **f, double **tor, double *eatom,
|
|||
FixGPU::FixGPU(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg)
|
||||
{
|
||||
if (lmp->cuda)
|
||||
if (lmp->cuda)
|
||||
error->all(FLERR,"Cannot use fix GPU with USER-CUDA mode enabled");
|
||||
|
||||
if (narg < 7) error->all(FLERR,"Illegal fix GPU command");
|
||||
|
@ -73,7 +73,7 @@ FixGPU::FixGPU(LAMMPS *lmp, int narg, char **arg) :
|
|||
_particle_split = force->numeric(arg[6]);
|
||||
if (_particle_split==0 || _particle_split>1)
|
||||
error->all(FLERR,"Illegal fix GPU command");
|
||||
|
||||
|
||||
int nthreads = 1;
|
||||
int threads_per_atom = -1;
|
||||
if (narg == 9) {
|
||||
|
@ -88,15 +88,15 @@ FixGPU::FixGPU(LAMMPS *lmp, int narg, char **arg) :
|
|||
|
||||
if (nthreads < 1)
|
||||
error->all(FLERR,"Illegal fix GPU command");
|
||||
|
||||
|
||||
#ifndef _OPENMP
|
||||
if (nthreads > 1)
|
||||
error->all(FLERR,"No OpenMP support compiled in");
|
||||
#endif
|
||||
|
||||
int gpu_flag = lmp_init_device(universe->uworld, world, first_gpu, last_gpu,
|
||||
_gpu_mode, _particle_split, nthreads,
|
||||
threads_per_atom);
|
||||
_gpu_mode, _particle_split, nthreads,
|
||||
threads_per_atom);
|
||||
GPU_EXTRA::check_flag(gpu_flag,error,world);
|
||||
}
|
||||
|
||||
|
@ -125,11 +125,11 @@ void FixGPU::init()
|
|||
|
||||
if (_gpu_mode == GPU_NEIGH || _gpu_mode == GPU_HYB_NEIGH)
|
||||
if (force->pair_match("hybrid",1) != NULL ||
|
||||
force->pair_match("hybrid/overlay",1) != NULL)
|
||||
force->pair_match("hybrid/overlay",1) != NULL)
|
||||
error->all(FLERR,"Cannot use pair hybrid with GPU neighbor builds");
|
||||
if (_particle_split < 0)
|
||||
if (force->pair_match("hybrid",1) != NULL ||
|
||||
force->pair_match("hybrid/overlay",1) != NULL)
|
||||
force->pair_match("hybrid/overlay",1) != NULL)
|
||||
error->all(FLERR,"Fix GPU split must be positive for hybrid pair styles");
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ void FixGPU::setup(int vflag)
|
|||
if (_gpu_mode == GPU_NEIGH || _gpu_mode == GPU_HYB_NEIGH)
|
||||
if (neighbor->exclude_setting()!=0)
|
||||
error->all(FLERR,
|
||||
"Cannot use neigh_modify exclude with GPU neighbor builds");
|
||||
"Cannot use neigh_modify exclude with GPU neighbor builds");
|
||||
post_force(vflag);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -24,33 +24,33 @@
|
|||
namespace GPU_EXTRA {
|
||||
|
||||
inline void check_flag(int error_flag, LAMMPS_NS::Error *error,
|
||||
MPI_Comm &world) {
|
||||
MPI_Comm &world) {
|
||||
int all_success;
|
||||
MPI_Allreduce(&error_flag, &all_success, 1, MPI_INT, MPI_MIN, world);
|
||||
if (all_success != 0) {
|
||||
if (all_success == -1)
|
||||
error->all(FLERR,
|
||||
"The package gpu command is required for gpu styles");
|
||||
error->all(FLERR,
|
||||
"The package gpu command is required for gpu styles");
|
||||
else if (all_success == -2)
|
||||
error->all(FLERR,
|
||||
"Could not find/initialize a specified accelerator device");
|
||||
error->all(FLERR,
|
||||
"Could not find/initialize a specified accelerator device");
|
||||
else if (all_success == -3)
|
||||
error->all(FLERR,"Insufficient memory on accelerator");
|
||||
error->all(FLERR,"Insufficient memory on accelerator");
|
||||
else if (all_success == -4)
|
||||
error->all(FLERR,"GPU library not compiled for this accelerator");
|
||||
error->all(FLERR,"GPU library not compiled for this accelerator");
|
||||
else if (all_success == -5)
|
||||
error->all(FLERR,
|
||||
"Double precision is not supported on this accelerator");
|
||||
error->all(FLERR,
|
||||
"Double precision is not supported on this accelerator");
|
||||
else if (all_success == -6)
|
||||
error->all(FLERR,"Unable to initialize accelerator for use");
|
||||
error->all(FLERR,"Unable to initialize accelerator for use");
|
||||
else if (all_success == -7)
|
||||
error->all(FLERR,
|
||||
error->all(FLERR,
|
||||
"Accelerator sharing is not currently supported on system");
|
||||
else if (all_success == -8)
|
||||
error->all(FLERR,
|
||||
error->all(FLERR,
|
||||
"GPU particle split must be set to 1 for this pair style.");
|
||||
else
|
||||
error->all(FLERR,"Unknown error in GPU library");
|
||||
error->all(FLERR,"Unknown error in GPU library");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
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
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
|
@ -38,40 +38,40 @@
|
|||
// External functions from cuda library for atom decomposition
|
||||
|
||||
int buckc_gpu_init(const int ntypes, double **cutsq, double **host_rhoinv,
|
||||
double **host_buck1, double **host_buck2, double **host_a,
|
||||
double **host_c, double **offset, double *special_lj,
|
||||
const int inum, const int nall, const int max_nbors,
|
||||
const int maxspecial, const double cell_size,
|
||||
int &gpu_mode, FILE *screen, double **host_cut_ljsq,
|
||||
double **host_cut_coulsq, double *host_special_coul,
|
||||
const double qqrd2e);
|
||||
double **host_buck1, double **host_buck2, double **host_a,
|
||||
double **host_c, double **offset, double *special_lj,
|
||||
const int inum, const int nall, const int max_nbors,
|
||||
const int maxspecial, const double cell_size,
|
||||
int &gpu_mode, FILE *screen, double **host_cut_ljsq,
|
||||
double **host_cut_coulsq, double *host_special_coul,
|
||||
const double qqrd2e);
|
||||
void buckc_gpu_clear();
|
||||
int ** buckc_gpu_compute_n(const int ago, const int inum_full, const int nall,
|
||||
double **host_x, int *host_type, double *sublo,
|
||||
double *subhi, int *tag, int **nspecial,
|
||||
int **special, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
int **ilist, int **jnum, const double cpu_time,
|
||||
bool &success, double *host_q, double *boxlo,
|
||||
double *prd);
|
||||
double **host_x, int *host_type, double *sublo,
|
||||
double *subhi, int *tag, int **nspecial,
|
||||
int **special, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
int **ilist, int **jnum, const double cpu_time,
|
||||
bool &success, double *host_q, double *boxlo,
|
||||
double *prd);
|
||||
void buckc_gpu_compute(const int ago, const int inum_full, const int nall,
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success, double *host_q,
|
||||
const int nlocal, double *boxlo, double *prd);
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success, double *host_q,
|
||||
const int nlocal, double *boxlo, double *prd);
|
||||
double buckc_gpu_bytes();
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairBuckCoulCutGPU::PairBuckCoulCutGPU(LAMMPS *lmp) : PairBuckCoulCut(lmp),
|
||||
gpu_mode(GPU_FORCE)
|
||||
PairBuckCoulCutGPU::PairBuckCoulCutGPU(LAMMPS *lmp) : PairBuckCoulCut(lmp),
|
||||
gpu_mode(GPU_FORCE)
|
||||
{
|
||||
respa_enable = 0;
|
||||
cpu_time = 0.0;
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -89,30 +89,30 @@ void PairBuckCoulCutGPU::compute(int eflag, int vflag)
|
|||
{
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = vflag_fdotr = 0;
|
||||
|
||||
|
||||
int nall = atom->nlocal + atom->nghost;
|
||||
int inum, host_start;
|
||||
|
||||
|
||||
bool success = true;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
if (gpu_mode != GPU_FORCE) {
|
||||
inum = atom->nlocal;
|
||||
firstneigh = buckc_gpu_compute_n(neighbor->ago, inum, nall,
|
||||
atom->x, atom->type, domain->sublo,
|
||||
domain->subhi, atom->tag, atom->nspecial,
|
||||
atom->special, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start,
|
||||
&ilist, &numneigh, cpu_time, success,
|
||||
atom->q, domain->boxlo, domain->prd);
|
||||
atom->x, atom->type, domain->sublo,
|
||||
domain->subhi, atom->tag, atom->nspecial,
|
||||
atom->special, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start,
|
||||
&ilist, &numneigh, cpu_time, success,
|
||||
atom->q, domain->boxlo, domain->prd);
|
||||
} else {
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
buckc_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type,
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success, atom->q,
|
||||
atom->nlocal, domain->boxlo, domain->prd);
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success, atom->q,
|
||||
atom->nlocal, domain->boxlo, domain->prd);
|
||||
}
|
||||
if (!success)
|
||||
error->one(FLERR,"Insufficient memory on accelerator");
|
||||
|
@ -130,9 +130,9 @@ void PairBuckCoulCutGPU::compute(int eflag, int vflag)
|
|||
|
||||
void PairBuckCoulCutGPU::init_style()
|
||||
{
|
||||
if (force->newton_pair)
|
||||
if (force->newton_pair)
|
||||
error->all(FLERR,
|
||||
"Cannot use newton pair with buck/coul/cut/gpu pair style");
|
||||
"Cannot use newton pair with buck/coul/cut/gpu pair style");
|
||||
|
||||
// Repeat cutsq calculation because done after call to init_style
|
||||
double maxcut = -1.0;
|
||||
|
@ -154,18 +154,18 @@ void PairBuckCoulCutGPU::init_style()
|
|||
int maxspecial=0;
|
||||
if (atom->molecular)
|
||||
maxspecial=atom->maxspecial;
|
||||
int success = buckc_gpu_init(atom->ntypes+1, cutsq, rhoinv, buck1, buck2,
|
||||
a, c, offset, force->special_lj, atom->nlocal,
|
||||
atom->nlocal+atom->nghost, 300, maxspecial,
|
||||
cell_size, gpu_mode, screen, cut_ljsq,
|
||||
cut_coulsq, force->special_coul, force->qqrd2e);
|
||||
int success = buckc_gpu_init(atom->ntypes+1, cutsq, rhoinv, buck1, buck2,
|
||||
a, c, offset, force->special_lj, atom->nlocal,
|
||||
atom->nlocal+atom->nghost, 300, maxspecial,
|
||||
cell_size, gpu_mode, screen, cut_ljsq,
|
||||
cut_coulsq, force->special_coul, force->qqrd2e);
|
||||
GPU_EXTRA::check_flag(success,error,world);
|
||||
|
||||
if (gpu_mode == GPU_FORCE) {
|
||||
int irequest = neighbor->request(this);
|
||||
neighbor->requests[irequest]->half = 0;
|
||||
neighbor->requests[irequest]->full = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
@ -179,8 +179,8 @@ double PairBuckCoulCutGPU::memory_usage()
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairBuckCoulCutGPU::cpu_compute(int start, int inum, int eflag, int vflag,
|
||||
int *ilist, int *numneigh,
|
||||
int **firstneigh) {
|
||||
int *ilist, int *numneigh,
|
||||
int **firstneigh) {
|
||||
int i,j,ii,jj,jnum,itype,jtype;
|
||||
double xtmp,ytmp,ztmp,qtmp,delx,dely,delz,evdwl,ecoul,fpair;
|
||||
double rsq,r2inv,r6inv,forcecoul,forcebuck,factor_coul,factor_lj;
|
||||
|
@ -188,7 +188,7 @@ void PairBuckCoulCutGPU::cpu_compute(int start, int inum, int eflag, int vflag,
|
|||
int *jlist;
|
||||
|
||||
evdwl = ecoul = 0.0;
|
||||
|
||||
|
||||
double **x = atom->x;
|
||||
double **f = atom->f;
|
||||
double *q = atom->q;
|
||||
|
@ -196,7 +196,7 @@ void PairBuckCoulCutGPU::cpu_compute(int start, int inum, int eflag, int vflag,
|
|||
double *special_coul = force->special_coul;
|
||||
double *special_lj = force->special_lj;
|
||||
double qqrd2e = force->qqrd2e;
|
||||
|
||||
|
||||
// loop over neighbors of my atoms
|
||||
|
||||
for (ii = start; ii < inum; ii++) {
|
||||
|
@ -222,37 +222,37 @@ void PairBuckCoulCutGPU::cpu_compute(int start, int inum, int eflag, int vflag,
|
|||
jtype = type[j];
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r2inv = 1.0/rsq;
|
||||
r = sqrt(rsq);
|
||||
|
||||
if (rsq < cut_coulsq[itype][jtype])
|
||||
forcecoul = qqrd2e * qtmp*q[j]/r;
|
||||
else forcecoul = 0.0;
|
||||
r2inv = 1.0/rsq;
|
||||
r = sqrt(rsq);
|
||||
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
rexp = exp(-r*rhoinv[itype][jtype]);
|
||||
forcebuck = buck1[itype][jtype]*r*rexp - buck2[itype][jtype]*r6inv;
|
||||
} else forcebuck = 0.0;
|
||||
|
||||
fpair = (factor_coul*forcecoul + factor_lj*forcebuck) * r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
if (rsq < cut_coulsq[itype][jtype])
|
||||
forcecoul = qqrd2e * qtmp*q[j]/r;
|
||||
else forcecoul = 0.0;
|
||||
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq[itype][jtype])
|
||||
ecoul = factor_coul * qqrd2e * qtmp*q[j]/r;
|
||||
else ecoul = 0.0;
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
evdwl = a[itype][jtype]*rexp - c[itype][jtype]*r6inv -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
} else evdwl = 0.0;
|
||||
}
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
rexp = exp(-r*rhoinv[itype][jtype]);
|
||||
forcebuck = buck1[itype][jtype]*r*rexp - buck2[itype][jtype]*r6inv;
|
||||
} else forcebuck = 0.0;
|
||||
|
||||
if (evflag) ev_tally_full(i,evdwl,ecoul,fpair,delx,dely,delz);
|
||||
fpair = (factor_coul*forcecoul + factor_lj*forcebuck) * r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq[itype][jtype])
|
||||
ecoul = factor_coul * qqrd2e * qtmp*q[j]/r;
|
||||
else ecoul = 0.0;
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
evdwl = a[itype][jtype]*rexp - c[itype][jtype]*r6inv -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
} else evdwl = 0.0;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally_full(i,evdwl,ecoul,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
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
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
|
@ -47,40 +47,40 @@
|
|||
// External functions from cuda library for atom decomposition
|
||||
|
||||
int buckcl_gpu_init(const int ntypes, double **cutsq, double **host_rhoinv,
|
||||
double **host_buck1, double **host_buck2, double **host_a,
|
||||
double **host_c, double **offset, double *special_lj,
|
||||
const int inum, const int nall, const int max_nbors,
|
||||
const int maxspecial, const double cell_size,
|
||||
int &gpu_mode, FILE *screen, double **host_cut_ljsq,
|
||||
double host_cut_coulsq, double *host_special_coul,
|
||||
const double qqrd2e, const double g_ewald);
|
||||
double **host_buck1, double **host_buck2, double **host_a,
|
||||
double **host_c, double **offset, double *special_lj,
|
||||
const int inum, const int nall, const int max_nbors,
|
||||
const int maxspecial, const double cell_size,
|
||||
int &gpu_mode, FILE *screen, double **host_cut_ljsq,
|
||||
double host_cut_coulsq, double *host_special_coul,
|
||||
const double qqrd2e, const double g_ewald);
|
||||
void buckcl_gpu_clear();
|
||||
int** buckcl_gpu_compute_n(const int ago, const int inum_full, const int nall,
|
||||
double **host_x, int *host_type, double *sublo,
|
||||
double *subhi, int *tag, int **nspecial,
|
||||
int **special, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
int **ilist, int **jnum, const double cpu_time,
|
||||
bool &success, double *host_q, double *boxlo,
|
||||
double *prd);
|
||||
double **host_x, int *host_type, double *sublo,
|
||||
double *subhi, int *tag, int **nspecial,
|
||||
int **special, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
int **ilist, int **jnum, const double cpu_time,
|
||||
bool &success, double *host_q, double *boxlo,
|
||||
double *prd);
|
||||
void buckcl_gpu_compute(const int ago, const int inum_full, const int nall,
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success, double *host_q,
|
||||
const int nlocal, double *boxlo, double *prd);
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success, double *host_q,
|
||||
const int nlocal, double *boxlo, double *prd);
|
||||
double buckcl_gpu_bytes();
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairBuckCoulLongGPU::PairBuckCoulLongGPU(LAMMPS *lmp) :
|
||||
PairBuckCoulLongGPU::PairBuckCoulLongGPU(LAMMPS *lmp) :
|
||||
PairBuckCoulLong(lmp), gpu_mode(GPU_FORCE)
|
||||
{
|
||||
respa_enable = 0;
|
||||
cpu_time = 0.0;
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -98,30 +98,30 @@ void PairBuckCoulLongGPU::compute(int eflag, int vflag)
|
|||
{
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = vflag_fdotr = 0;
|
||||
|
||||
|
||||
int nall = atom->nlocal + atom->nghost;
|
||||
int inum, host_start;
|
||||
|
||||
|
||||
bool success = true;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
if (gpu_mode != GPU_FORCE) {
|
||||
inum = atom->nlocal;
|
||||
firstneigh = buckcl_gpu_compute_n(neighbor->ago, inum, nall, atom->x,
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success, atom->q, domain->boxlo,
|
||||
domain->prd);
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success, atom->q, domain->boxlo,
|
||||
domain->prd);
|
||||
} else {
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
buckcl_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type,
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success, atom->q,
|
||||
atom->nlocal, domain->boxlo, domain->prd);
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success, atom->q,
|
||||
atom->nlocal, domain->boxlo, domain->prd);
|
||||
}
|
||||
if (!success)
|
||||
error->one(FLERR,"Insufficient memory on accelerator");
|
||||
|
@ -141,10 +141,10 @@ void PairBuckCoulLongGPU::init_style()
|
|||
{
|
||||
if (!atom->q_flag)
|
||||
error->all(FLERR,
|
||||
"Pair style buck/coul/long/gpu requires atom attribute q");
|
||||
if (force->newton_pair)
|
||||
"Pair style buck/coul/long/gpu requires atom attribute q");
|
||||
if (force->newton_pair)
|
||||
error->all(FLERR,
|
||||
"Cannot use newton pair with buck/coul/long/gpu pair style");
|
||||
"Cannot use newton pair with buck/coul/long/gpu pair style");
|
||||
|
||||
// Repeat cutsq calculation because done after call to init_style
|
||||
double maxcut = -1.0;
|
||||
|
@ -174,12 +174,12 @@ void PairBuckCoulLongGPU::init_style()
|
|||
int maxspecial=0;
|
||||
if (atom->molecular)
|
||||
maxspecial=atom->maxspecial;
|
||||
int success = buckcl_gpu_init(atom->ntypes+1, cutsq, rhoinv, buck1, buck2,
|
||||
a, c, offset, force->special_lj, atom->nlocal,
|
||||
atom->nlocal+atom->nghost, 300, maxspecial,
|
||||
cell_size, gpu_mode, screen, cut_ljsq,
|
||||
cut_coulsq, force->special_coul, force->qqrd2e,
|
||||
g_ewald);
|
||||
int success = buckcl_gpu_init(atom->ntypes+1, cutsq, rhoinv, buck1, buck2,
|
||||
a, c, offset, force->special_lj, atom->nlocal,
|
||||
atom->nlocal+atom->nghost, 300, maxspecial,
|
||||
cell_size, gpu_mode, screen, cut_ljsq,
|
||||
cut_coulsq, force->special_coul, force->qqrd2e,
|
||||
g_ewald);
|
||||
GPU_EXTRA::check_flag(success,error,world);
|
||||
|
||||
if (gpu_mode == GPU_FORCE) {
|
||||
|
@ -200,8 +200,8 @@ double PairBuckCoulLongGPU::memory_usage()
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairBuckCoulLongGPU::cpu_compute(int start, int inum, int eflag,
|
||||
int vflag, int *ilist, int *numneigh,
|
||||
int **firstneigh)
|
||||
int vflag, int *ilist, int *numneigh,
|
||||
int **firstneigh)
|
||||
{
|
||||
int i,j,ii,jj,jnum,itype,jtype,itable;
|
||||
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair;
|
||||
|
@ -246,44 +246,44 @@ void PairBuckCoulLongGPU::cpu_compute(int start, int inum, int eflag,
|
|||
jtype = type[j];
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r2inv = 1.0/rsq;
|
||||
r = sqrt(rsq);
|
||||
if (rsq < cut_coulsq) {
|
||||
grij = g_ewald * r;
|
||||
expm2 = exp(-grij*grij);
|
||||
t = 1.0 / (1.0 + EWALD_P*grij);
|
||||
erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2;
|
||||
prefactor = qqrd2e * qtmp*q[j]/r;
|
||||
forcecoul = prefactor * (erfc + EWALD_F*grij*expm2);
|
||||
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else forcecoul = 0.0;
|
||||
r2inv = 1.0/rsq;
|
||||
r = sqrt(rsq);
|
||||
if (rsq < cut_coulsq) {
|
||||
grij = g_ewald * r;
|
||||
expm2 = exp(-grij*grij);
|
||||
t = 1.0 / (1.0 + EWALD_P*grij);
|
||||
erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2;
|
||||
prefactor = qqrd2e * qtmp*q[j]/r;
|
||||
forcecoul = prefactor * (erfc + EWALD_F*grij*expm2);
|
||||
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else forcecoul = 0.0;
|
||||
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
rexp = exp(-r*rhoinv[itype][jtype]);
|
||||
forcebuck = buck1[itype][jtype]*r*rexp - buck2[itype][jtype]*r6inv;
|
||||
} else forcebuck = 0.0;
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
rexp = exp(-r*rhoinv[itype][jtype]);
|
||||
forcebuck = buck1[itype][jtype]*r*rexp - buck2[itype][jtype]*r6inv;
|
||||
} else forcebuck = 0.0;
|
||||
|
||||
fpair = (forcecoul + factor_lj*forcebuck) * r2inv;
|
||||
fpair = (forcecoul + factor_lj*forcebuck) * r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq) {
|
||||
ecoul = prefactor*erfc;
|
||||
if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else ecoul = 0.0;
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq) {
|
||||
ecoul = prefactor*erfc;
|
||||
if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else ecoul = 0.0;
|
||||
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
evdwl = a[itype][jtype]*rexp - c[itype][jtype]*r6inv -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
} else evdwl = 0.0;
|
||||
}
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
evdwl = a[itype][jtype]*rexp - c[itype][jtype]*r6inv -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
} else evdwl = 0.0;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally_full(i,evdwl,ecoul,fpair,delx,dely,delz);
|
||||
if (evflag) ev_tally_full(i,evdwl,ecoul,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
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
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
|
@ -38,24 +38,24 @@
|
|||
// External functions from cuda library for atom decomposition
|
||||
|
||||
int buck_gpu_init(const int ntypes, double **cutsq, double **host_rhoinv,
|
||||
double **host_buck1, double **host_buck2,
|
||||
double **host_a, double **host_c,
|
||||
double **offset, double *special_lj, const int inum,
|
||||
const int nall, const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen);
|
||||
double **host_buck1, double **host_buck2,
|
||||
double **host_a, double **host_c,
|
||||
double **offset, double *special_lj, const int inum,
|
||||
const int nall, const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen);
|
||||
void buck_gpu_clear();
|
||||
int ** buck_gpu_compute_n(const int ago, const int inum_full, const int nall,
|
||||
double **host_x, int *host_type, double *sublo,
|
||||
double *subhi, int *tag, int **nspecial,
|
||||
int **special, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
int **ilist, int **jnum, const double cpu_time,
|
||||
bool &success);
|
||||
double **host_x, int *host_type, double *sublo,
|
||||
double *subhi, int *tag, int **nspecial,
|
||||
int **special, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
int **ilist, int **jnum, const double cpu_time,
|
||||
bool &success);
|
||||
void buck_gpu_compute(const int ago, const int inum_full, const int nall,
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success);
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success);
|
||||
double buck_gpu_bytes();
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
@ -66,7 +66,7 @@ PairBuckGPU::PairBuckGPU(LAMMPS *lmp) : PairBuck(lmp), gpu_mode(GPU_FORCE)
|
|||
{
|
||||
respa_enable = 0;
|
||||
cpu_time = 0.0;
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -84,28 +84,28 @@ void PairBuckGPU::compute(int eflag, int vflag)
|
|||
{
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = vflag_fdotr = 0;
|
||||
|
||||
|
||||
int nall = atom->nlocal + atom->nghost;
|
||||
int inum, host_start;
|
||||
|
||||
|
||||
bool success = true;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
if (gpu_mode != GPU_FORCE) {
|
||||
inum = atom->nlocal;
|
||||
firstneigh = buck_gpu_compute_n(neighbor->ago, inum, nall,
|
||||
atom->x, atom->type, domain->sublo,
|
||||
domain->subhi, atom->tag, atom->nspecial,
|
||||
atom->special, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start,
|
||||
&ilist, &numneigh, cpu_time, success);
|
||||
atom->x, atom->type, domain->sublo,
|
||||
domain->subhi, atom->tag, atom->nspecial,
|
||||
atom->special, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start,
|
||||
&ilist, &numneigh, cpu_time, success);
|
||||
} else {
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
buck_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type,
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success);
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success);
|
||||
}
|
||||
if (!success)
|
||||
error->one(FLERR,"Insufficient memory on accelerator");
|
||||
|
@ -123,7 +123,7 @@ void PairBuckGPU::compute(int eflag, int vflag)
|
|||
|
||||
void PairBuckGPU::init_style()
|
||||
{
|
||||
if (force->newton_pair)
|
||||
if (force->newton_pair)
|
||||
error->all(FLERR,"Cannot use newton pair with buck/gpu pair style");
|
||||
|
||||
// Repeat cutsq calculation because done after call to init_style
|
||||
|
@ -146,10 +146,10 @@ void PairBuckGPU::init_style()
|
|||
int maxspecial=0;
|
||||
if (atom->molecular)
|
||||
maxspecial=atom->maxspecial;
|
||||
int success = buck_gpu_init(atom->ntypes+1, cutsq, rhoinv, buck1, buck2,
|
||||
a, c, offset, force->special_lj, atom->nlocal,
|
||||
atom->nlocal+atom->nghost, 300, maxspecial,
|
||||
cell_size, gpu_mode, screen);
|
||||
int success = buck_gpu_init(atom->ntypes+1, cutsq, rhoinv, buck1, buck2,
|
||||
a, c, offset, force->special_lj, atom->nlocal,
|
||||
atom->nlocal+atom->nghost, 300, maxspecial,
|
||||
cell_size, gpu_mode, screen);
|
||||
GPU_EXTRA::check_flag(success,error,world);
|
||||
|
||||
if (gpu_mode == GPU_FORCE) {
|
||||
|
@ -169,8 +169,8 @@ double PairBuckGPU::memory_usage()
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairBuckGPU::cpu_compute(int start, int inum, int eflag, int vflag,
|
||||
int *ilist, int *numneigh, int **firstneigh) {
|
||||
void PairBuckGPU::cpu_compute(int start, int inum, int eflag, int vflag,
|
||||
int *ilist, int *numneigh, int **firstneigh) {
|
||||
int i,j,ii,jj,jnum,itype,jtype;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair;
|
||||
double rsq,r2inv,r6inv,forcebuck,factor_lj;
|
||||
|
@ -205,24 +205,24 @@ void PairBuckGPU::cpu_compute(int start, int inum, int eflag, int vflag,
|
|||
jtype = type[j];
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
r = sqrt(rsq);
|
||||
rexp = exp(-r*rhoinv[itype][jtype]);
|
||||
forcebuck = buck1[itype][jtype]*r*rexp - buck2[itype][jtype]*r6inv;
|
||||
fpair = factor_lj*forcebuck*r2inv;
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
r = sqrt(rsq);
|
||||
rexp = exp(-r*rhoinv[itype][jtype]);
|
||||
forcebuck = buck1[itype][jtype]*r*rexp - buck2[itype][jtype]*r6inv;
|
||||
fpair = factor_lj*forcebuck*r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
|
||||
if (eflag) {
|
||||
evdwl = a[itype][jtype]*rexp - c[itype][jtype]*r6inv -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
}
|
||||
if (eflag) {
|
||||
evdwl = a[itype][jtype]*rexp - c[itype][jtype]*r6inv -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally_full(i,evdwl,0.0,fpair,delx,dely,delz);
|
||||
if (evflag) ev_tally_full(i,evdwl,0.0,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
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
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
|
@ -47,36 +47,36 @@
|
|||
// External functions from cuda library for atom decomposition
|
||||
|
||||
int cl_gpu_init(const int nlocal, const int nall, const int max_nbors,
|
||||
const int maxspecial, const double cell_size, int &gpu_mode,
|
||||
FILE *screen, double host_cut_coulsq, double *host_special_coul,
|
||||
const double qqrd2e, const double g_ewald);
|
||||
const int maxspecial, const double cell_size, int &gpu_mode,
|
||||
FILE *screen, double host_cut_coulsq, double *host_special_coul,
|
||||
const double qqrd2e, const double g_ewald);
|
||||
void cl_gpu_clear();
|
||||
int ** cl_gpu_compute_n(const int ago, const int inum,
|
||||
const int nall, double **host_x, int *host_type,
|
||||
double *sublo, double *subhi, int *tag,
|
||||
int **nspecial, int **special, const bool eflag,
|
||||
const bool vflag, const bool eatom, const bool vatom,
|
||||
int &host_start, int **ilist, int **jnum,
|
||||
const double cpu_time, bool &success, double *host_q,
|
||||
double *boxlo, double *prd);
|
||||
const int nall, double **host_x, int *host_type,
|
||||
double *sublo, double *subhi, int *tag,
|
||||
int **nspecial, int **special, const bool eflag,
|
||||
const bool vflag, const bool eatom, const bool vatom,
|
||||
int &host_start, int **ilist, int **jnum,
|
||||
const double cpu_time, bool &success, double *host_q,
|
||||
double *boxlo, double *prd);
|
||||
void cl_gpu_compute(const int ago, const int inum, const int nall,
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success, double *host_q,
|
||||
const int nlocal, double *boxlo, double *prd);
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success, double *host_q,
|
||||
const int nlocal, double *boxlo, double *prd);
|
||||
double cl_gpu_bytes();
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairCoulLongGPU::PairCoulLongGPU(LAMMPS *lmp) :
|
||||
PairCoulLongGPU::PairCoulLongGPU(LAMMPS *lmp) :
|
||||
PairCoulLong(lmp), gpu_mode(GPU_FORCE)
|
||||
{
|
||||
respa_enable = 0;
|
||||
cpu_time = 0.0;
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -94,30 +94,30 @@ void PairCoulLongGPU::compute(int eflag, int vflag)
|
|||
{
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = vflag_fdotr = 0;
|
||||
|
||||
|
||||
int nall = atom->nlocal + atom->nghost;
|
||||
int inum, host_start;
|
||||
|
||||
|
||||
bool success = true;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
if (gpu_mode != GPU_FORCE) {
|
||||
inum = atom->nlocal;
|
||||
firstneigh = cl_gpu_compute_n(neighbor->ago, inum, nall, atom->x,
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success, atom->q, domain->boxlo,
|
||||
domain->prd);
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success, atom->q, domain->boxlo,
|
||||
domain->prd);
|
||||
} else {
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
cl_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type,
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success, atom->q,
|
||||
atom->nlocal, domain->boxlo, domain->prd);
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success, atom->q,
|
||||
atom->nlocal, domain->boxlo, domain->prd);
|
||||
}
|
||||
if (!success)
|
||||
error->one(FLERR,"Insufficient memory on accelerator");
|
||||
|
@ -139,7 +139,7 @@ void PairCoulLongGPU::init_style()
|
|||
|
||||
if (!atom->q_flag)
|
||||
error->all(FLERR,"Pair style coul/long/gpu requires atom attribute q");
|
||||
if (force->newton_pair)
|
||||
if (force->newton_pair)
|
||||
error->all(FLERR,"Cannot use newton pair with coul/long/gpu pair style");
|
||||
|
||||
// Repeat cutsq calculation because done after call to init_style
|
||||
|
@ -160,9 +160,9 @@ void PairCoulLongGPU::init_style()
|
|||
int maxspecial=0;
|
||||
if (atom->molecular)
|
||||
maxspecial=atom->maxspecial;
|
||||
int success = cl_gpu_init(atom->nlocal, atom->nlocal+atom->nghost, 300,
|
||||
maxspecial, cell_size, gpu_mode, screen, cut_coulsq,
|
||||
force->special_coul, force->qqrd2e, g_ewald);
|
||||
int success = cl_gpu_init(atom->nlocal, atom->nlocal+atom->nghost, 300,
|
||||
maxspecial, cell_size, gpu_mode, screen, cut_coulsq,
|
||||
force->special_coul, force->qqrd2e, g_ewald);
|
||||
|
||||
GPU_EXTRA::check_flag(success,error,world);
|
||||
|
||||
|
@ -184,8 +184,8 @@ double PairCoulLongGPU::memory_usage()
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairCoulLongGPU::cpu_compute(int start, int inum, int eflag,
|
||||
int vflag, int *ilist, int *numneigh,
|
||||
int **firstneigh)
|
||||
int vflag, int *ilist, int *numneigh,
|
||||
int **firstneigh)
|
||||
{
|
||||
int i,j,ii,jj,jnum,itype,jtype,itable;
|
||||
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair;
|
||||
|
@ -230,49 +230,49 @@ void PairCoulLongGPU::cpu_compute(int start, int inum, int eflag,
|
|||
r2inv = 1.0/rsq;
|
||||
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq) {
|
||||
r = sqrt(rsq);
|
||||
grij = g_ewald * r;
|
||||
expm2 = exp(-grij*grij);
|
||||
t = 1.0 / (1.0 + EWALD_P*grij);
|
||||
erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2;
|
||||
prefactor = qqrd2e * qtmp*q[j]/r;
|
||||
forcecoul = prefactor * (erfc + EWALD_F*grij*expm2);
|
||||
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else {
|
||||
union_int_float_t rsq_lookup;
|
||||
rsq_lookup.f = rsq;
|
||||
itable = rsq_lookup.i & ncoulmask;
|
||||
itable >>= ncoulshiftbits;
|
||||
fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable];
|
||||
table = ftable[itable] + fraction*dftable[itable];
|
||||
forcecoul = qtmp*q[j] * table;
|
||||
if (factor_coul < 1.0) {
|
||||
table = ctable[itable] + fraction*dctable[itable];
|
||||
prefactor = qtmp*q[j] * table;
|
||||
forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
}
|
||||
}
|
||||
if (!ncoultablebits || rsq <= tabinnersq) {
|
||||
r = sqrt(rsq);
|
||||
grij = g_ewald * r;
|
||||
expm2 = exp(-grij*grij);
|
||||
t = 1.0 / (1.0 + EWALD_P*grij);
|
||||
erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2;
|
||||
prefactor = qqrd2e * qtmp*q[j]/r;
|
||||
forcecoul = prefactor * (erfc + EWALD_F*grij*expm2);
|
||||
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else {
|
||||
union_int_float_t rsq_lookup;
|
||||
rsq_lookup.f = rsq;
|
||||
itable = rsq_lookup.i & ncoulmask;
|
||||
itable >>= ncoulshiftbits;
|
||||
fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable];
|
||||
table = ftable[itable] + fraction*dftable[itable];
|
||||
forcecoul = qtmp*q[j] * table;
|
||||
if (factor_coul < 1.0) {
|
||||
table = ctable[itable] + fraction*dctable[itable];
|
||||
prefactor = qtmp*q[j] * table;
|
||||
forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
}
|
||||
}
|
||||
|
||||
fpair = forcecoul * r2inv;
|
||||
fpair = forcecoul * r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq)
|
||||
ecoul = prefactor*erfc;
|
||||
else {
|
||||
table = etable[itable] + fraction*detable[itable];
|
||||
ecoul = qtmp*q[j] * table;
|
||||
}
|
||||
if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else ecoul = 0.0;
|
||||
}
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq)
|
||||
ecoul = prefactor*erfc;
|
||||
else {
|
||||
table = etable[itable] + fraction*detable[itable];
|
||||
ecoul = qtmp*q[j] * table;
|
||||
}
|
||||
if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else ecoul = 0.0;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally_full(i,0.0,ecoul,fpair,delx,dely,delz);
|
||||
if (evflag) ev_tally_full(i,0.0,ecoul,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -96,9 +96,9 @@ void PairEAMAlloyGPU::coeff(int narg, char **arg)
|
|||
for (i = 1; i <= n; i++) {
|
||||
for (j = i; j <= n; j++) {
|
||||
if (map[i] >= 0 && map[j] >= 0) {
|
||||
setflag[i][j] = 1;
|
||||
if (i == j) atom->set_mass(i,setfl->mass[map[i]]);
|
||||
count++;
|
||||
setflag[i][j] = 1;
|
||||
if (i == j) atom->set_mass(i,setfl->mass[map[i]]);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ void PairEAMAlloyGPU::read_file(char *filename)
|
|||
int nwords = atom->count_words(line);
|
||||
if (nwords != file->nelements + 1)
|
||||
error->all(FLERR,"Incorrect element names in EAM potential file");
|
||||
|
||||
|
||||
char **words = new char*[file->nelements+1];
|
||||
nwords = 0;
|
||||
strtok(line," \t\n\r\f");
|
||||
|
@ -164,7 +164,7 @@ void PairEAMAlloyGPU::read_file(char *filename)
|
|||
if (me == 0) {
|
||||
fgets(line,MAXLINE,fptr);
|
||||
sscanf(line,"%d %lg %d %lg %lg",
|
||||
&file->nrho,&file->drho,&file->nr,&file->dr,&file->cut);
|
||||
&file->nrho,&file->drho,&file->nr,&file->dr,&file->cut);
|
||||
}
|
||||
|
||||
MPI_Bcast(&file->nrho,1,MPI_INT,0,world);
|
||||
|
@ -177,7 +177,7 @@ void PairEAMAlloyGPU::read_file(char *filename)
|
|||
memory->create(file->frho,file->nelements,file->nrho+1,"pair:frho");
|
||||
memory->create(file->rhor,file->nelements,file->nr+1,"pair:rhor");
|
||||
memory->create(file->z2r,file->nelements,file->nelements,file->nr+1,
|
||||
"pair:z2r");
|
||||
"pair:z2r");
|
||||
|
||||
int i,j,tmp;
|
||||
for (i = 0; i < file->nelements; i++) {
|
||||
|
@ -226,7 +226,7 @@ void PairEAMAlloyGPU::file2array()
|
|||
|
||||
// allocate frho arrays
|
||||
// nfrho = # of setfl elements + 1 for zero array
|
||||
|
||||
|
||||
nfrho = setfl->nelements + 1;
|
||||
memory->destroy(frho);
|
||||
memory->create(frho,nfrho,nrho+1,"pair:frho");
|
||||
|
@ -307,12 +307,12 @@ void PairEAMAlloyGPU::file2array()
|
|||
irow = map[i];
|
||||
icol = map[j];
|
||||
if (irow == -1 || icol == -1) {
|
||||
type2z2r[i][j] = 0;
|
||||
continue;
|
||||
type2z2r[i][j] = 0;
|
||||
continue;
|
||||
}
|
||||
if (irow < icol) {
|
||||
irow = map[j];
|
||||
icol = map[i];
|
||||
irow = map[j];
|
||||
icol = map[i];
|
||||
}
|
||||
n = 0;
|
||||
for (m = 0; m < irow; m++) n += m + 1;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -96,9 +96,9 @@ void PairEAMFSGPU::coeff(int narg, char **arg)
|
|||
for (i = 1; i <= n; i++) {
|
||||
for (j = i; j <= n; j++) {
|
||||
if (map[i] >= 0 && map[j] >= 0) {
|
||||
setflag[i][j] = 1;
|
||||
if (i == j) atom->set_mass(i,fs->mass[map[i]]);
|
||||
count++;
|
||||
setflag[i][j] = 1;
|
||||
if (i == j) atom->set_mass(i,fs->mass[map[i]]);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ void PairEAMFSGPU::read_file(char *filename)
|
|||
int nwords = atom->count_words(line);
|
||||
if (nwords != file->nelements + 1)
|
||||
error->all(FLERR,"Incorrect element names in EAM potential file");
|
||||
|
||||
|
||||
char **words = new char*[file->nelements+1];
|
||||
nwords = 0;
|
||||
strtok(line," \t\n\r\f");
|
||||
|
@ -164,7 +164,7 @@ void PairEAMFSGPU::read_file(char *filename)
|
|||
if (me == 0) {
|
||||
fgets(line,MAXLINE,fptr);
|
||||
sscanf(line,"%d %lg %d %lg %lg",
|
||||
&file->nrho,&file->drho,&file->nr,&file->dr,&file->cut);
|
||||
&file->nrho,&file->drho,&file->nr,&file->dr,&file->cut);
|
||||
}
|
||||
|
||||
MPI_Bcast(&file->nrho,1,MPI_INT,0,world);
|
||||
|
@ -175,11 +175,11 @@ void PairEAMFSGPU::read_file(char *filename)
|
|||
|
||||
file->mass = new double[file->nelements];
|
||||
memory->create(file->frho,file->nelements,file->nrho+1,
|
||||
"pair:frho");
|
||||
"pair:frho");
|
||||
memory->create(file->rhor,file->nelements,file->nelements,
|
||||
file->nr+1,"pair:rhor");
|
||||
file->nr+1,"pair:rhor");
|
||||
memory->create(file->z2r,file->nelements,file->nelements,
|
||||
file->nr+1,"pair:z2r");
|
||||
file->nr+1,"pair:z2r");
|
||||
|
||||
int i,j,tmp;
|
||||
for (i = 0; i < file->nelements; i++) {
|
||||
|
@ -231,7 +231,7 @@ void PairEAMFSGPU::file2array()
|
|||
|
||||
// allocate frho arrays
|
||||
// nfrho = # of fs elements + 1 for zero array
|
||||
|
||||
|
||||
nfrho = fs->nelements + 1;
|
||||
memory->destroy(frho);
|
||||
memory->create(frho,nfrho,nrho+1,"pair:frho");
|
||||
|
@ -316,12 +316,12 @@ void PairEAMFSGPU::file2array()
|
|||
irow = map[i];
|
||||
icol = map[j];
|
||||
if (irow == -1 || icol == -1) {
|
||||
type2z2r[i][j] = 0;
|
||||
continue;
|
||||
type2z2r[i][j] = 0;
|
||||
continue;
|
||||
}
|
||||
if (irow < icol) {
|
||||
irow = map[j];
|
||||
icol = map[i];
|
||||
irow = map[j];
|
||||
icol = map[i];
|
||||
}
|
||||
n = 0;
|
||||
for (m = 0; m < irow; m++) n += m + 1;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -38,30 +38,30 @@ using namespace LAMMPS_NS;
|
|||
// External functions from cuda library for atom decomposition
|
||||
|
||||
int eam_gpu_init(const int ntypes, double host_cutforcesq,
|
||||
int **host_type2rhor, int **host_type2z2r,
|
||||
int **host_type2rhor, int **host_type2z2r,
|
||||
int *host_type2frho, double ***host_rhor_spline,
|
||||
double ***host_z2r_spline, double ***host_frho_spline,
|
||||
double ***host_z2r_spline, double ***host_frho_spline,
|
||||
double rdr, double rdrho, int nrhor, int nrho, int nz2r,
|
||||
int nfrho, int nr, const int nlocal, const int nall,
|
||||
const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen,
|
||||
int &fp_size);
|
||||
int nfrho, int nr, const int nlocal, const int nall,
|
||||
const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen,
|
||||
int &fp_size);
|
||||
void eam_gpu_clear();
|
||||
int** eam_gpu_compute_n(const int ago, const int inum_full, const int nall,
|
||||
double **host_x, int *host_type, double *sublo,
|
||||
double *subhi, int *tag, int **nspecial, int **special,
|
||||
const bool eflag, const bool vflag, const bool eatom,
|
||||
const bool vatom, int &host_start, int **ilist,
|
||||
int **jnum, const double cpu_time, bool &success,
|
||||
int &inum, void **fp_ptr);
|
||||
void eam_gpu_compute(const int ago, const int inum_full, const int nlocal,
|
||||
const int nall,double **host_x, int *host_type,
|
||||
int *ilist, int *numj, int **firstneigh,
|
||||
const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success, void **fp_ptr);
|
||||
double **host_x, int *host_type, double *sublo,
|
||||
double *subhi, int *tag, int **nspecial, int **special,
|
||||
const bool eflag, const bool vflag, const bool eatom,
|
||||
const bool vatom, int &host_start, int **ilist,
|
||||
int **jnum, const double cpu_time, bool &success,
|
||||
int &inum, void **fp_ptr);
|
||||
void eam_gpu_compute(const int ago, const int inum_full, const int nlocal,
|
||||
const int nall,double **host_x, int *host_type,
|
||||
int *ilist, int *numj, int **firstneigh,
|
||||
const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success, void **fp_ptr);
|
||||
void eam_gpu_compute_force(int *ilist, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom);
|
||||
const bool eatom, const bool vatom);
|
||||
double eam_gpu_bytes();
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
@ -70,7 +70,7 @@ PairEAMGPU::PairEAMGPU(LAMMPS *lmp) : PairEAM(lmp), gpu_mode(GPU_FORCE)
|
|||
{
|
||||
respa_enable = 0;
|
||||
cpu_time = 0.0;
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -100,44 +100,44 @@ void PairEAMGPU::compute(int eflag, int vflag)
|
|||
evdwl = 0.0;
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = vflag_fdotr = eflag_global = eflag_atom = 0;
|
||||
|
||||
|
||||
int nlocal = atom->nlocal;
|
||||
int newton_pair = force->newton_pair;
|
||||
|
||||
// compute density on each atom on GPU
|
||||
|
||||
int nall = atom->nlocal + atom->nghost;
|
||||
int nall = atom->nlocal + atom->nghost;
|
||||
int inum, host_start, inum_dev;
|
||||
|
||||
|
||||
bool success = true;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
if (gpu_mode != GPU_FORCE) {
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
if (gpu_mode != GPU_FORCE) {
|
||||
inum = atom->nlocal;
|
||||
firstneigh = eam_gpu_compute_n(neighbor->ago, inum, nall, atom->x,
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success, inum_dev, &fp_pinned);
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success, inum_dev, &fp_pinned);
|
||||
} else { // gpu_mode == GPU_FORCE
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
eam_gpu_compute(neighbor->ago, inum, nlocal, nall, atom->x, atom->type,
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success, &fp_pinned);
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success, &fp_pinned);
|
||||
}
|
||||
|
||||
|
||||
if (!success)
|
||||
error->one(FLERR,"Insufficient memory on accelerator");
|
||||
|
||||
// communicate derivative of embedding function
|
||||
|
||||
comm->forward_comm_pair(this);
|
||||
|
||||
|
||||
// compute forces on each atom on GPU
|
||||
if (gpu_mode != GPU_FORCE)
|
||||
if (gpu_mode != GPU_FORCE)
|
||||
eam_gpu_compute_force(NULL, eflag, vflag, eflag_atom, vflag_atom);
|
||||
else
|
||||
eam_gpu_compute_force(ilist, eflag, vflag, eflag_atom, vflag_atom);
|
||||
|
@ -149,14 +149,14 @@ void PairEAMGPU::compute(int eflag, int vflag)
|
|||
|
||||
void PairEAMGPU::init_style()
|
||||
{
|
||||
if (force->newton_pair)
|
||||
if (force->newton_pair)
|
||||
error->all(FLERR,"Cannot use newton pair with eam/gpu pair style");
|
||||
|
||||
|
||||
// convert read-in file(s) to arrays and spline them
|
||||
|
||||
file2array();
|
||||
array2spline();
|
||||
|
||||
|
||||
// Repeat cutsq calculation because done after call to init_style
|
||||
double maxcut = -1.0;
|
||||
double cut;
|
||||
|
@ -173,18 +173,18 @@ void PairEAMGPU::init_style()
|
|||
}
|
||||
}
|
||||
double cell_size = sqrt(maxcut) + neighbor->skin;
|
||||
|
||||
|
||||
int maxspecial=0;
|
||||
if (atom->molecular)
|
||||
maxspecial=atom->maxspecial;
|
||||
int fp_size;
|
||||
int success = eam_gpu_init(atom->ntypes+1, cutforcesq, type2rhor, type2z2r,
|
||||
type2frho, rhor_spline, z2r_spline, frho_spline,
|
||||
rdr, rdrho, nrhor, nrho, nz2r, nfrho, nr,
|
||||
atom->nlocal, atom->nlocal+atom->nghost, 300,
|
||||
maxspecial, cell_size, gpu_mode, screen, fp_size);
|
||||
type2frho, rhor_spline, z2r_spline, frho_spline,
|
||||
rdr, rdrho, nrhor, nrho, nz2r, nfrho, nr,
|
||||
atom->nlocal, atom->nlocal+atom->nghost, 300,
|
||||
maxspecial, cell_size, gpu_mode, screen, fp_size);
|
||||
GPU_EXTRA::check_flag(success,error,world);
|
||||
|
||||
|
||||
if (gpu_mode == GPU_FORCE) {
|
||||
int irequest = neighbor->request(this);
|
||||
neighbor->requests[irequest]->half = 0;
|
||||
|
@ -199,8 +199,8 @@ void PairEAMGPU::init_style()
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int PairEAMGPU::pack_comm(int n, int *list, double *buf, int pbc_flag,
|
||||
int *pbc)
|
||||
int PairEAMGPU::pack_comm(int n, int *list, double *buf, int pbc_flag,
|
||||
int *pbc)
|
||||
{
|
||||
int i,j,m;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -44,7 +44,7 @@ class PairEAMGPU : public PairEAM {
|
|||
double cpu_time;
|
||||
int *gpulist;
|
||||
void *fp_pinned;
|
||||
bool fp_single;
|
||||
bool fp_single;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
@ -40,26 +40,26 @@
|
|||
// External functions from cuda library for atom decomposition
|
||||
|
||||
int gb_gpu_init(const int ntypes, const double gamma, const double upsilon,
|
||||
const double mu, double **shape, double **well, double **cutsq,
|
||||
double **sigma, double **epsilon, double *host_lshape,
|
||||
int **form, double **host_lj1, double **host_lj2,
|
||||
double **host_lj3, double **host_lj4, double **offset,
|
||||
double *special_lj, const int nlocal, const int nall,
|
||||
const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen);
|
||||
const double mu, double **shape, double **well, double **cutsq,
|
||||
double **sigma, double **epsilon, double *host_lshape,
|
||||
int **form, double **host_lj1, double **host_lj2,
|
||||
double **host_lj3, double **host_lj4, double **offset,
|
||||
double *special_lj, const int nlocal, const int nall,
|
||||
const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen);
|
||||
void gb_gpu_clear();
|
||||
int ** gb_gpu_compute_n(const int ago, const int inum, const int nall,
|
||||
double **host_x, int *host_type, double *sublo,
|
||||
double *subhi, int *tag, int **nspecial, int **special,
|
||||
const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
int **ilist, int **jnum, const double cpu_time,
|
||||
bool &success, double **host_quat);
|
||||
double **host_x, int *host_type, double *sublo,
|
||||
double *subhi, int *tag, int **nspecial, int **special,
|
||||
const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
int **ilist, int **jnum, const double cpu_time,
|
||||
bool &success, double **host_quat);
|
||||
int * gb_gpu_compute(const int ago, const int inum, const int nall,
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success, double **host_quat);
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success, double **host_quat);
|
||||
double gb_gpu_bytes();
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
@ -72,11 +72,11 @@ PairGayBerneGPU::PairGayBerneGPU(LAMMPS *lmp) : PairGayBerne(lmp),
|
|||
gpu_mode(GPU_FORCE)
|
||||
{
|
||||
avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid");
|
||||
if (!avec)
|
||||
if (!avec)
|
||||
error->all(FLERR,"Pair gayberne/gpu requires atom style ellipsoid");
|
||||
quat_nmax = 0;
|
||||
quat = NULL;
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -101,7 +101,7 @@ void PairGayBerneGPU::compute(int eflag, int vflag)
|
|||
int inum, host_start;
|
||||
|
||||
bool success = true;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
|
||||
if (nall > quat_nmax) {
|
||||
quat_nmax = static_cast<int>(1.1 * nall);
|
||||
|
@ -122,19 +122,19 @@ void PairGayBerneGPU::compute(int eflag, int vflag)
|
|||
if (gpu_mode != GPU_FORCE) {
|
||||
inum = atom->nlocal;
|
||||
firstneigh = gb_gpu_compute_n(neighbor->ago, inum, nall, atom->x,
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success, quat);
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success, quat);
|
||||
} else {
|
||||
inum = list->inum;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
ilist = gb_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type,
|
||||
list->ilist, numneigh, firstneigh, eflag, vflag,
|
||||
eflag_atom, vflag_atom, host_start,
|
||||
cpu_time, success, quat);
|
||||
list->ilist, numneigh, firstneigh, eflag, vflag,
|
||||
eflag_atom, vflag_atom, host_start,
|
||||
cpu_time, success, quat);
|
||||
}
|
||||
if (!success)
|
||||
error->one(FLERR,"Insufficient memory on accelerator");
|
||||
|
@ -152,7 +152,7 @@ void PairGayBerneGPU::compute(int eflag, int vflag)
|
|||
|
||||
void PairGayBerneGPU::init_style()
|
||||
{
|
||||
if (force->newton_pair)
|
||||
if (force->newton_pair)
|
||||
error->all(FLERR,"Cannot use newton pair with gayberne/gpu pair style");
|
||||
if (!atom->ellipsoid_flag)
|
||||
error->all(FLERR,"Pair gayberne/gpu requires atom style ellipsoid");
|
||||
|
@ -169,7 +169,7 @@ void PairGayBerneGPU::init_style()
|
|||
shape2[i][0] = shape1[i][0]*shape1[i][0];
|
||||
shape2[i][1] = shape1[i][1]*shape1[i][1];
|
||||
shape2[i][2] = shape1[i][2]*shape1[i][2];
|
||||
lshape[i] = (shape1[i][0]*shape1[i][1]+shape1[i][2]*shape1[i][2]) *
|
||||
lshape[i] = (shape1[i][0]*shape1[i][1]+shape1[i][2]*shape1[i][2]) *
|
||||
sqrt(shape1[i][0]*shape1[i][1]);
|
||||
}
|
||||
|
||||
|
@ -194,11 +194,11 @@ void PairGayBerneGPU::init_style()
|
|||
int maxspecial=0;
|
||||
if (atom->molecular)
|
||||
maxspecial=atom->maxspecial;
|
||||
int success = gb_gpu_init(atom->ntypes+1, gamma, upsilon, mu,
|
||||
shape2, well, cutsq, sigma, epsilon, lshape, form,
|
||||
lj1, lj2, lj3, lj4, offset, force->special_lj,
|
||||
atom->nlocal, atom->nlocal+atom->nghost, 300,
|
||||
maxspecial, cell_size, gpu_mode, screen);
|
||||
int success = gb_gpu_init(atom->ntypes+1, gamma, upsilon, mu,
|
||||
shape2, well, cutsq, sigma, epsilon, lshape, form,
|
||||
lj1, lj2, lj3, lj4, offset, force->special_lj,
|
||||
atom->nlocal, atom->nlocal+atom->nghost, 300,
|
||||
maxspecial, cell_size, gpu_mode, screen);
|
||||
GPU_EXTRA::check_flag(success,error,world);
|
||||
|
||||
if (gpu_mode == GPU_FORCE) {
|
||||
|
@ -221,7 +221,7 @@ double PairGayBerneGPU::memory_usage()
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairGayBerneGPU::cpu_compute(int start, int inum, int eflag, int vflag,
|
||||
int *ilist, int *numneigh, int **firstneigh)
|
||||
int *ilist, int *numneigh, int **firstneigh)
|
||||
{
|
||||
int i,j,ii,jj,jnum,itype,jtype;
|
||||
double evdwl,one_eng,rsq,r2inv,r6inv,forcelj,factor_lj;
|
||||
|
@ -273,68 +273,68 @@ void PairGayBerneGPU::cpu_compute(int start, int inum, int eflag, int vflag,
|
|||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
|
||||
switch (form[itype][jtype]) {
|
||||
case SPHERE_SPHERE:
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
forcelj *= -r2inv;
|
||||
if (eflag) one_eng =
|
||||
r6inv*(r6inv*lj3[itype][jtype]-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
fforce[0] = r12[0]*forcelj;
|
||||
fforce[1] = r12[1]*forcelj;
|
||||
fforce[2] = r12[2]*forcelj;
|
||||
ttor[0] = ttor[1] = ttor[2] = 0.0;
|
||||
rtor[0] = rtor[1] = rtor[2] = 0.0;
|
||||
break;
|
||||
switch (form[itype][jtype]) {
|
||||
case SPHERE_SPHERE:
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
forcelj *= -r2inv;
|
||||
if (eflag) one_eng =
|
||||
r6inv*(r6inv*lj3[itype][jtype]-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
fforce[0] = r12[0]*forcelj;
|
||||
fforce[1] = r12[1]*forcelj;
|
||||
fforce[2] = r12[2]*forcelj;
|
||||
ttor[0] = ttor[1] = ttor[2] = 0.0;
|
||||
rtor[0] = rtor[1] = rtor[2] = 0.0;
|
||||
break;
|
||||
|
||||
case SPHERE_ELLIPSE:
|
||||
jquat = bonus[ellipsoid[j]].quat;
|
||||
MathExtra::quat_to_mat_trans(jquat,a2);
|
||||
MathExtra::diag_times3(well[jtype],a2,temp);
|
||||
MathExtra::transpose_times3(a2,temp,b2);
|
||||
MathExtra::diag_times3(shape2[jtype],a2,temp);
|
||||
MathExtra::transpose_times3(a2,temp,g2);
|
||||
one_eng = gayberne_lj(j,i,a2,b2,g2,r12,rsq,fforce,rtor);
|
||||
ttor[0] = ttor[1] = ttor[2] = 0.0;
|
||||
break;
|
||||
jquat = bonus[ellipsoid[j]].quat;
|
||||
MathExtra::quat_to_mat_trans(jquat,a2);
|
||||
MathExtra::diag_times3(well[jtype],a2,temp);
|
||||
MathExtra::transpose_times3(a2,temp,b2);
|
||||
MathExtra::diag_times3(shape2[jtype],a2,temp);
|
||||
MathExtra::transpose_times3(a2,temp,g2);
|
||||
one_eng = gayberne_lj(j,i,a2,b2,g2,r12,rsq,fforce,rtor);
|
||||
ttor[0] = ttor[1] = ttor[2] = 0.0;
|
||||
break;
|
||||
|
||||
case ELLIPSE_SPHERE:
|
||||
one_eng = gayberne_lj(i,j,a1,b1,g1,r12,rsq,fforce,ttor);
|
||||
rtor[0] = rtor[1] = rtor[2] = 0.0;
|
||||
break;
|
||||
one_eng = gayberne_lj(i,j,a1,b1,g1,r12,rsq,fforce,ttor);
|
||||
rtor[0] = rtor[1] = rtor[2] = 0.0;
|
||||
break;
|
||||
|
||||
default:
|
||||
jquat = bonus[ellipsoid[j]].quat;
|
||||
MathExtra::quat_to_mat_trans(jquat,a2);
|
||||
MathExtra::diag_times3(well[jtype],a2,temp);
|
||||
MathExtra::transpose_times3(a2,temp,b2);
|
||||
MathExtra::diag_times3(shape2[jtype],a2,temp);
|
||||
MathExtra::transpose_times3(a2,temp,g2);
|
||||
one_eng = gayberne_analytic(i,j,a1,a2,b1,b2,g1,g2,r12,rsq,
|
||||
fforce,ttor,rtor);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
jquat = bonus[ellipsoid[j]].quat;
|
||||
MathExtra::quat_to_mat_trans(jquat,a2);
|
||||
MathExtra::diag_times3(well[jtype],a2,temp);
|
||||
MathExtra::transpose_times3(a2,temp,b2);
|
||||
MathExtra::diag_times3(shape2[jtype],a2,temp);
|
||||
MathExtra::transpose_times3(a2,temp,g2);
|
||||
one_eng = gayberne_analytic(i,j,a1,a2,b1,b2,g1,g2,r12,rsq,
|
||||
fforce,ttor,rtor);
|
||||
break;
|
||||
}
|
||||
|
||||
fforce[0] *= factor_lj;
|
||||
fforce[1] *= factor_lj;
|
||||
fforce[2] *= factor_lj;
|
||||
fforce[1] *= factor_lj;
|
||||
fforce[2] *= factor_lj;
|
||||
ttor[0] *= factor_lj;
|
||||
ttor[1] *= factor_lj;
|
||||
ttor[2] *= factor_lj;
|
||||
ttor[1] *= factor_lj;
|
||||
ttor[2] *= factor_lj;
|
||||
|
||||
f[i][0] += fforce[0];
|
||||
f[i][1] += fforce[1];
|
||||
f[i][2] += fforce[2];
|
||||
f[i][1] += fforce[1];
|
||||
f[i][2] += fforce[2];
|
||||
tor[i][0] += ttor[0];
|
||||
tor[i][1] += ttor[1];
|
||||
tor[i][2] += ttor[2];
|
||||
tor[i][1] += ttor[1];
|
||||
tor[i][2] += ttor[2];
|
||||
|
||||
if (eflag) evdwl = factor_lj*one_eng;
|
||||
|
||||
if (evflag) ev_tally_xyz_full(i,evdwl,0.0,fforce[0],fforce[1],fforce[2],
|
||||
-r12[0],-r12[1],-r12[2]);
|
||||
if (evflag) ev_tally_xyz_full(i,evdwl,0.0,fforce[0],fforce[1],fforce[2],
|
||||
-r12[0],-r12[1],-r12[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
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
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
|
@ -38,23 +38,23 @@
|
|||
// External functions from cuda library for atom decomposition
|
||||
|
||||
int lj96_gpu_init(const int ntypes, double **cutsq, double **host_lj1,
|
||||
double **host_lj2, double **host_lj3, double **host_lj4,
|
||||
double **offset, double *special_lj, const int nlocal,
|
||||
const int nall, const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen);
|
||||
double **host_lj2, double **host_lj3, double **host_lj4,
|
||||
double **offset, double *special_lj, const int nlocal,
|
||||
const int nall, const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen);
|
||||
void lj96_gpu_clear();
|
||||
int ** lj96_gpu_compute_n(const int ago, const int inum, const int nall,
|
||||
double **host_x, int *host_type, double *sublo,
|
||||
double *subhi, int *tag, int **nspecial,
|
||||
int **special, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
int **ilist, int **jnum,
|
||||
const double cpu_time, bool &success);
|
||||
double **host_x, int *host_type, double *sublo,
|
||||
double *subhi, int *tag, int **nspecial,
|
||||
int **special, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
int **ilist, int **jnum,
|
||||
const double cpu_time, bool &success);
|
||||
void lj96_gpu_compute(const int ago, const int inum, const int nall,
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success);
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success);
|
||||
double lj96_gpu_bytes();
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
@ -65,7 +65,7 @@ PairLJ96CutGPU::PairLJ96CutGPU(LAMMPS *lmp) : PairLJ96Cut(lmp), gpu_mode(GPU_FOR
|
|||
{
|
||||
respa_enable = 0;
|
||||
cpu_time = 0.0;
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -83,28 +83,28 @@ void PairLJ96CutGPU::compute(int eflag, int vflag)
|
|||
{
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = vflag_fdotr = 0;
|
||||
|
||||
|
||||
int nall = atom->nlocal + atom->nghost;
|
||||
int inum, host_start;
|
||||
|
||||
|
||||
bool success = true;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
if (gpu_mode != GPU_FORCE) {
|
||||
inum = atom->nlocal;
|
||||
firstneigh = lj96_gpu_compute_n(neighbor->ago, inum, nall, atom->x,
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success);
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success);
|
||||
} else {
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
lj96_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type,
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success);
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success);
|
||||
}
|
||||
if (!success)
|
||||
error->one(FLERR,"Insufficient memory on accelerator");
|
||||
|
@ -124,7 +124,7 @@ void PairLJ96CutGPU::init_style()
|
|||
{
|
||||
cut_respa = NULL;
|
||||
|
||||
if (force->newton_pair)
|
||||
if (force->newton_pair)
|
||||
error->all(FLERR,"Cannot use newton pair with lj96/cut/gpu pair style");
|
||||
|
||||
// Repeat cutsq calculation because done after call to init_style
|
||||
|
@ -148,9 +148,9 @@ void PairLJ96CutGPU::init_style()
|
|||
if (atom->molecular)
|
||||
maxspecial=atom->maxspecial;
|
||||
int success = lj96_gpu_init(atom->ntypes+1, cutsq, lj1, lj2, lj3, lj4,
|
||||
offset, force->special_lj, atom->nlocal,
|
||||
atom->nlocal+atom->nghost, 300, maxspecial,
|
||||
cell_size, gpu_mode, screen);
|
||||
offset, force->special_lj, atom->nlocal,
|
||||
atom->nlocal+atom->nghost, 300, maxspecial,
|
||||
cell_size, gpu_mode, screen);
|
||||
GPU_EXTRA::check_flag(success,error,world);
|
||||
|
||||
if (gpu_mode == GPU_FORCE) {
|
||||
|
@ -171,7 +171,7 @@ double PairLJ96CutGPU::memory_usage()
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJ96CutGPU::cpu_compute(int start, int inum, int eflag, int vflag,
|
||||
int *ilist, int *numneigh, int **firstneigh)
|
||||
int *ilist, int *numneigh, int **firstneigh)
|
||||
{
|
||||
int i,j,ii,jj,jnum,itype,jtype;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair;
|
||||
|
@ -206,23 +206,23 @@ void PairLJ96CutGPU::cpu_compute(int start, int inum, int eflag, int vflag,
|
|||
jtype = type[j];
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
r3inv = sqrt(r6inv);
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]);
|
||||
fpair = factor_lj*forcelj*r2inv;
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
r3inv = sqrt(r6inv);
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]);
|
||||
fpair = factor_lj*forcelj*r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
|
||||
if (eflag) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r3inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
}
|
||||
if (eflag) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r3inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally_full(i,evdwl,0.0,fpair,delx,dely,delz);
|
||||
if (evflag) ev_tally_full(i,evdwl,0.0,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
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
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
|
@ -47,42 +47,42 @@
|
|||
// External functions from cuda library for atom decomposition
|
||||
|
||||
int crml_gpu_init(const int ntypes, double cut_bothsq, double **host_lj1,
|
||||
double **host_lj2, double **host_lj3, double **host_lj4,
|
||||
double **offset, double *special_lj, const int nlocal,
|
||||
const int nall, const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen,
|
||||
double host_cut_ljsq, double host_cut_coulsq,
|
||||
double *host_special_coul, const double qqrd2e,
|
||||
const double g_ewald, const double cut_lj_innersq,
|
||||
const double denom_lj, double **epsilon, double **sigma,
|
||||
const bool mix_arithmetic);
|
||||
double **host_lj2, double **host_lj3, double **host_lj4,
|
||||
double **offset, double *special_lj, const int nlocal,
|
||||
const int nall, const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen,
|
||||
double host_cut_ljsq, double host_cut_coulsq,
|
||||
double *host_special_coul, const double qqrd2e,
|
||||
const double g_ewald, const double cut_lj_innersq,
|
||||
const double denom_lj, double **epsilon, double **sigma,
|
||||
const bool mix_arithmetic);
|
||||
void crml_gpu_clear();
|
||||
int ** crml_gpu_compute_n(const int ago, const int inum,
|
||||
const int nall, double **host_x, int *host_type,
|
||||
double *sublo, double *subhi, int *tag,
|
||||
int **nspecial, int **special, const bool eflag,
|
||||
const bool vflag, const bool eatom, const bool vatom,
|
||||
int &host_start, int **ilist, int **jnum,
|
||||
const double cpu_time, bool &success, double *host_q,
|
||||
double *boxlo, double *prd);
|
||||
const int nall, double **host_x, int *host_type,
|
||||
double *sublo, double *subhi, int *tag,
|
||||
int **nspecial, int **special, const bool eflag,
|
||||
const bool vflag, const bool eatom, const bool vatom,
|
||||
int &host_start, int **ilist, int **jnum,
|
||||
const double cpu_time, bool &success, double *host_q,
|
||||
double *boxlo, double *prd);
|
||||
void crml_gpu_compute(const int ago, const int inum, const int nall,
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success, double *host_q,
|
||||
const int nlocal, double *boxlo, double *prd);
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success, double *host_q,
|
||||
const int nlocal, double *boxlo, double *prd);
|
||||
double crml_gpu_bytes();
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairLJCharmmCoulLongGPU::PairLJCharmmCoulLongGPU(LAMMPS *lmp) :
|
||||
PairLJCharmmCoulLongGPU::PairLJCharmmCoulLongGPU(LAMMPS *lmp) :
|
||||
PairLJCharmmCoulLong(lmp), gpu_mode(GPU_FORCE)
|
||||
{
|
||||
respa_enable = 0;
|
||||
cpu_time = 0.0;
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -100,30 +100,30 @@ void PairLJCharmmCoulLongGPU::compute(int eflag, int vflag)
|
|||
{
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = vflag_fdotr = 0;
|
||||
|
||||
|
||||
int nall = atom->nlocal + atom->nghost;
|
||||
int inum, host_start;
|
||||
|
||||
|
||||
bool success = true;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
if (gpu_mode != GPU_FORCE) {
|
||||
inum = atom->nlocal;
|
||||
firstneigh = crml_gpu_compute_n(neighbor->ago, inum, nall, atom->x,
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success, atom->q, domain->boxlo,
|
||||
domain->prd);
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success, atom->q, domain->boxlo,
|
||||
domain->prd);
|
||||
} else {
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
crml_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type,
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success, atom->q,
|
||||
atom->nlocal, domain->boxlo, domain->prd);
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success, atom->q,
|
||||
atom->nlocal, domain->boxlo, domain->prd);
|
||||
}
|
||||
if (!success)
|
||||
error->one(FLERR,"Insufficient memory on accelerator");
|
||||
|
@ -145,7 +145,7 @@ void PairLJCharmmCoulLongGPU::init_style()
|
|||
|
||||
if (!atom->q_flag)
|
||||
error->all(FLERR,"Pair style lj/charmm/coul/long/gpu requires atom attribute q");
|
||||
if (force->newton_pair)
|
||||
if (force->newton_pair)
|
||||
error->all(FLERR,"Cannot use newton pair with lj/charmm/coul/long/gpu pair style");
|
||||
|
||||
// Repeat cutsq calculation because done after call to init_style
|
||||
|
@ -162,7 +162,7 @@ void PairLJCharmmCoulLongGPU::init_style()
|
|||
cut_coulsq = cut_coul * cut_coul;
|
||||
cut_bothsq = MAX(cut_ljsq,cut_coulsq);
|
||||
|
||||
denom_lj = (cut_ljsq-cut_lj_innersq) * (cut_ljsq-cut_lj_innersq) *
|
||||
denom_lj = (cut_ljsq-cut_lj_innersq) * (cut_ljsq-cut_lj_innersq) *
|
||||
(cut_ljsq-cut_lj_innersq);
|
||||
|
||||
double cell_size = sqrt(cut_bothsq) + neighbor->skin;
|
||||
|
@ -185,18 +185,18 @@ void PairLJCharmmCoulLongGPU::init_style()
|
|||
for (int i = 1; i < atom->ntypes + 1; i++)
|
||||
for (int j = i + 1; j < atom->ntypes + 1; j++) {
|
||||
if (epsilon[i][j] != sqrt(epsilon[i][i] * epsilon[j][j]))
|
||||
arithmetic = false;
|
||||
arithmetic = false;
|
||||
if (sigma[i][j] != 0.5 * (sigma[i][i] + sigma[j][j]))
|
||||
arithmetic = false;
|
||||
arithmetic = false;
|
||||
}
|
||||
|
||||
int success = crml_gpu_init(atom->ntypes+1, cut_bothsq, lj1, lj2, lj3, lj4,
|
||||
offset, force->special_lj, atom->nlocal,
|
||||
atom->nlocal+atom->nghost, 300, maxspecial,
|
||||
cell_size, gpu_mode, screen, cut_ljsq,
|
||||
cut_coulsq, force->special_coul, force->qqrd2e,
|
||||
g_ewald, cut_lj_innersq,denom_lj,epsilon,sigma,
|
||||
arithmetic);
|
||||
offset, force->special_lj, atom->nlocal,
|
||||
atom->nlocal+atom->nghost, 300, maxspecial,
|
||||
cell_size, gpu_mode, screen, cut_ljsq,
|
||||
cut_coulsq, force->special_coul, force->qqrd2e,
|
||||
g_ewald, cut_lj_innersq,denom_lj,epsilon,sigma,
|
||||
arithmetic);
|
||||
GPU_EXTRA::check_flag(success,error,world);
|
||||
|
||||
if (gpu_mode == GPU_FORCE) {
|
||||
|
@ -217,8 +217,8 @@ double PairLJCharmmCoulLongGPU::memory_usage()
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJCharmmCoulLongGPU::cpu_compute(int start, int inum, int eflag,
|
||||
int vflag, int *ilist,
|
||||
int *numneigh, int **firstneigh)
|
||||
int vflag, int *ilist,
|
||||
int *numneigh, int **firstneigh)
|
||||
{
|
||||
int i,j,ii,jj,jnum,itype,jtype,itable;
|
||||
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair;
|
||||
|
@ -263,77 +263,77 @@ void PairLJCharmmCoulLongGPU::cpu_compute(int start, int inum, int eflag,
|
|||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
|
||||
if (rsq < cut_bothsq) {
|
||||
r2inv = 1.0/rsq;
|
||||
r2inv = 1.0/rsq;
|
||||
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq) {
|
||||
r = sqrt(rsq);
|
||||
grij = g_ewald * r;
|
||||
expm2 = exp(-grij*grij);
|
||||
t = 1.0 / (1.0 + EWALD_P*grij);
|
||||
erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2;
|
||||
prefactor = qqrd2e * qtmp*q[j]/r;
|
||||
forcecoul = prefactor * (erfc + EWALD_F*grij*expm2);
|
||||
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else {
|
||||
union_int_float_t rsq_lookup;
|
||||
rsq_lookup.f = rsq;
|
||||
itable = rsq_lookup.i & ncoulmask;
|
||||
itable >>= ncoulshiftbits;
|
||||
fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable];
|
||||
table = ftable[itable] + fraction*dftable[itable];
|
||||
forcecoul = qtmp*q[j] * table;
|
||||
if (factor_coul < 1.0) {
|
||||
table = ctable[itable] + fraction*dctable[itable];
|
||||
prefactor = qtmp*q[j] * table;
|
||||
forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
}
|
||||
}
|
||||
} else forcecoul = 0.0;
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq) {
|
||||
r = sqrt(rsq);
|
||||
grij = g_ewald * r;
|
||||
expm2 = exp(-grij*grij);
|
||||
t = 1.0 / (1.0 + EWALD_P*grij);
|
||||
erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2;
|
||||
prefactor = qqrd2e * qtmp*q[j]/r;
|
||||
forcecoul = prefactor * (erfc + EWALD_F*grij*expm2);
|
||||
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else {
|
||||
union_int_float_t rsq_lookup;
|
||||
rsq_lookup.f = rsq;
|
||||
itable = rsq_lookup.i & ncoulmask;
|
||||
itable >>= ncoulshiftbits;
|
||||
fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable];
|
||||
table = ftable[itable] + fraction*dftable[itable];
|
||||
forcecoul = qtmp*q[j] * table;
|
||||
if (factor_coul < 1.0) {
|
||||
table = ctable[itable] + fraction*dctable[itable];
|
||||
prefactor = qtmp*q[j] * table;
|
||||
forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
}
|
||||
}
|
||||
} else forcecoul = 0.0;
|
||||
|
||||
if (rsq < cut_ljsq) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
jtype = type[j];
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
if (rsq > cut_lj_innersq) {
|
||||
switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) *
|
||||
(cut_ljsq + 2.0*rsq - 3.0*cut_lj_innersq) / denom_lj;
|
||||
switch2 = 12.0*rsq * (cut_ljsq-rsq) *
|
||||
(rsq-cut_lj_innersq) / denom_lj;
|
||||
philj = r6inv * (lj3[itype][jtype]*r6inv - lj4[itype][jtype]);
|
||||
forcelj = forcelj*switch1 + philj*switch2;
|
||||
}
|
||||
} else forcelj = 0.0;
|
||||
if (rsq < cut_ljsq) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
jtype = type[j];
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
if (rsq > cut_lj_innersq) {
|
||||
switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) *
|
||||
(cut_ljsq + 2.0*rsq - 3.0*cut_lj_innersq) / denom_lj;
|
||||
switch2 = 12.0*rsq * (cut_ljsq-rsq) *
|
||||
(rsq-cut_lj_innersq) / denom_lj;
|
||||
philj = r6inv * (lj3[itype][jtype]*r6inv - lj4[itype][jtype]);
|
||||
forcelj = forcelj*switch1 + philj*switch2;
|
||||
}
|
||||
} else forcelj = 0.0;
|
||||
|
||||
fpair = (forcecoul + factor_lj*forcelj) * r2inv;
|
||||
fpair = (forcecoul + factor_lj*forcelj) * r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq)
|
||||
ecoul = prefactor*erfc;
|
||||
else {
|
||||
table = etable[itable] + fraction*detable[itable];
|
||||
ecoul = qtmp*q[j] * table;
|
||||
}
|
||||
if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else ecoul = 0.0;
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq)
|
||||
ecoul = prefactor*erfc;
|
||||
else {
|
||||
table = etable[itable] + fraction*detable[itable];
|
||||
ecoul = qtmp*q[j] * table;
|
||||
}
|
||||
if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else ecoul = 0.0;
|
||||
|
||||
if (rsq < cut_ljsq) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]);
|
||||
if (rsq > cut_lj_innersq) {
|
||||
switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) *
|
||||
(cut_ljsq + 2.0*rsq - 3.0*cut_lj_innersq) / denom_lj;
|
||||
evdwl *= switch1;
|
||||
}
|
||||
evdwl *= factor_lj;
|
||||
} else evdwl = 0.0;
|
||||
}
|
||||
if (rsq < cut_ljsq) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]);
|
||||
if (rsq > cut_lj_innersq) {
|
||||
switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) *
|
||||
(cut_ljsq + 2.0*rsq - 3.0*cut_lj_innersq) / denom_lj;
|
||||
evdwl *= switch1;
|
||||
}
|
||||
evdwl *= factor_lj;
|
||||
} else evdwl = 0.0;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally_full(i,evdwl,ecoul,fpair,delx,dely,delz);
|
||||
if (evflag) ev_tally_full(i,evdwl,ecoul,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
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
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
|
@ -47,39 +47,39 @@
|
|||
// External functions from cuda library for atom decomposition
|
||||
|
||||
int c2cl_gpu_init(const int ntypes, double **cutsq, double **host_lj1,
|
||||
double **host_lj2, double **host_lj3, double **host_lj4,
|
||||
double **offset, double *special_lj, const int nlocal,
|
||||
const int nall, const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen,
|
||||
double **host_cut_ljsq, double host_cut_coulsq,
|
||||
double *host_special_coul, const double qqrd2e,
|
||||
const double g_ewald);
|
||||
double **host_lj2, double **host_lj3, double **host_lj4,
|
||||
double **offset, double *special_lj, const int nlocal,
|
||||
const int nall, const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen,
|
||||
double **host_cut_ljsq, double host_cut_coulsq,
|
||||
double *host_special_coul, const double qqrd2e,
|
||||
const double g_ewald);
|
||||
void c2cl_gpu_clear();
|
||||
int ** c2cl_gpu_compute_n(const int ago, const int inum,
|
||||
const int nall, double **host_x, int *host_type,
|
||||
double *sublo, double *subhi, int *tag,
|
||||
int **nspecial, int **special, const bool eflag,
|
||||
const bool vflag, const bool eatom, const bool vatom,
|
||||
int &host_start, int **ilist, int **jnum,
|
||||
const double cpu_time, bool &success, double *host_q,
|
||||
double *boxlo, double *prd);
|
||||
const int nall, double **host_x, int *host_type,
|
||||
double *sublo, double *subhi, int *tag,
|
||||
int **nspecial, int **special, const bool eflag,
|
||||
const bool vflag, const bool eatom, const bool vatom,
|
||||
int &host_start, int **ilist, int **jnum,
|
||||
const double cpu_time, bool &success, double *host_q,
|
||||
double *boxlo, double *prd);
|
||||
void c2cl_gpu_compute(const int ago, const int inum, const int nall,
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success, double *host_q,
|
||||
const int nlocal, double *boxlo, double *prd);
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success, double *host_q,
|
||||
const int nlocal, double *boxlo, double *prd);
|
||||
double c2cl_gpu_bytes();
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairLJClass2CoulLongGPU::PairLJClass2CoulLongGPU(LAMMPS *lmp) :
|
||||
PairLJClass2CoulLongGPU::PairLJClass2CoulLongGPU(LAMMPS *lmp) :
|
||||
PairLJClass2CoulLong(lmp), gpu_mode(GPU_FORCE)
|
||||
{
|
||||
cpu_time = 0.0;
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -97,30 +97,30 @@ void PairLJClass2CoulLongGPU::compute(int eflag, int vflag)
|
|||
{
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = vflag_fdotr = 0;
|
||||
|
||||
|
||||
int nall = atom->nlocal + atom->nghost;
|
||||
int inum, host_start;
|
||||
|
||||
|
||||
bool success = true;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
if (gpu_mode != GPU_FORCE) {
|
||||
inum = atom->nlocal;
|
||||
firstneigh = c2cl_gpu_compute_n(neighbor->ago, inum, nall, atom->x,
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success, atom->q, domain->boxlo,
|
||||
domain->prd);
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success, atom->q, domain->boxlo,
|
||||
domain->prd);
|
||||
} else {
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
c2cl_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type,
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success, atom->q,
|
||||
atom->nlocal, domain->boxlo, domain->prd);
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success, atom->q,
|
||||
atom->nlocal, domain->boxlo, domain->prd);
|
||||
}
|
||||
if (!success)
|
||||
error->one(FLERR,"Insufficient memory on accelerator");
|
||||
|
@ -140,7 +140,7 @@ void PairLJClass2CoulLongGPU::init_style()
|
|||
{
|
||||
if (!atom->q_flag)
|
||||
error->all(FLERR,"Pair style lj/class2/coul/long/gpu requires atom attribute q");
|
||||
if (force->newton_pair)
|
||||
if (force->newton_pair)
|
||||
error->all(FLERR,"Cannot use newton pair with lj/class2/coul/long/gpu pair style");
|
||||
|
||||
// Repeat cutsq calculation because done after call to init_style
|
||||
|
@ -196,8 +196,8 @@ double PairLJClass2CoulLongGPU::memory_usage()
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJClass2CoulLongGPU::cpu_compute(int start, int inum, int eflag,
|
||||
int vflag, int *ilist, int *numneigh,
|
||||
int **firstneigh)
|
||||
int vflag, int *ilist, int *numneigh,
|
||||
int **firstneigh)
|
||||
{
|
||||
int i,j,ii,jj,jnum,itype,jtype;
|
||||
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair;
|
||||
|
@ -241,45 +241,45 @@ void PairLJClass2CoulLongGPU::cpu_compute(int start, int inum, int eflag,
|
|||
jtype = type[j];
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r2inv = 1.0/rsq;
|
||||
r2inv = 1.0/rsq;
|
||||
|
||||
if (rsq < cut_coulsq) {
|
||||
r = sqrt(rsq);
|
||||
grij = g_ewald * r;
|
||||
expm2 = exp(-grij*grij);
|
||||
t = 1.0 / (1.0 + EWALD_P*grij);
|
||||
erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2;
|
||||
prefactor = qqrd2e * qtmp*q[j]/r;
|
||||
forcecoul = prefactor * (erfc + EWALD_F*grij*expm2);
|
||||
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else forcecoul = 0.0;
|
||||
if (rsq < cut_coulsq) {
|
||||
r = sqrt(rsq);
|
||||
grij = g_ewald * r;
|
||||
expm2 = exp(-grij*grij);
|
||||
t = 1.0 / (1.0 + EWALD_P*grij);
|
||||
erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2;
|
||||
prefactor = qqrd2e * qtmp*q[j]/r;
|
||||
forcecoul = prefactor * (erfc + EWALD_F*grij*expm2);
|
||||
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else forcecoul = 0.0;
|
||||
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
rinv = sqrt(r2inv);
|
||||
r3inv = r2inv*rinv;
|
||||
r6inv = r3inv*r3inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]);
|
||||
} else forcelj = 0.0;
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
rinv = sqrt(r2inv);
|
||||
r3inv = r2inv*rinv;
|
||||
r6inv = r3inv*r3inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]);
|
||||
} else forcelj = 0.0;
|
||||
|
||||
fpair = (forcecoul + factor_lj*forcelj) * r2inv;
|
||||
fpair = (forcecoul + factor_lj*forcelj) * r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq) {
|
||||
ecoul = prefactor*erfc;
|
||||
if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else ecoul = 0.0;
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r3inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
} else evdwl = 0.0;
|
||||
}
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq) {
|
||||
ecoul = prefactor*erfc;
|
||||
if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else ecoul = 0.0;
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r3inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
} else evdwl = 0.0;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally_full(i,evdwl,ecoul,fpair,delx,dely,delz);
|
||||
if (evflag) ev_tally_full(i,evdwl,ecoul,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
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
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
|
@ -38,23 +38,23 @@
|
|||
// External functions from cuda library for atom decomposition
|
||||
|
||||
int lj96_gpu_init(const int ntypes, double **cutsq, double **host_lj1,
|
||||
double **host_lj2, double **host_lj3, double **host_lj4,
|
||||
double **offset, double *special_lj, const int nlocal,
|
||||
const int nall, const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen);
|
||||
double **host_lj2, double **host_lj3, double **host_lj4,
|
||||
double **offset, double *special_lj, const int nlocal,
|
||||
const int nall, const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen);
|
||||
void lj96_gpu_clear();
|
||||
int ** lj96_gpu_compute_n(const int ago, const int inum, const int nall,
|
||||
double **host_x, int *host_type, double *sublo,
|
||||
double *subhi, int *tag, int **nspecial,
|
||||
int **special, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
int **ilist, int **jnum,
|
||||
const double cpu_time, bool &success);
|
||||
double **host_x, int *host_type, double *sublo,
|
||||
double *subhi, int *tag, int **nspecial,
|
||||
int **special, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
int **ilist, int **jnum,
|
||||
const double cpu_time, bool &success);
|
||||
void lj96_gpu_compute(const int ago, const int inum, const int nall,
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success);
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success);
|
||||
double lj96_gpu_bytes();
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
@ -64,7 +64,7 @@ using namespace LAMMPS_NS;
|
|||
PairLJClass2GPU::PairLJClass2GPU(LAMMPS *lmp) : PairLJClass2(lmp), gpu_mode(GPU_FORCE)
|
||||
{
|
||||
cpu_time = 0.0;
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -82,28 +82,28 @@ void PairLJClass2GPU::compute(int eflag, int vflag)
|
|||
{
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = vflag_fdotr = 0;
|
||||
|
||||
|
||||
int nall = atom->nlocal + atom->nghost;
|
||||
int inum, host_start;
|
||||
|
||||
|
||||
bool success = true;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
if (gpu_mode != GPU_FORCE) {
|
||||
inum = atom->nlocal;
|
||||
firstneigh = lj96_gpu_compute_n(neighbor->ago, inum, nall, atom->x,
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success);
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success);
|
||||
} else {
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
lj96_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type,
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success);
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success);
|
||||
}
|
||||
if (!success)
|
||||
error->one(FLERR,"Insufficient memory on accelerator");
|
||||
|
@ -121,7 +121,7 @@ void PairLJClass2GPU::compute(int eflag, int vflag)
|
|||
|
||||
void PairLJClass2GPU::init_style()
|
||||
{
|
||||
if (force->newton_pair)
|
||||
if (force->newton_pair)
|
||||
error->all(FLERR,"Cannot use newton pair with lj/class2/gpu pair style");
|
||||
|
||||
// Repeat cutsq calculation because done after call to init_style
|
||||
|
@ -145,9 +145,9 @@ void PairLJClass2GPU::init_style()
|
|||
if (atom->molecular)
|
||||
maxspecial=atom->maxspecial;
|
||||
int success = lj96_gpu_init(atom->ntypes+1, cutsq, lj1, lj2, lj3, lj4,
|
||||
offset, force->special_lj, atom->nlocal,
|
||||
atom->nlocal+atom->nghost, 300, maxspecial,
|
||||
cell_size, gpu_mode, screen);
|
||||
offset, force->special_lj, atom->nlocal,
|
||||
atom->nlocal+atom->nghost, 300, maxspecial,
|
||||
cell_size, gpu_mode, screen);
|
||||
GPU_EXTRA::check_flag(success,error,world);
|
||||
|
||||
if (gpu_mode == GPU_FORCE) {
|
||||
|
@ -168,7 +168,7 @@ double PairLJClass2GPU::memory_usage()
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJClass2GPU::cpu_compute(int start, int inum, int eflag, int vflag,
|
||||
int *ilist, int *numneigh, int **firstneigh)
|
||||
int *ilist, int *numneigh, int **firstneigh)
|
||||
{
|
||||
int i,j,ii,jj,jnum,itype,jtype;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair;
|
||||
|
@ -203,23 +203,23 @@ void PairLJClass2GPU::cpu_compute(int start, int inum, int eflag, int vflag,
|
|||
jtype = type[j];
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
r3inv = sqrt(r6inv);
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]);
|
||||
fpair = factor_lj*forcelj*r2inv;
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
r3inv = sqrt(r6inv);
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]);
|
||||
fpair = factor_lj*forcelj*r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
|
||||
if (eflag) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r3inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
}
|
||||
if (eflag) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r3inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally_full(i,evdwl,0.0,fpair,delx,dely,delz);
|
||||
if (evflag) ev_tally_full(i,evdwl,0.0,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
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
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
|
@ -38,28 +38,28 @@
|
|||
// External functions from cuda library for atom decomposition
|
||||
|
||||
int ljc_gpu_init(const int ntypes, double **cutsq, double **host_lj1,
|
||||
double **host_lj2, double **host_lj3, double **host_lj4,
|
||||
double **offset, double *special_lj, const int nlocal,
|
||||
double **host_lj2, double **host_lj3, double **host_lj4,
|
||||
double **offset, double *special_lj, const int nlocal,
|
||||
const int nall, const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen,
|
||||
double **host_cut_ljsq, double **host_cut_coulsq,
|
||||
double *host_special_coul, const double qqrd2e);
|
||||
void ljc_gpu_clear();
|
||||
int ** ljc_gpu_compute_n(const int ago, const int inum,
|
||||
const int nall, double **host_x, int *host_type,
|
||||
double *sublo, double *subhi, int *tag, int **nspecial,
|
||||
int **special, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
int **ilist, int **jnum, const double cpu_time,
|
||||
bool &success, double *host_q, double *boxlo,
|
||||
double *prd);
|
||||
const int nall, double **host_x, int *host_type,
|
||||
double *sublo, double *subhi, int *tag, int **nspecial,
|
||||
int **special, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
int **ilist, int **jnum, const double cpu_time,
|
||||
bool &success, double *host_q, double *boxlo,
|
||||
double *prd);
|
||||
void ljc_gpu_compute(const int ago, const int inum,
|
||||
const int nall, double **host_x, int *host_type,
|
||||
const int nall, double **host_x, int *host_type,
|
||||
int *ilist, int *numj, int **firstneigh,
|
||||
const bool eflag, const bool vflag, const bool eatom,
|
||||
const bool eflag, const bool vflag, const bool eatom,
|
||||
const bool vatom, int &host_start, const double cpu_time,
|
||||
bool &success, double *host_q, const int nlocal,
|
||||
double *boxlo, double *prd);
|
||||
double *boxlo, double *prd);
|
||||
double ljc_gpu_bytes();
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
@ -70,7 +70,7 @@ PairLJCutCoulCutGPU::PairLJCutCoulCutGPU(LAMMPS *lmp) : PairLJCutCoulCut(lmp), g
|
|||
{
|
||||
respa_enable = 0;
|
||||
cpu_time = 0.0;
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -88,30 +88,30 @@ void PairLJCutCoulCutGPU::compute(int eflag, int vflag)
|
|||
{
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = vflag_fdotr = 0;
|
||||
|
||||
|
||||
int nall = atom->nlocal + atom->nghost;
|
||||
int inum, host_start;
|
||||
|
||||
|
||||
bool success = true;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
if (gpu_mode != GPU_FORCE) {
|
||||
inum = atom->nlocal;
|
||||
firstneigh = ljc_gpu_compute_n(neighbor->ago, inum, nall, atom->x,
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success, atom->q, domain->boxlo,
|
||||
domain->prd);
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success, atom->q, domain->boxlo,
|
||||
domain->prd);
|
||||
} else {
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
ljc_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type,
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success, atom->q,
|
||||
atom->nlocal, domain->boxlo, domain->prd);
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success, atom->q,
|
||||
atom->nlocal, domain->boxlo, domain->prd);
|
||||
}
|
||||
if (!success)
|
||||
error->one(FLERR,"Insufficient memory on accelerator");
|
||||
|
@ -132,7 +132,7 @@ void PairLJCutCoulCutGPU::init_style()
|
|||
if (!atom->q_flag)
|
||||
error->all(FLERR,"Pair style lj/cut/coul/cut/gpu requires atom attribute q");
|
||||
|
||||
if (force->newton_pair)
|
||||
if (force->newton_pair)
|
||||
error->all(FLERR,"Cannot use newton pair with lj/cut/coul/cut/gpu pair style");
|
||||
|
||||
// Repeat cutsq calculation because done after call to init_style
|
||||
|
@ -156,10 +156,10 @@ void PairLJCutCoulCutGPU::init_style()
|
|||
if (atom->molecular)
|
||||
maxspecial=atom->maxspecial;
|
||||
int success = ljc_gpu_init(atom->ntypes+1, cutsq, lj1, lj2, lj3, lj4,
|
||||
offset, force->special_lj, atom->nlocal,
|
||||
atom->nlocal+atom->nghost, 300, maxspecial,
|
||||
cell_size, gpu_mode, screen, cut_ljsq, cut_coulsq,
|
||||
force->special_coul, force->qqrd2e);
|
||||
offset, force->special_lj, atom->nlocal,
|
||||
atom->nlocal+atom->nghost, 300, maxspecial,
|
||||
cell_size, gpu_mode, screen, cut_ljsq, cut_coulsq,
|
||||
force->special_coul, force->qqrd2e);
|
||||
GPU_EXTRA::check_flag(success,error,world);
|
||||
|
||||
if (gpu_mode == GPU_FORCE) {
|
||||
|
@ -180,8 +180,8 @@ double PairLJCutCoulCutGPU::memory_usage()
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJCutCoulCutGPU::cpu_compute(int start, int inum, int eflag, int vflag,
|
||||
int *ilist, int *numneigh,
|
||||
int **firstneigh)
|
||||
int *ilist, int *numneigh,
|
||||
int **firstneigh)
|
||||
{
|
||||
int i,j,ii,jj,jnum,itype,jtype;
|
||||
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair;
|
||||
|
@ -223,35 +223,35 @@ void PairLJCutCoulCutGPU::cpu_compute(int start, int inum, int eflag, int vflag,
|
|||
jtype = type[j];
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r2inv = 1.0/rsq;
|
||||
r2inv = 1.0/rsq;
|
||||
|
||||
if (rsq < cut_coulsq[itype][jtype])
|
||||
forcecoul = qqrd2e * qtmp*q[j]*sqrt(r2inv);
|
||||
else forcecoul = 0.0;
|
||||
if (rsq < cut_coulsq[itype][jtype])
|
||||
forcecoul = qqrd2e * qtmp*q[j]*sqrt(r2inv);
|
||||
else forcecoul = 0.0;
|
||||
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
} else forcelj = 0.0;
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
} else forcelj = 0.0;
|
||||
|
||||
fpair = (factor_coul*forcecoul + factor_lj*forcelj) * r2inv;
|
||||
fpair = (factor_coul*forcecoul + factor_lj*forcelj) * r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq[itype][jtype])
|
||||
ecoul = factor_coul * qqrd2e * qtmp*q[j]*sqrt(r2inv);
|
||||
else ecoul = 0.0;
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
} else evdwl = 0.0;
|
||||
}
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq[itype][jtype])
|
||||
ecoul = factor_coul * qqrd2e * qtmp*q[j]*sqrt(r2inv);
|
||||
else ecoul = 0.0;
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
} else evdwl = 0.0;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally_full(i,evdwl,ecoul,fpair,delx,dely,delz);
|
||||
if (evflag) ev_tally_full(i,evdwl,ecoul,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
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
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
|
@ -47,28 +47,28 @@
|
|||
// External functions from cuda library for atom decomposition
|
||||
|
||||
int ljcl_gpu_init(const int ntypes, double **cutsq, double **host_lj1,
|
||||
double **host_lj2, double **host_lj3, double **host_lj4,
|
||||
double **offset, double *special_lj, const int nlocal,
|
||||
const int nall, const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen,
|
||||
double **host_cut_ljsq, double host_cut_coulsq,
|
||||
double *host_special_coul, const double qqrd2e,
|
||||
const double g_ewald);
|
||||
double **host_lj2, double **host_lj3, double **host_lj4,
|
||||
double **offset, double *special_lj, const int nlocal,
|
||||
const int nall, const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen,
|
||||
double **host_cut_ljsq, double host_cut_coulsq,
|
||||
double *host_special_coul, const double qqrd2e,
|
||||
const double g_ewald);
|
||||
void ljcl_gpu_clear();
|
||||
int ** ljcl_gpu_compute_n(const int ago, const int inum,
|
||||
const int nall, double **host_x, int *host_type,
|
||||
double *sublo, double *subhi, int *tag,
|
||||
int **nspecial, int **special, const bool eflag,
|
||||
const bool vflag, const bool eatom, const bool vatom,
|
||||
int &host_start, int **ilist, int **jnum,
|
||||
const double cpu_time, bool &success, double *host_q,
|
||||
double *boxlo, double *prd);
|
||||
const int nall, double **host_x, int *host_type,
|
||||
double *sublo, double *subhi, int *tag,
|
||||
int **nspecial, int **special, const bool eflag,
|
||||
const bool vflag, const bool eatom, const bool vatom,
|
||||
int &host_start, int **ilist, int **jnum,
|
||||
const double cpu_time, bool &success, double *host_q,
|
||||
double *boxlo, double *prd);
|
||||
void ljcl_gpu_compute(const int ago, const int inum, const int nall,
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success, double *host_q,
|
||||
const int nlocal, double *boxlo, double *prd);
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success, double *host_q,
|
||||
const int nlocal, double *boxlo, double *prd);
|
||||
double ljcl_gpu_bytes();
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
@ -80,7 +80,7 @@ PairLJCutCoulLongGPU::PairLJCutCoulLongGPU(LAMMPS *lmp) :
|
|||
{
|
||||
respa_enable = 0;
|
||||
cpu_time = 0.0;
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -98,30 +98,30 @@ void PairLJCutCoulLongGPU::compute(int eflag, int vflag)
|
|||
{
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = vflag_fdotr = 0;
|
||||
|
||||
|
||||
int nall = atom->nlocal + atom->nghost;
|
||||
int inum, host_start;
|
||||
|
||||
|
||||
bool success = true;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
if (gpu_mode != GPU_FORCE) {
|
||||
inum = atom->nlocal;
|
||||
firstneigh = ljcl_gpu_compute_n(neighbor->ago, inum, nall, atom->x,
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success, atom->q, domain->boxlo,
|
||||
domain->prd);
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success, atom->q, domain->boxlo,
|
||||
domain->prd);
|
||||
} else {
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
ljcl_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type,
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success, atom->q,
|
||||
atom->nlocal, domain->boxlo, domain->prd);
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success, atom->q,
|
||||
atom->nlocal, domain->boxlo, domain->prd);
|
||||
}
|
||||
if (!success)
|
||||
error->one(FLERR,"Insufficient memory on accelerator");
|
||||
|
@ -143,7 +143,7 @@ void PairLJCutCoulLongGPU::init_style()
|
|||
|
||||
if (!atom->q_flag)
|
||||
error->all(FLERR,"Pair style lj/cut/coul/long/gpu requires atom attribute q");
|
||||
if (force->newton_pair)
|
||||
if (force->newton_pair)
|
||||
error->all(FLERR,"Cannot use newton pair with lj/cut/coul/long/gpu pair style");
|
||||
|
||||
// Repeat cutsq calculation because done after call to init_style
|
||||
|
@ -203,8 +203,8 @@ double PairLJCutCoulLongGPU::memory_usage()
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJCutCoulLongGPU::cpu_compute(int start, int inum, int eflag,
|
||||
int vflag, int *ilist, int *numneigh,
|
||||
int **firstneigh)
|
||||
int vflag, int *ilist, int *numneigh,
|
||||
int **firstneigh)
|
||||
{
|
||||
int i,j,ii,jj,jnum,itype,jtype,itable;
|
||||
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair;
|
||||
|
@ -249,64 +249,64 @@ void PairLJCutCoulLongGPU::cpu_compute(int start, int inum, int eflag,
|
|||
jtype = type[j];
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r2inv = 1.0/rsq;
|
||||
r2inv = 1.0/rsq;
|
||||
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq) {
|
||||
r = sqrt(rsq);
|
||||
grij = g_ewald * r;
|
||||
expm2 = exp(-grij*grij);
|
||||
t = 1.0 / (1.0 + EWALD_P*grij);
|
||||
erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2;
|
||||
prefactor = qqrd2e * qtmp*q[j]/r;
|
||||
forcecoul = prefactor * (erfc + EWALD_F*grij*expm2);
|
||||
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else {
|
||||
union_int_float_t rsq_lookup;
|
||||
rsq_lookup.f = rsq;
|
||||
itable = rsq_lookup.i & ncoulmask;
|
||||
itable >>= ncoulshiftbits;
|
||||
fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable];
|
||||
table = ftable[itable] + fraction*dftable[itable];
|
||||
forcecoul = qtmp*q[j] * table;
|
||||
if (factor_coul < 1.0) {
|
||||
table = ctable[itable] + fraction*dctable[itable];
|
||||
prefactor = qtmp*q[j] * table;
|
||||
forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
}
|
||||
}
|
||||
} else forcecoul = 0.0;
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq) {
|
||||
r = sqrt(rsq);
|
||||
grij = g_ewald * r;
|
||||
expm2 = exp(-grij*grij);
|
||||
t = 1.0 / (1.0 + EWALD_P*grij);
|
||||
erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2;
|
||||
prefactor = qqrd2e * qtmp*q[j]/r;
|
||||
forcecoul = prefactor * (erfc + EWALD_F*grij*expm2);
|
||||
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else {
|
||||
union_int_float_t rsq_lookup;
|
||||
rsq_lookup.f = rsq;
|
||||
itable = rsq_lookup.i & ncoulmask;
|
||||
itable >>= ncoulshiftbits;
|
||||
fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable];
|
||||
table = ftable[itable] + fraction*dftable[itable];
|
||||
forcecoul = qtmp*q[j] * table;
|
||||
if (factor_coul < 1.0) {
|
||||
table = ctable[itable] + fraction*dctable[itable];
|
||||
prefactor = qtmp*q[j] * table;
|
||||
forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
}
|
||||
}
|
||||
} else forcecoul = 0.0;
|
||||
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
} else forcelj = 0.0;
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
} else forcelj = 0.0;
|
||||
|
||||
fpair = (forcecoul + factor_lj*forcelj) * r2inv;
|
||||
fpair = (forcecoul + factor_lj*forcelj) * r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq)
|
||||
ecoul = prefactor*erfc;
|
||||
else {
|
||||
table = etable[itable] + fraction*detable[itable];
|
||||
ecoul = qtmp*q[j] * table;
|
||||
}
|
||||
if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else ecoul = 0.0;
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq)
|
||||
ecoul = prefactor*erfc;
|
||||
else {
|
||||
table = etable[itable] + fraction*detable[itable];
|
||||
ecoul = qtmp*q[j] * table;
|
||||
}
|
||||
if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else ecoul = 0.0;
|
||||
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
} else evdwl = 0.0;
|
||||
}
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
} else evdwl = 0.0;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally_full(i,evdwl,ecoul,fpair,delx,dely,delz);
|
||||
if (evflag) ev_tally_full(i,evdwl,ecoul,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
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
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
|
@ -38,23 +38,23 @@
|
|||
// External functions from cuda library for atom decomposition
|
||||
|
||||
int ljl_gpu_init(const int ntypes, double **cutsq, double **host_lj1,
|
||||
double **host_lj2, double **host_lj3, double **host_lj4,
|
||||
double **offset, double *special_lj, const int nlocal,
|
||||
const int nall, const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen);
|
||||
double **host_lj2, double **host_lj3, double **host_lj4,
|
||||
double **offset, double *special_lj, const int nlocal,
|
||||
const int nall, const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen);
|
||||
void ljl_gpu_clear();
|
||||
int ** ljl_gpu_compute_n(const int ago, const int inum,
|
||||
const int nall, double **host_x, int *host_type,
|
||||
double *sublo, double *subhi, int *tag, int **nspecial,
|
||||
int **special, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
int **ilist, int **jnum,
|
||||
const double cpu_time, bool &success);
|
||||
void ljl_gpu_compute(const int ago, const int inum, const int nall,
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success);
|
||||
const int nall, double **host_x, int *host_type,
|
||||
double *sublo, double *subhi, int *tag, int **nspecial,
|
||||
int **special, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
int **ilist, int **jnum,
|
||||
const double cpu_time, bool &success);
|
||||
void ljl_gpu_compute(const int ago, const int inum, const int nall,
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success);
|
||||
double ljl_gpu_bytes();
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
@ -65,7 +65,7 @@ PairLJCutGPU::PairLJCutGPU(LAMMPS *lmp) : PairLJCut(lmp), gpu_mode(GPU_FORCE)
|
|||
{
|
||||
respa_enable = 0;
|
||||
cpu_time = 0.0;
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -83,28 +83,28 @@ void PairLJCutGPU::compute(int eflag, int vflag)
|
|||
{
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = vflag_fdotr = 0;
|
||||
|
||||
|
||||
int nall = atom->nlocal + atom->nghost;
|
||||
int inum, host_start;
|
||||
|
||||
|
||||
bool success = true;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
if (gpu_mode != GPU_FORCE) {
|
||||
inum = atom->nlocal;
|
||||
firstneigh = ljl_gpu_compute_n(neighbor->ago, inum, nall,
|
||||
atom->x, atom->type, domain->sublo,
|
||||
domain->subhi, atom->tag, atom->nspecial,
|
||||
atom->special, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start,
|
||||
&ilist, &numneigh, cpu_time, success);
|
||||
atom->x, atom->type, domain->sublo,
|
||||
domain->subhi, atom->tag, atom->nspecial,
|
||||
atom->special, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start,
|
||||
&ilist, &numneigh, cpu_time, success);
|
||||
} else {
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
ljl_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type,
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success);
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success);
|
||||
}
|
||||
if (!success)
|
||||
error->one(FLERR,"Insufficient memory on accelerator");
|
||||
|
@ -124,7 +124,7 @@ void PairLJCutGPU::init_style()
|
|||
{
|
||||
cut_respa = NULL;
|
||||
|
||||
if (force->newton_pair)
|
||||
if (force->newton_pair)
|
||||
error->all(FLERR,"Cannot use newton pair with lj/cut/gpu pair style");
|
||||
|
||||
// Repeat cutsq calculation because done after call to init_style
|
||||
|
@ -148,9 +148,9 @@ void PairLJCutGPU::init_style()
|
|||
if (atom->molecular)
|
||||
maxspecial=atom->maxspecial;
|
||||
int success = ljl_gpu_init(atom->ntypes+1, cutsq, lj1, lj2, lj3, lj4,
|
||||
offset, force->special_lj, atom->nlocal,
|
||||
atom->nlocal+atom->nghost, 300, maxspecial,
|
||||
cell_size, gpu_mode, screen);
|
||||
offset, force->special_lj, atom->nlocal,
|
||||
atom->nlocal+atom->nghost, 300, maxspecial,
|
||||
cell_size, gpu_mode, screen);
|
||||
GPU_EXTRA::check_flag(success,error,world);
|
||||
|
||||
if (gpu_mode == GPU_FORCE) {
|
||||
|
@ -170,8 +170,8 @@ double PairLJCutGPU::memory_usage()
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJCutGPU::cpu_compute(int start, int inum, int eflag, int vflag,
|
||||
int *ilist, int *numneigh, int **firstneigh) {
|
||||
void PairLJCutGPU::cpu_compute(int start, int inum, int eflag, int vflag,
|
||||
int *ilist, int *numneigh, int **firstneigh) {
|
||||
int i,j,ii,jj,jnum,itype,jtype;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair;
|
||||
double rsq,r2inv,r6inv,forcelj,factor_lj;
|
||||
|
@ -205,22 +205,22 @@ void PairLJCutGPU::cpu_compute(int start, int inum, int eflag, int vflag,
|
|||
jtype = type[j];
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
fpair = factor_lj*forcelj*r2inv;
|
||||
r2inv = 1.0/rsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
fpair = factor_lj*forcelj*r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
|
||||
if (eflag) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
}
|
||||
if (eflag) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally_full(i,evdwl,0.0,fpair,delx,dely,delz);
|
||||
if (evflag) ev_tally_full(i,evdwl,0.0,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
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
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
|
@ -38,24 +38,24 @@
|
|||
// External functions from cuda library for atom decomposition
|
||||
|
||||
int lje_gpu_init(const int ntypes, double **cutsq, double **host_lj1,
|
||||
double **host_lj2, double **host_lj3, double **host_lj4,
|
||||
double **offset, double **shift, double *special_lj,
|
||||
const int nlocal, const int nall, const int max_nbors,
|
||||
const int maxspecial, const double cell_size, int &gpu_mode,
|
||||
FILE *screen);
|
||||
double **host_lj2, double **host_lj3, double **host_lj4,
|
||||
double **offset, double **shift, double *special_lj,
|
||||
const int nlocal, const int nall, const int max_nbors,
|
||||
const int maxspecial, const double cell_size, int &gpu_mode,
|
||||
FILE *screen);
|
||||
void lje_gpu_clear();
|
||||
int ** lje_gpu_compute_n(const int ago, const int inum, const int nall,
|
||||
double **host_x, int *host_type, double *sublo,
|
||||
double *subhi, int *tag, int **nspecial,
|
||||
int **special, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
int **ilist, int **jnum,
|
||||
const double cpu_time, bool &success);
|
||||
double **host_x, int *host_type, double *sublo,
|
||||
double *subhi, int *tag, int **nspecial,
|
||||
int **special, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
int **ilist, int **jnum,
|
||||
const double cpu_time, bool &success);
|
||||
void lje_gpu_compute(const int ago, const int inum, const int nall,
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success);
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success);
|
||||
double lje_gpu_bytes();
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
@ -66,7 +66,7 @@ PairLJExpandGPU::PairLJExpandGPU(LAMMPS *lmp) : PairLJExpand(lmp), gpu_mode(GPU_
|
|||
{
|
||||
respa_enable = 0;
|
||||
cpu_time = 0.0;
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -84,28 +84,28 @@ void PairLJExpandGPU::compute(int eflag, int vflag)
|
|||
{
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = vflag_fdotr = 0;
|
||||
|
||||
|
||||
int nall = atom->nlocal + atom->nghost;
|
||||
int inum, host_start;
|
||||
|
||||
|
||||
bool success = true;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
if (gpu_mode != GPU_FORCE) {
|
||||
inum = atom->nlocal;
|
||||
firstneigh = lje_gpu_compute_n(neighbor->ago, inum, nall, atom->x,
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success);
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success);
|
||||
} else {
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
lje_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type,
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success);
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success);
|
||||
}
|
||||
if (!success)
|
||||
error->one(FLERR,"Insufficient memory on accelerator");
|
||||
|
@ -123,7 +123,7 @@ void PairLJExpandGPU::compute(int eflag, int vflag)
|
|||
|
||||
void PairLJExpandGPU::init_style()
|
||||
{
|
||||
if (force->newton_pair)
|
||||
if (force->newton_pair)
|
||||
error->all(FLERR,"Cannot use newton pair with lj/expand/gpu pair style");
|
||||
|
||||
// Repeat cutsq calculation because done after call to init_style
|
||||
|
@ -147,9 +147,9 @@ void PairLJExpandGPU::init_style()
|
|||
if (atom->molecular)
|
||||
maxspecial=atom->maxspecial;
|
||||
int success = lje_gpu_init(atom->ntypes+1, cutsq, lj1, lj2, lj3, lj4,
|
||||
offset, shift, force->special_lj, atom->nlocal,
|
||||
atom->nlocal+atom->nghost, 300, maxspecial,
|
||||
cell_size, gpu_mode, screen);
|
||||
offset, shift, force->special_lj, atom->nlocal,
|
||||
atom->nlocal+atom->nghost, 300, maxspecial,
|
||||
cell_size, gpu_mode, screen);
|
||||
GPU_EXTRA::check_flag(success,error,world);
|
||||
|
||||
if (gpu_mode == GPU_FORCE) {
|
||||
|
@ -170,7 +170,7 @@ double PairLJExpandGPU::memory_usage()
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJExpandGPU::cpu_compute(int start, int inum, int eflag, int vflag,
|
||||
int *ilist, int *numneigh, int **firstneigh)
|
||||
int *ilist, int *numneigh, int **firstneigh)
|
||||
{
|
||||
int i,j,ii,jj,jnum,itype,jtype;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair;
|
||||
|
@ -206,25 +206,25 @@ void PairLJExpandGPU::cpu_compute(int start, int inum, int eflag, int vflag,
|
|||
jtype = type[j];
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r = sqrt(rsq);
|
||||
rshift = r - shift[itype][jtype];
|
||||
rshiftsq = rshift*rshift;
|
||||
r2inv = 1.0/rshiftsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
fpair = factor_lj*forcelj/rshift/r;
|
||||
r = sqrt(rsq);
|
||||
rshift = r - shift[itype][jtype];
|
||||
rshiftsq = rshift*rshift;
|
||||
r2inv = 1.0/rshiftsq;
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
fpair = factor_lj*forcelj/rshift/r;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
|
||||
if (eflag) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
}
|
||||
if (eflag) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally_full(i,evdwl,0.0,fpair,delx,dely,delz);
|
||||
if (evflag) ev_tally_full(i,evdwl,0.0,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
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.
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
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
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
|
@ -47,28 +47,28 @@
|
|||
// External functions from cuda library for atom decomposition
|
||||
|
||||
int cmml_gpu_init(const int ntypes, double **cutsq, int **lj_type,
|
||||
double **host_lj1, double **host_lj2, double **host_lj3,
|
||||
double **host_lj4, double **offset, double *special_lj,
|
||||
const int nlocal, const int nall, const int max_nbors,
|
||||
const int maxspecial, const double cell_size, int &gpu_mode,
|
||||
FILE *screen, double **host_cut_ljsq, double host_cut_coulsq,
|
||||
double *host_special_coul, const double qqrd2e,
|
||||
const double g_ewald);
|
||||
double **host_lj1, double **host_lj2, double **host_lj3,
|
||||
double **host_lj4, double **offset, double *special_lj,
|
||||
const int nlocal, const int nall, const int max_nbors,
|
||||
const int maxspecial, const double cell_size, int &gpu_mode,
|
||||
FILE *screen, double **host_cut_ljsq, double host_cut_coulsq,
|
||||
double *host_special_coul, const double qqrd2e,
|
||||
const double g_ewald);
|
||||
void cmml_gpu_clear();
|
||||
int ** cmml_gpu_compute_n(const int ago, const int inum, const int nall,
|
||||
double **host_x, int *host_type, double *sublo,
|
||||
double *subhi, int *tag, int **nspecial,
|
||||
int **special, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
int **ilist, int **jnum, const double cpu_time,
|
||||
bool &success, double *host_q, double *boxlo,
|
||||
double *prd);
|
||||
double **host_x, int *host_type, double *sublo,
|
||||
double *subhi, int *tag, int **nspecial,
|
||||
int **special, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
int **ilist, int **jnum, const double cpu_time,
|
||||
bool &success, double *host_q, double *boxlo,
|
||||
double *prd);
|
||||
void cmml_gpu_compute(const int ago, const int inum, const int nall,
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success, double *host_q,
|
||||
const int nlocal, double *boxlo, double *prd);
|
||||
double **host_x, int *host_type, int *ilist, int *numj,
|
||||
int **firstneigh, const bool eflag, const bool vflag,
|
||||
const bool eatom, const bool vatom, int &host_start,
|
||||
const double cpu_time, bool &success, double *host_q,
|
||||
const int nlocal, double *boxlo, double *prd);
|
||||
double cmml_gpu_bytes();
|
||||
|
||||
#include "lj_sdk_common.h"
|
||||
|
@ -83,7 +83,7 @@ PairLJSDKCoulLongGPU::PairLJSDKCoulLongGPU(LAMMPS *lmp) :
|
|||
{
|
||||
respa_enable = 0;
|
||||
cpu_time = 0.0;
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -101,30 +101,30 @@ void PairLJSDKCoulLongGPU::compute(int eflag, int vflag)
|
|||
{
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = vflag_fdotr = 0;
|
||||
|
||||
|
||||
int nall = atom->nlocal + atom->nghost;
|
||||
int inum, host_start;
|
||||
|
||||
|
||||
bool success = true;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
if (gpu_mode != GPU_FORCE) {
|
||||
inum = atom->nlocal;
|
||||
firstneigh = cmml_gpu_compute_n(neighbor->ago, inum, nall, atom->x,
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success, atom->q, domain->boxlo,
|
||||
domain->prd);
|
||||
atom->type, domain->sublo, domain->subhi,
|
||||
atom->tag, atom->nspecial, atom->special,
|
||||
eflag, vflag, eflag_atom, vflag_atom,
|
||||
host_start, &ilist, &numneigh, cpu_time,
|
||||
success, atom->q, domain->boxlo,
|
||||
domain->prd);
|
||||
} else {
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
cmml_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type,
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success, atom->q,
|
||||
atom->nlocal, domain->boxlo, domain->prd);
|
||||
ilist, numneigh, firstneigh, eflag, vflag, eflag_atom,
|
||||
vflag_atom, host_start, cpu_time, success, atom->q,
|
||||
atom->nlocal, domain->boxlo, domain->prd);
|
||||
}
|
||||
if (!success)
|
||||
error->one(FLERR,"Insufficient memory on accelerator");
|
||||
|
@ -147,7 +147,7 @@ void PairLJSDKCoulLongGPU::init_style()
|
|||
{
|
||||
if (!atom->q_flag)
|
||||
error->all(FLERR,"Pair style lj/sdk/coul/long/gpu requires atom attribute q");
|
||||
if (force->newton_pair)
|
||||
if (force->newton_pair)
|
||||
error->all(FLERR,"Cannot use newton pair with lj/sdk/coul/long/gpu pair style");
|
||||
|
||||
// Repeat cutsq calculation because done after call to init_style
|
||||
|
@ -183,11 +183,11 @@ void PairLJSDKCoulLongGPU::init_style()
|
|||
if (atom->molecular)
|
||||
maxspecial=atom->maxspecial;
|
||||
int success = cmml_gpu_init(atom->ntypes+1, cutsq, lj_type, lj1, lj2, lj3,
|
||||
lj4, offset, force->special_lj, atom->nlocal,
|
||||
atom->nlocal+atom->nghost, 300, maxspecial,
|
||||
cell_size, gpu_mode, screen, cut_ljsq,
|
||||
cut_coulsq, force->special_coul,
|
||||
force->qqrd2e, g_ewald);
|
||||
lj4, offset, force->special_lj, atom->nlocal,
|
||||
atom->nlocal+atom->nghost, 300, maxspecial,
|
||||
cell_size, gpu_mode, screen, cut_ljsq,
|
||||
cut_coulsq, force->special_coul,
|
||||
force->qqrd2e, g_ewald);
|
||||
GPU_EXTRA::check_flag(success,error,world);
|
||||
|
||||
if (gpu_mode == GPU_FORCE) {
|
||||
|
@ -208,7 +208,7 @@ double PairLJSDKCoulLongGPU::memory_usage()
|
|||
/* ---------------------------------------------------------------------- */
|
||||
template <int EVFLAG, int EFLAG>
|
||||
void PairLJSDKCoulLongGPU::cpu_compute(int start, int inum, int *ilist,
|
||||
int *numneigh, int **firstneigh)
|
||||
int *numneigh, int **firstneigh)
|
||||
{
|
||||
int i,j,ii,jj;
|
||||
double qtmp,xtmp,ytmp,ztmp;
|
||||
|
@ -255,11 +255,11 @@ void PairLJSDKCoulLongGPU::cpu_compute(int start, int inum, int *ilist,
|
|||
double fpair = 0.0;
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r2inv = 1.0/rsq;
|
||||
const int ljt = lj_type[itype][jtype];
|
||||
r2inv = 1.0/rsq;
|
||||
const int ljt = lj_type[itype][jtype];
|
||||
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq) {
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq) {
|
||||
const double r = sqrt(rsq);
|
||||
const double grij = g_ewald * r;
|
||||
const double expm2 = exp(-grij*grij);
|
||||
|
@ -272,7 +272,7 @@ void PairLJSDKCoulLongGPU::cpu_compute(int start, int inum, int *ilist,
|
|||
forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
if (EFLAG) ecoul -= (1.0-factor_coul)*prefactor;
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
union_int_float_t rsq_lookup;
|
||||
rsq_lookup.f = rsq;
|
||||
int itable = rsq_lookup.i & ncoulmask;
|
||||
|
@ -291,56 +291,56 @@ void PairLJSDKCoulLongGPU::cpu_compute(int start, int inum, int *ilist,
|
|||
forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
if (EFLAG) ecoul -= (1.0-factor_coul)*prefactor;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
forcecoul = 0.0;
|
||||
ecoul = 0.0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
forcecoul = 0.0;
|
||||
ecoul = 0.0;
|
||||
}
|
||||
|
||||
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
|
||||
if (ljt == LJ12_4) {
|
||||
const double r4inv=r2inv*r2inv;
|
||||
forcelj = r4inv*(lj1[itype][jtype]*r4inv*r4inv
|
||||
- lj2[itype][jtype]);
|
||||
if (ljt == LJ12_4) {
|
||||
const double r4inv=r2inv*r2inv;
|
||||
forcelj = r4inv*(lj1[itype][jtype]*r4inv*r4inv
|
||||
- lj2[itype][jtype]);
|
||||
|
||||
if (EFLAG)
|
||||
evdwl = r4inv*(lj3[itype][jtype]*r4inv*r4inv
|
||||
- lj4[itype][jtype]) - offset[itype][jtype];
|
||||
|
||||
} else if (ljt == LJ9_6) {
|
||||
const double r3inv = r2inv*sqrt(r2inv);
|
||||
const double r6inv = r3inv*r3inv;
|
||||
forcelj = r6inv*(lj1[itype][jtype]*r3inv
|
||||
- lj2[itype][jtype]);
|
||||
if (EFLAG)
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r3inv
|
||||
- lj4[itype][jtype]) - offset[itype][jtype];
|
||||
if (EFLAG)
|
||||
evdwl = r4inv*(lj3[itype][jtype]*r4inv*r4inv
|
||||
- lj4[itype][jtype]) - offset[itype][jtype];
|
||||
|
||||
} else if (ljt == LJ12_6) {
|
||||
const double r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv*(lj1[itype][jtype]*r6inv
|
||||
- lj2[itype][jtype]);
|
||||
if (EFLAG)
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv
|
||||
- lj4[itype][jtype]) - offset[itype][jtype];
|
||||
}
|
||||
} else if (ljt == LJ9_6) {
|
||||
const double r3inv = r2inv*sqrt(r2inv);
|
||||
const double r6inv = r3inv*r3inv;
|
||||
forcelj = r6inv*(lj1[itype][jtype]*r3inv
|
||||
- lj2[itype][jtype]);
|
||||
if (EFLAG)
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r3inv
|
||||
- lj4[itype][jtype]) - offset[itype][jtype];
|
||||
|
||||
if (EFLAG) evdwl *= factor_lj;
|
||||
} else if (ljt == LJ12_6) {
|
||||
const double r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv*(lj1[itype][jtype]*r6inv
|
||||
- lj2[itype][jtype]);
|
||||
if (EFLAG)
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv
|
||||
- lj4[itype][jtype]) - offset[itype][jtype];
|
||||
}
|
||||
|
||||
} else {
|
||||
forcelj=0.0;
|
||||
evdwl = 0.0;
|
||||
}
|
||||
if (EFLAG) evdwl *= factor_lj;
|
||||
|
||||
fpair = (forcecoul + factor_lj*forcelj) * r2inv;
|
||||
} else {
|
||||
forcelj=0.0;
|
||||
evdwl = 0.0;
|
||||
}
|
||||
|
||||
fxtmp += delx*fpair;
|
||||
fytmp += dely*fpair;
|
||||
fztmp += delz*fpair;
|
||||
fpair = (forcecoul + factor_lj*forcelj) * r2inv;
|
||||
|
||||
if (EVFLAG) ev_tally_full(i,evdwl,ecoul,fpair,delx,dely,delz);
|
||||
fxtmp += delx*fpair;
|
||||
fytmp += dely*fpair;
|
||||
fztmp += delz*fpair;
|
||||
|
||||
if (EVFLAG) ev_tally_full(i,evdwl,ecoul,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
f[i][0] += fxtmp;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue