git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@5792 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -66,24 +66,17 @@ void AtomVecEllipsoid::grow(int n)
|
|||||||
if (nmax < 0 || nmax > MAXSMALLINT)
|
if (nmax < 0 || nmax > MAXSMALLINT)
|
||||||
error->one("Per-processor system is too big");
|
error->one("Per-processor system is too big");
|
||||||
|
|
||||||
tag = atom->tag = (int *)
|
tag = memory->grow(atom->tag,nmax,"atom:tag");
|
||||||
memory->srealloc(atom->tag,nmax*sizeof(int),"atom:tag");
|
type = memory->grow(atom->type,nmax,"atom:type");
|
||||||
type = atom->type = (int *)
|
mask = memory->grow(atom->mask,nmax,"atom:mask");
|
||||||
memory->srealloc(atom->type,nmax*sizeof(int),"atom:type");
|
image = memory->grow(atom->image,nmax,"atom:image");
|
||||||
mask = atom->mask = (int *)
|
x = memory->grow(atom->x,nmax,3,"atom:x");
|
||||||
memory->srealloc(atom->mask,nmax*sizeof(int),"atom:mask");
|
v = memory->grow(atom->v,nmax,3,"atom:v");
|
||||||
image = atom->image = (int *)
|
f = memory->grow(atom->f,nmax,3,"atom:f");
|
||||||
memory->srealloc(atom->image,nmax*sizeof(int),"atom:image");
|
|
||||||
x = atom->x = memory->grow_2d_double_array(atom->x,nmax,3,"atom:x");
|
|
||||||
v = atom->v = memory->grow_2d_double_array(atom->v,nmax,3,"atom:v");
|
|
||||||
f = atom->f = memory->grow_2d_double_array(atom->f,nmax,3,"atom:f");
|
|
||||||
|
|
||||||
quat = atom->quat =
|
quat = memory->grow(atom->quat,nmax,4,"atom:quat");
|
||||||
memory->grow_2d_double_array(atom->quat,nmax,4,"atom:quat");
|
angmom = memory->grow(atom->angmom,nmax,3,"atom:angmom");
|
||||||
angmom = atom->angmom =
|
torque = memory->grow(atom->torque,nmax,3,"atom:torque");
|
||||||
memory->grow_2d_double_array(atom->angmom,nmax,3,"atom:angmom");
|
|
||||||
torque = atom->torque =
|
|
||||||
memory->grow_2d_double_array(atom->torque,nmax,3,"atom:torque");
|
|
||||||
|
|
||||||
if (atom->nextra_grow)
|
if (atom->nextra_grow)
|
||||||
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
||||||
|
|||||||
@ -62,23 +62,17 @@ void AtomVecColloid::grow(int n)
|
|||||||
if (nmax < 0 || nmax > MAXSMALLINT)
|
if (nmax < 0 || nmax > MAXSMALLINT)
|
||||||
error->one("Per-processor system is too big");
|
error->one("Per-processor system is too big");
|
||||||
|
|
||||||
tag = atom->tag = (int *)
|
tag = memory->grow(atom->tag,nmax,"atom:tag");
|
||||||
memory->srealloc(atom->tag,nmax*sizeof(int),"atom:tag");
|
type = memory->grow(atom->type,nmax,"atom:type");
|
||||||
type = atom->type = (int *)
|
mask = memory->grow(atom->mask,nmax,"atom:mask");
|
||||||
memory->srealloc(atom->type,nmax*sizeof(int),"atom:type");
|
image = memory->grow(atom->image,nmax,"atom:image");
|
||||||
mask = atom->mask = (int *)
|
x = memory->grow(atom->x,nmax,3,"atom:x");
|
||||||
memory->srealloc(atom->mask,nmax*sizeof(int),"atom:mask");
|
v = memory->grow(atom->v,nmax,3,"atom:v");
|
||||||
image = atom->image = (int *)
|
f = memory->grow(atom->f,nmax,3,"atom:f");
|
||||||
memory->srealloc(atom->image,nmax*sizeof(int),"atom:image");
|
|
||||||
x = atom->x = memory->grow_2d_double_array(atom->x,nmax,3,"atom:x");
|
omega = memory->grow(atom->omega,nmax,3,"atom:omega");
|
||||||
v = atom->v = memory->grow_2d_double_array(atom->v,nmax,3,"atom:v");
|
torque = memory->grow(atom->torque,nmax,3,"atom:torque");
|
||||||
f = atom->f = memory->grow_2d_double_array(atom->f,nmax,3,"atom:f");
|
|
||||||
|
|
||||||
omega = atom->omega =
|
|
||||||
memory->grow_2d_double_array(atom->omega,nmax,3,"atom:omega");
|
|
||||||
torque = atom->torque =
|
|
||||||
memory->grow_2d_double_array(atom->torque,nmax,3,"atom:torque");
|
|
||||||
|
|
||||||
if (atom->nextra_grow)
|
if (atom->nextra_grow)
|
||||||
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
||||||
modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax);
|
modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax);
|
||||||
|
|||||||
@ -61,26 +61,18 @@ void AtomVecDipole::grow(int n)
|
|||||||
if (nmax < 0 || nmax > MAXSMALLINT)
|
if (nmax < 0 || nmax > MAXSMALLINT)
|
||||||
error->one("Per-processor system is too big");
|
error->one("Per-processor system is too big");
|
||||||
|
|
||||||
tag = atom->tag = (int *)
|
tag = memory->grow(atom->tag,nmax,"atom:tag");
|
||||||
memory->srealloc(atom->tag,nmax*sizeof(int),"atom:tag");
|
type = memory->grow(atom->type,nmax,"atom:type");
|
||||||
type = atom->type = (int *)
|
mask = memory->grow(atom->mask,nmax,"atom:mask");
|
||||||
memory->srealloc(atom->type,nmax*sizeof(int),"atom:type");
|
image = memory->grow(atom->image,nmax,"atom:image");
|
||||||
mask = atom->mask = (int *)
|
x = memory->grow(atom->x,nmax,3,"atom:x");
|
||||||
memory->srealloc(atom->mask,nmax*sizeof(int),"atom:mask");
|
v = memory->grow(atom->v,nmax,3,"atom:v");
|
||||||
image = atom->image = (int *)
|
f = memory->grow(atom->f,nmax,3,"atom:f");
|
||||||
memory->srealloc(atom->image,nmax*sizeof(int),"atom:image");
|
|
||||||
x = atom->x = memory->grow_2d_double_array(atom->x,nmax,3,"atom:x");
|
|
||||||
v = atom->v = memory->grow_2d_double_array(atom->v,nmax,3,"atom:v");
|
|
||||||
f = atom->f = memory->grow_2d_double_array(atom->f,nmax,3,"atom:f");
|
|
||||||
|
|
||||||
q = atom->q = (double *)
|
q = memory->grow(atom->q,nmax,"atom:q");
|
||||||
memory->srealloc(atom->q,nmax*sizeof(double),"atom:q");
|
mu = memory->grow(atom->mu,nmax,3,"atom:mu");
|
||||||
mu = atom->mu =
|
omega = memory->grow(atom->omega,nmax,3,"atom:omega");
|
||||||
memory->grow_2d_double_array(atom->mu,nmax,3,"atom:mu");
|
torque = memory->grow(atom->torque,nmax,3,"atom:torque");
|
||||||
omega = atom->omega =
|
|
||||||
memory->grow_2d_double_array(atom->omega,nmax,3,"atom:omega");
|
|
||||||
torque = atom->torque =
|
|
||||||
memory->grow_2d_double_array(atom->torque,nmax,3,"atom:torque");
|
|
||||||
|
|
||||||
if (atom->nextra_grow)
|
if (atom->nextra_grow)
|
||||||
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
||||||
|
|||||||
@ -85,29 +85,20 @@ void AtomVecGranular::grow(int n)
|
|||||||
if (nmax < 0 || nmax > MAXSMALLINT)
|
if (nmax < 0 || nmax > MAXSMALLINT)
|
||||||
error->one("Per-processor system is too big");
|
error->one("Per-processor system is too big");
|
||||||
|
|
||||||
tag = atom->tag = (int *)
|
tag = memory->grow(atom->tag,nmax,"atom:tag");
|
||||||
memory->srealloc(atom->tag,nmax*sizeof(int),"atom:tag");
|
type = memory->grow(atom->type,nmax,"atom:type");
|
||||||
type = atom->type = (int *)
|
mask = memory->grow(atom->mask,nmax,"atom:mask");
|
||||||
memory->srealloc(atom->type,nmax*sizeof(int),"atom:type");
|
image = memory->grow(atom->image,nmax,"atom:image");
|
||||||
mask = atom->mask = (int *)
|
x = memory->grow(atom->x,nmax,3,"atom:x");
|
||||||
memory->srealloc(atom->mask,nmax*sizeof(int),"atom:mask");
|
v = memory->grow(atom->v,nmax,3,"atom:v");
|
||||||
image = atom->image = (int *)
|
f = memory->grow(atom->f,nmax,3,"atom:f");
|
||||||
memory->srealloc(atom->image,nmax*sizeof(int),"atom:image");
|
|
||||||
x = atom->x = memory->grow_2d_double_array(atom->x,nmax,3,"atom:x");
|
|
||||||
v = atom->v = memory->grow_2d_double_array(atom->v,nmax,3,"atom:v");
|
|
||||||
f = atom->f = memory->grow_2d_double_array(atom->f,nmax,3,"atom:f");
|
|
||||||
|
|
||||||
radius = atom->radius = (double *)
|
radius = memory->grow(atom->radius,nmax,"atom:radius");
|
||||||
memory->srealloc(atom->radius,nmax*sizeof(double),"atom:radius");
|
density = memory->grow(atom->density,nmax,"atom:density");
|
||||||
density = atom->density = (double *)
|
rmass = memory->grow(atom->rmass,nmax,"atom:rmass");
|
||||||
memory->srealloc(atom->density,nmax*sizeof(double),"atom:density");
|
|
||||||
rmass = atom->rmass = (double *)
|
|
||||||
memory->srealloc(atom->rmass,nmax*sizeof(double),"atom:rmass");
|
|
||||||
|
|
||||||
omega = atom->omega =
|
omega = memory->grow(atom->omega,nmax,3,"atom:omega");
|
||||||
memory->grow_2d_double_array(atom->omega,nmax,3,"atom:omega");
|
torque = memory->grow(atom->torque,nmax,3,"atom:torque");
|
||||||
torque = atom->torque =
|
|
||||||
memory->grow_2d_double_array(atom->torque,nmax,3,"atom:torque");
|
|
||||||
|
|
||||||
if (atom->nextra_grow)
|
if (atom->nextra_grow)
|
||||||
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
||||||
|
|||||||
@ -63,50 +63,34 @@ void AtomVecAngle::grow(int n)
|
|||||||
if (nmax < 0 || nmax > MAXSMALLINT)
|
if (nmax < 0 || nmax > MAXSMALLINT)
|
||||||
error->one("Per-processor system is too big");
|
error->one("Per-processor system is too big");
|
||||||
|
|
||||||
tag = atom->tag = (int *)
|
tag = memory->grow(atom->tag,nmax,"atom:tag");
|
||||||
memory->srealloc(atom->tag,nmax*sizeof(int),"atom:tag");
|
type = memory->grow(atom->type,nmax,"atom:type");
|
||||||
type = atom->type = (int *)
|
mask = memory->grow(atom->mask,nmax,"atom:mask");
|
||||||
memory->srealloc(atom->type,nmax*sizeof(int),"atom:type");
|
image = memory->grow(atom->image,nmax,"atom:image");
|
||||||
mask = atom->mask = (int *)
|
x = memory->grow(atom->x,nmax,3,"atom:x");
|
||||||
memory->srealloc(atom->mask,nmax*sizeof(int),"atom:mask");
|
v = memory->grow(atom->v,nmax,3,"atom:v");
|
||||||
image = atom->image = (int *)
|
f = memory->grow(atom->f,nmax,3,"atom:f");
|
||||||
memory->srealloc(atom->image,nmax*sizeof(int),"atom:image");
|
|
||||||
x = atom->x = memory->grow_2d_double_array(atom->x,nmax,3,"atom:x");
|
|
||||||
v = atom->v = memory->grow_2d_double_array(atom->v,nmax,3,"atom:v");
|
|
||||||
f = atom->f = memory->grow_2d_double_array(atom->f,nmax,3,"atom:f");
|
|
||||||
|
|
||||||
molecule = atom->molecule = (int *)
|
molecule = memory->grow(atom->molecule,nmax,"atom:molecule");
|
||||||
memory->srealloc(atom->molecule,nmax*sizeof(int),"atom:molecule");
|
|
||||||
|
nspecial = memory->grow(atom->nspecial,nmax,3,"atom:nspecial");
|
||||||
|
special = memory->grow(atom->special,nmax,atom->maxspecial,"atom:special");
|
||||||
|
|
||||||
nspecial = atom->nspecial =
|
num_bond = memory->grow(atom->num_bond,nmax,"atom:num_bond");
|
||||||
memory->grow_2d_int_array(atom->nspecial,nmax,3,"atom:nspecial");
|
bond_type = memory->grow(atom->bond_type,nmax,atom->bond_per_atom,
|
||||||
special = atom->special =
|
"atom:bond_type");
|
||||||
memory->grow_2d_int_array(atom->special,nmax,atom->maxspecial,
|
bond_atom = memory->grow(atom->bond_atom,nmax,atom->bond_per_atom,
|
||||||
"atom:special");
|
"atom:bond_atom");
|
||||||
|
|
||||||
num_bond = atom->num_bond = (int *)
|
num_angle = memory->grow(atom->num_angle,nmax,"atom:num_angle");
|
||||||
memory->srealloc(atom->num_bond,nmax*sizeof(int),"atom:num_bond");
|
angle_type = memory->grow(atom->angle_type,nmax,atom->angle_per_atom,
|
||||||
bond_type = atom->bond_type =
|
"atom:angle_type");
|
||||||
memory->grow_2d_int_array(atom->bond_type,nmax,atom->bond_per_atom,
|
angle_atom1 = memory->grow(atom->angle_atom1,nmax,atom->angle_per_atom,
|
||||||
"atom:bond_type");
|
"atom:angle_atom1");
|
||||||
bond_atom = atom->bond_atom =
|
angle_atom2 = memory->grow(atom->angle_atom2,nmax,atom->angle_per_atom,
|
||||||
memory->grow_2d_int_array(atom->bond_atom,nmax,atom->bond_per_atom,
|
"atom:angle_atom2");
|
||||||
"atom:bond_atom");
|
angle_atom3 = memory->grow(atom->angle_atom3,nmax,atom->angle_per_atom,
|
||||||
|
"atom:angle_atom3");
|
||||||
num_angle = atom->num_angle = (int *)
|
|
||||||
memory->srealloc(atom->num_angle,nmax*sizeof(int),"atom:num_angle");
|
|
||||||
angle_type = atom->angle_type =
|
|
||||||
memory->grow_2d_int_array(atom->angle_type,nmax,atom->angle_per_atom,
|
|
||||||
"atom:angle_type");
|
|
||||||
angle_atom1 = atom->angle_atom1 =
|
|
||||||
memory->grow_2d_int_array(atom->angle_atom1,nmax,atom->angle_per_atom,
|
|
||||||
"atom:angle_atom1");
|
|
||||||
angle_atom2 = atom->angle_atom2 =
|
|
||||||
memory->grow_2d_int_array(atom->angle_atom2,nmax,atom->angle_per_atom,
|
|
||||||
"atom:angle_atom2");
|
|
||||||
angle_atom3 = atom->angle_atom3 =
|
|
||||||
memory->grow_2d_int_array(atom->angle_atom3,nmax,atom->angle_per_atom,
|
|
||||||
"atom:angle_atom3");
|
|
||||||
|
|
||||||
if (atom->nextra_grow)
|
if (atom->nextra_grow)
|
||||||
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
||||||
|
|||||||
@ -63,36 +63,25 @@ void AtomVecBond::grow(int n)
|
|||||||
if (nmax < 0 || nmax > MAXSMALLINT)
|
if (nmax < 0 || nmax > MAXSMALLINT)
|
||||||
error->one("Per-processor system is too big");
|
error->one("Per-processor system is too big");
|
||||||
|
|
||||||
tag = atom->tag = (int *)
|
tag = memory->grow(atom->tag,nmax,"atom:tag");
|
||||||
memory->srealloc(atom->tag,nmax*sizeof(int),"atom:tag");
|
type = memory->grow(atom->type,nmax,"atom:type");
|
||||||
type = atom->type = (int *)
|
mask = memory->grow(atom->mask,nmax,"atom:mask");
|
||||||
memory->srealloc(atom->type,nmax*sizeof(int),"atom:type");
|
image = memory->grow(atom->image,nmax,"atom:image");
|
||||||
mask = atom->mask = (int *)
|
x = memory->grow(atom->x,nmax,3,"atom:x");
|
||||||
memory->srealloc(atom->mask,nmax*sizeof(int),"atom:mask");
|
v = memory->grow(atom->v,nmax,3,"atom:v");
|
||||||
image = atom->image = (int *)
|
f = memory->grow(atom->f,nmax,3,"atom:f");
|
||||||
memory->srealloc(atom->image,nmax*sizeof(int),"atom:image");
|
|
||||||
x = atom->x = memory->grow_2d_double_array(atom->x,nmax,3,"atom:x");
|
|
||||||
v = atom->v = memory->grow_2d_double_array(atom->v,nmax,3,"atom:v");
|
|
||||||
f = atom->f = memory->grow_2d_double_array(atom->f,nmax,3,"atom:f");
|
|
||||||
|
|
||||||
molecule = atom->molecule = (int *)
|
molecule = memory->grow(atom->molecule,nmax,"atom:molecule");
|
||||||
memory->srealloc(atom->molecule,nmax*sizeof(int),"atom:molecule");
|
|
||||||
|
|
||||||
nspecial = atom->nspecial =
|
nspecial = memory->grow(atom->nspecial,nmax,3,"atom:nspecial");
|
||||||
memory->grow_2d_int_array(atom->nspecial,nmax,3,"atom:nspecial");
|
special = memory->grow(atom->special,nmax,atom->maxspecial,"atom:special");
|
||||||
special = atom->special =
|
|
||||||
memory->grow_2d_int_array(atom->special,nmax,atom->maxspecial,
|
|
||||||
"atom:special");
|
|
||||||
|
|
||||||
num_bond = atom->num_bond = (int *)
|
|
||||||
memory->srealloc(atom->num_bond,nmax*sizeof(int),"atom:num_bond");
|
|
||||||
bond_type = atom->bond_type =
|
|
||||||
memory->grow_2d_int_array(atom->bond_type,nmax,atom->bond_per_atom,
|
|
||||||
"atom:bond_type");
|
|
||||||
bond_atom = atom->bond_atom =
|
|
||||||
memory->grow_2d_int_array(atom->bond_atom,nmax,atom->bond_per_atom,
|
|
||||||
"atom:bond_atom");
|
|
||||||
|
|
||||||
|
num_bond = memory->grow(atom->num_bond,nmax,"atom:num_bond");
|
||||||
|
bond_type = memory->grow(atom->bond_type,nmax,atom->bond_per_atom,
|
||||||
|
"atom:bond_type");
|
||||||
|
bond_atom = memory->grow(atom->bond_atom,nmax,atom->bond_per_atom,
|
||||||
|
"atom:bond_atom");
|
||||||
|
|
||||||
if (atom->nextra_grow)
|
if (atom->nextra_grow)
|
||||||
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
||||||
modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax);
|
modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax);
|
||||||
|
|||||||
@ -63,88 +63,68 @@ void AtomVecFull::grow(int n)
|
|||||||
if (nmax < 0 || nmax > MAXSMALLINT)
|
if (nmax < 0 || nmax > MAXSMALLINT)
|
||||||
error->one("Per-processor system is too big");
|
error->one("Per-processor system is too big");
|
||||||
|
|
||||||
tag = atom->tag = (int *)
|
tag = memory->grow(atom->tag,nmax,"atom:tag");
|
||||||
memory->srealloc(atom->tag,nmax*sizeof(int),"atom:tag");
|
type = memory->grow(atom->type,nmax,"atom:type");
|
||||||
type = atom->type = (int *)
|
mask = memory->grow(atom->mask,nmax,"atom:mask");
|
||||||
memory->srealloc(atom->type,nmax*sizeof(int),"atom:type");
|
image = memory->grow(atom->image,nmax,"atom:image");
|
||||||
mask = atom->mask = (int *)
|
x = memory->grow(atom->x,nmax,3,"atom:x");
|
||||||
memory->srealloc(atom->mask,nmax*sizeof(int),"atom:mask");
|
v = memory->grow(atom->v,nmax,3,"atom:v");
|
||||||
image = atom->image = (int *)
|
f = memory->grow(atom->f,nmax,3,"atom:f");
|
||||||
memory->srealloc(atom->image,nmax*sizeof(int),"atom:image");
|
|
||||||
x = atom->x = memory->grow_2d_double_array(atom->x,nmax,3,"atom:x");
|
|
||||||
v = atom->v = memory->grow_2d_double_array(atom->v,nmax,3,"atom:v");
|
|
||||||
f = atom->f = memory->grow_2d_double_array(atom->f,nmax,3,"atom:f");
|
|
||||||
|
|
||||||
q = atom->q = (double *)
|
q = memory->grow(atom->q,nmax,"atom:q");
|
||||||
memory->srealloc(atom->q,nmax*sizeof(double),"atom:q");
|
molecule = memory->grow(atom->molecule,nmax,"atom:molecule");
|
||||||
molecule = atom->molecule = (int *)
|
|
||||||
memory->srealloc(atom->molecule,nmax*sizeof(int),"atom:molecule");
|
|
||||||
|
|
||||||
nspecial = atom->nspecial =
|
nspecial = memory->grow(atom->nspecial,nmax,3,"atom:nspecial");
|
||||||
memory->grow_2d_int_array(atom->nspecial,nmax,3,"atom:nspecial");
|
special = memory->grow(atom->special,nmax,atom->maxspecial,"atom:special");
|
||||||
special = atom->special =
|
|
||||||
memory->grow_2d_int_array(atom->special,nmax,atom->maxspecial,
|
num_bond = memory->grow(atom->num_bond,nmax,"atom:num_bond");
|
||||||
"atom:special");
|
bond_type = memory->grow(atom->bond_type,nmax,atom->bond_per_atom,
|
||||||
|
"atom:bond_type");
|
||||||
|
bond_atom = memory->grow(atom->bond_atom,nmax,atom->bond_per_atom,
|
||||||
|
"atom:bond_atom");
|
||||||
|
|
||||||
num_bond = atom->num_bond = (int *)
|
num_angle = memory->grow(atom->num_angle,nmax,"atom:num_angle");
|
||||||
memory->srealloc(atom->num_bond,nmax*sizeof(int),"atom:num_bond");
|
angle_type = memory->grow(atom->angle_type,nmax,atom->angle_per_atom,
|
||||||
bond_type = atom->bond_type =
|
"atom:angle_type");
|
||||||
memory->grow_2d_int_array(atom->bond_type,nmax,atom->bond_per_atom,
|
angle_atom1 = memory->grow(atom->angle_atom1,nmax,atom->angle_per_atom,
|
||||||
"atom:bond_type");
|
"atom:angle_atom1");
|
||||||
bond_atom = atom->bond_atom =
|
angle_atom2 = memory->grow(atom->angle_atom2,nmax,atom->angle_per_atom,
|
||||||
memory->grow_2d_int_array(atom->bond_atom,nmax,atom->bond_per_atom,
|
"atom:angle_atom2");
|
||||||
"atom:bond_atom");
|
angle_atom3 = memory->grow(atom->angle_atom3,nmax,atom->angle_per_atom,
|
||||||
|
"atom:angle_atom3");
|
||||||
|
|
||||||
|
num_dihedral = memory->grow(atom->num_dihedral,nmax,"atom:num_dihedral");
|
||||||
|
dihedral_type = memory->grow(atom->dihedral_type,nmax,
|
||||||
|
atom->dihedral_per_atom,"atom:dihedral_type");
|
||||||
|
dihedral_atom1 =
|
||||||
|
memory->grow(atom->dihedral_atom1,nmax,atom->dihedral_per_atom,
|
||||||
|
"atom:dihedral_atom1");
|
||||||
|
dihedral_atom2 =
|
||||||
|
memory->grow(atom->dihedral_atom2,nmax,atom->dihedral_per_atom,
|
||||||
|
"atom:dihedral_atom2");
|
||||||
|
dihedral_atom3 =
|
||||||
|
memory->grow(atom->dihedral_atom3,nmax,atom->dihedral_per_atom,
|
||||||
|
"atom:dihedral_atom3");
|
||||||
|
dihedral_atom4 =
|
||||||
|
memory->grow(atom->dihedral_atom4,nmax,atom->dihedral_per_atom,
|
||||||
|
"atom:dihedral_atom4");
|
||||||
|
|
||||||
num_angle = atom->num_angle = (int *)
|
num_improper = memory->grow(atom->num_improper,nmax,"atom:num_improper");
|
||||||
memory->srealloc(atom->num_angle,nmax*sizeof(int),"atom:num_angle");
|
improper_type =
|
||||||
angle_type = atom->angle_type =
|
memory->grow(atom->improper_type,nmax,atom->improper_per_atom,
|
||||||
memory->grow_2d_int_array(atom->angle_type,nmax,atom->angle_per_atom,
|
"atom:improper_type");
|
||||||
"atom:angle_type");
|
improper_atom1 =
|
||||||
angle_atom1 = atom->angle_atom1 =
|
memory->grow(atom->improper_atom1,nmax,atom->improper_per_atom,
|
||||||
memory->grow_2d_int_array(atom->angle_atom1,nmax,atom->angle_per_atom,
|
"atom:improper_atom1");
|
||||||
"atom:angle_atom1");
|
improper_atom2 =
|
||||||
angle_atom2 = atom->angle_atom2 =
|
memory->grow(atom->improper_atom2,nmax,atom->improper_per_atom,
|
||||||
memory->grow_2d_int_array(atom->angle_atom2,nmax,atom->angle_per_atom,
|
"atom:improper_atom2");
|
||||||
"atom:angle_atom2");
|
improper_atom3 =
|
||||||
angle_atom3 = atom->angle_atom3 =
|
memory->grow(atom->improper_atom3,nmax,atom->improper_per_atom,
|
||||||
memory->grow_2d_int_array(atom->angle_atom3,nmax,atom->angle_per_atom,
|
"atom:improper_atom3");
|
||||||
"atom:angle_atom3");
|
improper_atom4 =
|
||||||
|
memory->grow(atom->improper_atom4,nmax,atom->improper_per_atom,
|
||||||
num_dihedral = atom->num_dihedral = (int *)
|
"atom:improper_atom4");
|
||||||
memory->srealloc(atom->num_dihedral,nmax*sizeof(int),"atom:num_dihedral");
|
|
||||||
dihedral_type = atom->dihedral_type =
|
|
||||||
memory->grow_2d_int_array(atom->dihedral_type,nmax,atom->dihedral_per_atom,
|
|
||||||
"atom:dihedral_type");
|
|
||||||
dihedral_atom1 = atom->dihedral_atom1 =
|
|
||||||
memory->grow_2d_int_array(atom->dihedral_atom1,nmax,
|
|
||||||
atom->dihedral_per_atom,"atom:dihedral_atom1");
|
|
||||||
dihedral_atom2 = atom->dihedral_atom2 =
|
|
||||||
memory->grow_2d_int_array(atom->dihedral_atom2,nmax,
|
|
||||||
atom->dihedral_per_atom,"atom:dihedral_atom2");
|
|
||||||
dihedral_atom3 = atom->dihedral_atom3 =
|
|
||||||
memory->grow_2d_int_array(atom->dihedral_atom3,nmax,
|
|
||||||
atom->dihedral_per_atom,"atom:dihedral_atom3");
|
|
||||||
dihedral_atom4 = atom->dihedral_atom4 =
|
|
||||||
memory->grow_2d_int_array(atom->dihedral_atom4,nmax,
|
|
||||||
atom->dihedral_per_atom,"atom:dihedral_atom4");
|
|
||||||
|
|
||||||
num_improper = atom->num_improper = (int *)
|
|
||||||
memory->srealloc(atom->num_improper,nmax*sizeof(int),"atom:num_improper");
|
|
||||||
improper_type = atom->improper_type =
|
|
||||||
memory->grow_2d_int_array(atom->improper_type,nmax,atom->improper_per_atom,
|
|
||||||
"atom:improper_type");
|
|
||||||
improper_atom1 = atom->improper_atom1 =
|
|
||||||
memory->grow_2d_int_array(atom->improper_atom1,nmax,
|
|
||||||
atom->improper_per_atom,"atom:improper_atom1");
|
|
||||||
improper_atom2 = atom->improper_atom2 =
|
|
||||||
memory->grow_2d_int_array(atom->improper_atom2,nmax,
|
|
||||||
atom->improper_per_atom,"atom:improper_atom2");
|
|
||||||
improper_atom3 = atom->improper_atom3 =
|
|
||||||
memory->grow_2d_int_array(atom->improper_atom3,nmax,
|
|
||||||
atom->improper_per_atom,"atom:improper_atom3");
|
|
||||||
improper_atom4 = atom->improper_atom4 =
|
|
||||||
memory->grow_2d_int_array(atom->improper_atom4,nmax,
|
|
||||||
atom->improper_per_atom,"atom:improper_atom4");
|
|
||||||
|
|
||||||
if (atom->nextra_grow)
|
if (atom->nextra_grow)
|
||||||
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
||||||
|
|||||||
@ -63,86 +63,67 @@ void AtomVecMolecular::grow(int n)
|
|||||||
if (nmax < 0 || nmax > MAXSMALLINT)
|
if (nmax < 0 || nmax > MAXSMALLINT)
|
||||||
error->one("Per-processor system is too big");
|
error->one("Per-processor system is too big");
|
||||||
|
|
||||||
tag = atom->tag = (int *)
|
tag = memory->grow(atom->tag,nmax,"atom:tag");
|
||||||
memory->srealloc(atom->tag,nmax*sizeof(int),"atom:tag");
|
type = memory->grow(atom->type,nmax,"atom:type");
|
||||||
type = atom->type = (int *)
|
mask = memory->grow(atom->mask,nmax,"atom:mask");
|
||||||
memory->srealloc(atom->type,nmax*sizeof(int),"atom:type");
|
image = memory->grow(atom->image,nmax,"atom:image");
|
||||||
mask = atom->mask = (int *)
|
x = memory->grow(atom->x,nmax,3,"atom:x");
|
||||||
memory->srealloc(atom->mask,nmax*sizeof(int),"atom:mask");
|
v = memory->grow(atom->v,nmax,3,"atom:v");
|
||||||
image = atom->image = (int *)
|
f = memory->grow(atom->f,nmax,3,"atom:f");
|
||||||
memory->srealloc(atom->image,nmax*sizeof(int),"atom:image");
|
|
||||||
x = atom->x = memory->grow_2d_double_array(atom->x,nmax,3,"atom:x");
|
|
||||||
v = atom->v = memory->grow_2d_double_array(atom->v,nmax,3,"atom:v");
|
|
||||||
f = atom->f = memory->grow_2d_double_array(atom->f,nmax,3,"atom:f");
|
|
||||||
|
|
||||||
molecule = atom->molecule = (int *)
|
molecule = memory->grow(atom->molecule,nmax,"atom:molecule");
|
||||||
memory->srealloc(atom->molecule,nmax*sizeof(int),"atom:molecule");
|
|
||||||
|
|
||||||
nspecial = atom->nspecial =
|
nspecial = memory->grow(atom->nspecial,nmax,3,"atom:nspecial");
|
||||||
memory->grow_2d_int_array(atom->nspecial,nmax,3,"atom:nspecial");
|
special = memory->grow(atom->special,nmax,atom->maxspecial,"atom:special");
|
||||||
special = atom->special =
|
|
||||||
memory->grow_2d_int_array(atom->special,nmax,atom->maxspecial,
|
num_bond = memory->grow(atom->num_bond,nmax,"atom:num_bond");
|
||||||
"atom:special");
|
bond_type = memory->grow(atom->bond_type,nmax,atom->bond_per_atom,
|
||||||
|
"atom:bond_type");
|
||||||
|
bond_atom = memory->grow(atom->bond_atom,nmax,atom->bond_per_atom,
|
||||||
|
"atom:bond_atom");
|
||||||
|
|
||||||
num_bond = atom->num_bond = (int *)
|
num_angle = memory->grow(atom->num_angle,nmax,"atom:num_angle");
|
||||||
memory->srealloc(atom->num_bond,nmax*sizeof(int),"atom:num_bond");
|
angle_type = memory->grow(atom->angle_type,nmax,atom->angle_per_atom,
|
||||||
bond_type = atom->bond_type =
|
"atom:angle_type");
|
||||||
memory->grow_2d_int_array(atom->bond_type,nmax,atom->bond_per_atom,
|
angle_atom1 = memory->grow(atom->angle_atom1,nmax,atom->angle_per_atom,
|
||||||
"atom:bond_type");
|
"atom:angle_atom1");
|
||||||
bond_atom = atom->bond_atom =
|
angle_atom2 = memory->grow(atom->angle_atom2,nmax,atom->angle_per_atom,
|
||||||
memory->grow_2d_int_array(atom->bond_atom,nmax,atom->bond_per_atom,
|
"atom:angle_atom2");
|
||||||
"atom:bond_atom");
|
angle_atom3 = memory->grow(atom->angle_atom3,nmax,atom->angle_per_atom,
|
||||||
|
"atom:angle_atom3");
|
||||||
|
|
||||||
num_angle = atom->num_angle = (int *)
|
num_dihedral = memory->grow(atom->num_dihedral,nmax,"atom:num_dihedral");
|
||||||
memory->srealloc(atom->num_angle,nmax*sizeof(int),"atom:num_angle");
|
dihedral_type = memory->grow(atom->dihedral_type,nmax,
|
||||||
angle_type = atom->angle_type =
|
atom->dihedral_per_atom,"atom:dihedral_type");
|
||||||
memory->grow_2d_int_array(atom->angle_type,nmax,atom->angle_per_atom,
|
dihedral_atom1 =
|
||||||
"atom:angle_type");
|
memory->grow(atom->dihedral_atom1,nmax,atom->dihedral_per_atom,
|
||||||
angle_atom1 = atom->angle_atom1 =
|
"atom:dihedral_atom1");
|
||||||
memory->grow_2d_int_array(atom->angle_atom1,nmax,atom->angle_per_atom,
|
dihedral_atom2 =
|
||||||
"atom:angle_atom1");
|
memory->grow(atom->dihedral_atom2,nmax,atom->dihedral_per_atom,
|
||||||
angle_atom2 = atom->angle_atom2 =
|
"atom:dihedral_atom2");
|
||||||
memory->grow_2d_int_array(atom->angle_atom2,nmax,atom->angle_per_atom,
|
dihedral_atom3 =
|
||||||
"atom:angle_atom2");
|
memory->grow(atom->dihedral_atom3,nmax,atom->dihedral_per_atom,
|
||||||
angle_atom3 = atom->angle_atom3 =
|
"atom:dihedral_atom3");
|
||||||
memory->grow_2d_int_array(atom->angle_atom3,nmax,atom->angle_per_atom,
|
dihedral_atom4 =
|
||||||
"atom:angle_atom3");
|
memory->grow(atom->dihedral_atom4,nmax,atom->dihedral_per_atom,
|
||||||
|
"atom:dihedral_atom4");
|
||||||
|
|
||||||
num_dihedral = atom->num_dihedral = (int *)
|
num_improper = memory->grow(atom->num_improper,nmax,"atom:num_improper");
|
||||||
memory->srealloc(atom->num_dihedral,nmax*sizeof(int),"atom:num_dihedral");
|
improper_type =
|
||||||
dihedral_type = atom->dihedral_type =
|
memory->grow(atom->improper_type,nmax,atom->improper_per_atom,
|
||||||
memory->grow_2d_int_array(atom->dihedral_type,nmax,atom->dihedral_per_atom,
|
"atom:improper_type");
|
||||||
"atom:dihedral_type");
|
improper_atom1 =
|
||||||
dihedral_atom1 = atom->dihedral_atom1 =
|
memory->grow(atom->improper_atom1,nmax,atom->improper_per_atom,
|
||||||
memory->grow_2d_int_array(atom->dihedral_atom1,nmax,
|
"atom:improper_atom1");
|
||||||
atom->dihedral_per_atom,"atom:dihedral_atom1");
|
improper_atom2 =
|
||||||
dihedral_atom2 = atom->dihedral_atom2 =
|
memory->grow(atom->improper_atom2,nmax,atom->improper_per_atom,
|
||||||
memory->grow_2d_int_array(atom->dihedral_atom2,nmax,
|
"atom:improper_atom2");
|
||||||
atom->dihedral_per_atom,"atom:dihedral_atom2");
|
improper_atom3 =
|
||||||
dihedral_atom3 = atom->dihedral_atom3 =
|
memory->grow(atom->improper_atom3,nmax,atom->improper_per_atom,
|
||||||
memory->grow_2d_int_array(atom->dihedral_atom3,nmax,
|
"atom:improper_atom3");
|
||||||
atom->dihedral_per_atom,"atom:dihedral_atom3");
|
improper_atom4 =
|
||||||
dihedral_atom4 = atom->dihedral_atom4 =
|
memory->grow(atom->improper_atom4,nmax,atom->improper_per_atom,
|
||||||
memory->grow_2d_int_array(atom->dihedral_atom4,nmax,
|
"atom:improper_atom4");
|
||||||
atom->dihedral_per_atom,"atom:dihedral_atom4");
|
|
||||||
|
|
||||||
num_improper = atom->num_improper = (int *)
|
|
||||||
memory->srealloc(atom->num_improper,nmax*sizeof(int),"atom:num_improper");
|
|
||||||
improper_type = atom->improper_type =
|
|
||||||
memory->grow_2d_int_array(atom->improper_type,nmax,atom->improper_per_atom,
|
|
||||||
"atom:improper_type");
|
|
||||||
improper_atom1 = atom->improper_atom1 =
|
|
||||||
memory->grow_2d_int_array(atom->improper_atom1,nmax,
|
|
||||||
atom->improper_per_atom,"atom:improper_atom1");
|
|
||||||
improper_atom2 = atom->improper_atom2 =
|
|
||||||
memory->grow_2d_int_array(atom->improper_atom2,nmax,
|
|
||||||
atom->improper_per_atom,"atom:improper_atom2");
|
|
||||||
improper_atom3 = atom->improper_atom3 =
|
|
||||||
memory->grow_2d_int_array(atom->improper_atom3,nmax,
|
|
||||||
atom->improper_per_atom,"atom:improper_atom3");
|
|
||||||
improper_atom4 = atom->improper_atom4 =
|
|
||||||
memory->grow_2d_int_array(atom->improper_atom4,nmax,
|
|
||||||
atom->improper_per_atom,"atom:improper_atom4");
|
|
||||||
|
|
||||||
if (atom->nextra_grow)
|
if (atom->nextra_grow)
|
||||||
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
||||||
|
|||||||
@ -64,27 +64,19 @@ void AtomVecPeri::grow(int n)
|
|||||||
if (nmax < 0 || nmax > MAXSMALLINT)
|
if (nmax < 0 || nmax > MAXSMALLINT)
|
||||||
error->one("Per-processor system is too big");
|
error->one("Per-processor system is too big");
|
||||||
|
|
||||||
tag = atom->tag = (int *)
|
tag = memory->grow(atom->tag,nmax,"atom:tag");
|
||||||
memory->srealloc(atom->tag,nmax*sizeof(int),"atom:tag");
|
type = memory->grow(atom->type,nmax,"atom:type");
|
||||||
type = atom->type = (int *)
|
mask = memory->grow(atom->mask,nmax,"atom:mask");
|
||||||
memory->srealloc(atom->type,nmax*sizeof(int),"atom:type");
|
image = memory->grow(atom->image,nmax,"atom:image");
|
||||||
mask = atom->mask = (int *)
|
x = memory->grow(atom->x,nmax,3,"atom:x");
|
||||||
memory->srealloc(atom->mask,nmax*sizeof(int),"atom:mask");
|
v = memory->grow(atom->v,nmax,3,"atom:v");
|
||||||
image = atom->image = (int *)
|
f = memory->grow(atom->f,nmax,3,"atom:f");
|
||||||
memory->srealloc(atom->image,nmax*sizeof(int),"atom:image");
|
|
||||||
x = atom->x = memory->grow_2d_double_array(atom->x,nmax,3,"atom:x");
|
|
||||||
v = atom->v = memory->grow_2d_double_array(atom->v,nmax,3,"atom:v");
|
|
||||||
f = atom->f = memory->grow_2d_double_array(atom->f,nmax,3,"atom:f");
|
|
||||||
|
|
||||||
vfrac = atom->vfrac = (double *)
|
vfrac = memory->grow(atom->vfrac,nmax,"atom:vfrac");
|
||||||
memory->srealloc(atom->vfrac,nmax*sizeof(double),"atom:vfrac");
|
density = memory->grow(atom->density,nmax,"atom:density");
|
||||||
density = atom->density = (double *)
|
rmass = memory->grow(atom->rmass,nmax,"atom:rmass");
|
||||||
memory->srealloc(atom->density,nmax*sizeof(double),"atom:density");
|
s0 = memory->grow(atom->s0,nmax,"atom:s0");
|
||||||
rmass = atom->rmass = (double *)
|
x0 = memory->grow(atom->x0,nmax,3,"atom:x0");
|
||||||
memory->srealloc(atom->rmass,nmax*sizeof(double),"atom:rmass");
|
|
||||||
s0 = atom->s0 = (double *)
|
|
||||||
memory->srealloc(atom->s0,nmax*sizeof(double),"atom:s0");
|
|
||||||
x0 = atom->x0 = memory->grow_2d_double_array(atom->x0,nmax,3,"atom:x0");
|
|
||||||
|
|
||||||
if (atom->nextra_grow)
|
if (atom->nextra_grow)
|
||||||
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
||||||
|
|||||||
@ -64,30 +64,20 @@ void AtomVecElectron::grow(int n)
|
|||||||
else nmax = n;
|
else nmax = n;
|
||||||
atom->nmax = nmax;
|
atom->nmax = nmax;
|
||||||
|
|
||||||
tag = atom->tag = (int *)
|
tag = memory->grow(atom->tag,nmax,"atom:tag");
|
||||||
memory->srealloc(atom->tag,nmax*sizeof(int),"atom:tag");
|
type = memory->grow(atom->type,nmax,"atom:type");
|
||||||
type = atom->type = (int *)
|
mask = memory->grow(atom->mask,nmax,"atom:mask");
|
||||||
memory->srealloc(atom->type,nmax*sizeof(int),"atom:type");
|
image = memory->grow(atom->image,nmax,"atom:image");
|
||||||
mask = atom->mask = (int *)
|
x = memory->grow(atom->x,nmax,3,"atom:x");
|
||||||
memory->srealloc(atom->mask,nmax*sizeof(int),"atom:mask");
|
v = memory->grow(atom->v,nmax,3,"atom:v");
|
||||||
image = atom->image = (int *)
|
f = memory->grow(atom->f,nmax,3,"atom:f");
|
||||||
memory->srealloc(atom->image,nmax*sizeof(int),"atom:image");
|
|
||||||
|
q = memory->grow(atom->q,nmax,"atom:q");
|
||||||
x = atom->x = memory->grow_2d_double_array(atom->x,nmax,3,"atom:x");
|
spin = memory->grow(atom->spin,nmax,"atom:spin");
|
||||||
v = atom->v = memory->grow_2d_double_array(atom->v,nmax,3,"atom:v");
|
eradius = memory->grow(atom->eradius,nmax,"atom:eradius");
|
||||||
f = atom->f = memory->grow_2d_double_array(atom->f,nmax,3,"atom:f");
|
ervel = memory->grow(atom->ervel,nmax,"atom:ervel");
|
||||||
|
erforce = memory->grow(atom->erforce,nmax,"atom:erforce");
|
||||||
q = atom->q = (double *)
|
|
||||||
memory->srealloc(atom->q,nmax*sizeof(double),"atom:q");
|
|
||||||
spin = atom->spin = (int *)
|
|
||||||
memory->srealloc(atom->spin,nmax*sizeof(int),"atom:spin");
|
|
||||||
eradius = atom->eradius = (double *)
|
|
||||||
memory->srealloc(atom->eradius,nmax*sizeof(double),"atom:eradius");
|
|
||||||
ervel = atom->ervel = (double *)
|
|
||||||
memory->srealloc(atom->ervel,nmax*sizeof(double),"atom:ervel");
|
|
||||||
erforce = atom->erforce = (double *)
|
|
||||||
memory->srealloc(atom->erforce,nmax*sizeof(double),"atom:erforce");
|
|
||||||
|
|
||||||
if (atom->nextra_grow)
|
if (atom->nextra_grow)
|
||||||
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
||||||
modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax);
|
modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax);
|
||||||
|
|||||||
149
src/atom.cpp
149
src/atom.cpp
@ -152,83 +152,83 @@ Atom::~Atom()
|
|||||||
delete avec;
|
delete avec;
|
||||||
|
|
||||||
delete [] firstgroupname;
|
delete [] firstgroupname;
|
||||||
memory->sfree(binhead);
|
memory->destroy(binhead);
|
||||||
memory->sfree(next);
|
memory->destroy(next);
|
||||||
memory->sfree(permute);
|
memory->destroy(permute);
|
||||||
|
|
||||||
// delete atom arrays
|
// delete atom arrays
|
||||||
// customize by adding new array
|
// customize by adding new array
|
||||||
|
|
||||||
memory->sfree(tag);
|
memory->destroy(tag);
|
||||||
memory->sfree(type);
|
memory->destroy(type);
|
||||||
memory->sfree(mask);
|
memory->destroy(mask);
|
||||||
memory->sfree(image);
|
memory->destroy(image);
|
||||||
memory->destroy_2d_double_array(x);
|
memory->destroy(x);
|
||||||
memory->destroy_2d_double_array(v);
|
memory->destroy(v);
|
||||||
memory->destroy_2d_double_array(f);
|
memory->destroy(f);
|
||||||
|
|
||||||
memory->sfree(q);
|
memory->destroy(q);
|
||||||
memory->destroy_2d_double_array(mu);
|
memory->destroy(mu);
|
||||||
memory->destroy_2d_double_array(quat);
|
memory->destroy(quat);
|
||||||
memory->destroy_2d_double_array(omega);
|
memory->destroy(omega);
|
||||||
memory->destroy_2d_double_array(angmom);
|
memory->destroy(angmom);
|
||||||
memory->destroy_2d_double_array(torque);
|
memory->destroy(torque);
|
||||||
|
|
||||||
memory->sfree(radius);
|
memory->destroy(radius);
|
||||||
memory->sfree(density);
|
memory->destroy(density);
|
||||||
memory->sfree(rmass);
|
memory->destroy(rmass);
|
||||||
memory->sfree(vfrac);
|
memory->destroy(vfrac);
|
||||||
memory->sfree(s0);
|
memory->destroy(s0);
|
||||||
memory->destroy_2d_double_array(x0);
|
memory->destroy(x0);
|
||||||
|
|
||||||
memory->sfree(spin);
|
memory->destroy(spin);
|
||||||
memory->sfree(eradius);
|
memory->destroy(eradius);
|
||||||
memory->sfree(ervel);
|
memory->destroy(ervel);
|
||||||
memory->sfree(erforce);
|
memory->destroy(erforce);
|
||||||
|
|
||||||
memory->sfree(molecule);
|
memory->destroy(molecule);
|
||||||
|
|
||||||
memory->destroy_2d_int_array(nspecial);
|
memory->destroy(nspecial);
|
||||||
memory->destroy_2d_int_array(special);
|
memory->destroy(special);
|
||||||
|
|
||||||
memory->sfree(num_bond);
|
memory->destroy(num_bond);
|
||||||
memory->destroy_2d_int_array(bond_type);
|
memory->destroy(bond_type);
|
||||||
memory->destroy_2d_int_array(bond_atom);
|
memory->destroy(bond_atom);
|
||||||
|
|
||||||
memory->sfree(num_angle);
|
memory->destroy(num_angle);
|
||||||
memory->destroy_2d_int_array(angle_type);
|
memory->destroy(angle_type);
|
||||||
memory->destroy_2d_int_array(angle_atom1);
|
memory->destroy(angle_atom1);
|
||||||
memory->destroy_2d_int_array(angle_atom2);
|
memory->destroy(angle_atom2);
|
||||||
memory->destroy_2d_int_array(angle_atom3);
|
memory->destroy(angle_atom3);
|
||||||
|
|
||||||
memory->sfree(num_dihedral);
|
memory->destroy(num_dihedral);
|
||||||
memory->destroy_2d_int_array(dihedral_type);
|
memory->destroy(dihedral_type);
|
||||||
memory->destroy_2d_int_array(dihedral_atom1);
|
memory->destroy(dihedral_atom1);
|
||||||
memory->destroy_2d_int_array(dihedral_atom2);
|
memory->destroy(dihedral_atom2);
|
||||||
memory->destroy_2d_int_array(dihedral_atom3);
|
memory->destroy(dihedral_atom3);
|
||||||
memory->destroy_2d_int_array(dihedral_atom4);
|
memory->destroy(dihedral_atom4);
|
||||||
|
|
||||||
memory->sfree(num_improper);
|
memory->destroy(num_improper);
|
||||||
memory->destroy_2d_int_array(improper_type);
|
memory->destroy(improper_type);
|
||||||
memory->destroy_2d_int_array(improper_atom1);
|
memory->destroy(improper_atom1);
|
||||||
memory->destroy_2d_int_array(improper_atom2);
|
memory->destroy(improper_atom2);
|
||||||
memory->destroy_2d_int_array(improper_atom3);
|
memory->destroy(improper_atom3);
|
||||||
memory->destroy_2d_int_array(improper_atom4);
|
memory->destroy(improper_atom4);
|
||||||
|
|
||||||
// delete per-type arrays
|
// delete per-type arrays
|
||||||
|
|
||||||
delete [] mass;
|
delete [] mass;
|
||||||
delete [] mass_setflag;
|
delete [] mass_setflag;
|
||||||
memory->destroy_2d_double_array(shape);
|
memory->destroy(shape);
|
||||||
delete [] shape_setflag;
|
delete [] shape_setflag;
|
||||||
delete [] dipole;
|
delete [] dipole;
|
||||||
delete [] dipole_setflag;
|
delete [] dipole_setflag;
|
||||||
|
|
||||||
// delete extra arrays
|
// delete extra arrays
|
||||||
|
|
||||||
memory->sfree(extra_grow);
|
memory->destroy(extra_grow);
|
||||||
memory->sfree(extra_restart);
|
memory->destroy(extra_restart);
|
||||||
memory->destroy_2d_double_array(extra);
|
memory->destroy(extra);
|
||||||
|
|
||||||
// delete mapping data structures
|
// delete mapping data structures
|
||||||
|
|
||||||
@ -300,7 +300,7 @@ void Atom::init()
|
|||||||
// delete extra array since it doesn't persist past first run
|
// delete extra array since it doesn't persist past first run
|
||||||
|
|
||||||
if (nextra_store) {
|
if (nextra_store) {
|
||||||
memory->destroy_2d_double_array(extra);
|
memory->destroy(extra);
|
||||||
extra = NULL;
|
extra = NULL;
|
||||||
nextra_store = 0;
|
nextra_store = 0;
|
||||||
}
|
}
|
||||||
@ -420,8 +420,7 @@ void Atom::map_init()
|
|||||||
MPI_Allreduce(&max,&map_tag_max,1,MPI_INT,MPI_MAX,world);
|
MPI_Allreduce(&max,&map_tag_max,1,MPI_INT,MPI_MAX,world);
|
||||||
|
|
||||||
if (map_style == 1) {
|
if (map_style == 1) {
|
||||||
map_array = (int *)
|
memory->create(map_array,map_tag_max+1,"atom:map_array");
|
||||||
memory->smalloc((map_tag_max+1)*sizeof(int),"atom:map_array");
|
|
||||||
for (int i = 0; i <= map_tag_max; i++) map_array[i] = -1;
|
for (int i = 0; i <= map_tag_max; i++) map_array[i] = -1;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -605,7 +604,7 @@ void Atom::map_one(int global, int local)
|
|||||||
void Atom::map_delete()
|
void Atom::map_delete()
|
||||||
{
|
{
|
||||||
if (map_style == 1) {
|
if (map_style == 1) {
|
||||||
if (map_tag_max) memory->sfree(map_array);
|
if (map_tag_max) memory->destroy(map_array);
|
||||||
} else {
|
} else {
|
||||||
if (map_nhash) {
|
if (map_nhash) {
|
||||||
delete [] map_bucket;
|
delete [] map_bucket;
|
||||||
@ -696,20 +695,21 @@ int Atom::tag_consecutive()
|
|||||||
int Atom::count_words(const char *line)
|
int Atom::count_words(const char *line)
|
||||||
{
|
{
|
||||||
int n = strlen(line) + 1;
|
int n = strlen(line) + 1;
|
||||||
char *copy = (char *) memory->smalloc(n*sizeof(char),"copy");
|
char *copy;
|
||||||
|
memory->create(copy,n,"atom:copy");
|
||||||
strcpy(copy,line);
|
strcpy(copy,line);
|
||||||
|
|
||||||
char *ptr;
|
char *ptr;
|
||||||
if (ptr = strchr(copy,'#')) *ptr = '\0';
|
if (ptr = strchr(copy,'#')) *ptr = '\0';
|
||||||
|
|
||||||
if (strtok(copy," \t\n\r\f") == NULL) {
|
if (strtok(copy," \t\n\r\f") == NULL) {
|
||||||
memory->sfree(copy);
|
memory->destroy(copy);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
n = 1;
|
n = 1;
|
||||||
while (strtok(NULL," \t\n\r\f")) n++;
|
while (strtok(NULL," \t\n\r\f")) n++;
|
||||||
|
|
||||||
memory->sfree(copy);
|
memory->destroy(copy);
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1066,7 +1066,7 @@ void Atom::allocate_type_arrays()
|
|||||||
for (int itype = 1; itype <= ntypes; itype++) mass_setflag[itype] = 0;
|
for (int itype = 1; itype <= ntypes; itype++) mass_setflag[itype] = 0;
|
||||||
}
|
}
|
||||||
if (avec->shape_type) {
|
if (avec->shape_type) {
|
||||||
shape = memory->create_2d_double_array(ntypes+1,3,"atom:shape");
|
memory->create(shape,ntypes+1,3,"atom:shape");
|
||||||
shape_setflag = new int[ntypes+1];
|
shape_setflag = new int[ntypes+1];
|
||||||
for (int itype = 1; itype <= ntypes; itype++) shape_setflag[itype] = 0;
|
for (int itype = 1; itype <= ntypes; itype++) shape_setflag[itype] = 0;
|
||||||
}
|
}
|
||||||
@ -1365,11 +1365,11 @@ void Atom::sort()
|
|||||||
// reallocate per-atom vectors if needed
|
// reallocate per-atom vectors if needed
|
||||||
|
|
||||||
if (nlocal > maxnext) {
|
if (nlocal > maxnext) {
|
||||||
memory->sfree(next);
|
memory->destroy(next);
|
||||||
memory->sfree(permute);
|
memory->destroy(permute);
|
||||||
maxnext = atom->nmax;
|
maxnext = atom->nmax;
|
||||||
next = (int *) memory->smalloc(maxnext*sizeof(int),"atom:next");
|
memory->create(next,maxnext,"atom:next");
|
||||||
permute = (int *) memory->smalloc(maxnext*sizeof(int),"atom:permute");
|
memory->create(permute,maxnext,"atom:permute");
|
||||||
}
|
}
|
||||||
|
|
||||||
// insure there is one extra atom location at end of arrays for swaps
|
// insure there is one extra atom location at end of arrays for swaps
|
||||||
@ -1497,9 +1497,9 @@ void Atom::setup_sort_bins()
|
|||||||
// reallocate per-bin memory if needed
|
// reallocate per-bin memory if needed
|
||||||
|
|
||||||
if (nbins > maxbin) {
|
if (nbins > maxbin) {
|
||||||
memory->sfree(binhead);
|
memory->destroy(binhead);
|
||||||
maxbin = nbins;
|
maxbin = nbins;
|
||||||
binhead = (int *) memory->smalloc(maxbin*sizeof(int),"atom:binhead");
|
memory->create(binhead,maxbin,"atom:binhead");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1528,18 +1528,14 @@ void Atom::add_callback(int flag)
|
|||||||
if (flag == 0) {
|
if (flag == 0) {
|
||||||
if (nextra_grow == nextra_grow_max) {
|
if (nextra_grow == nextra_grow_max) {
|
||||||
nextra_grow_max += DELTA;
|
nextra_grow_max += DELTA;
|
||||||
extra_grow = (int *)
|
memory->grow(extra_grow,nextra_grow_max,"atom:extra_grow");
|
||||||
memory->srealloc(extra_grow,nextra_grow_max*sizeof(int),
|
|
||||||
"atom:extra_grow");
|
|
||||||
}
|
}
|
||||||
extra_grow[nextra_grow] = ifix;
|
extra_grow[nextra_grow] = ifix;
|
||||||
nextra_grow++;
|
nextra_grow++;
|
||||||
} else if (flag == 1) {
|
} else if (flag == 1) {
|
||||||
if (nextra_restart == nextra_restart_max) {
|
if (nextra_restart == nextra_restart_max) {
|
||||||
nextra_restart_max += DELTA;
|
nextra_restart_max += DELTA;
|
||||||
extra_restart = (int *)
|
memory->grow(extra_restart,nextra_restart_max,"atom:extra_restart");
|
||||||
memory->srealloc(extra_restart,nextra_restart_max*sizeof(int),
|
|
||||||
"atom:extra_restart");
|
|
||||||
}
|
}
|
||||||
extra_restart[nextra_restart] = ifix;
|
extra_restart[nextra_restart] = ifix;
|
||||||
nextra_restart++;
|
nextra_restart++;
|
||||||
@ -1619,7 +1615,7 @@ void *Atom::extract(char *name)
|
|||||||
double Atom::memory_usage()
|
double Atom::memory_usage()
|
||||||
{
|
{
|
||||||
memlength = DELTA_MEMSTR;
|
memlength = DELTA_MEMSTR;
|
||||||
memstr = (char *) memory->smalloc(memlength*sizeof(char),"atom:memstr");
|
memory->create(memstr,memlength,"atom:memstr");
|
||||||
memstr[0] = '\0';
|
memstr[0] = '\0';
|
||||||
|
|
||||||
double bytes = avec->memory_usage();
|
double bytes = avec->memory_usage();
|
||||||
@ -1630,7 +1626,7 @@ double Atom::memory_usage()
|
|||||||
bytes += map_nhash*sizeof(HashElem);
|
bytes += map_nhash*sizeof(HashElem);
|
||||||
}
|
}
|
||||||
|
|
||||||
memory->sfree(memstr);
|
memory->destroy(memstr);
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1654,8 +1650,7 @@ int Atom::memcheck(const char *str)
|
|||||||
|
|
||||||
if (strlen(memstr) + n >= memlength) {
|
if (strlen(memstr) + n >= memlength) {
|
||||||
memlength += DELTA_MEMSTR;
|
memlength += DELTA_MEMSTR;
|
||||||
memstr = (char *) memory->srealloc(memstr,memlength*sizeof(char),
|
memory->grow(memstr,memlength,"atom:memstr");
|
||||||
"atom:memstr");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
strcat(memstr,padded);
|
strcat(memstr,padded);
|
||||||
|
|||||||
@ -57,17 +57,13 @@ void AtomVecAtomic::grow(int n)
|
|||||||
if (nmax < 0 || nmax > MAXSMALLINT)
|
if (nmax < 0 || nmax > MAXSMALLINT)
|
||||||
error->one("Per-processor system is too big");
|
error->one("Per-processor system is too big");
|
||||||
|
|
||||||
tag = atom->tag = (int *)
|
tag = memory->grow(atom->tag,nmax,"atom:tag");
|
||||||
memory->srealloc(atom->tag,nmax*sizeof(int),"atom:tag");
|
type = memory->grow(atom->type,nmax,"atom:type");
|
||||||
type = atom->type = (int *)
|
mask = memory->grow(atom->mask,nmax,"atom:mask");
|
||||||
memory->srealloc(atom->type,nmax*sizeof(int),"atom:type");
|
image = memory->grow(atom->image,nmax,"atom:image");
|
||||||
mask = atom->mask = (int *)
|
x = memory->grow(atom->x,nmax,3,"atom:x");
|
||||||
memory->srealloc(atom->mask,nmax*sizeof(int),"atom:mask");
|
v = memory->grow(atom->v,nmax,3,"atom:v");
|
||||||
image = atom->image = (int *)
|
f = memory->grow(atom->f,nmax,3,"atom:f");
|
||||||
memory->srealloc(atom->image,nmax*sizeof(int),"atom:image");
|
|
||||||
x = atom->x = memory->grow_2d_double_array(atom->x,nmax,3,"atom:x");
|
|
||||||
v = atom->v = memory->grow_2d_double_array(atom->v,nmax,3,"atom:v");
|
|
||||||
f = atom->f = memory->grow_2d_double_array(atom->f,nmax,3,"atom:f");
|
|
||||||
|
|
||||||
if (atom->nextra_grow)
|
if (atom->nextra_grow)
|
||||||
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
||||||
|
|||||||
@ -59,20 +59,15 @@ void AtomVecCharge::grow(int n)
|
|||||||
if (nmax < 0 || nmax > MAXSMALLINT)
|
if (nmax < 0 || nmax > MAXSMALLINT)
|
||||||
error->one("Per-processor system is too big");
|
error->one("Per-processor system is too big");
|
||||||
|
|
||||||
tag = atom->tag = (int *)
|
tag = memory->grow(atom->tag,nmax,"atom:tag");
|
||||||
memory->srealloc(atom->tag,nmax*sizeof(int),"atom:tag");
|
type = memory->grow(atom->type,nmax,"atom:type");
|
||||||
type = atom->type = (int *)
|
mask = memory->grow(atom->mask,nmax,"atom:mask");
|
||||||
memory->srealloc(atom->type,nmax*sizeof(int),"atom:type");
|
image = memory->grow(atom->image,nmax,"atom:image");
|
||||||
mask = atom->mask = (int *)
|
x = memory->grow(atom->x,nmax,3,"atom:x");
|
||||||
memory->srealloc(atom->mask,nmax*sizeof(int),"atom:mask");
|
v = memory->grow(atom->v,nmax,3,"atom:v");
|
||||||
image = atom->image = (int *)
|
f = memory->grow(atom->f,nmax,3,"atom:f");
|
||||||
memory->srealloc(atom->image,nmax*sizeof(int),"atom:image");
|
|
||||||
x = atom->x = memory->grow_2d_double_array(atom->x,nmax,3,"atom:x");
|
|
||||||
v = atom->v = memory->grow_2d_double_array(atom->v,nmax,3,"atom:v");
|
|
||||||
f = atom->f = memory->grow_2d_double_array(atom->f,nmax,3,"atom:f");
|
|
||||||
|
|
||||||
q = atom->q = (double *)
|
q = memory->grow(atom->q,nmax,"atom:q");
|
||||||
memory->srealloc(atom->q,nmax*sizeof(double),"atom:q");
|
|
||||||
|
|
||||||
if (atom->nextra_grow)
|
if (atom->nextra_grow)
|
||||||
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
|
||||||
|
|||||||
112
src/comm.cpp
112
src/comm.cpp
@ -68,20 +68,18 @@ Comm::Comm(LAMMPS *lmp) : Pointers(lmp)
|
|||||||
// initialize comm buffers & exchange memory
|
// initialize comm buffers & exchange memory
|
||||||
|
|
||||||
maxsend = BUFMIN;
|
maxsend = BUFMIN;
|
||||||
buf_send = (double *)
|
memory->create(buf_send,maxsend+BUFEXTRA,"comm:buf_send");
|
||||||
memory->smalloc((maxsend+BUFEXTRA)*sizeof(double),"comm:buf_send");
|
|
||||||
maxrecv = BUFMIN;
|
maxrecv = BUFMIN;
|
||||||
buf_recv = (double *)
|
memory->create(buf_recv,maxrecv,"comm:buf_recv");
|
||||||
memory->smalloc(maxrecv*sizeof(double),"comm:buf_recv");
|
|
||||||
|
|
||||||
maxswap = 6;
|
maxswap = 6;
|
||||||
allocate_swap(maxswap);
|
allocate_swap(maxswap);
|
||||||
|
|
||||||
sendlist = (int **) memory->smalloc(maxswap*sizeof(int *),"sendlist");
|
sendlist = (int **) memory->smalloc(maxswap*sizeof(int *),"sendlist");
|
||||||
maxsendlist = (int *) memory->smalloc(maxswap*sizeof(int),"maxsendlist");
|
memory->create(maxsendlist,maxswap,"maxsendlist");
|
||||||
for (int i = 0; i < maxswap; i++) {
|
for (int i = 0; i < maxswap; i++) {
|
||||||
maxsendlist[i] = BUFMIN;
|
maxsendlist[i] = BUFMIN;
|
||||||
sendlist[i] = (int *) memory->smalloc(BUFMIN*sizeof(int),"sendlist[i]");
|
memory->create(sendlist[i],BUFMIN,"sendlist[i]");
|
||||||
}
|
}
|
||||||
|
|
||||||
maxforward_fix = maxreverse_fix = 0;
|
maxforward_fix = maxreverse_fix = 0;
|
||||||
@ -92,20 +90,20 @@ Comm::Comm(LAMMPS *lmp) : Pointers(lmp)
|
|||||||
|
|
||||||
Comm::~Comm()
|
Comm::~Comm()
|
||||||
{
|
{
|
||||||
if (grid2proc) memory->destroy_3d_int_array(grid2proc);
|
if (grid2proc) memory->destroy(grid2proc);
|
||||||
|
|
||||||
free_swap();
|
free_swap();
|
||||||
if (style == MULTI) {
|
if (style == MULTI) {
|
||||||
free_multi();
|
free_multi();
|
||||||
memory->destroy_2d_double_array(cutghostmulti);
|
memory->destroy(cutghostmulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
memory->sfree(maxsendlist);
|
memory->destroy(maxsendlist);
|
||||||
if (sendlist) for (int i = 0; i < maxswap; i++) memory->sfree(sendlist[i]);
|
if (sendlist) for (int i = 0; i < maxswap; i++) memory->destroy(sendlist[i]);
|
||||||
memory->sfree(sendlist);
|
memory->sfree(sendlist);
|
||||||
|
|
||||||
memory->sfree(buf_send);
|
memory->destroy(buf_send);
|
||||||
memory->sfree(buf_recv);
|
memory->destroy(buf_recv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -121,9 +119,9 @@ void Comm::set_procs()
|
|||||||
if (domain->dimension == 2 && procgrid[2] != 1)
|
if (domain->dimension == 2 && procgrid[2] != 1)
|
||||||
error->all("Processor count in z must be 1 for 2d simulation");
|
error->all("Processor count in z must be 1 for 2d simulation");
|
||||||
|
|
||||||
if (grid2proc) memory->destroy_3d_int_array(grid2proc);
|
if (grid2proc) memory->destroy(grid2proc);
|
||||||
grid2proc = memory->create_3d_int_array(procgrid[0],procgrid[1],procgrid[2],
|
memory->create(grid2proc,procgrid[0],procgrid[1],procgrid[2],
|
||||||
"comm:grid2proc");
|
"comm:grid2proc");
|
||||||
|
|
||||||
// use MPI Cartesian routines to setup 3d grid of procs
|
// use MPI Cartesian routines to setup 3d grid of procs
|
||||||
// grid2proc[i][j][k] = proc that owns i,j,k location in grid
|
// grid2proc[i][j][k] = proc that owns i,j,k location in grid
|
||||||
@ -213,12 +211,11 @@ void Comm::init()
|
|||||||
|
|
||||||
if (style == MULTI && multilo == NULL) {
|
if (style == MULTI && multilo == NULL) {
|
||||||
allocate_multi(maxswap);
|
allocate_multi(maxswap);
|
||||||
cutghostmulti =
|
memory->create(cutghostmulti,atom->ntypes+1,3,"comm:cutghostmulti");
|
||||||
memory->create_2d_double_array(atom->ntypes+1,3,"comm:cutghostmulti");
|
|
||||||
}
|
}
|
||||||
if (style == SINGLE && multilo) {
|
if (style == SINGLE && multilo) {
|
||||||
free_multi();
|
free_multi();
|
||||||
memory->destroy_2d_double_array(cutghostmulti);
|
memory->destroy(cutghostmulti);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1129,13 +1126,10 @@ void Comm::grow_send(int n, int flag)
|
|||||||
{
|
{
|
||||||
maxsend = static_cast<int> (BUFFACTOR * n);
|
maxsend = static_cast<int> (BUFFACTOR * n);
|
||||||
if (flag)
|
if (flag)
|
||||||
buf_send = (double *)
|
memory->grow(buf_send,(maxsend+BUFEXTRA),"comm:buf_send");
|
||||||
memory->srealloc(buf_send,(maxsend+BUFEXTRA)*sizeof(double),
|
|
||||||
"comm:buf_send");
|
|
||||||
else {
|
else {
|
||||||
memory->sfree(buf_send);
|
memory->destroy(buf_send);
|
||||||
buf_send = (double *) memory->smalloc((maxsend+BUFEXTRA)*sizeof(double),
|
memory->create(buf_send,maxsend+BUFEXTRA,"comm:buf_send");
|
||||||
"comm:buf_send");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1146,9 +1140,8 @@ void Comm::grow_send(int n, int flag)
|
|||||||
void Comm::grow_recv(int n)
|
void Comm::grow_recv(int n)
|
||||||
{
|
{
|
||||||
maxrecv = static_cast<int> (BUFFACTOR * n);
|
maxrecv = static_cast<int> (BUFFACTOR * n);
|
||||||
memory->sfree(buf_recv);
|
memory->destroy(buf_recv);
|
||||||
buf_recv = (double *) memory->smalloc(maxrecv*sizeof(double),
|
memory->create(buf_recv,maxrecv,"comm:buf_recv");
|
||||||
"comm:buf_recv");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -1158,9 +1151,7 @@ void Comm::grow_recv(int n)
|
|||||||
void Comm::grow_list(int iswap, int n)
|
void Comm::grow_list(int iswap, int n)
|
||||||
{
|
{
|
||||||
maxsendlist[iswap] = static_cast<int> (BUFFACTOR * n);
|
maxsendlist[iswap] = static_cast<int> (BUFFACTOR * n);
|
||||||
sendlist[iswap] = (int *)
|
memory->grow(sendlist[iswap],maxsendlist[iswap],"comm:sendlist[iswap]");
|
||||||
memory->srealloc(sendlist[iswap],maxsendlist[iswap]*sizeof(int),
|
|
||||||
"comm:sendlist[iswap]");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -1178,12 +1169,10 @@ void Comm::grow_swap(int n)
|
|||||||
|
|
||||||
sendlist = (int **)
|
sendlist = (int **)
|
||||||
memory->srealloc(sendlist,n*sizeof(int *),"comm:sendlist");
|
memory->srealloc(sendlist,n*sizeof(int *),"comm:sendlist");
|
||||||
maxsendlist = (int *)
|
memory->grow(maxsendlist,n,"comm:maxsendlist");
|
||||||
memory->srealloc(maxsendlist,n*sizeof(int),"comm:maxsendlist");
|
|
||||||
for (int i = maxswap; i < n; i++) {
|
for (int i = maxswap; i < n; i++) {
|
||||||
maxsendlist[i] = BUFMIN;
|
maxsendlist[i] = BUFMIN;
|
||||||
sendlist[i] = (int *)
|
memory->create(sendlist[i],BUFMIN,"comm:sendlist[i]");
|
||||||
memory->smalloc(BUFMIN*sizeof(int),"comm:sendlist[i]");
|
|
||||||
}
|
}
|
||||||
maxswap = n;
|
maxswap = n;
|
||||||
}
|
}
|
||||||
@ -1194,29 +1183,28 @@ void Comm::grow_swap(int n)
|
|||||||
|
|
||||||
void Comm::allocate_swap(int n)
|
void Comm::allocate_swap(int n)
|
||||||
{
|
{
|
||||||
sendnum = (int *) memory->smalloc(n*sizeof(int),"comm:sendnum");
|
memory->create(sendnum,n,"comm:sendnum");
|
||||||
recvnum = (int *) memory->smalloc(n*sizeof(int),"comm:recvnum");
|
memory->create(recvnum,n,"comm:recvnum");
|
||||||
sendproc = (int *) memory->smalloc(n*sizeof(int),"comm:sendproc");
|
memory->create(sendproc,n,"comm:sendproc");
|
||||||
recvproc = (int *) memory->smalloc(n*sizeof(int),"comm:recvproc");
|
memory->create(recvproc,n,"comm:recvproc");
|
||||||
size_forward_recv = (int *) memory->smalloc(n*sizeof(int),"comm:size");
|
memory->create(size_forward_recv,n,"comm:size");
|
||||||
size_reverse_send = (int *) memory->smalloc(n*sizeof(int),"comm:size");
|
memory->create(size_reverse_send,n,"comm:size");
|
||||||
size_reverse_recv = (int *) memory->smalloc(n*sizeof(int),"comm:size");
|
memory->create(size_reverse_recv,n,"comm:size");
|
||||||
slablo = (double *) memory->smalloc(n*sizeof(double),"comm:slablo");
|
memory->create(slablo,n,"comm:slablo");
|
||||||
slabhi = (double *) memory->smalloc(n*sizeof(double),"comm:slabhi");
|
memory->create(slabhi,n,"comm:slabhi");
|
||||||
firstrecv = (int *) memory->smalloc(n*sizeof(int),"comm:firstrecv");
|
memory->create(firstrecv,n,"comm:firstrecv");
|
||||||
pbc_flag = (int *) memory->smalloc(n*sizeof(int),"comm:pbc_flag");
|
memory->create(pbc_flag,n,"comm:pbc_flag");
|
||||||
pbc = (int **) memory->create_2d_int_array(n,6,"comm:pbc");
|
memory->create(pbc,n,6,"comm:pbc");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
allocation of multi-type swap info
|
allocation of multi-type swap info
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void Comm::allocate_multi(int n)
|
void Comm::allocate_multi(int n)
|
||||||
{
|
{
|
||||||
multilo = memory->create_2d_double_array(n,atom->ntypes+1,"comm:multilo");
|
multilo = memory->create(multilo,n,atom->ntypes+1,"comm:multilo");
|
||||||
multihi = memory->create_2d_double_array(n,atom->ntypes+1,"comm:multihi");
|
multihi = memory->create(multihi,n,atom->ntypes+1,"comm:multihi");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -1225,17 +1213,17 @@ void Comm::allocate_multi(int n)
|
|||||||
|
|
||||||
void Comm::free_swap()
|
void Comm::free_swap()
|
||||||
{
|
{
|
||||||
memory->sfree(sendnum);
|
memory->destroy(sendnum);
|
||||||
memory->sfree(recvnum);
|
memory->destroy(recvnum);
|
||||||
memory->sfree(sendproc);
|
memory->destroy(sendproc);
|
||||||
memory->sfree(recvproc);
|
memory->destroy(recvproc);
|
||||||
memory->sfree(size_forward_recv);
|
memory->destroy(size_forward_recv);
|
||||||
memory->sfree(size_reverse_send);
|
memory->destroy(size_reverse_send);
|
||||||
memory->sfree(size_reverse_recv);
|
memory->destroy(size_reverse_recv);
|
||||||
memory->sfree(slablo);
|
memory->destroy(slablo);
|
||||||
memory->sfree(slabhi);
|
memory->destroy(slabhi);
|
||||||
memory->sfree(firstrecv);
|
memory->destroy(firstrecv);
|
||||||
memory->sfree(pbc_flag);
|
memory->destroy(pbc_flag);
|
||||||
memory->destroy_2d_int_array(pbc);
|
memory->destroy_2d_int_array(pbc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1245,8 +1233,8 @@ void Comm::free_swap()
|
|||||||
|
|
||||||
void Comm::free_multi()
|
void Comm::free_multi()
|
||||||
{
|
{
|
||||||
memory->destroy_2d_double_array(multilo);
|
memory->destroy(multilo);
|
||||||
memory->destroy_2d_double_array(multihi);
|
memory->destroy(multihi);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
|
|||||||
@ -71,6 +71,51 @@ void *Memory::srealloc(void *ptr, int n, const char *name)
|
|||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
newer routines
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void *Memory::smalloc_new(bigint nbytes, const char *name)
|
||||||
|
{
|
||||||
|
if (nbytes == 0) return NULL;
|
||||||
|
|
||||||
|
void *ptr = malloc(nbytes);
|
||||||
|
if (ptr == NULL) {
|
||||||
|
char str[128];
|
||||||
|
sprintf(str,"Failed to allocate " BIGINT_FORMAT "bytes for array %s",
|
||||||
|
nbytes,name);
|
||||||
|
error->one(str);
|
||||||
|
}
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *Memory::srealloc_new(void *ptr, bigint nbytes, const char *name)
|
||||||
|
{
|
||||||
|
if (nbytes == 0) {
|
||||||
|
sfree_new(ptr);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ptr = realloc(ptr,nbytes);
|
||||||
|
if (ptr == NULL) {
|
||||||
|
char str[128];
|
||||||
|
sprintf(str,"Failed to reallocate " BIGINT_FORMAT "bytes for array %s",
|
||||||
|
nbytes,name);
|
||||||
|
error->one(str);
|
||||||
|
}
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Memory::sfree_new(void *ptr)
|
||||||
|
{
|
||||||
|
if (ptr == NULL) return;
|
||||||
|
free(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
older routines
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
create a 1d double array with index from nlo to nhi inclusive
|
create a 1d double array with index from nlo to nhi inclusive
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
@ -361,7 +406,6 @@ void Memory::destroy_3d_double_array(double ***array, int n1_offset,
|
|||||||
sfree(array + n1_offset);
|
sfree(array + n1_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
create a 3d int array
|
create a 3d int array
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|||||||
342
src/memory.h
342
src/memory.h
@ -14,6 +14,7 @@
|
|||||||
#ifndef LMP_MEMORY_H
|
#ifndef LMP_MEMORY_H
|
||||||
#define LMP_MEMORY_H
|
#define LMP_MEMORY_H
|
||||||
|
|
||||||
|
#include "lmptype.h"
|
||||||
#include "pointers.h"
|
#include "pointers.h"
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
@ -22,6 +23,8 @@ class Memory : protected Pointers {
|
|||||||
public:
|
public:
|
||||||
Memory(class LAMMPS *);
|
Memory(class LAMMPS *);
|
||||||
|
|
||||||
|
// older routines
|
||||||
|
|
||||||
void *smalloc(int n, const char *);
|
void *smalloc(int n, const char *);
|
||||||
void sfree(void *);
|
void sfree(void *);
|
||||||
void *srealloc(void *, int n, const char *);
|
void *srealloc(void *, int n, const char *);
|
||||||
@ -55,6 +58,345 @@ class Memory : protected Pointers {
|
|||||||
|
|
||||||
double ****create_4d_double_array(int, int, int, int, const char *);
|
double ****create_4d_double_array(int, int, int, int, const char *);
|
||||||
void destroy_4d_double_array(double ****);
|
void destroy_4d_double_array(double ****);
|
||||||
|
|
||||||
|
// newer routines
|
||||||
|
|
||||||
|
public:
|
||||||
|
void *smalloc_new(bigint n, const char *);
|
||||||
|
void *srealloc_new(void *, bigint n, const char *);
|
||||||
|
void sfree_new(void *);
|
||||||
|
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
NOTE: to avoid code bloat, only use these for int,double,float,char
|
||||||
|
otherwise, just use smalloc,srealloc,sfree
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
create a 1d array
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
template <typename TYPE>
|
||||||
|
TYPE *create(TYPE *&array, int n, const char *name)
|
||||||
|
{
|
||||||
|
bigint nbytes = sizeof(TYPE) * n;
|
||||||
|
array = (TYPE *) smalloc_new(nbytes,name);
|
||||||
|
return array;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
grow or shrink 1d array
|
||||||
|
if dim is 0, return NULL
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
template <typename TYPE>
|
||||||
|
TYPE *grow(TYPE *&array, int n, const char *name)
|
||||||
|
{
|
||||||
|
if (array == NULL) return create(array,n,name);
|
||||||
|
if (n == 0) {
|
||||||
|
destroy(array);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
bigint nbytes = sizeof(TYPE) * n;
|
||||||
|
array = (TYPE *) srealloc_new(array,nbytes,name);
|
||||||
|
return array;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
destroy a 1d array
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
template <typename TYPE>
|
||||||
|
void destroy(TYPE *array)
|
||||||
|
{
|
||||||
|
sfree_new(array);
|
||||||
|
};
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
create a 1d array with index from nlo to nhi inclusive
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
template <typename TYPE>
|
||||||
|
TYPE *create(TYPE *&array, int nlo, int nhi, const char *name)
|
||||||
|
{
|
||||||
|
bigint nbytes = sizeof(TYPE) * (nhi-nlo+1);
|
||||||
|
array = (TYPE *) smalloc_new(nbytes,name);
|
||||||
|
array = array-nlo;
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
destroy a 1d array with index offset
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
template <typename TYPE>
|
||||||
|
void destroy(TYPE *array, int offset)
|
||||||
|
{
|
||||||
|
if (array) sfree_new(array+offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
create a 2d array
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
template <typename TYPE>
|
||||||
|
TYPE **create(TYPE **&array, int n1, int n2, const char *name)
|
||||||
|
{
|
||||||
|
bigint nbytes = sizeof(TYPE) * n1*n2;
|
||||||
|
TYPE *data = (TYPE *) smalloc_new(nbytes,name);
|
||||||
|
nbytes = sizeof(TYPE *) * n1;
|
||||||
|
array = (TYPE **) smalloc_new(nbytes,name);
|
||||||
|
|
||||||
|
int n = 0;
|
||||||
|
for (int i = 0; i < n1; i++) {
|
||||||
|
array[i] = &data[n];
|
||||||
|
n += n2;
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
grow or shrink 1st dim of a 2d array
|
||||||
|
last dim must stay the same
|
||||||
|
if either dim is 0, destroy it and return NULL
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
template <typename TYPE>
|
||||||
|
TYPE **grow(TYPE **&array, int n1, int n2, const char *name)
|
||||||
|
{
|
||||||
|
if (array == NULL) return create(array,n1,n2,name);
|
||||||
|
if (n1 == 0 || n2 == 0) {
|
||||||
|
destroy(array);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
bigint nbytes = sizeof(TYPE) * n1*n2;
|
||||||
|
TYPE *data = (TYPE *) srealloc_new(array[0],nbytes,name);
|
||||||
|
nbytes = sizeof(TYPE *) * n1;
|
||||||
|
array = (TYPE **) srealloc_new(array,nbytes,name);
|
||||||
|
|
||||||
|
int n = 0;
|
||||||
|
for (int i = 0; i < n1; i++) {
|
||||||
|
array[i] = &data[n];
|
||||||
|
n += n2;
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
destroy a 2d array
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
template <typename TYPE>
|
||||||
|
void destroy(TYPE **array)
|
||||||
|
{
|
||||||
|
if (array == NULL) return;
|
||||||
|
sfree_new(array[0]);
|
||||||
|
sfree_new(array);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
create a 2d array with 2nd index from n2lo to n2hi inclusive
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
template <typename TYPE>
|
||||||
|
TYPE **create(TYPE **&array, int n1, int n2lo, int n2hi,
|
||||||
|
const char *name)
|
||||||
|
{
|
||||||
|
int n2 = n2hi - n2lo + 1;
|
||||||
|
create(array,n1,n2,name);
|
||||||
|
for (int i = 0; i < n1; i++) array[i] -= n2lo;
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
destroy a 2d array with 2nd index offset
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
template <typename TYPE>
|
||||||
|
void destroy(TYPE **array, int offset)
|
||||||
|
{
|
||||||
|
if (array == NULL) return;
|
||||||
|
sfree_new(&array[0][offset]);
|
||||||
|
sfree_new(array);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
create a 3d array
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
template <typename TYPE>
|
||||||
|
TYPE ***create(TYPE ***&array, int n1, int n2, int n3, const char *name)
|
||||||
|
{
|
||||||
|
bigint nbytes = sizeof(TYPE) * n1*n2*n3;
|
||||||
|
TYPE *data = (TYPE *) smalloc_new(nbytes,name);
|
||||||
|
nbytes = sizeof(TYPE *) * n1*n2;
|
||||||
|
TYPE **plane = (TYPE **) smalloc_new(nbytes,name);
|
||||||
|
nbytes = sizeof(TYPE **) * n1;
|
||||||
|
array = (TYPE ***) smalloc_new(nbytes,name);
|
||||||
|
|
||||||
|
int i,j;
|
||||||
|
int n = 0;
|
||||||
|
for (i = 0; i < n1; i++) {
|
||||||
|
array[i] = &plane[i*n2];
|
||||||
|
for (j = 0; j < n2; j++) {
|
||||||
|
plane[i*n2+j] = &data[n];
|
||||||
|
n += n3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
grow or shrink 1st dim of a 3d array
|
||||||
|
last 2 dims must stay the same
|
||||||
|
if any dim is 0, destroy it and return NULL
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
template <typename TYPE>
|
||||||
|
TYPE ***grow(TYPE ***&array, int n1, int n2, int n3, const char *name)
|
||||||
|
{
|
||||||
|
if (array == NULL) return create(array,n1,n2,n3,name);
|
||||||
|
if (n1 == 0 || n2 == 0 || n3 == 0) {
|
||||||
|
destroy(array);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
bigint nbytes = sizeof(TYPE) * n1*n2*n3;
|
||||||
|
TYPE *data = (TYPE *) srealloc_new(array[0][0],nbytes,name);
|
||||||
|
nbytes = sizeof(TYPE *) * n1*n2;
|
||||||
|
TYPE **plane = (TYPE **) srealloc_new(array[0],nbytes,name);
|
||||||
|
nbytes = sizeof(TYPE **) * n1;
|
||||||
|
array = (TYPE ***) srealloc_new(array,nbytes,name);
|
||||||
|
|
||||||
|
int i,j;
|
||||||
|
int n = 0;
|
||||||
|
for (i = 0; i < n1; i++) {
|
||||||
|
array[i] = &plane[i*n2];
|
||||||
|
for (j = 0; j < n2; j++) {
|
||||||
|
plane[i*n2+j] = &data[n];
|
||||||
|
n += n3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
destroy a 3d array
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
template <typename TYPE>
|
||||||
|
void destroy(TYPE ***array)
|
||||||
|
{
|
||||||
|
if (array == NULL) return;
|
||||||
|
sfree_new(array[0][0]);
|
||||||
|
sfree_new(array[0]);
|
||||||
|
sfree_new(array);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
create a 3d array with 1st index from n1lo to n1hi inclusive
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
template <typename TYPE>
|
||||||
|
TYPE ***create(TYPE ***&array, int n1lo, int n1hi,
|
||||||
|
int n2, int n3, const char *name)
|
||||||
|
{
|
||||||
|
int n1 = n1hi - n1lo + 1;
|
||||||
|
create(array,n1,n2,n3,name);
|
||||||
|
return array-n1lo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
free a 3d array with 1st index offset
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
template <typename TYPE>
|
||||||
|
void destroy(TYPE ***array, int offset)
|
||||||
|
{
|
||||||
|
if (array) destroy(array+offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
create a 3d array with
|
||||||
|
1st index from n1lo to n1hi inclusive,
|
||||||
|
2nd index from n2lo to n2hi inclusive,
|
||||||
|
3rd index from n3lo to n3hi inclusive
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
template <typename TYPE>
|
||||||
|
TYPE ***create(TYPE ***&array, int n1lo, int n1hi, int n2lo, int n2hi,
|
||||||
|
int n3lo, int n3hi, const char *name)
|
||||||
|
{
|
||||||
|
int n1 = n1hi - n1lo + 1;
|
||||||
|
int n2 = n2hi - n2lo + 1;
|
||||||
|
int n3 = n3hi - n3lo + 1;
|
||||||
|
create(array,n1,n2,n3,name);
|
||||||
|
|
||||||
|
for (int i = 0; i < n1*n2; i++) array[0][i] -= n3lo;
|
||||||
|
for (int i = 0; i < n1; i++) array[i] -= n2lo;
|
||||||
|
return array-n1lo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
free a 3d array with all 3 indices offset
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
template <typename TYPE>
|
||||||
|
void destroy(TYPE ***array, int n1_offset, int n2_offset, int n3_offset)
|
||||||
|
{
|
||||||
|
if (array == NULL) return;
|
||||||
|
sfree_new(&array[n1_offset][n2_offset][n3_offset]);
|
||||||
|
sfree_new(&array[n1_offset][n2_offset]);
|
||||||
|
sfree_new(array + n1_offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
create a 4d array
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
template <typename TYPE>
|
||||||
|
TYPE ****create(TYPE ****&array, int n1, int n2, int n3, int n4,
|
||||||
|
const char *name)
|
||||||
|
{
|
||||||
|
bigint nbytes = sizeof(TYPE) * n1*n2*n3*n4;
|
||||||
|
TYPE *data = (double *) smalloc_new(nbytes,name);
|
||||||
|
nbytes = sizeof(TYPE *) * n1*n2*n3;
|
||||||
|
TYPE **cube = (double **) smalloc_new(nbytes,name);
|
||||||
|
nbytes = sizeof(TYPE **) * n1*n2;
|
||||||
|
TYPE ***plane = (double ***) smalloc_new(nbytes,name);
|
||||||
|
nbytes = sizeof(TYPE ***) * n1;
|
||||||
|
array = (double ****) smalloc_new(nbytes,name);
|
||||||
|
|
||||||
|
int i,j,k;
|
||||||
|
int n = 0;
|
||||||
|
for (i = 0; i < n1; i++) {
|
||||||
|
array[i] = &plane[i*n2];
|
||||||
|
for (j = 0; j < n2; j++) {
|
||||||
|
plane[i*n2+j] = &cube[i*n2*n3+j*n3];
|
||||||
|
for (k = 0; k < n3; k++) {
|
||||||
|
cube[i*n2*n3+j*n3+k] = &data[n];
|
||||||
|
n += n4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
destroy a 4d array
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
template <typename TYPE>
|
||||||
|
void destroy(TYPE ****array)
|
||||||
|
{
|
||||||
|
if (array == NULL) return;
|
||||||
|
sfree_new(array[0][0][0]);
|
||||||
|
sfree_new(array[0][0]);
|
||||||
|
sfree_new(array[0]);
|
||||||
|
sfree_new(array);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,8 +51,7 @@ void Neighbor::bond_all()
|
|||||||
if (newton_bond || i < atom1) {
|
if (newton_bond || i < atom1) {
|
||||||
if (nbondlist == maxbond) {
|
if (nbondlist == maxbond) {
|
||||||
maxbond += BONDDELTA;
|
maxbond += BONDDELTA;
|
||||||
bondlist = memory->grow_2d_int_array(bondlist,maxbond,3,
|
memory->grow(bondlist,maxbond,3,"neighbor:bondlist");
|
||||||
"neighbor:bondlist");
|
|
||||||
}
|
}
|
||||||
bondlist[nbondlist][0] = i;
|
bondlist[nbondlist][0] = i;
|
||||||
bondlist[nbondlist][1] = atom1;
|
bondlist[nbondlist][1] = atom1;
|
||||||
@ -91,8 +90,7 @@ void Neighbor::bond_partial()
|
|||||||
if (newton_bond || i < atom1) {
|
if (newton_bond || i < atom1) {
|
||||||
if (nbondlist == maxbond) {
|
if (nbondlist == maxbond) {
|
||||||
maxbond += BONDDELTA;
|
maxbond += BONDDELTA;
|
||||||
bondlist = memory->grow_2d_int_array(bondlist,maxbond,3,
|
memory->grow(bondlist,maxbond,3,"neighbor:bondlist");
|
||||||
"neighbor:bondlist");
|
|
||||||
}
|
}
|
||||||
bondlist[nbondlist][0] = i;
|
bondlist[nbondlist][0] = i;
|
||||||
bondlist[nbondlist][1] = atom1;
|
bondlist[nbondlist][1] = atom1;
|
||||||
@ -135,8 +133,7 @@ void Neighbor::angle_all()
|
|||||||
if (newton_bond || (i <= atom1 && i <= atom2 && i <= atom3)) {
|
if (newton_bond || (i <= atom1 && i <= atom2 && i <= atom3)) {
|
||||||
if (nanglelist == maxangle) {
|
if (nanglelist == maxangle) {
|
||||||
maxangle += BONDDELTA;
|
maxangle += BONDDELTA;
|
||||||
anglelist = memory->grow_2d_int_array(anglelist,maxangle,4,
|
memory->grow(anglelist,maxangle,4,"neighbor:anglelist");
|
||||||
"neighbor:anglelist");
|
|
||||||
}
|
}
|
||||||
anglelist[nanglelist][0] = atom1;
|
anglelist[nanglelist][0] = atom1;
|
||||||
anglelist[nanglelist][1] = atom2;
|
anglelist[nanglelist][1] = atom2;
|
||||||
@ -181,8 +178,7 @@ void Neighbor::angle_partial()
|
|||||||
if (newton_bond || (i <= atom1 && i <= atom2 && i <= atom3)) {
|
if (newton_bond || (i <= atom1 && i <= atom2 && i <= atom3)) {
|
||||||
if (nanglelist == maxangle) {
|
if (nanglelist == maxangle) {
|
||||||
maxangle += BONDDELTA;
|
maxangle += BONDDELTA;
|
||||||
anglelist = memory->grow_2d_int_array(anglelist,maxangle,4,
|
memory->grow(anglelist,maxangle,4,"neighbor:anglelist");
|
||||||
"neighbor:anglelist");
|
|
||||||
}
|
}
|
||||||
anglelist[nanglelist][0] = atom1;
|
anglelist[nanglelist][0] = atom1;
|
||||||
anglelist[nanglelist][1] = atom2;
|
anglelist[nanglelist][1] = atom2;
|
||||||
@ -230,9 +226,7 @@ void Neighbor::dihedral_all()
|
|||||||
(i <= atom1 && i <= atom2 && i <= atom3 && i <= atom4)) {
|
(i <= atom1 && i <= atom2 && i <= atom3 && i <= atom4)) {
|
||||||
if (ndihedrallist == maxdihedral) {
|
if (ndihedrallist == maxdihedral) {
|
||||||
maxdihedral += BONDDELTA;
|
maxdihedral += BONDDELTA;
|
||||||
dihedrallist =
|
memory->grow(dihedrallist,maxdihedral,5,"neighbor:dihedrallist");
|
||||||
memory->grow_2d_int_array(dihedrallist,maxdihedral,5,
|
|
||||||
"neighbor:dihedrallist");
|
|
||||||
}
|
}
|
||||||
dihedrallist[ndihedrallist][0] = atom1;
|
dihedrallist[ndihedrallist][0] = atom1;
|
||||||
dihedrallist[ndihedrallist][1] = atom2;
|
dihedrallist[ndihedrallist][1] = atom2;
|
||||||
@ -282,9 +276,7 @@ void Neighbor::dihedral_partial()
|
|||||||
(i <= atom1 && i <= atom2 && i <= atom3 && i <= atom4)) {
|
(i <= atom1 && i <= atom2 && i <= atom3 && i <= atom4)) {
|
||||||
if (ndihedrallist == maxdihedral) {
|
if (ndihedrallist == maxdihedral) {
|
||||||
maxdihedral += BONDDELTA;
|
maxdihedral += BONDDELTA;
|
||||||
dihedrallist =
|
memory->grow(dihedrallist,maxdihedral,5,"neighbor:dihedrallist");
|
||||||
memory->grow_2d_int_array(dihedrallist,maxdihedral,5,
|
|
||||||
"neighbor:dihedrallist");
|
|
||||||
}
|
}
|
||||||
dihedrallist[ndihedrallist][0] = atom1;
|
dihedrallist[ndihedrallist][0] = atom1;
|
||||||
dihedrallist[ndihedrallist][1] = atom2;
|
dihedrallist[ndihedrallist][1] = atom2;
|
||||||
@ -333,9 +325,7 @@ void Neighbor::improper_all()
|
|||||||
(i <= atom1 && i <= atom2 && i <= atom3 && i <= atom4)) {
|
(i <= atom1 && i <= atom2 && i <= atom3 && i <= atom4)) {
|
||||||
if (nimproperlist == maximproper) {
|
if (nimproperlist == maximproper) {
|
||||||
maximproper += BONDDELTA;
|
maximproper += BONDDELTA;
|
||||||
improperlist =
|
memory->grow(improperlist,maximproper,5,"neighbor:improperlist");
|
||||||
memory->grow_2d_int_array(improperlist,maximproper,5,
|
|
||||||
"neighbor:improperlist");
|
|
||||||
}
|
}
|
||||||
improperlist[nimproperlist][0] = atom1;
|
improperlist[nimproperlist][0] = atom1;
|
||||||
improperlist[nimproperlist][1] = atom2;
|
improperlist[nimproperlist][1] = atom2;
|
||||||
@ -385,9 +375,7 @@ void Neighbor::improper_partial()
|
|||||||
(i <= atom1 && i <= atom2 && i <= atom3 && i <= atom4)) {
|
(i <= atom1 && i <= atom2 && i <= atom3 && i <= atom4)) {
|
||||||
if (nimproperlist == maximproper) {
|
if (nimproperlist == maximproper) {
|
||||||
maximproper += BONDDELTA;
|
maximproper += BONDDELTA;
|
||||||
improperlist =
|
memory->grow(improperlist,maximproper,5,"neighbor:improperlist");
|
||||||
memory->grow_2d_int_array(improperlist,maximproper,5,
|
|
||||||
"neighbor:improperlist");
|
|
||||||
}
|
}
|
||||||
improperlist[nimproperlist][0] = atom1;
|
improperlist[nimproperlist][0] = atom1;
|
||||||
improperlist[nimproperlist][1] = atom2;
|
improperlist[nimproperlist][1] = atom2;
|
||||||
|
|||||||
@ -70,27 +70,27 @@ NeighList::NeighList(LAMMPS *lmp, int size) : Pointers(lmp)
|
|||||||
NeighList::~NeighList()
|
NeighList::~NeighList()
|
||||||
{
|
{
|
||||||
if (!listcopy) {
|
if (!listcopy) {
|
||||||
memory->sfree(ilist);
|
memory->destroy(ilist);
|
||||||
memory->sfree(numneigh);
|
memory->destroy(numneigh);
|
||||||
memory->sfree(firstneigh);
|
memory->sfree(firstneigh);
|
||||||
memory->sfree(firstdouble);
|
memory->sfree(firstdouble);
|
||||||
|
|
||||||
for (int i = 0; i < maxpage; i++) memory->sfree(pages[i]);
|
for (int i = 0; i < maxpage; i++) memory->destroy(pages[i]);
|
||||||
memory->sfree(pages);
|
memory->sfree(pages);
|
||||||
if (dnum) {
|
if (dnum) {
|
||||||
for (int i = 0; i < maxpage; i++) memory->sfree(dpages[i]);
|
for (int i = 0; i < maxpage; i++) memory->destroy(dpages[i]);
|
||||||
memory->sfree(dpages);
|
memory->sfree(dpages);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] iskip;
|
delete [] iskip;
|
||||||
memory->destroy_2d_int_array(ijskip);
|
memory->destroy(ijskip);
|
||||||
|
|
||||||
if (maxstencil) memory->sfree(stencil);
|
if (maxstencil) memory->destroy(stencil);
|
||||||
if (maxstencil_multi) {
|
if (maxstencil_multi) {
|
||||||
for (int i = 1; i <= atom->ntypes; i++) {
|
for (int i = 1; i <= atom->ntypes; i++) {
|
||||||
memory->sfree(stencil_multi[i]);
|
memory->destroy(stencil_multi[i]);
|
||||||
memory->sfree(distsq_multi[i]);
|
memory->destroy(distsq_multi[i]);
|
||||||
}
|
}
|
||||||
delete [] nstencil_multi;
|
delete [] nstencil_multi;
|
||||||
delete [] stencil_multi;
|
delete [] stencil_multi;
|
||||||
@ -110,13 +110,11 @@ void NeighList::grow(int nmax)
|
|||||||
if (nmax <= maxlocal) return;
|
if (nmax <= maxlocal) return;
|
||||||
maxlocal = nmax;
|
maxlocal = nmax;
|
||||||
|
|
||||||
memory->sfree(ilist);
|
memory->destroy(ilist);
|
||||||
memory->sfree(numneigh);
|
memory->destroy(numneigh);
|
||||||
memory->sfree(firstneigh);
|
memory->sfree(firstneigh);
|
||||||
ilist = (int *)
|
memory->create(ilist,maxlocal,"neighlist:ilist");
|
||||||
memory->smalloc(maxlocal*sizeof(int),"neighlist:ilist");
|
memory->create(numneigh,maxlocal,"neighlist:numneigh");
|
||||||
numneigh = (int *)
|
|
||||||
memory->smalloc(maxlocal*sizeof(int),"neighlist:numneigh");
|
|
||||||
firstneigh = (int **)
|
firstneigh = (int **)
|
||||||
memory->smalloc(maxlocal*sizeof(int *),"neighlist:firstneigh");
|
memory->smalloc(maxlocal*sizeof(int *),"neighlist:firstneigh");
|
||||||
|
|
||||||
@ -137,8 +135,8 @@ void NeighList::stencil_allocate(int smax, int style)
|
|||||||
if (style == BIN) {
|
if (style == BIN) {
|
||||||
if (smax > maxstencil) {
|
if (smax > maxstencil) {
|
||||||
maxstencil = smax;
|
maxstencil = smax;
|
||||||
memory->sfree(stencil);
|
memory->destroy(stencil);
|
||||||
stencil = (int *) memory->smalloc(smax*sizeof(int),"neighlist:stencil");
|
memory->create(stencil,smax,"neighlist:stencil");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -156,12 +154,10 @@ void NeighList::stencil_allocate(int smax, int style)
|
|||||||
if (smax > maxstencil_multi) {
|
if (smax > maxstencil_multi) {
|
||||||
maxstencil_multi = smax;
|
maxstencil_multi = smax;
|
||||||
for (i = 1; i <= n; i++) {
|
for (i = 1; i <= n; i++) {
|
||||||
memory->sfree(stencil_multi[i]);
|
memory->destroy(stencil_multi[i]);
|
||||||
memory->sfree(distsq_multi[i]);
|
memory->destroy(distsq_multi[i]);
|
||||||
stencil_multi[i] = (int *)
|
memory->create(stencil_multi[i],smax,"neighlist:stencil_multi");
|
||||||
memory->smalloc(smax*sizeof(int),"neighlist:stencil_multi");
|
memory->create(distsq_multi[i],smax,"neighlist:distsq_multi");
|
||||||
distsq_multi[i] = (double *) memory->smalloc(smax*sizeof(double),
|
|
||||||
"neighlist:distsq_multi");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,15 +175,13 @@ int **NeighList::add_pages()
|
|||||||
pages = (int **)
|
pages = (int **)
|
||||||
memory->srealloc(pages,maxpage*sizeof(int *),"neighlist:pages");
|
memory->srealloc(pages,maxpage*sizeof(int *),"neighlist:pages");
|
||||||
for (int i = npage; i < maxpage; i++)
|
for (int i = npage; i < maxpage; i++)
|
||||||
pages[i] = (int *) memory->smalloc(pgsize*sizeof(int),
|
memory->create(pages[i],pgsize,"neighlist:pages[i]");
|
||||||
"neighlist:pages[i]");
|
|
||||||
|
|
||||||
if (dnum) {
|
if (dnum) {
|
||||||
dpages = (double **)
|
dpages = (double **)
|
||||||
memory->srealloc(dpages,maxpage*sizeof(double *),"neighlist:dpages");
|
memory->srealloc(dpages,maxpage*sizeof(double *),"neighlist:dpages");
|
||||||
for (int i = npage; i < maxpage; i++)
|
for (int i = npage; i < maxpage; i++)
|
||||||
dpages[i] = (double *) memory->smalloc(dnum*pgsize*sizeof(double),
|
memory->create(dpages[i],dnum*pgsize,"neighlist:dpages[i]");
|
||||||
"neighlist:dpages[i]");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return pages;
|
return pages;
|
||||||
@ -201,8 +195,7 @@ void NeighList::copy_skip_info(int *rq_iskip, int **rq_ijskip)
|
|||||||
{
|
{
|
||||||
int ntypes = atom->ntypes;
|
int ntypes = atom->ntypes;
|
||||||
iskip = new int[ntypes+1];
|
iskip = new int[ntypes+1];
|
||||||
ijskip = memory->create_2d_int_array(ntypes+1,ntypes+1,
|
memory->create(ijskip,ntypes+1,ntypes+1,"neigh_list:ijskip");
|
||||||
"neigh_list:ijskip");
|
|
||||||
int i,j;
|
int i,j;
|
||||||
for (i = 1; i <= ntypes; i++) iskip[i] = rq_iskip[i];
|
for (i = 1; i <= ntypes; i++) iskip[i] = rq_iskip[i];
|
||||||
for (i = 1; i <= ntypes; i++)
|
for (i = 1; i <= ntypes; i++)
|
||||||
|
|||||||
@ -64,7 +64,7 @@ NeighRequest::NeighRequest(LAMMPS *lmp) : Pointers(lmp)
|
|||||||
NeighRequest::~NeighRequest()
|
NeighRequest::~NeighRequest()
|
||||||
{
|
{
|
||||||
delete [] iskip;
|
delete [] iskip;
|
||||||
memory->destroy_2d_int_array(ijskip);
|
memory->destroy(ijskip);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
|
|||||||
@ -14,7 +14,6 @@
|
|||||||
#include "neighbor.h"
|
#include "neighbor.h"
|
||||||
#include "neigh_list.h"
|
#include "neigh_list.h"
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "memory.h"
|
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
|||||||
@ -138,26 +138,26 @@ Neighbor::Neighbor(LAMMPS *lmp) : Pointers(lmp)
|
|||||||
|
|
||||||
Neighbor::~Neighbor()
|
Neighbor::~Neighbor()
|
||||||
{
|
{
|
||||||
memory->destroy_2d_double_array(cutneighsq);
|
memory->destroy(cutneighsq);
|
||||||
delete [] cuttype;
|
delete [] cuttype;
|
||||||
delete [] cuttypesq;
|
delete [] cuttypesq;
|
||||||
delete [] fixchecklist;
|
delete [] fixchecklist;
|
||||||
|
|
||||||
memory->destroy_2d_double_array(xhold);
|
memory->destroy(xhold);
|
||||||
|
|
||||||
memory->sfree(binhead);
|
memory->destroy(binhead);
|
||||||
memory->sfree(bins);
|
memory->destroy(bins);
|
||||||
|
|
||||||
memory->sfree(ex1_type);
|
memory->destroy(ex1_type);
|
||||||
memory->sfree(ex2_type);
|
memory->destroy(ex2_type);
|
||||||
memory->destroy_2d_int_array(ex_type);
|
memory->destroy(ex_type);
|
||||||
|
|
||||||
memory->sfree(ex1_group);
|
memory->destroy(ex1_group);
|
||||||
memory->sfree(ex2_group);
|
memory->destroy(ex2_group);
|
||||||
delete [] ex1_bit;
|
delete [] ex1_bit;
|
||||||
delete [] ex2_bit;
|
delete [] ex2_bit;
|
||||||
|
|
||||||
memory->sfree(ex_mol_group);
|
memory->destroy(ex_mol_group);
|
||||||
delete [] ex_mol_bit;
|
delete [] ex_mol_bit;
|
||||||
|
|
||||||
for (int i = 0; i < nlist; i++) delete lists[i];
|
for (int i = 0; i < nlist; i++) delete lists[i];
|
||||||
@ -173,10 +173,10 @@ Neighbor::~Neighbor()
|
|||||||
for (int i = 0; i < old_nrequest; i++) delete old_requests[i];
|
for (int i = 0; i < old_nrequest; i++) delete old_requests[i];
|
||||||
memory->sfree(old_requests);
|
memory->sfree(old_requests);
|
||||||
|
|
||||||
memory->destroy_2d_int_array(bondlist);
|
memory->destroy(bondlist);
|
||||||
memory->destroy_2d_int_array(anglelist);
|
memory->destroy(anglelist);
|
||||||
memory->destroy_2d_int_array(dihedrallist);
|
memory->destroy(dihedrallist);
|
||||||
memory->destroy_2d_int_array(improperlist);
|
memory->destroy(improperlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -225,7 +225,7 @@ void Neighbor::init()
|
|||||||
|
|
||||||
n = atom->ntypes;
|
n = atom->ntypes;
|
||||||
if (cutneighsq == NULL) {
|
if (cutneighsq == NULL) {
|
||||||
cutneighsq = memory->create_2d_double_array(n+1,n+1,"neigh:cutneighsq");
|
memory->create(cutneighsq,n+1,n+1,"neigh:cutneighsq");
|
||||||
cuttype = new double[n+1];
|
cuttype = new double[n+1];
|
||||||
cuttypesq = new double[n+1];
|
cuttypesq = new double[n+1];
|
||||||
}
|
}
|
||||||
@ -326,14 +326,14 @@ void Neighbor::init()
|
|||||||
// free xhold and bins if not needed for this run
|
// free xhold and bins if not needed for this run
|
||||||
|
|
||||||
if (dist_check == 0) {
|
if (dist_check == 0) {
|
||||||
memory->destroy_2d_double_array(xhold);
|
memory->destroy(xhold);
|
||||||
maxhold = 0;
|
maxhold = 0;
|
||||||
xhold = NULL;
|
xhold = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (style == NSQ) {
|
if (style == NSQ) {
|
||||||
memory->sfree(bins);
|
memory->destroy(bins);
|
||||||
memory->sfree(binhead);
|
memory->destroy(binhead);
|
||||||
maxbin = maxhead = 0;
|
maxbin = maxhead = 0;
|
||||||
binhead = NULL;
|
binhead = NULL;
|
||||||
bins = NULL;
|
bins = NULL;
|
||||||
@ -344,14 +344,14 @@ void Neighbor::init()
|
|||||||
if (dist_check) {
|
if (dist_check) {
|
||||||
if (maxhold == 0) {
|
if (maxhold == 0) {
|
||||||
maxhold = atom->nmax;
|
maxhold = atom->nmax;
|
||||||
xhold = memory->create_2d_double_array(maxhold,3,"neigh:xhold");
|
memory->create(xhold,maxhold,3,"neigh:xhold");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (style != NSQ) {
|
if (style != NSQ) {
|
||||||
if (maxbin == 0) {
|
if (maxbin == 0) {
|
||||||
maxbin = atom->nmax;
|
maxbin = atom->nmax;
|
||||||
bins = (int *) memory->smalloc(maxbin*sizeof(int),"bins");
|
memory->create(bins,maxbin,"bins");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -363,8 +363,8 @@ void Neighbor::init()
|
|||||||
else exclude = 1;
|
else exclude = 1;
|
||||||
|
|
||||||
if (nex_type) {
|
if (nex_type) {
|
||||||
memory->destroy_2d_int_array(ex_type);
|
memory->destroy(ex_type);
|
||||||
ex_type = (int **) memory->create_2d_int_array(n+1,n+1,"neigh:ex_type");
|
memory->create(ex_type,n+1,n+1,"neigh:ex_type");
|
||||||
|
|
||||||
for (i = 1; i <= n; i++)
|
for (i = 1; i <= n; i++)
|
||||||
for (j = 1; j <= n; j++)
|
for (j = 1; j <= n; j++)
|
||||||
@ -647,7 +647,7 @@ void Neighbor::init()
|
|||||||
// copy current requests and style to old for next run
|
// copy current requests and style to old for next run
|
||||||
|
|
||||||
for (i = 0; i < old_nrequest; i++) delete old_requests[i];
|
for (i = 0; i < old_nrequest; i++) delete old_requests[i];
|
||||||
memory->sfree(old_requests);
|
memory->destroy(old_requests);
|
||||||
old_nrequest = nrequest;
|
old_nrequest = nrequest;
|
||||||
old_requests = requests;
|
old_requests = requests;
|
||||||
nrequest = maxrequest = 0;
|
nrequest = maxrequest = 0;
|
||||||
@ -663,29 +663,27 @@ void Neighbor::init()
|
|||||||
if (atom->molecular && atom->nbonds && maxbond == 0) {
|
if (atom->molecular && atom->nbonds && maxbond == 0) {
|
||||||
if (nprocs == 1) maxbond = atom->nbonds;
|
if (nprocs == 1) maxbond = atom->nbonds;
|
||||||
else maxbond = static_cast<int> (LB_FACTOR * atom->nbonds / nprocs);
|
else maxbond = static_cast<int> (LB_FACTOR * atom->nbonds / nprocs);
|
||||||
bondlist = memory->create_2d_int_array(maxbond,3,"neigh:bondlist");
|
memory->create(bondlist,maxbond,3,"neigh:bondlist");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (atom->molecular && atom->nangles && maxangle == 0) {
|
if (atom->molecular && atom->nangles && maxangle == 0) {
|
||||||
if (nprocs == 1) maxangle = atom->nangles;
|
if (nprocs == 1) maxangle = atom->nangles;
|
||||||
else maxangle = static_cast<int> (LB_FACTOR * atom->nangles / nprocs);
|
else maxangle = static_cast<int> (LB_FACTOR * atom->nangles / nprocs);
|
||||||
anglelist = memory->create_2d_int_array(maxangle,4,"neigh:anglelist");
|
memory->create(anglelist,maxangle,4,"neigh:anglelist");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (atom->molecular && atom->ndihedrals && maxdihedral == 0) {
|
if (atom->molecular && atom->ndihedrals && maxdihedral == 0) {
|
||||||
if (nprocs == 1) maxdihedral = atom->ndihedrals;
|
if (nprocs == 1) maxdihedral = atom->ndihedrals;
|
||||||
else maxdihedral = static_cast<int>
|
else maxdihedral = static_cast<int>
|
||||||
(LB_FACTOR * atom->ndihedrals / nprocs);
|
(LB_FACTOR * atom->ndihedrals / nprocs);
|
||||||
dihedrallist =
|
memory->create(dihedrallist,maxdihedral,5,"neigh:dihedrallist");
|
||||||
memory->create_2d_int_array(maxdihedral,5,"neigh:dihedrallist");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (atom->molecular && atom->nimpropers && maximproper == 0) {
|
if (atom->molecular && atom->nimpropers && maximproper == 0) {
|
||||||
if (nprocs == 1) maximproper = atom->nimpropers;
|
if (nprocs == 1) maximproper = atom->nimpropers;
|
||||||
else maximproper = static_cast<int>
|
else maximproper = static_cast<int>
|
||||||
(LB_FACTOR * atom->nimpropers / nprocs);
|
(LB_FACTOR * atom->nimpropers / nprocs);
|
||||||
improperlist =
|
memory->create(improperlist,maximproper,5,"neigh:improperlist");
|
||||||
memory->create_2d_int_array(maximproper,5,"neigh:improperlist");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// set flags that determine which topology neighboring routines to use
|
// set flags that determine which topology neighboring routines to use
|
||||||
@ -1093,8 +1091,8 @@ void Neighbor::build()
|
|||||||
if (includegroup) nlocal = atom->nfirst;
|
if (includegroup) nlocal = atom->nfirst;
|
||||||
if (nlocal > maxhold) {
|
if (nlocal > maxhold) {
|
||||||
maxhold = atom->nmax;
|
maxhold = atom->nmax;
|
||||||
memory->destroy_2d_double_array(xhold);
|
memory->destroy(xhold);
|
||||||
xhold = memory->create_2d_double_array(maxhold,3,"neigh:xhold");
|
memory->create(xhold,maxhold,3,"neigh:xhold");
|
||||||
}
|
}
|
||||||
for (i = 0; i < nlocal; i++) {
|
for (i = 0; i < nlocal; i++) {
|
||||||
xhold[i][0] = x[i][0];
|
xhold[i][0] = x[i][0];
|
||||||
@ -1133,8 +1131,8 @@ void Neighbor::build()
|
|||||||
|
|
||||||
if (style != NSQ && atom->nmax > maxbin) {
|
if (style != NSQ && atom->nmax > maxbin) {
|
||||||
maxbin = atom->nmax;
|
maxbin = atom->nmax;
|
||||||
memory->sfree(bins);
|
memory->destroy(bins);
|
||||||
bins = (int *) memory->smalloc(maxbin*sizeof(int),"bins");
|
memory->create(bins,maxbin,"bins");
|
||||||
}
|
}
|
||||||
|
|
||||||
// check that pairwise lists with special bond weighting will not overflow
|
// check that pairwise lists with special bond weighting will not overflow
|
||||||
@ -1179,8 +1177,8 @@ void Neighbor::build_one(int i)
|
|||||||
|
|
||||||
if (style != NSQ && atom->nmax > maxbin) {
|
if (style != NSQ && atom->nmax > maxbin) {
|
||||||
maxbin = atom->nmax;
|
maxbin = atom->nmax;
|
||||||
memory->sfree(bins);
|
memory->destroy(bins);
|
||||||
bins = (int *) memory->smalloc(maxbin*sizeof(int),"bins");
|
memory->create(bins,maxbin,"bins");
|
||||||
}
|
}
|
||||||
|
|
||||||
// this condition can cause LAMMPS to crash
|
// this condition can cause LAMMPS to crash
|
||||||
@ -1354,8 +1352,8 @@ void Neighbor::setup_bins()
|
|||||||
mbins = bbin;
|
mbins = bbin;
|
||||||
if (mbins > maxhead) {
|
if (mbins > maxhead) {
|
||||||
maxhead = mbins;
|
maxhead = mbins;
|
||||||
memory->sfree(binhead);
|
memory->destroy(binhead);
|
||||||
binhead = (int *) memory->smalloc(maxhead*sizeof(int),"neigh:binhead");
|
memory->create(binhead,maxhead,"neigh:binhead");
|
||||||
}
|
}
|
||||||
|
|
||||||
// create stencil of bins to search over in neighbor list construction
|
// create stencil of bins to search over in neighbor list construction
|
||||||
@ -1481,10 +1479,8 @@ void Neighbor::modify_params(int narg, char **arg)
|
|||||||
if (iarg+4 > narg) error->all("Illegal neigh_modify command");
|
if (iarg+4 > narg) error->all("Illegal neigh_modify command");
|
||||||
if (nex_type == maxex_type) {
|
if (nex_type == maxex_type) {
|
||||||
maxex_type += EXDELTA;
|
maxex_type += EXDELTA;
|
||||||
ex1_type = (int *) memory->srealloc(ex1_type,maxex_type*sizeof(int),
|
memory->grow(ex1_type,maxex_type,"neigh:ex1_type");
|
||||||
"neigh:ex1_type");
|
memory->grow(ex2_type,maxex_type,"neigh:ex2_type");
|
||||||
ex2_type = (int *) memory->srealloc(ex2_type,maxex_type*sizeof(int),
|
|
||||||
"neigh:ex2_type");
|
|
||||||
}
|
}
|
||||||
ex1_type[nex_type] = atoi(arg[iarg+2]);
|
ex1_type[nex_type] = atoi(arg[iarg+2]);
|
||||||
ex2_type[nex_type] = atoi(arg[iarg+3]);
|
ex2_type[nex_type] = atoi(arg[iarg+3]);
|
||||||
@ -1495,12 +1491,8 @@ void Neighbor::modify_params(int narg, char **arg)
|
|||||||
if (iarg+4 > narg) error->all("Illegal neigh_modify command");
|
if (iarg+4 > narg) error->all("Illegal neigh_modify command");
|
||||||
if (nex_group == maxex_group) {
|
if (nex_group == maxex_group) {
|
||||||
maxex_group += EXDELTA;
|
maxex_group += EXDELTA;
|
||||||
ex1_group =
|
memory->grow(ex1_group,maxex_group,"neigh:ex1_group");
|
||||||
(int *) memory->srealloc(ex1_group,maxex_group*sizeof(int),
|
memory->grow(ex2_group,maxex_group,"neigh:ex2_group");
|
||||||
"neigh:ex1_group");
|
|
||||||
ex2_group =
|
|
||||||
(int *) memory->srealloc(ex2_group,maxex_group*sizeof(int),
|
|
||||||
"neigh:ex2_group");
|
|
||||||
}
|
}
|
||||||
ex1_group[nex_group] = group->find(arg[iarg+2]);
|
ex1_group[nex_group] = group->find(arg[iarg+2]);
|
||||||
ex2_group[nex_group] = group->find(arg[iarg+3]);
|
ex2_group[nex_group] = group->find(arg[iarg+3]);
|
||||||
@ -1518,9 +1510,7 @@ void Neighbor::modify_params(int narg, char **arg)
|
|||||||
}
|
}
|
||||||
if (nex_mol == maxex_mol) {
|
if (nex_mol == maxex_mol) {
|
||||||
maxex_mol += EXDELTA;
|
maxex_mol += EXDELTA;
|
||||||
ex_mol_group =
|
memory->grow(ex_mol_group,maxex_mol,"neigh:ex_mol_group");
|
||||||
(int *) memory->srealloc(ex_mol_group,maxex_mol*sizeof(int),
|
|
||||||
"neigh:ex_mol_group");
|
|
||||||
}
|
}
|
||||||
ex_mol_group[nex_mol] = group->find(arg[iarg+2]);
|
ex_mol_group[nex_mol] = group->find(arg[iarg+2]);
|
||||||
if (ex_mol_group[nex_mol] == -1)
|
if (ex_mol_group[nex_mol] == -1)
|
||||||
|
|||||||
Reference in New Issue
Block a user