torchspin.lft.ligand_field#
Differentiable one-electron d-shell ligand fields: AOM, Ballhausen crystal field, orbital energies.
Every constructor returns a real symmetric matrix (…, 5, 5) in the real-orbital basis
(x2-y2, xy, xz, yz, z2) (Telser’s DDN order and geometric phase convention). Leading
dimensions batch, and every argument may be a tensor carrying gradients (tensor inputs must be
float64; Python floats and lists are converted).
Energy units pass straight through: the matrix is in whatever unit the bonding parameters
(e_sigma, Dq, …) are given in. torchspin.lft.ddn reads it in the unit named by its
units= argument. Angles are in radians (torchspin’s convention); pass degrees=True
for Telser-style input.
AOM entry points:
aom_isotropic()(n, e_sigma, e_pi, e_delta): from bond vectors only. With isotropic pi (and delta) bonding the AOM depends only on the bond direction, so there are no Euler angles and no gimbal singularity at theta = 0.aom_from_angles()(theta, phi, psi, e): the general (anisotropic pi/delta) path: frameR = Rz(phi) Ry(theta) Rz(psi), local orbital k ->c = <Q_j, R Q_k R^T>,V = sum e c c^T.ecolumns areAOM_MODES.aom_from_frames()(R, e): the same from rotation matrices (columns = local x’, y’, z’).
Examples
An octahedron with e_sigma = 5000 and e_pi = 1000 cm^-1: t2g at 4 e_pi, eg at 3 e_sigma.
>>> import torch
>>> from torchspin.lft import ligand_field as lf
>>> V = lf.aom(lf.octahedron(5000.0, 1000.0)) # cm^-1 in, cm^-1 out
>>> [round(e, 6) for e in torch.linalg.eigvalsh(V).tolist()]
[4000.0, 4000.0, 4000.0, 15000.0, 15000.0]
The Ballhausen field with Dq = 1000 (e at +6 Dq, t2 at -4 Dq):
>>> V = lf.crystal_field(Dq=1000.0) # (x2-y2, xy, xz, yz, z2)
>>> [round(e, 6) for e in torch.diagonal(V).tolist()]
[6000.0, -4000.0, -4000.0, -4000.0, 6000.0]
- class torchspin.lft.ligand_field.Ligand(theta, phi, psi=0.0, e_sigma=0.0, e_pi_x=0.0, e_pi_y=0.0, e_delta_x2y2=0.0, e_delta_xy=0.0, label='')[source]#
One AOM ligand (
aom()).- Parameters:
theta (float or Tensor) – Polar angle and azimuth of the metal -> ligand direction, radians (see
from_degrees()).phi (float or Tensor) – Polar angle and azimuth of the metal -> ligand direction, radians (see
from_degrees()).psi (float or Tensor, default 0.0) – Rotation of the local frame about the bond, radians.
e_sigma (float or Tensor, default 0.0) – sigma bonding parameter (any energy unit).
e_pi_x (float or Tensor, default 0.0) – pi parameters acting on d(x’z’) and d(y’z’) of the local frame (DDN: “pi-c”/”pi-s”).
e_pi_y (float or Tensor, default 0.0) – pi parameters acting on d(x’z’) and d(y’z’) of the local frame (DDN: “pi-c”/”pi-s”).
e_delta_x2y2 (float or Tensor, default 0.0) – delta parameters acting on d(x’2-y’2) and d(x’y’) (DDN: “delta-c”/”delta-s”).
e_delta_xy (float or Tensor, default 0.0) – delta parameters acting on d(x’2-y’2) and d(x’y’) (DDN: “delta-c”/”delta-s”).
label (str, default '') – Free-form name.
- torchspin.lft.ligand_field.aom(ligands, device=None)[source]#
Angular-overlap ligand field from
Ligandobjects.V = sum_L sum_lambda e_lambda(L) |lambda_L><lambda_L|in the real-orbital basis.
- torchspin.lft.ligand_field.aom_from_angles(theta, phi, psi, e, degrees=False)[source]#
General angular-overlap ligand field from per-ligand angles.
- Parameters:
theta (float or Tensor, shape (..., nlig)) – Ligand directions and frame rotations, as
rotation().phi (float or Tensor, shape (..., nlig)) – Ligand directions and frame rotations, as
rotation().psi (float or Tensor, shape (..., nlig)) – Ligand directions and frame rotations, as
rotation().e (array_like or Tensor, shape (..., nlig, 5)) – Bonding parameters in
AOM_MODESorder, any energy unit.degrees (bool, default False) – Angles in degrees.
- Returns:
torch.Tensor, shape (…, 5, 5) – In the unit of
e.- Return type:
- torchspin.lft.ligand_field.aom_from_frames(R, e)[source]#
Angular-overlap ligand field from ligand frames.
V = sum_L sum_mode e[L, mode] c c^T.- Parameters:
- Returns:
torch.Tensor, shape (…, 5, 5) – In the unit of
e.- Return type:
- torchspin.lft.ligand_field.aom_isotropic(n, e_sigma, e_pi=0.0, e_delta=0.0)[source]#
Angular-overlap ligand field from bond vectors, with isotropic pi and delta bonding.
The projectors per ligand, with
s_a = <Q_a, (3 n n^T - I)/sqrt(6)>:sigma: s s^T pi: P_pi[a, b] = 2 n^T Q_a (I - n n^T) Q_b n delta: I - s s^T - P_pi
- Parameters:
n (array_like or Tensor, shape (..., nlig, 3)) – Metal -> ligand vectors (normalized here); float64 if a tensor.
e_sigma (float or Tensor) – sigma parameter; broadcasts against (…, nlig).
e_pi (float or Tensor, default 0.0) – Isotropic pi and delta parameters.
e_delta (float or Tensor, default 0.0) – Isotropic pi and delta parameters.
- Returns:
torch.Tensor, shape (…, 5, 5) – In the unit of the e parameters; smooth in
neverywhere.- Return type:
- torchspin.lft.ligand_field.crystal_field(Dq=0.0, Ds=0.0, Dt=0.0, Dr=0.0, geometry='Oh', axis='tetragonal')[source]#
Ballhausen crystal field in DDN’s conventions (linear in Dq, Ds, Dt, Dr).
- Parameters:
Dq (float or Tensor, default 0.0) – Cubic, axial rank-2, axial rank-4 and rhombic parameters, any one energy unit; broadcast against each other. For d1 (tetragonal) e(g) lies at +6Dq and t2(g) at -4Dq,
E(x2-y2), E(xy) = 2Ds - Dt,E(xz, yz) = -Ds + 4Dt,E(z2) = -2Ds - 6Dtrelative to the cubic levels.Ds (float or Tensor, default 0.0) – Cubic, axial rank-2, axial rank-4 and rhombic parameters, any one energy unit; broadcast against each other. For d1 (tetragonal) e(g) lies at +6Dq and t2(g) at -4Dq,
E(x2-y2), E(xy) = 2Ds - Dt,E(xz, yz) = -Ds + 4Dt,E(z2) = -2Ds - 6Dtrelative to the cubic levels.Dt (float or Tensor, default 0.0) – Cubic, axial rank-2, axial rank-4 and rhombic parameters, any one energy unit; broadcast against each other. For d1 (tetragonal) e(g) lies at +6Dq and t2(g) at -4Dq,
E(x2-y2), E(xy) = 2Ds - Dt,E(xz, yz) = -Ds + 4Dt,E(z2) = -2Ds - 6Dtrelative to the cubic levels.Dr (float or Tensor, default 0.0) – Cubic, axial rank-2, axial rank-4 and rhombic parameters, any one energy unit; broadcast against each other. For d1 (tetragonal) e(g) lies at +6Dq and t2(g) at -4Dq,
E(x2-y2), E(xy) = 2Ds - Dt,E(xz, yz) = -Ds + 4Dt,E(z2) = -2Ds - 6Dtrelative to the cubic levels.geometry ({'Oh', 'Td'}, default 'Oh') –
'Td'multiplies the whole matrix by -1, as DDN does.axis ({'tetragonal', 'trigonal'}, default 'tetragonal') – z along C4 or along C3.
- Returns:
torch.Tensor, shape (…, 5, 5) – In the unit of the parameters.
- Raises:
ValueError – For an unknown
geometryoraxis.- Return type:
- torchspin.lft.ligand_field.octahedron(e_sigma, e_pi=0.0)[source]#
Six identical isotropic ligands on +-x, +-y, +-z (list of
Ligand).
- torchspin.lft.ligand_field.orbital_coefficients(R)[source]#
Real-orbital coefficients of rotated orbitals.
R(…, 3, 3) is a frame fromrotation(); returnsC[..., k, j], the coefficient of global real orbital j in local orbital k, shape (…, 5, 5), orbitals in(x2-y2, xy, xz, yz, z2)order.
- torchspin.lft.ligand_field.orbital_matrix(energies, mixing=None)[source]#
Ligand-field matrix from d-orbital energies (DDN option D).
- Parameters:
- Returns:
torch.Tensor, shape (…, 5, 5) – Real symmetric, in the unit of
energies.- Return type:
- torchspin.lft.ligand_field.rotation(theta, phi, psi=0.0, degrees=False)[source]#
Ligand frame
R = Rz(phi) Ry(theta) Rz(psi); columns are the ligand’s x’, y’, z’.z’ points from the metal to the ligand (polar angle
theta, azimuthphi). Forpsi = 0, x’ lies in the plane of z and z’ and y’ is along +phi-hat.- Parameters:
theta (float or Tensor) – Polar angle and azimuth of the metal -> ligand direction.
phi (float or Tensor) – Polar angle and azimuth of the metal -> ligand direction.
psi (float or Tensor, default 0.0) – Rotation of the ligand frame about z’.
degrees (bool, default False) – Angles in degrees instead of radians.
- Returns:
torch.Tensor, shape (…, 3, 3) – Broadcast over the angles.
- Return type: