How to use the smact.charge_neutrality function in SMACT

To help you get started, we’ve selected a few SMACT examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github WMD-group / SMACT / examples / Permutations / threaded_count.py View on Github external
def _Kernel(elementList):
    combinationCount = 0;
    chargeNeutralCount = 0;
    paulingSensibleCount = 0;
    
    electronegativities = [element.pauling_eneg for element in elementList];

    
    for oxidationStates in itertools.product(*[element.oxidation_states for element in elementList]):
        combinationCount = combinationCount + 1;
        
        ret1, ret2 = smact.charge_neutrality(oxidationStates, threshold = 1);
        
        if ret1:
            chargeNeutralCount = chargeNeutralCount + 1;
            if smact.pauling_test(oxidationStates, electronegativities):
                paulingSensibleCount = paulingSensibleCount + 1;
    
    return (combinationCount, chargeNeutralCount, paulingSensibleCount);
github WMD-group / SMACT / examples / Permutations / binary_permutations.py View on Github external
for i, ele_a in enumerate(list_of_elements):
 	element_count = element_count + 1
	paul_a = smact.Element(ele_a).pauling_eneg
	for ox_a in smact.Element(ele_a).oxidation_states:
		ion_count = ion_count + 1
		for j, ele_b in enumerate(list_of_elements[i+1:]):
			element_count = element_count + 1
			paul_b = smact.Element(ele_b).pauling_eneg
			for ox_b in smact.Element(ele_b).oxidation_states:
				ion_count = ion_count + 1
				element = [ele_a, ele_b]
				print element
				oxidation_states = [ox_a, ox_b]
				pauling_electro = [paul_a, paul_b]
				electroneg_makes_sense = pauling_test(oxidation_states, pauling_electro)
				cn_e, cn_r = smact.charge_neutrality([ox_a, ox_b],threshold=1)
				if cn_e:
					charge_neutral_count = charge_neutral_count + 1
					if electroneg_makes_sense:
						pauling_count = pauling_count + 1

print "  "
print "------------------------------------------"
print "------------------------------------------"
print "Summary of screening for ternary compounds"
print "------------------------------------------"
print "Total from atoms: ", element_count
print "Total from ions:  ", ion_count
print "Total charge neutral: ", charge_neutral_count
print "Total Pauling allowed: ", pauling_count
print "------------------------------------------"
print "I owe you nothing!"
github WMD-group / SMACT / examples / Permutations / ternary_permutations_optimisation.py View on Github external
#				for k, ele_c in enumerate(list_of_elements[i+j+2:]):
	    element_count = element_count + 1
#	    paul_c = smact.Element(ele_c).pauling_eneg
            paul_c=0.2
            for ox_c in [0,1,2]:#smact.Element(ele_c).oxidation_states:
	        ion_count = ion_count + 1
		element = [ele_a, ele_b, ele_c]
#						print element
		oxidation_states = [ox_a, ox_b, ox_c]
		pauling_electro = [paul_a, paul_b, paul_c]

                paul=pauling_electro
                ox=oxidation_states
                electroneg_makes_sense = True #sorted(zip(paul,ox), key=lambda s: s[1])==sorted(zip(paul,ox), key=lambda s: s[0], reverse=True)
#                electroneg_makes_sense = pauling_test(oxidation_states, pauling_electro)
		cn_e, cn_r = smact.charge_neutrality([ox_a, ox_b, ox_c],threshold=1)
		if cn_e:
		    charge_neutral_count = charge_neutral_count + 1
		if electroneg_makes_sense:
		    pauling_count = pauling_count + 1

print "  "
print "------------------------------------------"
print "------------------------------------------"
print "Summary of screening for ternary compounds"
print "------------------------------------------"
print "Total from atoms: ", element_count
print "Total from ions:  ", ion_count
print "Total charge neutral: ", charge_neutral_count
print "Total Pauling allowed: ", pauling_count
print "------------------------------------------"
print "I owe you nothing!"
github WMD-group / SMACT / examples / Permutations / ternary_permutations.py View on Github external
for j, ele_b in enumerate(list_of_elements[i+1:]):
			element_count = element_count + 1
			paul_b = smact.Element(ele_b).pauling_eneg
			for ox_b in smact.Element(ele_b).oxidation_states:
				ion_count = ion_count + 1
				for k, ele_c in enumerate(list_of_elements[i+j+2:]):
				  	element_count = element_count + 1
					paul_c = smact.Element(ele_c).pauling_eneg
					for ox_c in smact.Element(ele_c).oxidation_states:
						ion_count = ion_count + 1
						element = [ele_a, ele_b, ele_c]
						print element
						oxidation_states = [ox_a, ox_b, ox_c]
						pauling_electro = [paul_a, paul_b, paul_c]
						electroneg_makes_sense = pauling_test(oxidation_states, pauling_electro)
						cn_e, cn_r = smact.charge_neutrality([ox_a, ox_b, ox_c],threshold=1)
						if cn_e:
							charge_neutral_count = charge_neutral_count + 1
							if electroneg_makes_sense:
								pauling_count = pauling_count + 1

print "  "
print "------------------------------------------"
print "------------------------------------------"
print "Summary of screening for ternary compounds"
print "------------------------------------------"
print "Total from atoms: ", element_count
print "Total from ions:  ", ion_count
print "Total charge neutral: ", charge_neutral_count
print "Total Pauling allowed: ", pauling_count
print "------------------------------------------"
print "I owe you nothing!"