make the recentering displacement available as global scalar/vector
This commit is contained in:
@ -91,9 +91,20 @@ to tether the molecule in place.
|
||||
|
||||
No information about this fix is written to "binary restart
|
||||
files"_restart.html. None of the "fix_modify"_fix_modify.html options
|
||||
are relevant to this fix. 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
|
||||
are relevant to this fix.
|
||||
|
||||
This fix computes a global scalar which can be accessed by various
|
||||
"output commands"_Section_howto.html#howto_15. The scalar is the
|
||||
distance the group is moved by fix recenter.
|
||||
|
||||
This fix also computes global 3-vector which can be accessed by
|
||||
various "output commands"_Section_howto.html#howto_15. The 3
|
||||
quantities in the vector are xyz components of displacement applied
|
||||
by to the group of atoms by the fix.
|
||||
|
||||
The scalar and vector values calculated by this fix are "extensive".
|
||||
|
||||
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.
|
||||
|
||||
|
||||
@ -42,6 +42,15 @@ FixRecenter::FixRecenter(LAMMPS *lmp, int narg, char **arg) :
|
||||
xcom = ycom = zcom = 0.0;
|
||||
xflag = yflag = zflag = 1;
|
||||
xinitflag = yinitflag = zinitflag = 0;
|
||||
shift[0] = shift[1] = shift[2] = 0.0;
|
||||
distance = 0.0;
|
||||
scalar_flag = 1;
|
||||
vector_flag = 1;
|
||||
size_vector = 3;
|
||||
extscalar = 1;
|
||||
extvector = 1;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
if (strcmp(arg[3],"NULL") == 0) xflag = 0;
|
||||
else if (strcmp(arg[3],"INIT") == 0) xinitflag = 1;
|
||||
@ -177,10 +186,30 @@ void FixRecenter::initial_integrate(int vflag)
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
|
||||
shift[0] = xflag ? (xtarget - xcm[0]) : 0.0;
|
||||
shift[1] = yflag ? (ytarget - xcm[1]) : 0.0;
|
||||
shift[2] = zflag ? (ztarget - xcm[2]) : 0.0;
|
||||
distance = sqrt(shift[0]*shift[0] + shift[1]*shift[1] + shift[2]*shift[2]);
|
||||
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & group2bit) {
|
||||
if (xflag) x[i][0] += xtarget - xcm[0];
|
||||
if (yflag) x[i][1] += ytarget - xcm[1];
|
||||
if (zflag) x[i][2] += ztarget - xcm[2];
|
||||
x[i][0] += shift[0];
|
||||
x[i][1] += shift[1];
|
||||
x[i][2] += shift[2];
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double FixRecenter::compute_scalar()
|
||||
{
|
||||
return distance;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double FixRecenter::compute_vector(int n)
|
||||
{
|
||||
return shift[n];
|
||||
}
|
||||
|
||||
|
||||
@ -30,12 +30,14 @@ class FixRecenter : public Fix {
|
||||
int setmask();
|
||||
void init();
|
||||
void initial_integrate(int);
|
||||
double compute_scalar();
|
||||
double compute_vector(int);
|
||||
|
||||
private:
|
||||
int group2bit,scaleflag;
|
||||
int xflag,yflag,zflag;
|
||||
int xinitflag,yinitflag,zinitflag;
|
||||
double xcom,ycom,zcom,xinit,yinit,zinit,masstotal;
|
||||
double xcom,ycom,zcom,xinit,yinit,zinit,masstotal,distance,shift[3];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user