File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 9
9
runs-on : ubuntu-latest
10
10
strategy :
11
11
matrix :
12
- python-version : [3.6 , 3.7 , 3.8 ]
12
+ python-version : [3.7 , 3.8 , 3.9 ]
13
13
14
14
steps :
15
15
- uses : actions/checkout@v2
Original file line number Diff line number Diff line change 1
1
import numpy as np
2
+ import re
2
3
3
4
def system_info (lines , type_idx_zero = False ) :
4
5
atom_names = []
5
6
atom_numbs = None
6
7
nelm = None
7
- for ii in lines :
8
+ for ii in lines :
9
+ ii_word_list = ii .split ()
8
10
if 'TITEL' in ii :
9
11
# get atom names from POTCAR info, tested only for PAW_PBE ...
10
12
_ii = ii .split ()[3 ]
@@ -13,10 +15,12 @@ def system_info (lines, type_idx_zero = False) :
13
15
atom_names .append (_ii .split ('_' )[0 ])
14
16
else :
15
17
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 :
20
24
atom_numbs_ = [int (s ) for s in ii .split ()[4 :]]
21
25
if atom_numbs is None :
22
26
atom_numbs = atom_numbs_
You can’t perform that action at this time.
0 commit comments