git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@3508 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2009-12-04 21:03:54 +00:00
parent 39edb1a6c2
commit 97cfbf8fb4
57 changed files with 272 additions and 232 deletions

View File

@ -34,7 +34,7 @@ FixFreeze::FixFreeze(LAMMPS *lmp, int narg, char **arg) :
vector_flag = 1;
size_vector = 3;
scalar_vector_freq = 1;
global_freq = 1;
extvector = 1;
force_flag = 0;

View File

@ -48,7 +48,7 @@ FixBondBreak::FixBondBreak(LAMMPS *lmp, int narg, char **arg) :
next_reneighbor = -1;
vector_flag = 1;
size_vector = 2;
scalar_vector_freq = 1;
global_freq = 1;
extvector = 1;
btype = atoi(arg[4]);

View File

@ -52,7 +52,7 @@ FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) :
next_reneighbor = -1;
vector_flag = 1;
size_vector = 2;
scalar_vector_freq = 1;
global_freq = 1;
extvector = 1;
iatomtype = atoi(arg[4]);

View File

@ -45,7 +45,7 @@ FixBondSwap::FixBondSwap(LAMMPS *lmp, int narg, char **arg) :
vector_flag = 1;
size_vector = 2;
scalar_vector_freq = 1;
global_freq = 1;
extvector = 0;
fraction = atof(arg[3]);

View File

@ -37,7 +37,7 @@ ComputeDamageAtom::ComputeDamageAtom(LAMMPS *lmp, int narg, char **arg) :
if (narg != 3) error->all("Illegal compute damage/atom command");
peratom_flag = 1;
size_peratom = 0;
size_peratom_cols = 0;
nmax = 0;
damage = NULL;
@ -82,7 +82,7 @@ void ComputeDamageAtom::compute_peratom()
nmax = atom->nmax;
damage = (double *) memory->smalloc(nmax*sizeof(double),
"damage/atom:damage");
scalar_atom = damage;
vector_atom = damage;
}
// compute damage for each atom in group

View File

@ -90,7 +90,7 @@ double ComputeEventDisplace::compute_scalar()
if (id_event == NULL) return 0.0;
double event = 0.0;
double **xevent = fix->vector_atom;
double **xevent = fix->array_atom;
double **x = atom->x;
int *mask = atom->mask;

View File

@ -159,7 +159,7 @@ void FixEvent::grow_arrays(int nmax)
// allow compute event to access stored event coords
vector_atom = xevent;
array_atom = xevent;
}
/* ----------------------------------------------------------------------

View File

@ -43,7 +43,7 @@ ComputeAcklandAtom::ComputeAcklandAtom(LAMMPS *lmp, int narg, char **arg) :
if (narg != 3) error->all("Illegal compute ackland/atom command");
peratom_flag = 1;
size_peratom = 0;
size_peratom_cols = 0;
nmax = 0;
structure = NULL;
@ -110,7 +110,7 @@ void ComputeAcklandAtom::compute_peratom()
nmax = atom->nmax;
structure = (double *)
memory->smalloc(nmax*sizeof(double),"compute/ackland/atom:ackland");
scalar_atom = structure;
vector_atom = structure;
}
// invoke half neighbor list (will copy or build if necessary)

View File

@ -260,14 +260,13 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
scalar_flag = atcTransfer_->scalar_flag();
vector_flag = atcTransfer_->vector_flag();
size_vector = atcTransfer_->size_vector();
scalar_vector_freq = atcTransfer_->scalar_vector_freq();
global_freq = atcTransfer_->global_freq();
extscalar = atcTransfer_->extscalar();
extvector = atcTransfer_->extvector();
extlist = atcTransfer_->extlist();
// set comm size needed by this fix
comm_forward = 3;
}
/*----------------------------------------------------------------------- */

View File

@ -52,7 +52,7 @@ FixSMD::FixSMD(LAMMPS *lmp, int narg, char **arg) :
restart_global = 1;
vector_flag = 1;
size_vector = 7;
scalar_vector_freq = 1;
global_freq = 1;
extvector = 1;
int argoffs=3;

View File

@ -1392,7 +1392,7 @@ void *Atom::extract(char *name)
/* ----------------------------------------------------------------------
return # of bytes of allocated memory
call to avec sums per-atom vectors
call to avec tallies per-atom vectors
add in global to local mapping storage
------------------------------------------------------------------------- */

View File

@ -55,11 +55,9 @@ Compute::Compute(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
// set child class defaults
vector = NULL;
scalar_atom = NULL;
vector_atom = NULL;
scalar_flag = vector_flag = array_flag = 0;
peratom_flag = local_flag = 0;
scalar_flag = vector_flag = peratom_flag = 0;
tempflag = pressflag = peflag = 0;
pressatomflag = peatomflag = 0;
tempbias = 0;
@ -67,7 +65,8 @@ Compute::Compute(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
timeflag = 0;
comm_forward = comm_reverse = 0;
invoked_scalar = invoked_vector = invoked_peratom = -1;
invoked_scalar = invoked_vector = invoked_array = -1;
invoked_peratom = invoked_local = -1;
// set modify defaults

View File

@ -25,17 +25,30 @@ class Compute : protected Pointers {
double scalar; // computed global scalar
double *vector; // computed global vector
double *scalar_atom; // computed per-atom scalar
double **vector_atom; // computed per-atom vector
double *array; // computed global array
double *vector_atom; // computed per-atom vector
double **array_atom; // computed per-atom array
double *vector_local; // computed local vector
double **array_local; // computed local array
int scalar_flag; // 0/1 if compute_scalar() function exists
int vector_flag; // 0/1 if compute_vector() function exists
int size_vector; // N = size of global vector
int array_flag; // 0/1 if compute_array() function exists
int size_vector; // length of global vector
int size_array_rows; // rows in global array
int size_array_cols; // columns in global array
int peratom_flag; // 0/1 if compute_peratom() function exists
int size_peratom; // 0 = scalar_atom, N = size of vector_atom
int extscalar; // 0/1 if scalar is intensive/extensive
int extvector; // 0/1/-1 if vector is all int/ext/extlist
int size_peratom_cols; // 0 = vector, N = columns in peratom array
int local_flag; // 0/1 if compute_local() function exists
int size_local_rows; // rows in local vector or array
int size_local_cols; // 0 = vector, N = columns in local array
int extscalar; // 0/1 if global scalar is intensive/extensive
int extvector; // 0/1/-1 if global vector is all int/ext/extlist
int *extlist; // list of 0/1 int/ext for each vec component
int extarray; // 0/1 if global array is intensive/extensive
int tempflag; // 1 if Compute can be used as temperature
// must have both compute_scalar, compute_vector
@ -55,7 +68,9 @@ class Compute : protected Pointers {
int invoked_flag; // non-zero if invoked or accessed this step, 0 if not
int invoked_scalar; // last timestep on which compute_scalar() was invoked
int invoked_vector; // ditto for compute_vector()
int invoked_array; // ditto for compute_array()
int invoked_peratom; // ditto for compute_peratom()
int invoked_local; // ditto for compute_local()
double dof; // degrees-of-freedom for temperature
@ -71,7 +86,9 @@ class Compute : protected Pointers {
virtual void init_list(int, class NeighList *) {}
virtual double compute_scalar() {return 0.0;}
virtual void compute_vector() {}
virtual void compute_array() {}
virtual void compute_peratom() {}
virtual void compute_local() {}
virtual int pack_comm(int, int *, double *, int, int *) {return 0;}
virtual void unpack_comm(int, int, double *) {}

View File

@ -35,7 +35,7 @@ ComputeCentroAtom::ComputeCentroAtom(LAMMPS *lmp, int narg, char **arg) :
if (narg != 3) error->all("Illegal compute centro/atom command");
peratom_flag = 1;
size_peratom = 0;
size_peratom_cols = 0;
nmax = 0;
centro = NULL;
@ -101,7 +101,7 @@ void ComputeCentroAtom::compute_peratom()
nmax = atom->nmax;
centro = (double *)
memory->smalloc(nmax*sizeof(double),"centro/atom:centro");
scalar_atom = centro;
vector_atom = centro;
}
// invoke full neighbor list (will copy or build if necessary)

View File

@ -50,7 +50,7 @@ ComputeCNAAtom::ComputeCNAAtom(LAMMPS *lmp, int narg, char **arg) :
if (narg != 4) error->all("Illegal compute cna/atom command");
peratom_flag = 1;
size_peratom = 0;
size_peratom_cols = 0;
double cutoff = atof(arg[3]);
if (cutoff < 0.0) error->all("Illegal compute cna/atom command");
@ -136,7 +136,7 @@ void ComputeCNAAtom::compute_peratom()
nnearest = (int *) memory->smalloc(nmax*sizeof(int),"cna:nnearest");
pattern = (double *) memory->smalloc(nmax*sizeof(double),
"cna:cna_pattern");
scalar_atom = pattern;
vector_atom = pattern;
}
// invoke full neighbor list (will copy or build if necessary)

View File

@ -40,7 +40,7 @@ ComputeCoordAtom::ComputeCoordAtom(LAMMPS *lmp, int narg, char **arg) :
cutsq = cutoff*cutoff;
peratom_flag = 1;
size_peratom = 0;
size_peratom_cols = 0;
nmax = 0;
coordination = NULL;
@ -102,7 +102,7 @@ void ComputeCoordAtom::compute_peratom()
nmax = atom->nmax;
coordination = (double *)
memory->smalloc(nmax*sizeof(double),"coord/atom:coordination");
scalar_atom = coordination;
vector_atom = coordination;
}
// invoke full neighbor list (will copy or build if necessary)

View File

@ -33,7 +33,7 @@ ComputeDisplaceAtom::ComputeDisplaceAtom(LAMMPS *lmp, int narg, char **arg) :
if (narg != 3) error->all("Illegal compute displace/atom command");
peratom_flag = 1;
size_peratom = 4;
size_peratom_cols = 4;
// create a new fix coord/original style
// id = compute-ID + coord_original, fix group = compute group
@ -90,14 +90,14 @@ void ComputeDisplaceAtom::compute_peratom()
nmax = atom->nmax;
displace =
memory->create_2d_double_array(nmax,4,"displace/atom:displace");
vector_atom = displace;
array_atom = displace;
}
// dx,dy,dz = displacement of atom from original position
// original unwrapped position is stored by fix
// for triclinic, need to unwrap current atom coord via h matrix
double **xoriginal = fix->vector_atom;
double **xoriginal = fix->array_atom;
double **x = atom->x;
int *mask = atom->mask;

View File

@ -214,7 +214,7 @@ void ComputeHeatFlux::compute_vector()
massone = (rmass) ? rmass[i] : mass[type[i]];
ke = mvv2e * 0.5 * massone *
(v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]);
pe = atomPE->scalar_atom[i];
pe = atomPE->vector_atom[i];
eng = pe + ke;
Jc[0] += v[i][0]*eng;
Jc[1] += v[i][1]*eng;

View File

@ -31,7 +31,7 @@ ComputeKEAtom::ComputeKEAtom(LAMMPS *lmp, int narg, char **arg) :
if (narg != 3) error->all("Illegal compute ke/atom command");
peratom_flag = 1;
size_peratom = 0;
size_peratom_cols = 0;
nmax = 0;
ke = NULL;
@ -67,7 +67,7 @@ void ComputeKEAtom::compute_peratom()
memory->sfree(ke);
nmax = atom->nmax;
ke = (double *) memory->smalloc(nmax*sizeof(double),"ke/atom:ke");
scalar_atom = ke;
vector_atom = ke;
}
// compute kinetic energy for each atom in group

View File

@ -124,7 +124,7 @@ void ComputeMSD::compute_vector()
// relative to center of mass if comflag is set
// for triclinic, need to unwrap current atom coord via h matrix
double **xoriginal = fix->vector_atom;
double **xoriginal = fix->array_atom;
double **x = atom->x;
int *mask = atom->mask;

View File

@ -35,7 +35,7 @@ ComputePEAtom::ComputePEAtom(LAMMPS *lmp, int narg, char **arg) :
if (narg < 3) error->all("Illegal compute pe/atom command");
peratom_flag = 1;
size_peratom = 0;
size_peratom_cols = 0;
peatomflag = 1;
timeflag = 1;
comm_reverse = 1;
@ -87,7 +87,7 @@ void ComputePEAtom::compute_peratom()
nmax = atom->nmax;
energy = (double *)
memory->smalloc(nmax*sizeof(double),"pe/atom:energy");
scalar_atom = energy;
vector_atom = energy;
}
// npair includes ghosts if either newton flag is set

View File

@ -137,21 +137,25 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) :
if (icompute < 0)
error->all("Compute ID for compute reduce does not exist");
if (modify->compute[icompute]->peratom_flag == 0)
error->all("Compute reduce compute does not calculate per-atom values");
if (argindex[i] == 0 && modify->compute[icompute]->size_peratom != 0)
error->all("Compute reduce compute does not calculate a per-atom scalar");
if (argindex[i] && modify->compute[icompute]->size_peratom == 0)
error->all("Compute reduce compute does not calculate a per-atom vector");
error->all("Compute reduce compute does not "
"calculate per-atom values");
if (argindex[i] == 0 &&
modify->compute[icompute]->size_peratom_cols != 0)
error->all("Compute reduce compute does not "
"calculate a per-atom vector");
if (argindex[i] && modify->compute[icompute]->size_peratom_cols == 0)
error->all("Compute reduce compute does not "
"calculate a per-atom array");
} else if (which[i] == FIX) {
int ifix = modify->find_fix(ids[i]);
if (ifix < 0)
error->all("Fix ID for compute reduce does not exist");
if (modify->fix[ifix]->peratom_flag == 0)
error->all("Compute reduce fix does not calculate per-atom values");
if (argindex[i] == 0 && modify->fix[ifix]->size_peratom != 0)
error->all("Compute reduce fix does not calculate a per-atom scalar");
if (argindex[i] && modify->fix[ifix]->size_peratom == 0)
if (argindex[i] == 0 && modify->fix[ifix]->size_peratom_cols != 0)
error->all("Compute reduce fix does not calculate a per-atom vector");
if (argindex[i] && modify->fix[ifix]->size_peratom_cols == 0)
error->all("Compute reduce fix does not calculate a per-atom array");
} else if (which[i] == VARIABLE) {
int ivariable = input->variable->find(ids[i]);
if (ivariable < 0)
@ -302,14 +306,14 @@ double ComputeReduce::compute_one(int m)
}
if (j == 0) {
double *compute_scalar = compute->scalar_atom;
double *compute_vector = compute->vector_atom;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit) combine(one,compute_scalar[i]);
if (mask[i] & groupbit) combine(one,compute_vector[i]);
} else {
double **compute_vector = compute->vector_atom;
double **compute_array = compute->array_atom;
int jm1 = j - 1;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit) combine(one,compute_vector[i][jm1]);
if (mask[i] & groupbit) combine(one,compute_array[i][jm1]);
}
// access fix fields, check if frequency is a match
@ -319,14 +323,14 @@ double ComputeReduce::compute_one(int m)
error->all("Fix used in compute reduce not computed at compatible time");
if (j == 0) {
double *fix_scalar = modify->fix[n]->scalar_atom;
double *fix_vector = modify->fix[n]->vector_atom;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit) combine(one,fix_scalar[i]);
if (mask[i] & groupbit) combine(one,fix_vector[i]);
} else {
double **fix_vector = modify->fix[n]->vector_atom;
double **fix_array = modify->fix[n]->array_atom;
int jm1 = j - 1;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit) combine(one,fix_vector[i][jm1]);
if (mask[i] & groupbit) combine(one,fix_array[i][jm1]);
}
// evaluate atom-style variable

View File

@ -87,16 +87,16 @@ double ComputeReduceRegion::compute_one(int m)
}
if (j == 0) {
double *compute_scalar = compute->scalar_atom;
double *compute_vector = compute->vector_atom;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]))
combine(one,compute_scalar[i]);
combine(one,compute_vector[i]);
} else {
double **compute_vector = compute->vector_atom;
double **compute_array = compute->array_atom;
int jm1 = j - 1;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]))
combine(one,compute_vector[i][jm1]);
combine(one,compute_array[i][jm1]);
}
// access fix fields, check if frequency is a match
@ -106,16 +106,16 @@ double ComputeReduceRegion::compute_one(int m)
error->all("Fix used in compute reduce not computed at compatible time");
if (j == 0) {
double *fix_scalar = modify->fix[n]->scalar_atom;
double *fix_vector = modify->fix[n]->vector_atom;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]))
combine(one,fix_scalar[i]);
combine(one,fix_vector[i]);
} else {
double **fix_vector = modify->fix[n]->vector_atom;
double **fix_array = modify->fix[n]->array_atom;
int jm1 = j - 1;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]))
combine(one,fix_vector[i][jm1]);
combine(one,fix_array[i][jm1]);
}
// evaluate atom-style variable

View File

@ -38,7 +38,7 @@ ComputeStressAtom::ComputeStressAtom(LAMMPS *lmp, int narg, char **arg) :
if (narg < 3) error->all("Illegal compute stress/atom command");
peratom_flag = 1;
size_peratom = 6;
size_peratom_cols = 6;
pressatomflag = 1;
timeflag = 1;
comm_reverse = 6;
@ -101,7 +101,7 @@ void ComputeStressAtom::compute_peratom()
nmax = atom->nmax;
stress =
memory->create_2d_double_array(nmax,6,"stress/atom:stress");
vector_atom = stress;
array_atom = stress;
}
// npair includes ghosts if either newton flag is set

View File

@ -668,21 +668,21 @@ int DumpCustom::count()
} else if (thresh_array[ithresh] == COMPUTE) {
i = nfield + ithresh;
if (argindex[i] == 0) {
ptr = compute[field2index[i]]->scalar_atom;
ptr = compute[field2index[i]]->vector_atom;
nstride = 1;
} else {
ptr = &compute[field2index[i]]->vector_atom[0][argindex[i]-1];
nstride = compute[field2index[i]]->size_peratom;
ptr = &compute[field2index[i]]->array_atom[0][argindex[i]-1];
nstride = compute[field2index[i]]->size_peratom_cols;
}
} else if (thresh_array[ithresh] == FIX) {
i = nfield + ithresh;
if (argindex[i] == 0) {
ptr = fix[field2index[i]]->scalar_atom;
ptr = fix[field2index[i]]->vector_atom;
nstride = 1;
} else {
ptr = &fix[field2index[i]]->vector_atom[0][argindex[i]-1];
nstride = fix[field2index[i]]->size_peratom;
ptr = &fix[field2index[i]]->array_atom[0][argindex[i]-1];
nstride = fix[field2index[i]]->size_peratom_cols;
}
} else if (thresh_array[ithresh] == VARIABLE) {
@ -981,13 +981,13 @@ void DumpCustom::parse_fields(int narg, char **arg)
n = modify->find_compute(suffix);
if (n < 0) error->all("Could not find dump custom compute ID");
if (modify->compute[n]->peratom_flag == 0)
error->all("Dump custom compute ID does not compute peratom info");
if (argindex[i] == 0 && modify->compute[n]->size_peratom > 0)
error->all("Dump custom compute ID does not compute scalar per atom");
if (argindex[i] > 0 && modify->compute[n]->size_peratom == 0)
error->all("Dump custom compute ID does not compute vector per atom");
error->all("Dump custom compute ID does not compute per-atom info");
if (argindex[i] == 0 && modify->compute[n]->size_peratom_cols > 0)
error->all("Dump custom compute ID does not compute per-atom vector");
if (argindex[i] > 0 && modify->compute[n]->size_peratom_cols == 0)
error->all("Dump custom compute ID does not compute per-atom array");
if (argindex[i] > 0 &&
argindex[i] > modify->compute[n]->size_peratom)
argindex[i] > modify->compute[n]->size_peratom_cols)
error->all("Dump custom compute ID vector is not large enough");
field2index[i] = add_compute(suffix);
@ -1015,13 +1015,13 @@ void DumpCustom::parse_fields(int narg, char **arg)
n = modify->find_fix(suffix);
if (n < 0) error->all("Could not find dump custom fix ID");
if (modify->fix[n]->peratom_flag == 0)
error->all("Dump custom fix ID does not compute peratom info");
if (argindex[i] == 0 && modify->fix[n]->size_peratom > 0)
error->all("Dump custom fix ID does not compute scalar per atom");
if (argindex[i] > 0 && modify->fix[n]->size_peratom == 0)
error->all("Dump custom fix ID does not compute vector per atom");
error->all("Dump custom fix ID does not compute per-atom info");
if (argindex[i] == 0 && modify->fix[n]->size_peratom_cols > 0)
error->all("Dump custom fix ID does not compute per-atom vector");
if (argindex[i] > 0 && modify->fix[n]->size_peratom_cols == 0)
error->all("Dump custom fix ID does not compute per-atom array");
if (argindex[i] > 0 &&
argindex[i] > modify->fix[n]->size_peratom)
argindex[i] > modify->fix[n]->size_peratom_cols)
error->all("Dump custom fix ID vector is not large enough");
field2index[i] = add_fix(suffix);
@ -1266,15 +1266,15 @@ int DumpCustom::modify_param(int narg, char **arg)
if (n < 0) error->all("Could not find dump custom compute ID");
if (modify->compute[n]->peratom_flag == 0)
error->all("Dump custom compute ID does not compute peratom info");
error->all("Dump custom compute ID does not compute per-atom info");
if (argindex[nfield+nthresh] == 0 &&
modify->compute[n]->size_peratom > 0)
error->all("Dump custom compute ID does not compute scalar per atom");
modify->compute[n]->size_peratom_cols > 0)
error->all("Dump custom compute ID does not compute per-atom vector");
if (argindex[nfield+nthresh] > 0 &&
modify->compute[n]->size_peratom == 0)
error->all("Dump custom compute ID does not compute vector per atom");
modify->compute[n]->size_peratom_cols == 0)
error->all("Dump custom compute ID does not compute per-atom array");
if (argindex[nfield+nthresh] > 0 &&
argindex[nfield+nthresh] > modify->compute[n]->size_peratom)
argindex[nfield+nthresh] > modify->compute[n]->size_peratom_cols)
error->all("Dump custom compute ID vector is not large enough");
field2index[nfield+nthresh] = add_compute(suffix);
@ -1308,15 +1308,15 @@ int DumpCustom::modify_param(int narg, char **arg)
if (n < 0) error->all("Could not find dump custom fix ID");
if (modify->fix[n]->peratom_flag == 0)
error->all("Dump custom fix ID does not compute peratom info");
error->all("Dump custom fix ID does not compute per-atom info");
if (argindex[nfield+nthresh] == 0 &&
modify->fix[n]->size_peratom > 0)
error->all("Dump custom fix ID does not compute scalar per atom");
modify->fix[n]->size_peratom_cols > 0)
error->all("Dump custom fix ID does not compute per-atom vector");
if (argindex[nfield+nthresh] > 0 &&
modify->fix[n]->size_peratom == 0)
error->all("Dump custom fix ID does not compute vector per atom");
modify->fix[n]->size_peratom_cols == 0)
error->all("Dump custom fix ID does not compute per-atom array");
if (argindex[nfield+nthresh] > 0 &&
argindex[nfield+nthresh] > modify->fix[n]->size_peratom)
argindex[nfield+nthresh] > modify->fix[n]->size_peratom_cols)
error->all("Dump custom fix ID vector is not large enough");
field2index[nfield+nthresh] = add_fix(suffix);
@ -1395,8 +1395,8 @@ double DumpCustom::memory_usage()
void DumpCustom::pack_compute(int n)
{
double *vector = compute[field2index[n]]->scalar_atom;
double **array = compute[field2index[n]]->vector_atom;
double *vector = compute[field2index[n]]->vector_atom;
double **array = compute[field2index[n]]->array_atom;
int index = argindex[n];
int nlocal = atom->nlocal;
@ -1421,8 +1421,8 @@ void DumpCustom::pack_compute(int n)
void DumpCustom::pack_fix(int n)
{
double *vector = fix[field2index[n]]->scalar_atom;
double **array = fix[field2index[n]]->vector_atom;
double *vector = fix[field2index[n]]->vector_atom;
double **array = fix[field2index[n]]->array_atom;
int index = argindex[n];
int nlocal = atom->nlocal;

View File

@ -57,7 +57,8 @@ Fix::Fix(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
create_attribute = 0;
restart_pbc = 0;
scalar_flag = vector_flag = peratom_flag = 0;
scalar_flag = vector_flag = array_flag = 0;
peratom_flag = local_flag = 0;
comm_forward = comm_reverse = 0;

View File

@ -42,18 +42,31 @@ class Fix : protected Pointers {
int scalar_flag; // 0/1 if compute_scalar() function exists
int vector_flag; // 0/1 if compute_vector() function exists
int size_vector; // N = size of global vector
int scalar_vector_freq; // frequency s/v data is available at
int extscalar; // 0/1 if scalar is intensive/extensive
int extvector; // 0/1/-1 if vector is all int/ext/extlist
int *extlist; // list of 0/1 int/ext for each vec component
int array_flag; // 0/1 if compute_array() function exists
int size_vector; // length of global vector
int size_array_rows; // rows in global array
int size_array_cols; // columns in global array
int global_freq; // frequency s/v data is available at
int peratom_flag; // 0/1 if per-atom data is stored
int size_peratom; // 0 = scalar_atom, N = size of vector_atom
double *scalar_atom; // computed per-atom scalar
double **vector_atom; // computed per-atom vector
int size_peratom_cols; // 0 = vector, N = columns in peratom array
int peratom_freq; // frequency per-atom data is available at
int local_flag; // 0/1 if local data is stored
int size_local_rows; // rows in local vector or array
int size_local_cols; // 0 = vector, N = columns in local array
int local_freq; // frequency local data is available at
int extscalar; // 0/1 if global scalar is intensive/extensive
int extvector; // 0/1/-1 if global vector is all int/ext/extlist
int *extlist; // list of 0/1 int/ext for each vec component
int extarray; // 0/1 if global array is intensive/extensive
double *vector_atom; // computed per-atom vector
double **array_atom; // computed per-atom array
double *vector_local; // computed local vector
double **array_local; // computed local array
int comm_forward; // size of forward communication (0 if none)
int comm_reverse; // size of reverse communication (0 if none)
@ -123,6 +136,7 @@ class Fix : protected Pointers {
virtual double compute_scalar() {return 0.0;}
virtual double compute_vector(int) {return 0.0;}
virtual double compute_array(int) {return 0.0;}
virtual int dof(int) {return 0;}
virtual void deform(int) {}

View File

@ -33,7 +33,7 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) :
scalar_flag = 1;
vector_flag = 1;
size_vector = 3;
scalar_vector_freq = 1;
global_freq = 1;
extscalar = 1;
extvector = 1;

View File

@ -138,11 +138,15 @@ FixAveAtom::FixAveAtom(LAMMPS *lmp, int narg, char **arg) :
error->all("Compute ID for fix ave/atom does not exist");
if (modify->compute[icompute]->peratom_flag == 0)
error->all("Fix ave/atom compute does not calculate per-atom values");
if (argindex[i] == 0 && modify->compute[icompute]->size_peratom != 0)
error->all("Fix ave/atom compute does not calculate a per-atom scalar");
if (argindex[i] && modify->compute[icompute]->size_peratom == 0)
error->all("Fix ave/atom compute does not calculate a per-atom vector");
if (argindex[i] && argindex[i] > modify->compute[icompute]->size_peratom)
if (argindex[i] == 0 &&
modify->compute[icompute]->size_peratom_cols != 0)
error->all("Fix ave/atom compute does not "
"calculate a per-atom vector");
if (argindex[i] && modify->compute[icompute]->size_peratom_cols == 0)
error->all("Fix ave/atom compute does not "
"calculate a per-atom array");
if (argindex[i] &&
argindex[i] > modify->compute[icompute]->size_peratom_cols)
error->all("Fix ave/atom compute vector is accessed out-of-range");
} else if (which[i] == FIX) {
int ifix = modify->find_fix(ids[i]);
@ -150,11 +154,11 @@ FixAveAtom::FixAveAtom(LAMMPS *lmp, int narg, char **arg) :
error->all("Fix ID for fix ave/atom does not exist");
if (modify->fix[ifix]->peratom_flag == 0)
error->all("Fix ave/atom fix does not calculate per-atom values");
if (argindex[i] && modify->fix[ifix]->size_peratom != 0)
error->all("Fix ave/atom fix does not calculate a per-atom scalar");
if (argindex[i] && modify->fix[ifix]->size_peratom == 0)
if (argindex[i] && modify->fix[ifix]->size_peratom_cols != 0)
error->all("Fix ave/atom fix does not calculate a per-atom vector");
if (argindex[i] && argindex[i] > modify->fix[ifix]->size_peratom)
if (argindex[i] && modify->fix[ifix]->size_peratom_cols == 0)
error->all("Fix ave/atom fix does not calculate a per-atom array");
if (argindex[i] && argindex[i] > modify->fix[ifix]->size_peratom_cols)
error->all("Fix ave/atom fix vector is accessed out-of-range");
} else if (which[i] == VARIABLE) {
int ivariable = input->variable->find(ids[i]);
@ -165,16 +169,16 @@ FixAveAtom::FixAveAtom(LAMMPS *lmp, int narg, char **arg) :
}
}
// this fix produces either a per-atom scalar or vector
// this fix produces either a per-atom vector or array
peratom_flag = 1;
if (nvalues == 1) size_peratom = 0;
else size_peratom = nvalues;
if (nvalues == 1) size_peratom_cols = 0;
else size_peratom_cols = nvalues;
// perform initial allocation of atom-based array
// register with Atom class
vector = NULL;
array = NULL;
grow_arrays(atom->nmax);
atom->add_callback(0);
@ -184,7 +188,7 @@ FixAveAtom::FixAveAtom(LAMMPS *lmp, int narg, char **arg) :
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++)
for (int m = 0; m < nvalues; m++)
vector[i][m] = 0.0;
array[i][m] = 0.0;
// nvalid = next step on which end_of_step does something
// can be this timestep if multiple of peratom_freq and nrepeat = 1
@ -219,7 +223,7 @@ FixAveAtom::~FixAveAtom()
delete [] ids;
delete [] value2index;
memory->destroy_2d_double_array(vector);
memory->destroy_2d_double_array(array);
}
/* ---------------------------------------------------------------------- */
@ -291,7 +295,7 @@ void FixAveAtom::end_of_step()
if (irepeat == 0)
for (i = 0; i < nlocal; i++)
for (m = 0; m < nvalues; m++)
vector[i][m] = 0.0;
array[i][m] = 0.0;
// accumulate results of attributes,computes,fixes,variables to local copy
// compute/fix/variable may invoke computes so wrap with clear/add
@ -307,7 +311,7 @@ void FixAveAtom::end_of_step()
if (which[m] == X) {
double **x = atom->x;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit) vector[i][m] += x[i][j];
if (mask[i] & groupbit) array[i][m] += x[i][j];
} else if (which[m] == XU) {
double **x = atom->x;
@ -316,28 +320,28 @@ void FixAveAtom::end_of_step()
double xprd = domain->xprd;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit)
vector[i][m] += x[i][0] + ((image[i] & 1023) - 512) * xprd;
array[i][m] += x[i][0] + ((image[i] & 1023) - 512) * xprd;
} else if (j == 1) {
double yprd = domain->yprd;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit)
vector[i][m] += x[i][1] + ((image[i] >> 10 & 1023) - 512) * yprd;
array[i][m] += x[i][1] + ((image[i] >> 10 & 1023) - 512) * yprd;
} else {
double zprd = domain->zprd;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit)
vector[i][m] += x[i][2] + ((image[i] >> 20) - 512) * zprd;
array[i][m] += x[i][2] + ((image[i] >> 20) - 512) * zprd;
}
} else if (which[m] == V) {
double **v = atom->v;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit) vector[i][m] += v[i][j];
if (mask[i] & groupbit) array[i][m] += v[i][j];
} else if (which[m] == F) {
double **f = atom->f;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit) vector[i][m] += f[i][j];
if (mask[i] & groupbit) array[i][m] += f[i][j];
// invoke compute if not previously invoked
@ -349,34 +353,34 @@ void FixAveAtom::end_of_step()
}
if (j == 0) {
double *compute_scalar = compute->scalar_atom;
double *compute_vector = compute->vector_atom;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit) vector[i][m] += compute_scalar[i];
if (mask[i] & groupbit) array[i][m] += compute_vector[i];
} else {
int jm1 = j - 1;
double **compute_vector = compute->vector_atom;
double **compute_array = compute->array_atom;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit) vector[i][m] += compute_vector[i][jm1];
if (mask[i] & groupbit) array[i][m] += compute_array[i][jm1];
}
// access fix fields, guaranteed to be ready
} else if (which[m] == FIX) {
if (j == 0) {
double *fix_scalar = modify->fix[n]->scalar_atom;
double *fix_vector = modify->fix[n]->vector_atom;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit) vector[i][m] += fix_scalar[i];
if (mask[i] & groupbit) array[i][m] += fix_vector[i];
} else {
int jm1 = j - 1;
double **fix_vector = modify->fix[n]->vector_atom;
double **fix_array = modify->fix[n]->array_atom;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit) vector[i][m] += fix_vector[i][jm1];
if (mask[i] & groupbit) array[i][m] += fix_array[i][jm1];
}
// evaluate atom-style variable
} else if (which[m] == VARIABLE)
input->variable->compute_atom(n,igroup,&vector[0][m],nvalues,1);
input->variable->compute_atom(n,igroup,&array[0][m],nvalues,1);
}
// done if irepeat < nrepeat
@ -398,7 +402,7 @@ void FixAveAtom::end_of_step()
double repeat = nrepeat;
for (i = 0; i < nlocal; i++)
for (m = 0; m < nvalues; m++)
vector[i][m] /= repeat;
array[i][m] /= repeat;
}
/* ----------------------------------------------------------------------
@ -418,10 +422,10 @@ double FixAveAtom::memory_usage()
void FixAveAtom::grow_arrays(int nmax)
{
vector = memory->grow_2d_double_array(vector,nmax,nvalues,
"fix_ave/atom:vector");
vector_atom = vector;
scalar_atom = vector[0];
array = memory->grow_2d_double_array(array,nmax,nvalues,
"fix_ave/atom:array");
array_atom = array;
vector_atom = array[0];
}
/* ----------------------------------------------------------------------
@ -431,7 +435,7 @@ void FixAveAtom::grow_arrays(int nmax)
void FixAveAtom::copy_arrays(int i, int j)
{
for (int m = 0; m < nvalues; m++)
vector[j][m] = vector[i][m];
array[j][m] = array[i][m];
}
/* ----------------------------------------------------------------------
@ -440,7 +444,7 @@ void FixAveAtom::copy_arrays(int i, int j)
int FixAveAtom::pack_exchange(int i, double *buf)
{
for (int m = 0; m < nvalues; m++) buf[m] = vector[i][m];
for (int m = 0; m < nvalues; m++) buf[m] = array[i][m];
return nvalues;
}
@ -450,6 +454,6 @@ int FixAveAtom::pack_exchange(int i, double *buf)
int FixAveAtom::unpack_exchange(int nlocal, double *buf)
{
for (int m = 0; m < nvalues; m++) vector[nlocal][m] = buf[m];
for (int m = 0; m < nvalues; m++) array[nlocal][m] = buf[m];
return nvalues;
}

View File

@ -40,7 +40,7 @@ class FixAveAtom : public Fix {
int *which,*argindex,*value2index;
char **ids;
double **vector;
double **array;
};
}

View File

@ -33,7 +33,7 @@ FixAveForce::FixAveForce(LAMMPS *lmp, int narg, char **arg) :
vector_flag = 1;
size_vector = 3;
scalar_vector_freq = 1;
global_freq = 1;
extvector = 1;
xflag = yflag = zflag = 1;

View File

@ -211,11 +211,15 @@ FixAveSpatial::FixAveSpatial(LAMMPS *lmp, int narg, char **arg) :
error->all("Compute ID for fix ave/spatial does not exist");
if (modify->compute[icompute]->peratom_flag == 0)
error->all("Fix ave/spatial compute does not calculate per-atom values");
if (argindex[i] == 0 && modify->compute[icompute]->size_peratom != 0)
error->all("Fix ave/spatial compute does not calculate a per-atom scalar");
if (argindex[i] && modify->compute[icompute]->size_peratom == 0)
error->all("Fix ave/spatial compute does not calculate a per-atom vector");
if (argindex[i] && argindex[i] > modify->compute[icompute]->size_peratom)
if (argindex[i] == 0 &&
modify->compute[icompute]->size_peratom_cols != 0)
error->all("Fix ave/spatial compute does not "
"calculate a per-atom vector");
if (argindex[i] && modify->compute[icompute]->size_peratom_cols == 0)
error->all("Fix ave/spatial compute does not "
"calculate a per-atom array");
if (argindex[i] &&
argindex[i] > modify->compute[icompute]->size_peratom_cols)
error->all("Fix ave/spatial compute vector is accessed out-of-range");
} else if (which[i] == FIX) {
@ -224,11 +228,11 @@ FixAveSpatial::FixAveSpatial(LAMMPS *lmp, int narg, char **arg) :
error->all("Fix ID for fix ave/spatial does not exist");
if (modify->fix[ifix]->peratom_flag == 0)
error->all("Fix ave/spatial fix does not calculate per-atom values");
if (argindex[i] && modify->fix[ifix]->size_peratom != 0)
error->all("Fix ave/spatial fix does not calculate a per-atom scalar");
if (argindex[i] && modify->fix[ifix]->size_peratom == 0)
if (argindex[i] && modify->fix[ifix]->size_peratom_cols != 0)
error->all("Fix ave/spatial fix does not calculate a per-atom vector");
if (argindex[i] && argindex[i] > modify->fix[ifix]->size_peratom)
if (argindex[i] && modify->fix[ifix]->size_peratom_cols == 0)
error->all("Fix ave/spatial fix does not calculate a per-atom array");
if (argindex[i] && argindex[i] > modify->fix[ifix]->size_peratom_cols)
error->all("Fix ave/spatial fix vector is accessed out-of-range");
} else if (which[i] == VARIABLE) {
int ivariable = input->variable->find(ids[i]);
@ -258,7 +262,7 @@ FixAveSpatial::FixAveSpatial(LAMMPS *lmp, int narg, char **arg) :
vector_flag = 1;
size_vector = BIG;
scalar_vector_freq = nfreq;
global_freq = nfreq;
extvector = 0;
// setup scaling
@ -628,27 +632,27 @@ void FixAveSpatial::end_of_step()
compute->compute_peratom();
compute->invoked_flag |= INVOKED_PERATOM;
}
double *scalar = compute->scalar_atom;
double **vector = compute->vector_atom;
double *vector = compute->vector_atom;
double **array = compute->array_atom;
int jm1 = j - 1;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit)
if (j == 0) values_one[layer[i]][m] += scalar[i];
else values_one[layer[i]][m] += vector[i][jm1];
if (j == 0) values_one[layer[i]][m] += vector[i];
else values_one[layer[i]][m] += array[i][jm1];
// FIX adds its scalar or vector component to values
// access fix fields, guaranteed to be ready
} else if (which[m] == FIX) {
double *scalar = modify->fix[n]->scalar_atom;
double **vector = modify->fix[n]->vector_atom;
double *vector = modify->fix[n]->vector_atom;
double **array = modify->fix[n]->array_atom;
int jm1 = j - 1;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
if (j == 0) values_one[layer[i]][m] += scalar[i];
else values_one[layer[i]][m] += vector[i][jm1];
if (j == 0) values_one[layer[i]][m] += vector[i];
else values_one[layer[i]][m] += array[i][jm1];
}
// VARIABLE adds its per-atom quantities to values

View File

@ -190,7 +190,7 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) :
// this fix produces either a global scalar or vector
// intensive/extensive flags set by compute,fix,variable that produces value
scalar_vector_freq = nfreq;
global_freq = nfreq;
extlist = NULL;
if (nvalues == 1) {
@ -301,7 +301,7 @@ void FixAveTime::init()
error->all("Fix ID for fix ave/time does not exist");
value2index[i] = ifix;
if (nevery % modify->fix[ifix]->scalar_vector_freq)
if (nevery % modify->fix[ifix]->global_freq)
error->all("Fix for fix ave/time not computed at compatible time");
} else if (which[i] == VARIABLE) {

View File

@ -31,7 +31,7 @@ FixCoordOriginal::FixCoordOriginal(LAMMPS *lmp, int narg, char **arg) :
restart_peratom = 1;
peratom_flag = 1;
size_peratom = 3;
size_peratom_cols = 3;
peratom_freq = 1;
// optional args
@ -125,7 +125,7 @@ void FixCoordOriginal::grow_arrays(int nmax)
{
xoriginal =
memory->grow_2d_double_array(xoriginal,nmax,3,"fix_msd:xoriginal");
vector_atom = xoriginal;
array_atom = xoriginal;
}
/* ----------------------------------------------------------------------

View File

@ -32,7 +32,7 @@ FixDrag::FixDrag(LAMMPS *lmp, int narg, char **arg) :
vector_flag = 1;
size_vector = 3;
scalar_vector_freq = 1;
global_freq = 1;
extvector = 1;
xflag = yflag = zflag = 1;

View File

@ -47,7 +47,7 @@ FixDtReset::FixDtReset(LAMMPS *lmp, int narg, char **arg) :
scalar_flag = 1;
vector_flag = 1;
size_vector = 1;
scalar_vector_freq = 1;
global_freq = 1;
extscalar = 0;
extvector = 0;

View File

@ -40,7 +40,7 @@ FixEvaporate::FixEvaporate(LAMMPS *lmp, int narg, char **arg) :
if (narg != 7) error->all("Illegal fix evaporate command");
scalar_flag = 1;
scalar_vector_freq = 1;
global_freq = 1;
extscalar = 0;
nevery = atoi(arg[3]);

View File

@ -35,7 +35,7 @@ FixHeat::FixHeat(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
if (narg < 4) error->all("Illegal fix heat command");
scalar_flag = 1;
scalar_vector_freq = 1;
global_freq = 1;
extscalar = 0;
nevery = atoi(arg[3]);

View File

@ -42,7 +42,7 @@ FixIndent::FixIndent(LAMMPS *lmp, int narg, char **arg) :
scalar_flag = 1;
vector_flag = 1;
size_vector = 3;
scalar_vector_freq = 1;
global_freq = 1;
extscalar = 1;
extvector = 1;

View File

@ -45,7 +45,7 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) :
if (narg < 7) error->all("Illegal fix langevin command");
scalar_flag = 1;
scalar_vector_freq = 1;
global_freq = 1;
extscalar = 1;
nevery = 1;

View File

@ -42,7 +42,7 @@ FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) :
restart_peratom = 1;
peratom_flag = 1;
size_peratom = 3;
size_peratom_cols = 3;
peratom_freq = 1;
time_integrate = 1;
time_depend = 1;
@ -804,7 +804,7 @@ void FixMove::grow_arrays(int nmax)
{
xoriginal =
memory->grow_2d_double_array(xoriginal,nmax,3,"move:xoriginal");
vector_atom = xoriginal;
array_atom = xoriginal;
}
/* ----------------------------------------------------------------------

View File

@ -50,7 +50,7 @@ FixNPH::FixNPH(LAMMPS *lmp, int narg, char **arg) :
box_change = 1;
time_integrate = 1;
scalar_flag = 1;
scalar_vector_freq = 1;
global_freq = 1;
extscalar = 1;
double p_period[3];

View File

@ -50,7 +50,7 @@ FixNPT::FixNPT(LAMMPS *lmp, int narg, char **arg) :
box_change = 1;
time_integrate = 1;
scalar_flag = 1;
scalar_vector_freq = 1;
global_freq = 1;
extscalar = 1;
t_start = atof(arg[3]);

View File

@ -33,7 +33,7 @@ FixNVELimit::FixNVELimit(LAMMPS *lmp, int narg, char **arg) :
time_integrate = 1;
scalar_flag = 1;
scalar_vector_freq = 1;
global_freq = 1;
extscalar = 1;
xlimit = atof(arg[3]);

View File

@ -44,7 +44,7 @@ FixNVT::FixNVT(LAMMPS *lmp, int narg, char **arg) :
restart_global = 1;
time_integrate = 1;
scalar_flag = 1;
scalar_vector_freq = 1;
global_freq = 1;
extscalar = 1;
t_start = atof(arg[3]);

View File

@ -47,7 +47,7 @@ FixOrientFCC::FixOrientFCC(LAMMPS *lmp, int narg, char **arg) :
if (narg != 11) error->all("Illegal fix orient/fcc command");
scalar_flag = 1;
scalar_vector_freq = 1;
global_freq = 1;
extscalar = 1;
nstats = atoi(arg[3]);

View File

@ -205,7 +205,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
vector_flag = 1;
size_vector = 12*nbody;
scalar_vector_freq = 1;
global_freq = 1;
extvector = 0;
for (i = 0; i < nbody; i++) {

View File

@ -30,7 +30,7 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) :
vector_flag = 1;
size_vector = 3;
scalar_vector_freq = 1;
global_freq = 1;
extvector = 1;
flagx = flagy = flagz = 1;

View File

@ -45,7 +45,7 @@ FixSpring::FixSpring(LAMMPS *lmp, int narg, char **arg) :
scalar_flag = 1;
vector_flag = 1;
size_vector = 4;
scalar_vector_freq = 1;
global_freq = 1;
extscalar = 1;
extvector = 1;

View File

@ -36,7 +36,7 @@ FixSpringSelf::FixSpringSelf(LAMMPS *lmp, int narg, char **arg) :
restart_peratom = 1;
scalar_flag = 1;
scalar_vector_freq = 1;
global_freq = 1;
extscalar = 1;
k = atof(arg[3]);

View File

@ -41,7 +41,7 @@ FixTempRescale::FixTempRescale(LAMMPS *lmp, int narg, char **arg) :
if (nevery <= 0) error->all("Illegal fix temp/rescale command");
scalar_flag = 1;
scalar_vector_freq = nevery;
global_freq = nevery;
extscalar = 1;
t_start = atof(arg[4]);

View File

@ -37,15 +37,15 @@ FixThermalConductivity::FixThermalConductivity(LAMMPS *lmp,
{
if (narg < 6) error->all("Illegal fix thermal/conductivity command");
scalar_flag = 1;
global_freq = nevery;
extscalar = 0;
MPI_Comm_rank(world,&me);
nevery = atoi(arg[3]);
if (nevery <= 0) error->all("Illegal fix thermal/conductivity command");
scalar_flag = 1;
scalar_vector_freq = nevery;
extscalar = 0;
if (strcmp(arg[4],"x") == 0) edim = 0;
else if (strcmp(arg[4],"y") == 0) edim = 1;
else if (strcmp(arg[4],"z") == 0) edim = 2;

View File

@ -48,7 +48,7 @@ FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) :
vector_flag = 1;
size_vector = 2;
scalar_vector_freq = 1;
global_freq = 1;
extvector = 1;
nevery = 1;
restart_peratom = 1;

View File

@ -43,7 +43,7 @@ FixViscosity::FixViscosity(LAMMPS *lmp, int narg, char **arg) :
if (nevery <= 0) error->all("Illegal fix viscosity command");
scalar_flag = 1;
scalar_vector_freq = nevery;
global_freq = nevery;
extscalar = 0;
if (strcmp(arg[4],"x") == 0) vdim = 0;

View File

@ -35,7 +35,7 @@ FixWall::FixWall(LAMMPS *lmp, int narg, char **arg) :
scalar_flag = 1;
vector_flag = 1;
size_vector = 6;
scalar_vector_freq = 1;
global_freq = 1;
extscalar = 1;
extvector = 1;
time_depend = 1;

View File

@ -212,7 +212,7 @@ void Thermo::init()
ifix = modify->find_fix(id_fix[i]);
if (ifix < 0) error->all("Could not find thermo fix ID");
fixes[i] = modify->fix[ifix];
if (output->thermo_every % fixes[i]->scalar_vector_freq)
if (output->thermo_every % fixes[i]->global_freq)
error->all("Thermo and fix not computed at compatible times");
}

View File

@ -713,10 +713,10 @@ double Variable::evaluate(char *str, Tree **tree)
treestack[ntreestack++] = newtree;
} else argstack[nargstack++] = value1;
// c_ID[] = per-atom scalar
// c_ID[] = per-atom vector
} else if (nbracket == 1 && index1 == 0 &&
compute->peratom_flag && compute->size_peratom == 0) {
compute->peratom_flag && compute->size_peratom_cols == 0) {
if (tree == NULL)
error->all("Per-atom compute in equal-style variable formula");
@ -731,15 +731,15 @@ double Variable::evaluate(char *str, Tree **tree)
Tree *newtree = new Tree();
newtree->type = ATOMARRAY;
newtree->array = compute->scalar_atom;
newtree->array = compute->vector_atom;
newtree->nstride = 1;
newtree->left = newtree->right = NULL;
treestack[ntreestack++] = newtree;
// c_ID[N] = global value from per-atom scalar
// c_ID[N] = global value from per-atom vector
} else if (nbracket == 1 && index1 > 0 &&
compute->peratom_flag && compute->size_peratom == 0) {
compute->peratom_flag && compute->size_peratom_cols == 0) {
if (update->whichflag == 0) {
if (compute->invoked_peratom != update->ntimestep)
@ -750,17 +750,17 @@ double Variable::evaluate(char *str, Tree **tree)
compute->invoked_flag |= INVOKED_PERATOM;
}
peratom2global(1,NULL,compute->scalar_atom,1,index1,
peratom2global(1,NULL,compute->vector_atom,1,index1,
tree,treestack,ntreestack,argstack,nargstack);
// c_ID[][2] = per-atom vector
// c_ID[][2] = per-atom array
} else if (nbracket == 2 && index1 == 0 && index2 > 0 &&
compute->peratom_flag) {
if (tree == NULL)
error->all("Per-atom compute in equal-style variable formula");
if (index2 > compute->size_peratom)
if (index2 > compute->size_peratom_cols)
error->all("Compute vector in variable formula is too small");
if (update->whichflag == 0) {
if (compute->invoked_peratom != update->ntimestep)
@ -773,17 +773,17 @@ double Variable::evaluate(char *str, Tree **tree)
Tree *newtree = new Tree();
newtree->type = ATOMARRAY;
newtree->array = &compute->vector_atom[0][index2-1];
newtree->nstride = compute->size_peratom;
newtree->array = &compute->array_atom[0][index2-1];
newtree->nstride = compute->size_peratom_cols;
newtree->left = newtree->right = NULL;
treestack[ntreestack++] = newtree;
// c_ID[N][2] = global value from per-atom vector
// c_ID[N][2] = global value from per-atom array
} else if (nbracket == 2 && index1 > 0 && index2 > 0 &&
compute->peratom_flag) {
if (index2 > compute->size_peratom)
if (index2 > compute->size_peratom_cols)
error->all("Compute vector in variable formula is too small");
if (update->whichflag == 0) {
if (compute->invoked_peratom != update->ntimestep)
@ -794,8 +794,8 @@ double Variable::evaluate(char *str, Tree **tree)
compute->invoked_flag |= INVOKED_PERATOM;
}
peratom2global(1,NULL,&compute->vector_atom[0][index2-1],
compute->size_peratom,index1,
peratom2global(1,NULL,&compute->array_atom[0][index2-1],
compute->size_peratom_cols,index1,
tree,treestack,ntreestack,argstack,nargstack);
} else error->all("Mismatched compute in variable formula");
@ -839,8 +839,7 @@ double Variable::evaluate(char *str, Tree **tree)
if (nbracket == 0 && fix->scalar_flag) {
if (update->whichflag > 0 &&
update->ntimestep % fix->scalar_vector_freq)
if (update->whichflag > 0 && update->ntimestep % fix->global_freq)
error->all("Fix in variable not computed at compatible time");
value1 = fix->compute_scalar();
if (tree) {
@ -857,8 +856,7 @@ double Variable::evaluate(char *str, Tree **tree)
if (index1 > fix->size_vector)
error->all("Fix vector in variable formula is too small");
if (update->whichflag > 0 &&
update->ntimestep % fix->scalar_vector_freq)
if (update->whichflag > 0 && update->ntimestep % fix->global_freq)
error->all("Fix in variable not computed at compatible time");
value1 = fix->compute_vector(index1-1);
if (tree) {
@ -869,10 +867,10 @@ double Variable::evaluate(char *str, Tree **tree)
treestack[ntreestack++] = newtree;
} else argstack[nargstack++] = value1;
// f_ID[] = per-atom scalar
// f_ID[] = per-atom vector
} else if (nbracket == 1 && index1 == 0 &&
fix->peratom_flag && fix->size_peratom == 0) {
fix->peratom_flag && fix->size_peratom_cols == 0) {
if (tree == NULL)
error->all("Per-atom fix in equal-style variable formula");
@ -881,53 +879,53 @@ double Variable::evaluate(char *str, Tree **tree)
error->all("Fix in variable not computed at compatible time");
Tree *newtree = new Tree();
newtree->type = ATOMARRAY;
newtree->array = fix->scalar_atom;
newtree->array = fix->vector_atom;
newtree->nstride = 1;
newtree->left = newtree->right = NULL;
treestack[ntreestack++] = newtree;
// f_ID[N] = global value from per-atom scalar
// f_ID[N] = global value from per-atom vector
} else if (nbracket == 1 && index1 > 0 &&
fix->peratom_flag && fix->size_peratom == 0) {
fix->peratom_flag && fix->size_peratom_cols == 0) {
if (update->whichflag > 0 &&
update->ntimestep % fix->peratom_freq)
error->all("Fix in variable not computed at compatible time");
peratom2global(1,NULL,fix->scalar_atom,1,index1,
peratom2global(1,NULL,fix->vector_atom,1,index1,
tree,treestack,ntreestack,argstack,nargstack);
// f_ID[][2] = per-atom vector
// f_ID[][2] = per-atom array
} else if (nbracket == 2 && index1 == 0 && index2 > 0 &&
fix->peratom_flag) {
if (tree == NULL)
error->all("Per-atom fix in equal-style variable formula");
if (index2 > fix->size_peratom)
if (index2 > fix->size_peratom_cols)
error->all("Fix vector in variable formula is too small");
if (update->whichflag > 0 &&
update->ntimestep % fix->peratom_freq)
error->all("Fix in variable not computed at compatible time");
Tree *newtree = new Tree();
newtree->type = ATOMARRAY;
newtree->array = &fix->vector_atom[0][index2-1];
newtree->nstride = fix->size_peratom;
newtree->array = &fix->array_atom[0][index2-1];
newtree->nstride = fix->size_peratom_cols;
newtree->left = newtree->right = NULL;
treestack[ntreestack++] = newtree;
// f_ID[N][2] = global value from per-atom vector
// f_ID[N][2] = global value from per-atom array
} else if (nbracket == 2 && index1 > 0 && index2 > 0 &&
fix->peratom_flag) {
if (index2 > fix->size_peratom)
if (index2 > fix->size_peratom_cols)
error->all("Fix vector in variable formula is too small");
if (update->whichflag > 0 &&
update->ntimestep % fix->peratom_freq)
error->all("Fix in variable not computed at compatible time");
peratom2global(1,NULL,&fix->vector_atom[0][index2-1],
fix->size_peratom,index1,
peratom2global(1,NULL,&fix->array_atom[0][index2-1],
fix->size_peratom_cols,index1,
tree,treestack,ntreestack,argstack,nargstack);
} else error->all("Mismatched fix in variable formula");