git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@1277 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2008-01-03 00:30:07 +00:00
parent dc622dbbb6
commit fdd2b430d6
3 changed files with 24 additions and 2 deletions

View File

@ -31,6 +31,10 @@ FixNVELimit::FixNVELimit(LAMMPS *lmp, int narg, char **arg) :
{ {
if (narg != 4) error->all("Illegal fix nve/limit command"); if (narg != 4) error->all("Illegal fix nve/limit command");
scalar_flag = 1;
scalar_vector_freq = 1;
extscalar = 1;
xlimit = atof(arg[3]); xlimit = atof(arg[3]);
} }
@ -53,6 +57,7 @@ void FixNVELimit::init()
dtv = update->dt; dtv = update->dt;
dtf = 0.5 * update->dt * force->ftm2v; dtf = 0.5 * update->dt * force->ftm2v;
vlimitsq = (xlimit/dtv) * (xlimit/dtv); vlimitsq = (xlimit/dtv) * (xlimit/dtv);
ncount = 0;
if (strcmp(update->integrate_style,"respa") == 0) if (strcmp(update->integrate_style,"respa") == 0)
step_respa = ((Respa *) update->integrate)->step; step_respa = ((Respa *) update->integrate)->step;
@ -85,6 +90,7 @@ void FixNVELimit::initial_integrate()
vsq = v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]; vsq = v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2];
if (vsq > vlimitsq) { if (vsq > vlimitsq) {
ncount++;
scale = sqrt(vlimitsq/vsq); scale = sqrt(vlimitsq/vsq);
v[i][0] *= scale; v[i][0] *= scale;
v[i][1] *= scale; v[i][1] *= scale;
@ -107,6 +113,7 @@ void FixNVELimit::initial_integrate()
vsq = v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]; vsq = v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2];
if (vsq > vlimitsq) { if (vsq > vlimitsq) {
ncount++;
scale = sqrt(vlimitsq/vsq); scale = sqrt(vlimitsq/vsq);
v[i][0] *= scale; v[i][0] *= scale;
v[i][1] *= scale; v[i][1] *= scale;
@ -145,6 +152,7 @@ void FixNVELimit::final_integrate()
vsq = v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]; vsq = v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2];
if (vsq > vlimitsq) { if (vsq > vlimitsq) {
ncount++;
scale = sqrt(vlimitsq/vsq); scale = sqrt(vlimitsq/vsq);
v[i][0] *= scale; v[i][0] *= scale;
v[i][1] *= scale; v[i][1] *= scale;
@ -163,6 +171,7 @@ void FixNVELimit::final_integrate()
vsq = v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]; vsq = v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2];
if (vsq > vlimitsq) { if (vsq > vlimitsq) {
ncount++;
scale = sqrt(vlimitsq/vsq); scale = sqrt(vlimitsq/vsq);
v[i][0] *= scale; v[i][0] *= scale;
v[i][1] *= scale; v[i][1] *= scale;
@ -202,3 +211,15 @@ void FixNVELimit::reset_dt()
dtf = 0.5 * update->dt * force->ftm2v; dtf = 0.5 * update->dt * force->ftm2v;
vlimitsq = (xlimit/dtv) * (xlimit/dtv); vlimitsq = (xlimit/dtv) * (xlimit/dtv);
} }
/* ----------------------------------------------------------------------
energy of indenter interaction
------------------------------------------------------------------------- */
double FixNVELimit::compute_scalar()
{
double one = ncount;
double all;
MPI_Allreduce(&one,&all,1,MPI_DOUBLE,MPI_SUM,world);
return all;
}

View File

@ -28,11 +28,12 @@ class FixNVELimit : public Fix {
void initial_integrate_respa(int, int); void initial_integrate_respa(int, int);
void final_integrate_respa(int); void final_integrate_respa(int);
void reset_dt(); void reset_dt();
double compute_scalar();
private: private:
double dtv,dtf; double dtv,dtf;
double *step_respa; double *step_respa;
int mass_require; int mass_require,ncount;
double xlimit,vlimitsq; double xlimit,vlimitsq;
}; };

View File

@ -434,7 +434,7 @@ void Neighbor::init()
} }
// detect lists that are connected to other lists // detect lists that are connected to other lists
// if-the-else sequence is important // if-then-else sequence is important
// since don't want to re-process skip or copy lists further down // since don't want to re-process skip or copy lists further down
// skip: point this list at request->otherlist, copy skip info from request // skip: point this list at request->otherlist, copy skip info from request
// copy: point this list at request->otherlist // copy: point this list at request->otherlist