ham_nn#

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

Nuclear-nuclear coupling Hamiltonian (MHz).

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

  • nSpins (list[int] | None) – 1-based indices of nuclear spins to include: at least 2, each in 1..nNuclei, no duplicates; otherwise ValueError is raised (as in EasySpin). Ignored (zero matrix returned) when the system has fewer than 2 nuclei or nn is absent or all zero, as in EasySpin. Defaults to all nuclei.

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

  • device (str) – PyTorch device string.

Returns:

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

Return type:

Tensor