torchspin.lft.ddn#

DDN: differentiable d^n ligand-field Hamiltonian, levels, and doublet g tensor.

H = A M_A + B M_B + C M_C + alpha L^2 + sum_ab V[a, b] E_real[a, b] + zeta sum_i l_i.s_i
  • mu_B sum_i B_i (k_i L_i + g_e S_i)

in the full basis of C(10, n) Slater determinants (Telser’s DDN, via telser-tools). Every parameter may be a tensor carrying gradients, with leading batch dimensions.

Units#

Energy-valued inputs (B, C, A, zeta, alpha, slater, the ligand field V) and energy-valued outputs are in units (default 'MHz', torchspin’s unit; use units='cm^-1' to work in wavenumbers, or 'GHz', 'K', 'eV'). The magnetic field is in mT. The orbital reduction k is dimensionless. Internally everything is cm^-1.

>>> from torchspin import lft
>>> V = lft.crystal_field(Dq=1200.0)                       # cm^-1
>>> E = lft.ddn.levels(3, B=800.0, C=3200.0, V=V, zeta=200.0, units='cm^-1')
>>> g = lft.ddn.g_tensor(9, zeta=830.0, V=lft.aom(lft.octahedron(6000.0, 1000.0)),
...                      k=(0.8, 0.8, 0.8), units='cm^-1')

Degenerate levels are handled by torchspin.lft._linalg: the gradient of a degenerate eigenvalue is that of its level’s mean, and the doublet g is differentiated through the projector onto the doublet, which is exact at the Kramers degeneracy.

class torchspin.lft.ddn.Constants(mu_b, g_e, k_b)[source]#

Physical constants used by the d^n Hamiltonian.

Variables:
  • mu_b (float) – Bohr magneton over h c, in cm^-1 per mT.

  • g_e (float) – Free-electron g value (dimensionless).

  • k_b (float) – Boltzmann constant over h c, in cm^-1 per K.

mu_b: float#

Alias for field number 0

g_e: float#

Alias for field number 1

k_b: float#

Alias for field number 2

torchspin.lft.ddn.TORCHSPIN_CONSTANTS = (0.00046686447719298217, 2.00231930436092, 0.6950348004861274)#

Derived from torchspin.constants.

class torchspin.lft.ddn.DnSystem(n, *, units='MHz', constants=TORCHSPIN_CONSTANTS, device='cpu')[source]#

A d^n ion with cached operators.

DnSystem(n).levels(...), .g_tensor(...), .hamiltonian(...) and .zeeman_operators(k) call the module functions with the cached operators; units and constants set here are the defaults of every call (override per call).

Parameters:
  • n (int) – Number of d electrons, 0 to 10.

  • units (str, default 'MHz') – Default energy unit.

  • constants (Constants, default TORCHSPIN_CONSTANTS) – Default constants.

  • device (str or device, default 'cpu') – Device of the operators.

Variables:

size (int) – Basis size C(10, n).

Examples

>>> from torchspin import lft
>>> ion = lft.ddn.DnSystem(8, units='cm^-1')
>>> ion.size, ion.levels(B=900.0, C=3600.0).shape
(45, torch.Size([45]))
class torchspin.lft.ddn.GTensor(ggT, principal, g, gap)[source]#

Effective spin-1/2 g tensor of the lowest doublet (returned by g_tensor()).

Variables:
  • ggT (Tensor, shape (..., 3, 3)) – g g^T in the molecular frame.

  • principal (Tensor, shape (..., 3)) – Principal g values (square roots of the eigenvalues of ggT), ascending.

  • g (Tensor, shape (..., 3, 3)) – (g g^T)^(1/2), the symmetric molecular-frame g (exact gradients at axial g).

  • gap (Tensor, shape (...)) – Energy from the doublet to the next state, in the units of the call. Gradients of g scale as 1/gap: check that it is large.

ggT: Tensor#

Alias for field number 0

principal: Tensor#

Alias for field number 1

g: Tensor#

Alias for field number 2

gap: Tensor#

Alias for field number 3

torchspin.lft.ddn.g_tensor(n, *, k=(1.0, 1.0, 1.0), units='MHz', constants=TORCHSPIN_CONSTANTS, device='cpu', **kw)[source]#

Zero-field g tensor of the lowest doublet of d^n.

Computes (g g^T)_ij = 2 tr(P mu_i P mu_j) with P the projector onto the two lowest states and mu = k L + g_e S.

Parameters:
  • n (int or DnOperators) – Number of d electrons (0 to 10) or a cached operator set.

  • k (array_like or Tensor, shape (..., 3), default (1.0, 1.0, 1.0)) – Orbital reduction factors.

  • units (str, default 'MHz') – Energy unit of the Hamiltonian keywords and of gap.

  • constants (Constants, default TORCHSPIN_CONSTANTS) – g_e of the moment operator.

  • device (str or device, default 'cpu') – Device of the operators.

  • **kw – Hamiltonian keywords of hamiltonian() except field (B, C, A, zeta, V, alpha, slater).

Returns:

GTensor – ggT, principal, g (dimensionless) and gap (units).

Raises:
  • ValueError – If field is given (this is the zero-field g).

  • TypeError – For an unknown keyword.

Return type:

GTensor

Notes

Meaningful for odd n (Kramers doublets) or any isolated ground doublet.

Examples

d^9 (Cu(II)) in an elongated octahedron, energies in cm^-1:

>>> import torch
>>> from torchspin import lft
>>> V = torch.diag(torch.tensor([9900., -2100., -5100., -5100., 2400.], dtype=torch.float64))
>>> res = lft.ddn.g_tensor(9, zeta=830.0, V=V, k=(0.8, 0.8, 0.8), units='cm^-1')
>>> [round(float(x), 3) for x in res.principal]
[2.071, 2.071, 2.42]
torchspin.lft.ddn.hamiltonian(n, *, B=0.0, C=0.0, A=0.0, zeta=0.0, V=None, k=(1.0, 1.0, 1.0), alpha=0.0, slater=None, field=None, units='MHz', constants=TORCHSPIN_CONSTANTS, device='cpu')[source]#

Complex Hermitian d^n Hamiltonian in the full determinant basis.

Builds A M_A + B M_B + C M_C + alpha L^2 + sum_ab V[a, b] E_real[a, b] + zeta sum_i l_i.s_i + mu_B field . (k L + g_e S) (module docstring). Every parameter may be a tensor with leading batch dimensions and gradients.

Parameters:
  • n (int or DnOperators) – Number of d electrons (0 to 10) or a cached operator set.

  • B (float or Tensor, default 0.0) – Racah parameters, in units. A only shifts all levels.

  • C (float or Tensor, default 0.0) – Racah parameters, in units. A only shifts all levels.

  • A (float or Tensor, default 0.0) – Racah parameters, in units. A only shifts all levels.

  • zeta (float or Tensor, default 0.0) – One-electron spin-orbit coupling constant, in units.

  • V (array_like or Tensor, shape (..., 5, 5), optional) – Real symmetric ligand-field matrix in the real-orbital basis (x2-y2, xy, xz, yz, z2), in units (see torchspin.lft.ligand_field). Default None: no ligand field.

  • k (array_like or Tensor, shape (..., 3), default (1.0, 1.0, 1.0)) – Orbital reduction factors (dimensionless); enter only the Zeeman term.

  • alpha (float or Tensor, default 0.0) – Trees correction (coefficient of L^2), in units.

  • slater (tuple of 3, optional) – (F0, F2, F4) Slater integrals in units; replaces A, B, C when given.

  • field (array_like or Tensor, shape (..., 3), optional) – Magnetic field vector in mT. Default None: zero field.

  • units (str, default 'MHz') – Energy unit of the inputs and of the result: 'MHz', 'GHz', 'Hz', 'cm^-1', 'K', 'eV', 'meV' or 'J'.

  • constants (Constants, default TORCHSPIN_CONSTANTS) – mu_B and g_e of the Zeeman term.

  • device (str or device, default 'cpu') – Device of the operators.

Returns:

torch.Tensor, shape (…, nd, nd), complex128 – Hamiltonian in units, nd = C(10, n).

Raises:

ValueError – If n is not an integer from 0 to 10 or units is unknown.

Return type:

Tensor

Examples

>>> from torchspin import lft
>>> H = lft.ddn.hamiltonian(2, B=800.0, C=3200.0, units='cm^-1')
>>> H.shape, H.dtype
(torch.Size([45, 45]), torch.complex128)
torchspin.lft.ddn.levels(n, *, relative=False, units='MHz', **kw)[source]#

Ascending energy levels of d^n.

Parameters:
  • n (int or DnOperators) – Number of d electrons (0 to 10) or a cached operator set.

  • relative (bool, default False) – If True, subtract the lowest level (ground state at 0).

  • units (str, default 'MHz') – Energy unit of the inputs and the result (as hamiltonian()).

  • **kw – Hamiltonian keywords of hamiltonian() (B, C, A, zeta, V, k, alpha, slater, field, constants, device).

Returns:

torch.Tensor, shape (…, nd), float64 – Eigenvalues in units, ascending, nd = C(10, n).

Return type:

Tensor

Notes

The gradient of a degenerate eigenvalue is that of its level’s mean (exact for symmetry-protected degeneracies, a symmetric subgradient at an accidental crossing).

Examples

d^3 in an octahedral field (cm^-1); the ground 4A2 level is fourfold:

>>> from torchspin import lft
>>> E = lft.ddn.levels(3, B=800.0, C=3200.0, V=lft.crystal_field(Dq=1500.0),
...                    units='cm^-1', relative=True)
>>> E.shape, [round(float(x), 6) for x in E[:4]]
(torch.Size([120]), [0.0, 0.0, 0.0, 0.0])
torchspin.lft.ddn.zeeman_operators(n, k=(1.0, 1.0, 1.0), constants=TORCHSPIN_CONSTANTS, device='cpu')[source]#

Magnetic moment operators in Bohr magnetons, k_i L_i + g_e S_i.

Parameters:
  • n (int or DnOperators) – Number of d electrons (0 to 10) or a cached operator set.

  • k (array_like or Tensor, shape (..., 3), default (1.0, 1.0, 1.0)) – Orbital reduction factors along x, y, z (dimensionless).

  • constants (Constants, default TORCHSPIN_CONSTANTS) – Supplies g_e.

  • device (str or device, default 'cpu') – Device of the operators (ignored when n is a DnOperators).

Returns:

torch.Tensor, shape (…, 3, nd, nd), complex128 – mu_x, mu_y, mu_z over mu_B in the Slater-determinant basis, nd = C(10, n).

Raises:

ValueError – If n is not an integer from 0 to 10.

Return type:

Tensor

Examples

>>> from torchspin import lft
>>> lft.ddn.zeeman_operators(1).shape
torch.Size([3, 10, 10])