reformat with clang-format and related changes
This commit is contained in:
@ -19,64 +19,45 @@
|
|||||||
|
|
||||||
#include "fix_brownian.h"
|
#include "fix_brownian.h"
|
||||||
|
|
||||||
#include <cmath>
|
|
||||||
#include <cstring>
|
|
||||||
#include "math_extra.h"
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "force.h"
|
|
||||||
#include "update.h"
|
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
#include "domain.h"
|
#include "domain.h"
|
||||||
#include "random_mars.h"
|
|
||||||
#include "memory.h"
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "force.h"
|
||||||
|
#include "math_extra.h"
|
||||||
|
#include "memory.h"
|
||||||
|
#include "random_mars.h"
|
||||||
|
#include "update.h"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
using namespace FixConst;
|
using namespace FixConst;
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
FixBrownian::FixBrownian(LAMMPS *lmp, int narg, char **arg) :
|
FixBrownian::FixBrownian(LAMMPS *lmp, int narg, char **arg) : FixBrownianBase(lmp, narg, arg)
|
||||||
FixBrownianBase(lmp, narg, arg)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (dipole_flag || gamma_t_eigen_flag || gamma_r_eigen_flag || gamma_r_flag) {
|
if (dipole_flag || gamma_t_eigen_flag || gamma_r_eigen_flag || gamma_r_flag) {
|
||||||
error->all(FLERR, "Illegal fix brownian command.");
|
error->all(FLERR, "Illegal fix brownian command.");
|
||||||
}
|
}
|
||||||
|
if (!gamma_t_flag) { error->all(FLERR, "Illegal fix brownian command."); }
|
||||||
if (!gamma_t_flag) {
|
|
||||||
error->all(FLERR,"Illegal fix brownian command.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
FixBrownian::~FixBrownian()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixBrownian::init()
|
void FixBrownian::init()
|
||||||
{
|
{
|
||||||
|
|
||||||
FixBrownianBase::init();
|
FixBrownianBase::init();
|
||||||
|
|
||||||
g1 /= gamma_t;
|
g1 /= gamma_t;
|
||||||
g2 *= sqrt(gamma_t);
|
g2 *= sqrt(gamma_t);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixBrownian::initial_integrate(int /*vflag */)
|
void FixBrownian::initial_integrate(int /*vflag */)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (domain->dimension == 2) {
|
if (domain->dimension == 2) {
|
||||||
if (!noise_flag) {
|
if (!noise_flag) {
|
||||||
initial_integrate_templated<0, 0, 1>();
|
initial_integrate_templated<0, 0, 1>();
|
||||||
@ -99,8 +80,7 @@ void FixBrownian::initial_integrate(int /*vflag */)
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
template < int Tp_UNIFORM, int Tp_GAUSS, int Tp_2D >
|
template <int Tp_UNIFORM, int Tp_GAUSS, int Tp_2D> void FixBrownian::initial_integrate_templated()
|
||||||
void FixBrownian::initial_integrate_templated()
|
|
||||||
{
|
{
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
double **v = atom->v;
|
double **v = atom->v;
|
||||||
@ -114,29 +94,27 @@ void FixBrownian::initial_integrate_templated()
|
|||||||
|
|
||||||
for (int i = 0; i < nlocal; i++) {
|
for (int i = 0; i < nlocal; i++) {
|
||||||
if (mask[i] & groupbit) {
|
if (mask[i] & groupbit) {
|
||||||
|
|
||||||
if (Tp_2D) {
|
if (Tp_2D) {
|
||||||
dz = 0;
|
dz = 0;
|
||||||
if (Tp_UNIFORM) {
|
if (Tp_UNIFORM) {
|
||||||
dx = dt * (g1 * f[i][0] + g2 * (random->uniform()-0.5));
|
dx = dt * (g1 * f[i][0] + g2 * (rng->uniform() - 0.5));
|
||||||
dy = dt * (g1 * f[i][1] + g2 * (random->uniform()-0.5));
|
dy = dt * (g1 * f[i][1] + g2 * (rng->uniform() - 0.5));
|
||||||
|
|
||||||
} else if (Tp_GAUSS) {
|
} else if (Tp_GAUSS) {
|
||||||
dx = dt * (g1 * f[i][0] + g2 * random->gaussian());
|
dx = dt * (g1 * f[i][0] + g2 * rng->gaussian());
|
||||||
dy = dt * (g1 * f[i][1] + g2 * random->gaussian());
|
dy = dt * (g1 * f[i][1] + g2 * rng->gaussian());
|
||||||
} else {
|
} else {
|
||||||
dx = dt * g1 * f[i][0];
|
dx = dt * g1 * f[i][0];
|
||||||
dy = dt * g1 * f[i][1];
|
dy = dt * g1 * f[i][1];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Tp_UNIFORM) {
|
if (Tp_UNIFORM) {
|
||||||
dx = dt * (g1 * f[i][0] + g2 * (random->uniform()-0.5));
|
dx = dt * (g1 * f[i][0] + g2 * (rng->uniform() - 0.5));
|
||||||
dy = dt * (g1 * f[i][1] + g2 * (random->uniform()-0.5));
|
dy = dt * (g1 * f[i][1] + g2 * (rng->uniform() - 0.5));
|
||||||
dz = dt * (g1 * f[i][2] + g2 * (random->uniform()-0.5));
|
dz = dt * (g1 * f[i][2] + g2 * (rng->uniform() - 0.5));
|
||||||
} else if (Tp_GAUSS) {
|
} else if (Tp_GAUSS) {
|
||||||
dx = dt * (g1 * f[i][0] + g2 * random->gaussian());
|
dx = dt * (g1 * f[i][0] + g2 * rng->gaussian());
|
||||||
dy = dt * (g1 * f[i][1] + g2 * random->gaussian());
|
dy = dt * (g1 * f[i][1] + g2 * rng->gaussian());
|
||||||
dz = dt * (g1 * f[i][2] + g2 * random->gaussian());
|
dz = dt * (g1 * f[i][2] + g2 * rng->gaussian());
|
||||||
} else {
|
} else {
|
||||||
dx = dt * g1 * f[i][0];
|
dx = dt * g1 * f[i][0];
|
||||||
dy = dt * g1 * f[i][1];
|
dy = dt * g1 * f[i][1];
|
||||||
@ -147,15 +125,11 @@ void FixBrownian::initial_integrate_templated()
|
|||||||
x[i][0] += dx;
|
x[i][0] += dx;
|
||||||
v[i][0] = dx / dt;
|
v[i][0] = dx / dt;
|
||||||
|
|
||||||
|
|
||||||
x[i][1] += dy;
|
x[i][1] += dy;
|
||||||
v[i][1] = dy / dt;
|
v[i][1] = dy / dt;
|
||||||
|
|
||||||
|
|
||||||
x[i][2] += dz;
|
x[i][2] += dz;
|
||||||
v[i][2] = dz / dt;
|
v[i][2] = dz / dt;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -12,9 +12,9 @@
|
|||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#ifdef FIX_CLASS
|
#ifdef FIX_CLASS
|
||||||
|
// clang-format off
|
||||||
FixStyle(brownian,FixBrownian)
|
FixStyle(brownian,FixBrownian);
|
||||||
|
// clang-format on
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifndef LMP_FIX_BROWNIAN_H
|
#ifndef LMP_FIX_BROWNIAN_H
|
||||||
@ -27,18 +27,16 @@ namespace LAMMPS_NS {
|
|||||||
class FixBrownian : public FixBrownianBase {
|
class FixBrownian : public FixBrownianBase {
|
||||||
public:
|
public:
|
||||||
FixBrownian(class LAMMPS *, int, char **);
|
FixBrownian(class LAMMPS *, int, char **);
|
||||||
virtual ~FixBrownian();
|
virtual ~FixBrownian() {};
|
||||||
void init();
|
void init();
|
||||||
void initial_integrate(int);
|
void initial_integrate(int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <int Tp_UNIFORM, int Tp_GAUSS, int Tp_2D>
|
template <int Tp_UNIFORM, int Tp_GAUSS, int Tp_2D>
|
||||||
void initial_integrate_templated();
|
void initial_integrate_templated();
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace LAMMPS_NS
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -19,65 +19,44 @@
|
|||||||
|
|
||||||
#include "fix_brownian_asphere.h"
|
#include "fix_brownian_asphere.h"
|
||||||
|
|
||||||
#include <cmath>
|
|
||||||
#include <cstring>
|
|
||||||
#include "math_extra.h"
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "atom_vec_ellipsoid.h"
|
#include "atom_vec_ellipsoid.h"
|
||||||
#include "force.h"
|
|
||||||
#include "update.h"
|
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
#include "domain.h"
|
#include "domain.h"
|
||||||
#include "random_mars.h"
|
|
||||||
#include "memory.h"
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "force.h"
|
||||||
|
#include "math_extra.h"
|
||||||
|
#include "memory.h"
|
||||||
|
#include "random_mars.h"
|
||||||
|
#include "update.h"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
using namespace FixConst;
|
using namespace FixConst;
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
FixBrownianAsphere::FixBrownianAsphere(LAMMPS *lmp, int narg, char **arg) :
|
FixBrownianAsphere::FixBrownianAsphere(LAMMPS *lmp, int narg, char **arg) :
|
||||||
FixBrownianBase(lmp, narg, arg)
|
FixBrownianBase(lmp, narg, arg)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if (!gamma_t_eigen_flag || !gamma_r_eigen_flag) {
|
if (!gamma_t_eigen_flag || !gamma_r_eigen_flag) {
|
||||||
error->all(FLERR, "Illegal fix brownian command.");
|
error->all(FLERR, "Illegal fix brownian command.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gamma_t_flag || gamma_r_flag) {
|
if (gamma_t_flag || gamma_r_flag) error->all(FLERR, "Illegal fix brownian command.");
|
||||||
error->all(FLERR,"Illegal fix brownian command.");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (dipole_flag && !atom->mu_flag)
|
if (dipole_flag && !atom->mu_flag)
|
||||||
error->all(FLERR, "Fix brownian/asphere dipole requires atom attribute mu");
|
error->all(FLERR, "Fix brownian/asphere dipole requires atom attribute mu");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
FixBrownianAsphere::~FixBrownianAsphere()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixBrownianAsphere::init()
|
void FixBrownianAsphere::init()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid");
|
avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid");
|
||||||
if (!avec)
|
if (!avec) error->all(FLERR, "Compute brownian/asphere requires atom style ellipsoid");
|
||||||
error->all(FLERR,"Compute brownian/asphere requires "
|
|
||||||
"atom style ellipsoid");
|
|
||||||
|
|
||||||
// check that all particles are finite-size ellipsoids
|
// check that all particles are finite-size ellipsoids
|
||||||
// no point particles allowed, spherical is OK
|
// no point particles allowed, spherical is OK
|
||||||
@ -88,9 +67,7 @@ void FixBrownianAsphere::init()
|
|||||||
|
|
||||||
for (int i = 0; i < nlocal; i++)
|
for (int i = 0; i < nlocal; i++)
|
||||||
if (mask[i] & groupbit)
|
if (mask[i] & groupbit)
|
||||||
if (ellipsoid[i] < 0)
|
if (ellipsoid[i] < 0) error->one(FLERR, "Fix brownian/asphere requires extended particles");
|
||||||
error->one(FLERR,"Fix brownian/asphere requires extended particles");
|
|
||||||
|
|
||||||
|
|
||||||
if (dipole_flag) {
|
if (dipole_flag) {
|
||||||
|
|
||||||
@ -100,7 +77,6 @@ void FixBrownianAsphere::init()
|
|||||||
AtomVecEllipsoid::Bonus *bonus = avec->bonus;
|
AtomVecEllipsoid::Bonus *bonus = avec->bonus;
|
||||||
|
|
||||||
double Q[3][3];
|
double Q[3][3];
|
||||||
|
|
||||||
double **mu = atom->mu;
|
double **mu = atom->mu;
|
||||||
|
|
||||||
for (int i = 0; i < nlocal; i++) {
|
for (int i = 0; i < nlocal; i++) {
|
||||||
@ -112,21 +88,17 @@ void FixBrownianAsphere::init()
|
|||||||
mu[i][0] = f_rot[0];
|
mu[i][0] = f_rot[0];
|
||||||
mu[i][1] = f_rot[1];
|
mu[i][1] = f_rot[1];
|
||||||
mu[i][2] = f_rot[2];
|
mu[i][2] = f_rot[2];
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FixBrownianBase::init();
|
FixBrownianBase::init();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixBrownianAsphere::initial_integrate(int /*vflag */)
|
void FixBrownianAsphere::initial_integrate(int /*vflag */)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (domain->dimension == 2) {
|
if (domain->dimension == 2) {
|
||||||
if (dipole_flag) {
|
if (dipole_flag) {
|
||||||
if (!noise_flag) {
|
if (!noise_flag) {
|
||||||
@ -180,24 +152,17 @@ void FixBrownianAsphere::initial_integrate_templated()
|
|||||||
|
|
||||||
AtomVecEllipsoid::Bonus *bonus = avec->bonus;
|
AtomVecEllipsoid::Bonus *bonus = avec->bonus;
|
||||||
|
|
||||||
|
|
||||||
double **mu = atom->mu;
|
double **mu = atom->mu;
|
||||||
double **torque = atom->torque;
|
double **torque = atom->torque;
|
||||||
|
|
||||||
double qw[4];
|
double qw[4];
|
||||||
|
|
||||||
double *quat;
|
double *quat;
|
||||||
int *ellipsoid = atom->ellipsoid;
|
int *ellipsoid = atom->ellipsoid;
|
||||||
|
|
||||||
if (igroup == atom->firstgroup) nlocal = atom->nfirst;
|
if (igroup == atom->firstgroup) nlocal = atom->nfirst;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// project dipole along x axis of quat
|
// project dipole along x axis of quat
|
||||||
double f_rot[3];
|
double f_rot[3];
|
||||||
|
|
||||||
double rotationmatrix_transpose[3][3];
|
double rotationmatrix_transpose[3][3];
|
||||||
|
|
||||||
double tmp[3];
|
double tmp[3];
|
||||||
double dv[3];
|
double dv[3];
|
||||||
|
|
||||||
@ -207,7 +172,6 @@ void FixBrownianAsphere::initial_integrate_templated()
|
|||||||
// update orientation first
|
// update orientation first
|
||||||
|
|
||||||
quat = bonus[ellipsoid[i]].quat;
|
quat = bonus[ellipsoid[i]].quat;
|
||||||
|
|
||||||
MathExtra::quat_to_mat_trans(quat, rotationmatrix_transpose);
|
MathExtra::quat_to_mat_trans(quat, rotationmatrix_transpose);
|
||||||
|
|
||||||
// tmp holds angular velocity in body frame
|
// tmp holds angular velocity in body frame
|
||||||
@ -216,33 +180,25 @@ void FixBrownianAsphere::initial_integrate_templated()
|
|||||||
if (Tp_2D) {
|
if (Tp_2D) {
|
||||||
tmp[0] = tmp[1] = 0.0;
|
tmp[0] = tmp[1] = 0.0;
|
||||||
if (Tp_UNIFORM) {
|
if (Tp_UNIFORM) {
|
||||||
tmp[2] = g1*tmp[2]*gamma_r_inv[2] + gamma_r_invsqrt[2]*(random->uniform()-0.5)*g2;
|
tmp[2] = g1 * tmp[2] * gamma_r_inv[2] + gamma_r_invsqrt[2] * (rng->uniform() - 0.5) * g2;
|
||||||
|
|
||||||
} else if (Tp_GAUSS) {
|
} else if (Tp_GAUSS) {
|
||||||
tmp[2] = g1*tmp[2]*gamma_r_inv[2] + gamma_r_invsqrt[2]*random->gaussian()*g2;
|
tmp[2] = g1 * tmp[2] * gamma_r_inv[2] + gamma_r_invsqrt[2] * rng->gaussian() * g2;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
tmp[2] = g1 * tmp[2] * gamma_r_inv[2];
|
tmp[2] = g1 * tmp[2] * gamma_r_inv[2];
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Tp_UNIFORM) {
|
if (Tp_UNIFORM) {
|
||||||
|
tmp[0] = g1 * tmp[0] * gamma_r_inv[0] + gamma_r_invsqrt[0] * (rng->uniform() - 0.5) * g2;
|
||||||
tmp[0] = g1*tmp[0]*gamma_r_inv[0] + gamma_r_invsqrt[0]*(random->uniform()-0.5)*g2;
|
tmp[1] = g1 * tmp[1] * gamma_r_inv[1] + gamma_r_invsqrt[1] * (rng->uniform() - 0.5) * g2;
|
||||||
tmp[1] = g1*tmp[1]*gamma_r_inv[1] + gamma_r_invsqrt[1]*(random->uniform()-0.5)*g2;
|
tmp[2] = g1 * tmp[2] * gamma_r_inv[2] + gamma_r_invsqrt[2] * (rng->uniform() - 0.5) * g2;
|
||||||
tmp[2] = g1*tmp[2]*gamma_r_inv[2] + gamma_r_invsqrt[2]*(random->uniform()-0.5)*g2;
|
|
||||||
|
|
||||||
} else if (Tp_GAUSS) {
|
} else if (Tp_GAUSS) {
|
||||||
|
tmp[0] = g1 * tmp[0] * gamma_r_inv[0] + gamma_r_invsqrt[0] * rng->gaussian() * g2;
|
||||||
tmp[0] = g1*tmp[0]*gamma_r_inv[0] + gamma_r_invsqrt[0]*random->gaussian()*g2;
|
tmp[1] = g1 * tmp[1] * gamma_r_inv[1] + gamma_r_invsqrt[1] * rng->gaussian() * g2;
|
||||||
tmp[1] = g1*tmp[1]*gamma_r_inv[1] + gamma_r_invsqrt[1]*random->gaussian()*g2;
|
tmp[2] = g1 * tmp[2] * gamma_r_inv[2] + gamma_r_invsqrt[2] * rng->gaussian() * g2;
|
||||||
tmp[2] = g1*tmp[2]*gamma_r_inv[2] + gamma_r_invsqrt[2]*random->gaussian()*g2;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
tmp[0] = g1 * tmp[0] * gamma_r_inv[0];
|
tmp[0] = g1 * tmp[0] * gamma_r_inv[0];
|
||||||
tmp[1] = g1 * tmp[1] * gamma_r_inv[1];
|
tmp[1] = g1 * tmp[1] * gamma_r_inv[1];
|
||||||
tmp[2] = g1 * tmp[2] * gamma_r_inv[2];
|
tmp[2] = g1 * tmp[2] * gamma_r_inv[2];
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,74 +222,34 @@ void FixBrownianAsphere::initial_integrate_templated()
|
|||||||
if (Tp_2D) {
|
if (Tp_2D) {
|
||||||
tmp[2] = 0.0;
|
tmp[2] = 0.0;
|
||||||
if (Tp_UNIFORM) {
|
if (Tp_UNIFORM) {
|
||||||
tmp[0] = g1*tmp[0]*gamma_t_inv[0]
|
tmp[0] = g1 * tmp[0] * gamma_t_inv[0] + gamma_t_invsqrt[0] * (rng->uniform() - 0.5) * g2;
|
||||||
+ gamma_t_invsqrt[0]*(random->uniform()-0.5)*g2;
|
tmp[1] = g1 * tmp[1] * gamma_t_inv[1] + gamma_t_invsqrt[1] * (rng->uniform() - 0.5) * g2;
|
||||||
tmp[1] = g1*tmp[1]*gamma_t_inv[1]
|
|
||||||
+ gamma_t_invsqrt[1]*(random->uniform()-0.5)*g2;
|
|
||||||
|
|
||||||
} else if (Tp_GAUSS) {
|
} else if (Tp_GAUSS) {
|
||||||
tmp[0] = g1*tmp[0]*gamma_t_inv[0]
|
tmp[0] = g1 * tmp[0] * gamma_t_inv[0] + gamma_t_invsqrt[0] * rng->gaussian() * g2;
|
||||||
+ gamma_t_invsqrt[0]*random->gaussian()*g2;
|
tmp[1] = g1 * tmp[1] * gamma_t_inv[1] + gamma_t_invsqrt[1] * rng->gaussian() * g2;
|
||||||
tmp[1] = g1*tmp[1]*gamma_t_inv[1]
|
|
||||||
+ gamma_t_invsqrt[1]*random->gaussian()*g2;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
tmp[0] = g1 * tmp[0] * gamma_t_inv[0];
|
tmp[0] = g1 * tmp[0] * gamma_t_inv[0];
|
||||||
tmp[1] = g1 * tmp[1] * gamma_t_inv[1];
|
tmp[1] = g1 * tmp[1] * gamma_t_inv[1];
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Tp_UNIFORM) {
|
if (Tp_UNIFORM) {
|
||||||
|
tmp[0] = g1 * tmp[0] * gamma_t_inv[0] + gamma_t_invsqrt[0] * (rng->uniform() - 0.5) * g2;
|
||||||
tmp[0] = g1*tmp[0]*gamma_t_inv[0]
|
tmp[1] = g1 * tmp[1] * gamma_t_inv[1] + gamma_t_invsqrt[1] * (rng->uniform() - 0.5) * g2;
|
||||||
+ gamma_t_invsqrt[0]*(random->uniform()-0.5)*g2;
|
tmp[2] = g1 * tmp[2] * gamma_t_inv[2] + gamma_t_invsqrt[2] * (rng->uniform() - 0.5) * g2;
|
||||||
tmp[1] = g1*tmp[1]*gamma_t_inv[1]
|
|
||||||
+ gamma_t_invsqrt[1]*(random->uniform()-0.5)*g2;
|
|
||||||
tmp[2] = g1*tmp[2]*gamma_t_inv[2]
|
|
||||||
+ gamma_t_invsqrt[2]*(random->uniform()-0.5)*g2;
|
|
||||||
|
|
||||||
} else if (Tp_GAUSS) {
|
} else if (Tp_GAUSS) {
|
||||||
|
tmp[0] = g1 * tmp[0] * gamma_t_inv[0] + gamma_t_invsqrt[0] * rng->gaussian() * g2;
|
||||||
tmp[0] = g1*tmp[0]*gamma_t_inv[0]
|
tmp[1] = g1 * tmp[1] * gamma_t_inv[1] + gamma_t_invsqrt[1] * rng->gaussian() * g2;
|
||||||
+ gamma_t_invsqrt[0]*random->gaussian()*g2;
|
tmp[2] = g1 * tmp[2] * gamma_t_inv[2] + gamma_t_invsqrt[2] * rng->gaussian() * g2;
|
||||||
tmp[1] = g1*tmp[1]*gamma_t_inv[1]
|
|
||||||
+ gamma_t_invsqrt[1]*random->gaussian()*g2;
|
|
||||||
tmp[2] = g1*tmp[2]*gamma_t_inv[2]
|
|
||||||
+ gamma_t_invsqrt[2]*random->gaussian()*g2;
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
tmp[0] = g1 * tmp[0] * gamma_t_inv[0];
|
tmp[0] = g1 * tmp[0] * gamma_t_inv[0];
|
||||||
tmp[1] = g1 * tmp[1] * gamma_t_inv[1];
|
tmp[1] = g1 * tmp[1] * gamma_t_inv[1];
|
||||||
tmp[2] = g1 * tmp[2] * gamma_t_inv[2];
|
tmp[2] = g1 * tmp[2] * gamma_t_inv[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// finally, convert this back to lab-frame velocity and store in dv
|
// finally, convert this back to lab-frame velocity and store in dv
|
||||||
MathExtra::transpose_matvec(rotationmatrix_transpose, tmp, dv);
|
MathExtra::transpose_matvec(rotationmatrix_transpose, tmp, dv);
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (Tp_UNIFORM) {
|
|
||||||
dv[0] = dt * (g1 * f[i][0] + g2 * (random->uniform()-0.5));
|
|
||||||
dv[1] = dt * (g1 * f[i][1] + g2 * (random->uniform()-0.5));
|
|
||||||
dv[2] = dt * (g1 * f[i][2] + g2 * (random->uniform()-0.5));
|
|
||||||
|
|
||||||
} else if (Tp_GAUSS) {
|
|
||||||
dv[0] = dt * (g1 * f[i][0] + g2 * random->gaussian());
|
|
||||||
dv[1] = dt * (g1 * f[i][1] + g2 * random->gaussian());
|
|
||||||
dv[2] = dt * (g1 * f[i][2] + g2 * random->gaussian());
|
|
||||||
|
|
||||||
} else {
|
|
||||||
dv[0] = dt * g1 * f[i][0];
|
|
||||||
dv[1] = dt * g1 * f[i][1];
|
|
||||||
dv[2] = dt * g1 * f[i][2];
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
v[i][0] = dv[0];
|
v[i][0] = dv[0];
|
||||||
v[i][1] = dv[1];
|
v[i][1] = dv[1];
|
||||||
v[i][2] = dv[2];
|
v[i][2] = dv[2];
|
||||||
@ -343,16 +259,13 @@ void FixBrownianAsphere::initial_integrate_templated()
|
|||||||
x[i][2] += dv[2] * dt;
|
x[i][2] += dv[2] * dt;
|
||||||
|
|
||||||
if (Tp_DIPOLE) {
|
if (Tp_DIPOLE) {
|
||||||
|
|
||||||
MathExtra::quat_to_mat_trans(quat, rotationmatrix_transpose);
|
MathExtra::quat_to_mat_trans(quat, rotationmatrix_transpose);
|
||||||
MathExtra::transpose_matvec(rotationmatrix_transpose, dipole_body, f_rot);
|
MathExtra::transpose_matvec(rotationmatrix_transpose, dipole_body, f_rot);
|
||||||
|
|
||||||
mu[i][0] = f_rot[0];
|
mu[i][0] = f_rot[0];
|
||||||
mu[i][1] = f_rot[1];
|
mu[i][1] = f_rot[1];
|
||||||
mu[i][2] = f_rot[2];
|
mu[i][2] = f_rot[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -12,9 +12,9 @@
|
|||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#ifdef FIX_CLASS
|
#ifdef FIX_CLASS
|
||||||
|
// clang-format off
|
||||||
FixStyle(brownian/asphere,FixBrownianAsphere)
|
FixStyle(brownian/asphere,FixBrownianAsphere);
|
||||||
|
// clang-format on
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifndef LMP_FIX_BROWNIAN_ASPHERE_H
|
#ifndef LMP_FIX_BROWNIAN_ASPHERE_H
|
||||||
@ -27,9 +27,8 @@ namespace LAMMPS_NS {
|
|||||||
class FixBrownianAsphere : public FixBrownianBase {
|
class FixBrownianAsphere : public FixBrownianBase {
|
||||||
public:
|
public:
|
||||||
FixBrownianAsphere(class LAMMPS *, int, char **);
|
FixBrownianAsphere(class LAMMPS *, int, char **);
|
||||||
virtual ~FixBrownianAsphere();
|
virtual ~FixBrownianAsphere() {};
|
||||||
void initial_integrate(int);
|
void initial_integrate(int);
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -38,14 +37,8 @@ class FixBrownianAsphere : public FixBrownianBase {
|
|||||||
private:
|
private:
|
||||||
template <int Tp_UNIFORM, int Tp_GAUSS, int Tp_DIPOLE, int Tp_2D>
|
template <int Tp_UNIFORM, int Tp_GAUSS, int Tp_DIPOLE, int Tp_2D>
|
||||||
void initial_integrate_templated();
|
void initial_integrate_templated();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
} // namespace LAMMPS_NS
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -19,28 +19,26 @@
|
|||||||
|
|
||||||
#include "fix_brownian.h"
|
#include "fix_brownian.h"
|
||||||
|
|
||||||
#include <cmath>
|
|
||||||
#include <cstring>
|
|
||||||
#include "math_extra.h"
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "force.h"
|
|
||||||
#include "update.h"
|
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
#include "domain.h"
|
#include "domain.h"
|
||||||
#include "random_mars.h"
|
|
||||||
#include "memory.h"
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "force.h"
|
||||||
|
#include "math_extra.h"
|
||||||
|
#include "memory.h"
|
||||||
|
#include "random_mars.h"
|
||||||
|
#include "update.h"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
using namespace FixConst;
|
using namespace FixConst;
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
FixBrownianBase::FixBrownianBase(LAMMPS *lmp, int narg, char **arg) :
|
FixBrownianBase::FixBrownianBase(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
|
||||||
Fix(lmp, narg, arg)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
time_integrate = 1;
|
time_integrate = 1;
|
||||||
|
|
||||||
noise_flag = 1;
|
noise_flag = 1;
|
||||||
@ -49,8 +47,7 @@ FixBrownianBase::FixBrownianBase(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
gamma_t_eigen_flag = gamma_r_eigen_flag = 0;
|
gamma_t_eigen_flag = gamma_r_eigen_flag = 0;
|
||||||
dipole_flag = 0;
|
dipole_flag = 0;
|
||||||
|
|
||||||
if (narg < 5)
|
if (narg < 5) error->all(FLERR, "Illegal fix brownian command.");
|
||||||
error->all(FLERR,"Illegal fix brownian command.");
|
|
||||||
|
|
||||||
temp = utils::numeric(FLERR, arg[3], false, lmp);
|
temp = utils::numeric(FLERR, arg[3], false, lmp);
|
||||||
if (temp <= 0) error->all(FLERR, "Fix brownian temp must be > 0.");
|
if (temp <= 0) error->all(FLERR, "Fix brownian temp must be > 0.");
|
||||||
@ -58,13 +55,10 @@ FixBrownianBase::FixBrownianBase(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
seed = utils::inumeric(FLERR, arg[4], false, lmp);
|
seed = utils::inumeric(FLERR, arg[4], false, lmp);
|
||||||
if (seed <= 0) error->all(FLERR, "Fix brownian seed must be > 0.");
|
if (seed <= 0) error->all(FLERR, "Fix brownian seed must be > 0.");
|
||||||
|
|
||||||
|
|
||||||
int iarg = 5;
|
int iarg = 5;
|
||||||
while (iarg < narg) {
|
while (iarg < narg) {
|
||||||
if (strcmp(arg[iarg], "rng") == 0) {
|
if (strcmp(arg[iarg], "rng") == 0) {
|
||||||
if (narg == iarg + 1) {
|
if (narg == iarg + 1) error->all(FLERR, "Illegal fix brownian command.");
|
||||||
error->all(FLERR,"Illegal fix brownian command.");
|
|
||||||
}
|
|
||||||
if (strcmp(arg[iarg + 1], "uniform") == 0) {
|
if (strcmp(arg[iarg + 1], "uniform") == 0) {
|
||||||
noise_flag = 1;
|
noise_flag = 1;
|
||||||
} else if (strcmp(arg[iarg + 1], "gaussian") == 0) {
|
} else if (strcmp(arg[iarg + 1], "gaussian") == 0) {
|
||||||
@ -77,9 +71,7 @@ FixBrownianBase::FixBrownianBase(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
}
|
}
|
||||||
iarg = iarg + 2;
|
iarg = iarg + 2;
|
||||||
} else if (strcmp(arg[iarg], "dipole") == 0) {
|
} else if (strcmp(arg[iarg], "dipole") == 0) {
|
||||||
if (narg == iarg + 3) {
|
if (narg == iarg + 3) error->all(FLERR, "Illegal fix brownian command.");
|
||||||
error->all(FLERR,"Illegal fix brownian command.");
|
|
||||||
}
|
|
||||||
|
|
||||||
dipole_flag = 1;
|
dipole_flag = 1;
|
||||||
dipole_body = new double[3];
|
dipole_body = new double[3];
|
||||||
@ -90,9 +82,7 @@ FixBrownianBase::FixBrownianBase(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
iarg = iarg + 4;
|
iarg = iarg + 4;
|
||||||
|
|
||||||
} else if (strcmp(arg[iarg], "gamma_t_eigen") == 0) {
|
} else if (strcmp(arg[iarg], "gamma_t_eigen") == 0) {
|
||||||
if (narg == iarg + 3) {
|
if (narg == iarg + 3) error->all(FLERR, "Illegal fix brownian command.");
|
||||||
error->all(FLERR,"Illegal fix brownian command.");
|
|
||||||
}
|
|
||||||
|
|
||||||
gamma_t_eigen_flag = 1;
|
gamma_t_eigen_flag = 1;
|
||||||
gamma_t_inv = new double[3];
|
gamma_t_inv = new double[3];
|
||||||
@ -106,7 +96,7 @@ FixBrownianBase::FixBrownianBase(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
}
|
}
|
||||||
gamma_t_inv[2] = 0;
|
gamma_t_inv[2] = 0;
|
||||||
} else {
|
} else {
|
||||||
gamma_t_inv[2] = 1./utils::numeric(FLERR,arg[iarg+3],false,lmp);
|
gamma_t_inv[2] = 1.0 / utils::numeric(FLERR, arg[iarg + 3], false, lmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gamma_t_inv[0] < 0 || gamma_t_inv[1] < 0 || gamma_t_inv[2] < 0)
|
if (gamma_t_inv[0] < 0 || gamma_t_inv[1] < 0 || gamma_t_inv[2] < 0)
|
||||||
@ -118,15 +108,12 @@ FixBrownianBase::FixBrownianBase(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
iarg = iarg + 4;
|
iarg = iarg + 4;
|
||||||
|
|
||||||
} else if (strcmp(arg[iarg], "gamma_r_eigen") == 0) {
|
} else if (strcmp(arg[iarg], "gamma_r_eigen") == 0) {
|
||||||
if (narg == iarg + 3) {
|
if (narg == iarg + 3) error->all(FLERR, "Illegal fix brownian command.");
|
||||||
error->all(FLERR,"Illegal fix brownian command.");
|
|
||||||
}
|
|
||||||
|
|
||||||
gamma_r_eigen_flag = 1;
|
gamma_r_eigen_flag = 1;
|
||||||
gamma_r_inv = new double[3];
|
gamma_r_inv = new double[3];
|
||||||
gamma_r_invsqrt = new double[3];
|
gamma_r_invsqrt = new double[3];
|
||||||
|
|
||||||
|
|
||||||
if (domain->dimension == 2) {
|
if (domain->dimension == 2) {
|
||||||
if (strcmp(arg[iarg + 1], "inf") != 0) {
|
if (strcmp(arg[iarg + 1], "inf") != 0) {
|
||||||
error->all(FLERR, "Fix brownian gamma_r_eigen first value must be inf for 2D system.");
|
error->all(FLERR, "Fix brownian gamma_r_eigen first value must be inf for 2D system.");
|
||||||
@ -141,7 +128,6 @@ FixBrownianBase::FixBrownianBase(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
gamma_r_inv[0] = 1. / utils::numeric(FLERR, arg[iarg + 1], false, lmp);
|
gamma_r_inv[0] = 1. / utils::numeric(FLERR, arg[iarg + 1], false, lmp);
|
||||||
gamma_r_inv[1] = 1. / utils::numeric(FLERR, arg[iarg + 2], false, lmp);
|
gamma_r_inv[1] = 1. / utils::numeric(FLERR, arg[iarg + 2], false, lmp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gamma_r_inv[2] = 1. / utils::numeric(FLERR, arg[iarg + 3], false, lmp);
|
gamma_r_inv[2] = 1. / utils::numeric(FLERR, arg[iarg + 3], false, lmp);
|
||||||
@ -155,25 +141,19 @@ FixBrownianBase::FixBrownianBase(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
iarg = iarg + 4;
|
iarg = iarg + 4;
|
||||||
|
|
||||||
} else if (strcmp(arg[iarg], "gamma_t") == 0) {
|
} else if (strcmp(arg[iarg], "gamma_t") == 0) {
|
||||||
if (narg == iarg + 1) {
|
if (narg == iarg + 1) { error->all(FLERR, "Illegal fix brownian command."); }
|
||||||
error->all(FLERR,"Illegal fix brownian command.");
|
|
||||||
}
|
|
||||||
|
|
||||||
gamma_t_flag = 1;
|
gamma_t_flag = 1;
|
||||||
gamma_t = utils::numeric(FLERR, arg[iarg + 1], false, lmp);
|
gamma_t = utils::numeric(FLERR, arg[iarg + 1], false, lmp);
|
||||||
if (gamma_t <= 0)
|
if (gamma_t <= 0) error->all(FLERR, "Fix brownian gamma_t must be > 0.");
|
||||||
error->all(FLERR,"Fix brownian gamma_t must be > 0.");
|
|
||||||
iarg = iarg + 2;
|
iarg = iarg + 2;
|
||||||
|
|
||||||
} else if (strcmp(arg[iarg], "gamma_r") == 0) {
|
} else if (strcmp(arg[iarg], "gamma_r") == 0) {
|
||||||
if (narg == iarg + 1) {
|
if (narg == iarg + 1) { error->all(FLERR, "Illegal fix brownian command."); }
|
||||||
error->all(FLERR,"Illegal fix brownian command.");
|
|
||||||
}
|
|
||||||
|
|
||||||
gamma_r_flag = 1;
|
gamma_r_flag = 1;
|
||||||
gamma_r = utils::numeric(FLERR, arg[iarg + 1], false, lmp);
|
gamma_r = utils::numeric(FLERR, arg[iarg + 1], false, lmp);
|
||||||
if (gamma_r <= 0)
|
if (gamma_r <= 0) error->all(FLERR, "Fix brownian gamma_r must be > 0.");
|
||||||
error->all(FLERR,"Fix brownian gamma_r must be > 0.");
|
|
||||||
iarg = iarg + 2;
|
iarg = iarg + 2;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -182,8 +162,7 @@ FixBrownianBase::FixBrownianBase(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
// initialize Marsaglia RNG with processor-unique seed
|
// initialize Marsaglia RNG with processor-unique seed
|
||||||
random = new RanMars(lmp,seed + comm->me);
|
rng = new RanMars(lmp, seed + comm->me);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -209,16 +188,10 @@ FixBrownianBase::~FixBrownianBase()
|
|||||||
delete[] gamma_r_invsqrt;
|
delete[] gamma_r_invsqrt;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dipole_flag) {
|
if (dipole_flag) { delete[] dipole_body; }
|
||||||
delete [] dipole_body;
|
delete rng;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
delete random;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixBrownianBase::init()
|
void FixBrownianBase::init()
|
||||||
@ -234,17 +207,12 @@ void FixBrownianBase::init()
|
|||||||
} else {
|
} else {
|
||||||
g2 = sqrt(24 * force->boltz * temp / dt / force->mvv2e);
|
g2 = sqrt(24 * force->boltz * temp / dt / force->mvv2e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void FixBrownianBase::reset_dt()
|
void FixBrownianBase::reset_dt()
|
||||||
{
|
{
|
||||||
double sqrtdt_old = sqrtdt;
|
double sqrtdt_old = sqrtdt;
|
||||||
dt = update->dt;
|
dt = update->dt;
|
||||||
sqrtdt = sqrt(dt);
|
sqrtdt = sqrt(dt);
|
||||||
g2 *= sqrtdt_old / sqrtdt;
|
g2 *= sqrtdt_old / sqrtdt;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,6 @@
|
|||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
#ifndef LMP_FIX_BROWNIAN_BASE_H
|
#ifndef LMP_FIX_BROWNIAN_BASE_H
|
||||||
#define LMP_FIX_BROWNIAN_BASE_H
|
#define LMP_FIX_BROWNIAN_BASE_H
|
||||||
|
|
||||||
@ -19,7 +18,6 @@
|
|||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
|
|
||||||
class FixBrownianBase : public Fix {
|
class FixBrownianBase : public Fix {
|
||||||
public:
|
public:
|
||||||
FixBrownianBase(class LAMMPS *, int, char **);
|
FixBrownianBase(class LAMMPS *, int, char **);
|
||||||
@ -31,21 +29,17 @@ class FixBrownianBase : public Fix {
|
|||||||
protected:
|
protected:
|
||||||
int seed; // RNG seed
|
int seed; // RNG seed
|
||||||
double dt, sqrtdt; // time step interval and its sqrt
|
double dt, sqrtdt; // time step interval and its sqrt
|
||||||
|
|
||||||
int gamma_t_flag; // 0/1 if isotropic translational damping is unset/set
|
int gamma_t_flag; // 0/1 if isotropic translational damping is unset/set
|
||||||
int gamma_r_flag; // 0/1 if isotropic rotational damping is unset/set
|
int gamma_r_flag; // 0/1 if isotropic rotational damping is unset/set
|
||||||
double gamma_t,gamma_r; // translational and rotational (isotropic) damping params
|
|
||||||
|
|
||||||
|
|
||||||
int gamma_t_eigen_flag; // 0/1 if anisotropic translational damping is unset/set
|
int gamma_t_eigen_flag; // 0/1 if anisotropic translational damping is unset/set
|
||||||
int gamma_r_eigen_flag; // 0/1 if anisotropic rotational damping is unset/set
|
int gamma_r_eigen_flag; // 0/1 if anisotropic rotational damping is unset/set
|
||||||
|
|
||||||
|
double gamma_t, gamma_r; // translational and rotational (isotropic) damping params
|
||||||
double *gamma_t_inv; // anisotropic damping parameter eigenvalues
|
double *gamma_t_inv; // anisotropic damping parameter eigenvalues
|
||||||
double *gamma_r_inv;
|
double *gamma_r_inv;
|
||||||
double *gamma_t_invsqrt;
|
double *gamma_t_invsqrt;
|
||||||
double *gamma_r_invsqrt;
|
double *gamma_r_invsqrt;
|
||||||
|
|
||||||
|
|
||||||
int dipole_flag; // set if dipole is used for asphere
|
int dipole_flag; // set if dipole is used for asphere
|
||||||
double *dipole_body; // direction dipole is slaved to in body frame
|
double *dipole_body; // direction dipole is slaved to in body frame
|
||||||
|
|
||||||
@ -53,18 +47,12 @@ class FixBrownianBase : public Fix {
|
|||||||
int gaussian_noise_flag; // 0/1 for uniform/gaussian noise
|
int gaussian_noise_flag; // 0/1 for uniform/gaussian noise
|
||||||
|
|
||||||
double temp; // temperature
|
double temp; // temperature
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
double g1, g2; // prefactors in time stepping
|
double g1, g2; // prefactors in time stepping
|
||||||
|
|
||||||
|
class RanMars *rng;
|
||||||
class RanMars *random;
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace LAMMPS_NS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ERROR/WARNING messages:
|
/* ERROR/WARNING messages:
|
||||||
|
|||||||
@ -19,77 +19,52 @@
|
|||||||
|
|
||||||
#include "fix_brownian_sphere.h"
|
#include "fix_brownian_sphere.h"
|
||||||
|
|
||||||
#include <cmath>
|
|
||||||
#include <cstring>
|
|
||||||
#include "math_extra.h"
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "force.h"
|
|
||||||
#include "update.h"
|
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
#include "domain.h"
|
#include "domain.h"
|
||||||
#include "random_mars.h"
|
|
||||||
#include "memory.h"
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "force.h"
|
||||||
|
#include "math_extra.h"
|
||||||
|
#include "memory.h"
|
||||||
|
#include "random_mars.h"
|
||||||
|
#include "update.h"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
using namespace FixConst;
|
using namespace FixConst;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
FixBrownianSphere::FixBrownianSphere(LAMMPS *lmp, int narg, char **arg) :
|
FixBrownianSphere::FixBrownianSphere(LAMMPS *lmp, int narg, char **arg) :
|
||||||
FixBrownianBase(lmp, narg, arg)
|
FixBrownianBase(lmp, narg, arg)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (gamma_t_eigen_flag || gamma_r_eigen_flag) {
|
if (gamma_t_eigen_flag || gamma_r_eigen_flag) {
|
||||||
error->all(FLERR, "Illegal fix brownian command.");
|
error->all(FLERR, "Illegal fix brownian command.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gamma_t_flag || !gamma_r_flag) {
|
if (!gamma_t_flag || !gamma_r_flag) { error->all(FLERR, "Illegal fix brownian command."); }
|
||||||
error->all(FLERR,"Illegal fix brownian command.");
|
if (!atom->mu_flag) error->all(FLERR, "Fix brownian/sphere requires atom attribute mu");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!atom->mu_flag)
|
|
||||||
error->all(FLERR,"Fix brownian/sphere requires atom attribute mu");
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
FixBrownianSphere::~FixBrownianSphere()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixBrownianSphere::init()
|
void FixBrownianSphere::init()
|
||||||
{
|
{
|
||||||
|
|
||||||
FixBrownianBase::init();
|
FixBrownianBase::init();
|
||||||
|
|
||||||
g3 = g1 / gamma_r;
|
g3 = g1 / gamma_r;
|
||||||
g4 = g2 / sqrt(gamma_r);
|
g4 = g2 / sqrt(gamma_r);
|
||||||
|
|
||||||
g1 /= gamma_t;
|
g1 /= gamma_t;
|
||||||
g2 /= sqrt(gamma_t);
|
g2 /= sqrt(gamma_t);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixBrownianSphere::initial_integrate(int /*vflag */)
|
void FixBrownianSphere::initial_integrate(int /*vflag */)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (domain->dimension == 2) {
|
if (domain->dimension == 2) {
|
||||||
|
|
||||||
if (!noise_flag) {
|
if (!noise_flag) {
|
||||||
initial_integrate_templated<0, 0, 1>();
|
initial_integrate_templated<0, 0, 1>();
|
||||||
} else if (gaussian_noise_flag) {
|
} else if (gaussian_noise_flag) {
|
||||||
@ -106,11 +81,9 @@ void FixBrownianSphere::initial_integrate(int /*vflag */)
|
|||||||
initial_integrate_templated<1, 0, 0>();
|
initial_integrate_templated<1, 0, 0>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
template <int Tp_UNIFORM, int Tp_GAUSS, int Tp_2D>
|
template <int Tp_UNIFORM, int Tp_GAUSS, int Tp_2D>
|
||||||
@ -128,77 +101,62 @@ void FixBrownianSphere::initial_integrate_templated()
|
|||||||
|
|
||||||
if (igroup == atom->firstgroup) nlocal = atom->nfirst;
|
if (igroup == atom->firstgroup) nlocal = atom->nfirst;
|
||||||
|
|
||||||
|
|
||||||
double dx, dy, dz;
|
double dx, dy, dz;
|
||||||
|
|
||||||
for (int i = 0; i < nlocal; i++) {
|
for (int i = 0; i < nlocal; i++) {
|
||||||
if (mask[i] & groupbit) {
|
if (mask[i] & groupbit) {
|
||||||
|
|
||||||
if (Tp_2D) {
|
if (Tp_2D) {
|
||||||
dz = 0;
|
dz = 0;
|
||||||
wx = wy = 0;
|
wx = wy = 0;
|
||||||
if (Tp_UNIFORM) {
|
if (Tp_UNIFORM) {
|
||||||
dx = dt * (g1 * f[i][0] + g2 * (random->uniform()-0.5));
|
dx = dt * (g1 * f[i][0] + g2 * (rng->uniform() - 0.5));
|
||||||
dy = dt * (g1 * f[i][1] + g2 * (random->uniform()-0.5));
|
dy = dt * (g1 * f[i][1] + g2 * (rng->uniform() - 0.5));
|
||||||
wz = (random->uniform()-0.5)*g4;
|
wz = (rng->uniform() - 0.5) * g4;
|
||||||
|
|
||||||
} else if (Tp_GAUSS) {
|
} else if (Tp_GAUSS) {
|
||||||
dx = dt * (g1 * f[i][0] + g2 * random->gaussian());
|
dx = dt * (g1 * f[i][0] + g2 * rng->gaussian());
|
||||||
dy = dt * (g1 * f[i][1] + g2 * random->gaussian());
|
dy = dt * (g1 * f[i][1] + g2 * rng->gaussian());
|
||||||
wz = random->gaussian()*g4;
|
wz = rng->gaussian() * g4;
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
dx = dt * g1 * f[i][0];
|
dx = dt * g1 * f[i][0];
|
||||||
dy = dt * g1 * f[i][1];
|
dy = dt * g1 * f[i][1];
|
||||||
wz = 0;
|
wz = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Tp_UNIFORM) {
|
if (Tp_UNIFORM) {
|
||||||
dx = dt * (g1 * f[i][0] + g2 * (random->uniform()-0.5));
|
dx = dt * (g1 * f[i][0] + g2 * (rng->uniform() - 0.5));
|
||||||
dy = dt * (g1 * f[i][1] + g2 * (random->uniform()-0.5));
|
dy = dt * (g1 * f[i][1] + g2 * (rng->uniform() - 0.5));
|
||||||
dz = dt * (g1 * f[i][2] + g2 * (random->uniform()-0.5));
|
dz = dt * (g1 * f[i][2] + g2 * (rng->uniform() - 0.5));
|
||||||
wx = (random->uniform()-0.5)*g4;
|
wx = (rng->uniform() - 0.5) * g4;
|
||||||
wy = (random->uniform()-0.5)*g4;
|
wy = (rng->uniform() - 0.5) * g4;
|
||||||
wz = (random->uniform()-0.5)*g4;
|
wz = (rng->uniform() - 0.5) * g4;
|
||||||
|
|
||||||
} else if (Tp_GAUSS) {
|
} else if (Tp_GAUSS) {
|
||||||
dx = dt * (g1 * f[i][0] + g2 * random->gaussian());
|
dx = dt * (g1 * f[i][0] + g2 * rng->gaussian());
|
||||||
dy = dt * (g1 * f[i][1] + g2 * random->gaussian());
|
dy = dt * (g1 * f[i][1] + g2 * rng->gaussian());
|
||||||
dz = dt * (g1 * f[i][2] + g2 * random->gaussian());
|
dz = dt * (g1 * f[i][2] + g2 * rng->gaussian());
|
||||||
wx = random->gaussian()*g4;
|
wx = rng->gaussian() * g4;
|
||||||
wy = random->gaussian()*g4;
|
wy = rng->gaussian() * g4;
|
||||||
wz = random->gaussian()*g4;
|
wz = rng->gaussian() * g4;
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
dx = dt * g1 * f[i][0];
|
dx = dt * g1 * f[i][0];
|
||||||
dy = dt * g1 * f[i][1];
|
dy = dt * g1 * f[i][1];
|
||||||
dz = dt * g1 * f[i][2];
|
dz = dt * g1 * f[i][2];
|
||||||
wx = wy = wz = 0;
|
wx = wy = wz = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
x[i][0] += dx;
|
x[i][0] += dx;
|
||||||
v[i][0] = dx / dt;
|
v[i][0] = dx / dt;
|
||||||
|
|
||||||
|
|
||||||
x[i][1] += dy;
|
x[i][1] += dy;
|
||||||
v[i][1] = dy / dt;
|
v[i][1] = dy / dt;
|
||||||
|
|
||||||
|
|
||||||
x[i][2] += dz;
|
x[i][2] += dz;
|
||||||
v[i][2] = dz / dt;
|
v[i][2] = dz / dt;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
wx += g3 * torque[i][0];
|
wx += g3 * torque[i][0];
|
||||||
wy += g3 * torque[i][1];
|
wy += g3 * torque[i][1];
|
||||||
wz += g3 * torque[i][2];
|
wz += g3 * torque[i][2];
|
||||||
|
|
||||||
|
|
||||||
// store length of dipole as we need to convert it to a unit vector and
|
// store length of dipole as we need to convert it to a unit vector and
|
||||||
// then back again
|
// then back again
|
||||||
|
|
||||||
@ -209,8 +167,6 @@ void FixBrownianSphere::initial_integrate_templated()
|
|||||||
muy = mu[i][1] / mulen;
|
muy = mu[i][1] / mulen;
|
||||||
muz = mu[i][2] / mulen;
|
muz = mu[i][2] / mulen;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// un-normalised unit vector at time t + dt
|
// un-normalised unit vector at time t + dt
|
||||||
mu[i][0] = mux + (wy * muz - wz * muy) * dt;
|
mu[i][0] = mux + (wy * muz - wz * muy) * dt;
|
||||||
mu[i][1] = muy + (wz * mux - wx * muz) * dt;
|
mu[i][1] = muy + (wz * mux - wx * muz) * dt;
|
||||||
@ -224,9 +180,6 @@ void FixBrownianSphere::initial_integrate_templated()
|
|||||||
mu[i][0] = mu[i][0] * mulen;
|
mu[i][0] = mu[i][0] * mulen;
|
||||||
mu[i][1] = mu[i][1] * mulen;
|
mu[i][1] = mu[i][1] * mulen;
|
||||||
mu[i][2] = mu[i][2] * mulen;
|
mu[i][2] = mu[i][2] * mulen;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,9 +12,9 @@
|
|||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#ifdef FIX_CLASS
|
#ifdef FIX_CLASS
|
||||||
|
// clang-format off
|
||||||
FixStyle(brownian/sphere,FixBrownianSphere)
|
FixStyle(brownian/sphere,FixBrownianSphere);
|
||||||
|
// clang-format on
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifndef LMP_FIX_BROWNIAN_SPHERE_H
|
#ifndef LMP_FIX_BROWNIAN_SPHERE_H
|
||||||
@ -27,18 +27,16 @@ namespace LAMMPS_NS {
|
|||||||
class FixBrownianSphere : public FixBrownianBase {
|
class FixBrownianSphere : public FixBrownianBase {
|
||||||
public:
|
public:
|
||||||
FixBrownianSphere(class LAMMPS *, int, char **);
|
FixBrownianSphere(class LAMMPS *, int, char **);
|
||||||
virtual ~FixBrownianSphere();
|
virtual ~FixBrownianSphere() {};
|
||||||
void init();
|
void init();
|
||||||
void initial_integrate(int /*vflag */);
|
void initial_integrate(int);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <int Tp_UNIFORM, int Tp_GAUSS, int Tp_2D>
|
template <int Tp_UNIFORM, int Tp_GAUSS, int Tp_2D>
|
||||||
void initial_integrate_templated();
|
void initial_integrate_templated();
|
||||||
double g3, g4;
|
double g3, g4;
|
||||||
};
|
};
|
||||||
|
} // namespace LAMMPS_NS
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -42,15 +42,12 @@ enum{DIPOLE,VELOCITY,QUAT};
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
FixPropelSelf::FixPropelSelf(LAMMPS *lmp, int narg, char **arg) :
|
FixPropelSelf::FixPropelSelf(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
|
||||||
Fix(lmp, narg, arg)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
virial_global_flag = virial_peratom_flag = 1;
|
virial_global_flag = virial_peratom_flag = 1;
|
||||||
|
|
||||||
if (narg != 5 && narg != 9)
|
if (narg != 5 && narg != 9) error->all(FLERR, "Illegal fix propel/self command");
|
||||||
error->all(FLERR,"Illegal fix propel/self command");
|
|
||||||
|
|
||||||
|
|
||||||
if (strcmp(arg[3], "velocity") == 0) {
|
if (strcmp(arg[3], "velocity") == 0) {
|
||||||
mode = VELOCITY;
|
mode = VELOCITY;
|
||||||
@ -70,9 +67,7 @@ FixPropelSelf::FixPropelSelf(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
// check for keyword
|
// check for keyword
|
||||||
|
|
||||||
if (narg == 9) {
|
if (narg == 9) {
|
||||||
if (mode != QUAT) {
|
if (mode != QUAT) { error->all(FLERR, "Illegal fix propel/self command"); }
|
||||||
error->all(FLERR,"Illegal fix propel/self command");
|
|
||||||
}
|
|
||||||
if (strcmp(arg[5], "qvector") == 0) {
|
if (strcmp(arg[5], "qvector") == 0) {
|
||||||
sx = utils::numeric(FLERR, arg[6], false, lmp);
|
sx = utils::numeric(FLERR, arg[6], false, lmp);
|
||||||
sy = utils::numeric(FLERR, arg[7], false, lmp);
|
sy = utils::numeric(FLERR, arg[7], false, lmp);
|
||||||
@ -89,7 +84,6 @@ FixPropelSelf::FixPropelSelf(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
sy = 0.0;
|
sy = 0.0;
|
||||||
sz = 0.0;
|
sz = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -101,27 +95,16 @@ int FixPropelSelf::setmask()
|
|||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
FixPropelSelf::~FixPropelSelf()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixPropelSelf::init()
|
void FixPropelSelf::init()
|
||||||
{
|
{
|
||||||
if (mode == DIPOLE && !atom->mu_flag)
|
if (mode == DIPOLE && !atom->mu_flag)
|
||||||
error->all(FLERR,"Fix propel/self requires atom attribute mu "
|
error->all(FLERR, "Fix propel/self requires atom attribute mu with option dipole");
|
||||||
"with option dipole.");
|
|
||||||
|
|
||||||
if (mode == QUAT) {
|
if (mode == QUAT) {
|
||||||
avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid");
|
avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid");
|
||||||
if (!avec)
|
if (!avec) error->all(FLERR, "Fix propel/self requires atom style ellipsoid with option quat");
|
||||||
error->all(FLERR,"Fix propel/self requires "
|
|
||||||
"atom style ellipsoid with option quat.");
|
|
||||||
|
|
||||||
// check that all particles are finite-size ellipsoids
|
// check that all particles are finite-size ellipsoids
|
||||||
// no point particles allowed, spherical is OK
|
// no point particles allowed, spherical is OK
|
||||||
@ -133,17 +116,19 @@ void FixPropelSelf::init()
|
|||||||
for (int i = 0; i < nlocal; i++)
|
for (int i = 0; i < nlocal; i++)
|
||||||
if (mask[i] & groupbit)
|
if (mask[i] & groupbit)
|
||||||
if (ellipsoid[i] < 0)
|
if (ellipsoid[i] < 0)
|
||||||
error->one(FLERR,"Fix propel/self requires extended particles "
|
error->one(FLERR, "Fix propel/self requires extended particles with option quat");
|
||||||
"with option quat.");
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixPropelSelf::setup(int vflag)
|
void FixPropelSelf::setup(int vflag)
|
||||||
{
|
{
|
||||||
post_force(vflag);
|
post_force(vflag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixPropelSelf::post_force(int vflag)
|
void FixPropelSelf::post_force(int vflag)
|
||||||
{
|
{
|
||||||
if (mode == DIPOLE)
|
if (mode == DIPOLE)
|
||||||
@ -152,9 +137,9 @@ void FixPropelSelf::post_force(int vflag)
|
|||||||
post_force_velocity(vflag);
|
post_force_velocity(vflag);
|
||||||
else if (mode == QUAT)
|
else if (mode == QUAT)
|
||||||
post_force_quaternion(vflag);
|
post_force_quaternion(vflag);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixPropelSelf::post_force_dipole(int vflag)
|
void FixPropelSelf::post_force_dipole(int vflag)
|
||||||
{
|
{
|
||||||
@ -165,11 +150,12 @@ void FixPropelSelf::post_force_dipole(int vflag)
|
|||||||
double **mu = atom->mu;
|
double **mu = atom->mu;
|
||||||
double fx, fy, fz;
|
double fx, fy, fz;
|
||||||
|
|
||||||
|
|
||||||
// energy and virial setup
|
// energy and virial setup
|
||||||
double vi[6];
|
double vi[6];
|
||||||
if (vflag) v_setup(vflag);
|
if (vflag)
|
||||||
else evflag = 0;
|
v_setup(vflag);
|
||||||
|
else
|
||||||
|
evflag = 0;
|
||||||
|
|
||||||
// if domain has PBC, need to unwrap for virial
|
// if domain has PBC, need to unwrap for virial
|
||||||
double unwrap[3];
|
double unwrap[3];
|
||||||
@ -199,6 +185,7 @@ void FixPropelSelf::post_force_dipole(int vflag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixPropelSelf::post_force_velocity(int vflag)
|
void FixPropelSelf::post_force_velocity(int vflag)
|
||||||
{
|
{
|
||||||
@ -209,11 +196,12 @@ void FixPropelSelf::post_force_velocity(int vflag)
|
|||||||
int nlocal = atom->nlocal;
|
int nlocal = atom->nlocal;
|
||||||
double nv2, fnorm, fx, fy, fz;
|
double nv2, fnorm, fx, fy, fz;
|
||||||
|
|
||||||
|
|
||||||
// energy and virial setup
|
// energy and virial setup
|
||||||
double vi[6];
|
double vi[6];
|
||||||
if (vflag) v_setup(vflag);
|
if (vflag)
|
||||||
else evflag = 0;
|
v_setup(vflag);
|
||||||
|
else
|
||||||
|
evflag = 0;
|
||||||
|
|
||||||
// if domain has PBC, need to unwrap for virial
|
// if domain has PBC, need to unwrap for virial
|
||||||
double unwrap[3];
|
double unwrap[3];
|
||||||
@ -255,6 +243,8 @@ void FixPropelSelf::post_force_velocity(int vflag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixPropelSelf::post_force_quaternion(int vflag)
|
void FixPropelSelf::post_force_quaternion(int vflag)
|
||||||
{
|
{
|
||||||
double **f = atom->f;
|
double **f = atom->f;
|
||||||
@ -271,11 +261,12 @@ void FixPropelSelf::post_force_quaternion(int vflag)
|
|||||||
double Q[3][3];
|
double Q[3][3];
|
||||||
double fx, fy, fz;
|
double fx, fy, fz;
|
||||||
|
|
||||||
|
|
||||||
// energy and virial setup
|
// energy and virial setup
|
||||||
double vi[6];
|
double vi[6];
|
||||||
if (vflag) v_setup(vflag);
|
if (vflag)
|
||||||
else evflag = 0;
|
v_setup(vflag);
|
||||||
|
else
|
||||||
|
evflag = 0;
|
||||||
|
|
||||||
// if domain has PBC, need to unwrap for virial
|
// if domain has PBC, need to unwrap for virial
|
||||||
double unwrap[3];
|
double unwrap[3];
|
||||||
|
|||||||
@ -12,9 +12,9 @@
|
|||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#ifdef FIX_CLASS
|
#ifdef FIX_CLASS
|
||||||
|
// clang-format off
|
||||||
FixStyle(propel/self,FixPropelSelf)
|
FixStyle(propel/self,FixPropelSelf);
|
||||||
|
// clang-format on
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifndef LMP_FIX_PROPEL_SELF_H
|
#ifndef LMP_FIX_PROPEL_SELF_H
|
||||||
@ -26,7 +26,7 @@ namespace LAMMPS_NS {
|
|||||||
class FixPropelSelf : public Fix {
|
class FixPropelSelf : public Fix {
|
||||||
public:
|
public:
|
||||||
FixPropelSelf(class LAMMPS *, int, char **);
|
FixPropelSelf(class LAMMPS *, int, char **);
|
||||||
virtual ~FixPropelSelf();
|
virtual ~FixPropelSelf() {};
|
||||||
void init();
|
void init();
|
||||||
void post_force(int);
|
void post_force(int);
|
||||||
void setup(int);
|
void setup(int);
|
||||||
@ -42,10 +42,8 @@ class FixPropelSelf : public Fix {
|
|||||||
void post_force_quaternion(int);
|
void post_force_quaternion(int);
|
||||||
|
|
||||||
class AtomVecEllipsoid *avec;
|
class AtomVecEllipsoid *avec;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
} // namespace LAMMPS_NS
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user