magnopy.SpinHamiltonian.cell#
property
- property SpinHamiltonian.cell#
Cell of the crystal on which the Hamiltonian is build.
- Returns:
- cell(3, 3) numpy.ndarray
Matrix of the cell, rows are lattice vectors.
Notes
If is not recommended to change the
cellproperty after the creation ofSpinHamiltonian. In fact an attempt to do so will raise anAttributeError:>>> import numpy as np >>> import magnopy >>> convention = magnopy.Convention() >>> spinham = magnopy.SpinHamiltonian(cell = np.eye(3), atoms={}, convention=convention) >>> spinham.cell = 2 * np.eye(3) Traceback (most recent call last): ... AttributeError: Change of the cell attribute is not supported after the creation of SpinHamiltonian instance. If you need to modify cell, then use pre-defined methods of SpinHamiltonian or create a new one.
Use pre-defined methods of the
SpinHamiltonianclass to safely modify the cell.If you need to change the cell attribute, then use
>>> import numpy as np >>> import magnopy >>> convention = magnopy.Convention() >>> spinham = magnopy.SpinHamiltonian(cell = np.eye(3), atoms={}, convention=convention) >>> spinham.cell array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]) >>> spinham._cell = 2 * np.eye(3) >>> spinham.cell array([[2., 0., 0.], [0., 2., 0.], [0., 0., 2.]])
In the latter case correct behavior of magnopy is not guaranteed. Use only if you have a deep understanding of the magnopy source code.