added functionity to lib interface

This commit is contained in:
Steve Plimpton
2016-12-13 16:22:17 -07:00
parent fb3f597f41
commit ae5764beac
28 changed files with 386 additions and 160 deletions

View File

@ -33,7 +33,8 @@ using namespace MathConst;
/* ---------------------------------------------------------------------- */
ComputeAngleLocal::ComputeAngleLocal(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg)
Compute(lmp, narg, arg),
vlocal(NULL), alocal(NULL)
{
if (narg < 4) error->all(FLERR,"Illegal compute angle/local command");
@ -55,14 +56,16 @@ ComputeAngleLocal::ComputeAngleLocal(LAMMPS *lmp, int narg, char **arg) :
}
nmax = 0;
vlocal = NULL;
alocal = NULL;
}
/* ---------------------------------------------------------------------- */
ComputeAngleLocal::~ComputeAngleLocal()
{
memory->destroy(vector);
memory->destroy(array);
memory->destroy(vlocal);
memory->destroy(alocal);
}
/* ---------------------------------------------------------------------- */
@ -130,12 +133,12 @@ int ComputeAngleLocal::compute_angles(int flag)
if (flag) {
if (nvalues == 1) {
if (tflag >= 0) tbuf = vector;
if (eflag >= 0) ebuf = vector;
if (tflag >= 0) tbuf = vlocal;
if (eflag >= 0) ebuf = vlocal;
} else {
if (tflag >= 0 && array) tbuf = &array[0][tflag];
if (tflag >= 0 && alocal) tbuf = &alocal[0][tflag];
else tbuf = NULL;
if (eflag >= 0 && array) ebuf = &array[0][eflag];
if (eflag >= 0 && alocal) ebuf = &alocal[0][eflag];
else ebuf = NULL;
}
}
@ -218,18 +221,18 @@ int ComputeAngleLocal::compute_angles(int flag)
void ComputeAngleLocal::reallocate(int n)
{
// grow vector or array and indices array
// grow vector_local or array_local
while (nmax < n) nmax += DELTA;
if (nvalues == 1) {
memory->destroy(vector);
memory->create(vector,nmax,"bond/local:vector");
vector_local = vector;
memory->destroy(vlocal);
memory->create(vlocal,nmax,"angle/local:vector_local");
vector_local = vlocal;
} else {
memory->destroy(array);
memory->create(array,nmax,nvalues,"bond/local:array");
array_local = array;
memory->destroy(alocal);
memory->create(alocal,nmax,nvalues,"angle/local:array_local");
array_local = alocal;
}
}