18
18
import abc
19
19
20
20
21
- #from monty.string import str2unicode
22
21
from monty .serialization import dumpfn
23
22
from pymatgen .core .structure import PeriodicSite , Structure
24
23
from pymatgen .core .periodic_table import Element , Specie , get_el_sp
@@ -246,7 +245,7 @@ def __init__(self, structure):
246
245
self .oxi_states = {}
247
246
for key ,val in oxi_states .items ():
248
247
strip_key = '' .join ([s for s in key if s .isalpha ()])
249
- self .oxi_states [str2unicode ( strip_key ) ] = val
248
+ self .oxi_states [strip_key ] = val
250
249
251
250
self .min_max_oxi = {}
252
251
for s in struct_species :
@@ -258,7 +257,7 @@ def __init__(self, structure):
258
257
continue
259
258
max_oxi = max (el .common_oxidation_states )
260
259
min_oxi = min (el .common_oxidation_states )
261
- self .min_max_oxi [str2unicode ( el .symbol ) ] = (min_oxi ,max_oxi )
260
+ self .min_max_oxi [el .symbol ] = (min_oxi ,max_oxi )
262
261
263
262
def get_charges (self , defect_type , site_specie = None , sub_specie = None ):
264
263
"""
@@ -274,7 +273,7 @@ def get_charges(self, defect_type, site_specie=None, sub_specie=None):
274
273
"""
275
274
if defect_type == 'vacancy' :
276
275
vac_symbol = get_el_sp (site_specie ).symbol
277
- vac_oxi_state = self .oxi_states [str2unicode ( vac_symbol ) ]
276
+ vac_oxi_state = self .oxi_states [vac_symbol ]
278
277
if vac_oxi_state < 0 :
279
278
min_oxi = max (vac_oxi_state , self .min_max_oxi [vac_symbol ][0 ])
280
279
max_oxi = 0
@@ -289,7 +288,7 @@ def get_charges(self, defect_type, site_specie=None, sub_specie=None):
289
288
290
289
elif defect_type == 'antisite' :
291
290
vac_symbol = get_el_sp (site_specie ).symbol
292
- vac_oxi_state = self .oxi_states [str2unicode ( vac_symbol ) ]
291
+ vac_oxi_state = self .oxi_states [vac_symbol ]
293
292
as_symbol = get_el_sp (sub_specie ).symbol
294
293
if vac_oxi_state > 0 :
295
294
oxi_max = max (self .min_max_oxi [as_symbol ][1 ],0 )
@@ -304,7 +303,7 @@ def get_charges(self, defect_type, site_specie=None, sub_specie=None):
304
303
site_specie = get_el_sp (site_specie )
305
304
sub_specie = get_el_sp (sub_specie )
306
305
vac_symbol = site_specie .symbol
307
- vac_oxi_state = self .oxi_states [str2unicode ( vac_symbol ) ]
306
+ vac_oxi_state = self .oxi_states [vac_symbol ]
308
307
309
308
max_oxi_sub = max (sub_specie .common_oxidation_states )
310
309
min_oxi_sub = min (sub_specie .common_oxidation_states )
@@ -352,7 +351,7 @@ def __init__(self, structure):
352
351
self .oxi_states = {}
353
352
for key ,val in oxi_states .items ():
354
353
strip_key = '' .join ([s for s in key if s .isalpha ()])
355
- self .oxi_states [str2unicode ( strip_key ) ] = val
354
+ self .oxi_states [strip_key ] = val
356
355
357
356
def get_charges (self , defect_type , site_specie = None , sub_specie = None ):
358
357
"""
@@ -368,7 +367,7 @@ def get_charges(self, defect_type, site_specie=None, sub_specie=None):
368
367
"""
369
368
if defect_type == 'vacancy' :
370
369
vac_symbol = get_el_sp (site_specie ).symbol
371
- vac_oxi_state = self .oxi_states [str2unicode ( vac_symbol ) ]
370
+ vac_oxi_state = self .oxi_states [vac_symbol ]
372
371
if vac_oxi_state == 0 :
373
372
return [- 1 ,0 ,1 ]
374
373
else :
@@ -379,9 +378,9 @@ def get_charges(self, defect_type, site_specie=None, sub_specie=None):
379
378
elif defect_type in ['antisite' , 'substitution' ]:
380
379
#TODO: may cause some weird states for substitutions. Worth updating in future.
381
380
vac_symbol = get_el_sp (site_specie ).symbol
382
- vac_oxi_state = self .oxi_states [str2unicode ( vac_symbol ) ]
381
+ vac_oxi_state = self .oxi_states [vac_symbol ]
383
382
as_symbol = get_el_sp (sub_specie ).symbol
384
- as_oxi_state = self .oxi_states [str2unicode ( as_symbol ) ]
383
+ as_oxi_state = self .oxi_states [as_symbol ]
385
384
expected_oxi = as_oxi_state - vac_oxi_state
386
385
if expected_oxi == 0 :
387
386
return [- 1 ,0 ,1 ]
@@ -565,7 +564,7 @@ def __init__(self, structure, max_min_oxi=None, substitutions=None,
565
564
self .substitutions = {}
566
565
self .struct_type = struct_type
567
566
for key , val in substitutions .items ():
568
- self .substitutions [str2unicode ( key ) ] = val
567
+ self .substitutions [key ] = val
569
568
570
569
spa = SpacegroupAnalyzer (structure , symprec = 1e-2 )
571
570
prim_struct = spa .get_primitive_standard_structure ()
0 commit comments