Constructs spin Hamiltonian matrix
[H0,mux,muy,muz] = ham(Sys) [H0,mux,muy,muz] = ham(Sys,'sparse') H = ham(Sys,B) H = ham(Sys,B,'sparse')
This function returns the matrix representation of the spin Hamiltonian or its components. Sys
is the structure defining the spin system. The optional B
is the 3-element external magnetic field vector (in mT) defined in the molecular frame of the spin system.
If no magnetic field is given, ham
returns the four Hamiltonian components H0
, mux
, muy
and muz
. H0
is the Hamiltonian containing all field-independent interactions, and the other three matrices are the components of the magnetic dipole moment operator along the three principal directions of the molecular frame of the spin system (see ham_ez, ham_nz and ham_oz).
If a magnetic field B
is given, ham
returns the overall Hamiltonian H
.
To construct H
from H0
, mux
, muy
, muz
and B
, use H = H0 - B(1)*mux - B(2)*muy - B(3)*muz
.
H
and H0
are in units of MHz, and mux
, muy
and muz
are in units of MHz/mT (= GHz/T).
The general form of the spin Hamiltonian and the terms contained in it are explained in the section about the spin system structure.
If 'sparse'
is given as last input argument, the Hamiltonian matrix is returned in sparse format instead of full format.
The Hamiltonian of a simple S=I=1/2 system is
Sys.g = 2; Sys.A = [1 1 2]*180; Sys.Nucs = '1H'; B = [0 0 340]; H = ham(Sys,B)
H = 1.0e+03 * 4.8015 0 0 0 0 4.7160 0.0500 0 0 0.0500 -4.8160 0 0 0 0 -4.7015
To get its eigenvalues in GHz and their associated eigenvectors, use
[V,E] = eig(H); E = diag(E).'/1e3; E, V
E = -4.8162 -4.7015 4.7162 4.8015 V = 0 0 0 1.0000 -0.0052 0 -1.0000 0 1.0000 0 -0.0052 0 0 1.0000 0 0
ham_cf, ham_ee, ham_ez, ham_ezho, ham_hf, ham_nn, ham_nq, ham_nz, ham_oz, ham_so, ham_zf