fix bug where floating point data was formatted as integer since the second column was assumed to be the type

This commit is contained in:
Axel Kohlmeyer
2023-03-19 18:20:31 -04:00
parent 03b63de588
commit 57e86346a6

View File

@ -657,11 +657,14 @@ class dump:
atoms = snap.atoms atoms = snap.atoms
nvalues = len(atoms[0]) nvalues = len(atoms[0])
keys = dict()
for pair in self.names.items():
keys[pair[1]] = pair[0]
for i in range(snap.natoms): for i in range(snap.natoms):
if not snap.aselect[i]: continue if not snap.aselect[i]: continue
line = "" line = ""
for j in range(nvalues): for j in range(nvalues):
if (j < 2): if keys[j] == 'id' or keys[j] == 'type' or keys[j] == 'mol':
line += str(int(atoms[i][j])) + " " line += str(int(atoms[i][j])) + " "
else: else:
line += str(atoms[i][j]) + " " line += str(atoms[i][j]) + " "