fix issues with reading and writing data files for systems without atom IDs

This commit is contained in:
Axel Kohlmeyer
2024-01-31 20:20:35 -05:00
parent 5599d1843a
commit 17f869bf5e
4 changed files with 130 additions and 6 deletions

View File

@ -1465,8 +1465,23 @@ void ReadData::atoms()
void ReadData::velocities()
{
bigint nread = 0;
int nchunk, eof;
// cannot map velocities to atoms without atom IDs
if (!atom->tag_enable) {
if (me == 0) utils::logmesg(lmp, " skipping velocities without atom IDs ...\n");
while (nread < natoms) {
nchunk = MIN(natoms - nread, CHUNK);
eof = utils::read_lines_from_file(fp, nchunk, MAXLINE, buffer, me, world);
if (eof) error->all(FLERR, "Unexpected end of data file");
nread += nchunk;
}
return;
}
if (me == 0) utils::logmesg(lmp, " reading velocities ...\n");
int mapflag = 0;
@ -1476,8 +1491,6 @@ void ReadData::velocities()
atom->map_set();
}
bigint nread = 0;
while (nread < natoms) {
nchunk = MIN(natoms - nread, CHUNK);
eof = utils::read_lines_from_file(fp, nchunk, MAXLINE, buffer, me, world);