2nd set of updates
This commit is contained in:
@ -23,7 +23,7 @@ keyword = {temp} or {press} or {energy} or {virial} or {respa} or {dynamic/dof}
|
|||||||
{dynamic/dof} value = {yes} or {no}
|
{dynamic/dof} value = {yes} or {no}
|
||||||
yes/no = do or do not recompute the number of degrees of freedom (DOF) contributing to the temperature
|
yes/no = do or do not recompute the number of degrees of freedom (DOF) contributing to the temperature
|
||||||
{bodyforces} value = {early} or {late}
|
{bodyforces} value = {early} or {late}
|
||||||
early/late = compute per-rigid-body forces and torques at post_force (early) or at final_integrate (late) :pre
|
early/late = compute rigid-body forces/torques early or late in the timestep :pre
|
||||||
:ule
|
:ule
|
||||||
|
|
||||||
[Examples:]
|
[Examples:]
|
||||||
@ -86,9 +86,8 @@ if you want virial contribution of the fix to be part of the
|
|||||||
relaxation criteria, although this seems unlikely.
|
relaxation criteria, although this seems unlikely.
|
||||||
|
|
||||||
NOTE: This option is only supported by fixes that explicitly say
|
NOTE: This option is only supported by fixes that explicitly say
|
||||||
so. For some of these (e.g. the
|
so. For some of these (e.g. the "fix shake"_fix_shake.html command)
|
||||||
"fix shake"_fix_shake.html command) the default setting is
|
the default setting is {virial yes}, for others it is {virial no}.
|
||||||
{virial yes}, for others it is {virial no}.
|
|
||||||
|
|
||||||
For fixes that set or modify forces, it may be possible to select at
|
For fixes that set or modify forces, it may be possible to select at
|
||||||
which "r-RESPA"_run_style.html level the fix operates via the {respa}
|
which "r-RESPA"_run_style.html level the fix operates via the {respa}
|
||||||
@ -122,22 +121,27 @@ compute to calculate temperature. See the "compute_modify
|
|||||||
dynamic/dof"_compute_modify.html command for a similar way to insure
|
dynamic/dof"_compute_modify.html command for a similar way to insure
|
||||||
correct temperature normalization for those thermostats.
|
correct temperature normalization for those thermostats.
|
||||||
|
|
||||||
The {bodyforces} keyword determines whether the resultant forces and
|
The {bodyforces} keyword determines whether the forces and torques
|
||||||
torques acting on rigid bodies are computed at the post-force stage of
|
acting on rigid bodies are computed {early} at the post-force stage of
|
||||||
a time step (i.e. right after per-atom forces have been computed and
|
each timestep (right after per-atom forces have been computed and
|
||||||
communicated among processors) or at the final-integrate stage (i.e.
|
communicated among processors), or {late} at the final-integrate stage
|
||||||
after all other fixes have finished their post-force tasks). This option
|
of each timestep (after any other fixes have finished their post-force
|
||||||
applies for "fix rigid"_fix_rigid.html and "fix rigid/small"_fix_rigid.html,
|
tasks). Only the rigid-body integration fixes use this option, which
|
||||||
along with their nve, nvt, npt, and nph versions. It also applies for
|
includes "fix rigid"_fix_rigid.html and "fix
|
||||||
"fix poems"_fix_poems.html. Few fix styles actually do post-force
|
rigid/small"_fix_rigid.html, and their variants, and also "fix
|
||||||
tasks. Some of them cause modifications in the computed per-atoms forces
|
poems"_fix_poems.html.
|
||||||
(e.g. "fix addforce"_fix_addforce.html, "fix setforce"_fix_setforce.html,
|
|
||||||
"fix spring"_fix_spring.html, "fix shake"_fix_shake.html, and
|
The default is {late}. If there are other fixes that add forces to
|
||||||
"fix rattle"_fix_shake.html). These tasks are executed sequentially for
|
individual atoms, then the rigid-body constraints will include these
|
||||||
each fix, following the order of their definitions in the input script.
|
forces when time-integrating the rigid bodies. If {early} is
|
||||||
Therefore, once the {bodyforces} keyword is set as {early} for a given
|
specified, then new fixes can be written that use or modify the
|
||||||
rigid-style fix, per-atom force modifications done by other fixes defined
|
per-body force and torque, before time-integration of the rigid bodies
|
||||||
afterwards will have no effect on the per-body forces/torques it computes.
|
occurs. Note however this has the side effect, that fixes such as
|
||||||
|
"fix addforce"_fix_addforce.html, "fix setforce"_fix_setforce.html,
|
||||||
|
"fix spring"_fix_spring.html, which add forces to individual atoms
|
||||||
|
will have no effect on the motion of the rigid bodies if they are
|
||||||
|
specified in the input script after the fix rigid command. LAMMPS
|
||||||
|
will give a warning if that is the case.
|
||||||
|
|
||||||
[Restrictions:] none
|
[Restrictions:] none
|
||||||
|
|
||||||
@ -149,4 +153,5 @@ pressure"_compute_pressure.html, "thermo_style"_thermo_style.html
|
|||||||
[Default:]
|
[Default:]
|
||||||
|
|
||||||
The option defaults are temp = ID defined by fix, press = ID defined
|
The option defaults are temp = ID defined by fix, press = ID defined
|
||||||
by fix, energy = no, virial = varies by fix style, respa = 0, bodyforces = late.
|
by fix, energy = no, virial = different for each fix style, respa = 0,
|
||||||
|
bodyforce = late.
|
||||||
|
|||||||
@ -105,17 +105,19 @@ off, and there is only a single fix poems defined.
|
|||||||
|
|
||||||
[Restart, fix_modify, output, run start/stop, minimize info:]
|
[Restart, fix_modify, output, run start/stop, minimize info:]
|
||||||
|
|
||||||
The "fix_modify"_fix_modify.html {bodyforces} option is supported by
|
|
||||||
this fix style to set whether per-body forces and torques are
|
|
||||||
computed early or late in a time step, i.e., at the post-force stage
|
|
||||||
or at the final-integrate stage, respectively.
|
|
||||||
|
|
||||||
No information about this fix is written to "binary restart
|
No information about this fix is written to "binary restart
|
||||||
files"_restart.html. No global or per-atom quantities are stored
|
files"_restart.html.
|
||||||
by this fix for access by various "output
|
|
||||||
commands"_Section_howto.html#howto_15. No parameter of this fix can
|
The "fix_modify"_fix_modify.html {bodyforces} option is supported by
|
||||||
be used with the {start/stop} keywords of the "run"_run.html command.
|
this fix style to set whether per-body forces and torques are computed
|
||||||
This fix is not invoked during "energy minimization"_minimize.html.
|
early or late in a timestep, i.e. at the post-force stage or at the
|
||||||
|
final-integrate stage, respectively.
|
||||||
|
|
||||||
|
No global or per-atom quantities are stored by this fix for access by
|
||||||
|
various "output commands"_Section_howto.html#howto_15. No parameter
|
||||||
|
of this fix can be used with the {start/stop} keywords of the
|
||||||
|
"run"_run.html command. This fix is not invoked during "energy
|
||||||
|
minimization"_minimize.html.
|
||||||
|
|
||||||
[Restrictions:]
|
[Restrictions:]
|
||||||
|
|
||||||
|
|||||||
@ -223,10 +223,10 @@ via several options.
|
|||||||
|
|
||||||
NOTE: With the {rigid/small} styles, which require that {bodystyle} be
|
NOTE: With the {rigid/small} styles, which require that {bodystyle} be
|
||||||
specified as {molecule} or {custom}, you can define a system that has
|
specified as {molecule} or {custom}, you can define a system that has
|
||||||
no rigid bodies initially. This is useful when you are using the {mol}
|
no rigid bodies initially. This is useful when you are using the
|
||||||
keyword in conjunction with another fix that is adding rigid bodies
|
{mol} keyword in conjunction with another fix that is adding rigid
|
||||||
on-the-fly as molecules, such as "fix deposit"_fix_deposit.html or
|
bodies on-the-fly as molecules, such as "fix deposit"_fix_deposit.html
|
||||||
"fix pour"_fix_pour.html.
|
or "fix pour"_fix_pour.html.
|
||||||
|
|
||||||
For bodystyle {single} the entire fix group of atoms is treated as one
|
For bodystyle {single} the entire fix group of atoms is treated as one
|
||||||
rigid body. This option is only allowed for the {rigid} styles.
|
rigid body. This option is only allowed for the {rigid} styles.
|
||||||
@ -744,8 +744,8 @@ instantaneous temperature.
|
|||||||
|
|
||||||
The "fix_modify"_fix_modify.html {bodyforces} option is supported by
|
The "fix_modify"_fix_modify.html {bodyforces} option is supported by
|
||||||
all rigid styles to set whether per-body forces and torques are
|
all rigid styles to set whether per-body forces and torques are
|
||||||
computed early or late in a time step, i.e., at the post-force stage
|
computed early or late in a timestep, i.e. at the post-force stage or
|
||||||
or at the final-integrate stage, respectively.
|
at the final-integrate stage or the timestep, respectively.
|
||||||
|
|
||||||
The 2 NVE rigid fixes compute a global scalar which can be accessed by
|
The 2 NVE rigid fixes compute a global scalar which can be accessed by
|
||||||
various "output commands"_Section_howto.html#howto_15. The scalar
|
various "output commands"_Section_howto.html#howto_15. The scalar
|
||||||
|
|||||||
@ -174,7 +174,8 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
MPI_Allreduce(&vmin,&minval,1,MPI_INT,MPI_MIN,world);
|
MPI_Allreduce(&vmin,&minval,1,MPI_INT,MPI_MIN,world);
|
||||||
molecule = new tagint[nlocal];
|
molecule = new tagint[nlocal];
|
||||||
for (i = 0; i < nlocal; i++)
|
for (i = 0; i < nlocal; i++)
|
||||||
if (mask[i] & groupbit) molecule[i] = (tagint)((tagint)value[i] - minval + 1);
|
if (mask[i] & groupbit)
|
||||||
|
molecule[i] = (tagint)((tagint)value[i] - minval + 1);
|
||||||
delete[] value;
|
delete[] value;
|
||||||
} else error->all(FLERR,"Unsupported fix rigid custom property");
|
} else error->all(FLERR,"Unsupported fix rigid custom property");
|
||||||
} else {
|
} else {
|
||||||
@ -624,7 +625,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
setupflag = 0;
|
setupflag = 0;
|
||||||
|
|
||||||
// compute per body forces and torques inside final_integrate() by default
|
// compute per body forces and torques at final_integrate() by default
|
||||||
|
|
||||||
earlyflag = 0;
|
earlyflag = 0;
|
||||||
|
|
||||||
@ -688,29 +689,12 @@ FixRigid::~FixRigid()
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
int FixRigid::modify_param(int narg, char **arg)
|
|
||||||
{
|
|
||||||
if (strcmp(arg[0],"bodyforces") == 0) {
|
|
||||||
if (narg < 2)
|
|
||||||
error->all(FLERR,"Illegal fix_modify command");
|
|
||||||
if (strcmp(arg[1],"early") == 0)
|
|
||||||
earlyflag = 1;
|
|
||||||
else if (strcmp(arg[1],"late") == 0)
|
|
||||||
earlyflag = 0;
|
|
||||||
else
|
|
||||||
error->all(FLERR,"Illegal fix_modify command");
|
|
||||||
return 2;
|
|
||||||
} else return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
int FixRigid::setmask()
|
int FixRigid::setmask()
|
||||||
{
|
{
|
||||||
int mask = 0;
|
int mask = 0;
|
||||||
mask |= INITIAL_INTEGRATE;
|
mask |= INITIAL_INTEGRATE;
|
||||||
mask |= FINAL_INTEGRATE;
|
mask |= FINAL_INTEGRATE;
|
||||||
mask |= POST_FORCE;
|
if (langflag || earlyflag) mask |= POST_FORCE;
|
||||||
mask |= PRE_NEIGHBOR;
|
mask |= PRE_NEIGHBOR;
|
||||||
mask |= INITIAL_INTEGRATE_RESPA;
|
mask |= INITIAL_INTEGRATE_RESPA;
|
||||||
mask |= FINAL_INTEGRATE_RESPA;
|
mask |= FINAL_INTEGRATE_RESPA;
|
||||||
@ -732,19 +716,25 @@ void FixRigid::init()
|
|||||||
avec_tri = (AtomVecTri *) atom->style_match("tri");
|
avec_tri = (AtomVecTri *) atom->style_match("tri");
|
||||||
|
|
||||||
// warn if more than one rigid fix
|
// warn if more than one rigid fix
|
||||||
|
// if earlyflag, warn if any post-force fixes come after POEMS fix
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int myindex, myposition;
|
|
||||||
for (i = 0; i < modify->nfix; i++)
|
for (i = 0; i < modify->nfix; i++)
|
||||||
if (strcmp(modify->fix[i]->style,"rigid") == 0) {
|
if (modify->fix[i]->rigid_flag) count++;
|
||||||
count++;
|
if (count > 1 && me == 0) error->warning(FLERR,"More than one fix rigid");
|
||||||
if (strcmp(modify->fix[i]->id,this->id) == 0) {
|
|
||||||
myindex = i;
|
if (earlyflag) {
|
||||||
myposition = count;
|
int rflag = 0;
|
||||||
|
for (i = 0; i < modify->nfix; i++) {
|
||||||
|
if (modify->fix[i]->rigid_flag) rflag = 1;
|
||||||
|
if (rflag && (modify->fmask[i] & POST_FORCE) &&
|
||||||
|
!modify->fix[i]->rigid_flag) {
|
||||||
|
char str[128];
|
||||||
|
sprintf(str,"Fix %d alters forces after fix rigid",modify->fix[i]->id);
|
||||||
|
error->warning(FLERR,str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count > 1 && myposition == 1 && comm->me == 0)
|
}
|
||||||
error->warning(FLERR,"More than one fix rigid");
|
|
||||||
|
|
||||||
// error if npt,nph fix comes before rigid fix
|
// error if npt,nph fix comes before rigid fix
|
||||||
|
|
||||||
@ -758,29 +748,6 @@ void FixRigid::init()
|
|||||||
error->all(FLERR,"Rigid fix must come before NPT/NPH fix");
|
error->all(FLERR,"Rigid fix must come before NPT/NPH fix");
|
||||||
}
|
}
|
||||||
|
|
||||||
// warn if fix rigid preceeds non-rigid fixes with post-force tasks
|
|
||||||
// when computing body forces and torques in post_force() instead of final_integrate()
|
|
||||||
|
|
||||||
if (earlyflag) {
|
|
||||||
int has_post_force[modify->nfix - myindex];
|
|
||||||
count = 0;
|
|
||||||
for (i = myindex + 1; i < modify->nfix; i++)
|
|
||||||
if ( (modify->fmask[i] & POST_FORCE) && (!modify->fix[i]->rigid_flag) )
|
|
||||||
has_post_force[count++] = i;
|
|
||||||
if (count) {
|
|
||||||
FILE *p[2] = {screen, logfile};
|
|
||||||
for (int j = 0; j < 2; j++)
|
|
||||||
if (p[j]) {
|
|
||||||
fprintf(p[j],"WARNING: fix %s %s",id,style);
|
|
||||||
fprintf(p[j]," will add up forces before they are handled by:\n");
|
|
||||||
for (int k = 0; k < count; k++) {
|
|
||||||
Fix *fix = modify->fix[has_post_force[k]];
|
|
||||||
fprintf(p[j]," => fix %s %s\n",fix->id,fix->style);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// timestep info
|
// timestep info
|
||||||
|
|
||||||
dtv = update->dt;
|
dtv = update->dt;
|
||||||
@ -993,7 +960,7 @@ void FixRigid::initial_integrate(int vflag)
|
|||||||
apply Langevin thermostat to all 6 DOF of rigid bodies
|
apply Langevin thermostat to all 6 DOF of rigid bodies
|
||||||
computed by proc 0, broadcast to other procs
|
computed by proc 0, broadcast to other procs
|
||||||
unlike fix langevin, this stores extra force in extra arrays,
|
unlike fix langevin, this stores extra force in extra arrays,
|
||||||
which are added in when one calculates a new fcm/torque
|
which are added in when final_integrate() calculates a new fcm/torque
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixRigid::apply_langevin_thermostat()
|
void FixRigid::apply_langevin_thermostat()
|
||||||
@ -1063,6 +1030,7 @@ void FixRigid::enforce2d()
|
|||||||
void FixRigid::compute_forces_and_torques()
|
void FixRigid::compute_forces_and_torques()
|
||||||
{
|
{
|
||||||
int i,ibody;
|
int i,ibody;
|
||||||
|
double dtfm;
|
||||||
|
|
||||||
// sum over atoms to get force and torque on rigid body
|
// sum over atoms to get force and torque on rigid body
|
||||||
|
|
||||||
@ -1125,6 +1093,7 @@ void FixRigid::compute_forces_and_torques()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixRigid::post_force(int vflag)
|
void FixRigid::post_force(int vflag)
|
||||||
@ -2660,6 +2629,21 @@ void FixRigid::zero_rotation()
|
|||||||
set_v();
|
set_v();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
int FixRigid::modify_param(int narg, char **arg)
|
||||||
|
{
|
||||||
|
if (strcmp(arg[0],"bodyforces") == 0) {
|
||||||
|
if (narg < 2) error->all(FLERR,"Illegal fix_modify command");
|
||||||
|
if (strcmp(arg[1],"early") == 0) earlyflag = 1;
|
||||||
|
else if (strcmp(arg[1],"late") == 0) earlyflag = 0;
|
||||||
|
else error->all(FLERR,"Illegal fix_modify command");
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
return temperature of collection of rigid bodies
|
return temperature of collection of rigid bodies
|
||||||
non-active DOF are removed by fflag/tflag and in tfactor
|
non-active DOF are removed by fflag/tflag and in tfactor
|
||||||
|
|||||||
@ -28,7 +28,6 @@ class FixRigid : public Fix {
|
|||||||
public:
|
public:
|
||||||
FixRigid(class LAMMPS *, int, char **);
|
FixRigid(class LAMMPS *, int, char **);
|
||||||
virtual ~FixRigid();
|
virtual ~FixRigid();
|
||||||
int modify_param(int, char **);
|
|
||||||
virtual int setmask();
|
virtual int setmask();
|
||||||
virtual void init();
|
virtual void init();
|
||||||
virtual void setup(int);
|
virtual void setup(int);
|
||||||
@ -55,6 +54,7 @@ class FixRigid : public Fix {
|
|||||||
void reset_dt();
|
void reset_dt();
|
||||||
void zero_momentum();
|
void zero_momentum();
|
||||||
void zero_rotation();
|
void zero_rotation();
|
||||||
|
virtual int modify_param(int, char **);
|
||||||
virtual void *extract(const char*, int &);
|
virtual void *extract(const char*, int &);
|
||||||
double extract_ke();
|
double extract_ke();
|
||||||
double extract_erotational();
|
double extract_erotational();
|
||||||
@ -70,7 +70,7 @@ class FixRigid : public Fix {
|
|||||||
char *infile; // file to read rigid body attributes from
|
char *infile; // file to read rigid body attributes from
|
||||||
int rstyle; // SINGLE,MOLECULE,GROUP
|
int rstyle; // SINGLE,MOLECULE,GROUP
|
||||||
int setupflag; // 1 if body properties are setup, else 0
|
int setupflag; // 1 if body properties are setup, else 0
|
||||||
int earlyflag; // 1 if forces and torques are computed at post_force()
|
int earlyflag; // 1 if forces/torques computed at post_force()
|
||||||
|
|
||||||
int dimension; // # of dimensions
|
int dimension; // # of dimensions
|
||||||
int nbody; // # of rigid bodies
|
int nbody; // # of rigid bodies
|
||||||
@ -146,7 +146,7 @@ class FixRigid : public Fix {
|
|||||||
void setup_bodies_static();
|
void setup_bodies_static();
|
||||||
void setup_bodies_dynamic();
|
void setup_bodies_dynamic();
|
||||||
void apply_langevin_thermostat();
|
void apply_langevin_thermostat();
|
||||||
virtual void compute_forces_and_torques();
|
void compute_forces_and_torques();
|
||||||
void readfile(int, double *, double **, double **, double **,
|
void readfile(int, double *, double **, double **, double **,
|
||||||
imageint *, int *);
|
imageint *, int *);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -591,9 +591,9 @@ void FixRigidNH::initial_integrate(int vflag)
|
|||||||
|
|
||||||
void FixRigidNH::final_integrate()
|
void FixRigidNH::final_integrate()
|
||||||
{
|
{
|
||||||
int ibody;
|
int i,ibody;
|
||||||
double tmp,scale_t[3],scale_r;
|
double tmp,scale_t[3],scale_r;
|
||||||
double dtfm;
|
double dtfm,xy,xz,yz;
|
||||||
double mbody[3],tbody[3],fquat[4];
|
double mbody[3],tbody[3],fquat[4];
|
||||||
|
|
||||||
double dtf2 = dtf * 2.0;
|
double dtf2 = dtf * 2.0;
|
||||||
@ -1249,7 +1249,9 @@ int FixRigidNH::modify_param(int narg, char **arg)
|
|||||||
if (pressure->pressflag == 0)
|
if (pressure->pressflag == 0)
|
||||||
error->all(FLERR,"Fix_modify pressure ID does not compute pressure");
|
error->all(FLERR,"Fix_modify pressure ID does not compute pressure");
|
||||||
return 2;
|
return 2;
|
||||||
} else return FixRigid::modify_param(narg,arg);
|
}
|
||||||
|
|
||||||
|
return FixRigid::modify_param(narg,arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|||||||
@ -618,7 +618,7 @@ void FixRigidNHSmall::initial_integrate(int vflag)
|
|||||||
|
|
||||||
void FixRigidNHSmall::final_integrate()
|
void FixRigidNHSmall::final_integrate()
|
||||||
{
|
{
|
||||||
int ibody;
|
int i,ibody;
|
||||||
double tmp,scale_t[3],scale_r;
|
double tmp,scale_t[3],scale_r;
|
||||||
double dtfm;
|
double dtfm;
|
||||||
double mbody[3],tbody[3],fquat[4];
|
double mbody[3],tbody[3],fquat[4];
|
||||||
@ -1367,7 +1367,9 @@ int FixRigidNHSmall::modify_param(int narg, char **arg)
|
|||||||
if (pressure->pressflag == 0)
|
if (pressure->pressflag == 0)
|
||||||
error->all(FLERR,"Fix_modify pressure ID does not compute pressure");
|
error->all(FLERR,"Fix_modify pressure ID does not compute pressure");
|
||||||
return 2;
|
return 2;
|
||||||
} else return FixRigidSmall::modify_param(narg,arg);
|
}
|
||||||
|
|
||||||
|
return FixRigidSmall::modify_param(narg,arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|||||||
@ -535,29 +535,12 @@ FixRigidSmall::~FixRigidSmall()
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
int FixRigidSmall::modify_param(int narg, char **arg)
|
|
||||||
{
|
|
||||||
if (strcmp(arg[0],"bodyforces") == 0) {
|
|
||||||
if (narg < 2)
|
|
||||||
error->all(FLERR,"Illegal fix_modify command");
|
|
||||||
if (strcmp(arg[1],"early") == 0)
|
|
||||||
earlyflag = 1;
|
|
||||||
else if (strcmp(arg[1],"late") == 0)
|
|
||||||
earlyflag = 0;
|
|
||||||
else
|
|
||||||
error->all(FLERR,"Illegal fix_modify command");
|
|
||||||
return 2;
|
|
||||||
} else return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
int FixRigidSmall::setmask()
|
int FixRigidSmall::setmask()
|
||||||
{
|
{
|
||||||
int mask = 0;
|
int mask = 0;
|
||||||
mask |= INITIAL_INTEGRATE;
|
mask |= INITIAL_INTEGRATE;
|
||||||
mask |= FINAL_INTEGRATE;
|
mask |= FINAL_INTEGRATE;
|
||||||
mask |= POST_FORCE;
|
if (langflag || earlyflag) mask |= POST_FORCE;
|
||||||
mask |= PRE_NEIGHBOR;
|
mask |= PRE_NEIGHBOR;
|
||||||
mask |= INITIAL_INTEGRATE_RESPA;
|
mask |= INITIAL_INTEGRATE_RESPA;
|
||||||
mask |= FINAL_INTEGRATE_RESPA;
|
mask |= FINAL_INTEGRATE_RESPA;
|
||||||
@ -575,17 +558,22 @@ void FixRigidSmall::init()
|
|||||||
// warn if more than one rigid fix
|
// warn if more than one rigid fix
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int myindex, myposition;
|
|
||||||
for (i = 0; i < modify->nfix; i++)
|
for (i = 0; i < modify->nfix; i++)
|
||||||
if (strcmp(modify->fix[i]->style,"rigid") == 0) {
|
if (modify->fix[i]->rigid_flag) count++;
|
||||||
count++;
|
if (count > 1 && me == 0) error->warning(FLERR,"More than one fix rigid");
|
||||||
if (strcmp(modify->fix[i]->id,this->id) == 0) {
|
|
||||||
myindex = i;
|
if (earlyflag) {
|
||||||
myposition = count;
|
int rflag = 0;
|
||||||
|
for (i = 0; i < modify->nfix; i++) {
|
||||||
|
if (modify->fix[i]->rigid_flag) rflag = 1;
|
||||||
|
if (rflag && (modify->fmask[i] & POST_FORCE) &&
|
||||||
|
!modify->fix[i]->rigid_flag) {
|
||||||
|
char str[128];
|
||||||
|
sprintf(str,"Fix %d alters forces after fix rigid",modify->fix[i]->id);
|
||||||
|
error->warning(FLERR,str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count > 1 && myposition == 1 && comm->me == 0)
|
}
|
||||||
error->warning(FLERR,"More than one fix rigid");
|
|
||||||
|
|
||||||
// error if npt,nph fix comes before rigid fix
|
// error if npt,nph fix comes before rigid fix
|
||||||
|
|
||||||
@ -599,29 +587,6 @@ void FixRigidSmall::init()
|
|||||||
error->all(FLERR,"Rigid fix must come before NPT/NPH fix");
|
error->all(FLERR,"Rigid fix must come before NPT/NPH fix");
|
||||||
}
|
}
|
||||||
|
|
||||||
// warn if fix rigid preceeds non-rigid fixes with post-force tasks
|
|
||||||
// when computing body forces and torques in post_force() instead of final_integrate()
|
|
||||||
|
|
||||||
if (earlyflag) {
|
|
||||||
int has_post_force[modify->nfix - myindex];
|
|
||||||
count = 0;
|
|
||||||
for (i = myindex + 1; i < modify->nfix; i++)
|
|
||||||
if ( (modify->fmask[i] & POST_FORCE) && (!modify->fix[i]->rigid_flag) )
|
|
||||||
has_post_force[count++] = i;
|
|
||||||
if (count) {
|
|
||||||
FILE *p[2] = {screen, logfile};
|
|
||||||
for (int j = 0; j < 2; j++)
|
|
||||||
if (p[j]) {
|
|
||||||
fprintf(p[j],"WARNING: fix %s %s",id,style);
|
|
||||||
fprintf(p[j]," will add up forces before they are handled by:\n");
|
|
||||||
for (int k = 0; k < count; k++) {
|
|
||||||
Fix *fix = modify->fix[has_post_force[k]];
|
|
||||||
fprintf(p[j]," => fix %s %s\n",fix->id,fix->style);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// timestep info
|
// timestep info
|
||||||
|
|
||||||
dtv = update->dt;
|
dtv = update->dt;
|
||||||
@ -822,10 +787,10 @@ void FixRigidSmall::initial_integrate(int vflag)
|
|||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
apply Langevin thermostat to all 6 DOF of rigid bodies I own
|
apply Langevin thermostat to all 6 DOF of rigid bodies I own
|
||||||
unlike fix langevin, this stores extra force in extra arrays,
|
unlike fix langevin, this stores extra force in extra arrays,
|
||||||
which are added in when one calculates a new fcm/torque
|
which are added in when a new fcm/torque are calculated
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixRigidSmall::apply_langevin_thermostat()
|
void FixRigidSmall::apply_langevin_thermostat(int vflag)
|
||||||
{
|
{
|
||||||
double gamma1,gamma2;
|
double gamma1,gamma2;
|
||||||
|
|
||||||
@ -984,13 +949,6 @@ void FixRigidSmall::compute_forces_and_torques()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
void FixRigidSmall::post_force(int vflag)
|
|
||||||
{
|
|
||||||
if (langflag) apply_langevin_thermostat();
|
|
||||||
if (earlyflag) compute_forces_and_torques();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
@ -3454,6 +3412,21 @@ void FixRigidSmall::zero_rotation()
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
int FixRigidSmall::modify_param(int narg, char **arg)
|
||||||
|
{
|
||||||
|
if (strcmp(arg[0],"bodyforces") == 0) {
|
||||||
|
if (narg < 2) error->all(FLERR,"Illegal fix_modify command");
|
||||||
|
if (strcmp(arg[1],"early") == 0) earlyflag = 1;
|
||||||
|
else if (strcmp(arg[1],"late") == 0) earlyflag = 0;
|
||||||
|
else error->all(FLERR,"Illegal fix_modify command");
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void *FixRigidSmall::extract(const char *str, int &dim)
|
void *FixRigidSmall::extract(const char *str, int &dim)
|
||||||
{
|
{
|
||||||
if (strcmp(str,"body") == 0) {
|
if (strcmp(str,"body") == 0) {
|
||||||
|
|||||||
@ -33,7 +33,6 @@ class FixRigidSmall : public Fix {
|
|||||||
public:
|
public:
|
||||||
FixRigidSmall(class LAMMPS *, int, char **);
|
FixRigidSmall(class LAMMPS *, int, char **);
|
||||||
virtual ~FixRigidSmall();
|
virtual ~FixRigidSmall();
|
||||||
int modify_param(int, char **);
|
|
||||||
virtual int setmask();
|
virtual int setmask();
|
||||||
virtual void init();
|
virtual void init();
|
||||||
virtual void setup(int);
|
virtual void setup(int);
|
||||||
@ -64,6 +63,7 @@ class FixRigidSmall : public Fix {
|
|||||||
void reset_dt();
|
void reset_dt();
|
||||||
void zero_momentum();
|
void zero_momentum();
|
||||||
void zero_rotation();
|
void zero_rotation();
|
||||||
|
int modify_param(int, char **);
|
||||||
void *extract(const char*, int &);
|
void *extract(const char*, int &);
|
||||||
double extract_ke();
|
double extract_ke();
|
||||||
double extract_erotational();
|
double extract_erotational();
|
||||||
@ -79,7 +79,7 @@ class FixRigidSmall : public Fix {
|
|||||||
|
|
||||||
char *infile; // file to read rigid body attributes from
|
char *infile; // file to read rigid body attributes from
|
||||||
int setupflag; // 1 if body properties are setup, else 0
|
int setupflag; // 1 if body properties are setup, else 0
|
||||||
int earlyflag; // 1 if forces and torques are computed at post_force()
|
int earlyflag; // 1 if forces/torques are computed at post_force()
|
||||||
int commflag; // various modes of forward/reverse comm
|
int commflag; // various modes of forward/reverse comm
|
||||||
int customflag; // 1 if custom property/variable define bodies
|
int customflag; // 1 if custom property/variable define bodies
|
||||||
int nbody; // total # of rigid bodies
|
int nbody; // total # of rigid bodies
|
||||||
@ -194,7 +194,7 @@ class FixRigidSmall : public Fix {
|
|||||||
void setup_bodies_static();
|
void setup_bodies_static();
|
||||||
void setup_bodies_dynamic();
|
void setup_bodies_dynamic();
|
||||||
void apply_langevin_thermostat();
|
void apply_langevin_thermostat();
|
||||||
virtual void compute_forces_and_torques();
|
void compute_forces_and_torques();
|
||||||
void readfile(int, double **, int *);
|
void readfile(int, double **, int *);
|
||||||
void grow_body();
|
void grow_body();
|
||||||
void reset_atom2body();
|
void reset_atom2body();
|
||||||
|
|||||||
@ -45,4 +45,3 @@ class FixRigidOMP : public FixRigid {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -618,3 +618,4 @@ void FixRigidSmallOMP::set_v_thr()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user