Skip to content

Commit c08c74c

Browse files
Vibsteamerwanghan-iapcmHan Wangnjzjz
authored
bug_fix | read "nelm" | compatible with vasp6 format change (#239)
* Update outcar.py VASP6 writes NELMIN(minimum number of electronic steps) ahead of NELM(max num), dpdata reads the first line contains "NEIM", then will take the value of NELMIN as that of NELM, inducing "false" in scf_convergence_check this revise includes this such cases by request a stronger check that the line should not be initiated by "NELMIN" or "NELMDL" * bug_fix | read "nelm" | compatible with vasp6 adding a stricter check for whether the line is actually assigning value for "NELM". expecting the assignment follows the format : ``` "anywhere_in_the_line"+"NELM"+"any_number_of_spaces"+"="+"value(data-type-check_omitted_don't-believe-it's-needed-here)"+"whatever_else" ``` * Apply suggestions from code review Co-authored-by: Jinzhe Zeng <[email protected]> * Apply suggestions from code review Co-authored-by: Jinzhe Zeng <[email protected]> Co-authored-by: Han Wang <[email protected]> Co-authored-by: Han Wang <[email protected]> Co-authored-by: Jinzhe Zeng <[email protected]>
1 parent 3edbc24 commit c08c74c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

dpdata/vasp/outcar.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import numpy as np
2+
import re
23

34
def system_info (lines, type_idx_zero = False) :
45
atom_names = []
56
atom_numbs = None
67
nelm = None
7-
for ii in lines:
8+
for ii in lines:
9+
ii_word_list=ii.split()
810
if 'TITEL' in ii :
911
# get atom names from POTCAR info, tested only for PAW_PBE ...
1012
_ii=ii.split()[3]
@@ -13,9 +15,11 @@ def system_info (lines, type_idx_zero = False) :
1315
atom_names.append(_ii.split('_')[0])
1416
else:
1517
atom_names.append(_ii)
16-
elif 'NELM' in ii and nelm == None:
17-
# will read only first nelm
18-
nelm = int(ii.split()[2].rstrip(";"))
18+
#a stricker check for "NELM"; compatible with distingct formats in different versions(6 and older, newers_expect-to-work) of vasp
19+
elif nelm is None:
20+
m = re.search(r'NELM\s*=\s*(\d+)', ii)
21+
if m:
22+
nelm = int(m.group(1))
1923
elif 'ions per type' in ii :
2024
atom_numbs_ = [int(s) for s in ii.split()[4:]]
2125
if atom_numbs is None :

0 commit comments

Comments
 (0)