Commit 1a629640 authored by Luigi's avatar Luigi

Create module perovskites_tolerance_factor

parent c1a811d1
H,2.2
He,0
Li,0.98
Be,1.57
B,2.04
C,2.55
N,3.04
O,3.44
F,3.98
Ne,0
Na,0.93
Mg,1.31
Al,1.61
Si,1.9
P,2.19
S,2.58
Cl,3.16
Ar,0
K,0.82
Ca,1
Sc,1.36
Ti,1.54
V,1.63
Cr,1.66
Mn,1.55
Fe,1.83
Co,1.88
Ni,1.91
Cu,1.9
Zn,1.65
Ga,1.81
Ge,2.01
As,2.18
Se,2.55
Br,2.96
Kr,3
Rb,0.82
Sr,0.95
Y,1.22
Zr,1.33
Nb,1.6
Mo,2.16
Tc,1.9
Ru,2.2
Rh,2.28
Pd,2.2
Ag,1.93
Cd,1.69
In,1.78
Sn,1.96
Sb,2.05
Te,2.1
I,2.66
Xe,2.6
Cs,0.79
Ba,0.89
La,1.1
Ce,1.12
Pr,1.13
Nd,1.14
Pm,1.13
Sm,1.17
Eu,1.2
Gd,1.2
Tb,1.1
Dy,1.22
Ho,1.23
Er,1.24
Tm,1.25
Yb,1.1
Lu,1.27
Hf,1.3
Ta,1.5
W,2.36
Re,1.9
Os,2.2
Ir,2.2
Pt,2.28
Au,2.54
Hg,2
Tl,1.62
Pb,2.33
Bi,2.02
Po,2
At,2.2
Rn,0
Fr,0.7
Ra,0.9
Ac,1.1
Th,1.3
Pa,1.5
U,1.38
Np,1.36
Pu,1.28
Am,1.3
Cm,1.3
Bk,1.3
Cf,1.3
Es,1.3
Fm,1.3
Md,1.3
No,1.3
Lr,1.3
Rf,nan
Db,nan
Sg,nan
Bh,nan
Hs,nan
Mt,nan
This diff is collapsed.
......@@ -3,7 +3,7 @@ import pandas as pd
import os, json
fjson = 'Shannon_radii_dict.json'
if not os.path.exists(fjson):
from make_radii_dict import ionic_radii_dict as Shannon_dict
from perovskites_tolerance_factor.make_radii_dict import ionic_radii_dict as Shannon_dict
else:
with open(fjson) as f:
Shannon_dict = json.load(f)
......@@ -138,7 +138,7 @@ class PredictABX3(object):
"""
cations = self.cations
chi_dict = {}
with open('electronegativities.csv') as f:
with open('./electronegativities.csv') as f:
for line in f:
line = line.split(',')
if line[0] in cations:
......
This diff is collapsed.
This diff is collapsed.
H,2.2
He,0
Li,0.98
Be,1.57
B,2.04
C,2.55
N,3.04
O,3.44
F,3.98
Ne,0
Na,0.93
Mg,1.31
Al,1.61
Si,1.9
P,2.19
S,2.58
Cl,3.16
Ar,0
K,0.82
Ca,1
Sc,1.36
Ti,1.54
V,1.63
Cr,1.66
Mn,1.55
Fe,1.83
Co,1.88
Ni,1.91
Cu,1.9
Zn,1.65
Ga,1.81
Ge,2.01
As,2.18
Se,2.55
Br,2.96
Kr,3
Rb,0.82
Sr,0.95
Y,1.22
Zr,1.33
Nb,1.6
Mo,2.16
Tc,1.9
Ru,2.2
Rh,2.28
Pd,2.2
Ag,1.93
Cd,1.69
In,1.78
Sn,1.96
Sb,2.05
Te,2.1
I,2.66
Xe,2.6
Cs,0.79
Ba,0.89
La,1.1
Ce,1.12
Pr,1.13
Nd,1.14
Pm,1.13
Sm,1.17
Eu,1.2
Gd,1.2
Tb,1.1
Dy,1.22
Ho,1.23
Er,1.24
Tm,1.25
Yb,1.1
Lu,1.27
Hf,1.3
Ta,1.5
W,2.36
Re,1.9
Os,2.2
Ir,2.2
Pt,2.28
Au,2.54
Hg,2
Tl,1.62
Pb,2.33
Bi,2.02
Po,2
At,2.2
Rn,0
Fr,0.7
Ra,0.9
Ac,1.1
Th,1.3
Pa,1.5
U,1.38
Np,1.36
Pu,1.28
Am,1.3
Cm,1.3
Bk,1.3
Cf,1.3
Es,1.3
Fm,1.3
Md,1.3
No,1.3
Lr,1.3
Rf,nan
Db,nan
Sg,nan
Bh,nan
Hs,nan
Mt,nan
import numpy as np
import pandas as pd
import json
df = pd.read_csv('./perovskites_tolerance_factor/Shannon_Effective_Ionic_Radii.csv')
df = df.rename(columns = {'OX. State': 'ox',
'Coord. #': 'coord',
'Crystal Radius': 'rcryst',
'Ionic Radius': 'rion',
'Spin State' : 'spin'})
df['spin'] = [spin if spin in ['HS', 'LS'] else 'only_spin' for spin in df.spin.values]
def get_el(row):
ION = row['ION']
if ' ' in ION:
return ION.split(' ')[0]
elif '+' in ION:
return ION.split('+')[0]
elif '-' in ION:
return ION.split('-')[0]
df['el'] = df.apply(lambda row: get_el(row), axis = 1)
el_to_ox = {}
for el in df.el.values:
el_to_ox[el] = list(set(df.ox.get((df['el'] == el)).tolist()))
ionic_radii_dict = {}
for el in el_to_ox:
oxs = el_to_ox[el]
ox_to_coord = {}
for ox in oxs:
coords = df.coord.get((df['el'] == el) & (df['ox'] == ox)).tolist()
ox_to_coord[ox] = coords
coord_to_spin = {}
for coord in ox_to_coord[ox]:
spin = df.spin.get((df['el'] == el) & (df['ox'] == ox) & (df['coord'] == coord)).tolist()
coord_to_spin[coord] = spin
spin_to_rad = {}
for spin in coord_to_spin[coord]:
rad = df.rion.get((df['el'] == el) & (df['ox'] == ox) & (df['coord'] == coord) & (df['spin'] == spin)).tolist()[0]
spin_to_rad[spin] = rad
coord_to_spin[coord] = spin_to_rad
ox_to_coord[ox] = coord_to_spin
ionic_radii_dict[el] = ox_to_coord
spin_els = ['Cr', 'Mn', 'Fe', 'Co', 'Ni', 'Cu']
starting_d = [4, 5, 6, 7, 8, 9]
d_dict = dict(zip(spin_els, starting_d))
for el in spin_els:
for ox in ionic_radii_dict[el].keys():
for coord in ionic_radii_dict[el][ox].keys():
if len(ionic_radii_dict[el][ox][coord].keys()) > 1:
num_d = d_dict[el] + 2 - ox
if num_d in [4, 5, 6, 7]:
ionic_radii_dict[el][ox][coord]['only_spin'] = ionic_radii_dict[el][ox][coord]['HS']
else:
ionic_radii_dict[el][ox][coord]['only_spin'] = ionic_radii_dict[el][ox][coord]['LS']
elif 'HS' in ionic_radii_dict[el][ox][coord].keys():
ionic_radii_dict[el][ox][coord]['only_spin'] = ionic_radii_dict[el][ox][coord]['HS']
elif 'LS' in ionic_radii_dict[el][ox][coord].keys():
ionic_radii_dict[el][ox][coord]['only_spin'] = ionic_radii_dict[el][ox][coord]['LS']
with open('Shannon_radii_dict.json', 'w') as f:
json.dump(ionic_radii_dict, f)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment