recover read_restart and read_data capability for fix property/atom

This commit is contained in:
Axel Kohlmeyer
2022-04-13 12:41:40 -04:00
parent ef4e41d2a2
commit 0f1097d7e6
3 changed files with 14 additions and 27 deletions

View File

@ -1926,8 +1926,7 @@ int Atom::find_molecule(char *id)
called by fixes and commands that add molecules called by fixes and commands that add molecules
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void Atom::add_molecule_atom(Molecule *onemol, int iatom, void Atom::add_molecule_atom(Molecule *onemol, int iatom, int ilocal, tagint offset)
int ilocal, tagint offset)
{ {
if (onemol->qflag && q_flag) q[ilocal] = onemol->q[iatom]; if (onemol->qflag && q_flag) q[ilocal] = onemol->q[iatom];
if (onemol->radiusflag && radius_flag) radius[ilocal] = onemol->radius[iatom]; if (onemol->radiusflag && radius_flag) radius[ilocal] = onemol->radius[iatom];
@ -1942,6 +1941,19 @@ void Atom::add_molecule_atom(Molecule *onemol, int iatom,
onemol->avec_body->set_quat(ilocal,onemol->quat_external); onemol->avec_body->set_quat(ilocal,onemol->quat_external);
} }
// initialize custom per-atom properties to zero if present
for (int i = 0; i < nivector; ++i)
ivector[i][ilocal] = 0;
for (int i = 0; i < ndvector; ++i)
dvector[i][ilocal] = 0.0;
for (int i = 0; i < niarray; ++i)
for (int j = 0; j < icols[i]; ++j)
iarray[i][ilocal][j] = 0;
for (int i = 0; i < ndarray; ++i)
for (int j = 0; j < dcols[i]; ++j)
darray[i][ilocal][j] = 0.0;
if (molecular != Atom::MOLECULAR) return; if (molecular != Atom::MOLECULAR) return;
// add bond topology info // add bond topology info

View File

@ -36,7 +36,6 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
restart_peratom = 1; restart_peratom = 1;
wd_section = 1; wd_section = 1;
create_attribute = 1;
int iarg = 3; int iarg = 3;
nvalue = narg - iarg; nvalue = narg - iarg;
@ -572,29 +571,6 @@ void FixPropertyAtom::copy_arrays(int i, int j, int /*delflag*/)
} }
} }
/* ----------------------------------------------------------------------
initialize one atom's storage values, called when atom is created
------------------------------------------------------------------------- */
void FixPropertyAtom::set_arrays(int i)
{
int k, ncol;
for (int nv = 0; nv < nvalue; nv++) {
if (styles[nv] == IVEC)
atom->ivector[index[nv]][i] = 0;
else if (styles[nv] == DVEC)
atom->dvector[index[nv]][i] = 0.0;
else if (styles[nv] == IARRAY) {
ncol = cols[nv];
for (k = 0; k < ncol; k++) atom->iarray[index[nv]][i][k] = 0;
} else if (styles[nv] == DARRAY) {
ncol = cols[nv];
for (k = 0; k < ncol; k++) atom->darray[index[nv]][i][k] = 0.0;
}
}
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
pack values for border communication at re-neighboring pack values for border communication at re-neighboring
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */

View File

@ -41,7 +41,6 @@ class FixPropertyAtom : public Fix {
void grow_arrays(int) override; void grow_arrays(int) override;
void copy_arrays(int, int, int) override; void copy_arrays(int, int, int) override;
void set_arrays(int) override;
int pack_border(int, int *, double *) override; int pack_border(int, int *, double *) override;
int unpack_border(int, int, double *) override; int unpack_border(int, int, double *) override;
int pack_exchange(int, double *) override; int pack_exchange(int, double *) override;