Source code for edlgt.models.XYZ_model

"""XYZ spin model built on top of :class:`edlgt.models.quantum_model.QuantumModel`."""

import logging

from edlgt.modeling import TwoBodyTerm
from edlgt.operators import get_Pauli_operators

from .quantum_model import QuantumModel

logger = logging.getLogger(__name__)
__all__ = ["XYZModel"]


[docs] class XYZModel(QuantumModel): """Anisotropic XYZ nearest-neighbor spin model.""" def __init__(self, **kwargs): """Initialize the XYZ model and site-local Pauli operators. Parameters ---------- **kwargs Arguments forwarded to :class:`~edlgt.models.quantum_model.QuantumModel`. """ # Initialize base class with the common parameters super().__init__(**kwargs) # ------------------------------------------------------------------------------- # Acquire operators and project onto the local Hilbert space ops = get_Pauli_operators() self.project_operators(ops) # DEFAULT PARAMS self.default_params()
[docs] def build_Hamiltonian(self, coeffs): """Assemble the XYZ Hamiltonian. Parameters ---------- coeffs : dict Coupling dictionary with key ``"Delta"`` (ZZ anisotropy). The XX and YY couplings are fixed to 1. """ logger.info("BUILDING HAMILTONIAN") # Hamiltonian Coefficients self.coeffs = coeffs h_terms = {} # ------------------------------------------------------------------------------- # NEAREST NEIGHBOR INTERACTION twobody_terms = [["Sx", "Sx"], ["Sy", "Sy"], ["Sz", "Sz"]] twobody_strengths = [1, 1, self.coeffs["Delta"]] for strength, op_names_list in zip(twobody_strengths, twobody_terms): for d in self.directions: op_list = [self.ops[op] for op in op_names_list] h_term_name = f"{d}_" + "_".join(op_names_list) h_terms[h_term_name] = TwoBodyTerm( axis=d, op_list=op_list, op_names_list=op_names_list, **self.def_params, ) self.H.add_term(h_terms[h_term_name].get_Hamiltonian(strength=strength)) # ------------------------------------------------------------------------------- self.H.build(self.ham_format)