Skip to content
12 changes: 8 additions & 4 deletions dpdata/vasp/outcar.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import numpy as np
import re

def system_info (lines, type_idx_zero = False) :
atom_names = []
atom_numbs = None
nelm = None
for ii in lines:
for ii in lines:
ii_word_list=ii.split()
if 'TITEL' in ii :
# get atom names from POTCAR info, tested only for PAW_PBE ...
_ii=ii.split()[3]
Expand All @@ -13,9 +15,11 @@ def system_info (lines, type_idx_zero = False) :
atom_names.append(_ii.split('_')[0])
else:
atom_names.append(_ii)
elif 'NELM' in ii and nelm == None:
# will read only first nelm
nelm = int(ii.split()[2].rstrip(";"))
#a stricker check for "NELM"; compatible with distingct formats in different versions(6 and older, newers_expect-to-work) of vasp
elif nelm is None:
m = re.search(r'NELM\s*=\s*(\d+)', ii)
if m:
nelm = int(m.group(1))
elif 'ions per type' in ii :
atom_numbs_ = [int(s) for s in ii.split()[4:]]
if atom_numbs is None :
Expand Down