Skip to content

Commit aec0004

Browse files
committed
str2unicode removed
1 parent 27973b6 commit aec0004

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

pycdt/core/defectsmaker.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import abc
1919

2020

21-
#from monty.string import str2unicode
2221
from monty.serialization import dumpfn
2322
from pymatgen.core.structure import PeriodicSite, Structure
2423
from pymatgen.core.periodic_table import Element, Specie, get_el_sp
@@ -246,7 +245,7 @@ def __init__(self, structure):
246245
self.oxi_states = {}
247246
for key,val in oxi_states.items():
248247
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
250249

251250
self.min_max_oxi = {}
252251
for s in struct_species:
@@ -258,7 +257,7 @@ def __init__(self, structure):
258257
continue
259258
max_oxi = max(el.common_oxidation_states)
260259
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)
262261

263262
def get_charges(self, defect_type, site_specie=None, sub_specie=None):
264263
"""
@@ -274,7 +273,7 @@ def get_charges(self, defect_type, site_specie=None, sub_specie=None):
274273
"""
275274
if defect_type == 'vacancy':
276275
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]
278277
if vac_oxi_state < 0:
279278
min_oxi = max(vac_oxi_state, self.min_max_oxi[vac_symbol][0])
280279
max_oxi = 0
@@ -289,7 +288,7 @@ def get_charges(self, defect_type, site_specie=None, sub_specie=None):
289288

290289
elif defect_type == 'antisite':
291290
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]
293292
as_symbol = get_el_sp(sub_specie).symbol
294293
if vac_oxi_state > 0:
295294
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):
304303
site_specie = get_el_sp(site_specie)
305304
sub_specie = get_el_sp(sub_specie)
306305
vac_symbol = site_specie.symbol
307-
vac_oxi_state = self.oxi_states[str2unicode(vac_symbol)]
306+
vac_oxi_state = self.oxi_states[vac_symbol]
308307

309308
max_oxi_sub = max(sub_specie.common_oxidation_states)
310309
min_oxi_sub = min(sub_specie.common_oxidation_states)
@@ -352,7 +351,7 @@ def __init__(self, structure):
352351
self.oxi_states = {}
353352
for key,val in oxi_states.items():
354353
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
356355

357356
def get_charges(self, defect_type, site_specie=None, sub_specie=None):
358357
"""
@@ -368,7 +367,7 @@ def get_charges(self, defect_type, site_specie=None, sub_specie=None):
368367
"""
369368
if defect_type == 'vacancy':
370369
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]
372371
if vac_oxi_state == 0:
373372
return [-1,0,1]
374373
else:
@@ -379,9 +378,9 @@ def get_charges(self, defect_type, site_specie=None, sub_specie=None):
379378
elif defect_type in ['antisite', 'substitution']:
380379
#TODO: may cause some weird states for substitutions. Worth updating in future.
381380
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]
383382
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]
385384
expected_oxi = as_oxi_state - vac_oxi_state
386385
if expected_oxi == 0:
387386
return [-1,0,1]
@@ -565,7 +564,7 @@ def __init__(self, structure, max_min_oxi=None, substitutions=None,
565564
self.substitutions = {}
566565
self.struct_type = struct_type
567566
for key, val in substitutions.items():
568-
self.substitutions[str2unicode(key)] = val
567+
self.substitutions[key] = val
569568

570569
spa = SpacegroupAnalyzer(structure, symprec=1e-2)
571570
prim_struct = spa.get_primitive_standard_structure()

0 commit comments

Comments
 (0)