Building lists#
Often when using smact the aim will be to search over combinations of a set of elements. This
is most efficiently achieved by setting up a dictionary of the elements that you want to search
over. The easiest way to achieve this in smact is to first create a list of the symbols of the elements
that you want to include, then to build a dictionary of the corresponding element objects.
The list can be built by hand, or if you want to cover a given range there is a helper function.
import smact
elements = smact.ordered_elements(13, 27)
print(elements)
['Al', 'Si', 'P', 'S', 'Cl', 'Ar', 'K', 'Ca', 'Sc', 'Ti', 'V', 'Cr', 'Mn', 'Fe', 'Co']
For doing searches across combinations of elements it is then quickest to load the element objects into a dictionary and search by key. This avoids having to repopulate the element class at each iteration of the search.
element_list = smact.element_dictionary(elements)
print(element_list)
{'Al': <smact.Element object at 0x7f3bace21d90>, 'Si': <smact.Element object at 0x7f3b4e56bd70>, 'P': <smact.Element object at 0x7f3b4e56ac90>, 'S': <smact.Element object at 0x7f3b4e56bce0>, 'Cl': <smact.Element object at 0x7f3b4e56bd10>, 'Ar': <smact.Element object at 0x7f3b4e56be90>, 'K': <smact.Element object at 0x7f3b4e56be00>, 'Ca': <smact.Element object at 0x7f3b4e56bec0>, 'Sc': <smact.Element object at 0x7f3b4e56bda0>, 'Ti': <smact.Element object at 0x7f3b4e56be30>, 'V': <smact.Element object at 0x7f3b4e56bef0>, 'Cr': <smact.Element object at 0x7f3b4e56bf50>, 'Mn': <smact.Element object at 0x7f3b4e5880b0>, 'Fe': <smact.Element object at 0x7f3b4e5881d0>, 'Co': <smact.Element object at 0x7f3b4e588170>}