torchspin.lft.dipole#

DIPOLE: dipolar couplings of a metal 3d Slater orbital to a nucleus or a second electron (Telser’s DIPOLE).

Ported from telser-tools (telser_tools_diff.dipole): the default (mode="corrected", exact 3d Slater-orbital tensor) path of telser_tools.dipole. Every continuous input may carry gradients (distance, Z*, direction, the d orbital itself, g, alpha1^2, g_N, the partner g), with leading batch dimensions.

Units and axes#

Couplings (hyperfine A, electron-electron D, point-dipole values) are energies and come back in units (default 'MHz'; 'cm^-1', 'GHz', 'K', 'eV' on request). The dipolar tensor tensor_cm3 is <(3 u u^T - u^2)/u^5> in cm^-3; the reduced tensors (sto_tensor(), sto_tensor_full()) are dimensionless (R^3 T). Distances are in Angstrom. g, alpha1^2 (metal-orbital population) and g_N are dimensionless. The per-axis outputs are on dipole.f’s axes, ordered (y, x, z) = Fortran (3, 2, 1), z along the metal-point vector; g is given in the same order. Physical constants are CGS-Gaussian (as dipole.f), derived from torchspin.constants (TORCHSPIN_CONSTANTS); pass constants= (any object with the fields of Constants, e.g. telser-tools’ CODATA2018) to override.

The tensor, for any point direction and any real d orbital#

The closed form R^3 T = P(A) exp(-4A/3) + Q(A) cancels its A^-4 … A^-1 poles at small A (telser-tools evaluates it in 60-digit Decimal arithmetic). This module uses the multipole expansion instead, which works for ANY point direction and ANY real d orbital Y(r) = r^T M r (M real symmetric, made traceless; d_xy is M = (e_x e_y^T + e_y e_x^T)/2):

rho = N^2 Y(r)^2 exp(-2 zeta r),     Y^2 = h4 + r^2 h2 + r^4 h0   (harmonic h_L of degree L)
V(P) = sum_L G_L(R) h_L(P),   T_ij(P) = d_i d_j V(P) + (4 pi/3) rho(P) delta_ij

(zeta = 1 units, R = zeta abs(P) = 2A/3, A = Z* R/(2 a0)). The radial functions are written through the lower incomplete gamma function, evaluated from its all-positive series below 2R = SERIES_SWITCH and from its complement above, so no step cancels. Agreement with the Decimal path from A = 1e-3 to 1e3: rel <= 3e-14 of max(abs(t)).

Contents#

Nuclear g values come from torchspin.nucgval() (nucleus='14N'); g_n= overrides it (and may carry gradients). telser-tools’ table (Weil & Bolton 2007) differs from torchspin’s for some metal nuclides; pass g_n= to use a specific value.

Not ported: mode="fortran" / model="fortran" (dipole.f’s polynomials, which are not the dipolar tensor of a 3d Slater orbital; they exist to reproduce the original), the alpha1^2 clamping of that mode, nucleus lookup by bare mass number (use the isotope name), the CLI and the report.

Examples

14N at 2.0 Angstrom from Cu(II) (d9) in the orbital plane, axial g, 75 % metal character (telser-tools’ DIPOLE quick start); couplings on the (y, x, z) axes in MHz:

>>> from torchspin.lft import dipole
>>> h = dipole.hyperfine(9, 29, "14N", 2.0, g=(2.05, 2.05, 2.25), alpha2=0.75)
>>> round(float(h.zstar), 4), round(float(h.A), 5)
(13.201, 24.94627)
>>> [round(x, 4) for x in h.a_alpha.tolist()]
[-0.581, -0.5508, 1.2422]
>>> [round(x, 4) for x in h.point_dipole.tolist()]
[-0.5486, -0.5486, 1.2041]

Electron-electron coupling of a Ni(II) d electron to a spin 3.5 Angstrom away, in cm^-1:

>>> e = dipole.electron_electron(8, 28, 3.5, g=(2.2, 2.2, 2.0), units="cm^-1")
>>> [round(x, 4) for x in e.ddip_edip.tolist()]      # (Ddip, Edip)
[-0.123, -0.0004]
torchspin.lft.dipole.TORCHSPIN_CONSTANTS = (2.00231930436092, 5.0507837393e-24, 9.2740100657e-21, 6.62607015e-27, 5.29177210544e-09, 3.3356409519815205e-05, 4.329705860805485e-25)#

From torchspin.constants (J/T -> erg/G is 1e3, J s -> erg s is 1e7, m -> cm is 1e2).

class torchspin.lft.dipole.Constants(g_e, beta_n, beta_e, h, a0_cm, mhz_to_cm, ee_point_cm)[source]#

CGS-Gaussian constants of dipole.f (field names as telser-tools’ dipole.constants.Constants).

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

  • beta_e (beta_n,) – Nuclear and Bohr magnetons in erg/G.

  • h (float) – Planck constant in erg s.

  • a0_cm (float) – Bohr radius in cm.

  • mhz_to_cm (float) – 1 MHz in cm^-1.

  • ee_point_cm (float) – beta_e^2 / (h c) in cm^-1 cm^3 (point-dipole electron-electron prefactor).

g_e: float#

Alias for field number 0

beta_n: float#

Alias for field number 1

beta_e: float#

Alias for field number 2

h: float#

Alias for field number 3

a0_cm: float#

Alias for field number 4

mhz_to_cm: float#

Alias for field number 5

ee_point_cm: float#

Alias for field number 6

class torchspin.lft.dipole.ElectronElectron(A, zstar, tensor_cm3, d, d_g, d_alpha, point_dipole)[source]#

Electron-electron dipolar coupling H = S1.D.S2 (electron_electron()) on the axes (y, x, z).

Energies in the units asked for. For two spins 1/2 combined to a triplet, the triplet zero-field splitting is half of these values.

Variables:
  • tensor_cm3 (A, zstar,) – As Hyperfine.

  • d (Tensor, shape (..., 3)) – Coupling without g correction.

  • d_g (Tensor, shape (..., 3)) – Times g_i g' / g_e^2.

  • d_alpha (Tensor, shape (..., 3)) – Also times alpha1^2.

  • point_dipole (Tensor, shape (..., 3)) – Point-dipole value with g (no alpha1^2, as dipole.f).

A: Tensor#

Alias for field number 0

zstar: Tensor#

Alias for field number 1

tensor_cm3: Tensor#

Alias for field number 2

d: Tensor#

Alias for field number 3

d_g: Tensor#

Alias for field number 4

d_alpha: Tensor#

Alias for field number 5

point_dipole: Tensor#

Alias for field number 6

property ddip_edip: Tensor[source]#

(Ddip, Edip) of the g-corrected tensor d_g.

property ddip_edip_point: Tensor[source]#

(Ddip, Edip) of the point-dipole tensor.

property ddip_edip_alpha: Tensor[source]#

(Ddip, Edip) of d_alpha.

class torchspin.lft.dipole.Hyperfine(A, zstar, tensor_cm3, a, a_g, a_alpha, point_dipole)[source]#

Electron-nuclear dipolar coupling (hyperfine()) on the axes (y, x, z).

Variables:
  • A (Tensor) – Slater parameter.

  • zstar (Tensor) – Effective nuclear charge Z*.

  • tensor_cm3 (Tensor, shape (..., 3)) – <(3 u u^T - u^2)/u^5> in cm^-3.

  • a (Tensor, shape (..., 3)) – Coupling without g correction, in units.

  • a_g (Tensor, shape (..., 3)) – Times g_i/g_e.

  • a_alpha (Tensor, shape (..., 3)) – Also times alpha1^2.

  • point_dipole (Tensor, shape (..., 3)) – Point-dipole value with g and alpha1^2.

A: Tensor#

Alias for field number 0

zstar: Tensor#

Alias for field number 1

tensor_cm3: Tensor#

Alias for field number 2

a: Tensor#

Alias for field number 3

a_g: Tensor#

Alias for field number 4

a_alpha: Tensor#

Alias for field number 5

point_dipole: Tensor#

Alias for field number 6

torchspin.lft.dipole.d_and_e(d_yxz)[source]#

Axial and rhombic dipolar parameters (Ddip, Edip) = (3/2 D_z, (D_x - D_y)/2).

d_yxz is a tensor (…, 3) ordered (D_y, D_x, D_z); returns (…, 2) in the same unit.

torchspin.lft.dipole.electron_electron(n_d, z, r_angstrom, g=(2.0023, 2.0023, 2.0023), alpha2=1.0, geometry='in_plane', *, partner_g=None, zstar=None, units='MHz', constants=TORCHSPIN_CONSTANTS)[source]#

Electron-electron dipolar coupling between the metal d electron and a point spin.

Parameters:
  • n_d (int) – As hyperfine() (r_angstrom is the distance to the point spin).

  • z (int) – As hyperfine() (r_angstrom is the distance to the point spin).

  • r_angstrom – As hyperfine() (r_angstrom is the distance to the point spin).

  • g – As hyperfine() (r_angstrom is the distance to the point spin).

  • alpha2 – As hyperfine() (r_angstrom is the distance to the point spin).

  • geometry (str) – As hyperfine() (r_angstrom is the distance to the point spin).

  • zstar – As hyperfine() (r_angstrom is the distance to the point spin).

  • constants (Constants) – As hyperfine() (r_angstrom is the distance to the point spin).

  • partner_g (float or Tensor, optional) – g of the second (point) spin; default g_e.

  • units (str, default 'MHz') – Energy unit of the couplings (dipole.f printed MHz and cm^-1: use units='cm^-1').

Returns:

ElectronElectron

Raises:

ValueError – For a distance <= 0, alpha2 outside [0, 1], or an unknown geometry or energy unit.

Return type:

ElectronElectron

torchspin.lft.dipole.hyperfine(n_d, z, nucleus, r_angstrom, g=(2.0023, 2.0023, 2.0023), alpha2=1.0, geometry='in_plane', *, zstar=None, g_n=None, units='MHz', constants=TORCHSPIN_CONSTANTS)[source]#

Electron-nuclear dipolar (hyperfine) coupling of a metal d electron to a ligand nucleus.

Parameters:
  • n_d (int) – Number of d electrons (for the Clementi-Raimondi Z*).

  • z (int) – Atomic number of the metal.

  • nucleus (str or None) – Isotope name for torchspin.nucgval() (e.g. '14N'); may be None when g_n is given.

  • r_angstrom (float or Tensor) – Metal-nucleus distance in Angstrom (> 0).

  • g (array_like or Tensor, shape (..., 3), default (2.0023, 2.0023, 2.0023)) – g values ordered (g_y, g_x, g_z).

  • alpha2 (float or Tensor, default 1.0) – alpha1^2, the metal-orbital population, in [0, 1].

  • geometry (str, default 'in_plane') – As sto_tensor().

  • zstar (float or Tensor, optional) – Overrides the tabulated Z* (so the orbital exponent may carry gradients).

  • g_n (float or Tensor, optional) – Overrides the nuclear g value.

  • units (str, default 'MHz') – Energy unit of the couplings.

  • constants (Constants, optional) – Default TORCHSPIN_CONSTANTS.

Returns:

Hyperfine

Raises:

ValueError – For a distance <= 0, alpha2 outside [0, 1], an unknown geometry or energy unit, or neither nucleus nor g_n.

Return type:

Hyperfine

torchspin.lft.dipole.orbital_matrix(name='xy')[source]#

Matrix M of a real d orbital Y(r) = r^T M r.

Parameters:

name ({'xy', 'xz', 'yz', 'x2-y2', 'z2'}, default 'xy') – The orbital.

Returns:

torch.Tensor, shape (3, 3), float64 – Symmetric; the overall scale is irrelevant.

Raises:

KeyError – For an unknown name.

Return type:

Tensor

torchspin.lft.dipole.point_dipole_full(direction)[source]#

Point-dipole tensor 3 n n^T - 1, shape (…, 3, 3), for the metal -> point direction (normalized here).

torchspin.lft.dipole.slater_A(zstar, r_angstrom, bohr_cm=TORCHSPIN_CONSTANTS.a0_cm)[source]#

Slater parameter A = Z* R/(2 a0).

zstar is the effective nuclear charge Z*, r_angstrom the distance in Angstrom, bohr_cm the Bohr radius in cm. Float or tensor inputs; returns a float64 tensor.

torchspin.lft.dipole.sto_tensor(A, geometry='in_plane')[source]#

Reduced dipolar tensor of d_xy on dipole.f’s axes for a dipole.f geometry.

Parameters:
  • A (float or Tensor, shape (...)) – Slater parameter (> 0).

  • geometry ({'in_plane', 'out_of_plane', 'in_plane_lobe'}, default 'in_plane') – 'in_plane' (dipole.f ‘I’: the point on a d_xy nodal axis), 'out_of_plane' (‘O’: on the orbital’s normal) or 'in_plane_lobe' (along a lobe; telser-tools addition).

Returns:

torch.Tensor, shape (…, 3) – (t_y, t_x, t_z), dimensionless, z along the metal-point vector.

Raises:

ValueError – For an unknown geometry.

Return type:

Tensor

torchspin.lft.dipole.sto_tensor_full(A, direction, orbital=None)[source]#

Reduced dipolar tensor of a 3d Slater orbital, t = R^3 <(3 u u^T - u^2)/u^5>.

Parameters:
  • A (float or Tensor, shape (...)) – Slater parameter A = Z* R/(2 a0) (> 0; slater_A()).

  • direction (array_like or Tensor, shape (..., 3)) – Metal -> point vector in the orbital frame (normalized here, so it may carry gradients through angles).

  • orbital (array_like or Tensor, shape (..., 3, 3), optional) – Real symmetric M of Y = r^T M r (made traceless here); default d_xy.

Returns:

torch.Tensor, shape (…, 3, 3) – Dimensionless. The point-dipole limit (A -> inf) is 3 n n^T - 1.

Return type:

Tensor

Examples

>>> import torch
>>> from torchspin.lft import dipole
>>> t = dipole.sto_tensor_full(1e3, [1.0, 0.0, 0.0])
>>> [round(x, 3) for x in torch.diagonal(t).tolist()]
[2.0, -1.0, -1.0]
torchspin.lft.dipole.zstar(n_d, z)[source]#

Clementi-Raimondi effective nuclear charge Z* of a 3d electron (dipole.f CLEMRAIM).

n_d is the number of d electrons and z the atomic number. Returns a float64 scalar tensor (integer inputs: no gradient).