Commit fdd2b430 authored by sjplimp's avatar sjplimp
Browse files

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@1277 f3b2605a-c512-4ea7-a41b-209d697bcdaa
parent dc622dbb
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -31,6 +31,10 @@ FixNVELimit::FixNVELimit(LAMMPS *lmp, int narg, char **arg) :
{
  if (narg != 4) error->all("Illegal fix nve/limit command");

  scalar_flag = 1;
  scalar_vector_freq = 1;
  extscalar = 1;

  xlimit = atof(arg[3]);
}

@@ -53,6 +57,7 @@ void FixNVELimit::init()
  dtv = update->dt;
  dtf = 0.5 * update->dt * force->ftm2v;
  vlimitsq = (xlimit/dtv) * (xlimit/dtv);
  ncount = 0;

  if (strcmp(update->integrate_style,"respa") == 0)
    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];
	if (vsq > vlimitsq) {
	  ncount++;
	  scale = sqrt(vlimitsq/vsq);
	  v[i][0] *= 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];
	if (vsq > vlimitsq) {
	  ncount++;
	  scale = sqrt(vlimitsq/vsq);
	  v[i][0] *= 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];
	if (vsq > vlimitsq) {
	  ncount++;
	  scale = sqrt(vlimitsq/vsq);
	  v[i][0] *= 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];
	if (vsq > vlimitsq) {
	  ncount++;
	  scale = sqrt(vlimitsq/vsq);
	  v[i][0] *= scale;
	  v[i][1] *= scale;
@@ -202,3 +211,15 @@ void FixNVELimit::reset_dt()
  dtf = 0.5 * update->dt * force->ftm2v;
  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;
}
+2 −1
Original line number Diff line number Diff line
@@ -28,11 +28,12 @@ class FixNVELimit : public Fix {
  void initial_integrate_respa(int, int);
  void final_integrate_respa(int);
  void reset_dt();
  double compute_scalar();

 private:
  double dtv,dtf;
  double *step_respa;
  int mass_require;
  int mass_require,ncount;
  double xlimit,vlimitsq;
};

+1 −1
Original line number Diff line number Diff line
@@ -434,7 +434,7 @@ void Neighbor::init()
    }

    // 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
    // skip: point this list at request->otherlist, copy skip info from request
    // copy: point this list at request->otherlist