# ePSproc LF/AF function verification & tests¶

• 10/09/20 v5 AF code now working and verified.
• 27/08/20 v4 Revisiting again, updates to normalisation with degen factor. Now getting correct $$\beta$$ values, still some possible issues with total XS however.
• 06/07/20 v3 Updated plotting codes & added AF tests.
• 26/06/20 v2
• 19/06/20 v1

For LF and AF calculations, trying to get to the bottom of issues with magnitudes and/or phases and/or formalism differences with raw ePS matrix elements.

## Formalism¶

Test cases:

1. ePS matrix elements with formalism from [1], for LF cross-sections and $$\beta_{2}$$. Formalism with Clebsch-Gordan (CG) terms.
2. ePSproc AF calculations, for LF cross-sections and $$\beta_{2}$$ in isotropic case (or other terms in general cases). Usual 3j-symbol based formalism.

The AF calculations should reduce to the LF case for an isotropic ensemble, and both cases should match the “direct” ePS GetCro outputs (LF). Hopefully this should clear up any outstanding issues with normalisation, units, scale-factors, phase conventions etc. For details of the AF code, see the method dev notes.

(For MF verification, see the MFPADs and associated :math:beta_{LM} <https://epsproc.readthedocs.io/en/dev/demos/ePSproc_BLM_calc_demo_Sept2019.html#Benchmark-vs.->__ notebooks, where the numerics are verified for the NO2 test case, although the total cross-sections may still have issues (for more discussion, see the Matlab code release software paper). The geometric tensor version of the MF calculations is also verified against the same test case.)

[1] Cross section and asymmetry parameter calculation for sulfur 1s photoionization of SF6, A. P. P. Natalense and R. R. Lucchese, J. Chem. Phys. 111, 5344 (1999), http://dx.doi.org/10.1063/1.479794

[2] Reid, Katharine L., and Jonathan G. Underwood. “Extracting Molecular Axis Alignment from Photoelectron Angular Distributions.” The Journal of Chemical Physics 112, no. 8 (2000): 3643. https://doi.org/10.1063/1.480517.

[3] Underwood, Jonathan G., and Katharine L. Reid. “Time-Resolved Photoelectron Angular Distributions as a Probe of Intramolecular Dynamics: Connecting the Molecular Frame and the Laboratory Frame.” The Journal of Chemical Physics 113, no. 3 (2000): 1067. https://doi.org/10.1063/1.481918.

[4] Stolow, Albert, and Jonathan G. Underwood. “Time-Resolved Photoelectron Spectroscopy of Non-Adiabatic Dynamics in Polyatomic Molecules.” In Advances in Chemical Physics, edited by Stuart A. Rice, 139:497–584. Advances in Chemical Physics. Hoboken, NJ, USA: John Wiley & Sons, Inc., 2008. https://doi.org/10.1002/9780470259498.ch6.

### Formalism: LF case with CG terms¶

As given in ref. [1]. This is now implemented in implemented in ePSproc.lfblmGeom <https://epsproc.readthedocs.io/en/dev/modules/epsproc.geomFunc.lfblmGeom.html>__. NOTE - that the $$M$$ term here is an MF projection term, and should be summed over for the final LF result.

The matrix elements $$I_{\mathbf{k},\hat{n}}^{(L,V)}$$ of Eqs. (8) and (9) can be expanded in terms of the $$X_{lh}^{p\mu}$$ functions of Eq. (7) as$$^{14}$$

$$I_{\mathbf{k},\hat{n}}^{(L,V)}=\left[\frac{4\pi}{3}\right]^{1/2}\sum_{p\mu lhv}I_{lhv}^{p\mu(L,V)}X_{lh}^{p\mu}(\hat{k})X_{1v}^{p_{v}\mu_{v}}(\hat{n}).$$

{[}Note here the final term gives polarization (dipole) terms, with $$l=1$$, $$h=v$$, corresponding to a photon with one unit of angular momentum and projections $$v=-1,0,1$$, correlated with irreducible representations $$p_{v}\mu_{v}$$.{]}

The differential cross section is given by

$$\frac{d\sigma^{L,V}}{d\Omega_{\mathbf{k}}}=\frac{\sigma^{L,V}}{4\pi}[1+\beta_{\mathbf{k}}^{L,V}P_{2}(\cos\theta)],$$

where the asymmetry parameter can be written as$$^{14}$$

\begin{eqnarray} \beta_{\mathbf{k}}^{L,V} & = & \frac{3}{5}\frac{1}{\sum_{p\mu lhv}|I_{\mathbf{k},\hat{n}}^{(L,V)}|^{2}}\sum_{\stackrel{p\mu lhvmm_{v}}{p'\mu'l'h'v'm'm'_{v}}}(-1)^{m'-m_{v}}I_{\mathbf{k},\hat{n}}^{(L,V)}\nonumber \\ & \times & \left(I_{\mathbf{k},\hat{n}}^{(L,V)}\right)^{*}b_{lhm}^{p\mu}b_{l'h'm'}^{p'\mu'*}b_{1vm_{v}}^{p_{v}\mu_{v}}b_{1v'm'_{v}}^{p'_{v}\mu'_{v}*}\nonumber \\ & \times & [(2l+1)(2l'+1)]^{1/2}(1100|20)(l'l00|20)\nonumber \\ & \times & (11-m'_{v}m_{v}|2M')(l'l-m'm|2-M'), \end{eqnarray}

and the $$(l'lm'm|L'M')$$ are the usual Clebsch–Gordan coefficients. The total cross section is

$$\sigma^{L,V}=\frac{4\pi^{2}}{3c}E\sum_{p\mu lhv}|I_{\mathbf{k},\hat{n}}^{(L,V)}|^{2},$$

where c is the speed of light.

Additional notes:

• In the current numerics, the XS is defined as $$\beta_0$$ calculated as per above, for $$L=0$$, or as $$1/3*\sum_{p\mu lhv}|I_{\mathbf{k},\hat{n}}^{(L,V)}|^{2}$$. These are identical.
• The normalisation factors of 1/3 and 1/5 appear to be $$1/(2L+1)$$ (or other degeneracy - possibly symmetry) terms - TBC.
• Computing $$\beta_0$$ with the full formalism gives the correct values here, while using the matrix elements directly requires the additional 1/3 normalisation term.
• For $$\beta_2$$, the 1/5 term is required in both cases.

### AF formalism¶

The original (full) form for the AF equations, as implemented in ePSproc.afblm <https://epsproc.readthedocs.io/en/dev/modules/epsproc.AFBLM.html>__ (NOTE - there are some corrections to be made here, which are not yet implemented in the base code, but are now in the geometric version):

\begin{eqnarray} \beta_{L,-M}^{\mu_{i},\mu_{f}} & = & \sum_{l,m,\mu}\sum_{l',m',\mu'}(-1)^{M}(-1)^{m}(-1)^{(\mu'-\mu_{0})}\left(\frac{(2l+1)(2l'+1)(2L+1)}{4\pi}\right)^{1/2}\left(\begin{array}{ccc} l & l' & L\\ 0 & 0 & 0 \end{array}\right)\left(\begin{array}{ccc} l & l' & L\\ -m & m' & -M \end{array}\right)\nonumber \\ & \times & I_{l,m,\mu}^{p_{i}\mu_{i},p_{f}\mu_{f}}(E)I_{l',m',\mu'}^{p_{i}\mu_{i},p_{f}\mu_{f}*}(E)\\ & \times & \sum_{P,R,R'}(2P+1)(-1)^{(R'-R)}\left(\begin{array}{ccc} 1 & 1 & P\\ \mu_{0} & -\mu_{0} & R \end{array}\right)\left(\begin{array}{ccc} 1 & 1 & P\\ \mu & -\mu' & R' \end{array}\right)\\ & \times & \sum_{K,Q,S}(2K+1)^{1/2}(-1)^{K+Q}\left(\begin{array}{ccc} P & K & L\\ R & -Q & -M \end{array}\right)\left(\begin{array}{ccc} P & K & L\\ R' & -S & S-R' \end{array}\right)A_{Q,S}^{K}(t) \end{eqnarray}

Where $$I_{l,m,\mu}^{p_{i}\mu_{i},p_{f}\mu_{f}}(E)$$ are the energy-dependent dipole matrix elements, and $$A_{Q,S}^{K}(t)$$ define the alignment parameters.

In terms of the geometric parameters, this can be rewritten as:

\begin{eqnarray} \beta_{L,-M}^{\mu_{i},\mu_{f}} & =(-1)^{M} & \sum_{P,R',R}{[P]^{\frac{1}{2}}}{E_{P-R}(\hat{e};\mu_{0})}\sum_{l,m,\mu}\sum_{l',m',\mu'}(-1)^{(\mu'-\mu_{0})}{\Lambda_{R'}(\mu,P,R')B_{L,-M}(l,l',m,m')}I_{l,m,\mu}^{p_{i}\mu_{i},p_{f}\mu_{f}}(E)I_{l',m',\mu'}^{p_{i}\mu_{i},p_{f}\mu_{f}*}(E)\sum_{K,Q,S}\Delta_{L,M}(K,Q,S)A_{Q,S}^{K}(t)\label{eq:BLM-tidy-prod-2} \end{eqnarray}

See the method dev notebook for more details. Both methods gave the same results for N2 test cases, so are at least consistent, but do not currently match ePS GetCro outputs for the LF case.

### Numerics¶

In both LF and AF cases, the numerics tested herein are based on the geometric tensor expansion code, which has been verified for the MF case as noted above (for PADs at a single energy).

A few additional notes on the implementations…

• The matrix elements used are taken from the DumpIdy output segments of the ePS output file, which provide “phase corrected and properly normalized dynamical coefs”.
• The matrix elements output by ePS are assumed to correspond to $$I_{lhv}^{p\mu(L,V)}$$ as defined above.
• The Scale Factor (SF) “to sqrt Mbarn” output with the matrix elements is assumed to correspond to the $$\frac{4\pi^{2}}{3c}E$$ term defined above, plus any other required numerical factors ($$4\pi$$ terms and similar).
• The SF is energy dependent, but not continuum (or partial wave) dependent.
• If correct, then using matrix elements * scale factor, should give correct results (as a function of $$E$$), while omitting the scale factor should still give correct PADs at any given $$E$$, but incorrect total cross-section and energy scaling.
• This may be incorrect, and some other assumptions are tested herein.
• EDIT: now verified as $$SF*\sqrt(4*pi)$$ to match LF/GetCro cross-section results.
• The AF and LF case should match for an isotropic distribution, defined as $$A^{0}_{0,0}=1$$. Additional normalisation required here…?
• A factor of $$\sqrt{(2K+1)}/8\pi^2$$ might be required for correct normalisation, although shouldn’t matter in this case. (See eqn. 47 in [4].)
• For the LF case, as defined above, conversion from Legendre-normalised $$\beta$$ to spherical harmonic normalised $$\beta$$ is required for comparison with the AF formalism, where $$\beta^{Sph}_{L,0} = \sqrt{(2L+1)/4\pi}\beta^{Lg}$$

### Status¶

09/09/20 - AF code now working correctly, and verified herein, ePSproc v1.2.5-dev.

## Set up¶

[1]:

# Imports
import numpy as np
import pandas as pd
import xarray as xr

# Special functions
# from scipy.special import sph_harm
import spherical_functions as sf
import quaternion

# Performance & benchmarking libraries
# from joblib import Memory
# import xyzpy as xyz
import numba as nb

# Timings with ttictoc or time
# https://github.com/hector-sab/ttictoc
# from ttictoc import TicToc
import time

# Package fns.
# For module testing, include path to module here
import sys
import os

if sys.platform == "win32":
modPath = r'D:\code\github\ePSproc'  # Win test machine
else:
modPath = r'/home/femtolab/github/ePSproc/'  # Linux test machine

sys.path.append(modPath)
import epsproc as ep
# TODO: tidy this up!
from epsproc.util import matEleSelector
from epsproc.geomFunc import geomCalc, geomUtils
from epsproc.geomFunc.lfblmGeom import lfblmXprod

# Plotters
from epsproc.plot import hvPlotters

* pyevtk not found, VTK export not available.

[2]:

hvPlotters.setPlotters()
# import bokeh
# import holoviews as hv
# hv.extension('bokeh')