Commit d0e374e4 authored by sjplimp's avatar sjplimp
Browse files

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@1591 f3b2605a-c512-4ea7-a41b-209d697bcdaa
parent 07c6376b
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ void FixNPTASphere::initial_integrate(int vflag)
  }
  ang_factor = exp(-dthalf*eta_dot);

  // v update only for atoms in NPT group
  // v update only for atoms in group

  double **x = atom->x;
  double **v = atom->v;
@@ -107,7 +107,7 @@ void FixNPTASphere::initial_integrate(int vflag)

  remap(0);

  // x update by full step only for atoms in NPT group
  // x update by full step only for atoms in group

  for (i = 0; i < nlocal; i++) {
    if (mask[i] & groupbit) {
@@ -147,7 +147,7 @@ void FixNPTASphere::final_integrate()
{
  int i;

  // v update only for atoms in NPT group
  // v update only for atoms in group

  double **v = atom->v;
  double **f = atom->f;
+2 −2
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ void FixNVTASphere::initial_integrate(int vflag)
  eta += dtv*eta_dot;
  factor = exp(-dthalf*eta_dot);

  // update v and x of only atoms in NVT group
  // update v and x of only atoms in group

  double **x = atom->x;
  double **v = atom->v;
@@ -106,7 +106,7 @@ void FixNVTASphere::final_integrate()
{
  double dtfm;

  // update v of only atoms in NVT group
  // update v of only atoms in group

  double **v = atom->v;
  double **f = atom->f;
+14 −0
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ Compute::Compute(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
  scalar_flag = vector_flag = peratom_flag = 0;
  tempflag = pressflag = peflag = 0;
  pressatomflag = peatomflag = 0;
  tempbias = 0;
  id_pre = NULL;
  timeflag = 0;
  invoked = 0;
@@ -162,3 +163,16 @@ int Compute::matchstep(int ntimestep)
  }
  return 0;
}

/* ----------------------------------------------------------------------
   add back in velocity bias removed by remove_bias() to leave thermal temp
   assume remove_bias() was previously called for this atom
------------------------------------------------------------------------- */

void Compute::restore_bias(double *v)
{
  v[0] += vbias[0];
  v[1] += vbias[1];
  v[2] += vbias[2];
}
+6 −0
Original line number Diff line number Diff line
@@ -45,6 +45,9 @@ class Compute : protected Pointers {
  int peflag;         // 1 if Compute calculates PE (uses Force energies)
  int peatomflag;     // 1 if Compute calculates per-atom PE

  int tempbias;       // 0/1 if has bias routines for isolating thermal temp
  double vbias[3];    // stored velocity bias for one atom

  char *id_pre;       // ID of pre-compute the Compute may store

  int timeflag;       // 1 if Compute stores list of timesteps it's called on
@@ -73,6 +76,9 @@ class Compute : protected Pointers {
  virtual int pack_reverse_comm(int, int, double *) {return 0;}
  virtual void unpack_reverse_comm(int, int *, double *) {}

  virtual void remove_bias(int, double *) {}
  void restore_bias(double *);

  void addstep(int);
  int matchstep(int);

+21 −10
Original line number Diff line number Diff line
@@ -44,6 +44,8 @@ ComputeTempCOM::ComputeTempCOM(LAMMPS *lmp, int narg, char **arg) :
  extscalar = 0;
  extvector = 1;
  tempflag = 1;
  tempbias = 1;
  vbias[0] = vbias[1] = vbias[2] = 0.0;

  vector = new double[6];
}
@@ -81,12 +83,12 @@ void ComputeTempCOM::recount()

double ComputeTempCOM::compute_scalar()
{
  double vcm[3],vthermal[3];
  double vthermal[3];

  invoked |= INVOKED_SCALAR;

  if (dynamic) masstotal = group->mass(igroup);
  group->vcm(igroup,masstotal,vcm);
  group->vcm(igroup,masstotal,vbias);

  double **v = atom->v;
  double *mass = atom->mass;
@@ -98,9 +100,9 @@ double ComputeTempCOM::compute_scalar()
  double t = 0.0;
  for (int i = 0; i < nlocal; i++)
    if (mask[i] & groupbit) {
      vthermal[0] = v[i][0] - vcm[0];
      vthermal[1] = v[i][1] - vcm[1];
      vthermal[2] = v[i][2] - vcm[2];
      vthermal[0] = v[i][0] - vbias[0];
      vthermal[1] = v[i][1] - vbias[1];
      vthermal[2] = v[i][2] - vbias[2];
      if (mass)
	t += (vthermal[0]*vthermal[0] + vthermal[1]*vthermal[1] + 
	      vthermal[2]*vthermal[2]) * mass[type[i]];
@@ -120,12 +122,12 @@ double ComputeTempCOM::compute_scalar()
void ComputeTempCOM::compute_vector()
{
  int i;
  double vcm[3],vthermal[3];
  double vthermal[3];

  invoked |= INVOKED_VECTOR;

  if (dynamic) masstotal = group->mass(igroup);
  group->vcm(igroup,masstotal,vcm);
  group->vcm(igroup,masstotal,vbias);

  double **x = atom->x;
  double **v = atom->v;
@@ -140,9 +142,9 @@ void ComputeTempCOM::compute_vector()

  for (i = 0; i < nlocal; i++)
    if (mask[i] & groupbit) {
      vthermal[0] = v[i][0] - vcm[0];
      vthermal[1] = v[i][1] - vcm[1];
      vthermal[2] = v[i][2] - vcm[2];
      vthermal[0] = v[i][0] - vbias[0];
      vthermal[1] = v[i][1] - vbias[1];
      vthermal[2] = v[i][2] - vbias[2];

      if (mass) massone = mass[type[i]];
      else massone = rmass[i];
@@ -157,3 +159,12 @@ void ComputeTempCOM::compute_vector()
  MPI_Allreduce(t,vector,6,MPI_DOUBLE,MPI_SUM,world);
  for (i = 0; i < 6; i++) vector[i] *= force->mvv2e;
}

/* ---------------------------------------------------------------------- */

void ComputeTempCOM::remove_bias(int i, double *v)
{
  v[0] = v[0] - vbias[0];
  v[1] = v[1] - vbias[1];
  v[2] = v[2] - vbias[2];
}
Loading