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 asee,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 fieldsNucs,n,A/A_,AFrame,gnscale,sigma,sigmaFrame,Q,QFrameandAbundare reduced to the remaining nuclei (full 3x3 tensor forms included).Raises
ValueErrorif nonzero nucleus-nucleus couplingsnnwould remain (as EasySpin), or ifinitStateis given in the full spin space and the nuclear dimension changes.AStrainbelongs to the first nucleus: it is dropped, with aUserWarning, 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:
Examples
>>> sys = SpinSystem(S=0.5, Nucs=['14N', '1H'], A=[40.0, 10.0]) >>> sys2 = nucspinrmv(sys, 1) # remove nucleus 1 >>> sys2.Nucs ['14N']