radtools.SpinHamiltonian.get_atom#

method

SpinHamiltonian.get_atom(name, index=None, return_all=False)#

Return atom object of the crystal.

Parameters:
namestr

Name of the atom. In general not unique. If name contains "__", then it is split into name and index.

indexint, optional

Index of the atom.

return_allbool, default False

Whether to return the list of non-unique matches or raise an ValueError.

Returns:
atomAtom or list

If only one atom is found, then Atom object is returned. If several atoms are found and return_all is True, then list of Atom objects is returned.

Raises:
ValueError

If no match is found or the match is not unique and return_all is False.

Notes

index in combination with name is supposed to be a unique value, however it uniqueness is not strictly checked, pay attention in custom cases.