Skip to content

Commit

Permalink
Merge pull request #249 from AntObi/doper_fix
Browse files Browse the repository at this point in the history
Add in a threshold to eliminate species pairs not present in the lambda table
  • Loading branch information
AntObi committed May 24, 2024
2 parents 2e2c720 + 1971ac5 commit c54fba2
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions smact/dopant_prediction/doper.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ def __init__(self, original_species: Tuple[str, ...], filepath: str = None):
self.filepath = filepath
self.cation_mutator = mutation.CationMutator.from_json(filepath)
self.possible_species = list(self.cation_mutator.specs)
self.threshold = (
1
/ self.cation_mutator.Z
* np.exp(self.cation_mutator.alpha("X", "Y"))
)
self.results = None

def _get_selectivity(
Expand Down Expand Up @@ -152,17 +157,19 @@ def get_dopants(
n_specie_charge = utilities.parse_spec(n_specie)[1]
if cation_charge >= n_specie_charge:
continue
n_type_cat.append(
[n_specie, cation, CM.sub_prob(cation, n_specie)]
)
if CM.sub_prob(cation, n_specie) > self.threshold:
n_type_cat.append(
[n_specie, cation, CM.sub_prob(cation, n_specie)]
)

for p_specie in poss_p_type_cat:
p_specie_charge = utilities.parse_spec(p_specie)[1]
if cation_charge <= p_specie_charge:
continue
p_type_cat.append(
[p_specie, cation, CM.sub_prob(cation, p_specie)]
)
if CM.sub_prob(cation, p_specie) > self.threshold:
p_type_cat.append(
[p_specie, cation, CM.sub_prob(cation, p_specie)]
)

for anion in anions:
anion_charge = utilities.parse_spec(anion)[1]
Expand All @@ -171,17 +178,19 @@ def get_dopants(
n_specie_charge = utilities.parse_spec(n_specie)[1]
if anion_charge >= n_specie_charge:
continue
n_type_an.append(
[n_specie, anion, CM.sub_prob(anion, n_specie)]
)
if CM.sub_prob(anion, n_specie) > self.threshold:
n_type_an.append(
[n_specie, anion, CM.sub_prob(anion, n_specie)]
)

for p_specie in poss_p_type_an:
p_specie_charge = utilities.parse_spec(p_specie)[1]
if anion_charge <= p_specie_charge:
continue
p_type_an.append(
[p_specie, anion, CM.sub_prob(anion, p_specie)]
)
if CM.sub_prob(anion, p_specie) > self.threshold:
p_type_an.append(
[p_specie, anion, CM.sub_prob(anion, p_specie)]
)

dopants_lists = [n_type_cat, p_type_cat, n_type_an, p_type_an]

Expand Down

0 comments on commit c54fba2

Please sign in to comment.