torchspin.lft.bridge#

Bridges from ligand-field models to torchspin spin systems.

dn2sys() turns d^n ligand-field parameters into a torchspin.SpinSystem with S = 1/2 and the full 3x3 molecular-frame g matrix of the ground Kramers doublet. The full matrix (not principal values plus gFrame) keeps the autograd graph intact, so ligand-field parameters -> g -> torchspin.pepper() (or pepper_autograd) is differentiable end to end without touching the spectrum code.

torchspin.lft.bridge.dn2sys(n, params, *, units='MHz', min_gap=None, **sys_kwargs)[source]#

Spin-1/2 SpinSystem of the ground Kramers doublet of a d^n ligand-field model.

Parameters:
  • n (int) – Number of d electrons (an odd n gives a Kramers doublet).

  • params (dict) – Keywords of torchspin.lft.ddn.g_tensor() (B, C, zeta, V, k, …), energies in units. They are passed as a dict because A is the Racah A there and the hyperfine tensor in SpinSystem. Tensors that require grad stay on the graph.

  • units (str, default 'MHz') – Energy unit of params and min_gap ('cm^-1', 'MHz', … of torchspin.lft.units).

  • min_gap (float, optional) – Raise if the doublet is closer than this (in units) to the next state, where an effective spin 1/2 is not a good description and gradients grow as 1/gap. None (default): no check.

  • **sys_kwargs – Passed to SpinSystem (Nucs, A, lw, HStrain, …) in torchspin’s units (MHz, mT). S and g are set here.

Returns:

  • sys (SpinSystem) – S = 1/2 with the full 3x3 molecular-frame g matrix (sys.g of shape (3, 3); not principal values plus gFrame, so the graph stays intact).

  • gt (torchspin.lft.ddn.GTensor) – The g tensor (g, ggT, principal ascending, gap in units).

Raises:
  • TypeError – If sys_kwargs contains S or g.

  • ValueError – If the gap is below min_gap, or the parameters are batched (more than one g tensor).

Return type:

tuple[SpinSystem, GTensor]

Examples

Tetragonally elongated Cu(II), d^9, parameters in cm^-1:

>>> from torchspin import lft
>>> V = lft.crystal_field(1200.0, 2000.0, 300.0)       # Dq, Ds, Dt
>>> sys, gt = lft.dn2sys(9, dict(V=V, zeta=830.0, k=(0.8, 0.8, 0.8)), units='cm^-1', lw=1.0)
>>> sys.g.shape, [round(v, 3) for v in gt.principal.tolist()]
(torch.Size([3, 3]), [2.063, 2.063, 2.423])