ham_nq#

torchspin.ham_nq(sys, nSpins=None, dtype=torch.complex128, device='cpu')[source]#

Nuclear quadrupole Hamiltonian (MHz).

Parameters:
  • sys (SpinSystem) – Spin system. Quadrupole tensors are in sys.Q (MHz) and frames in sys.QFrame. If sys.Q is None, returns zero matrix.

  • nSpins (list[int] | None) – 1-based indices of nuclear spins to include. Defaults to all.

  • dtype (dtype) – Output dtype. Default torch.complex128.

  • device (str) – PyTorch device string.

Returns:

torch.Tensor – Nuclear quadrupole Hamiltonian (MHz), shape (nStates, nStates).

Return type:

Tensor