diff --git a/src/atom.cpp b/src/atom.cpp index 6578016208..099a5098e6 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -270,6 +270,8 @@ void Atom::create_avec(const char *style, int narg, char **arg, char *suffix) vfrac_flag = spin_flag = eradius_flag = ervel_flag = erforce_flag = 0; // create instance of AtomVec + // use grow to initialize atom-based arrays to length 1 + // so that x[0][0] can be referenced even if proc has no atoms int sflag; avec = new_avec(style,suffix,sflag); diff --git a/src/lammps.cpp b/src/lammps.cpp index 97376a4951..d191d0c278 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -449,7 +449,7 @@ LAMMPS::~LAMMPS() void LAMMPS::create() { - // Comm class must be created before Atom + // Comm class must be created before Atom class // so that nthreads is defined when create_avec invokes grow() if (cuda) comm = new CommCuda(this); diff --git a/src/respa.cpp b/src/respa.cpp index 3e08f505d2..b07228134e 100644 --- a/src/respa.cpp +++ b/src/respa.cpp @@ -560,6 +560,11 @@ void Respa::recurse(int ilevel) timer->stamp(TIME_COMM); } + // force computations + // important that ordering is same as Verlet + // so that any order dependencies are the same + // when potentials are invoked at same level + force_clear(newton[ilevel]); if (modify->n_pre_force_respa) modify->pre_force_respa(vflag,ilevel,iloop); diff --git a/src/verlet.cpp b/src/verlet.cpp index 8e1bccc362..db47a675c6 100644 --- a/src/verlet.cpp +++ b/src/verlet.cpp @@ -263,6 +263,9 @@ void Verlet::run(int n) } // force computations + // important for pair to come before bonded contributions + // since some bonded potentials tally pairwise energy/virial + // and Pair:ev_tally() needs to be called before any tallying force_clear(); if (n_pre_force) modify->pre_force(vflag);