diff -Naur lammps-17Nov09/src/ASPHERE/atom_vec_ellipsoid.cpp lammps-18Nov09/src/ASPHERE/atom_vec_ellipsoid.cpp --- lammps-17Nov09/src/ASPHERE/atom_vec_ellipsoid.cpp 2009-11-09 11:20:20.000000000 -0700 +++ lammps-18Nov09/src/ASPHERE/atom_vec_ellipsoid.cpp 2009-11-17 09:07:28.000000000 -0700 @@ -87,6 +87,18 @@ modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax); } +/* ---------------------------------------------------------------------- + reset local array ptrs +------------------------------------------------------------------------- */ + +void AtomVecEllipsoid::grow_reset() +{ + tag = atom->tag; type = atom->type; + mask = atom->mask; image = atom->image; + x = atom->x; v = atom->v; f = atom->f; + quat = atom->quat; angmom = atom->angmom; torque = atom->torque; +} + /* ---------------------------------------------------------------------- */ void AtomVecEllipsoid::copy(int i, int j) @@ -782,14 +794,7 @@ quat[nlocal][3] = atof(values[3]); MathExtra::normalize4(quat[nlocal]); - v[nlocal][0] = 0.0; - v[nlocal][1] = 0.0; - v[nlocal][2] = 0.0; - angmom[nlocal][0] = 0.0; - angmom[nlocal][1] = 0.0; - angmom[nlocal][2] = 0.0; - - return 0; + return 4; } /* ---------------------------------------------------------------------- diff -Naur lammps-17Nov09/src/ASPHERE/atom_vec_ellipsoid.h lammps-18Nov09/src/ASPHERE/atom_vec_ellipsoid.h --- lammps-17Nov09/src/ASPHERE/atom_vec_ellipsoid.h 2009-11-09 11:20:20.000000000 -0700 +++ lammps-18Nov09/src/ASPHERE/atom_vec_ellipsoid.h 2009-11-17 09:07:28.000000000 -0700 @@ -23,6 +23,7 @@ AtomVecEllipsoid(class LAMMPS *, int, char **); virtual ~AtomVecEllipsoid() {} void grow(int); + void grow_reset(); void copy(int, int); int pack_comm(int, int *, double *, int, int *); int pack_comm_vel(int, int *, double *, int, int *); diff -Naur lammps-17Nov09/src/ASPHERE/fix_npt_asphere.cpp lammps-18Nov09/src/ASPHERE/fix_npt_asphere.cpp --- lammps-17Nov09/src/ASPHERE/fix_npt_asphere.cpp 2009-06-26 12:23:16.000000000 -0600 +++ lammps-18Nov09/src/ASPHERE/fix_npt_asphere.cpp 2009-11-17 14:18:23.000000000 -0700 @@ -119,6 +119,12 @@ } factor_rotate = exp(-dthalf*eta_dot); + // update v of atoms in group + // for BIAS: + // calculate temperature since some computes require temp + // computed on current nlocal atoms to remove bias + // OK to not test returned v = 0, since factor is multiplied by v + double **x = atom->x; double **v = atom->v; double **f = atom->f; @@ -140,7 +146,8 @@ v[i][2] = v[i][2]*factor[2] + dtfm*f[i][2]; } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { temperature->remove_bias(i,v[i]); @@ -157,7 +164,7 @@ remap(0); - // x update by full step only for atoms in group + // update x by full step for atoms in group for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { @@ -171,7 +178,7 @@ dtq = 0.5 * dtv; - // update angular momentum by 1/2 step for all particles + // update angular momentum by 1/2 step for atoms in group // update quaternion a full step via Richardson iteration // returns new normalized quaternion @@ -199,7 +206,11 @@ int i; double dtfm; - // update v of only atoms in group + // update v,angmom of atoms in group + // for BIAS: + // calculate temperature since some computes require temp + // computed on current nlocal atoms to remove bias + // OK to not test returned v = 0, since factor is multiplied by v double **v = atom->v; double **f = atom->f; @@ -223,7 +234,8 @@ angmom[i][2] = (angmom[i][2] + dtf * torque[i][2]) * factor_rotate; } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { temperature->remove_bias(i,v[i]); diff -Naur lammps-17Nov09/src/ASPHERE/fix_nvt_asphere.cpp lammps-18Nov09/src/ASPHERE/fix_nvt_asphere.cpp --- lammps-17Nov09/src/ASPHERE/fix_nvt_asphere.cpp 2009-06-26 12:23:16.000000000 -0600 +++ lammps-18Nov09/src/ASPHERE/fix_nvt_asphere.cpp 2009-11-17 14:18:23.000000000 -0700 @@ -101,6 +101,12 @@ eta += dtv*eta_dot; factor = exp(-dthalf*eta_dot); + // update v,x,angmom of atoms in group + // for BIAS: + // calculate temperature since some computes require temp + // computed on current nlocal atoms to remove bias + // OK to not test returned v = 0, since factor is multiplied by v + double **x = atom->x; double **v = atom->v; double **f = atom->f; @@ -140,7 +146,8 @@ } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { temperature->remove_bias(i,v[i]); @@ -173,6 +180,12 @@ { double dtfm; + // update v,angmom of atoms in group + // for BIAS: + // calculate temperature since some computes require temp + // computed on current nlocal atoms to remove bias + // OK to not test returned v = 0, since factor is multiplied by v + double **v = atom->v; double **f = atom->f; double **angmom = atom->angmom; @@ -196,7 +209,8 @@ } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { temperature->remove_bias(i,v[i]); diff -Naur lammps-17Nov09/src/COLLOID/atom_vec_colloid.cpp lammps-18Nov09/src/COLLOID/atom_vec_colloid.cpp --- lammps-17Nov09/src/COLLOID/atom_vec_colloid.cpp 2009-11-09 11:20:20.000000000 -0700 +++ lammps-18Nov09/src/COLLOID/atom_vec_colloid.cpp 2009-11-17 09:07:28.000000000 -0700 @@ -81,6 +81,18 @@ modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax); } +/* ---------------------------------------------------------------------- + reset local array ptrs +------------------------------------------------------------------------- */ + +void AtomVecColloid::grow_reset() +{ + tag = atom->tag; type = atom->type; + mask = atom->mask; image = atom->image; + x = atom->x; v = atom->v; f = atom->f; + omega = atom->omega; torque = atom->torque; +} + /* ---------------------------------------------------------------------- */ void AtomVecColloid::copy(int i, int j) @@ -643,23 +655,6 @@ } /* ---------------------------------------------------------------------- - unpack hybrid quantities from one line in Atoms section of data file - initialize other atom quantities for this sub-style -------------------------------------------------------------------------- */ - -int AtomVecColloid::data_atom_hybrid(int nlocal, char **values) -{ - v[nlocal][0] = 0.0; - v[nlocal][1] = 0.0; - v[nlocal][2] = 0.0; - omega[nlocal][0] = 0.0; - omega[nlocal][1] = 0.0; - omega[nlocal][2] = 0.0; - - return 0; -} - -/* ---------------------------------------------------------------------- unpack one line from Velocities section of data file ------------------------------------------------------------------------- */ diff -Naur lammps-17Nov09/src/COLLOID/atom_vec_colloid.h lammps-18Nov09/src/COLLOID/atom_vec_colloid.h --- lammps-17Nov09/src/COLLOID/atom_vec_colloid.h 2009-11-09 11:20:20.000000000 -0700 +++ lammps-18Nov09/src/COLLOID/atom_vec_colloid.h 2009-11-17 09:07:28.000000000 -0700 @@ -23,6 +23,7 @@ AtomVecColloid(class LAMMPS *, int, char **); virtual ~AtomVecColloid() {} void grow(int); + void grow_reset(); void copy(int, int); int pack_comm(int, int *, double *, int, int *); int pack_comm_vel(int, int *, double *, int, int *); @@ -43,7 +44,6 @@ int unpack_restart(double *); void create_atom(int, double *); void data_atom(double *, int, char **); - int data_atom_hybrid(int, char **); void data_vel(int, char **); int data_vel_hybrid(int, char **); double memory_usage(); diff -Naur lammps-17Nov09/src/DIPOLE/atom_vec_dipole.cpp lammps-18Nov09/src/DIPOLE/atom_vec_dipole.cpp --- lammps-17Nov09/src/DIPOLE/atom_vec_dipole.cpp 2009-11-09 11:20:20.000000000 -0700 +++ lammps-18Nov09/src/DIPOLE/atom_vec_dipole.cpp 2009-11-17 09:07:28.000000000 -0700 @@ -84,6 +84,19 @@ modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax); } +/* ---------------------------------------------------------------------- + reset local array ptrs +------------------------------------------------------------------------- */ + +void AtomVecDipole::grow_reset() +{ + tag = atom->tag; type = atom->type; + mask = atom->mask; image = atom->image; + x = atom->x; v = atom->v; f = atom->f; + q = atom->q; mu = atom->mu; + omega = atom->omega; torque = atom->torque; +} + /* ---------------------------------------------------------------------- */ void AtomVecDipole::copy(int i, int j) @@ -770,13 +783,6 @@ mu[nlocal][1] = atof(values[2]); mu[nlocal][2] = atof(values[3]); - v[nlocal][0] = 0.0; - v[nlocal][1] = 0.0; - v[nlocal][2] = 0.0; - omega[nlocal][0] = 0.0; - omega[nlocal][1] = 0.0; - omega[nlocal][2] = 0.0; - return 4; } diff -Naur lammps-17Nov09/src/DIPOLE/atom_vec_dipole.h lammps-18Nov09/src/DIPOLE/atom_vec_dipole.h --- lammps-17Nov09/src/DIPOLE/atom_vec_dipole.h 2009-11-09 11:20:20.000000000 -0700 +++ lammps-18Nov09/src/DIPOLE/atom_vec_dipole.h 2009-11-17 09:07:28.000000000 -0700 @@ -22,6 +22,7 @@ public: AtomVecDipole(class LAMMPS *, int, char **); void grow(int); + void grow_reset(); void copy(int, int); int pack_comm(int, int *, double *, int, int *); int pack_comm_vel(int, int *, double *, int, int *); diff -Naur lammps-17Nov09/src/GRANULAR/atom_vec_granular.cpp lammps-18Nov09/src/GRANULAR/atom_vec_granular.cpp --- lammps-17Nov09/src/GRANULAR/atom_vec_granular.cpp 2009-11-09 11:20:20.000000000 -0700 +++ lammps-18Nov09/src/GRANULAR/atom_vec_granular.cpp 2009-11-17 09:07:28.000000000 -0700 @@ -90,6 +90,19 @@ modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax); } +/* ---------------------------------------------------------------------- + reset local array ptrs +------------------------------------------------------------------------- */ + +void AtomVecGranular::grow_reset() +{ + tag = atom->tag; type = atom->type; + mask = atom->mask; image = atom->image; + x = atom->x; v = atom->v; f = atom->f; + radius = atom->radius; density = atom->density; rmass = atom->rmass; + omega = atom->omega; torque = atom->torque; +} + /* ---------------------------------------------------------------------- */ void AtomVecGranular::copy(int i, int j) @@ -737,13 +750,6 @@ rmass[nlocal] = 4.0*PI/3.0 * radius[nlocal]*radius[nlocal]*radius[nlocal] * density[nlocal]; - v[nlocal][0] = 0.0; - v[nlocal][1] = 0.0; - v[nlocal][2] = 0.0; - omega[nlocal][0] = 0.0; - omega[nlocal][1] = 0.0; - omega[nlocal][2] = 0.0; - return 2; } diff -Naur lammps-17Nov09/src/GRANULAR/atom_vec_granular.h lammps-18Nov09/src/GRANULAR/atom_vec_granular.h --- lammps-17Nov09/src/GRANULAR/atom_vec_granular.h 2009-11-09 11:20:20.000000000 -0700 +++ lammps-18Nov09/src/GRANULAR/atom_vec_granular.h 2009-11-17 09:07:28.000000000 -0700 @@ -23,6 +23,7 @@ AtomVecGranular(class LAMMPS *, int, char **); ~AtomVecGranular() {} void grow(int); + void grow_reset(); void copy(int, int); int pack_comm(int, int *, double *, int, int *); int pack_comm_vel(int, int *, double *, int, int *); diff -Naur lammps-17Nov09/src/MOLECULE/atom_vec_angle.cpp lammps-18Nov09/src/MOLECULE/atom_vec_angle.cpp --- lammps-17Nov09/src/MOLECULE/atom_vec_angle.cpp 2009-11-16 10:03:09.000000000 -0700 +++ lammps-18Nov09/src/MOLECULE/atom_vec_angle.cpp 2009-11-17 09:07:28.000000000 -0700 @@ -110,11 +110,22 @@ modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax); } -/* ---------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + reset local array ptrs +------------------------------------------------------------------------- */ -void AtomVecAngle::reset_special() +void AtomVecAngle::grow_reset() { - special = atom->special; + tag = atom->tag; type = atom->type; + mask = atom->mask; image = atom->image; + x = atom->x; v = atom->v; f = atom->f; + molecule = atom->molecule; + nspecial = atom->nspecial; special = atom->special; + num_bond = atom->num_bond; bond_type = atom->bond_type; + bond_atom = atom->bond_atom; + num_angle = atom->num_angle; angle_type = atom->angle_type; + angle_atom1 = atom->angle_atom1; angle_atom2 = atom->angle_atom2; + angle_atom3 = atom->angle_atom3; } /* ---------------------------------------------------------------------- */ @@ -754,9 +765,6 @@ { molecule[nlocal] = atoi(values[0]); - v[nlocal][0] = 0.0; - v[nlocal][1] = 0.0; - v[nlocal][2] = 0.0; num_bond[nlocal] = 0; num_angle[nlocal] = 0; diff -Naur lammps-17Nov09/src/MOLECULE/atom_vec_angle.h lammps-18Nov09/src/MOLECULE/atom_vec_angle.h --- lammps-17Nov09/src/MOLECULE/atom_vec_angle.h 2009-11-09 11:20:20.000000000 -0700 +++ lammps-18Nov09/src/MOLECULE/atom_vec_angle.h 2009-11-17 09:07:28.000000000 -0700 @@ -22,7 +22,7 @@ public: AtomVecAngle(class LAMMPS *, int, char **); void grow(int); - void reset_special(); + void grow_reset(); void copy(int, int); int pack_comm(int, int *, double *, int, int *); int pack_comm_vel(int, int *, double *, int, int *); diff -Naur lammps-17Nov09/src/MOLECULE/atom_vec_bond.cpp lammps-18Nov09/src/MOLECULE/atom_vec_bond.cpp --- lammps-17Nov09/src/MOLECULE/atom_vec_bond.cpp 2009-11-09 11:20:20.000000000 -0700 +++ lammps-18Nov09/src/MOLECULE/atom_vec_bond.cpp 2009-11-17 09:07:28.000000000 -0700 @@ -95,11 +95,19 @@ modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax); } -/* ---------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + reset local array ptrs +------------------------------------------------------------------------- */ -void AtomVecBond::reset_special() +void AtomVecBond::grow_reset() { - special = atom->special; + tag = atom->tag; type = atom->type; + mask = atom->mask; image = atom->image; + x = atom->x; v = atom->v; f = atom->f; + molecule = atom->molecule; + nspecial = atom->nspecial; special = atom->special; + num_bond = atom->num_bond; bond_type = atom->bond_type; + bond_atom = atom->bond_atom; } /* ---------------------------------------------------------------------- */ @@ -697,9 +705,6 @@ { molecule[nlocal] = atoi(values[0]); - v[nlocal][0] = 0.0; - v[nlocal][1] = 0.0; - v[nlocal][2] = 0.0; num_bond[nlocal] = 0; return 1; diff -Naur lammps-17Nov09/src/MOLECULE/atom_vec_bond.h lammps-18Nov09/src/MOLECULE/atom_vec_bond.h --- lammps-17Nov09/src/MOLECULE/atom_vec_bond.h 2009-11-09 11:20:20.000000000 -0700 +++ lammps-18Nov09/src/MOLECULE/atom_vec_bond.h 2009-11-17 09:07:28.000000000 -0700 @@ -22,7 +22,7 @@ public: AtomVecBond(class LAMMPS *, int, char **); void grow(int); - void reset_special(); + void grow_reset(); void copy(int, int); int pack_comm(int, int *, double *, int, int *); int pack_comm_vel(int, int *, double *, int, int *); diff -Naur lammps-17Nov09/src/MOLECULE/atom_vec_full.cpp lammps-18Nov09/src/MOLECULE/atom_vec_full.cpp --- lammps-17Nov09/src/MOLECULE/atom_vec_full.cpp 2009-11-09 11:20:20.000000000 -0700 +++ lammps-18Nov09/src/MOLECULE/atom_vec_full.cpp 2009-11-17 09:07:28.000000000 -0700 @@ -148,11 +148,28 @@ modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax); } -/* ---------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + reset local array ptrs +------------------------------------------------------------------------- */ -void AtomVecFull::reset_special() +void AtomVecFull::grow_reset() { - special = atom->special; + tag = atom->tag; type = atom->type; + mask = atom->mask; image = atom->image; + x = atom->x; v = atom->v; f = atom->f; + q = atom->q; molecule = atom->molecule; + nspecial = atom->nspecial; special = atom->special; + num_bond = atom->num_bond; bond_type = atom->bond_type; + bond_atom = atom->bond_atom; + num_angle = atom->num_angle; angle_type = atom->angle_type; + angle_atom1 = atom->angle_atom1; angle_atom2 = atom->angle_atom2; + angle_atom3 = atom->angle_atom3; + num_dihedral = atom->num_dihedral; dihedral_type = atom->dihedral_type; + dihedral_atom1 = atom->dihedral_atom1; dihedral_atom2 = atom->dihedral_atom2; + dihedral_atom3 = atom->dihedral_atom3; dihedral_atom4 = atom->dihedral_atom4; + num_improper = atom->num_improper; improper_type = atom->improper_type; + improper_atom1 = atom->improper_atom1; improper_atom2 = atom->improper_atom2; + improper_atom3 = atom->improper_atom3; improper_atom4 = atom->improper_atom4; } /* ---------------------------------------------------------------------- */ @@ -904,9 +921,6 @@ molecule[nlocal] = atoi(values[1]); q[nlocal] = atof(values[3]); - v[nlocal][0] = 0.0; - v[nlocal][1] = 0.0; - v[nlocal][2] = 0.0; num_bond[nlocal] = 0; num_angle[nlocal] = 0; num_dihedral[nlocal] = 0; diff -Naur lammps-17Nov09/src/MOLECULE/atom_vec_full.h lammps-18Nov09/src/MOLECULE/atom_vec_full.h --- lammps-17Nov09/src/MOLECULE/atom_vec_full.h 2009-11-09 11:20:20.000000000 -0700 +++ lammps-18Nov09/src/MOLECULE/atom_vec_full.h 2009-11-17 09:07:28.000000000 -0700 @@ -22,7 +22,7 @@ public: AtomVecFull(class LAMMPS *, int, char **); void grow(int); - void reset_special(); + void grow_reset(); void copy(int, int); int pack_comm(int, int *, double *, int, int *); int pack_comm_vel(int, int *, double *, int, int *); diff -Naur lammps-17Nov09/src/MOLECULE/atom_vec_molecular.cpp lammps-18Nov09/src/MOLECULE/atom_vec_molecular.cpp --- lammps-17Nov09/src/MOLECULE/atom_vec_molecular.cpp 2009-11-09 11:20:20.000000000 -0700 +++ lammps-18Nov09/src/MOLECULE/atom_vec_molecular.cpp 2009-11-17 09:07:28.000000000 -0700 @@ -146,11 +146,28 @@ modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax); } -/* ---------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + reset local array ptrs +------------------------------------------------------------------------- */ -void AtomVecMolecular::reset_special() +void AtomVecMolecular::grow_reset() { - special = atom->special; + tag = atom->tag; type = atom->type; + mask = atom->mask; image = atom->image; + x = atom->x; v = atom->v; f = atom->f; + molecule = atom->molecule; + nspecial = atom->nspecial; special = atom->special; + num_bond = atom->num_bond; bond_type = atom->bond_type; + bond_atom = atom->bond_atom; + num_angle = atom->num_angle; angle_type = atom->angle_type; + angle_atom1 = atom->angle_atom1; angle_atom2 = atom->angle_atom2; + angle_atom3 = atom->angle_atom3; + num_dihedral = atom->num_dihedral; dihedral_type = atom->dihedral_type; + dihedral_atom1 = atom->dihedral_atom1; dihedral_atom2 = atom->dihedral_atom2; + dihedral_atom3 = atom->dihedral_atom3; dihedral_atom4 = atom->dihedral_atom4; + num_improper = atom->num_improper; improper_type = atom->improper_type; + improper_atom1 = atom->improper_atom1; improper_atom2 = atom->improper_atom2; + improper_atom3 = atom->improper_atom3; improper_atom4 = atom->improper_atom4; } /* ---------------------------------------------------------------------- */ @@ -885,9 +902,6 @@ { molecule[nlocal] = atoi(values[0]); - v[nlocal][0] = 0.0; - v[nlocal][1] = 0.0; - v[nlocal][2] = 0.0; num_bond[nlocal] = 0; num_angle[nlocal] = 0; num_dihedral[nlocal] = 0; diff -Naur lammps-17Nov09/src/MOLECULE/atom_vec_molecular.h lammps-18Nov09/src/MOLECULE/atom_vec_molecular.h --- lammps-17Nov09/src/MOLECULE/atom_vec_molecular.h 2009-11-09 11:20:20.000000000 -0700 +++ lammps-18Nov09/src/MOLECULE/atom_vec_molecular.h 2009-11-17 09:07:28.000000000 -0700 @@ -22,7 +22,7 @@ public: AtomVecMolecular(class LAMMPS *, int, char **); void grow(int); - void reset_special(); + void grow_reset(); void copy(int, int); int pack_comm(int, int *, double *, int, int *); int pack_comm_vel(int, int *, double *, int, int *); diff -Naur lammps-17Nov09/src/PERI/atom_vec_peri.cpp lammps-18Nov09/src/PERI/atom_vec_peri.cpp --- lammps-17Nov09/src/PERI/atom_vec_peri.cpp 2009-11-09 11:20:20.000000000 -0700 +++ lammps-18Nov09/src/PERI/atom_vec_peri.cpp 2009-11-17 09:07:28.000000000 -0700 @@ -88,6 +88,19 @@ modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax); } +/* ---------------------------------------------------------------------- + reset local array ptrs +------------------------------------------------------------------------- */ + +void AtomVecPeri::grow_reset() +{ + tag = atom->tag; type = atom->type; + mask = atom->mask; image = atom->image; + x = atom->x; v = atom->v; f = atom->f; + vfrac = atom->vfrac; density = atom->density; rmass = atom->rmass; + s0 = atom->s0; x0 = atom->x0; +} + /* ---------------------------------------------------------------------- */ void AtomVecPeri::copy(int i, int j) @@ -727,10 +740,6 @@ rmass[nlocal] = density[nlocal]; if (rmass[nlocal] <= 0.0) error->one("Invalid mass value"); - v[nlocal][0] = 0.0; - v[nlocal][1] = 0.0; - v[nlocal][2] = 0.0; - s0[nlocal] = DBL_MAX; x0[nlocal][0] = x[nlocal][0]; x0[nlocal][1] = x[nlocal][1]; diff -Naur lammps-17Nov09/src/PERI/atom_vec_peri.h lammps-18Nov09/src/PERI/atom_vec_peri.h --- lammps-17Nov09/src/PERI/atom_vec_peri.h 2009-11-09 11:20:20.000000000 -0700 +++ lammps-18Nov09/src/PERI/atom_vec_peri.h 2009-11-17 09:07:28.000000000 -0700 @@ -22,6 +22,7 @@ public: AtomVecPeri(class LAMMPS *, int, char **); void grow(int); + void grow_reset(); void copy(int, int); int pack_comm(int, int *, double *, int, int *); int pack_comm_vel(int, int *, double *, int, int *); diff -Naur lammps-17Nov09/src/atom_vec.h lammps-18Nov09/src/atom_vec.h --- lammps-17Nov09/src/atom_vec.h 2009-11-09 11:20:20.000000000 -0700 +++ lammps-18Nov09/src/atom_vec.h 2009-11-17 09:07:28.000000000 -0700 @@ -43,7 +43,7 @@ virtual void init() {} virtual void grow(int) = 0; - virtual void reset_special() {} + virtual void grow_reset() = 0; virtual void copy(int, int) = 0; virtual int pack_comm(int, int *, double *, int, int *) = 0; @@ -74,7 +74,7 @@ virtual void create_atom(int, double *) = 0; virtual void data_atom(double *, int, char **) = 0; - virtual int data_atom_hybrid(int, char **) = 0; + virtual int data_atom_hybrid(int, char **) {return 0;} virtual void data_vel(int, char **); virtual int data_vel_hybrid(int, char **) {return 0;} diff -Naur lammps-17Nov09/src/atom_vec_atomic.cpp lammps-18Nov09/src/atom_vec_atomic.cpp --- lammps-17Nov09/src/atom_vec_atomic.cpp 2009-11-09 11:20:20.000000000 -0700 +++ lammps-18Nov09/src/atom_vec_atomic.cpp 2009-11-17 09:07:28.000000000 -0700 @@ -71,6 +71,17 @@ modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax); } +/* ---------------------------------------------------------------------- + reset local array ptrs +------------------------------------------------------------------------- */ + +void AtomVecAtomic::grow_reset() +{ + tag = atom->tag; type = atom->type; + mask = atom->mask; image = atom->image; + x = atom->x; v = atom->v; f = atom->f; +} + /* ---------------------------------------------------------------------- */ void AtomVecAtomic::copy(int i, int j) @@ -561,20 +572,6 @@ } /* ---------------------------------------------------------------------- - unpack hybrid quantities from one line in Atoms section of data file - initialize other atom quantities for this sub-style -------------------------------------------------------------------------- */ - -int AtomVecAtomic::data_atom_hybrid(int nlocal, char **values) -{ - v[nlocal][0] = 0.0; - v[nlocal][1] = 0.0; - v[nlocal][2] = 0.0; - - return 0; -} - -/* ---------------------------------------------------------------------- return # of bytes of allocated memory ------------------------------------------------------------------------- */ diff -Naur lammps-17Nov09/src/atom_vec_atomic.h lammps-18Nov09/src/atom_vec_atomic.h --- lammps-17Nov09/src/atom_vec_atomic.h 2009-11-09 11:20:20.000000000 -0700 +++ lammps-18Nov09/src/atom_vec_atomic.h 2009-11-17 09:07:28.000000000 -0700 @@ -23,6 +23,7 @@ AtomVecAtomic(class LAMMPS *, int, char **); ~AtomVecAtomic() {} void grow(int); + void grow_reset(); void copy(int, int); int pack_comm(int, int *, double *, int, int *); int pack_comm_vel(int, int *, double *, int, int *); @@ -41,7 +42,6 @@ int unpack_restart(double *); void create_atom(int, double *); void data_atom(double *, int, char **); - int data_atom_hybrid(int, char **); double memory_usage(); private: diff -Naur lammps-17Nov09/src/atom_vec_charge.cpp lammps-18Nov09/src/atom_vec_charge.cpp --- lammps-17Nov09/src/atom_vec_charge.cpp 2009-11-09 11:20:20.000000000 -0700 +++ lammps-18Nov09/src/atom_vec_charge.cpp 2009-11-17 09:07:28.000000000 -0700 @@ -76,6 +76,18 @@ modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax); } +/* ---------------------------------------------------------------------- + reset local array ptrs +------------------------------------------------------------------------- */ + +void AtomVecCharge::grow_reset() +{ + tag = atom->tag; type = atom->type; + mask = atom->mask; image = atom->image; + x = atom->x; v = atom->v; f = atom->f; + q = atom->q; +} + /* ---------------------------------------------------------------------- */ void AtomVecCharge::copy(int i, int j) @@ -610,10 +622,6 @@ { q[nlocal] = atof(values[0]); - v[nlocal][0] = 0.0; - v[nlocal][1] = 0.0; - v[nlocal][2] = 0.0; - return 1; } diff -Naur lammps-17Nov09/src/atom_vec_charge.h lammps-18Nov09/src/atom_vec_charge.h --- lammps-17Nov09/src/atom_vec_charge.h 2009-11-09 11:20:20.000000000 -0700 +++ lammps-18Nov09/src/atom_vec_charge.h 2009-11-17 09:07:28.000000000 -0700 @@ -22,6 +22,7 @@ public: AtomVecCharge(class LAMMPS *, int, char **); void grow(int); + void grow_reset(); void copy(int, int); int pack_comm(int, int *, double *, int, int *); int pack_comm_vel(int, int *, double *, int, int *); diff -Naur lammps-17Nov09/src/atom_vec_hybrid.cpp lammps-18Nov09/src/atom_vec_hybrid.cpp --- lammps-17Nov09/src/atom_vec_hybrid.cpp 2009-11-12 10:03:16.000000000 -0700 +++ lammps-18Nov09/src/atom_vec_hybrid.cpp 2009-11-17 09:10:08.000000000 -0700 @@ -113,34 +113,35 @@ else nmax = n; atom->nmax = nmax; + // sub-styles perform all reallocation + // turn off nextra_grow so hybrid can do that once below + int tmp = atom->nextra_grow; atom->nextra_grow = 0; for (int k = 0; k < nstyles; k++) styles[k]->grow(nmax); atom->nextra_grow = tmp; - // pointers for arrays used directly by hybrid style - - tag = atom->tag; - type = atom->type; - mask = atom->mask; - image = atom->image; - x = atom->x; - v = atom->v; - f = atom->f; + // insure sub-style ptrs and hybrid local ptrs are up to date + // for sub-styles, do this in case multiple sub-style reallocs occurred - omega = atom->omega; - angmom = atom->angmom; + for (int k = 0; k < nstyles; k++) styles[k]->grow_reset(); + grow_reset(); if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax); } -/* ---------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + reset local array ptrs +------------------------------------------------------------------------- */ -void AtomVecHybrid::reset_special() +void AtomVecHybrid::grow_reset() { - for (int k = 0; k < nstyles; k++) styles[k]->reset_special(); + tag = atom->tag; type = atom->type; + mask = atom->mask; image = atom->image; + x = atom->x; v = atom->v; f = atom->f; + omega = atom->omega; angmom = atom->angmom; } /* ---------------------------------------------------------------------- @@ -715,6 +716,20 @@ image[nlocal] = imagetmp; mask[nlocal] = 1; + v[nlocal][0] = 0.0; + v[nlocal][1] = 0.0; + v[nlocal][2] = 0.0; + if (atom->omega_flag) { + omega[nlocal][0]; + omega[nlocal][1]; + omega[nlocal][2]; + } + if (atom->angmom_flag) { + angmom[nlocal][0]; + angmom[nlocal][1]; + angmom[nlocal][2]; + } + // each sub-style parses sub-style specific values int m = 5; diff -Naur lammps-17Nov09/src/atom_vec_hybrid.h lammps-18Nov09/src/atom_vec_hybrid.h --- lammps-17Nov09/src/atom_vec_hybrid.h 2009-11-09 11:20:20.000000000 -0700 +++ lammps-18Nov09/src/atom_vec_hybrid.h 2009-11-17 09:07:28.000000000 -0700 @@ -27,7 +27,7 @@ AtomVecHybrid(class LAMMPS *, int, char **); ~AtomVecHybrid(); void grow(int); - void reset_special(); + void grow_reset(); void copy(int, int); int pack_comm(int, int *, double *, int, int *); int pack_comm_vel(int, int *, double *, int, int *); diff -Naur lammps-17Nov09/src/fix_langevin.cpp lammps-18Nov09/src/fix_langevin.cpp --- lammps-17Nov09/src/fix_langevin.cpp 2009-11-06 16:34:26.000000000 -0700 +++ lammps-18Nov09/src/fix_langevin.cpp 2009-11-17 14:18:23.000000000 -0700 @@ -195,7 +195,12 @@ double t_target = t_start + delta * (t_stop-t_start); double tsqrt = sqrt(t_target); - // apply damping and thermostat to appropriate atoms + // apply damping and thermostat to atoms in group + // for BIAS: + // calculate temperature since some computes require temp + // computed on current nlocal atoms to remove bias + // test v = 0 since some computes mask non-participating atoms via v = 0 + // and added force has extra term not multiplied by v = 0 if (rmass) { double boltz = force->boltz; @@ -216,12 +221,8 @@ } } - // invoke temperature since some computes require it to remove bias - // test v = 0 since some computes mask non-participating atoms via v = 0 - } else if (which == BIAS) { double tmp = temperature->compute_scalar(); - for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { gamma1 = -rmass[i] / t_period / ftm2v; @@ -252,12 +253,8 @@ } } - // invoke temperature since some computes require it to remove bias - // test v = 0 since some computes mask non-participating atoms via v = 0 - } else if (which == BIAS) { double tmp = temperature->compute_scalar(); - for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { gamma1 = gfactor1[type[i]]; @@ -303,6 +300,11 @@ double tsqrt = sqrt(t_target); // apply damping and thermostat to appropriate atoms + // for BIAS: + // calculate temperature since some computes require temp + // computed on current nlocal atoms to remove bias + // test v = 0 since some computes mask non-participating atoms via v = 0 + // and added force has extra term not multiplied by v = 0 if (rmass) { double boltz = force->boltz; @@ -326,12 +328,8 @@ } } - // invoke temperature since some computes require it to remove bias - // test v = 0 since some computes mask non-participating atoms via v = 0 - } else if (which == BIAS) { double tmp = temperature->compute_scalar(); - for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { gamma1 = -rmass[i] / t_period / ftm2v; @@ -368,12 +366,8 @@ } } - // invoke temperature since some computes require it to remove bias - // test v = 0 since some computes mask non-participating atoms via v = 0 - } else if (which == BIAS) { double tmp = temperature->compute_scalar(); - for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { gamma1 = gfactor1[type[i]]; diff -Naur lammps-17Nov09/src/fix_npt.cpp lammps-18Nov09/src/fix_npt.cpp --- lammps-17Nov09/src/fix_npt.cpp 2009-10-30 12:14:19.000000000 -0600 +++ lammps-18Nov09/src/fix_npt.cpp 2009-11-17 14:18:23.000000000 -0700 @@ -388,6 +388,12 @@ dilation[i] = exp(dthalf*omega_dot[i]); } + // update v and x of atoms in group + // for BIAS: + // calculate temperature since some computes require temp + // computed on current nlocal atoms to remove bias + // OK to not test returned v = 0, since factor is multiplied by v + double **x = atom->x; double **v = atom->v; double **f = atom->f; @@ -408,7 +414,8 @@ v[i][2] = v[i][2]*factor[2] + dtfm*f[i][2]; } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { temperature->remove_bias(i,v[i]); @@ -431,7 +438,8 @@ v[i][2] = v[i][2]*factor[2] + dtfm*f[i][2]; } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { temperature->remove_bias(i,v[i]); @@ -449,7 +457,7 @@ remap(0); - // x update by full step only for atoms in group + // update x by full step for atoms in group for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { @@ -475,6 +483,12 @@ int i; double dtfm; + // update v of atoms in group + // for BIAS: + // calculate temperature since some computes require temp + // computed on current nlocal atoms to remove bias + // OK to not test returned v = 0, since factor is multiplied by v + double **v = atom->v; double **f = atom->f; double *rmass = atom->rmass; @@ -494,7 +508,8 @@ v[i][2] = (v[i][2] + dtfm*f[i][2]) * factor[2]; } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { temperature->remove_bias(i,v[i]); @@ -517,7 +532,8 @@ v[i][2] = (v[i][2] + dtfm*f[i][2]) * factor[2]; } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { temperature->remove_bias(i,v[i]); @@ -602,7 +618,7 @@ // outermost level - update eta_dot and omega_dot, apply to v, remap box // all other levels - NVE update of v - // x,v updates only performed for atoms in group + // x,v updates performed for atoms in group if (ilevel == nlevels_respa-1) { @@ -635,7 +651,7 @@ dilation[i] = exp(dthalf*omega_dot[i]); } - // v update only for atoms in group + // update v for atoms in group if (rmass) { for (int i = 0; i < nlocal; i++) { @@ -663,57 +679,31 @@ } else { - // v update only for atoms in group + // update v for atoms in group if (rmass) { - if (which == NOBIAS) { - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) { - dtfm = dtf / rmass[i]; - v[i][0] += dtfm*f[i][0]; - v[i][1] += dtfm*f[i][1]; - v[i][2] += dtfm*f[i][2]; - } - } - } else if (which == BIAS) { - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) { - temperature->remove_bias(i,v[i]); - dtfm = dtf / rmass[i]; - v[i][0] += dtfm*f[i][0]; - v[i][1] += dtfm*f[i][1]; - v[i][2] += dtfm*f[i][2]; - temperature->restore_bias(i,v[i]); - } + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + dtfm = dtf / rmass[i]; + v[i][0] += dtfm*f[i][0]; + v[i][1] += dtfm*f[i][1]; + v[i][2] += dtfm*f[i][2]; } } } else { - if (which == NOBIAS) { - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) { - dtfm = dtf / mass[type[i]]; - v[i][0] += dtfm*f[i][0]; - v[i][1] += dtfm*f[i][1]; - v[i][2] += dtfm*f[i][2]; - } - } - } else if (which == BIAS) { - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) { - temperature->remove_bias(i,v[i]); - dtfm = dtf / mass[type[i]]; - v[i][0] += dtfm*f[i][0]; - v[i][1] += dtfm*f[i][1]; - v[i][2] += dtfm*f[i][2]; - temperature->restore_bias(i,v[i]); - } + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + dtfm = dtf / mass[type[i]]; + v[i][0] += dtfm*f[i][0]; + v[i][1] += dtfm*f[i][1]; + v[i][2] += dtfm*f[i][2]; } } } } - // innermost level - also update x only for atoms in group + // innermost level - also update x for atoms in group if (ilevel == 0) { for (int i = 0; i < nlocal; i++) { @@ -740,12 +730,12 @@ // outermost level - update eta_dot and omega_dot, // apply to v via final_integrate() // all other levels - NVE update of v - // v update only performed for atoms in group + // update v for atoms in group if (ilevel == nlevels_respa-1) final_integrate(); else { - // v update only for atoms in group + // update v for atoms in group double **v = atom->v; double **f = atom->f; @@ -757,48 +747,22 @@ if (igroup == atom->firstgroup) nlocal = atom->nfirst; if (rmass) { - if (which == NOBIAS) { - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) { - dtfm = dtf / rmass[i]; - v[i][0] += dtfm*f[i][0]; - v[i][1] += dtfm*f[i][1]; - v[i][2] += dtfm*f[i][2]; - } - } - } else if (which == BIAS) { - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) { - temperature->remove_bias(i,v[i]); - dtfm = dtf / rmass[i]; - v[i][0] += dtfm*f[i][0]; - v[i][1] += dtfm*f[i][1]; - v[i][2] += dtfm*f[i][2]; - temperature->restore_bias(i,v[i]); - } + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + dtfm = dtf / rmass[i]; + v[i][0] += dtfm*f[i][0]; + v[i][1] += dtfm*f[i][1]; + v[i][2] += dtfm*f[i][2]; } } } else { - if (which == NOBIAS) { - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) { - dtfm = dtf / mass[type[i]]; - v[i][0] += dtfm*f[i][0]; - v[i][1] += dtfm*f[i][1]; - v[i][2] += dtfm*f[i][2]; - } - } - } else if (which == BIAS) { - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) { - temperature->remove_bias(i,v[i]); - dtfm = dtf / mass[type[i]]; - v[i][0] += dtfm*f[i][0]; - v[i][1] += dtfm*f[i][1]; - v[i][2] += dtfm*f[i][2]; - temperature->restore_bias(i,v[i]); - } + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + dtfm = dtf / mass[type[i]]; + v[i][0] += dtfm*f[i][0]; + v[i][1] += dtfm*f[i][1]; + v[i][2] += dtfm*f[i][2]; } } } diff -Naur lammps-17Nov09/src/fix_npt_sphere.cpp lammps-18Nov09/src/fix_npt_sphere.cpp --- lammps-17Nov09/src/fix_npt_sphere.cpp 2009-06-26 12:23:16.000000000 -0600 +++ lammps-18Nov09/src/fix_npt_sphere.cpp 2009-11-17 14:18:23.000000000 -0700 @@ -122,6 +122,12 @@ } factor_rotate = exp(-dthalf*eta_dot); + // update v of atoms in group + // for BIAS: + // calculate temperature since some computes require temp + // computed on current nlocal atoms to remove bias + // OK to not test returned v = 0, since factor is multiplied by v + double **x = atom->x; double **v = atom->v; double **f = atom->f; @@ -146,7 +152,8 @@ v[i][2] = v[i][2]*factor[2] + dtfm*f[i][2]; } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { temperature->remove_bias(i,v[i]); @@ -169,7 +176,8 @@ v[i][2] = v[i][2]*factor[2] + dtfm*f[i][2]; } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { temperature->remove_bias(i,v[i]); @@ -187,7 +195,7 @@ remap(0); - // x update by full step only for atoms in group + // update x by full step for atoms in group for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { @@ -282,9 +290,13 @@ double dtfrotate = dtf / INERTIA; - // update v,omega for all particles + // update v,omega of atoms in group // d_omega/dt = torque / inertia // 8 cases depending on radius vs shape, rmass vs mass, bias vs nobias + // for BIAS: + // calculate temperature since some computes require temp + // computed on current nlocal atoms to remove bias + // OK to not test returned v = 0, since factor is multiplied by v if (radius) { if (rmass) { @@ -305,7 +317,8 @@ factor_rotate; } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { temperature->remove_bias(i,v[i]); @@ -345,8 +358,9 @@ factor_rotate; } } - } else if (which == BIAS) { + } else { for (i = 0; i < nlocal; i++) { + double tmp = temperature->compute_scalar(); if (mask[i] & groupbit) { itype = type[i]; temperature->remove_bias(i,v[i]); @@ -388,7 +402,8 @@ factor_rotate; } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { itype = type[i]; @@ -430,7 +445,8 @@ factor_rotate; } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { itype = type[i]; diff -Naur lammps-17Nov09/src/fix_nve.cpp lammps-18Nov09/src/fix_nve.cpp --- lammps-17Nov09/src/fix_nve.cpp 2009-02-12 14:36:52.000000000 -0700 +++ lammps-18Nov09/src/fix_nve.cpp 2009-11-17 14:18:23.000000000 -0700 @@ -64,6 +64,8 @@ { double dtfm; + // update v and x of atoms in group + double **x = atom->x; double **v = atom->v; double **f = atom->f; @@ -108,6 +110,8 @@ { double dtfm; + // update v of atoms in group + double **v = atom->v; double **f = atom->f; double *mass = atom->mass; diff -Naur lammps-17Nov09/src/fix_nvt.cpp lammps-18Nov09/src/fix_nvt.cpp --- lammps-17Nov09/src/fix_nvt.cpp 2009-10-30 12:14:19.000000000 -0600 +++ lammps-18Nov09/src/fix_nvt.cpp 2009-11-17 14:18:23.000000000 -0700 @@ -200,7 +200,11 @@ factor = exp(-dthalf*eta_dot); - // update v and x of only atoms in group + // update v and x of atoms in group + // for BIAS: + // calculate temperature since some computes require temp + // computed on current nlocal atoms to remove bias + // OK to not test returned v = 0, since factor is multiplied by v double **x = atom->x; double **v = atom->v; @@ -223,7 +227,8 @@ x[i][2] += dtv * v[i][2]; } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { temperature->remove_bias(i,v[i]); @@ -252,7 +257,8 @@ x[i][2] += dtv * v[i][2]; } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { temperature->remove_bias(i,v[i]); @@ -284,7 +290,11 @@ { double dtfm; - // update v of only atoms in group + // update v of atoms in group + // for BIAS: + // calculate temperature since some computes require temp + // computed on current nlocal atoms to remove bias + // OK to not test returned v = 0, since factor is multiplied by v double **v = atom->v; double **f = atom->f; @@ -307,7 +317,8 @@ v[i][2] = v[i][2]*factor + dtfm*f[i][2]; } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { temperature->remove_bias(i,v[i]); @@ -330,7 +341,8 @@ v[i][2] = v[i][2]*factor + dtfm*f[i][2]; } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { temperature->remove_bias(i,v[i]); @@ -369,19 +381,20 @@ for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { dtfm = dtf / mass[type[i]]; - v[i][0] = v[i][0] * factor; - v[i][1] = v[i][1] * factor; - v[i][2] = v[i][2] * factor; + v[i][0] *= factor; + v[i][1] *= factor; + v[i][2] *= factor; } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { temperature->remove_bias(i,v[i]); dtfm = dtf / mass[type[i]]; - v[i][0] = v[i][0] * factor; - v[i][1] = v[i][1] * factor; - v[i][2] = v[i][2] * factor; + v[i][0] *= factor; + v[i][1] *= factor; + v[i][2] *= factor; temperature->restore_bias(i,v[i]); } } @@ -392,19 +405,20 @@ for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { dtfm = dtf / mass[type[i]]; - v[i][0] = v[i][0] * factor; - v[i][1] = v[i][1] * factor; - v[i][2] = v[i][2] * factor; + v[i][0] *= factor; + v[i][1] *= factor; + v[i][2] *= factor; } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { temperature->remove_bias(i,v[i]); dtfm = dtf / mass[type[i]]; - v[i][0] = v[i][0] * factor; - v[i][1] = v[i][1] * factor; - v[i][2] = v[i][2] * factor; + v[i][0] *= factor; + v[i][1] *= factor; + v[i][2] *= factor; temperature->restore_bias(i,v[i]); } } @@ -492,7 +506,8 @@ v[i][2] = v[i][2]*factor + dtfm*f[i][2]; } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { temperature->remove_bias(i,v[i]); @@ -516,7 +531,8 @@ } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { temperature->remove_bias(i,v[i]); diff -Naur lammps-17Nov09/src/fix_nvt_sllod.cpp lammps-18Nov09/src/fix_nvt_sllod.cpp --- lammps-17Nov09/src/fix_nvt_sllod.cpp 2008-05-15 16:42:47.000000000 -0600 +++ lammps-18Nov09/src/fix_nvt_sllod.cpp 2009-11-17 14:18:23.000000000 -0700 @@ -35,7 +35,6 @@ using namespace LAMMPS_NS; enum{NO_REMAP,X_REMAP,V_REMAP}; // same as fix_deform.cpp -enum{NOBIAS,BIAS}; /* ---------------------------------------------------------------------- */ @@ -51,13 +50,17 @@ if (!temperature->tempbias) error->all("Temperature for fix nvt/sllod does not have a bias"); + nondeformbias = 0; + if (strcmp(temperature->style,"temp/deform") != 0) nondeformbias = 1; + // check fix deform remap settings int i; for (i = 0; i < modify->nfix; i++) if (strcmp(modify->fix[i]->style,"deform") == 0) { if (((FixDeform *) modify->fix[i])->remapflag != V_REMAP) - error->all("Using fix nvt/sllod with inconsistent fix deform remap option"); + error->all("Using fix nvt/sllod with inconsistent fix deform " + "remap option"); break; } if (i == modify->nfix) @@ -82,10 +85,15 @@ eta += dtv*eta_dot; factor = exp(-dthalf*eta_dot); - // update v and x of only atoms in group + // update v and x of atoms in group // remove and restore bias = streaming velocity = Hrate*lamda + Hratelo // thermostat thermal velocity only // vdelu = SLLOD correction = Hrate*Hinv*vthermal + // for non temp/deform BIAS: + // calculate temperature since some computes require temp + // computed on current nlocal atoms to remove bias + + if (nondeformbias) double tmp = temperature->compute_scalar(); double **x = atom->x; double **v = atom->v; @@ -124,10 +132,16 @@ { double dtfm; - // update v of only atoms in group + // update v of atoms in group // remove and restore bias = streaming velocity = Hrate*lamda + Hratelo // thermostat thermal velocity only // vdelu = SLLOD correction = Hrate*Hinv*vthermal + // for non temp/deform BIAS: + // calculate temperature since some computes require temp + // computed on current nlocal atoms to remove bias + // OK to not test returned v = 0, since factor is multiplied by v + + if (nondeformbias) double tmp = temperature->compute_scalar(); double **v = atom->v; double **f = atom->f; @@ -207,7 +221,9 @@ factor = exp(-dthalf*eta_dot); } else factor = 1.0; - // update v of only atoms in group + // update v of atoms in group + + if (nondeformbias) double tmp = temperature->compute_scalar(); double h_two[6],vdelu[3]; MathExtra::multiply_shape_shape(domain->h_rate,domain->h_inv,h_two); diff -Naur lammps-17Nov09/src/fix_nvt_sllod.h lammps-18Nov09/src/fix_nvt_sllod.h --- lammps-17Nov09/src/fix_nvt_sllod.h 2008-03-19 15:43:26.000000000 -0600 +++ lammps-18Nov09/src/fix_nvt_sllod.h 2009-11-17 14:18:23.000000000 -0700 @@ -25,6 +25,9 @@ void initial_integrate(int); void final_integrate(); void initial_integrate_respa(int, int, int); + + private: + int nondeformbias; }; } diff -Naur lammps-17Nov09/src/fix_nvt_sphere.cpp lammps-18Nov09/src/fix_nvt_sphere.cpp --- lammps-17Nov09/src/fix_nvt_sphere.cpp 2009-06-26 12:23:16.000000000 -0600 +++ lammps-18Nov09/src/fix_nvt_sphere.cpp 2009-11-17 14:18:23.000000000 -0700 @@ -125,9 +125,13 @@ double dtfrotate = dtf / INERTIA; - // update v,x,omega for all particles + // update v,x,omega of atoms in group // d_omega/dt = torque / inertia // 8 cases depending on radius vs shape, rmass vs mass, bias vs nobias + // for BIAS: + // calculate temperature since some computes require temp + // computed on current nlocal atoms to remove bias + // OK to not test returned v = 0, since factor is multiplied by v if (radius) { if (rmass) { @@ -148,7 +152,8 @@ omega[i][2] = omega[i][2]*factor + dtirotate*torque[i][2]; } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { temperature->remove_bias(i,v[i]); @@ -188,7 +193,8 @@ omega[i][2] = omega[i][2]*factor + dtirotate*torque[i][2]; } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { itype = type[i]; @@ -231,7 +237,8 @@ omega[i][2] = omega[i][2]*factor + dtirotate*torque[i][2]; } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { itype = type[i]; @@ -273,7 +280,8 @@ omega[i][2] = omega[i][2]*factor + dtirotate*torque[i][2]; } } - } else if (which == BIAS) { + } else { + double tmp = temperature->compute_scalar(); for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { itype = type[i]; @@ -306,7 +314,13 @@ int itype; double dtfm,dtirotate; - // update v of only atoms in group + // update v,omega of atoms in group + // d_omega/dt = torque / inertia + // 8 cases depending on radius vs shape, rmass vs mass, bias vs nobias + // for BIAS: + // calculate temperature since some computes require temp + // computed on current nlocal atoms to remove bias + // OK to not test returned v = 0, since factor is multiplied by v double **v = atom->v; double **f = atom->f; @@ -325,10 +339,6 @@ double dtfrotate = dtf / INERTIA; - // update v,omega for all particles - // d_omega/dt = torque / inertia - // 8 cases depending on radius vs shape, rmass vs mass, bias vs nobias - if (radius) { if (rmass) { if (which == NOBIAS) { @@ -346,6 +356,7 @@ } } } else { + double tmp = temperature->compute_scalar(); for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { temperature->remove_bias(i,v[i]); @@ -380,6 +391,7 @@ } } } else { + double tmp = temperature->compute_scalar(); for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { itype = type[i]; @@ -417,6 +429,7 @@ } } } else { + double tmp = temperature->compute_scalar(); for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { itype = type[i]; @@ -453,6 +466,7 @@ } } } else { + double tmp = temperature->compute_scalar(); for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { itype = type[i]; diff -Naur lammps-17Nov09/src/fix_temp_berendsen.cpp lammps-18Nov09/src/fix_temp_berendsen.cpp --- lammps-17Nov09/src/fix_temp_berendsen.cpp 2009-07-02 12:01:55.000000000 -0600 +++ lammps-18Nov09/src/fix_temp_berendsen.cpp 2009-11-17 14:18:23.000000000 -0700 @@ -109,6 +109,9 @@ t_target = t_start + delta * (t_stop-t_start); // rescale velocities by lamda + // for BIAS: + // temperature is current, so do not need to re-compute + // OK to not test returned v = 0, since lamda is multiplied by v double lamda = sqrt(1.0 + update->dt/t_period*(t_target/t_current - 1.0)); @@ -124,7 +127,7 @@ v[i][2] *= lamda; } } - } else if (which == BIAS) { + } else { for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { temperature->remove_bias(i,v[i]); diff -Naur lammps-17Nov09/src/fix_temp_rescale.cpp lammps-18Nov09/src/fix_temp_rescale.cpp --- lammps-17Nov09/src/fix_temp_rescale.cpp 2009-07-21 09:15:31.000000000 -0600 +++ lammps-18Nov09/src/fix_temp_rescale.cpp 2009-11-17 14:18:23.000000000 -0700 @@ -114,6 +114,9 @@ double t_target = t_start + delta * (t_stop-t_start); // rescale velocity of appropriate atoms if outside window + // for BIAS: + // temperature is current, so do not need to re-compute + // OK to not test returned v = 0, since factor is multiplied by v if (fabs(t_current-t_target) > t_window) { t_target = t_current - fraction*(t_current-t_target); @@ -133,8 +136,7 @@ v[i][2] *= factor; } } - - } else if (which == BIAS) { + } else { energy += (t_current-t_target) * efactor; for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { @@ -178,7 +180,6 @@ return 0; } - /* ---------------------------------------------------------------------- */ void FixTempRescale::reset_target(double t_new) diff -Naur lammps-17Nov09/src/special.cpp lammps-18Nov09/src/special.cpp --- lammps-17Nov09/src/special.cpp 2009-01-05 15:26:08.000000000 -0700 +++ lammps-18Nov09/src/special.cpp 2009-11-17 09:07:28.000000000 -0700 @@ -639,7 +639,7 @@ atom->special = memory->create_2d_int_array(atom->nmax,atom->maxspecial,"atom:special"); - atom->avec->reset_special(); + atom->avec->grow_reset(); int **special = atom->special; // ----------------------------------------------------