nucspinrmv#

torchspin.nucspinrmv(sys, idx)[source]#

Return a new SpinSystem with the specified nuclei removed.

Port of EasySpin’s nucspinrmv (NewSys = Sys, then the per-nucleus fields are filtered): every field of sys (electron interactions such as ee, ee2, Ham, L/soc/CF*, linewidths, strains, dynamics, …) is carried over unchanged, tensors without copying, so the result stays on the autograd graph of sys. The per-nucleus fields Nucs, n, A/A_, AFrame, gnscale, sigma, sigmaFrame, Q, QFrame and Abund are reduced to the remaining nuclei (full 3x3 tensor forms included).

Raises ValueError if nonzero nucleus-nucleus couplings nn would remain (as EasySpin), or if initState is given in the full spin space and the nuclear dimension changes. AStrain belongs to the first nucleus: it is dropped, with a UserWarning, when that nucleus is removed.

Parameters:
  • sys (SpinSystem) – Input spin system.

  • idx (int or sequence of int) – 0-based nucleus index/indices to remove.

Returns:

SpinSystem – New spin system without the specified nuclei.

Return type:

SpinSystem

Examples

>>> sys = SpinSystem(S=0.5, Nucs=['14N', '1H'], A=[40.0, 10.0])
>>> sys2 = nucspinrmv(sys, 1)   # remove nucleus 1
>>> sys2.Nucs
['14N']