git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12073 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -31,6 +31,7 @@ AtomVec::AtomVec(LAMMPS *lmp) : Pointers(lmp)
|
||||
nmax = 0;
|
||||
bonds_allow = angles_allow = dihedrals_allow = impropers_allow = 0;
|
||||
mass_type = dipole_type = 0;
|
||||
forceclearflag = 0;
|
||||
size_data_bonus = 0;
|
||||
cudable = kokkosable = 0;
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@ class AtomVec : protected Pointers {
|
||||
int dihedrals_allow,impropers_allow; // 1 if dihedrals, impropers used
|
||||
int mass_type; // 1 if per-type masses
|
||||
int dipole_type; // 1 if per-type dipole moments
|
||||
int forceclearflag; // 1 if has forceclear() method
|
||||
|
||||
int comm_x_only; // 1 if only exchange x in forward comm
|
||||
int comm_f_only; // 1 if only exchange f in reverse comm
|
||||
@ -39,7 +40,6 @@ class AtomVec : protected Pointers {
|
||||
int size_data_bonus; // number of values in Bonus line
|
||||
int xcol_data; // column (1-N) where x is in Atom line
|
||||
|
||||
int forceclearflag; // 1 if has forceclear() method
|
||||
class Molecule **onemols; // list of molecules for style template
|
||||
int nset; // # of molecules in list
|
||||
|
||||
@ -113,6 +113,9 @@ class AtomVec : protected Pointers {
|
||||
void write_dihedral(FILE *, int, tagint **, int);
|
||||
void pack_improper(tagint **);
|
||||
void write_improper(FILE *, int, tagint **, int);
|
||||
|
||||
virtual int property_atom(char *) {return -1;}
|
||||
virtual void pack_property_atom(int, double *, int, int) {}
|
||||
|
||||
virtual bigint memory_usage() = 0;
|
||||
|
||||
|
||||
@ -107,6 +107,7 @@ void AtomVecHybrid::process_args(int narg, char **arg)
|
||||
impropers_allow = MAX(impropers_allow,styles[k]->impropers_allow);
|
||||
mass_type = MAX(mass_type,styles[k]->mass_type);
|
||||
dipole_type = MAX(dipole_type,styles[k]->dipole_type);
|
||||
forceclearflag = MAX(forceclearflag,styles[k]->forceclearflag);
|
||||
|
||||
comm_x_only = MIN(comm_x_only,styles[k]->comm_x_only);
|
||||
comm_f_only = MIN(comm_f_only,styles[k]->comm_f_only);
|
||||
@ -202,6 +203,14 @@ void AtomVecHybrid::clear_bonus()
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void AtomVecHybrid::force_clear(int n, size_t nbytes)
|
||||
{
|
||||
for (int k = 0; k < nstyles; k++)
|
||||
if (styles[k]->forceclearflag) styles[k]->force_clear(n,nbytes);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int AtomVecHybrid::pack_comm(int n, int *list, double *buf,
|
||||
int pbc_flag, int *pbc)
|
||||
{
|
||||
|
||||
@ -39,6 +39,7 @@ class AtomVecHybrid : public AtomVec {
|
||||
void grow_reset();
|
||||
void copy(int, int, int);
|
||||
void clear_bonus();
|
||||
void force_clear(int, size_t);
|
||||
int pack_comm(int, int *, double *, int, int *);
|
||||
int pack_comm_vel(int, int *, double *, int, int *);
|
||||
void unpack_comm(int, int, double *);
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#include "compute_property_atom.h"
|
||||
#include "math_extra.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "atom_vec_ellipsoid.h"
|
||||
#include "atom_vec_line.h"
|
||||
#include "atom_vec_tri.h"
|
||||
@ -239,27 +240,6 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
"atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_tqz;
|
||||
|
||||
} else if (strcmp(arg[iarg],"spin") == 0) {
|
||||
if (!atom->spin_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_spin;
|
||||
} else if (strcmp(arg[iarg],"eradius") == 0) {
|
||||
if (!atom->eradius_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_eradius;
|
||||
} else if (strcmp(arg[iarg],"ervel") == 0) {
|
||||
if (!atom->ervel_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_ervel;
|
||||
} else if (strcmp(arg[iarg],"erforce") == 0) {
|
||||
if (!atom->erforce_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_erforce;
|
||||
|
||||
} else if (strcmp(arg[iarg],"end1x") == 0) {
|
||||
avec_line = (AtomVecLine *) atom->style_match("line");
|
||||
if (!avec_line) error->all(FLERR,"Compute property/atom for "
|
||||
@ -342,6 +322,7 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_nbonds;
|
||||
|
||||
} else if (strstr(arg[iarg],"i_") == arg[iarg]) {
|
||||
int flag;
|
||||
index[i] = atom->find_custom(&arg[iarg][2],flag);
|
||||
@ -357,7 +338,12 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
"vector does not exist");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_dname;
|
||||
|
||||
} else error->all(FLERR,"Invalid keyword in compute property/atom command");
|
||||
} else {
|
||||
index[i] = atom->avec->property_atom(arg[iarg]);
|
||||
if (index[i] < 0)
|
||||
error->all(FLERR,"Invalid keyword in compute property/atom command");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_property_atom;
|
||||
}
|
||||
}
|
||||
|
||||
nmax = 0;
|
||||
@ -1341,66 +1327,6 @@ void ComputePropertyAtom::pack_tqz(int n)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputePropertyAtom::pack_spin(int n)
|
||||
{
|
||||
int *spin = atom->spin;
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) buf[n] = spin[i];
|
||||
else buf[n] = 0.0;
|
||||
n += nvalues;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputePropertyAtom::pack_eradius(int n)
|
||||
{
|
||||
double *eradius = atom->eradius;
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) buf[n] = eradius[i];
|
||||
else buf[n] = 0.0;
|
||||
n += nvalues;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputePropertyAtom::pack_ervel(int n)
|
||||
{
|
||||
double *ervel = atom->ervel;
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) buf[n] = ervel[i];
|
||||
else buf[n] = 0.0;
|
||||
n += nvalues;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputePropertyAtom::pack_erforce(int n)
|
||||
{
|
||||
double *erforce = atom->erforce;
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) buf[n] = erforce[i];
|
||||
else buf[n] = 0.0;
|
||||
n += nvalues;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputePropertyAtom::pack_end1x(int n)
|
||||
{
|
||||
AtomVecLine::Bonus *bonus = avec_line->bonus;
|
||||
@ -1734,3 +1660,10 @@ void ComputePropertyAtom::pack_dname(int n)
|
||||
n += nvalues;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputePropertyAtom::pack_property_atom(int n)
|
||||
{
|
||||
atom->avec->pack_property_atom(index[n],&buf[n],nvalues,groupbit);
|
||||
}
|
||||
|
||||
@ -101,10 +101,6 @@ class ComputePropertyAtom : public Compute {
|
||||
void pack_tqx(int);
|
||||
void pack_tqy(int);
|
||||
void pack_tqz(int);
|
||||
void pack_spin(int);
|
||||
void pack_eradius(int);
|
||||
void pack_ervel(int);
|
||||
void pack_erforce(int);
|
||||
void pack_end1x(int);
|
||||
void pack_end1y(int);
|
||||
void pack_end1z(int);
|
||||
@ -125,6 +121,8 @@ class ComputePropertyAtom : public Compute {
|
||||
|
||||
void pack_iname(int);
|
||||
void pack_dname(int);
|
||||
|
||||
void pack_property_atom(int);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user