Note
Go to the end to download the full example code.
Convention of spin Hamiltonian¶
Exercises
Create an instance of
magnopy.Conventionfor the following Hamiltonians\[\begin{split}\mathcal{H}_1 = - \sum_{i \neq j} J_{ij} \mathbf{S}_i \cdot \mathbf{S}_j \\ \mathcal{H}_2 = - \sum_{i, j} J_{ij} \mathbf{S}_i \cdot \mathbf{S}_j \\ \mathcal{H}_3 = 0.5 \sum_{i, j} J_{ij} \mathbf{S}_i \cdot \mathbf{S}_j \\ \mathcal{H}_4 = - \sum_{i < j} J_{ij} \mathbf{e}_i \cdot \mathbf{e}_j\end{split}\]
Before we move on to the Hamiltonian itself it is very important to understand that there is a dozen of different conventions of essentially the same type of Hamiltonian present in the literature. Here are a few examples of different conventions for the isotropic exchange term
Please read Convention problem for the illustration of the challenges that this problem introduces.
In magnopy we did not want to introduce a new one or to use one convention in particular. As a solution we decided to support any convention that the user wants to use. Naturally, that implied a responsibility on the user: to provide one! When spin Hamiltonian is read from the knows source (i. e. TB2J or GROGU), magnopy knows the convention and user can just read the Hamiltonian from the file like so
# Reading from TB2J
spinham = magnopy.io.load_tb2j("exchange.out")
# Reading from GROGU
spinham = magnopy.io.load_grogu("spinham-from-GROGU.txt")
However, magnopy.Convention object has to be created and supplied when the
spin Hamiltonian is created by user. For example, to introduce the convention for the
Hamiltonian that is written as
one shall create the convention object as
import magnopy
convention = magnopy.Convention(
c21=1, c22=0.5, multiple_counting=False, spin_normalized=False
)
To consult the convention properties you can display either individual properties
print(convention.c21)
print(convention.multiple_counting)
1.0
False
or the whole convention
print(convention)
"custom" convention where
* Bonds are counted once in the sum;
* Spin vectors are not normalized;
* Undefined c1 factor;
* c21 = 1.0;
* c22 = 0.5;
* Undefined c31 factor;
* Undefined c32 factor;
* Undefined c33 factor;
* Undefined c41 factor;
* Undefined c421 factor;
* Undefined c422 factor;
* Undefined c43 factor;
* Undefined c44 factor.
Pre-defined conventions¶
Magnopy has some pre-defined named conventions. To get one use
convention = magnopy.Convention.get_predefined("GROGU")
print(convention)
convention = magnopy.Convention.get_predefined("Vampire")
print(convention)
convention = magnopy.Convention.get_predefined("TB2J")
print(convention)
"grogu" convention where
* Bonds are counted multiple times in the sum;
* Spin vectors are normalized to 1;
* Undefined c1 factor;
* c21 = 1.0;
* c22 = 0.5;
* Undefined c31 factor;
* Undefined c32 factor;
* Undefined c33 factor;
* Undefined c41 factor;
* Undefined c421 factor;
* Undefined c422 factor;
* Undefined c43 factor;
* Undefined c44 factor.
"vampire" convention where
* Bonds are counted multiple times in the sum;
* Spin vectors are normalized to 1;
* Undefined c1 factor;
* c21 = -1.0;
* c22 = -0.5;
* Undefined c31 factor;
* Undefined c32 factor;
* Undefined c33 factor;
* Undefined c41 factor;
* Undefined c421 factor;
* Undefined c422 factor;
* Undefined c43 factor;
* Undefined c44 factor.
"tb2j" convention where
* Bonds are counted multiple times in the sum;
* Spin vectors are normalized to 1;
* Undefined c1 factor;
* c21 = -1.0;
* c22 = -1.0;
* Undefined c31 factor;
* Undefined c32 factor;
* Undefined c33 factor;
* Undefined c41 factor;
* Undefined c421 factor;
* Undefined c422 factor;
* Undefined c43 factor;
* Undefined c44 factor.
Modifying convention¶
To get the convention where just a few of the properties are changed one can create a new convention and populate all of its properties again. Or use a shortcut
convention = magnopy.Convention.get_predefined("TB2J")
modified = convention.get_modified(c31=1, name="modified")
print(convention)
print(modified)
"tb2j" convention where
* Bonds are counted multiple times in the sum;
* Spin vectors are normalized to 1;
* Undefined c1 factor;
* c21 = -1.0;
* c22 = -1.0;
* Undefined c31 factor;
* Undefined c32 factor;
* Undefined c33 factor;
* Undefined c41 factor;
* Undefined c421 factor;
* Undefined c422 factor;
* Undefined c43 factor;
* Undefined c44 factor.
"modified" convention where
* Bonds are counted multiple times in the sum;
* Spin vectors are normalized to 1;
* Undefined c1 factor;
* c21 = -1.0;
* c22 = -1.0;
* c31 = 1.0;
* Undefined c32 factor;
* Undefined c33 factor;
* Undefined c41 factor;
* Undefined c421 factor;
* Undefined c422 factor;
* Undefined c43 factor;
* Undefined c44 factor.
Total running time of the script: (0 minutes 0.002 seconds)