wulfric.crystal.populate_atom_species#
- wulfric.crystal.populate_atom_species(atoms, raise_on_fail=False) None[source]#
Populate atom species, based on their names. If atom species are already present in the
atoms, then they will be overwritten.- Parameters:
- atomsdict
Dictionary with atoms. Must have a
nameswith the value oflistof Nstr.- raise_on_failbool, default False
Whether to raise an error if the atom type can not be deduced based on its name.
- Raises:
- FailedToDeduceAtomSpecies
If
raise_on_fail = Trueand automatic species deduction fails.
Warning
If
raise_on_fail = Trueand automatic species deduction fails, thenRuntimeWarningis issued, and atom species is set to "X".Examples
>>> import wulfric as wulf >>> atoms = {"names" : ["Cr1", "cr2", "Br3", "S4", "fe5", "Fe6"]} >>> atoms {'names': ['Cr1', 'cr2', 'Br3', 'S4', 'fe5', 'Fe6']} >>> wulf.crystal.populate_atom_species(atoms) >>> atoms {'names': ['Cr1', 'cr2', 'Br3', 'S4', 'fe5', 'Fe6'], 'species': ['Cr', 'Cr', 'Br', 'S', 'Fe', 'Fe']}