Adding alloc flag to ev_setup
This commit is contained in:
@ -74,7 +74,7 @@ void Improper::init()
|
||||
see integrate::ev_set() for values of eflag (0-3) and vflag (0-6)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Improper::ev_setup(int eflag, int vflag)
|
||||
void Improper::ev_setup(int eflag, int vflag, int alloc)
|
||||
{
|
||||
int i,n;
|
||||
|
||||
@ -92,25 +92,29 @@ void Improper::ev_setup(int eflag, int vflag)
|
||||
|
||||
if (eflag_atom && atom->nmax > maxeatom) {
|
||||
maxeatom = atom->nmax;
|
||||
memory->destroy(eatom);
|
||||
memory->create(eatom,comm->nthreads*maxeatom,"improper:eatom");
|
||||
if (alloc) {
|
||||
memory->destroy(eatom);
|
||||
memory->create(eatom,comm->nthreads*maxeatom,"improper:eatom");
|
||||
}
|
||||
}
|
||||
if (vflag_atom && atom->nmax > maxvatom) {
|
||||
maxvatom = atom->nmax;
|
||||
memory->destroy(vatom);
|
||||
memory->create(vatom,comm->nthreads*maxvatom,6,"improper:vatom");
|
||||
if (alloc) {
|
||||
memory->destroy(vatom);
|
||||
memory->create(vatom,comm->nthreads*maxvatom,6,"improper:vatom");
|
||||
}
|
||||
}
|
||||
|
||||
// zero accumulators
|
||||
|
||||
if (eflag_global) energy = 0.0;
|
||||
if (vflag_global) for (i = 0; i < 6; i++) virial[i] = 0.0;
|
||||
if (eflag_atom) {
|
||||
if (eflag_atom && alloc) {
|
||||
n = atom->nlocal;
|
||||
if (force->newton_bond) n += atom->nghost;
|
||||
for (i = 0; i < n; i++) eatom[i] = 0.0;
|
||||
}
|
||||
if (vflag_atom) {
|
||||
if (vflag_atom && alloc) {
|
||||
n = atom->nlocal;
|
||||
if (force->newton_bond) n += atom->nghost;
|
||||
for (i = 0; i < n; i++) {
|
||||
|
||||
Reference in New Issue
Block a user