Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions dpdata/lammps/dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ def get_posi_frac(lines) :
posis = np.array(posis)
return posis[:,1:4]

def safe_get_posi(lines, cell):
def safe_get_posi(lines, cell, orig = np.zeros(3)):
try:
posis = get_posi(lines)
posis = get_posi(lines) - orig
except ValueError:
fposis = get_posi_frac(lines)
posis = fposis @ cell
Expand Down Expand Up @@ -173,12 +173,12 @@ def system_data(lines, type_map = None, type_idx_zero = True) :
system['cells'] = [np.array(cell)]
natoms = sum(system['atom_numbs'])
system['atom_types'] = get_atype(lines, type_idx_zero = type_idx_zero)
system['coords'] = [safe_get_posi(lines, cell) - np.array(orig)]
system['coords'] = [safe_get_posi(lines, cell, np.array(orig))]
for ii in range(1, len(array_lines)) :
bounds, tilt = get_dumpbox(array_lines[ii])
orig, cell = dumpbox2box(bounds, tilt)
system['cells'].append(cell)
system['coords'].append(safe_get_posi(array_lines[ii], cell) - np.array(orig))
system['coords'].append(safe_get_posi(array_lines[ii], cell, np.array(orig)))
system['cells'] = np.array(system['cells'])
system['coords'] = np.array(system['coords'])
return system
Expand Down