-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_calculation_info.py
executable file
·34 lines (32 loc) · 1.21 KB
/
get_calculation_info.py
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
#!/usr/bin/env python3
from pymatgen.io import vasp
import numpy as np
from pymatgen.analysis.structure_analyzer import SpacegroupAnalyzer
import pymatgen
run = vasp.Vasprun('vasprun.xml')
outcar = vasp.Outcar('OUTCAR')
st = run.final_structure
symbols = np.array([x.value for x in st.species])
sa = SpacegroupAnalyzer(st)
print('**************')
print("conventional cell")
print(sa.get_conventional_standard_structure())
print(sa.get_conventional_standard_structure().volume)
print(sa.get_space_group_symbol(),sa.get_space_group_number())
print("******************")
print("Final structure")
print(run.final_structure)
print("vol={}".format(run.final_structure.volume))
print("******************")
print("Bandgap information")
print(run.get_band_structure().get_band_gap())
print("******************")
print("Magnetzation per site")
for ielement in range(len(symbols)):
print("{}-{} {}".format(symbols[ielement], ielement,
outcar.magnetization[ielement]['tot']))
print("******************")
print("Magnetzation per species")
for element in st.symbol_set:
temp = np.array(outcar.magnetization)[np.where(symbols == element)[0]]
print("{} {}".format(element, np.average([abs(x['tot']) for x in temp])))