forked from mbkumar/defect_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinter_anlysis.py
35 lines (28 loc) · 958 Bytes
/
inter_anlysis.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
35
import os
import sys
import json
import matplotlib.pyplot as plt
from pymatgen.io.cifio import CifParser
from pymatgen.core.structure import Structure
from pymatgen.defects.point_defects import Interstitial
#cif_dir = 'Binary oxide dataset/20130524/comp_structures'
# define different plot generators
def coord_no_vs_inter_radius(inter_descript_dict):
X = []
Y = []
dct = inter_descript_dict
for key in dct.keys():
for i in range(dct[key]['no_inter']):
x = dct[key]['interstitials'][i]['coord_no']
y = dct[key]['interstitials'][i]['radius']
X.append(x)
Y.append(y)
fig = plt.figure()
ax = fig.add_subplot(111)
plt.scatter(X,Y)
plt.savefig('test1.png')
if __name__ == '__main__':
with open('inter_prop.json', 'r') as fp:
json_string = fp.read()
inter_descript_dict = json.loads(json_string)
coord_no_vs_inter_radius(struct_inter_dict)