First of all this is a great resource, but I did find a bug. The .json is incorrect for the element, charge pairs:
Mn +3
Mn +2
Ni +3
Fe +3
Fe +2
Co +3
Co +2
Cr +2
There is both a high and low spin state for these ions. In this case, (within the .json) the low spin state is given the proper coordination number, but the high spin state is given a C.N. of an empty string.
For example, d['Mn']['3]['VI']['r_ionic'] cannot uniquely identify an ionic radius because the high and low spin states have different radii.
I have attached my custom modifications to the .json file and an admittedly very hacky python code to read the updated .json:
import json
def get_ion_data(data, ele='Fe', charge = '2', coord = 'IV', info = 'r_ionic',spin_state = ''):
coord_info = data[ele][charge][coord]
if len(coord_info) == 4:
return data[ele][charge][coord][info]
elif len(coord_info) == 2:
if spin_state != '':
return data[ele][charge][coord][spin_state][info]
else:
print('Warning: Returning average of two spin states')
return (data[ele][charge][coord]['Low Spin'][info] + data[ele][charge][coord]['High Spin'][info])/2
else:
raise NameError("Useful message here")
with open('IonicRadiiData.json') as f:
out = f.read()
data = json.loads(out)
arguments are data, element, charge, coordination, one of r_crystal, r_ionic, spin, remark, then spin state (optional)
print(get_ion_data(data,'Cr','2','VI','r_crystal','High Spin'))
IonicRadiiData.json
First of all this is a great resource, but I did find a bug. The .json is incorrect for the element, charge pairs:
Mn +3
Mn +2
Ni +3
Fe +3
Fe +2
Co +3
Co +2
Cr +2
There is both a high and low spin state for these ions. In this case, (within the .json) the low spin state is given the proper coordination number, but the high spin state is given a C.N. of an empty string.
For example, d['Mn']['3]['VI']['r_ionic'] cannot uniquely identify an ionic radius because the high and low spin states have different radii.
I have attached my custom modifications to the .json file and an admittedly very hacky python code to read the updated .json:
import json
def get_ion_data(data, ele='Fe', charge = '2', coord = 'IV', info = 'r_ionic',spin_state = ''):
coord_info = data[ele][charge][coord]
if len(coord_info) == 4:
return data[ele][charge][coord][info]
elif len(coord_info) == 2:
if spin_state != '':
return data[ele][charge][coord][spin_state][info]
else:
print('Warning: Returning average of two spin states')
return (data[ele][charge][coord]['Low Spin'][info] + data[ele][charge][coord]['High Spin'][info])/2
else:
raise NameError("Useful message here")
with open('IonicRadiiData.json') as f:
out = f.read()
data = json.loads(out)
arguments are data, element, charge, coordination, one of r_crystal, r_ionic, spin, remark, then spin state (optional)
print(get_ion_data(data,'Cr','2','VI','r_crystal','High Spin'))
IonicRadiiData.json