magnopy.SpinHamiltonian.atoms#

property

property SpinHamiltonian.atoms: dict#

Atoms of the crystal on which the Hamiltonian is build.

Returns:
atomsdict (with added sugar)

Dictionary with the atoms.

Notes

If is not recommended to change the atoms property after the creation of SpinHamiltonian. In fact an attempt to do so will raise an AttributeError:

>>> import numpy as np
>>> import magnopy
>>> convention = magnopy.Convention()
>>> spinham = magnopy.SpinHamiltonian(
...     cell=np.eye(3), atoms={}, convention=convention
... )
>>> spinham.atoms = {"names": ["Cr"]}
Traceback (most recent call last):
...
AttributeError: Change of the atoms dictionary is not supported after the creation of SpinHamiltonian instance. If you need to modify atoms, then use pre-defined methods of SpinHamiltonian or create a new one.

Use pre-defined methods of the SpinHamiltonian class to safely modify atoms.

If you need to change the whole dictionary at once, then use

>>> import numpy as np
>>> import magnopy
>>> convention = magnopy.Convention()
>>> spinham = magnopy.SpinHamiltonian(
...     cell=np.eye(3), atoms={}, convention=convention
... )
>>> spinham.atoms
{}
>>> spinham._atoms = {"names": ["Cr"]}
>>> spinham.atoms
{'names': ['Cr']}

In the latter case correct behavior of magnopy is not guaranteed. Use only if you have a deep understanding of the magnopy source code.