fix read_data bug

This commit is contained in:
Axel Kohlmeyer
2021-08-18 22:50:42 -04:00
parent b942c4d122
commit c53875421b

View File

@ -254,8 +254,7 @@ void FixPropertyAtom::init()
id_offset is applied to first atomID field if multiple data files are read
------------------------------------------------------------------------- */
void FixPropertyAtom::read_data_section(char *keyword, int n, char *buf,
tagint id_offset)
void FixPropertyAtom::read_data_section(char *keyword, int n, char *buf, tagint id_offset)
{
int j,k,m,ncol;
tagint itag;
@ -280,14 +279,13 @@ void FixPropertyAtom::read_data_section(char *keyword, int n, char *buf,
try {
ValueTokenizer values(buf);
if ((int)values.count() != nvalue+1)
error->all(FLERR,"Incorrect format in {} section "
"of data file: {}",keyword,buf);
if ((int)values.count() != values_peratom+1)
error->all(FLERR,"Incorrect format in {} section of data file: {}"
" expected {} and got {}",keyword,buf,values_peratom+1,values.count());
itag = values.next_tagint() + id_offset;
if (itag <= 0 || itag > map_tag_max)
error->all(FLERR,"Invalid atom ID {} in {} section of "
"data file",itag, keyword);
error->all(FLERR,"Invalid atom ID {} in {} section of data file",itag, keyword);
// assign words in line to per-atom vectors
@ -303,7 +301,6 @@ void FixPropertyAtom::read_data_section(char *keyword, int n, char *buf,
atom->ivector[index[j]][m] = values.next_int();
} else if (style[j] == DVEC) {
atom->dvector[index[j]][m] = values.next_double();
// NOTE: Axel please check these lines of array code
} else if (style[j] == IARRAY) {
ncol = cols[j];
for (k = 0; k < ncol; k++)
@ -316,8 +313,7 @@ void FixPropertyAtom::read_data_section(char *keyword, int n, char *buf,
}
}
} catch (TokenizerException &e) {
error->all(FLERR,"Invalid format in {} section of data "
"file '{}': {}",keyword, buf,e.what());
error->all(FLERR,"Invalid format in {} section of data file '{}': {}",keyword, buf,e.what());
}
buf = next + 1;
}