-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvasp_info.py
More file actions
58 lines (51 loc) · 1.88 KB
/
vasp_info.py
File metadata and controls
58 lines (51 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 11 22:34:34 2024
@author: qidaw
"""
"""
Extracts information about:
free energy TOTEN
E-fermi
final convergence information
Maximum number of electronic SC (self-consistency) steps
ISYM
The script should be run from the directory where the OUTCAR, OSZICAR, and INCAR files are located.
"""
import re
with open(r'OUTCAR', 'r') as OUTCAR:
line = OUTCAR.readline()
while line != '': #The EOF char is an empty string
if re.search('free energy TOTEN', line):
print(line.lstrip().rstrip('\r\n') + ' #from OUTCAR')
if re.search('E-fermi', line):
print(line.lstrip().rstrip('\r\n') + ' #from OUTCAR')
line = OUTCAR.readline()
print('')
with open(r'OSZICAR', 'r') as OSZICAR:
line = OSZICAR.readline()
while line != '': #find first DAV
if re.search('DAV:', line):
previous_line = line
while line != '':
if not re.search('DAV:', line): #find first line without DAV
print(previous_line.rstrip('\r\n') + ' #from OSZICAR')
break
else: #if not, store it as previous_line
previous_line = line
line = OSZICAR.readline() #read next line for the last DAV search cycle
line = OSZICAR.readline() #read next line for the first DAV search cycle
print('')
ISYM_exist = False
with open(r'INCAR', 'r') as INCAR:
line = INCAR.readline()
while line != '':
line = re.sub(r'[#!].*', '', line) #remove INCAR comments
if re.search(r'NELM\b', line):
print(line.rstrip('\r\n') + ' #from INCAR')
elif re.search(r'ISYM\b', line):
print(line.rstrip('\r\n') + ' #from INCAR')
ISYM_exist = True
line = INCAR.readline()
if not ISYM_exist:
print('ISYM as Default')