Adding alloc flag to ev_setup

This commit is contained in:
Stan Moore
2017-03-08 12:36:23 -07:00
parent 79b005dc3d
commit 683023d820
12 changed files with 72 additions and 48 deletions

View File

@ -76,7 +76,7 @@ void Angle::init()
see integrate::ev_set() for values of eflag (0-3) and vflag (0-6)
------------------------------------------------------------------------- */
void Angle::ev_setup(int eflag, int vflag)
void Angle::ev_setup(int eflag, int vflag, int alloc)
{
int i,n;
@ -94,25 +94,29 @@ void Angle::ev_setup(int eflag, int vflag)
if (eflag_atom && atom->nmax > maxeatom) {
maxeatom = atom->nmax;
if (alloc) {
memory->destroy(eatom);
memory->create(eatom,comm->nthreads*maxeatom,"angle:eatom");
}
}
if (vflag_atom && atom->nmax > maxvatom) {
maxvatom = atom->nmax;
if (alloc) {
memory->destroy(vatom);
memory->create(vatom,comm->nthreads*maxvatom,6,"angle: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++) {

View File

@ -58,7 +58,7 @@ class Angle : protected Pointers {
int vflag_either,vflag_global,vflag_atom;
int maxeatom,maxvatom;
void ev_setup(int, int);
void ev_setup(int, int, int alloc = 1);
void ev_tally(int, int, int, int, int, double, double *, double *,
double, double, double, double, double, double);
};

View File

@ -79,7 +79,7 @@ void Bond::init()
see integrate::ev_set() for values of eflag (0-3) and vflag (0-6)
------------------------------------------------------------------------- */
void Bond::ev_setup(int eflag, int vflag)
void Bond::ev_setup(int eflag, int vflag, int alloc)
{
int i,n;
@ -97,25 +97,29 @@ void Bond::ev_setup(int eflag, int vflag)
if (eflag_atom && atom->nmax > maxeatom) {
maxeatom = atom->nmax;
if (alloc) {
memory->destroy(eatom);
memory->create(eatom,comm->nthreads*maxeatom,"bond:eatom");
}
}
if (vflag_atom && atom->nmax > maxvatom) {
maxvatom = atom->nmax;
if (alloc) {
memory->destroy(vatom);
memory->create(vatom,comm->nthreads*maxvatom,6,"bond: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++) {

View File

@ -60,7 +60,7 @@ class Bond : protected Pointers {
int vflag_either,vflag_global,vflag_atom;
int maxeatom,maxvatom;
void ev_setup(int, int);
void ev_setup(int, int, int alloc = 1);
void ev_tally(int, int, int, int, double, double, double, double, double);
};

View File

@ -76,7 +76,7 @@ void Dihedral::init()
see integrate::ev_set() for values of eflag (0-3) and vflag (0-6)
------------------------------------------------------------------------- */
void Dihedral::ev_setup(int eflag, int vflag)
void Dihedral::ev_setup(int eflag, int vflag, int alloc)
{
int i,n;
@ -94,25 +94,29 @@ void Dihedral::ev_setup(int eflag, int vflag)
if (eflag_atom && atom->nmax > maxeatom) {
maxeatom = atom->nmax;
if (alloc) {
memory->destroy(eatom);
memory->create(eatom,comm->nthreads*maxeatom,"dihedral:eatom");
}
}
if (vflag_atom && atom->nmax > maxvatom) {
maxvatom = atom->nmax;
if (alloc) {
memory->destroy(vatom);
memory->create(vatom,comm->nthreads*maxvatom,6,"dihedral: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++) {

View File

@ -56,7 +56,7 @@ class Dihedral : protected Pointers {
int vflag_either,vflag_global,vflag_atom;
int maxeatom,maxvatom;
void ev_setup(int, int);
void ev_setup(int, int, int alloc = 1);
void ev_tally(int, int, int, int, int, int, double,
double *, double *, double *, double, double, double,
double, double, double, double, double, double);

View File

@ -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;
if (alloc) {
memory->destroy(eatom);
memory->create(eatom,comm->nthreads*maxeatom,"improper:eatom");
}
}
if (vflag_atom && atom->nmax > maxvatom) {
maxvatom = atom->nmax;
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++) {

View File

@ -56,7 +56,7 @@ class Improper : protected Pointers {
int vflag_either,vflag_global,vflag_atom;
int maxeatom,maxvatom;
void ev_setup(int, int);
void ev_setup(int, int, int alloc = 1);
void ev_tally(int, int, int, int, int, int, double,
double *, double *, double *, double, double, double,
double, double, double, double, double, double);

View File

@ -206,7 +206,7 @@ void KSpace::pair_check()
see integrate::ev_set() for values of eflag (0-3) and vflag (0-6)
------------------------------------------------------------------------- */
void KSpace::ev_setup(int eflag, int vflag)
void KSpace::ev_setup(int eflag, int vflag, int alloc)
{
int i,n;
@ -227,25 +227,29 @@ void KSpace::ev_setup(int eflag, int vflag)
if (eflag_atom && atom->nmax > maxeatom) {
maxeatom = atom->nmax;
if (alloc) {
memory->destroy(eatom);
memory->create(eatom,maxeatom,"kspace:eatom");
}
}
if (vflag_atom && atom->nmax > maxvatom) {
maxvatom = atom->nmax;
if (alloc) {
memory->destroy(vatom);
memory->create(vatom,maxvatom,6,"kspace: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 (tip4pflag) n += atom->nghost;
for (i = 0; i < n; i++) eatom[i] = 0.0;
}
if (vflag_atom) {
if (vflag_atom && alloc) {
n = atom->nlocal;
if (tip4pflag) n += atom->nghost;
for (i = 0; i < n; i++) {

View File

@ -197,7 +197,7 @@ class KSpace : protected Pointers {
int kx_ewald,ky_ewald,kz_ewald; // kspace settings for Ewald sum
void pair_check();
void ev_setup(int, int);
void ev_setup(int, int, int alloc = 1);
double estimate_table_accuracy(double, double);
};

View File

@ -749,7 +749,7 @@ void Pair::del_tally_callback(Compute *ptr)
see integrate::ev_set() for values of eflag (0-3) and vflag (0-6)
------------------------------------------------------------------------- */
void Pair::ev_setup(int eflag, int vflag)
void Pair::ev_setup(int eflag, int vflag, int alloc)
{
int i,n;
@ -767,14 +767,18 @@ void Pair::ev_setup(int eflag, int vflag)
if (eflag_atom && atom->nmax > maxeatom) {
maxeatom = atom->nmax;
if (alloc) {
memory->destroy(eatom);
memory->create(eatom,comm->nthreads*maxeatom,"pair:eatom");
}
}
if (vflag_atom && atom->nmax > maxvatom) {
maxvatom = atom->nmax;
if (alloc) {
memory->destroy(vatom);
memory->create(vatom,comm->nthreads*maxvatom,6,"pair:vatom");
}
}
// zero accumulators
// use force->newton instead of newton_pair
@ -782,12 +786,12 @@ void Pair::ev_setup(int eflag, int vflag)
if (eflag_global) eng_vdwl = eng_coul = 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) 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) n += atom->nghost;
for (i = 0; i < n; i++) {

View File

@ -221,7 +221,7 @@ class Pair : protected Pointers {
int copymode; // if set, do not deallocate during destruction
// required when classes are used as functors by Kokkos
virtual void ev_setup(int, int);
virtual void ev_setup(int, int, int alloc = 1);
void ev_unset();
void ev_tally_full(int, double, double, double, double, double, double);
void ev_tally_xyz_full(int, double, double,