decrement/increment molindex and atomindex to have 1-based indices in files and 0-based internally
This commit is contained in:
@ -112,6 +112,27 @@ void AtomVecTemplate::create_atom_post(int ilocal)
|
||||
molatom[ilocal] = -1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
modify values for AtomVec::pack_data() to pack
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void AtomVecTemplate::pack_data_pre(int ilocal)
|
||||
{
|
||||
molindex[ilocal]++;
|
||||
molatom[ilocal]++;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
unmodify values packed by AtomVec::pack_data()
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void AtomVecTemplate::pack_data_post(int ilocal)
|
||||
{
|
||||
molindex[ilocal]--;
|
||||
molatom[ilocal]--;
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
modify what AtomVec::data_atom() just unpacked
|
||||
or initialize other atom quantities
|
||||
@ -119,8 +140,8 @@ void AtomVecTemplate::create_atom_post(int ilocal)
|
||||
|
||||
void AtomVecTemplate::data_atom_post(int ilocal)
|
||||
{
|
||||
int molindex_one = molindex[ilocal];
|
||||
int molatom_one = molatom[ilocal];
|
||||
int molindex_one = --molindex[ilocal];
|
||||
int molatom_one = --molatom[ilocal];
|
||||
|
||||
if (molindex_one < 0 || molindex_one >= nset)
|
||||
error->one(FLERR,"Invalid template index in Atoms section of data file");
|
||||
|
||||
@ -31,6 +31,8 @@ class AtomVecTemplate : public AtomVec {
|
||||
void grow_pointers();
|
||||
void process_args(int, char **);
|
||||
void create_atom_post(int);
|
||||
void pack_data_pre(int);
|
||||
void pack_data_post(int);
|
||||
void data_atom_post(int);
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user