Skip to content

Commit 47ddd24

Browse files
author
Han Wang
committed
Merge remote-tracking branch 'upstream/devel' into devel
2 parents 985a944 + 11a3cb4 commit 47ddd24

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
python-version: [3.6, 3.7, 3.8]
12+
python-version: [3.7, 3.8, 3.9]
1313

1414
steps:
1515
- uses: actions/checkout@v2

dpdata/vasp/outcar.py

Lines changed: 9 additions & 5 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,10 +15,12 @@ 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(";"))
19-
elif 'ions per type' in ii :
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))
23+
if 'ions per type' in ii :
2024
atom_numbs_ = [int(s) for s in ii.split()[4:]]
2125
if atom_numbs is None :
2226
atom_numbs = atom_numbs_

0 commit comments

Comments
 (0)