forked from lijiext/lammps
add flag "reinit" with args "yes" / "no" to fixes rigid & rigid/small
This commit is contained in:
parent
286d4f2743
commit
deff6c666e
|
@ -267,6 +267,8 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
|
||||||
|
|
||||||
int seed;
|
int seed;
|
||||||
langflag = 0;
|
langflag = 0;
|
||||||
|
reinitflag = 1;
|
||||||
|
|
||||||
tstat_flag = 0;
|
tstat_flag = 0;
|
||||||
pstat_flag = 0;
|
pstat_flag = 0;
|
||||||
allremap = 1;
|
allremap = 1;
|
||||||
|
@ -501,6 +503,14 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
|
||||||
infile = new char[n];
|
infile = new char[n];
|
||||||
strcpy(infile,arg[iarg+1]);
|
strcpy(infile,arg[iarg+1]);
|
||||||
restart_file = 1;
|
restart_file = 1;
|
||||||
|
reinitflag = 0;
|
||||||
|
iarg += 2;
|
||||||
|
|
||||||
|
} else if (strcmp(arg[iarg],"reinit") == 0) {
|
||||||
|
if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid/small command");
|
||||||
|
if (strcmp("yes",arg[iarg+1]) == 0) reinitflag = 1;
|
||||||
|
else if (strcmp("no",arg[iarg+1]) == 0) reinitflag = 0;
|
||||||
|
else error->all(FLERR,"Illegal fix rigid command");
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
|
|
||||||
} else error->all(FLERR,"Illegal fix rigid command");
|
} else error->all(FLERR,"Illegal fix rigid command");
|
||||||
|
@ -679,15 +689,15 @@ void FixRigid::init()
|
||||||
if (strstr(update->integrate_style,"respa"))
|
if (strstr(update->integrate_style,"respa"))
|
||||||
step_respa = ((Respa *) update->integrate)->step;
|
step_respa = ((Respa *) update->integrate)->step;
|
||||||
|
|
||||||
// setup rigid bodies, using current atom info
|
// setup rigid bodies, using current atom info. if reinitflag is not set,
|
||||||
// only do initialization once, b/c properties may not be re-computable
|
// do the initialization only once, b/c properties may not be re-computable
|
||||||
// especially if overlapping particles
|
// especially if overlapping particles.
|
||||||
// do not do dynamic init if read body properties from infile
|
// do not do dynamic init if read body properties from infile.
|
||||||
// this is b/c the infile defines the static and dynamic properties
|
// this is b/c the infile defines the static and dynamic properties and may
|
||||||
// and may not be computable if contain overlapping particles
|
// not be computable if contain overlapping particles.
|
||||||
// setup_bodies_static() reads infile itself
|
// setup_bodies_static() reads infile itself
|
||||||
|
|
||||||
if (!setupflag) {
|
if (reinitflag || !setupflag) {
|
||||||
setup_bodies_static();
|
setup_bodies_static();
|
||||||
if (!infile) setup_bodies_dynamic();
|
if (!infile) setup_bodies_dynamic();
|
||||||
setupflag = 1;
|
setupflag = 1;
|
||||||
|
|
|
@ -104,6 +104,7 @@ class FixRigid : public Fix {
|
||||||
int extended; // 1 if any particles have extended attributes
|
int extended; // 1 if any particles have extended attributes
|
||||||
int orientflag; // 1 if particles store spatial orientation
|
int orientflag; // 1 if particles store spatial orientation
|
||||||
int dorientflag; // 1 if particles store dipole orientation
|
int dorientflag; // 1 if particles store dipole orientation
|
||||||
|
int reinitflag; // 1 if re-initialize rigid bodies between runs
|
||||||
|
|
||||||
imageint *xcmimage; // internal image flags for atoms in rigid bodies
|
imageint *xcmimage; // internal image flags for atoms in rigid bodies
|
||||||
// set relative to in-box xcm of each body
|
// set relative to in-box xcm of each body
|
||||||
|
|
|
@ -138,6 +138,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) :
|
||||||
langflag = 0;
|
langflag = 0;
|
||||||
infile = NULL;
|
infile = NULL;
|
||||||
onemols = NULL;
|
onemols = NULL;
|
||||||
|
reinitflag = 1;
|
||||||
|
|
||||||
tstat_flag = 0;
|
tstat_flag = 0;
|
||||||
pstat_flag = 0;
|
pstat_flag = 0;
|
||||||
|
@ -173,6 +174,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) :
|
||||||
error->all(FLERR,"Fix rigid/small langevin period must be > 0.0");
|
error->all(FLERR,"Fix rigid/small langevin period must be > 0.0");
|
||||||
if (seed <= 0) error->all(FLERR,"Illegal fix rigid/small command");
|
if (seed <= 0) error->all(FLERR,"Illegal fix rigid/small command");
|
||||||
iarg += 5;
|
iarg += 5;
|
||||||
|
|
||||||
} else if (strcmp(arg[iarg],"infile") == 0) {
|
} else if (strcmp(arg[iarg],"infile") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid/small command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid/small command");
|
||||||
delete [] infile;
|
delete [] infile;
|
||||||
|
@ -180,7 +182,16 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) :
|
||||||
infile = new char[n];
|
infile = new char[n];
|
||||||
strcpy(infile,arg[iarg+1]);
|
strcpy(infile,arg[iarg+1]);
|
||||||
restart_file = 1;
|
restart_file = 1;
|
||||||
|
reinitflag = 0;
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
|
|
||||||
|
} else if (strcmp(arg[iarg],"reinit") == 0) {
|
||||||
|
if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid/small command");
|
||||||
|
if (strcmp("yes",arg[iarg+1]) == 0) reinitflag = 1;
|
||||||
|
else if (strcmp("no",arg[iarg+1]) == 0) reinitflag = 0;
|
||||||
|
else error->all(FLERR,"Illegal fix rigid/small command");
|
||||||
|
iarg += 2;
|
||||||
|
|
||||||
} else if (strcmp(arg[iarg],"mol") == 0) {
|
} else if (strcmp(arg[iarg],"mol") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid/small command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid/small command");
|
||||||
int imol = atom->find_molecule(arg[iarg+1]);
|
int imol = atom->find_molecule(arg[iarg+1]);
|
||||||
|
@ -520,14 +531,15 @@ void FixRigidSmall::init()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
setup static/dynamic properties of rigid bodies, using current atom info
|
setup static/dynamic properties of rigid bodies, using current atom info.
|
||||||
only do initialization once, b/c properties may not be re-computable
|
if reinitflag is not set, do the initialization only once, b/c properties
|
||||||
especially if overlapping particles or bodies inserted from mol template
|
may not be re-computable especially if overlapping particles or bodies
|
||||||
do not do dynamic init if read body properties from infile
|
are inserted from mol template.
|
||||||
this is b/c the infile defines the static and dynamic properties
|
do not do dynamic init if read body properties from infile. this
|
||||||
and may not be computable if contain overlapping particles
|
is b/c the infile defines the static and dynamic properties and may not
|
||||||
setup_bodies_static() reads infile itself
|
be computable if contain overlapping particles setup_bodies_static()
|
||||||
cannot do this until now, b/c requires comm->setup() to have setup stencil
|
reads infile itself.
|
||||||
|
cannot do this until now, b/c requires comm->setup() to have setup stencil
|
||||||
invoke pre_neighbor() to insure body xcmimage flags are reset
|
invoke pre_neighbor() to insure body xcmimage flags are reset
|
||||||
needed if Verlet::setup::pbc() has remapped/migrated atoms for 2nd run
|
needed if Verlet::setup::pbc() has remapped/migrated atoms for 2nd run
|
||||||
setup_bodies_static() invokes pre_neighbor itself
|
setup_bodies_static() invokes pre_neighbor itself
|
||||||
|
@ -535,9 +547,13 @@ void FixRigidSmall::init()
|
||||||
|
|
||||||
void FixRigidSmall::setup_pre_neighbor()
|
void FixRigidSmall::setup_pre_neighbor()
|
||||||
{
|
{
|
||||||
if (!setupflag) setup_bodies_static();
|
if (reinitflag || !setupflag)
|
||||||
|
setup_bodies_static();
|
||||||
else pre_neighbor();
|
else pre_neighbor();
|
||||||
if (!setupflag && !infile) setup_bodies_dynamic();
|
|
||||||
|
if ((reinitflag || !setupflag) && !infile)
|
||||||
|
setup_bodies_dynamic();
|
||||||
|
|
||||||
setupflag = 1;
|
setupflag = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,6 +131,7 @@ class FixRigidSmall : public Fix {
|
||||||
int extended; // 1 if any particles have extended attributes
|
int extended; // 1 if any particles have extended attributes
|
||||||
int orientflag; // 1 if particles store spatial orientation
|
int orientflag; // 1 if particles store spatial orientation
|
||||||
int dorientflag; // 1 if particles store dipole orientation
|
int dorientflag; // 1 if particles store dipole orientation
|
||||||
|
int reinitflag; // 1 if re-initialize rigid bodies between runs
|
||||||
|
|
||||||
int POINT,SPHERE,ELLIPSOID,LINE,TRIANGLE,DIPOLE; // bitmasks for eflags
|
int POINT,SPHERE,ELLIPSOID,LINE,TRIANGLE,DIPOLE; // bitmasks for eflags
|
||||||
int OMEGA,ANGMOM,TORQUE;
|
int OMEGA,ANGMOM,TORQUE;
|
||||||
|
|
Loading…
Reference in New Issue