enable fix rigid to support 2d enforcement internally
This commit is contained in:
@ -27,12 +27,9 @@ using namespace FixConst;
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixEnforce2D::FixEnforce2D(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg),
|
||||
flist(nullptr)
|
||||
Fix(lmp, narg, arg)
|
||||
{
|
||||
if (narg != 3) error->all(FLERR,"Illegal fix enforce2d command");
|
||||
|
||||
nfixlist = 0;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -40,8 +37,6 @@ FixEnforce2D::FixEnforce2D(LAMMPS *lmp, int narg, char **arg) :
|
||||
FixEnforce2D::~FixEnforce2D()
|
||||
{
|
||||
if (copymode) return;
|
||||
|
||||
delete [] flist;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -61,29 +56,6 @@ void FixEnforce2D::init()
|
||||
{
|
||||
if (domain->dimension == 3)
|
||||
error->all(FLERR,"Cannot use fix enforce2d with 3d simulation");
|
||||
|
||||
// list of fixes with enforce2d methods
|
||||
|
||||
nfixlist = 0;
|
||||
for (int i = 0; i < modify->nfix; i++)
|
||||
if (modify->fix[i]->enforce2d_flag) nfixlist++;
|
||||
|
||||
if (nfixlist) {
|
||||
int myindex = -1;
|
||||
delete [] flist;
|
||||
flist = new Fix*[nfixlist];
|
||||
nfixlist = 0;
|
||||
for (int i = 0; i < modify->nfix; i++) {
|
||||
if (modify->fix[i]->enforce2d_flag) {
|
||||
if (myindex < 0)
|
||||
flist[nfixlist++] = modify->fix[i];
|
||||
else
|
||||
error->all(FLERR,"Fix enforce2d must be defined after fix {}",
|
||||
modify->fix[i]->style);
|
||||
}
|
||||
if (modify->fix[i] == this) myindex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -153,12 +125,6 @@ void FixEnforce2D::post_force(int /*vflag*/)
|
||||
torque[i][1] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
// invoke other fixes that enforce 2d
|
||||
// fix rigid variants
|
||||
|
||||
for (int m = 0; m < nfixlist; m++)
|
||||
flist[m]->enforce2d();
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user