WMD-group/SMACT

Do you have plan for more advanced Pauling rules for screening module?

Closed this issue · 6 comments

https://www.tulane.edu/~sanelson/eens211/paulingsrules.htm

Pauling's five rules for crystal structure.

Which rule is the one that you have implemented here https://smact.readthedocs.io/en/latest/smact.screening.html?

We do have a plan. All of those screening filters are compositional, while structural filters are in development.

There is existing code for Pauling's rules over here: https://github.com/JaGeo/PaulingPublication however, more research is needed to develop them into a clean metric suitable for crystal screening.

Thanks for the link to structural pauling rule. Aron.

I do have a question about your composition pauling test

result=pauling_test(oxidation_states,
electronegativities, symbols=[],
repeat_anions=True, repeat_cations=True, threshold=0.0)

How do you get the oxidation_states automatically from a given formula?
do u have a routine for this? it needs to do exhaustive search ?

We used brute force (with a bit of caching) from a given element combination to obtain all charge-neutral stoichiometries of "ions" (using known oxidation states). So the proposed oxidation states and elemental stoichiometry are actually generated simultaneously.

It's in examples/Counting/ElementCombinationsParallel.py

can you create a usage example for your screening.pauling_test function given a composition formula?

It seems to be not easy to use...

oxidation_states=[] # i have figured out how to get this from your sample Elementcombinationparrel code.

electronegativities=[] #?
result=pauling_test(oxidation_states,
electronegativities, symbols=[],
repeat_anions=True, repeat_cations=True, threshold=0.0)

result=pauling_test(oxidation_states,
electronegativities, symbols=[],
repeat_anions=True, repeat_cations=True, threshold=0.0)

for the above function. if the formula is. SrTiO3
what should I put for symbols?
is it:
symbols = ['Sr','Ti','O','O','O']
or
symbols = ['Sr','Ti','O']

i almost finshed a version for Pauling test for a given formula, except the symbols part, can u guys check it for me?
especially, how to set the symbols variable for the function

#! /usr/bin/env python

import time
import smact
import itertools
from sys import stdout
from smact import Element
from smact.screening import pauling_test

from smact.screening import eneg_states_test
from multiprocessing import Pool
from pymatgen.core.composition import Composition
import numpy as np

def pauling_testX(formula):
# formula = "SrTiO3"
comp=Composition(formula)
element_list = list(comp.as_dict().keys())
elements = smact.element_dictionary(element_list)

max_n = len(element_list)
neutral_stoichiometries_threshold = 8
include_pauling_test = True
pauling_test_threshold = 0.0

# Number of times to report progress during the counting loop.

count_progress_interval = 2#100

# Parameters for the threaded version of the code.

mp_use = True
mp_processes = 4
mp_chunk_size = 10


# print(Element('Ti').oxidation_states)
oxidation_state_combinations=[]
for x1 in Element(element_list[0]).oxidation_states:
    for x2 in Element(element_list[1]).oxidation_states:
        if len(element_list)==2:
            oxidation_state_combinations.append((x1,x2))
        else:
            for x3 in Element(element_list[2]).oxidation_states:
                if len(element_list)==3:
                    oxidation_state_combinations.append((x1,x2,x3))
                else:
                    for x4 in Element(element_list[3]).oxidation_states:
                        if len(element_list)==4:
                            oxidation_state_combinations.append((x1,x2,x3,x4))
                        else:
                            for x5 in Element(element_list[4]).oxidation_states:
                                if len(element_list)==5:
                                    oxidation_state_combinations.append((x1,x2,x3,x4,x5))
                                else:
                                    for x6 in Element(element_list[5]).oxidation_states:
                                        if len(element_list)==6:
                                            oxidation_state_combinations.append((x1,x2,x3,x4,x5,x6))
                                        else:
                                            for x7 in Element(element_list[6]).oxidation_states:
                                                if len(element_list)==7:
                                                    oxidation_state_combinations.append((x1,x2,x3,x4,x5,x6,x7))
                                                else:
                                                    for x8 in Element(element_list[7]).oxidation_states:
                                                        if len(element_list)==8:
                                                            oxidation_state_combinations.append((x1,x2,x3,x4,x5,x6,x7,x8))
                                                        else:
                                                            for x9 in Element(element_list[8]).oxidation_states:
                                                                if len(element_list)==9:
                                                                    oxidation_state_combinations.append((x1,x2,x3,x4,x5,x6,x7,x8,x9))
                                                                else:
                                                                    pass
print(oxidation_state_combinations)
electronegativities=[Element(x).pauling_eneg for x in element_list]
symbols = element_list
# symbols = ['Sr','Ti','O','O','O']

# oxidation_states=(1,3,-1)
npass=0
for oxidation_states in oxidation_state_combinations:
    moleratio = np.array(list(comp.as_dict().values()))
    ostates = np.array(oxidation_states)
    
    if np.dot(moleratio,ostates) !=0:
        continue
    print(moleratio, ostates)
    result=pauling_test(oxidation_states,
        electronegativities, symbols=[],
        repeat_anions=True, repeat_cations=True, threshold=0.0)
    print(result, " pauling_test")
    if result:
        npass+=1
print("total pass:",npass)
if npass>0: #if one of the oxidation states pass Pauling test, we report true
    return True
else:
    return False

def main():
print(pauling_testX('SrTiO3'), "SrTiO3")
return

if name == 'main':
main()