A collection of tools for estimating physical properties based on chemical composition.
Internal function for checking electronegativity criterion.
This implementation is fast as it ‘short-circuits’ as soon as it finds an invalid combination. However it may be that in some cases redundant comparisons are made. Performance is very close between this method and eneg_states_test_alternate.
Args:#Returns:#
- ox_states (list): oxidation states corresponding to species
in compound
- enegs (list): Electronegativities corresponding to species in
compound
- boolTrue if anions are more electronegative than
cations, otherwise False
Internal function for checking electronegativity criterion.
This implementation appears to be slightly slower than eneg_states_test, but further testing is needed.
Args:#Returns:#
- ox_states (list): oxidation states corresponding to species
in compound
- enegs (list): Electronegativities corresponding to species in
compound
- boolTrue if anions are more electronegative than
cations, otherwise False
Internal function for checking electronegativity criterion.
This implementation is fast as it ‘short-circuits’ as soon as it finds an invalid combination. However it may be that in some cases redundant comparisons are made. Performance is very close between this method and eneg_states_test_alternate.
A ‘threshold’ option is added so that this constraint may be relaxed somewhat.
Args:#Returns:#
- ox_states (list): oxidation states corresponding to species
in compound
- enegs (list): Electronegativities corresponding to species in
compound
- threshold (Option(float)): a tolerance for the allowed deviation from
the Pauling criterion
- boolTrue if anions are more electronegative than
cations, otherwise False
Function to take a composition of Elements and return a list of values between 0 and 1 that describes the composition, useful for machine learning.
The list is of length 103 as there are 103 elements considered in total in SMACT.
e.g. Li2O –> [0, 0, 2/3, 0, 0, 0, 0, 1/3, 0 ….]
Inspired by the representation used by Legrain et al. DOI: 10.1021/acs.chemmater.7b00789
Args:#Returns:#composition (list): Element objects in composition OR symbols of elements in composition stoichs (list): Corresponding stoichiometries in the composition
- norm (list): List of floats representing the composition that sum
to one
(i.e. positive ions should be of lower electronegativity).
Returns:#oxidation_states (list): oxidation states of elements in the compound electronegativities (list): the corresponding Pauling electronegativities
of the elements in the compound
symbols (list) : chemical symbols of each site threshold (float): a tolerance for the allowed deviation from
the Pauling criterion
- repeat_anionsboolean, allow an anion to repeat in different
oxidation states in the same compound
repeat_cations : as above, but for cations
- bool:
True if anions are more electronegative than cations, otherwise False
Check if a combination of ions makes chemical sense, (i.e. positive ions should be of lower Pauling electronegativity). This function should give the same results as pauling_test but is not optimised for speed.
Args:#Returns:#ox (list): oxidation states of the compound paul (list): the corresponding Pauling electronegativities
of the elements in the compound
symbols (list) : chemical symbols of each site. threshold (float): a tolerance for the allowed deviation from
the Pauling criterion
- repeat_anionsboolean, allow an anion to repeat in different
oxidation states in the same compound.
repeat_cations : as above, but for cations.
- (bool):
True if anions are more electronegative than cations, otherwise False
Function that applies the charge neutrality and electronegativity tests in one go for simple application in external scripts that wish to apply the general ‘smact test’.
Args:#Warning
For backwards compatibility in SMACT >=2.7, expllicitly set oxidation_states_set to ‘smact14’ if you wish to use the 2014 SMACT default oxidation states. In SMACT 3.0, the smact_filter function will be set to use a new default oxidation states set.
Returns:#els (tuple/list): A list of smact.Element objects. threshold (int): Threshold for stoichiometry limit, default = 8. stoichs (list[int]): A selection of valid stoichiometric ratios for each site. species_unique (bool): Whether or not to consider elements in different oxidation states as unique in the results. oxidation_states_set (string): A string to choose which set of oxidation states should be chosen. Options are ‘smact14’, ‘icsd16’,”icsd24”, ‘pymatgen_sp’ and ‘wiki’ for the 2014 SMACT default, 2016 ICSD, 2024 ICSD, pymatgen structure predictor and Wikipedia (https://en.wikipedia.org/wiki/Template:List_of_oxidation_states_of_the_elements) oxidation states respectively. A filepath to an oxidation states text file can also be supplied as well.
allowed_comps (list): Allowed compositions for that chemical system in the form [(elements), (oxidation states), (ratios)] if species_unique=True and tuple=False or in the form [(elements), (ratios)] if species_unique=False and tuple=False.
>>> from smact.screening import smact_filter >>> from smact import Element >>> els = (Element("Cs"), Element("Pb"), Element("I")) >>> comps = smact_filter(els, threshold=5) >>> for comp in comps: >>> print(comp) [('Cs', 'Pb', 'I'), (1, -4, -1), (5, 1, 1)] [('Cs', 'Pb', 'I'), (1, 2, -1), (1, 1, 3)] [('Cs', 'Pb', 'I'), (1, 2, -1), (1, 2, 5)] [('Cs', 'Pb', 'I'), (1, 2, -1), (2, 1, 4)] [('Cs', 'Pb', 'I'), (1, 2, -1), (3, 1, 5)] [('Cs', 'Pb', 'I'), (1, 4, -1), (1, 1, 5)]
>>> from smact.screening import smact_filter >>> from smact import Element >>> comps = smact_filter(els, stoichs=[[1], [1], [3]]) >>> for comp in comps: >>> print(comp) [('Cs', 'Pb', 'I'), (1, 2, -1), (1, 1, 3)]
Check if a composition is valid according to SMACT rules: 1) Passes charge neutrality. 2) Passes (optional) Pauling electronegativity test, or is considered an alloy or metal if so chosen.
This function short-circuits, returning True as soon as a valid combination is found.
composition (Composition or str) – Composition to check.
use_pauling_test (bool) – Whether to apply the Pauling EN test.
include_alloys (bool) – Consider pure metals valid automatically.
check_metallicity (bool) – If True, consider high metallicity valid.
metallicity_threshold (float) – Score threshold for metallicity validity.
oxidation_states_set (str) – Which set of oxidation states to use. If specified it overrides the making of the oxidation states set.
include_zero (bool) – Include oxidation state of zero in the filtered list. Default is False.
consensus (int) – Minimum number of occurrences in literature for an ion to be considered valid. Default is 3.
commonality (str) – Excludes species below a certain proportion of appearances in literature with respect to the total number of reports of a given element (after the consensus threshold has been applied). “low” includes all species, “medium” excludes rare species below 10% occurrence, and “high” excludes non-majority species below 50% occurrence. “main” selects the species with the highest occurrence for a given element. Users may also specify their own threshold (float or int). Default is “medium”.
True if the composition is valid, False otherwise.
bool
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4