torchspin.lft.ddpowh#
DDPOWH: powder EPR, FDMR, ENDOR and NMR/NQR spectra at field points, with Telser’s level strain.
Torch port of Josh Telser’s DDPOWH in its exact mode (via telser-tools, telser_tools_diff.ddpowh),
on a torchspin SpinSystem. The Hamiltonian is torchspin’s (ham: H = H0 - B n.mu),
plus two optional Telser terms that torchspin’s core does not carry yet (zeeman2 for the second-order
Zeeman w (mu_B B.S)^2 and h0_extra for the I.S^3 hyperfine U; torchspin.lft.telser2torchspin
builds both). Unlike pepper no resonance field is searched: for every orientation n of the grid and
every field B of the sweep, H(B n) is diagonalized and every selected level pair (i, j) adds:
y(B) += w(n) P_ij pop_ij F(nu_ij) f(nu_ij(B) - nu_mw; W_ij(n, B))
f: Telser’s DLINE.F line (Gaussian or Lorentzian, HWHM W, cut at
cutoffhalf widths), evaluated in the frequency domain at each field point. The field-swept line is the frequency line mapped through the exact nu_ij(B), so curved and looping levels need no linearization (the 1/abs(d nu/dB) weight is implicit).W_ij(n, B) = W(n) (B/B_set)^b (1 + [sqrt(sum_b abs(c_bi)^2 w_b) + sqrt(sum_b abs(c_bj)^2 w_b)]/2) with W(n)^2 = sum_k W_k^2 n_k^2. The square brackets are Telser’s level strain: w_b is a weight per basis state
|m_S, m_I>and c_bi the components of level i, so the width of a transition depends on what its two levels are made of.strain_weights()builds DDPOWH’s w_b = WMS(m_S) + WMI(m_I);torchspin.lft.ddpowj.strain_weights()DDPOWJ’s product WMS1(m_1) WMS2(m_2).P_ij: the B1-averaged abs(<i|mu|j>)^2 / mu_B^2 (perpendicular mode; parallel for
h1mode < 0; perpendicular + h1mode x parallel forh1mode > 0). Withmoment='electron'(default, Telser’s) mu is the electron Zeeman moment only (g.S: no nuclear moment, no third-order Zeeman u); withmoment='full'it is torchspin’s -dH/dB moment.pop_ij = p_i - p_j: Boltzmann populations at
temperature(normalized; None: no populations).F(nu) = nu (Gaussian) or nu^3/nu_mw^2 (Lorentzian), nu in cm^-1: the Flygare frequency factor (
frequency_factor=Falseremoves it, as in EasySpin/pepper).w(n): the grid weight times the partial-orientation factor exp(lam_x cos^2 phi + lam_z cos^2 theta) (
ordering=(lam_x, lam_z)).
Functions: epr() (field sweep), fdmr() (frequency sweep at one field, zero field included),
endor() (rf sweep at one field, orientation selection by the EPR line) and nmr() (S = 0
NMR/NQR, Telser’s DDPOWH NMR mode, with the chemical shielding sigma_k in kHz).
Units#
Fields in mT, microwave frequency in GHz, temperature in K, rf axes in MHz. width, nmr_width and
the FDMR axis are in units (default 'MHz'; 'cm^-1', 'GHz', … via torchspin.lft.units).
Intensities are DDPOWH’s exact-mode values (P as above, the line in 1/MHz, F in cm^-1), except that
field-derivative spectra are d/dB per mT (10x DDPOWH’s per-gauss values). constants (a
SpinConstants) sets mu_B (P normalization), k_B and cm^-1 -> MHz; parity tests pass telser-tools’
CODATA 2018 values through SpinConstants.from_telser().
Example (an S = 3/2 system with D = 6000 MHz whose +-3/2 levels are broadened by level strain):
>>> import torch
>>> from torchspin import SpinSystem
>>> from torchspin.lft import ddpowh
>>> sys = SpinSystem(S=1.5, g=[2.0, 2.0, 2.0], D=[-2000., -2000., 4000.]) # MHz
>>> w = ddpowh.strain_weights(sys, ms=[1.0, 0.0, 0.0, 1.0])
>>> res = ddpowh.epr(sys, torch.linspace(50, 450, 201), 9.5, width=60.0,
... strain=ddpowh.Strain(w), igloo=6)
>>> res.spectrum.shape, res.n_orientations
(torch.Size([201]), 98)
Gradients#
Every tensor parameter of the SpinSystem that ham keeps on the graph (g, D, A, Q principal values,
full tensors, ee, the Euler frames …), the widths, the strain weights, b, B_set,
the microwave frequency, the temperature, ordering, zeeman2, h0_extra, the shielding and
scale carry gradients. Eigenvalues and eigenvectors come from torchspin.lft._linalg.eigh_gauge.
Discrete choices are made on detached values: which (orientation, field) points carry a line (the cutoff),
the window of each FDMR/ENDOR line and the ENDOR selection sign test.
Strain inside a degenerate level (e.g. zero field with isotropic exchange) uses per-state weights, which are basis dependent there, as in Telser’s program.
Not ported (Fortran reproduction, see telser-tools docs/FINDINGS.md): EPRTRANS/NMRTRANS probabilities, the
Fortran thresholds, the IEND/JEND strain bug (DDPOWH-06), the sqrt(ICUTOFF) cut is available as
exact_cutoff=False, the original phi windows as grid='fortran', d/dnu derivatives as
field_derivative=False and unnormalized populations as normalized_populations=False.
- class torchspin.lft.ddpowh.SpinConstants(mu_b, k_b, mhz_per_cm)[source]#
Physical constants used by the DDPOWH/DDPOWJ simulations.
- Variables:
mu_b (float) – Bohr magneton over Planck’s constant, mu_B/h, in MHz per mT (normalizes the transition probabilities P).
k_b (float) – Boltzmann constant over Planck’s constant, k_B/h, in MHz per K.
mhz_per_cm (float) – MHz per cm^-1 (energy conversion of widths, axes and the Flygare frequency factor).
See also
TORCHSPIN_CONSTANTStorchspin’s CODATA values.
- classmethod from_telser(c)[source]#
Build from a telser-tools
Constants-like object.- Parameters:
c (object) – Any object with attributes
mu_b_mhz(MHz per gauss),mu_b_cm(cm^-1 per gauss) andk_b_cm(cm^-1 per K), e.g. telser-tools’ CODATA 2018 constants (used by the parity tests).- Returns:
SpinConstants –
mu_b = 10 * mu_b_mhz(MHz/mT),mhz_per_cm = mu_b_mhz / mu_b_cmandk_b = k_b_cm * mhz_per_cm.- Return type:
- torchspin.lft.ddpowh.TORCHSPIN_CONSTANTS = (13.996244917056908, 20836.619123327575, 29979.245800000004)#
Derived from
torchspin.constants(CODATA 2022 mu_B).
- class torchspin.lft.ddpowh.Strain(weights, b=0.0, field=1.0)[source]#
Telser’s level strain of a DDPOWH/DDPOWJ EPR line.
The half width of the line between levels i and j at field B is
W(n) (B/B_set)^b (1 + [sqrt(sum_b abs(c_bi)^2 w_b) + sqrt(sum_b abs(c_bj)^2 w_b)]/2), wherec_biare the components of level i in the basis state b andw_bare the basis weights.- Variables:
weights (Tensor, shape (nStates,)) – One weight per basis state of the SpinSystem (
nStates = sys.nStates, states|m_S1, m_S2, ..., m_I1, ...>with every m descending, torchspin’s order), dimensionless. Built bystrain_weights()(DDPOWH) ortorchspin.lft.ddpowj.strain_weights()(DDPOWJ). May require grad.b (float or Tensor, default 0.0) – Field exponent of the width.
field (float or Tensor, default 1.0) – Reference field B_set in mT; only used when
b != 0.
- class torchspin.lft.ddpowh.PowderResult(axis, spectrum, n_orientations, grid)[source]#
Result of
epr(),fdmr(),endor()andnmr().- Variables:
axis (Tensor, shape (npts,)) – The sweep axis as used: fields in mT (
epr()), energies inunits(fdmr()) or radio frequencies in MHz (endor(),nmr()); detached,float64.spectrum (Tensor, shape (npts,)) – The spectrum on
axis(DDPOWH’s exact-mode intensity scale, see the module docstring), on the autograd graph of differentiable inputs.n_orientations (int) – Number of grid orientations.
grid (Grid) – The orientation grid (
theta,phiin radians,weight, unitdirections(n_orientations, 3), …).
- grid: Grid#
Alias for field number 3
- torchspin.lft.ddpowh.strain_weights(sys, ms=None, mi=None, *, electron=0, nucleus=0)[source]#
DDPOWH’s basis-state strain weights
w_b = WMS(m_S) + WMI(m_I).- Parameters:
sys (SpinSystem) – The spin system; one weight is returned per basis state.
ms (array_like or Tensor, shape (2S+1,), optional) – WMS for
m_S = S, S-1, ..., -Sof electronelectron(Telser’s input order), dimensionless.None: zeros.mi (array_like or Tensor, shape (2I+1,), optional) – WMI for
m_I = I, ..., -Iof nucleusnucleus.None: zeros.electron (int, default 0) – 0-based electron index for
ms.nucleus (int, default 0) – 0-based nucleus index for
mi.
- Returns:
torch.Tensor, shape (nStates,) – The weights in torchspin’s basis order,
float64; tensor inputs keep their graph.- Raises:
ValueError – If
ms/midoes not have2S+1/2I+1values, or if the electron or nucleus does not exist and more than one value is given (a single value for an absent spin, Telser’s WMI(1) without a nucleus, is added to every state).- Return type:
See also
Examples
>>> from torchspin import SpinSystem >>> from torchspin.lft import ddpowh >>> sys = SpinSystem(S=0.5, Nucs='14N', A=[20.0, 20.0, 95.0]) >>> ddpowh.strain_weights(sys, ms=[1.0, 0.0], mi=[0.5, 0.0, 0.5]).tolist() [1.5, 1.0, 1.5, 0.5, 0.0, 0.5]
- torchspin.lft.ddpowh.manifold_pairs(ms_range, manifold_size)[source]#
DDPOWH’s level-range pair selection.
The levels, sorted by energy, are grouped in consecutive manifolds of
manifold_sizelevels (Telser: 2I + 1, the m_S manifolds at high field). Level i runs over manifolds a to b, level j over c to d, and onlyi < jis kept.- Parameters:
ms_range (sequence of 4 int) –
(a, b, c, d), 1-based manifold numbers;(1, 1, 2, 2)selects the transitions from the lowest manifold to the next.manifold_size (int) – Levels per manifold.
- Returns:
tuple of tuple of int – 0-based level pairs
(i, j). (DDPOWJ’s default, all pairs, isall_pairs().)- Return type:
Examples
>>> from torchspin.lft import ddpowh >>> ddpowh.manifold_pairs((1, 1, 2, 2), 2) ((0, 2), (0, 3), (1, 2), (1, 3))
- torchspin.lft.ddpowh.all_pairs(n)[source]#
Every level pair
(i, j),i < j, ofnlevels.- Parameters:
n (int) – Number of levels.
- Returns:
tuple of tuple of int – 0-based pairs of levels numbered by ascending energy.
- Return type:
Examples
>>> from torchspin.lft import ddpowh >>> ddpowh.all_pairs(3) ((0, 1), (0, 2), (1, 2))
- torchspin.lft.ddpowh.epr(sys, fields, mw_freq, *, width, shape='gaussian', derivative=False, cutoff=8, temperature=None, h1mode=0.0, pairs=None, strain=None, frequency_factor=True, igloo=10, extent='hemisphere', angle_range=None, degrees=False, ordering=None, grid='exact', field_derivative=True, normalized_populations=True, exact_cutoff=True, moment='electron', zeeman2=None, h0_extra=None, scale=1.0, units='MHz', constants=TORCHSPIN_CONSTANTS, device='cpu', chunk_budget=4_000_000)[source]#
Field-swept powder (or partial-orientation) EPR spectrum at the field points
fields.For every grid orientation and every field point the Hamiltonian is diagonalized and every selected level pair adds a line evaluated in the frequency domain (see the module docstring for the intensity formula).
- Parameters:
sys (SpinSystem) – Spin system; its Hamiltonian is built by
torchspin.ham().fields (array_like or Tensor, shape (npts,)) – Field points in mT (not differentiated). Telser’s axis is
linspace(B_min, B_max, npts + 1).width (float or array_like, shape (3,)) – Line half width at half maximum
(Wx, Wy, Wz)along the molecular axes, inunits(frequency domain); a scalar is isotropic. The width for direction n issqrt(sum_k W_k^2 n_k^2).shape ({'gaussian', 'lorentzian'}, default 'gaussian') – Line shape (Telser’s DLINE.F;
'g'/'l'also accepted).derivative (bool, default False) – First-derivative spectrum: d/dB per mT (
field_derivative=False: the Fortran’s d/dnu).cutoff (int, default 8) – Lines are cut at
cutoffhalf widths.temperature (float or Tensor, optional) – Temperature in K for Boltzmann population differences.
None(default): no population factor.h1mode (float, default 0.0) – Microwave mode: 0 perpendicular,
< 0parallel,> 0perpendicular +h1modex parallel.pairs (sequence of (int, int), optional) – 0-based level pairs
(i, j),i < j, levels numbered by ascending energy at each (orientation, field).None(default): all pairs.manifold_pairs()builds Telser’s m_S ranges.strain (Strain, optional) – Telser’s level strain;
None(default): widthW(n)only.frequency_factor (bool, default True) – Include the Flygare frequency factor (nu for Gaussian, nu^3/nu_mw^2 for Lorentzian lines, nu in cm^-1);
Falseas EasySpin/pepper.igloo (int, default 10) – Grid rings per 90 degrees of theta.
extent ({'hemisphere', 'octant'}, default 'hemisphere') – Powder grid extent: a hemisphere (general) or one octant (D2h systems; Telser’s NROT = 1).
angle_range (sequence of 4 float, optional) –
(theta_min, theta_max, phi_min, phi_max): a restricted orientation range instead of the powder, in radians (degrees withdegrees=True).degrees (bool, default False) –
angle_rangeis in degrees.ordering (tuple of 2 float or Tensor, optional) –
(lam_x, lam_z): orientation weightexp(lam_x cos^2(phi) + lam_z cos^2(theta)), applied whenever given (Telser applies it only withangle_range).moment ({'electron', 'full'}, default 'electron') – Transition operator: the electron Zeeman moment
g.Sonly (Telser) or torchspin’s full-dH/dBmoment.zeeman2 (array_like or Tensor, shape (3, 3, nStates, nStates), optional) – Field-quadratic Zeeman operator in MHz/mT^2:
H += B^2 n.Z2.n(torchspin.lft.telser2torchspin.second_order_zeeman_operator()).h0_extra (array_like or Tensor, shape (nStates, nStates), optional) – Extra field-independent Hamiltonian in MHz (e.g.
torchspin.lft.telser2torchspin.u_term_operator()).scale (float or Tensor, default 1.0) – Multiplies the spectrum.
units (str, default 'MHz') – Unit of
width('MHz','GHz','cm^-1', … oftorchspin.lft.units).constants (SpinConstants, default TORCHSPIN_CONSTANTS) – mu_B/h, k_B/h and MHz per cm^-1.
device (str or device, default 'cpu') – Device of the computation.
grid ({'exact', 'fortran'}, default 'exact') –
'fortran'reproduces the original phi windows of the grid.field_derivative (bool, default True) – With
derivative: d/dB per mT (False: d/dnu as the Fortran).normalized_populations (bool, default True) – Normalize the Boltzmann populations (
False: as the Fortran).exact_cutoff (bool, default True) – Cut lines exactly at
cutoffhalf widths (False: Telser’ssqrt(ICUTOFF)rule).chunk_budget (int, default 4000000) – Approximate number of complex matrix elements per batch of orientations (memory control).
- Returns:
PowderResult –
axis=fields(mT),spectrumof shape(npts,).- Raises:
ValueError – For an unknown
shape,extent,gridormoment; awidththat is not a scalar or 3 values;angle_rangewithout 4 values; a pair outside0 <= i < j < n; strain weights not of lengthn;zeeman2not of shape(3, 3, n, n).- Return type:
See also
fdmr,endor,nmr,torchspin.lft.ddpowj.epr,torchspin.pepperExamples
>>> import torch >>> from torchspin import SpinSystem >>> from torchspin.lft import ddpowh >>> sys = SpinSystem(S=0.5, g=[2.0, 2.0, 2.2]) >>> res = ddpowh.epr(sys, torch.linspace(300, 350, 101), 9.5, width=50.0, igloo=6) >>> res.axis.shape, res.spectrum.shape, res.n_orientations (torch.Size([101]), torch.Size([101]), 98)
- torchspin.lft.ddpowh.fdmr(sys, axis, field, *, width, shape='gaussian', derivative=False, cutoff=8, temperature=None, h1mode=0.0, pairs=None, frequency_factor=True, igloo=10, extent='hemisphere', angle_range=None, degrees=False, ordering=None, grid='exact', normalized_populations=True, exact_cutoff=True, moment='electron', zeeman2=None, h0_extra=None, scale=1.0, units='MHz', constants=TORCHSPIN_CONSTANTS, device='cpu')[source]#
Frequency-domain (FDMR) powder spectrum at one field.
field = 0is a true zero field: the levels are the same for every orientation, and the transition probability is still averaged over B1 about each grid direction (as DDPOWH does). There is no strain (Telser’s FDMR input has none).- Parameters:
sys (SpinSystem) – Spin system.
axis (array_like or Tensor, shape (npts,)) – Transition energies at which the spectrum is evaluated, in
units(not differentiated).width (float or array_like, shape (3,)) – HWHM
(Wx, Wy, Wz)inunits, or one isotropic value.derivative (bool, default False) – d/dnu spectrum.
frequency_factor (bool, default True) – Flygare factor: nu (Gaussian) or nu^3/x^2 (Lorentzian), with x the axis in cm^-1.
temperature – As for
epr().pairs – As for
epr().angle_range – As for
epr().ordering – As for
epr().zeeman2 – As for
epr().h0_extra – As for
epr().scale – As for
epr().constants (SpinConstants) – As for
epr().device – As for
epr().
- Returns:
PowderResult –
axisinunits,spectrumof shape(npts,).- Raises:
ValueError – As for
epr().- Return type:
See also
Examples
Zero-field FDMR of an S = 1 system (D = 3000 MHz, E = 300 MHz):
>>> import torch >>> from torchspin import SpinSystem >>> from torchspin.lft import ddpowh >>> res = ddpowh.fdmr(SpinSystem(S=1, D=[3000.0, 300.0]), torch.linspace(2000, 4000, 201), ... 0.0, width=50.0, igloo=6) >>> round(float(res.axis[res.spectrum.argmax()])) 3300
- torchspin.lft.ddpowh.endor(sys, rf, field, mw_freq, *, width, nmr_width, shape='gaussian', nmr_shape='gaussian', derivative=False, epr_derivative=False, cutoff=8, nmr_cutoff=None, temperature=None, h1mode=0.0, pairs=None, epr_pairs=None, nucleus=0, strain=None, field_strain=True, intensity_shape='nmr', frequency_factor=True, igloo=10, extent='hemisphere', angle_range=None, degrees=False, ordering=None, grid='exact', normalized_populations=True, exact_cutoff=True, moment='electron', zeeman2=None, h0_extra=None, scale=1.0, units='MHz', constants=TORCHSPIN_CONSTANTS, device='cpu')[source]#
Powder ENDOR spectrum at one field, with orientation selection by the EPR line.
Every orientation is weighted by its EPR excitation, the sum over
epr_pairsofP_kl f(nu_kl - nu_mw; W_kl)with the EPRwidth,shapeandstrain; orientations with a non-positive weight are dropped. Each NMR pair then addsP_NMR pop nu f(rf - nu_ij; w(n)), whereP_NMRis the B1-averagedabs(<i|I|j>)^2of nucleusnucleus(no g_N, no hyperfine enhancement; Telser’s NMRTRANS in exact form).- Parameters:
sys (SpinSystem) – Spin system with at least one nucleus (without electron spins every orientation has weight 1).
rf (array_like or Tensor, shape (npts,)) – Radio frequencies in MHz (absolute, uniform).
width (float or array_like, shape (3,)) – EPR HWHM
(Wx, Wy, Wz)inunitsfor the orientation selection.nmr_width (float or array_like, shape (3,)) – NMR HWHM
(wx, wy, wz)inunits.shape ({'gaussian', 'lorentzian'}, default 'gaussian') – EPR (selection) line shape.
nmr_shape ({'gaussian', 'lorentzian'}, default 'gaussian') – NMR line shape.
derivative (bool, default False) – d/d(rf) spectrum.
epr_derivative (bool, default False) – Use the derivative EPR line for the selection weights.
cutoff (int, default 8) – Cut of the EPR selection line in half widths.
nmr_cutoff (int, optional) – Cut of the NMR lines; default
cutoff.pairs (sequence of (int, int), optional) – 0-based NMR level pairs;
None: all.epr_pairs (sequence of (int, int), optional) – 0-based EPR level pairs for the selection;
None: all.nucleus (int, default 0) – 0-based nucleus whose spin operator drives the NMR transitions.
strain (Strain, optional) – Level strain of the EPR selection line.
field_strain (bool, default True) – Include the
(B/B_set)^bfactor ofstrain.intensity_shape ({'nmr', 'epr'}, default 'nmr') – Which line type selects the nu or nu^3/rf^2 Flygare factor (
'nmr': Telser exact;'epr': the Fortran’s ELNTYP flag).temperature – As for
epr().angle_range – As for
epr().ordering – As for
epr().zeeman2 – As for
epr().h0_extra – As for
epr().scale – As for
epr().constants (SpinConstants) – As for
epr().device – As for
epr().
- Returns:
PowderResult –
axis=rf(MHz),spectrumof shape(npts,).- Raises:
ValueError – For an unknown
intensity_shapeor a nonexistentnucleus, and as forepr().- Return type:
See also
Examples
>>> import torch >>> from torchspin import SpinSystem >>> from torchspin.lft import ddpowh >>> sys = SpinSystem(S=0.5, g=[2.0, 2.0, 2.1], Nucs='1H', A=[5.0, 5.0, 12.0]) >>> res = ddpowh.endor(sys, torch.linspace(5, 25, 201), 340.0, 9.5, width=30.0, ... nmr_width=0.2, igloo=6) >>> res.spectrum.shape torch.Size([201])
- torchspin.lft.ddpowh.nmr(sys, rf, field, *, nmr_width, shape='gaussian', derivative=False, cutoff=8, temperature=None, h1mode=0.0, pairs=None, shielding_khz=None, frequency_factor=True, igloo=10, extent='hemisphere', angle_range=None, degrees=False, ordering=None, grid='exact', normalized_populations=True, exact_cutoff=True, h0_extra=None, scale=1.0, units='MHz', constants=TORCHSPIN_CONSTANTS, device='cpu')[source]#
Powder NMR/NQR spectrum of a system without electron spins (Telser’s DDPOWH NMR mode).
The nuclear levels (nuclear Zeeman + quadrupole) are computed at every grid orientation and each pair adds
P pop nu f(rf - nu_ij; w(n))withPthe B1-averagedabs(<i|I|j>)^2(no g_N).field = 0gives the NQR spectrum. Differentiable in Q, the shielding, the widths and the temperature.- Parameters:
sys (SpinSystem) – Spin system with
S=[]and at least one nucleus, e.g.SpinSystem(S=[], Nucs='14N', Q=...); only the first nucleus is driven.rf (array_like or Tensor, shape (npts,)) – Radio frequencies in MHz.
nmr_width (float or array_like, shape (3,)) – HWHM
(wx, wy, wz)inunits.shielding_khz (array_like, shape (3,), optional) – Telser’s shielding
(sigma_x, sigma_y, sigma_z): the shift of the Larmor frequency in kHz for the field along each molecular axis (a positive sigma lowersabs(nu_N)); the nuclear Zeeman moment along k is scaled by1 - sigma_k/abs(nu_N(B)). Ignored at zero field.derivative (bool) – As for
epr()(shapeis the NMR line shape).temperature – As for
epr()(shapeis the NMR line shape).h1mode (float) – As for
epr()(shapeis the NMR line shape).pairs – As for
epr()(shapeis the NMR line shape).frequency_factor (bool) – As for
epr()(shapeis the NMR line shape).angle_range – As for
epr()(shapeis the NMR line shape).degrees (bool) – As for
epr()(shapeis the NMR line shape).ordering – As for
epr()(shapeis the NMR line shape).h0_extra – As for
epr()(shapeis the NMR line shape).scale – As for
epr()(shapeis the NMR line shape).constants (SpinConstants) – As for
epr()(shapeis the NMR line shape).device – As for
epr()(shapeis the NMR line shape).
- Returns:
PowderResult –
axis=rf(MHz),spectrumof shape(npts,).- Raises:
ValueError – If the system has electron spins or no nucleus,
shielding_khzis not three values, and as forepr().- Return type:
See also
Examples
14N NQR (e2qQ/h = 3 MHz, eta = 0.2):
>>> import torch >>> from torchspin import SpinSystem >>> from torchspin.lft import ddpowh >>> sys = SpinSystem(S=[], Nucs='14N', Q=[3.0, 0.2]) >>> res = ddpowh.nmr(sys, torch.linspace(0.1, 3.0, 300), 0.0, nmr_width=0.02, igloo=6) >>> round(float(res.axis[res.spectrum.argmax()]), 1) 2.4
- torchspin.lft.ddpowh.simulate(conversion, sys=None, **overrides)[source]#
Every spectrum of a converted Telser DDPOWH/DDPOWJ input.
- Parameters:
conversion (TelserConversion) – Result of
telser2torchspin.ddpowh2sys(inp, target='lft')orddpowj2sys(..., target='lft'); itsextras['spectra']lists the spectra (function name and keywords).sys (SpinSystem, optional) – Replaces the converted SpinSystem (e.g. one rebuilt with tensor parameters for gradients).
**overrides – Keywords that replace those of every spectrum (
width=,strain=,temperature=, …).
- Returns:
tuple of PowderResult – One result per spectrum, in input order. The axis Telser writes is in
conversion.extras['spectra'][k]['x'](G or T, cm^-1 or THz, MHz).- Raises:
ValueError – If
conversionwas not made withtarget='lft'.- Return type:
tuple[PowderResult, …]