enable replicate to work with local ptrs

This commit is contained in:
Steve Plimpton
2019-12-18 08:56:03 -07:00
parent db6d272303
commit b6374bacfb
47 changed files with 686 additions and 480 deletions

View File

@ -54,6 +54,16 @@ AtomVecDipole::AtomVecDipole(LAMMPS *lmp) : AtomVec(lmp)
setup_fields(); setup_fields();
} }
/* ----------------------------------------------------------------------
set local copies of all grow ptrs used by this class, except defaults
needed in replicate when 2 atom classes exist and it calls pack_restart()
------------------------------------------------------------------------- */
void AtomVecDipole::grow_pointers()
{
mu = atom->mu;
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
modify what AtomVec::data_atom() just unpacked modify what AtomVec::data_atom() just unpacked
or initialize other atom quantities or initialize other atom quantities
@ -61,6 +71,7 @@ AtomVecDipole::AtomVecDipole(LAMMPS *lmp) : AtomVec(lmp)
void AtomVecDipole::data_atom_post(int ilocal) void AtomVecDipole::data_atom_post(int ilocal)
{ {
double *mu = atom->mu[ilocal]; double *mu_one = mu[ilocal];
mu[3] = sqrt(mu[0]*mu[0] + mu[1]*mu[1] + mu[2]*mu[2]); mu_one[3] =
sqrt(mu_one[0]*mu_one[0] + mu_one[1]*mu_one[1] + mu_one[2]*mu_one[2]);
} }

View File

@ -27,7 +27,12 @@ namespace LAMMPS_NS {
class AtomVecDipole : public AtomVec { class AtomVecDipole : public AtomVec {
public: public:
AtomVecDipole(class LAMMPS *); AtomVecDipole(class LAMMPS *);
void grow_pointers();
void data_atom_post(int); void data_atom_post(int);
private:
double **mu;
}; };
} }

View File

@ -66,6 +66,20 @@ AtomVecAngle::~AtomVecAngle()
delete [] angle_negative; delete [] angle_negative;
} }
/* ----------------------------------------------------------------------
set local copies of all grow ptrs used by this class, except defaults
needed in replicate when 2 atom classes exist and it calls pack_restart()
------------------------------------------------------------------------- */
void AtomVecAngle::grow_pointers()
{
num_bond = atom->num_bond;
bond_type = atom->bond_type;
num_angle = atom->num_angle;
angle_type = atom->angle_type;
nspecial = atom->nspecial;
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
modify values for AtomVec::pack_restart() to pack modify values for AtomVec::pack_restart() to pack
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
@ -87,11 +101,6 @@ void AtomVecAngle::pack_restart_pre(int ilocal)
// flip any negative types to positive and flag which ones // flip any negative types to positive and flag which ones
int *num_bond = atom->num_bond;
int **bond_type = atom->bond_type;
int *num_angle = atom->num_angle;
int **angle_type = atom->angle_type;
int any_bond_negative = 0; int any_bond_negative = 0;
for (int m = 0; m < num_bond[ilocal]; m++) { for (int m = 0; m < num_bond[ilocal]; m++) {
if (bond_type[ilocal][m] < 0) { if (bond_type[ilocal][m] < 0) {
@ -120,15 +129,11 @@ void AtomVecAngle::pack_restart_post(int ilocal)
// restore the flagged types to their negative values // restore the flagged types to their negative values
if (any_bond_negative) { if (any_bond_negative) {
int *num_bond = atom->num_bond;
int **bond_type = atom->bond_type;
for (int m = 0; m < num_bond[ilocal]; m++) for (int m = 0; m < num_bond[ilocal]; m++)
if (bond_negative[m]) bond_type[ilocal][m] = -bond_type[ilocal][m]; if (bond_negative[m]) bond_type[ilocal][m] = -bond_type[ilocal][m];
} }
if (any_angle_negative) { if (any_angle_negative) {
int *num_angle = atom->num_angle;
int **angle_type = atom->angle_type;
for (int m = 0; m < num_angle[ilocal]; m++) for (int m = 0; m < num_angle[ilocal]; m++)
if (angle_negative[m]) angle_type[ilocal][m] = -angle_type[ilocal][m]; if (angle_negative[m]) angle_type[ilocal][m] = -angle_type[ilocal][m];
} }
@ -140,9 +145,9 @@ void AtomVecAngle::pack_restart_post(int ilocal)
void AtomVecAngle::unpack_restart_init(int ilocal) void AtomVecAngle::unpack_restart_init(int ilocal)
{ {
atom->nspecial[ilocal][0] = 0; nspecial[ilocal][0] = 0;
atom->nspecial[ilocal][1] = 0; nspecial[ilocal][1] = 0;
atom->nspecial[ilocal][2] = 0; nspecial[ilocal][2] = 0;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -152,9 +157,9 @@ void AtomVecAngle::unpack_restart_init(int ilocal)
void AtomVecAngle::data_atom_post(int ilocal) void AtomVecAngle::data_atom_post(int ilocal)
{ {
atom->num_bond[ilocal] = 0; num_bond[ilocal] = 0;
atom->num_angle[ilocal] = 0; num_angle[ilocal] = 0;
atom->nspecial[ilocal][0] = 0; nspecial[ilocal][0] = 0;
atom->nspecial[ilocal][1] = 0; nspecial[ilocal][1] = 0;
atom->nspecial[ilocal][2] = 0; nspecial[ilocal][2] = 0;
} }

View File

@ -28,12 +28,18 @@ class AtomVecAngle : public AtomVec {
public: public:
AtomVecAngle(class LAMMPS *); AtomVecAngle(class LAMMPS *);
~AtomVecAngle(); ~AtomVecAngle();
void grow_pointers();
void pack_restart_pre(int); void pack_restart_pre(int);
void pack_restart_post(int); void pack_restart_post(int);
void unpack_restart_init(int); void unpack_restart_init(int);
void data_atom_post(int); void data_atom_post(int);
private: private:
int *num_bond,*num_angle;
int **bond_type,**angle_type;
int **nspecial;
int any_bond_negative,any_angle_negative; int any_bond_negative,any_angle_negative;
int bond_per_atom,angle_per_atom; int bond_per_atom,angle_per_atom;
int *bond_negative,*angle_negative; int *bond_negative,*angle_negative;

View File

@ -61,19 +61,17 @@ AtomVecBond::~AtomVecBond()
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
grow atom arrays set local copies of all grow ptrs used by this class, except defaults
must set local copy of body ptr needed in replicate when 2 atom classes exist and it calls pack_restart()
needed in replicate when 2 atom classes exist and pack_restart() is called
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void AtomVecBond::grow(int n) void AtomVecBond::grow_pointers()
{ {
AtomVec::grow(n);
num_bond = atom->num_bond; num_bond = atom->num_bond;
bond_type = atom->bond_type; bond_type = atom->bond_type;
nspecial = atom->nspecial;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
modify values for AtomVec::pack_restart() to pack modify values for AtomVec::pack_restart() to pack
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
@ -90,9 +88,6 @@ void AtomVecBond::pack_restart_pre(int ilocal)
// flip any negative types to positive and flag which ones // flip any negative types to positive and flag which ones
//int *num_bond = atom->num_bond;
//int **bond_type = atom->bond_type;
any_bond_negative = 0; any_bond_negative = 0;
for (int m = 0; m < num_bond[ilocal]; m++) { for (int m = 0; m < num_bond[ilocal]; m++) {
if (bond_type[ilocal][m] < 0) { if (bond_type[ilocal][m] < 0) {
@ -112,8 +107,6 @@ void AtomVecBond::pack_restart_post(int ilocal)
// restore the flagged types to their negative values // restore the flagged types to their negative values
if (any_bond_negative) { if (any_bond_negative) {
//int *num_bond = atom->num_bond;
//int **bond_type = atom->bond_type;
for (int m = 0; m < num_bond[ilocal]; m++) for (int m = 0; m < num_bond[ilocal]; m++)
if (bond_negative[m]) bond_type[ilocal][m] = -bond_type[ilocal][m]; if (bond_negative[m]) bond_type[ilocal][m] = -bond_type[ilocal][m];
} }
@ -125,9 +118,9 @@ void AtomVecBond::pack_restart_post(int ilocal)
void AtomVecBond::unpack_restart_init(int ilocal) void AtomVecBond::unpack_restart_init(int ilocal)
{ {
atom->nspecial[ilocal][0] = 0; nspecial[ilocal][0] = 0;
atom->nspecial[ilocal][1] = 0; nspecial[ilocal][1] = 0;
atom->nspecial[ilocal][2] = 0; nspecial[ilocal][2] = 0;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -137,8 +130,8 @@ void AtomVecBond::unpack_restart_init(int ilocal)
void AtomVecBond::data_atom_post(int ilocal) void AtomVecBond::data_atom_post(int ilocal)
{ {
atom->num_bond[ilocal] = 0; num_bond[ilocal] = 0;
atom->nspecial[ilocal][0] = 0; nspecial[ilocal][0] = 0;
atom->nspecial[ilocal][1] = 0; nspecial[ilocal][1] = 0;
atom->nspecial[ilocal][2] = 0; nspecial[ilocal][2] = 0;
} }

View File

@ -28,19 +28,21 @@ class AtomVecBond : public AtomVec {
public: public:
AtomVecBond(class LAMMPS *); AtomVecBond(class LAMMPS *);
~AtomVecBond(); ~AtomVecBond();
void grow(int);
void grow_pointers();
void pack_restart_pre(int); void pack_restart_pre(int);
void pack_restart_post(int); void pack_restart_post(int);
void unpack_restart_init(int); void unpack_restart_init(int);
void data_atom_post(int); void data_atom_post(int);
private: private:
int *num_bond;
int **bond_type;
int **nspecial;
int any_bond_negative; int any_bond_negative;
int bond_per_atom; int bond_per_atom;
int *bond_negative; int *bond_negative;
int *num_bond;
int **bond_type;
}; };
} }

View File

@ -88,6 +88,24 @@ AtomVecFull::~AtomVecFull()
delete [] improper_negative; delete [] improper_negative;
} }
/* ----------------------------------------------------------------------
set local copies of all grow ptrs used by this class, except defaults
needed in replicate when 2 atom classes exist and it calls pack_restart()
------------------------------------------------------------------------- */
void AtomVecFull::grow_pointers()
{
num_bond = atom->num_bond;
bond_type = atom->bond_type;
num_angle = atom->num_angle;
angle_type = atom->angle_type;
num_dihedral = atom->num_dihedral;
dihedral_type = atom->dihedral_type;
num_improper = atom->num_improper;
improper_type = atom->improper_type;
nspecial = atom->nspecial;
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
modify values for AtomVec::pack_restart() to pack modify values for AtomVec::pack_restart() to pack
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
@ -119,15 +137,6 @@ void AtomVecFull::pack_restart_pre(int ilocal)
// flip any negative types to positive and flag which ones // flip any negative types to positive and flag which ones
int *num_bond = atom->num_bond;
int **bond_type = atom->bond_type;
int *num_angle = atom->num_angle;
int **angle_type = atom->angle_type;
int *num_dihedral = atom->num_dihedral;
int **dihedral_type = atom->dihedral_type;
int *num_improper = atom->num_improper;
int **improper_type = atom->improper_type;
any_bond_negative = 0; any_bond_negative = 0;
for (int m = 0; m < num_bond[ilocal]; m++) { for (int m = 0; m < num_bond[ilocal]; m++) {
if (bond_type[ilocal][m] < 0) { if (bond_type[ilocal][m] < 0) {
@ -174,30 +183,22 @@ void AtomVecFull::pack_restart_post(int ilocal)
// restore the flagged types to their negative values // restore the flagged types to their negative values
if (any_bond_negative) { if (any_bond_negative) {
int *num_bond = atom->num_bond;
int **bond_type = atom->bond_type;
for (int m = 0; m < num_bond[ilocal]; m++) for (int m = 0; m < num_bond[ilocal]; m++)
if (bond_negative[m]) bond_type[ilocal][m] = -bond_type[ilocal][m]; if (bond_negative[m]) bond_type[ilocal][m] = -bond_type[ilocal][m];
} }
if (any_angle_negative) { if (any_angle_negative) {
int *num_angle = atom->num_angle;
int **angle_type = atom->angle_type;
for (int m = 0; m < num_angle[ilocal]; m++) for (int m = 0; m < num_angle[ilocal]; m++)
if (angle_negative[m]) angle_type[ilocal][m] = -angle_type[ilocal][m]; if (angle_negative[m]) angle_type[ilocal][m] = -angle_type[ilocal][m];
} }
if (any_dihedral_negative) { if (any_dihedral_negative) {
int *num_dihedral = atom->num_dihedral;
int **dihedral_type = atom->dihedral_type;
for (int m = 0; m < num_dihedral[ilocal]; m++) for (int m = 0; m < num_dihedral[ilocal]; m++)
if (dihedral_negative[m]) if (dihedral_negative[m])
dihedral_type[ilocal][m] = -dihedral_type[ilocal][m]; dihedral_type[ilocal][m] = -dihedral_type[ilocal][m];
} }
if (any_improper_negative) { if (any_improper_negative) {
int *num_improper = atom->num_improper;
int **improper_type = atom->improper_type;
for (int m = 0; m < num_improper[ilocal]; m++) for (int m = 0; m < num_improper[ilocal]; m++)
if (improper_negative[m]) if (improper_negative[m])
improper_type[ilocal][m] = -improper_type[ilocal][m]; improper_type[ilocal][m] = -improper_type[ilocal][m];
@ -210,9 +211,9 @@ void AtomVecFull::pack_restart_post(int ilocal)
void AtomVecFull::unpack_restart_init(int ilocal) void AtomVecFull::unpack_restart_init(int ilocal)
{ {
atom->nspecial[ilocal][0] = 0; nspecial[ilocal][0] = 0;
atom->nspecial[ilocal][1] = 0; nspecial[ilocal][1] = 0;
atom->nspecial[ilocal][2] = 0; nspecial[ilocal][2] = 0;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -222,11 +223,11 @@ void AtomVecFull::unpack_restart_init(int ilocal)
void AtomVecFull::data_atom_post(int ilocal) void AtomVecFull::data_atom_post(int ilocal)
{ {
atom->num_bond[ilocal] = 0; num_bond[ilocal] = 0;
atom->num_angle[ilocal] = 0; num_angle[ilocal] = 0;
atom->num_dihedral[ilocal] = 0; num_dihedral[ilocal] = 0;
atom->num_improper[ilocal] = 0; num_improper[ilocal] = 0;
atom->nspecial[ilocal][0] = 0; nspecial[ilocal][0] = 0;
atom->nspecial[ilocal][1] = 0; nspecial[ilocal][1] = 0;
atom->nspecial[ilocal][2] = 0; nspecial[ilocal][2] = 0;
} }

View File

@ -28,12 +28,18 @@ class AtomVecFull : public AtomVec {
public: public:
AtomVecFull(class LAMMPS *); AtomVecFull(class LAMMPS *);
~AtomVecFull(); ~AtomVecFull();
void grow_pointers();
void pack_restart_pre(int); void pack_restart_pre(int);
void pack_restart_post(int); void pack_restart_post(int);
void unpack_restart_init(int); void unpack_restart_init(int);
void data_atom_post(int); void data_atom_post(int);
private: private:
int *num_bond,*num_angle,*num_dihedral,*num_improper;
int **bond_type,**angle_type,**dihedral_type,**improper_type;
int **nspecial;
int any_bond_negative,any_angle_negative, int any_bond_negative,any_angle_negative,
any_dihedral_negative,any_improper_negative; any_dihedral_negative,any_improper_negative;
int bond_per_atom,angle_per_atom,dihedral_per_atom,improper_per_atom; int bond_per_atom,angle_per_atom,dihedral_per_atom,improper_per_atom;

View File

@ -88,6 +88,24 @@ AtomVecMolecular::~AtomVecMolecular()
delete [] improper_negative; delete [] improper_negative;
} }
/* ----------------------------------------------------------------------
set local copies of all grow ptrs used by this class, except defaults
needed in replicate when 2 atom classes exist and it calls pack_restart()
------------------------------------------------------------------------- */
void AtomVecMolecular::grow_pointers()
{
num_bond = atom->num_bond;
bond_type = atom->bond_type;
num_angle = atom->num_angle;
angle_type = atom->angle_type;
num_dihedral = atom->num_dihedral;
dihedral_type = atom->dihedral_type;
num_improper = atom->num_improper;
improper_type = atom->improper_type;
nspecial = atom->nspecial;
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
modify values for AtomVec::pack_restart() to pack modify values for AtomVec::pack_restart() to pack
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
@ -119,15 +137,6 @@ void AtomVecMolecular::pack_restart_pre(int ilocal)
// flip any negative types to positive and flag which ones // flip any negative types to positive and flag which ones
int *num_bond = atom->num_bond;
int **bond_type = atom->bond_type;
int *num_angle = atom->num_angle;
int **angle_type = atom->angle_type;
int *num_dihedral = atom->num_dihedral;
int **dihedral_type = atom->dihedral_type;
int *num_improper = atom->num_improper;
int **improper_type = atom->improper_type;
any_bond_negative = 0; any_bond_negative = 0;
for (int m = 0; m < num_bond[ilocal]; m++) { for (int m = 0; m < num_bond[ilocal]; m++) {
if (bond_type[ilocal][m] < 0) { if (bond_type[ilocal][m] < 0) {
@ -174,30 +183,22 @@ void AtomVecMolecular::pack_restart_post(int ilocal)
// restore the flagged types to their negative values // restore the flagged types to their negative values
if (any_bond_negative) { if (any_bond_negative) {
int *num_bond = atom->num_bond;
int **bond_type = atom->bond_type;
for (int m = 0; m < num_bond[ilocal]; m++) for (int m = 0; m < num_bond[ilocal]; m++)
if (bond_negative[m]) bond_type[ilocal][m] = -bond_type[ilocal][m]; if (bond_negative[m]) bond_type[ilocal][m] = -bond_type[ilocal][m];
} }
if (any_angle_negative) { if (any_angle_negative) {
int *num_angle = atom->num_angle;
int **angle_type = atom->angle_type;
for (int m = 0; m < num_angle[ilocal]; m++) for (int m = 0; m < num_angle[ilocal]; m++)
if (angle_negative[m]) angle_type[ilocal][m] = -angle_type[ilocal][m]; if (angle_negative[m]) angle_type[ilocal][m] = -angle_type[ilocal][m];
} }
if (any_dihedral_negative) { if (any_dihedral_negative) {
int *num_dihedral = atom->num_dihedral;
int **dihedral_type = atom->dihedral_type;
for (int m = 0; m < num_dihedral[ilocal]; m++) for (int m = 0; m < num_dihedral[ilocal]; m++)
if (dihedral_negative[m]) if (dihedral_negative[m])
dihedral_type[ilocal][m] = -dihedral_type[ilocal][m]; dihedral_type[ilocal][m] = -dihedral_type[ilocal][m];
} }
if (any_improper_negative) { if (any_improper_negative) {
int *num_improper = atom->num_improper;
int **improper_type = atom->improper_type;
for (int m = 0; m < num_improper[ilocal]; m++) for (int m = 0; m < num_improper[ilocal]; m++)
if (improper_negative[m]) if (improper_negative[m])
improper_type[ilocal][m] = -improper_type[ilocal][m]; improper_type[ilocal][m] = -improper_type[ilocal][m];
@ -210,9 +211,9 @@ void AtomVecMolecular::pack_restart_post(int ilocal)
void AtomVecMolecular::unpack_restart_init(int ilocal) void AtomVecMolecular::unpack_restart_init(int ilocal)
{ {
atom->nspecial[ilocal][0] = 0; nspecial[ilocal][0] = 0;
atom->nspecial[ilocal][1] = 0; nspecial[ilocal][1] = 0;
atom->nspecial[ilocal][2] = 0; nspecial[ilocal][2] = 0;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -222,11 +223,11 @@ void AtomVecMolecular::unpack_restart_init(int ilocal)
void AtomVecMolecular::data_atom_post(int ilocal) void AtomVecMolecular::data_atom_post(int ilocal)
{ {
atom->num_bond[ilocal] = 0; num_bond[ilocal] = 0;
atom->num_angle[ilocal] = 0; num_angle[ilocal] = 0;
atom->num_dihedral[ilocal] = 0; num_dihedral[ilocal] = 0;
atom->num_improper[ilocal] = 0; num_improper[ilocal] = 0;
atom->nspecial[ilocal][0] = 0; nspecial[ilocal][0] = 0;
atom->nspecial[ilocal][1] = 0; nspecial[ilocal][1] = 0;
atom->nspecial[ilocal][2] = 0; nspecial[ilocal][2] = 0;
} }

View File

@ -28,12 +28,18 @@ class AtomVecMolecular : public AtomVec {
public: public:
AtomVecMolecular(class LAMMPS *); AtomVecMolecular(class LAMMPS *);
~AtomVecMolecular(); ~AtomVecMolecular();
void grow_pointers();
void pack_restart_pre(int); void pack_restart_pre(int);
void pack_restart_post(int); void pack_restart_post(int);
void unpack_restart_init(int); void unpack_restart_init(int);
void data_atom_post(int); void data_atom_post(int);
private: private:
int *num_bond,*num_angle,*num_dihedral,*num_improper;
int **bond_type,**angle_type,**dihedral_type,**improper_type;
int **nspecial;
int any_bond_negative,any_angle_negative, int any_bond_negative,any_angle_negative,
any_dihedral_negative,any_improper_negative; any_dihedral_negative,any_improper_negative;
int bond_per_atom,angle_per_atom,dihedral_per_atom,improper_per_atom; int bond_per_atom,angle_per_atom,dihedral_per_atom,improper_per_atom;

View File

@ -96,14 +96,25 @@ void AtomVecTemplate::process_args(int narg, char **arg)
} }
} }
/* ----------------------------------------------------------------------
set local copies of all grow ptrs used by this class, except defaults
needed in replicate when 2 atom classes exist and it calls pack_restart()
------------------------------------------------------------------------- */
void AtomVecTemplate::grow_pointers()
{
molindex = atom->molindex;
molatom = atom->molatom;
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
initialize non-zero atom quantities initialize non-zero atom quantities
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void AtomVecTemplate::create_atom_post(int ilocal) void AtomVecTemplate::create_atom_post(int ilocal)
{ {
atom->molindex[ilocal] = -1; molindex[ilocal] = -1;
atom->molatom[ilocal] = -1; molatom[ilocal] = -1;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -113,11 +124,11 @@ void AtomVecTemplate::create_atom_post(int ilocal)
void AtomVecTemplate::data_atom_post(int ilocal) void AtomVecTemplate::data_atom_post(int ilocal)
{ {
int molindex = atom->molindex[ilocal]; int molindex_one = molindex[ilocal];
int molatom = atom->molatom[ilocal]; int molatom_one = molatom[ilocal];
if (molindex < 0 || molindex >= nset) if (molindex_one < 0 || molindex_one >= nset)
error->one(FLERR,"Invalid template index in Atoms section of data file"); error->one(FLERR,"Invalid template index in Atoms section of data file");
if (molatom < 0 || molatom >= onemols[molindex]->natoms) if (molatom_one < 0 || molatom_one >= onemols[molindex_one]->natoms)
error->one(FLERR,"Invalid template atom in Atoms section of data file"); error->one(FLERR,"Invalid template atom in Atoms section of data file");
} }

View File

@ -27,9 +27,14 @@ namespace LAMMPS_NS {
class AtomVecTemplate : public AtomVec { class AtomVecTemplate : public AtomVec {
public: public:
AtomVecTemplate(class LAMMPS *); AtomVecTemplate(class LAMMPS *);
void grow_pointers();
void process_args(int, char **); void process_args(int, char **);
void create_atom_post(int); void create_atom_post(int);
void data_atom_post(int); void data_atom_post(int);
private:
int *molindex,*molatom;
}; };
} }

View File

@ -69,18 +69,31 @@ AtomVecPeri::AtomVecPeri(LAMMPS *lmp) : AtomVec(lmp)
setup_fields(); setup_fields();
} }
/* ----------------------------------------------------------------------
set local copies of all grow ptrs used by this class, except defaults
needed in replicate when 2 atom classes exist and it calls pack_restart()
------------------------------------------------------------------------- */
void AtomVecPeri::grow_pointers()
{
rmass = atom->rmass;
vfrac = atom->vfrac;
s0 = atom->s0;
x0 = atom->x0;
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
initialize non-zero atom quantities initialize non-zero atom quantities
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void AtomVecPeri::create_atom_post(int ilocal) void AtomVecPeri::create_atom_post(int ilocal)
{ {
atom->vfrac[ilocal] = 1.0; vfrac[ilocal] = 1.0;
atom->rmass[ilocal] = 1.0; rmass[ilocal] = 1.0;
atom->s0[ilocal] = DBL_MAX; s0[ilocal] = DBL_MAX;
atom->x0[ilocal][0] = atom->x[ilocal][0]; x0[ilocal][0] = x[ilocal][0];
atom->x0[ilocal][1] = atom->x[ilocal][1]; x0[ilocal][1] = x[ilocal][1];
atom->x0[ilocal][2] = atom->x[ilocal][2]; x0[ilocal][2] = x[ilocal][2];
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -90,12 +103,12 @@ void AtomVecPeri::create_atom_post(int ilocal)
void AtomVecPeri::data_atom_post(int ilocal) void AtomVecPeri::data_atom_post(int ilocal)
{ {
atom->s0[ilocal] = DBL_MAX; s0[ilocal] = DBL_MAX;
atom->x0[ilocal][0] = atom->x[ilocal][0]; x0[ilocal][0] = x[ilocal][0];
atom->x0[ilocal][1] = atom->x[ilocal][1]; x0[ilocal][1] = x[ilocal][1];
atom->x0[ilocal][2] = atom->x[ilocal][2]; x0[ilocal][2] = x[ilocal][2];
if (atom->rmass[ilocal] <= 0.0) if (rmass[ilocal] <= 0.0)
error->one(FLERR,"Invalid mass in Atoms section of data file"); error->one(FLERR,"Invalid mass in Atoms section of data file");
} }
@ -124,14 +137,12 @@ void AtomVecPeri::pack_property_atom(int index, double *buf,
int n = 0; int n = 0;
if (index == 0) { if (index == 0) {
double *vfrac = atom->vfrac;
for (int i = 0; i < nlocal; i++) { for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = vfrac[i]; if (mask[i] & groupbit) buf[n] = vfrac[i];
else buf[n] = 0.0; else buf[n] = 0.0;
n += nvalues; n += nvalues;
} }
} else if (index == 1) { } else if (index == 1) {
double *s0 = atom->s0;
for (int i = 0; i < nlocal; i++) { for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = s0[i]; if (mask[i] & groupbit) buf[n] = s0[i];
else buf[n] = 0.0; else buf[n] = 0.0;

View File

@ -27,10 +27,17 @@ namespace LAMMPS_NS {
class AtomVecPeri : public AtomVec { class AtomVecPeri : public AtomVec {
public: public:
AtomVecPeri(class LAMMPS *); AtomVecPeri(class LAMMPS *);
void grow_pointers();
void create_atom_post(int); void create_atom_post(int);
void data_atom_post(int); void data_atom_post(int);
int property_atom(char *); int property_atom(char *);
void pack_property_atom(int, double *, int, int); void pack_property_atom(int, double *, int, int);
private:
double *rmass,*vfrac,*s0;
double **x0;
}; };
} }

View File

@ -61,6 +61,18 @@ AtomVecSpin::AtomVecSpin(LAMMPS *lmp) : AtomVec(lmp)
setup_fields(); setup_fields();
} }
/* ----------------------------------------------------------------------
set local copies of all grow ptrs used by this class, except defaults
needed in replicate when 2 atom classes exist and it calls pack_restart()
------------------------------------------------------------------------- */
void AtomVecSpin::grow_pointers()
{
sp = atom->sp;
fm = atom->fm;
fm_long = atom->fm_long;
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
clear extra forces starting at atom N clear extra forces starting at atom N
nbytes = # of bytes to clear for a per-atom vector nbytes = # of bytes to clear for a per-atom vector
@ -69,9 +81,9 @@ AtomVecSpin::AtomVecSpin(LAMMPS *lmp) : AtomVec(lmp)
void AtomVecSpin::force_clear(int n, size_t nbytes) void AtomVecSpin::force_clear(int n, size_t nbytes)
{ {
memset(&atom->f[n][0],0,3*nbytes); memset(&f[n][0],0,3*nbytes);
memset(&atom->fm[n][0],0,3*nbytes); memset(&fm[n][0],0,3*nbytes);
memset(&atom->fm_long[n][0],0,3*nbytes); memset(&fm_long[n][0],0,3*nbytes);
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -81,9 +93,10 @@ void AtomVecSpin::force_clear(int n, size_t nbytes)
void AtomVecSpin::data_atom_post(int ilocal) void AtomVecSpin::data_atom_post(int ilocal)
{ {
double *sp = atom->sp[ilocal]; double *sp_one = sp[ilocal];
double inorm = 1.0/sqrt(sp[0]*sp[0] + sp[1]*sp[1] + sp[2]*sp[2]); double norm =
sp[0] *= inorm; 1.0/sqrt(sp_one[0]*sp_one[0] + sp_one[1]*sp_one[1] + sp_one[2]*sp_one[2]);
sp[1] *= inorm; sp_one[0] *= norm;
sp[2] *= inorm; sp_one[1] *= norm;
sp_one[2] *= norm;
} }

View File

@ -27,8 +27,13 @@ namespace LAMMPS_NS {
class AtomVecSpin : public AtomVec { class AtomVecSpin : public AtomVec {
public: public:
AtomVecSpin(class LAMMPS *); AtomVecSpin(class LAMMPS *);
void grow_pointers();
void force_clear(int, size_t); void force_clear(int, size_t);
void data_atom_post(int); void data_atom_post(int);
private:
double **sp,**fm,**fm_long;
}; };
} }

View File

@ -52,14 +52,30 @@ AtomVecDPD::AtomVecDPD(LAMMPS *lmp) : AtomVec(lmp)
setup_fields(); setup_fields();
} }
/* ----------------------------------------------------------------------
set local copies of all grow ptrs used by this class, except defaults
needed in replicate when 2 atom classes exist and it calls pack_restart()
------------------------------------------------------------------------- */
void AtomVecDPD::grow_pointers()
{
rho = atom->rho;
dpdTheta = atom->dpdTheta;
uCond = atom->uCond;
uMech = atom->uMech;
uChem = atom->uChem;
uCG = atom->uCG;
uCGnew = atom->uCGnew;
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
initialize other atom quantities after AtomVec::unpack_restart() initialize other atom quantities after AtomVec::unpack_restart()
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void AtomVecDPD::unpack_restart_init(int ilocal) void AtomVecDPD::unpack_restart_init(int ilocal)
{ {
atom->uCG[ilocal] = 0.0; uCG[ilocal] = 0.0;
atom->uCGnew[ilocal] = 0.0; uCGnew[ilocal] = 0.0;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -69,14 +85,14 @@ void AtomVecDPD::unpack_restart_init(int ilocal)
void AtomVecDPD::data_atom_post(int ilocal) void AtomVecDPD::data_atom_post(int ilocal)
{ {
atom->rho[ilocal] = 0.0; rho[ilocal] = 0.0;
atom->uCond[ilocal] = 0.0; uCond[ilocal] = 0.0;
atom->uMech[ilocal] = 0.0; uMech[ilocal] = 0.0;
atom->uChem[ilocal] = 0.0; uChem[ilocal] = 0.0;
atom->uCG[ilocal] = 0.0; uCG[ilocal] = 0.0;
atom->uCGnew[ilocal] = 0.0; uCGnew[ilocal] = 0.0;
if (atom->dpdTheta[ilocal] <= 0) if (dpdTheta[ilocal] <= 0)
error->one(FLERR,"Internal temperature in Atoms section of date file " error->one(FLERR,"Internal temperature in Atoms section of date file "
"must be > zero"); "must be > zero");
} }

View File

@ -27,8 +27,15 @@ namespace LAMMPS_NS {
class AtomVecDPD : public AtomVec { class AtomVecDPD : public AtomVec {
public: public:
AtomVecDPD(class LAMMPS *); AtomVecDPD(class LAMMPS *);
void grow_pointers();
void unpack_restart_init(int); void unpack_restart_init(int);
void data_atom_post(int); void data_atom_post(int);
private:
double *rho,*dpdTheta;
double *uCond,*uMech,*uChem;
double *uCG,*uCGnew;
}; };
} }

View File

@ -69,6 +69,19 @@ AtomVecElectron::AtomVecElectron(LAMMPS *lmp) : AtomVec(lmp)
setup_fields(); setup_fields();
} }
/* ----------------------------------------------------------------------
set local copies of all grow ptrs used by this class, except defaults
needed in replicate when 2 atom classes exist and it calls pack_restart()
------------------------------------------------------------------------- */
void AtomVecElectron::grow_pointers()
{
spin = atom->spin;
eradius = atom->eradius;
ervel = atom->ervel;
erforce = atom->erforce;
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
clear extra forces starting at atom N clear extra forces starting at atom N
nbytes = # of bytes to clear for a per-atom vector nbytes = # of bytes to clear for a per-atom vector
@ -76,7 +89,7 @@ AtomVecElectron::AtomVecElectron(LAMMPS *lmp) : AtomVec(lmp)
void AtomVecElectron::force_clear(int n, size_t nbytes) void AtomVecElectron::force_clear(int n, size_t nbytes)
{ {
memset(&atom->erforce[n],0,nbytes); memset(&erforce[n],0,nbytes);
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -85,8 +98,8 @@ void AtomVecElectron::force_clear(int n, size_t nbytes)
void AtomVecElectron::create_atom_post(int ilocal) void AtomVecElectron::create_atom_post(int ilocal)
{ {
atom->spin[ilocal] = 1; spin[ilocal] = 1;
atom->eradius[ilocal] = 1.0; eradius[ilocal] = 1.0;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -96,7 +109,7 @@ void AtomVecElectron::create_atom_post(int ilocal)
void AtomVecElectron::data_atom_post(int ilocal) void AtomVecElectron::data_atom_post(int ilocal)
{ {
atom->ervel[ilocal] = 0.0; ervel[ilocal] = 0.0;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -126,28 +139,24 @@ void AtomVecElectron::pack_property_atom(int index, double *buf,
int n = 0; int n = 0;
if (index == 0) { if (index == 0) {
int *spin = atom->spin;
for (int i = 0; i < nlocal; i++) { for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = spin[i]; if (mask[i] & groupbit) buf[n] = spin[i];
else buf[n] = 0.0; else buf[n] = 0.0;
n += nvalues; n += nvalues;
} }
} else if (index == 1) { } else if (index == 1) {
double *eradius = atom->eradius;
for (int i = 0; i < nlocal; i++) { for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = eradius[i]; if (mask[i] & groupbit) buf[n] = eradius[i];
else buf[n] = 0.0; else buf[n] = 0.0;
n += nvalues; n += nvalues;
} }
} else if (index == 2) { } else if (index == 2) {
double *ervel = atom->ervel;
for (int i = 0; i < nlocal; i++) { for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = ervel[i]; if (mask[i] & groupbit) buf[n] = ervel[i];
else buf[n] = 0.0; else buf[n] = 0.0;
n += nvalues; n += nvalues;
} }
} else if (index == 3) { } else if (index == 3) {
double *erforce = atom->erforce;
for (int i = 0; i < nlocal; i++) { for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = erforce[i]; if (mask[i] & groupbit) buf[n] = erforce[i];
else buf[n] = 0.0; else buf[n] = 0.0;

View File

@ -27,11 +27,17 @@ namespace LAMMPS_NS {
class AtomVecElectron : public AtomVec { class AtomVecElectron : public AtomVec {
public: public:
AtomVecElectron(class LAMMPS *); AtomVecElectron(class LAMMPS *);
void grow_pointers();
void force_clear(int, size_t); void force_clear(int, size_t);
void create_atom_post(int); void create_atom_post(int);
void data_atom_post(int); void data_atom_post(int);
int property_atom(char *); int property_atom(char *);
void pack_property_atom(int, double *, int, int); void pack_property_atom(int, double *, int, int);
private:
int *spin;
double *eradius,*ervel,*erforce;
}; };
} }

View File

@ -67,6 +67,20 @@ void AtomVecEDPD::init()
error->all(FLERR,"Atom style edpd requires lj units"); error->all(FLERR,"Atom style edpd requires lj units");
} }
/* ----------------------------------------------------------------------
set local copies of all grow ptrs used by this class, except defaults
needed in replicate when 2 atom classes exist and it calls pack_restart()
------------------------------------------------------------------------- */
void AtomVecEDPD::grow_pointers()
{
edpd_cv = atom->edpd_cv;
edpd_temp = atom->edpd_temp;
edpd_flux = atom->edpd_flux;
vest = atom->vest;
vest_temp = atom->vest_temp;
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
clear extra forces starting at atom N clear extra forces starting at atom N
nbytes = # of bytes to clear for a per-atom vector nbytes = # of bytes to clear for a per-atom vector
@ -74,7 +88,7 @@ void AtomVecEDPD::init()
void AtomVecEDPD::force_clear(int n, size_t nbytes) void AtomVecEDPD::force_clear(int n, size_t nbytes)
{ {
memset(&atom->edpd_flux[n],0,nbytes); memset(&edpd_flux[n],0,nbytes);
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -83,9 +97,9 @@ void AtomVecEDPD::force_clear(int n, size_t nbytes)
void AtomVecEDPD::create_atom_post(int ilocal) void AtomVecEDPD::create_atom_post(int ilocal)
{ {
atom->edpd_temp[ilocal] = 1.0; edpd_temp[ilocal] = 1.0;
atom->edpd_cv[ilocal]= 1.0e5; edpd_cv[ilocal]= 1.0e5;
atom->vest_temp[ilocal] = atom->edpd_temp[ilocal]; vest_temp[ilocal] = edpd_temp[ilocal];
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -95,9 +109,9 @@ void AtomVecEDPD::create_atom_post(int ilocal)
void AtomVecEDPD::data_atom_post(int ilocal) void AtomVecEDPD::data_atom_post(int ilocal)
{ {
atom->edpd_flux[ilocal] = 0.0; edpd_flux[ilocal] = 0.0;
atom->vest[ilocal][0] = 0.0; vest[ilocal][0] = 0.0;
atom->vest[ilocal][1] = 0.0; vest[ilocal][1] = 0.0;
atom->vest[ilocal][2] = 0.0; vest[ilocal][2] = 0.0;
atom->vest_temp[ilocal] = atom->edpd_temp[ilocal]; vest_temp[ilocal] = edpd_temp[ilocal];
} }

View File

@ -28,9 +28,16 @@ class AtomVecEDPD : public AtomVec {
public: public:
AtomVecEDPD(class LAMMPS *); AtomVecEDPD(class LAMMPS *);
void init(); void init();
void grow_pointers();
void force_clear(int, size_t); void force_clear(int, size_t);
void create_atom_post(int); void create_atom_post(int);
void data_atom_post(int); void data_atom_post(int);
private:
double *edpd_cv,*edpd_temp,*edpd_flux;
double **vest;
double *vest_temp;
}; };
} }

View File

@ -61,6 +61,18 @@ void AtomVecMDPD::init()
error->all(FLERR,"Atom style mdpd requires lj units"); error->all(FLERR,"Atom style mdpd requires lj units");
} }
/* ----------------------------------------------------------------------
set local copies of all grow ptrs used by this class, except defaults
needed in replicate when 2 atom classes exist and it calls pack_restart()
------------------------------------------------------------------------- */
void AtomVecMDPD::grow_pointers()
{
rho = atom->rho;
drho = atom->drho;
vest = atom->vest;
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
clear extra forces starting at atom N clear extra forces starting at atom N
nbytes = # of bytes to clear for a per-atom vector nbytes = # of bytes to clear for a per-atom vector
@ -68,7 +80,7 @@ void AtomVecMDPD::init()
void AtomVecMDPD::force_clear(int n, size_t nbytes) void AtomVecMDPD::force_clear(int n, size_t nbytes)
{ {
memset(&atom->drho[n],0,nbytes); memset(&drho[n],0,nbytes);
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -78,10 +90,10 @@ void AtomVecMDPD::force_clear(int n, size_t nbytes)
void AtomVecMDPD::data_atom_post(int ilocal) void AtomVecMDPD::data_atom_post(int ilocal)
{ {
atom->drho[ilocal] = 0.0; drho[ilocal] = 0.0;
atom->vest[ilocal][0] = 0.0; vest[ilocal][0] = 0.0;
atom->vest[ilocal][1] = 0.0; vest[ilocal][1] = 0.0;
atom->vest[ilocal][2] = 0.0; vest[ilocal][2] = 0.0;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -109,14 +121,12 @@ void AtomVecMDPD::pack_property_atom(int index, double *buf,
int n = 0; int n = 0;
if (index == 0) { if (index == 0) {
double *rho = atom->rho;
for (int i = 0; i < nlocal; i++) { for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = rho[i]; if (mask[i] & groupbit) buf[n] = rho[i];
else buf[n] = 0.0; else buf[n] = 0.0;
n += nvalues; n += nvalues;
} }
} else if (index == 1) { } else if (index == 1) {
double *drho = atom->drho;
for (int i = 0; i < nlocal; i++) { for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = drho[i]; if (mask[i] & groupbit) buf[n] = drho[i];
else buf[n] = 0.0; else buf[n] = 0.0;

View File

@ -28,10 +28,16 @@ class AtomVecMDPD : public AtomVec {
public: public:
AtomVecMDPD(class LAMMPS *); AtomVecMDPD(class LAMMPS *);
void init(); void init();
void grow_pointers();
void force_clear(int, size_t); void force_clear(int, size_t);
void data_atom_post(int); void data_atom_post(int);
int property_atom(char *); int property_atom(char *);
void pack_property_atom(int, double *, int, int); void pack_property_atom(int, double *, int, int);
private:
double *rho,*drho;
double **vest;
}; };
} }

View File

@ -80,6 +80,18 @@ void AtomVecTDPD::init()
error->all(FLERR,"Atom style tdpd requires lj units"); error->all(FLERR,"Atom style tdpd requires lj units");
} }
/* ----------------------------------------------------------------------
set local copies of all grow ptrs used by this class, except defaults
needed in replicate when 2 atom classes exist and it calls pack_restart()
------------------------------------------------------------------------- */
void AtomVecTDPD::grow_pointers()
{
cc_flux = atom->cc_flux;
vest = atom->vest;
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
clear extra forces starting at atom N clear extra forces starting at atom N
nbytes = # of bytes to clear for a per-atom vector nbytes = # of bytes to clear for a per-atom vector
@ -87,7 +99,7 @@ void AtomVecTDPD::init()
void AtomVecTDPD::force_clear(int n, size_t nbytes) void AtomVecTDPD::force_clear(int n, size_t nbytes)
{ {
memset(&atom->cc_flux[n][0],0,cc_species*nbytes); memset(&cc_flux[n][0],0,cc_species*nbytes);
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------

View File

@ -29,10 +29,15 @@ class AtomVecTDPD : public AtomVec {
AtomVecTDPD(class LAMMPS *); AtomVecTDPD(class LAMMPS *);
void process_args(int, char **); void process_args(int, char **);
void init(); void init();
void grow_pointers();
void force_clear(int, size_t); void force_clear(int, size_t);
void data_atom_post(int); void data_atom_post(int);
protected: protected:
double **cc_flux;
double **vest;
int cc_species; int cc_species;
}; };

View File

@ -62,11 +62,11 @@ AtomVecSMD::AtomVecSMD(LAMMPS *lmp) : AtomVec(lmp)
// except: fields_data_atom & fields_data_vel must match data file // except: fields_data_atom & fields_data_vel must match data file
fields_grow = (char *) fields_grow = (char *)
"de vfrac rmass x0 radius contact_radius molecule " "e de vfrac rmass x0 radius contact_radius molecule "
"smd_data_9 e vest smd_stress " "smd_data_9 vest smd_stress "
"eff_plastic_strain eff_plastic_strain_rate damage"; "eff_plastic_strain eff_plastic_strain_rate damage";
fields_copy = (char *) fields_copy = (char *)
"vfrac rmass x0 radius contact_radius molecule e " "e vfrac rmass x0 radius contact_radius molecule "
"eff_plastic_strain eff_plastic_strain_rate vest " "eff_plastic_strain eff_plastic_strain_rate vest "
"smd_data_9 smd_stress damage"; "smd_data_9 smd_stress damage";
fields_comm = (char *) "radius vfrac vest e"; fields_comm = (char *) "radius vfrac vest e";
@ -101,6 +101,29 @@ AtomVecSMD::AtomVecSMD(LAMMPS *lmp) : AtomVec(lmp)
setup_fields(); setup_fields();
} }
/* ----------------------------------------------------------------------
set local copies of all grow ptrs used by this class, except defaults
needed in replicate when 2 atom classes exist and it calls pack_restart()
------------------------------------------------------------------------- */
void AtomVecSMD::grow_pointers()
{
e = atom->e;
de = atom->de;
vfrac = atom->vfrac;
rmass = atom->rmass;
x0 = atom->x0;
radius = atom->radius;
contact_radius = atom->contact_radius;
molecule = atom->molecule;
smd_data_9 = atom->smd_data_9;
vest = atom->vest;
smd_stress = atom->smd_stress;
eff_plastic_strain = atom->eff_plastic_strain;
eff_plastic_strain_rate = atom->eff_plastic_strain_rate;
damage = atom->damage;
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
clear extra forces starting at atom N clear extra forces starting at atom N
nbytes = # of bytes to clear for a per-atom vector nbytes = # of bytes to clear for a per-atom vector
@ -109,8 +132,8 @@ AtomVecSMD::AtomVecSMD(LAMMPS *lmp) : AtomVec(lmp)
void AtomVecSMD::force_clear(int n, size_t nbytes) void AtomVecSMD::force_clear(int n, size_t nbytes)
{ {
memset(&atom->de[n],0,nbytes); memset(&de[n],0,nbytes);
memset(&atom->f[n][0],0,3*nbytes); memset(&f[n][0],0,3*nbytes);
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -119,19 +142,19 @@ void AtomVecSMD::force_clear(int n, size_t nbytes)
void AtomVecSMD::create_atom_post(int ilocal) void AtomVecSMD::create_atom_post(int ilocal)
{ {
atom->x0[ilocal][0] = atom->x[ilocal][0]; x0[ilocal][0] = x[ilocal][0];
atom->x0[ilocal][1] = atom->x[ilocal][1]; x0[ilocal][1] = x[ilocal][1];
atom->x0[ilocal][2] = atom->x[ilocal][2]; x0[ilocal][2] = x[ilocal][2];
atom->vfrac[ilocal] = 1.0; vfrac[ilocal] = 1.0;
atom->rmass[ilocal] = 1.0; rmass[ilocal] = 1.0;
atom->radius[ilocal] = 0.5; radius[ilocal] = 0.5;
atom->contact_radius[ilocal] = 0.5; contact_radius[ilocal] = 0.5;
atom->molecule[ilocal] = 1; molecule[ilocal] = 1;
atom->smd_data_9[ilocal][0] = 1.0; // xx smd_data_9[ilocal][0] = 1.0; // xx
atom->smd_data_9[ilocal][4] = 1.0; // yy smd_data_9[ilocal][4] = 1.0; // yy
atom->smd_data_9[ilocal][8] = 1.0; // zz smd_data_9[ilocal][8] = 1.0; // zz
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -141,32 +164,27 @@ void AtomVecSMD::create_atom_post(int ilocal)
void AtomVecSMD::data_atom_post(int ilocal) void AtomVecSMD::data_atom_post(int ilocal)
{ {
atom->e[ilocal] = 0.0; e[ilocal] = 0.0;
atom->x0[ilocal][0] = atom->x[ilocal][0]; x0[ilocal][0] = x[ilocal][0];
atom->x0[ilocal][1] = atom->x[ilocal][1]; x0[ilocal][1] = x[ilocal][1];
atom->x0[ilocal][2] = atom->x[ilocal][2]; x0[ilocal][2] = x[ilocal][2];
atom->vest[ilocal][0] = 0.0; vest[ilocal][0] = 0.0;
atom->vest[ilocal][1] = 0.0; vest[ilocal][1] = 0.0;
atom->vest[ilocal][2] = 0.0; vest[ilocal][2] = 0.0;
atom->damage[ilocal] = 0.0; damage[ilocal] = 0.0;
atom->eff_plastic_strain[ilocal] = 0.0; eff_plastic_strain[ilocal] = 0.0;
atom->eff_plastic_strain_rate[ilocal] = 0.0; eff_plastic_strain_rate[ilocal] = 0.0;
for (int k = 0; k < NMAT_FULL; k++) for (int k = 0; k < NMAT_FULL; k++)
atom->smd_data_9[ilocal][k] = 0.0; smd_data_9[ilocal][k] = 0.0;
for (int k = 0; k < NMAT_SYMM; k++) for (int k = 0; k < NMAT_SYMM; k++)
atom->smd_stress[ilocal][k] = 0.0; smd_stress[ilocal][k] = 0.0;
atom->smd_data_9[ilocal][0] = 1.0; // xx smd_data_9[ilocal][0] = 1.0; // xx
atom->smd_data_9[ilocal][4] = 1.0; // yy smd_data_9[ilocal][4] = 1.0; // yy
atom->smd_data_9[ilocal][8] = 1.0; // zz smd_data_9[ilocal][8] = 1.0; // zz
} }

View File

@ -38,9 +38,17 @@ namespace LAMMPS_NS {
class AtomVecSMD : public AtomVec { class AtomVecSMD : public AtomVec {
public: public:
AtomVecSMD(class LAMMPS *); AtomVecSMD(class LAMMPS *);
void grow_pointers();
void force_clear(int, size_t); void force_clear(int, size_t);
void create_atom_post(int); void create_atom_post(int);
void data_atom_post(int); void data_atom_post(int);
private:
int *molecule;
double *e,*de,*vfrac,*rmass,*radius,*contact_radius;
double *eff_plastic_strain,*eff_plastic_strain_rate,*damage;
double **x0,**smd_data_9,**smd_stress,**vest;
}; };
} }

View File

@ -52,6 +52,21 @@ AtomVecMeso::AtomVecMeso(LAMMPS *lmp) : AtomVec(lmp)
setup_fields(); setup_fields();
} }
/* ----------------------------------------------------------------------
set local copies of all grow ptrs used by this class, except defaults
needed in replicate when 2 atom classes exist and it calls pack_restart()
------------------------------------------------------------------------- */
void AtomVecMeso::grow_pointers()
{
rho = atom->rho;
drho = atom->drho;
e = atom->e;
de = atom->de;
cv = atom->cv;
vest = atom->vest;
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
clear extra forces starting at atom N clear extra forces starting at atom N
nbytes = # of bytes to clear for a per-atom vector nbytes = # of bytes to clear for a per-atom vector
@ -59,8 +74,8 @@ AtomVecMeso::AtomVecMeso(LAMMPS *lmp) : AtomVec(lmp)
void AtomVecMeso::force_clear(int n, size_t nbytes) void AtomVecMeso::force_clear(int n, size_t nbytes)
{ {
memset(&atom->de[n],0,nbytes); memset(&de[n],0,nbytes);
memset(&atom->drho[n],0,nbytes); memset(&drho[n],0,nbytes);
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -69,7 +84,7 @@ void AtomVecMeso::force_clear(int n, size_t nbytes)
void AtomVecMeso::create_atom_post(int ilocal) void AtomVecMeso::create_atom_post(int ilocal)
{ {
atom->cv[ilocal] = 1.0; cv[ilocal] = 1.0;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -79,11 +94,11 @@ void AtomVecMeso::create_atom_post(int ilocal)
void AtomVecMeso::data_atom_post(int ilocal) void AtomVecMeso::data_atom_post(int ilocal)
{ {
atom->vest[ilocal][0] = 0.0; vest[ilocal][0] = 0.0;
atom->vest[ilocal][1] = 0.0; vest[ilocal][1] = 0.0;
atom->vest[ilocal][2] = 0.0; vest[ilocal][2] = 0.0;
atom->de[ilocal] = 0.0; de[ilocal] = 0.0;
atom->drho[ilocal] = 0.0; drho[ilocal] = 0.0;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -114,35 +129,30 @@ void AtomVecMeso::pack_property_atom(int index, double *buf,
int n = 0; int n = 0;
if (index == 0) { if (index == 0) {
double *rho = atom->rho;
for (int i = 0; i < nlocal; i++) { for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = rho[i]; if (mask[i] & groupbit) buf[n] = rho[i];
else buf[n] = 0.0; else buf[n] = 0.0;
n += nvalues; n += nvalues;
} }
} else if (index == 1) { } else if (index == 1) {
double *drho = atom->drho;
for (int i = 0; i < nlocal; i++) { for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = drho[i]; if (mask[i] & groupbit) buf[n] = drho[i];
else buf[n] = 0.0; else buf[n] = 0.0;
n += nvalues; n += nvalues;
} }
} else if (index == 2) { } else if (index == 2) {
double *e = atom->e;
for (int i = 0; i < nlocal; i++) { for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = e[i]; if (mask[i] & groupbit) buf[n] = e[i];
else buf[n] = 0.0; else buf[n] = 0.0;
n += nvalues; n += nvalues;
} }
} else if (index == 3) { } else if (index == 3) {
double *de = atom->de;
for (int i = 0; i < nlocal; i++) { for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = de[i]; if (mask[i] & groupbit) buf[n] = de[i];
else buf[n] = 0.0; else buf[n] = 0.0;
n += nvalues; n += nvalues;
} }
} else if (index == 4) { } else if (index == 4) {
double *cv = atom->cv;
for (int i = 0; i < nlocal; i++) { for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = cv[i]; if (mask[i] & groupbit) buf[n] = cv[i];
else buf[n] = 0.0; else buf[n] = 0.0;

View File

@ -27,11 +27,17 @@ namespace LAMMPS_NS {
class AtomVecMeso : public AtomVec { class AtomVecMeso : public AtomVec {
public: public:
AtomVecMeso(class LAMMPS *); AtomVecMeso(class LAMMPS *);
void grow_pointers();
void force_clear(int, size_t); void force_clear(int, size_t);
void create_atom_post(int); void create_atom_post(int);
void data_atom_post(int); void data_atom_post(int);
int property_atom(char *); int property_atom(char *);
void pack_property_atom(int, double *, int, int); void pack_property_atom(int, double *, int, int);
private:
double *rho,*drho,*e,*de,*cv;
double **vest;
}; };
} }

View File

@ -175,42 +175,8 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
iname = dname = NULL; iname = dname = NULL;
// initialize atom style and array existence flags // initialize atom style and array existence flags
// customize by adding new flag
sphere_flag = peri_flag = electron_flag = 0; set_atomflag_defaults();
wavepacket_flag = sph_flag = 0;
molecule_flag = 0;
q_flag = mu_flag = 0;
omega_flag = torque_flag = angmom_flag = 0;
radius_flag = rmass_flag = 0;
ellipsoid_flag = line_flag = tri_flag = body_flag = 0;
// magnetic flags
sp_flag = 0;
vfrac_flag = 0;
spin_flag = eradius_flag = ervel_flag = erforce_flag = ervelforce_flag = 0;
cs_flag = csforce_flag = vforce_flag = etag_flag = 0;
rho_flag = e_flag = cv_flag = vest_flag = 0;
dpd_flag = edpd_flag = tdpd_flag = 0;
// USER-SMD
smd_flag = 0;
contact_radius_flag = 0;
smd_data_9_flag = 0;
smd_stress_flag = 0;
x0_flag = 0;
eff_plastic_strain_flag = 0;
eff_plastic_strain_rate_flag = 0;
damage_flag = 0;
// Peridynamic scale factor
pdscale = 1.0;
// initialize peratom data structure // initialize peratom data structure
@ -668,6 +634,32 @@ void Atom::add_peratom_vary(const char *name, void *address,
nperatom++; nperatom++;
} }
/* ----------------------------------------------------------------------
add info for a single per-atom array to PerAtom data struct
customize by adding new flag, identical list as atom.h 2nd customization
------------------------------------------------------------------------- */
void Atom::set_atomflag_defaults()
{
sphere_flag = ellipsoid_flag = line_flag = tri_flag = body_flag = 0;
peri_flag = electron_flag = 0;
wavepacket_flag = sph_flag = 0;
molecule_flag = molindex_flag = molatom_flag = 0;
q_flag = mu_flag = 0;
rmass_flag = radius_flag = omega_flag = torque_flag = angmom_flag = 0;
vfrac_flag = spin_flag = eradius_flag = ervel_flag = erforce_flag = 0;
cs_flag = csforce_flag = vforce_flag = ervelforce_flag = etag_flag = 0;
rho_flag = e_flag = cv_flag = vest_flag = 0;
dpd_flag = edpd_flag = tdpd_flag = 0;
sp_flag = 0;
x0_flag = 0;
smd_flag = damage_flag = 0;
contact_radius_flag = smd_data_9_flag = smd_stress_flag = 0;
eff_plastic_strain_flag = eff_plastic_strain_rate_flag = 0;
pdscale = 1.0;
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
create an AtomVec style create an AtomVec style
called from lammps.cpp, input script, restart file, replicate called from lammps.cpp, input script, restart file, replicate
@ -682,26 +674,8 @@ void Atom::create_avec(const char *style, int narg, char **arg, int trysuffix)
// unset atom style and array existence flags // unset atom style and array existence flags
// may have been set by old avec // may have been set by old avec
// customize by adding new flag
sphere_flag = peri_flag = electron_flag = 0; set_atomflag_defaults();
wavepacket_flag = sph_flag = 0;
molecule_flag = 0;
q_flag = mu_flag = 0;
omega_flag = torque_flag = angmom_flag = 0;
radius_flag = rmass_flag = 0;
ellipsoid_flag = line_flag = tri_flag = body_flag = 0;
// magnetic flags
sp_flag = 0;
vfrac_flag = 0;
spin_flag = eradius_flag = ervel_flag = erforce_flag = ervelforce_flag = 0;
cs_flag = csforce_flag = vforce_flag = etag_flag = 0;
rho_flag = e_flag = cv_flag = vest_flag = 0;
// create instance of AtomVec // create instance of AtomVec
// use grow() to initialize atom-based arrays to length 1 // use grow() to initialize atom-based arrays to length 1
@ -785,6 +759,7 @@ AtomVec *Atom::avec_creator(LAMMPS *lmp)
return new T(lmp); return new T(lmp);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void Atom::init() void Atom::init()

View File

@ -143,7 +143,8 @@ class Atom : protected Pointers {
double **vest; double **vest;
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// 1st customization section: customize by adding new flags // 2nd customization section: customize by adding new flags
// identical list as Atom::set_atomflag_defaults()
// most are existence flags for per-atom vectors and arrays // most are existence flags for per-atom vectors and arrays
// 1 if variable is used, 0 if not // 1 if variable is used, 0 if not
@ -165,14 +166,10 @@ class Atom : protected Pointers {
// USER-SMD package // USER-SMD package
int smd_flag;
int contact_radius_flag;
int smd_data_9_flag;
int smd_stress_flag;
int x0_flag; int x0_flag;
int eff_plastic_strain_flag; int smd_flag,damage_flag;
int eff_plastic_strain_rate_flag; int contact_radius_flag,smd_data_9_flag,smd_stress_flag;
int damage_flag; int eff_plastic_strain_flag,eff_plastic_strain_rate_flag;
// Peridynamics scale factor, used by dump cfg // Peridynamics scale factor, used by dump cfg
@ -264,6 +261,7 @@ class Atom : protected Pointers {
void *, int collength=0); void *, int collength=0);
void create_avec(const char *, int, char **, int); void create_avec(const char *, int, char **, int);
virtual class AtomVec *new_avec(const char *, int, int &); virtual class AtomVec *new_avec(const char *, int, int &);
void init(); void init();
void setup(); void setup();
@ -380,6 +378,7 @@ class Atom : protected Pointers {
double bininvx,bininvy,bininvz; // inverse actual bin sizes double bininvx,bininvy,bininvz; // inverse actual bin sizes
double bboxlo[3],bboxhi[3]; // bounding box of my sub-domain double bboxlo[3],bboxhi[3]; // bounding box of my sub-domain
void set_atomflag_defaults();
void setup_sort_bins(); void setup_sort_bins();
int next_prime(int); int next_prime(int);

View File

@ -185,7 +185,7 @@ void AtomVec::grow(int n)
atom->nmax = nmax; atom->nmax = nmax;
if (nmax < 0 || nmax > MAXSMALLINT) if (nmax < 0 || nmax > MAXSMALLINT)
error->one(FLERR,"Per-processor system is too big"); error->one(FLERR,"Per-processor system is too big");
tag = memory->grow(atom->tag,nmax,"atom:tag"); tag = memory->grow(atom->tag,nmax,"atom:tag");
type = memory->grow(atom->type,nmax,"atom:type"); type = memory->grow(atom->type,nmax,"atom:type");
mask = memory->grow(atom->mask,nmax,"atom:mask"); mask = memory->grow(atom->mask,nmax,"atom:mask");
@ -230,6 +230,8 @@ void AtomVec::grow(int n)
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);
grow_pointers();
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -2387,7 +2389,6 @@ void AtomVec::setup_fields()
// set style-specific sizes // set style-specific sizes
// NOTE: check for others vars in atom_vec.cpp/h ?? // NOTE: check for others vars in atom_vec.cpp/h ??
// NOTE: need to set maxexchange, e.g for style hybrid?
comm_x_only = 1; comm_x_only = 1;
if (ncomm) comm_x_only = 0; if (ncomm) comm_x_only = 0;
@ -2435,7 +2436,6 @@ void AtomVec::setup_fields()
else size_data_atom += cols; else size_data_atom += cols;
} }
size_data_vel = 0; size_data_vel = 0;
for (n = 0; n < ndata_vel; n++) { for (n = 0; n < ndata_vel; n++) {
cols = mdata_vel.cols[n]; cols = mdata_vel.cols[n];

View File

@ -74,7 +74,8 @@ class AtomVec : protected Pointers {
virtual void force_clear(int, size_t) {} virtual void force_clear(int, size_t) {}
virtual void grow(int); void grow(int);
virtual void grow_pointers() {}
void copy(int, int, int); void copy(int, int, int);
virtual void copy_bonus(int, int, int) {} virtual void copy_bonus(int, int, int) {}

View File

@ -100,6 +100,7 @@ AtomVecBody::~AtomVecBody()
void AtomVecBody::process_args(int narg, char **arg) void AtomVecBody::process_args(int narg, char **arg)
{ {
// suppress unused parameter warning dependent on style_body.h // suppress unused parameter warning dependent on style_body.h
(void)(arg); (void)(arg);
if (narg < 1) error->all(FLERR,"Invalid atom_style body command"); if (narg < 1) error->all(FLERR,"Invalid atom_style body command");
@ -120,11 +121,12 @@ void AtomVecBody::process_args(int narg, char **arg)
icp = bptr->icp; icp = bptr->icp;
dcp = bptr->dcp; dcp = bptr->dcp;
// max size of forward/border comm // max size of forward/border and exchange comm
// bptr values = max number of additional ivalues/dvalues from Body class // bptr values = max number of additional ivalues/dvalues from Body class
size_forward_bonus += bptr->size_forward; size_forward_bonus += bptr->size_forward;
size_border_bonus += bptr->size_border; size_border_bonus += bptr->size_border;
maxexchange = bptr->maxexchange;
setup_fields(); setup_fields();
} }
@ -138,7 +140,11 @@ void AtomVecBody::process_args(int narg, char **arg)
void AtomVecBody::grow(int n) void AtomVecBody::grow(int n)
{ {
AtomVec::grow(n); AtomVec::grow(n);
body = atom->body; body = atom->body;
rmass = atom->rmass;
radius = atom->radius;
angmom = atom->angmom;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -186,7 +192,7 @@ void AtomVecBody::copy_bonus(int i, int j, int delflag)
void AtomVecBody::copy_bonus_all(int i, int j) void AtomVecBody::copy_bonus_all(int i, int j)
{ {
atom->body[bonus[i].ilocal] = j; body[bonus[i].ilocal] = j;
memcpy(&bonus[j],&bonus[i],sizeof(Bonus)); memcpy(&bonus[j],&bonus[i],sizeof(Bonus));
} }
@ -503,9 +509,9 @@ int AtomVecBody::unpack_restart_bonus(int ilocal, double *buf)
void AtomVecBody::create_atom_post(int ilocal) void AtomVecBody::create_atom_post(int ilocal)
{ {
atom->radius[ilocal] = 0.5; radius[ilocal] = 0.5;
atom->rmass[ilocal] = 1.0; rmass[ilocal] = 1.0;
atom->body[ilocal] = -1; body[ilocal] = -1;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -515,19 +521,19 @@ void AtomVecBody::create_atom_post(int ilocal)
void AtomVecBody::data_atom_post(int ilocal) void AtomVecBody::data_atom_post(int ilocal)
{ {
body_flag = atom->body[ilocal]; body_flag = body[ilocal];
if (body_flag == 0) body_flag = -1; if (body_flag == 0) body_flag = -1;
else if (body_flag == 1) body_flag = 0; else if (body_flag == 1) body_flag = 0;
else error->one(FLERR,"Invalid body flag in Atoms section of data file"); else error->one(FLERR,"Invalid body flag in Atoms section of data file");
atom->body[ilocal] = body_flag; body[ilocal] = body_flag;
if (atom->rmass[ilocal] <= 0.0) if (rmass[ilocal] <= 0.0)
error->one(FLERR,"Invalid density in Atoms section of data file"); error->one(FLERR,"Invalid density in Atoms section of data file");
atom->radius[ilocal] = 0.5; radius[ilocal] = 0.5;
atom->angmom[ilocal][0] = 0.0; angmom[ilocal][0] = 0.0;
atom->angmom[ilocal][1] = 0.0; angmom[ilocal][1] = 0.0;
atom->angmom[ilocal][2] = 0.0; angmom[ilocal][2] = 0.0;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -537,12 +543,12 @@ void AtomVecBody::data_atom_post(int ilocal)
void AtomVecBody::data_body(int m, int ninteger, int ndouble, void AtomVecBody::data_body(int m, int ninteger, int ndouble,
int *ivalues, double *dvalues) int *ivalues, double *dvalues)
{ {
if (atom->body[m]) if (body[m])
error->one(FLERR,"Assigning body parameters to non-body atom"); error->one(FLERR,"Assigning body parameters to non-body atom");
if (nlocal_bonus == nmax_bonus) grow_bonus(); if (nlocal_bonus == nmax_bonus) grow_bonus();
bonus[nlocal_bonus].ilocal = m; bonus[nlocal_bonus].ilocal = m;
bptr->data_body(nlocal_bonus,ninteger,ndouble,ivalues,dvalues); bptr->data_body(nlocal_bonus,ninteger,ndouble,ivalues,dvalues);
atom->body[m] = nlocal_bonus++; body[m] = nlocal_bonus++;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -570,10 +576,10 @@ bigint AtomVecBody::memory_usage_bonus()
void AtomVecBody::pack_data_pre(int ilocal) void AtomVecBody::pack_data_pre(int ilocal)
{ {
body_flag = atom->body[ilocal]; body_flag = body[ilocal];
if (body_flag < 0) atom->body[ilocal] = 0; if (body_flag < 0) body[ilocal] = 0;
else atom->body[ilocal] = 1; else body[ilocal] = 1;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -582,7 +588,7 @@ void AtomVecBody::pack_data_pre(int ilocal)
void AtomVecBody::pack_data_post(int ilocal) void AtomVecBody::pack_data_post(int ilocal)
{ {
atom->body[ilocal] = body_flag; body[ilocal] = body_flag;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -602,8 +608,8 @@ double AtomVecBody::radius_body(int ninteger, int ndouble,
void AtomVecBody::set_quat(int m, double *quat_external) void AtomVecBody::set_quat(int m, double *quat_external)
{ {
if (atom->body[m] < 0) error->one(FLERR,"Assigning quat to non-body atom"); if (body[m] < 0) error->one(FLERR,"Assigning quat to non-body atom");
double *quat = bonus[atom->body[m]].quat; double *quat = bonus[body[m]].quat;
quat[0] = quat_external[0]; quat[1] = quat_external[1]; quat[0] = quat_external[0]; quat[1] = quat_external[1];
quat[2] = quat_external[2]; quat[3] = quat_external[3]; quat[2] = quat_external[2]; quat[3] = quat_external[3];
} }
@ -616,15 +622,15 @@ void AtomVecBody::set_quat(int m, double *quat_external)
void AtomVecBody::check(int flag) void AtomVecBody::check(int flag)
{ {
for (int i = 0; i < atom->nlocal; i++) { for (int i = 0; i < atom->nlocal; i++) {
if (atom->body[i] >= 0 && atom->body[i] >= nlocal_bonus) { if (body[i] >= 0 && body[i] >= nlocal_bonus) {
printf("Proc %d, step %ld, flag %d\n",comm->me,update->ntimestep,flag); printf("Proc %d, step %ld, flag %d\n",comm->me,update->ntimestep,flag);
errorx->one(FLERR,"BAD AAA"); errorx->one(FLERR,"BAD AAA");
} }
} }
for (int i = atom->nlocal; i < atom->nlocal+atom->nghost; i++) { for (int i = atom->nlocal; i < atom->nlocal+atom->nghost; i++) {
if (atom->body[i] >= 0 && if (body[i] >= 0 &&
(atom->body[i] < nlocal_bonus || (body[i] < nlocal_bonus ||
atom->body[i] >= nlocal_bonus+nghost_bonus)) { body[i] >= nlocal_bonus+nghost_bonus)) {
printf("Proc %d, step %ld, flag %d\n",comm->me,update->ntimestep,flag); printf("Proc %d, step %ld, flag %d\n",comm->me,update->ntimestep,flag);
errorx->one(FLERR,"BAD BBB"); errorx->one(FLERR,"BAD BBB");
} }
@ -636,7 +642,7 @@ void AtomVecBody::check(int flag)
} }
} }
for (int i = 0; i < nlocal_bonus; i++) { for (int i = 0; i < nlocal_bonus; i++) {
if (atom->body[bonus[i].ilocal] != i) { if (body[bonus[i].ilocal] != i) {
printf("Proc %d, step %ld, flag %d\n",comm->me,update->ntimestep,flag); printf("Proc %d, step %ld, flag %d\n",comm->me,update->ntimestep,flag);
errorx->one(FLERR,"BAD DDD"); errorx->one(FLERR,"BAD DDD");
} }
@ -649,7 +655,7 @@ void AtomVecBody::check(int flag)
} }
} }
for (int i = nlocal_bonus; i < nlocal_bonus+nghost_bonus; i++) { for (int i = nlocal_bonus; i < nlocal_bonus+nghost_bonus; i++) {
if (atom->body[bonus[i].ilocal] != i) { if (body[bonus[i].ilocal] != i) {
printf("Proc %d, step %ld, flag %d\n",comm->me,update->ntimestep,flag); printf("Proc %d, step %ld, flag %d\n",comm->me,update->ntimestep,flag);
errorx->one(FLERR,"BAD FFF"); errorx->one(FLERR,"BAD FFF");
} }

View File

@ -71,12 +71,14 @@ class AtomVecBody : public AtomVec {
int nlocal_bonus; int nlocal_bonus;
private: private:
int *body;
double *rmass,*radius;
double **angmom;
int nghost_bonus,nmax_bonus; int nghost_bonus,nmax_bonus;
int intdoubleratio; // sizeof(double) / sizeof(int) int intdoubleratio; // sizeof(double) / sizeof(int)
int body_flag; int body_flag;
int *body;
MyPoolChunk<int> *icp; MyPoolChunk<int> *icp;
MyPoolChunk<double> *dcp; MyPoolChunk<double> *dcp;

View File

@ -75,6 +75,17 @@ AtomVecEllipsoid::~AtomVecEllipsoid()
memory->sfree(bonus); memory->sfree(bonus);
} }
/* ----------------------------------------------------------------------
set local copies of all grow ptrs used by this class, except defaults
needed in replicate when 2 atom classes exist and it calls pack_restart()
------------------------------------------------------------------------- */
void AtomVecEllipsoid::grow_pointers()
{
ellipsoid = atom->ellipsoid;
rmass = atom->rmass;
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
grow bonus data structure grow bonus data structure
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
@ -95,8 +106,6 @@ void AtomVecEllipsoid::grow_bonus()
void AtomVecEllipsoid::copy_bonus(int i, int j, int delflag) void AtomVecEllipsoid::copy_bonus(int i, int j, int delflag)
{ {
int *ellipsoid = atom->ellipsoid;
// if deleting atom J via delflag and J has bonus data, then delete it // if deleting atom J via delflag and J has bonus data, then delete it
if (delflag && ellipsoid[j] >= 0) { if (delflag && ellipsoid[j] >= 0) {
@ -118,7 +127,7 @@ void AtomVecEllipsoid::copy_bonus(int i, int j, int delflag)
void AtomVecEllipsoid::copy_bonus_all(int i, int j) void AtomVecEllipsoid::copy_bonus_all(int i, int j)
{ {
atom->ellipsoid[bonus[i].ilocal] = j; ellipsoid[bonus[i].ilocal] = j;
memcpy(&bonus[j],&bonus[i],sizeof(Bonus)); memcpy(&bonus[j],&bonus[i],sizeof(Bonus));
} }
@ -143,8 +152,6 @@ int AtomVecEllipsoid::pack_comm_bonus(int n, int *list, double *buf)
int i,j,m; int i,j,m;
double *quat; double *quat;
int *ellipsoid = atom->ellipsoid;
m = 0; m = 0;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
j = list[i]; j = list[i];
@ -167,8 +174,6 @@ void AtomVecEllipsoid::unpack_comm_bonus(int n, int first, double *buf)
int i,m,last; int i,m,last;
double *quat; double *quat;
int *ellipsoid = atom->ellipsoid;
m = 0; m = 0;
last = first + n; last = first + n;
for (i = first; i < last; i++) { for (i = first; i < last; i++) {
@ -190,8 +195,6 @@ int AtomVecEllipsoid::pack_border_bonus(int n, int *list, double *buf)
double dx,dy,dz; double dx,dy,dz;
double *shape,*quat; double *shape,*quat;
int *ellipsoid = atom->ellipsoid;
m = 0; m = 0;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
j = list[i]; j = list[i];
@ -220,8 +223,6 @@ int AtomVecEllipsoid::unpack_border_bonus(int n, int first, double *buf)
int i,j,m,last; int i,j,m,last;
double *shape,*quat; double *shape,*quat;
int *ellipsoid = atom->ellipsoid;
m = 0; m = 0;
last = first + n; last = first + n;
for (i = first; i < last; i++) { for (i = first; i < last; i++) {
@ -257,8 +258,6 @@ int AtomVecEllipsoid::pack_exchange_bonus(int i, double *buf)
{ {
int m = 0; int m = 0;
int *ellipsoid = atom->ellipsoid;
if (ellipsoid[i] < 0) buf[m++] = ubuf(0).d; if (ellipsoid[i] < 0) buf[m++] = ubuf(0).d;
else { else {
buf[m++] = ubuf(1).d; buf[m++] = ubuf(1).d;
@ -283,8 +282,6 @@ int AtomVecEllipsoid::unpack_exchange_bonus(int ilocal, double *buf)
{ {
int m = 0; int m = 0;
int *ellipsoid = atom->ellipsoid;
ellipsoid[ilocal] = (int) ubuf(buf[m++]).i; ellipsoid[ilocal] = (int) ubuf(buf[m++]).i;
if (ellipsoid[ilocal] == 0) ellipsoid[ilocal] = -1; if (ellipsoid[ilocal] == 0) ellipsoid[ilocal] = -1;
else { else {
@ -314,8 +311,6 @@ int AtomVecEllipsoid::size_restart_bonus()
{ {
int i; int i;
int *ellipsoid = atom->ellipsoid;
int n = 0; int n = 0;
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
@ -336,8 +331,6 @@ int AtomVecEllipsoid::pack_restart_bonus(int i, double *buf)
{ {
int m = 0; int m = 0;
int *ellipsoid = atom->ellipsoid;
if (ellipsoid[i] < 0) buf[m++] = ubuf(0).d; if (ellipsoid[i] < 0) buf[m++] = ubuf(0).d;
else { else {
buf[m++] = ubuf(1).d; buf[m++] = ubuf(1).d;
@ -362,8 +355,6 @@ int AtomVecEllipsoid::unpack_restart_bonus(int ilocal, double *buf)
{ {
int m = 0; int m = 0;
int *ellipsoid = atom->ellipsoid;
ellipsoid[ilocal] = (int) ubuf(buf[m++]).i; ellipsoid[ilocal] = (int) ubuf(buf[m++]).i;
if (ellipsoid[ilocal] == 0) ellipsoid[ilocal] = -1; if (ellipsoid[ilocal] == 0) ellipsoid[ilocal] = -1;
else { else {
@ -390,8 +381,6 @@ int AtomVecEllipsoid::unpack_restart_bonus(int ilocal, double *buf)
void AtomVecEllipsoid::data_atom_bonus(int m, char **values) void AtomVecEllipsoid::data_atom_bonus(int m, char **values)
{ {
int *ellipsoid = atom->ellipsoid;
if (ellipsoid[m]) if (ellipsoid[m])
error->one(FLERR,"Assigning ellipsoid parameters to non-ellipsoid atom"); error->one(FLERR,"Assigning ellipsoid parameters to non-ellipsoid atom");
@ -414,7 +403,7 @@ void AtomVecEllipsoid::data_atom_bonus(int m, char **values)
// reset ellipsoid mass // reset ellipsoid mass
// previously stored density in rmass // previously stored density in rmass
atom->rmass[m] *= 4.0*MY_PI/3.0 * shape[0]*shape[1]*shape[2]; rmass[m] *= 4.0*MY_PI/3.0 * shape[0]*shape[1]*shape[2];
bonus[nlocal_bonus].ilocal = m; bonus[nlocal_bonus].ilocal = m;
ellipsoid[m] = nlocal_bonus++; ellipsoid[m] = nlocal_bonus++;
@ -437,8 +426,8 @@ bigint AtomVecEllipsoid::memory_usage_bonus()
void AtomVecEllipsoid::create_atom_post(int ilocal) void AtomVecEllipsoid::create_atom_post(int ilocal)
{ {
atom->rmass[ilocal] = 1.0; rmass[ilocal] = 1.0;
atom->ellipsoid[ilocal] = -1; ellipsoid[ilocal] = -1;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -448,13 +437,13 @@ void AtomVecEllipsoid::create_atom_post(int ilocal)
void AtomVecEllipsoid::data_atom_post(int ilocal) void AtomVecEllipsoid::data_atom_post(int ilocal)
{ {
ellipsoid_flag = atom->ellipsoid[ilocal]; ellipsoid_flag = ellipsoid[ilocal];
if (ellipsoid_flag == 0) ellipsoid_flag = -1; if (ellipsoid_flag == 0) ellipsoid_flag = -1;
else if (ellipsoid_flag == 1) ellipsoid_flag = 0; else if (ellipsoid_flag == 1) ellipsoid_flag = 0;
else error->one(FLERR,"Invalid ellipsoid flag in Atoms section of data file"); else error->one(FLERR,"Invalid ellipsoid flag in Atoms section of data file");
atom->ellipsoid[ilocal] = ellipsoid_flag; ellipsoid[ilocal] = ellipsoid_flag;
if (atom->rmass[ilocal] <= 0.0) if (rmass[ilocal] <= 0.0)
error->one(FLERR,"Invalid density in Atoms section of data file"); error->one(FLERR,"Invalid density in Atoms section of data file");
} }
@ -467,14 +456,14 @@ void AtomVecEllipsoid::pack_data_pre(int ilocal)
double *shape; double *shape;
ellipsoid_flag = atom->ellipsoid[ilocal]; ellipsoid_flag = atom->ellipsoid[ilocal];
rmass = atom->rmass[ilocal]; rmass_one = atom->rmass[ilocal];
if (ellipsoid_flag < 0) atom->ellipsoid[ilocal] = 0; if (ellipsoid_flag < 0) ellipsoid[ilocal] = 0;
else atom->ellipsoid[ilocal] = 1; else ellipsoid[ilocal] = 1;
if (ellipsoid_flag >= 0) { if (ellipsoid_flag >= 0) {
shape = bonus[ellipsoid_flag].shape; shape = bonus[ellipsoid_flag].shape;
atom->rmass[ilocal] /= 4.0*MY_PI/3.0 * shape[0]*shape[1]*shape[2]; rmass[ilocal] /= 4.0*MY_PI/3.0 * shape[0]*shape[1]*shape[2];
} }
} }
@ -484,8 +473,8 @@ void AtomVecEllipsoid::pack_data_pre(int ilocal)
void AtomVecEllipsoid::pack_data_post(int ilocal) void AtomVecEllipsoid::pack_data_post(int ilocal)
{ {
atom->ellipsoid[ilocal] = ellipsoid_flag; ellipsoid[ilocal] = ellipsoid_flag;
atom->rmass[ilocal] = rmass; rmass[ilocal] = rmass_one;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -497,8 +486,6 @@ void AtomVecEllipsoid::pack_data_post(int ilocal)
void AtomVecEllipsoid:: void AtomVecEllipsoid::
set_shape(int i, double shapex, double shapey, double shapez) set_shape(int i, double shapex, double shapey, double shapez)
{ {
int *ellipsoid = atom->ellipsoid;
if (ellipsoid[i] < 0) { if (ellipsoid[i] < 0) {
if (shapex == 0.0 && shapey == 0.0 && shapez == 0.0) return; if (shapex == 0.0 && shapey == 0.0 && shapez == 0.0) return;
if (nlocal_bonus == nmax_bonus) grow_bonus(); if (nlocal_bonus == nmax_bonus) grow_bonus();

View File

@ -36,6 +36,7 @@ class AtomVecEllipsoid : public AtomVec {
AtomVecEllipsoid(class LAMMPS *); AtomVecEllipsoid(class LAMMPS *);
~AtomVecEllipsoid(); ~AtomVecEllipsoid();
void grow_pointers();
void copy_bonus(int, int, int); void copy_bonus(int, int, int);
void clear_bonus(); void clear_bonus();
int pack_comm_bonus(int, int *, double *); int pack_comm_bonus(int, int *, double *);
@ -62,9 +63,12 @@ class AtomVecEllipsoid : public AtomVec {
int nlocal_bonus; int nlocal_bonus;
private: private:
int *ellipsoid;
double *rmass;
int nghost_bonus,nmax_bonus; int nghost_bonus,nmax_bonus;
int ellipsoid_flag; int ellipsoid_flag;
double rmass; double rmass_one;
void grow_bonus(); void grow_bonus();
void copy_bonus_all(int, int); void copy_bonus_all(int, int);

View File

@ -36,7 +36,6 @@ AtomVecHybrid::AtomVecHybrid(LAMMPS *lmp) : AtomVec(lmp)
// NOTE: set bonus_flag if any substyle does // NOTE: set bonus_flag if any substyle does
// set nstyles_bonus, styles_bonus // set nstyles_bonus, styles_bonus
// NOTE: call method in each sub-style to set q_flag ??
// these strings will be concatenated from sub-style strings // these strings will be concatenated from sub-style strings
// fields_data_atom & fields_data_vel start with fields common to all styles // fields_data_atom & fields_data_vel start with fields common to all styles
@ -124,8 +123,8 @@ void AtomVecHybrid::process_args(int narg, char **arg)
for (int k = 0; k < nstyles; k++) { for (int k = 0; k < nstyles; k++) {
if ((styles[k]->molecular == 1 && molecular == 2) || if ((styles[k]->molecular == 1 && molecular == 2) ||
(styles[k]->molecular == 2 && molecular == 1)) (styles[k]->molecular == 2 && molecular == 1))
error->all(FLERR,"Cannot mix molecular and molecule template " error->all(FLERR,
"atom styles"); "Cannot mix molecular and molecule template atom styles");
molecular = MAX(molecular,styles[k]->molecular); molecular = MAX(molecular,styles[k]->molecular);
bonds_allow = MAX(bonds_allow,styles[k]->bonds_allow); bonds_allow = MAX(bonds_allow,styles[k]->bonds_allow);
@ -135,11 +134,9 @@ void AtomVecHybrid::process_args(int narg, char **arg)
mass_type = MAX(mass_type,styles[k]->mass_type); mass_type = MAX(mass_type,styles[k]->mass_type);
dipole_type = MAX(dipole_type,styles[k]->dipole_type); dipole_type = MAX(dipole_type,styles[k]->dipole_type);
forceclearflag = MAX(forceclearflag,styles[k]->forceclearflag); forceclearflag = MAX(forceclearflag,styles[k]->forceclearflag);
maxexchange += styles[k]->maxexchange;
if (styles[k]->molecular == 2) onemols = styles[k]->onemols; if (styles[k]->molecular == 2) onemols = styles[k]->onemols;
// NOTE: need to sum this one?
maxexchange += styles[k]->maxexchange;
} }
// issue a warning if both per-type mass and per-atom rmass are defined // issue a warning if both per-type mass and per-atom rmass are defined
@ -237,6 +234,13 @@ void AtomVecHybrid::init()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void AtomVecHybrid::grow_pointers()
{
for (int k = 0; k < nstyles; k++) styles[k]->grow_pointers();
}
/* ---------------------------------------------------------------------- */
void AtomVecHybrid::force_clear(int n, size_t nbytes) void AtomVecHybrid::force_clear(int n, size_t nbytes)
{ {
for (int k = 0; k < nstyles; k++) for (int k = 0; k < nstyles; k++)

View File

@ -34,8 +34,9 @@ class AtomVecHybrid : public AtomVec {
~AtomVecHybrid(); ~AtomVecHybrid();
void process_args(int, char **); void process_args(int, char **);
void init(); void init();
void force_clear(int, size_t);
void grow_pointers();
void force_clear(int, size_t);
void copy_bonus(int, int, int); void copy_bonus(int, int, int);
void clear_bonus() {} void clear_bonus() {}
int pack_comm_bonus(int, int *, double *); int pack_comm_bonus(int, int *, double *);

View File

@ -86,6 +86,19 @@ void AtomVecLine::init()
error->all(FLERR,"Atom_style line can only be used in 2d simulations"); error->all(FLERR,"Atom_style line can only be used in 2d simulations");
} }
/* ----------------------------------------------------------------------
set local copies of all grow ptrs used by this class, except defaults
needed in replicate when 2 atom classes exist and it calls pack_restart()
------------------------------------------------------------------------- */
void AtomVecLine::grow_pointers()
{
line = atom->line;
radius = atom->radius;
rmass = atom->rmass;
omega = atom->omega;
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
grow bonus data structure grow bonus data structure
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
@ -106,8 +119,6 @@ void AtomVecLine::grow_bonus()
void AtomVecLine::copy_bonus(int i, int j, int delflag) void AtomVecLine::copy_bonus(int i, int j, int delflag)
{ {
int *line = atom->line;
// if deleting atom J via delflag and J has bonus data, then delete it // if deleting atom J via delflag and J has bonus data, then delete it
if (delflag && line[j] >= 0) { if (delflag && line[j] >= 0) {
@ -129,7 +140,7 @@ void AtomVecLine::copy_bonus(int i, int j, int delflag)
void AtomVecLine::copy_bonus_all(int i, int j) void AtomVecLine::copy_bonus_all(int i, int j)
{ {
atom->line[bonus[i].ilocal] = j; line[bonus[i].ilocal] = j;
memcpy(&bonus[j],&bonus[i],sizeof(Bonus)); memcpy(&bonus[j],&bonus[i],sizeof(Bonus));
} }
@ -153,8 +164,6 @@ int AtomVecLine::pack_comm_bonus(int n, int *list, double *buf)
{ {
int i,j,m; int i,j,m;
int *line = atom->line;
m = 0; m = 0;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
j = list[i]; j = list[i];
@ -170,8 +179,6 @@ void AtomVecLine::unpack_comm_bonus(int n, int first, double *buf)
{ {
int i,m,last; int i,m,last;
int *line = atom->line;
m = 0; m = 0;
last = first + n; last = first + n;
for (i = first; i < last; i++) { for (i = first; i < last; i++) {
@ -185,8 +192,6 @@ int AtomVecLine::pack_border_bonus(int n, int *list, double *buf)
{ {
int i,j,m; int i,j,m;
int *line = atom->line;
m = 0; m = 0;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
j = list[i]; j = list[i];
@ -207,8 +212,6 @@ int AtomVecLine::unpack_border_bonus(int n, int first, double *buf)
{ {
int i,j,m,last; int i,j,m,last;
int *line = atom->line;
m = 0; m = 0;
last = first + n; last = first + n;
for (i = first; i < last; i++) { for (i = first; i < last; i++) {
@ -237,8 +240,6 @@ int AtomVecLine::pack_exchange_bonus(int i, double *buf)
{ {
int m = 0; int m = 0;
int *line = atom->line;
if (line[i] < 0) buf[m++] = ubuf(0).d; if (line[i] < 0) buf[m++] = ubuf(0).d;
else { else {
buf[m++] = ubuf(1).d; buf[m++] = ubuf(1).d;
@ -256,8 +257,6 @@ int AtomVecLine::unpack_exchange_bonus(int ilocal, double *buf)
{ {
int m = 0; int m = 0;
int *line = atom->line;
line[ilocal] = (int) ubuf(buf[m++]).i; line[ilocal] = (int) ubuf(buf[m++]).i;
if (line[ilocal] == 0) line[ilocal] = -1; if (line[ilocal] == 0) line[ilocal] = -1;
else { else {
@ -280,8 +279,6 @@ int AtomVecLine::size_restart_bonus()
{ {
int i; int i;
int *line = atom->line;
int n = 0; int n = 0;
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
@ -302,8 +299,6 @@ int AtomVecLine::pack_restart_bonus(int i, double *buf)
{ {
int m = 0; int m = 0;
int *line = atom->line;
if (line[i] < 0) buf[m++] = ubuf(0).d; if (line[i] < 0) buf[m++] = ubuf(0).d;
else { else {
buf[m++] = ubuf(1).d; buf[m++] = ubuf(1).d;
@ -323,8 +318,6 @@ int AtomVecLine::unpack_restart_bonus(int ilocal, double *buf)
{ {
int m = 0; int m = 0;
int *line = atom->line;
line[ilocal] = (int) ubuf(buf[m++]).i; line[ilocal] = (int) ubuf(buf[m++]).i;
if (line[ilocal] == 0) line[ilocal] = -1; if (line[ilocal] == 0) line[ilocal] = -1;
else { else {
@ -344,8 +337,6 @@ int AtomVecLine::unpack_restart_bonus(int ilocal, double *buf)
void AtomVecLine::data_atom_bonus(int m, char **values) void AtomVecLine::data_atom_bonus(int m, char **values)
{ {
int *line = atom->line;
if (line[m]) error->one(FLERR,"Assigning line parameters to non-line atom"); if (line[m]) error->one(FLERR,"Assigning line parameters to non-line atom");
if (nlocal_bonus == nmax_bonus) grow_bonus(); if (nlocal_bonus == nmax_bonus) grow_bonus();
@ -377,8 +368,8 @@ void AtomVecLine::data_atom_bonus(int m, char **values)
// reset line radius and mass // reset line radius and mass
// rmass currently holds density // rmass currently holds density
atom->radius[m] = 0.5 * length; radius[m] = 0.5 * length;
atom->rmass[m] *= length; rmass[m] *= length;
bonus[nlocal_bonus].ilocal = m; bonus[nlocal_bonus].ilocal = m;
line[m] = nlocal_bonus++; line[m] = nlocal_bonus++;
@ -402,10 +393,10 @@ bigint AtomVecLine::memory_usage_bonus()
void AtomVecLine::create_atom_post(int ilocal) void AtomVecLine::create_atom_post(int ilocal)
{ {
double radius = 0.5; double radius_one = 0.5;
atom->radius[ilocal] = radius; radius[ilocal] = radius_one;
atom->rmass[ilocal] = 4.0*MY_PI/3.0 * radius*radius*radius; rmass[ilocal] = 4.0*MY_PI/3.0 * radius_one*radius_one*radius_one;
atom->line[ilocal] = -1; line[ilocal] = -1;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -415,24 +406,24 @@ void AtomVecLine::create_atom_post(int ilocal)
void AtomVecLine::data_atom_post(int ilocal) void AtomVecLine::data_atom_post(int ilocal)
{ {
line_flag = atom->line[ilocal]; line_flag = line[ilocal];
if (line_flag == 0) line_flag = -1; if (line_flag == 0) line_flag = -1;
else if (line_flag == 1) line_flag = 0; else if (line_flag == 1) line_flag = 0;
else error->one(FLERR,"Invalid line flag in Atoms section of data file"); else error->one(FLERR,"Invalid line flag in Atoms section of data file");
atom->line[ilocal] = line_flag; line[ilocal] = line_flag;
if (atom->rmass[ilocal] <= 0.0) if (rmass[ilocal] <= 0.0)
error->one(FLERR,"Invalid density in Atoms section of data file"); error->one(FLERR,"Invalid density in Atoms section of data file");
if (line_flag < 0) { if (line_flag < 0) {
double radius = 0.5; double radius_one = 0.5;
atom->radius[ilocal] = radius; radius[ilocal] = radius_one;
atom->rmass[ilocal] *= 4.0*MY_PI/3.0 * radius*radius*radius; rmass[ilocal] *= 4.0*MY_PI/3.0 * radius_one*radius_one*radius_one;
} else atom->radius[ilocal] = 0.0; } else radius[ilocal] = 0.0;
atom->omega[ilocal][0] = 0.0; omega[ilocal][0] = 0.0;
atom->omega[ilocal][1] = 0.0; omega[ilocal][1] = 0.0;
atom->omega[ilocal][2] = 0.0; omega[ilocal][2] = 0.0;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -441,16 +432,16 @@ void AtomVecLine::data_atom_post(int ilocal)
void AtomVecLine::pack_data_pre(int ilocal) void AtomVecLine::pack_data_pre(int ilocal)
{ {
line_flag = atom->line[ilocal]; line_flag = line[ilocal];
rmass = atom->rmass[ilocal]; rmass_one = rmass[ilocal];
if (line_flag < 0) atom->line[ilocal] = 0; if (line_flag < 0) line[ilocal] = 0;
else atom->line[ilocal] = 1; else line[ilocal] = 1;
if (line_flag < 0) { if (line_flag < 0) {
double radius = atom->radius[ilocal]; double radius_one = radius[ilocal];
atom->rmass[ilocal] /= 4.0*MY_PI/3.0 * radius*radius*radius; rmass[ilocal] /= 4.0*MY_PI/3.0 * radius_one*radius_one*radius_one;
} else atom->rmass[ilocal] /= bonus[line_flag].length; } else rmass[ilocal] /= bonus[line_flag].length;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -459,8 +450,8 @@ void AtomVecLine::pack_data_pre(int ilocal)
void AtomVecLine::pack_data_post(int ilocal) void AtomVecLine::pack_data_post(int ilocal)
{ {
atom->line[ilocal] = line_flag; line[ilocal] = line_flag;
atom->rmass[ilocal] = rmass; rmass[ilocal] = rmass_one;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -471,8 +462,6 @@ void AtomVecLine::pack_data_post(int ilocal)
void AtomVecLine::set_length(int i, double value) void AtomVecLine::set_length(int i, double value)
{ {
int *line = atom->line;
if (line[i] < 0) { if (line[i] < 0) {
if (value == 0.0) return; if (value == 0.0) return;
if (nlocal_bonus == nmax_bonus) grow_bonus(); if (nlocal_bonus == nmax_bonus) grow_bonus();
@ -489,8 +478,8 @@ void AtomVecLine::set_length(int i, double value)
// also set radius = half of length // also set radius = half of length
// unless value = 0.0, then set diameter = 1.0 // unless value = 0.0, then set diameter = 1.0
atom->radius[i] = 0.5 * value; radius[i] = 0.5 * value;
if (value == 0.0) atom->radius[i] = 0.5; if (value == 0.0) radius[i] = 0.5;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------

View File

@ -36,6 +36,7 @@ class AtomVecLine : public AtomVec {
~AtomVecLine(); ~AtomVecLine();
void init(); void init();
void grow_pointers();
void copy_bonus(int, int, int); void copy_bonus(int, int, int);
void clear_bonus(); void clear_bonus();
int pack_comm_bonus(int, int *, double *); int pack_comm_bonus(int, int *, double *);
@ -62,9 +63,13 @@ class AtomVecLine : public AtomVec {
int nlocal_bonus; int nlocal_bonus;
private: private:
int *line;
double *radius,*rmass;
double **omega;
int nghost_bonus,nmax_bonus; int nghost_bonus,nmax_bonus;
int line_flag; int line_flag;
double rmass; double rmass_one;
void grow_bonus(); void grow_bonus();
void copy_bonus_all(int, int); void copy_bonus_all(int, int);

View File

@ -100,14 +100,25 @@ void AtomVecSphere::init()
} }
} }
/* ----------------------------------------------------------------------
set local copies of all grow ptrs used by this class, except defaults
needed in replicate when 2 atom classes exist and it calls pack_restart()
------------------------------------------------------------------------- */
void AtomVecSphere::grow_pointers()
{
radius = atom->radius;
rmass = atom->rmass;
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
initialize non-zero atom quantities initialize non-zero atom quantities
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void AtomVecSphere::create_atom_post(int ilocal) void AtomVecSphere::create_atom_post(int ilocal)
{ {
atom->radius[ilocal] = 0.5; radius[ilocal] = 0.5;
atom->rmass[ilocal] = 4.0*MY_PI/3.0 * 0.5*0.5*0.5; rmass[ilocal] = 4.0*MY_PI/3.0 * 0.5*0.5*0.5;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -117,13 +128,12 @@ void AtomVecSphere::create_atom_post(int ilocal)
void AtomVecSphere::data_atom_post(int ilocal) void AtomVecSphere::data_atom_post(int ilocal)
{ {
double radius = 0.5 * atom->radius[ilocal]; radius_one = 0.5 * atom->radius[ilocal];
atom->radius[ilocal] = radius; radius[ilocal] = radius_one;
if (radius > 0.0) if (radius_one > 0.0)
atom->rmass[ilocal] = rmass[ilocal] *= 4.0*MY_PI/3.0 * radius_one*radius_one*radius_one;
4.0*MY_PI/3.0 * radius*radius*radius * atom->rmass[ilocal];
if (atom->rmass[ilocal] <= 0.0) if (rmass[ilocal] <= 0.0)
error->one(FLERR,"Invalid density in Atoms section of data file"); error->one(FLERR,"Invalid density in Atoms section of data file");
} }
@ -132,13 +142,14 @@ void AtomVecSphere::data_atom_post(int ilocal)
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void AtomVecSphere::pack_data_pre(int ilocal) void AtomVecSphere::pack_data_pre(int ilocal)
{ {
radius = atom->radius[ilocal]; radius_one = radius[ilocal];
rmass = atom->rmass[ilocal]; rmass_one = rmass[ilocal];
atom->radius[ilocal] *= 2.0; radius[ilocal] *= 2.0;
if (radius == 0.0) if (radius_one!= 0.0)
atom->rmass[ilocal] = rmass / (4.0*MY_PI/3.0 * radius*radius*radius); rmass[ilocal] =
rmass_one / (4.0*MY_PI/3.0 * radius_one*radius_one*radius_one);
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -146,7 +157,7 @@ void AtomVecSphere::pack_data_pre(int ilocal)
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void AtomVecSphere::pack_data_post(int ilocal) void AtomVecSphere::pack_data_post(int ilocal)
{ {
atom->radius[ilocal] = radius; radius[ilocal] = radius_one;
atom->rmass[ilocal] = rmass; rmass[ilocal] = rmass_one;
} }

View File

@ -29,14 +29,18 @@ class AtomVecSphere : public AtomVec {
AtomVecSphere(class LAMMPS *); AtomVecSphere(class LAMMPS *);
void process_args(int, char **); void process_args(int, char **);
void init(); void init();
void grow_pointers();
void create_atom_post(int); void create_atom_post(int);
void data_atom_post(int); void data_atom_post(int);
void pack_data_pre(int); void pack_data_pre(int);
void pack_data_post(int); void pack_data_post(int);
private: private:
double *radius,*rmass;
int radvary; int radvary;
double radius,rmass; double radius_one,rmass_one;
}; };
} }

View File

@ -88,6 +88,20 @@ void AtomVecTri::init()
error->all(FLERR,"Atom_style tri can only be used in 3d simulations"); error->all(FLERR,"Atom_style tri can only be used in 3d simulations");
} }
/* ----------------------------------------------------------------------
set local copies of all grow ptrs used by this class, except defaults
needed in replicate when 2 atom classes exist and it calls pack_restart()
------------------------------------------------------------------------- */
void AtomVecTri::grow_pointers()
{
tri = atom->tri;
radius = atom->radius;
rmass = atom->rmass;
omega = atom->omega;
angmom = atom->angmom;
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
grow bonus data structure grow bonus data structure
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
@ -109,8 +123,6 @@ void AtomVecTri::grow_bonus()
void AtomVecTri::copy_bonus(int i, int j, int delflag) void AtomVecTri::copy_bonus(int i, int j, int delflag)
{ {
int *tri = atom->tri;
// if deleting atom J via delflag and J has bonus data, then delete it // if deleting atom J via delflag and J has bonus data, then delete it
if (delflag && tri[j] >= 0) { if (delflag && tri[j] >= 0) {
@ -132,7 +144,7 @@ void AtomVecTri::copy_bonus(int i, int j, int delflag)
void AtomVecTri::copy_bonus_all(int i, int j) void AtomVecTri::copy_bonus_all(int i, int j)
{ {
atom->tri[bonus[i].ilocal] = j; tri[bonus[i].ilocal] = j;
memcpy(&bonus[j],&bonus[i],sizeof(Bonus)); memcpy(&bonus[j],&bonus[i],sizeof(Bonus));
} }
@ -157,8 +169,6 @@ int AtomVecTri::pack_comm_bonus(int n, int *list, double *buf)
int i,j,m; int i,j,m;
double *quat; double *quat;
int *tri = atom->tri;
m = 0; m = 0;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
j = list[i]; j = list[i];
@ -181,8 +191,6 @@ void AtomVecTri::unpack_comm_bonus(int n, int first, double *buf)
int i,m,last; int i,m,last;
double *quat; double *quat;
int *tri = atom->tri;
m = 0; m = 0;
last = first + n; last = first + n;
for (i = first; i < last; i++) { for (i = first; i < last; i++) {
@ -203,8 +211,6 @@ int AtomVecTri::pack_border_bonus(int n, int *list, double *buf)
int i,j,m; int i,j,m;
double *quat,*c1,*c2,*c3,*inertia; double *quat,*c1,*c2,*c3,*inertia;
int *tri = atom->tri;
m = 0; m = 0;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
j = list[i]; j = list[i];
@ -245,8 +251,6 @@ int AtomVecTri::unpack_border_bonus(int n, int first, double *buf)
int i,j,m,last; int i,j,m,last;
double *quat,*c1,*c2,*c3,*inertia; double *quat,*c1,*c2,*c3,*inertia;
int *tri = atom->tri;
m = 0; m = 0;
last = first + n; last = first + n;
for (i = first; i < last; i++) { for (i = first; i < last; i++) {
@ -294,8 +298,6 @@ int AtomVecTri::pack_exchange_bonus(int i, double *buf)
{ {
int m = 0; int m = 0;
int *tri = atom->tri;
if (tri[i] < 0) buf[m++] = ubuf(0).d; if (tri[i] < 0) buf[m++] = ubuf(0).d;
else { else {
buf[m++] = ubuf(1).d; buf[m++] = ubuf(1).d;
@ -332,8 +334,6 @@ int AtomVecTri::unpack_exchange_bonus(int ilocal, double *buf)
{ {
int m = 0; int m = 0;
int *tri = atom->tri;
tri[ilocal] = (int) ubuf(buf[m++]).i; tri[ilocal] = (int) ubuf(buf[m++]).i;
if (tri[ilocal] == 0) tri[ilocal] = -1; if (tri[ilocal] == 0) tri[ilocal] = -1;
else { else {
@ -375,8 +375,6 @@ int AtomVecTri::size_restart_bonus()
{ {
int i; int i;
int *tri = atom->tri;
int n = 0; int n = 0;
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
@ -395,8 +393,6 @@ int AtomVecTri::pack_restart_bonus(int i, double *buf)
{ {
int m = 0; int m = 0;
int *tri = atom->tri;
if (tri[i] < 0) buf[m++] = ubuf(0).d; if (tri[i] < 0) buf[m++] = ubuf(0).d;
else { else {
buf[m++] = ubuf(1).d; buf[m++] = ubuf(1).d;
@ -435,8 +431,6 @@ int AtomVecTri::unpack_restart_bonus(int ilocal, double *buf)
{ {
int m = 0; int m = 0;
int *tri = atom->tri;
tri[ilocal] = (int) ubuf(buf[m++]).i; tri[ilocal] = (int) ubuf(buf[m++]).i;
if (tri[ilocal] == 0) tri[ilocal] = -1; if (tri[ilocal] == 0) tri[ilocal] = -1;
else { else {
@ -475,8 +469,6 @@ int AtomVecTri::unpack_restart_bonus(int ilocal, double *buf)
void AtomVecTri::data_atom_bonus(int m, char **values) void AtomVecTri::data_atom_bonus(int m, char **values)
{ {
int *tri = atom->tri;
if (tri[m]) error->one(FLERR,"Assigning tri parameters to non-tri atom"); if (tri[m]) error->one(FLERR,"Assigning tri parameters to non-tri atom");
if (nlocal_bonus == nmax_bonus) grow_bonus(); if (nlocal_bonus == nmax_bonus) grow_bonus();
@ -523,9 +515,9 @@ void AtomVecTri::data_atom_bonus(int m, char **values)
if (delta/size > EPSILON) if (delta/size > EPSILON)
error->one(FLERR,"Inconsistent triangle in data file"); error->one(FLERR,"Inconsistent triangle in data file");
atom->x[m][0] = centroid[0]; x[m][0] = centroid[0];
atom->x[m][1] = centroid[1]; x[m][1] = centroid[1];
atom->x[m][2] = centroid[2]; x[m][2] = centroid[2];
// reset tri radius and mass // reset tri radius and mass
// rmass currently holds density // rmass currently holds density
@ -533,22 +525,22 @@ void AtomVecTri::data_atom_bonus(int m, char **values)
double c4[3]; double c4[3];
MathExtra::sub3(c1,centroid,c4); MathExtra::sub3(c1,centroid,c4);
atom->radius[m] = MathExtra::lensq3(c4); radius[m] = MathExtra::lensq3(c4);
MathExtra::sub3(c2,centroid,c4); MathExtra::sub3(c2,centroid,c4);
atom->radius[m] = MAX(atom->radius[m],MathExtra::lensq3(c4)); radius[m] = MAX(radius[m],MathExtra::lensq3(c4));
MathExtra::sub3(c3,centroid,c4); MathExtra::sub3(c3,centroid,c4);
atom->radius[m] = MAX(atom->radius[m],MathExtra::lensq3(c4)); radius[m] = MAX(radius[m],MathExtra::lensq3(c4));
atom->radius[m] = sqrt(atom->radius[m]); radius[m] = sqrt(radius[m]);
double norm[3]; double norm[3];
MathExtra::cross3(c2mc1,c3mc1,norm); MathExtra::cross3(c2mc1,c3mc1,norm);
double area = 0.5 * MathExtra::len3(norm); double area = 0.5 * MathExtra::len3(norm);
atom->rmass[m] *= area; rmass[m] *= area;
// inertia = inertia tensor of triangle as 6-vector in Voigt notation // inertia = inertia tensor of triangle as 6-vector in Voigt notation
double inertia[6]; double inertia[6];
MathExtra::inertia_triangle(c1,c2,c3,atom->rmass[m],inertia); MathExtra::inertia_triangle(c1,c2,c3,rmass[m],inertia);
// diagonalize inertia tensor via Jacobi rotations // diagonalize inertia tensor via Jacobi rotations
// bonus[].inertia = 3 eigenvalues = principal moments of inertia // bonus[].inertia = 3 eigenvalues = principal moments of inertia
@ -622,10 +614,10 @@ bigint AtomVecTri::memory_usage_bonus()
void AtomVecTri::create_atom_post(int ilocal) void AtomVecTri::create_atom_post(int ilocal)
{ {
double radius = 0.5; double radius_one = 0.5;
atom->radius[ilocal] = radius; radius[ilocal] = radius_one;
atom->rmass[ilocal] = 4.0*MY_PI/3.0 * radius*radius*radius; rmass[ilocal] = 4.0*MY_PI/3.0 * radius_one*radius_one*radius_one;
atom->tri[ilocal] = -1; tri[ilocal] = -1;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -635,27 +627,27 @@ void AtomVecTri::create_atom_post(int ilocal)
void AtomVecTri::data_atom_post(int ilocal) void AtomVecTri::data_atom_post(int ilocal)
{ {
tri_flag = atom->tri[ilocal]; tri_flag = tri[ilocal];
if (tri_flag == 0) tri_flag = -1; if (tri_flag == 0) tri_flag = -1;
else if (tri_flag == 1) tri_flag = 0; else if (tri_flag == 1) tri_flag = 0;
else error->one(FLERR,"Invalid tri flag in Atoms section of data file"); else error->one(FLERR,"Invalid tri flag in Atoms section of data file");
atom->tri[ilocal] = tri_flag; tri[ilocal] = tri_flag;
if (atom->rmass[ilocal] <= 0.0) if (rmass[ilocal] <= 0.0)
error->one(FLERR,"Invalid density in Atoms section of data file"); error->one(FLERR,"Invalid density in Atoms section of data file");
if (tri_flag < 0) { if (tri_flag < 0) {
double radius = 0.5; double radius_one = 0.5;
atom->radius[ilocal] = radius; radius[ilocal] = radius_one;
atom->rmass[ilocal] *= 4.0*MY_PI/3.0 * radius*radius*radius; rmass[ilocal] *= 4.0*MY_PI/3.0 * radius_one*radius_one*radius_one;
} else atom->radius[ilocal] = 0.0; } else radius[ilocal] = 0.0;
atom->omega[ilocal][0] = 0.0; omega[ilocal][0] = 0.0;
atom->omega[ilocal][1] = 0.0; omega[ilocal][1] = 0.0;
atom->omega[ilocal][2] = 0.0; omega[ilocal][2] = 0.0;
atom->angmom[ilocal][0] = 0.0; angmom[ilocal][0] = 0.0;
atom->angmom[ilocal][1] = 0.0; angmom[ilocal][1] = 0.0;
atom->angmom[ilocal][2] = 0.0; angmom[ilocal][2] = 0.0;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -664,22 +656,22 @@ void AtomVecTri::data_atom_post(int ilocal)
void AtomVecTri::pack_data_pre(int ilocal) void AtomVecTri::pack_data_pre(int ilocal)
{ {
tri_flag = atom->tri[ilocal]; tri_flag = tri[ilocal];
rmass = atom->rmass[ilocal]; rmass_one = rmass[ilocal];
if (tri_flag < 0) atom->tri[ilocal] = 0; if (tri_flag < 0) tri[ilocal] = 0;
else atom->tri[ilocal] = 1; else tri[ilocal] = 1;
if (tri_flag < 0) { if (tri_flag < 0) {
double radius = atom->radius[ilocal]; double radius_one = radius[ilocal];
atom->rmass[ilocal] /= 4.0*MY_PI/3.0 * radius*radius*radius; rmass[ilocal] /= 4.0*MY_PI/3.0 * radius_one*radius_one*radius_one;
} else { } else {
double c2mc1[3],c3mc1[3],norm[3]; double c2mc1[3],c3mc1[3],norm[3];
MathExtra::sub3(bonus[tri_flag].c2,bonus[tri_flag].c1,c2mc1); MathExtra::sub3(bonus[tri_flag].c2,bonus[tri_flag].c1,c2mc1);
MathExtra::sub3(bonus[tri_flag].c3,bonus[tri_flag].c1,c3mc1); MathExtra::sub3(bonus[tri_flag].c3,bonus[tri_flag].c1,c3mc1);
MathExtra::cross3(c2mc1,c3mc1,norm); MathExtra::cross3(c2mc1,c3mc1,norm);
double area = 0.5 * MathExtra::len3(norm); double area = 0.5 * MathExtra::len3(norm);
atom->rmass[ilocal] /= area; rmass[ilocal] /= area;
} }
} }
@ -689,8 +681,8 @@ void AtomVecTri::pack_data_pre(int ilocal)
void AtomVecTri::pack_data_post(int ilocal) void AtomVecTri::pack_data_post(int ilocal)
{ {
atom->tri[ilocal] = tri_flag; tri[ilocal] = tri_flag;
atom->rmass[ilocal] = rmass; rmass[ilocal] = rmass_one;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -704,8 +696,6 @@ void AtomVecTri::set_equilateral(int i, double size)
// also set radius = distance from center to corner-pt = len(c1) // also set radius = distance from center to corner-pt = len(c1)
// unless size = 0.0, then set diameter = 1.0 // unless size = 0.0, then set diameter = 1.0
int *tri = atom->tri;
if (tri[i] < 0) { if (tri[i] < 0) {
if (size == 0.0) return; if (size == 0.0) return;
if (nlocal_bonus == nmax_bonus) grow_bonus(); if (nlocal_bonus == nmax_bonus) grow_bonus();
@ -730,11 +720,11 @@ void AtomVecTri::set_equilateral(int i, double size)
inertia[0] = sqrt(3.0)/96.0 * size*size*size*size; inertia[0] = sqrt(3.0)/96.0 * size*size*size*size;
inertia[1] = sqrt(3.0)/96.0 * size*size*size*size; inertia[1] = sqrt(3.0)/96.0 * size*size*size*size;
inertia[2] = sqrt(3.0)/48.0 * size*size*size*size; inertia[2] = sqrt(3.0)/48.0 * size*size*size*size;
atom->radius[i] = MathExtra::len3(c1); radius[i] = MathExtra::len3(c1);
bonus[nlocal_bonus].ilocal = i; bonus[nlocal_bonus].ilocal = i;
tri[i] = nlocal_bonus++; tri[i] = nlocal_bonus++;
} else if (size == 0.0) { } else if (size == 0.0) {
atom->radius[i] = 0.5; radius[i] = 0.5;
copy_bonus_all(nlocal_bonus-1,tri[i]); copy_bonus_all(nlocal_bonus-1,tri[i]);
nlocal_bonus--; nlocal_bonus--;
tri[i] = -1; tri[i] = -1;
@ -755,6 +745,6 @@ void AtomVecTri::set_equilateral(int i, double size)
inertia[0] = sqrt(3.0)/96.0 * size*size*size*size; inertia[0] = sqrt(3.0)/96.0 * size*size*size*size;
inertia[1] = sqrt(3.0)/96.0 * size*size*size*size; inertia[1] = sqrt(3.0)/96.0 * size*size*size*size;
inertia[2] = sqrt(3.0)/48.0 * size*size*size*size; inertia[2] = sqrt(3.0)/48.0 * size*size*size*size;
atom->radius[i] = MathExtra::len3(c1); radius[i] = MathExtra::len3(c1);
} }
} }

View File

@ -38,6 +38,7 @@ class AtomVecTri : public AtomVec {
~AtomVecTri(); ~AtomVecTri();
void init(); void init();
void grow_pointers();
void copy_bonus(int, int, int); void copy_bonus(int, int, int);
void clear_bonus(); void clear_bonus();
int pack_comm_bonus(int, int *, double *); int pack_comm_bonus(int, int *, double *);
@ -64,9 +65,13 @@ class AtomVecTri : public AtomVec {
int nlocal_bonus; int nlocal_bonus;
private: private:
int *tri;
double *radius,*rmass;
double **omega,**angmom;
int nghost_bonus,nmax_bonus; int nghost_bonus,nmax_bonus;
int tri_flag; int tri_flag;
double rmass; double rmass_one;
void grow_bonus(); void grow_bonus();
void copy_bonus_all(int, int); void copy_bonus_all(int, int);

View File

@ -100,7 +100,8 @@ void Replicate::command(int narg, char **arg)
maxmol = maxmol_all; maxmol = maxmol_all;
} }
// check image flags maximum extent; only efficient small image flags compared to new system // check image flags maximum extent
// only efficient small image flags compared to new system
int _imagelo[3], _imagehi[3]; int _imagelo[3], _imagehi[3];
_imagelo[0] = 0; _imagelo[0] = 0;