nucspinkeep#
- torchspin.nucspinkeep(sys, idx)[source]#
Return a new SpinSystem with only the specified nuclei kept.
Port of EasySpin’s
nucspinkeep: every field of sys is carried over, and the per-nucleus fields are reduced to the kept nuclei (seenucspinrmv()).- Parameters:
sys (SpinSystem) – Input spin system.
idx (int or sequence of int) – 0-based nucleus index/indices to keep.
- Returns:
SpinSystem – New spin system with only the specified nuclei.
- Return type:
Examples
>>> sys = SpinSystem(S=0.5, Nucs=['14N', '1H', '1H'], A=[40.0, 10.0, 5.0]) >>> sys2 = nucspinkeep(sys, [0, 2]) # keep nuclei 0 and 2 >>> sys2.Nucs ['14N', '1H']