cgmatrix#

torchspin.cgmatrix(S1, S2, Stot=None)[source]#

Transformation matrix between uncoupled and coupled spin representations.

Parameters:
  • S1 (float) – Spin quantum numbers (1/2, 1, 3/2, 2, …).

  • S2 (float) – Spin quantum numbers (1/2, 1, 3/2, 2, …).

  • Stot (float or None, optional) – If given, return only coupled states with total spin Stot.

Returns:

  • U2C (ndarray, shape (n, n)) – Transformation matrix with elements <Stot,mStot|mS1,mS2>. Apply as: psi_c = U2C @ psi_u (uncoupled→coupled).

  • Smtot (ndarray, shape (n, 2)) – [Stot, mStot] for each coupled basis state.

  • m12 (ndarray, shape (n, 2)) – [mS1, mS2] for each uncoupled basis state.

Return type:

tuple

Notes

Basis ordering matches EasySpin:

  • Uncoupled: descending mS1 (outer), descending mS2 (inner).

  • Coupled: descending Stot (outer), descending mStot (inner).

Uses clebschgordan() to compute each matrix element.