radtools.SpinHamiltonian.add_atom#

method

SpinHamiltonian.add_atom(new_atom: Atom | str = None, relative=True, **kwargs)#

Add atom to the crystal.

If name and index of the new_atom are the same as of some atom of the crystal, then new_atom is not added.

If index of new_atom is not defined, it is set.

Parameters:
new_atomsAtom or str, optional

New atom. All kwargs are ignored if new_atom is not None and of type Atom. If str, then pair name : new_atom is added to kwargs.

relativebool, default True

Whether new_atom position is in relative coordinates.

**kwargs

Keyword arguments for Atom initialization.

Raises:
TypeError

If new_atom is not an Atom.

ValueError

If the atom is already present in the crystal.