ElMD API
Class Reference
The sole class is ElMD.ElMD
class ElMD(formula="", metric="mod_petti")
Construct an ElMD object from a given formula string. Elements are parsed and stored in a fixed length vector according to the ordering by the given metric.
formula: str, default=""
The formula for the ElMD object should be initialized with a parseable chemical composition with balanced brackets and standard ascii characters. Unrecognized characters and elements will fail silently
metric: str, default="mod_petti"
The type of elemental indexing which should be used to construct an elemental vector. The available indices are:
"mod_petti"
: The modified Pettifor scale"petti"
: The pettifor number as first reported by D. Pettifor."mendeleev"
: The Mendeleev number for ordering the elements"atomic"
: The standard atomic number given for each element
Attributes
ElMD.vector_form : numpy.ndarray
Stores a vectorized representation of the formula with the given metric indexing the ratios of each element as a numpy array.
ElMD.pretty_formula
Returns a chemical composition string using normalized ratios of each element.
Methods
ElMD.elmd(self, comp2, comp1 = None)
Main method to calculate ElMD between two compositions. Has been overloaded to accept formula strings or other ElMD objects.
In this usage, all three examples are equivalent:
x = ElMD("NaCl")
x.elmd("LiCl")
y = ElMD("LiCl")
x.elmd(y)
f = ElMD.elmd
f("NaCl", "LiCl")
Returns a float to signify distance between two formula.