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#
sto_tensor_full()-> (…, 3, 3) R^3 T in the orbital framesto_tensor()-> (…, 3) (t_y, t_x, t_z) for a dipole.f geometrypoint_dipole_full()-> (…, 3, 3)3 n n^T - 1hyperfine()->Hyperfine;electron_electron()->ElectronElectron
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:
- 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
unitsasked for. For two spins 1/2 combined to a triplet, the triplet zero-field splitting is half of these values.
- 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.
- 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_yxzis 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_angstromis the distance to the point spin).z (int) – As
hyperfine()(r_angstromis the distance to the point spin).r_angstrom – As
hyperfine()(r_angstromis the distance to the point spin).g – As
hyperfine()(r_angstromis the distance to the point spin).alpha2 – As
hyperfine()(r_angstromis the distance to the point spin).geometry (str) – As
hyperfine()(r_angstromis the distance to the point spin).zstar – As
hyperfine()(r_angstromis the distance to the point spin).constants (Constants) – As
hyperfine()(r_angstromis 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:
- 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 wheng_nis 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
nucleusnorg_n.- Return type:
- torchspin.lft.dipole.orbital_matrix(name='xy')[source]#
Matrix M of a real d orbital
Y(r) = r^T M r.
- 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).zstaris the effective nuclear charge Z*,r_angstromthe distance in Angstrom,bohr_cmthe 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:
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:
- 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:
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]