nucspinadd#

torchspin.nucspinadd(sys, nuc, A=None, Q=None, AFrame=None, QFrame=None, gnscale=1.0)[source]#

Return a new SpinSystem with one nucleus appended.

Port of EasySpin’s nucspinadd: every field of sys is carried over and the per-nucleus fields get one more entry. If either the existing or the new hyperfine (quadrupole) tensor is a full 3x3 matrix, both are written as full matrices in the molecular frame, as EasySpin does. Unlike EasySpin, systems with several electron spins are accepted (a 3-element A is used for every electron).

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

  • nuc (str) – Isotope string, e.g. '1H' or '14N'.

  • A (array_like or None) – Hyperfine coupling (MHz): a scalar (isotropic), [Aperp, Apar], [Ax, Ay, Az] (used for all electrons), (3*nElectrons,) principal values per electron, or a full (3, 3*nElectrons) matrix. None → zero. A tensor that requires grad stays on the graph.

  • Q (array_like or None) – Nuclear quadrupole coupling (MHz): e2qQ/h, [e2qQ/h, eta], principal values [Qx, Qy, Qz] or a full 3x3 matrix. Only for I ≥ 1.

  • AFrame (array_like or None) – Euler angles for A-tensor frame. Shape (3,) or (3*nElectrons,).

  • QFrame (array_like or None) – Euler angles for Q-tensor frame. Shape (3,).

  • gnscale (float) – Nuclear g-factor scale factor (dimensionless). Default 1.0.

Returns:

SpinSystem – New spin system with the nucleus appended.

Return type:

SpinSystem

Examples

>>> sys = SpinSystem(S=0.5, Nucs=['14N'], A=[20.0, 20.0, 95.0])
>>> sys2 = nucspinadd(sys, '1H', A=[5.0, 5.0, 10.0])
>>> sys2.Nucs
['14N', '1H']