OCS orb 11 (HOMO) ePS results processing + AF-BLMs

09/06/21 PH

Quick look at initial ePS results for orb 11 (HOMO), 2.5eV step size.

TODO:

  • Currently AF code fails for Xarray = 0.17, issue with phaseCons setting to coord, sigh.
  • AF normalisation not correct here, due to doubly-degenerate state? Summing over 'it' not working correctly either, needs a debug (or missing some settings...?).
  • lmPlot() slice and cmapping to fix, in cases of missing/dropped dims, and for clims if possible.

For methods: https://epsproc.readthedocs.io/en/dev/demos/ePSproc_class_demo_161020.html

Setup

In [1]:
!hostname
jake
In [2]:
!conda env list
# conda environments:
#
base                     /home/paul/anaconda3
baseBK-280321            /home/paul/anaconda3/envs/baseBK-280321
ePSproc-v1.2             /home/paul/anaconda3/envs/ePSproc-v1.2
ePSproc-v1.2-dev      *  /home/paul/anaconda3/envs/ePSproc-v1.2-dev
epsdev                   /home/paul/anaconda3/envs/epsdev
epsman                   /home/paul/anaconda3/envs/epsman
fibre-sim                /home/paul/anaconda3/envs/fibre-sim
frog                     /home/paul/anaconda3/envs/frog
matlab                   /home/paul/anaconda3/envs/matlab
tmo-dev                  /home/paul/anaconda3/envs/tmo-dev

In [3]:
import sys
import os
from pathlib import Path
import numpy as np
# import epsproc as ep
import xarray as xr

import matplotlib.pyplot as plt

from datetime import datetime as dt
timeString = dt.now()

import epsproc as ep

# Plotters
from epsproc.plot import hvPlotters

# Multijob class dev code
from epsproc.classes.multiJob import ePSmultiJob

hvPlotters.setPlotters(width = 700, snsStyle='whitegrid')
* sparse not found, sparse matrix forms not available. 
* natsort not found, some sorting functions not available. 
* plotly not found, plotly plots not available. 
* pyevtk not found, VTK export not available. 
In [4]:
# For class, above settings don't take, not sure why, something to do with namespaces/calling sequence?
# Overriding snsStyle does work however... although NOT CONSISTENTLY????
# AH, looks like ordering matters - set_style LAST (.set seems to override)
import seaborn as sns

sns.set(rc={'figure.figsize':(10,6)})  # Set figure size in inches
sns.set_context("paper")
sns.set_style("whitegrid")  # Set plot style
sns.set_palette("Paired")   # Set colour mapping

# Try direct fig type setting for PDF output figs
from IPython.display import set_matplotlib_formats
# set_matplotlib_formats('png', 'pdf')
set_matplotlib_formats('svg', 'pdf')
In [5]:
# xr.set_options(display_style='html')

Load data

In [6]:
# # Scan for subdirs, based on existing routine in getFiles()

fileBase = Path('/home/paul/ePS/OCS/OCS_survey')  # Data dir on Stimpy
In [7]:
# TODO: fix orb label here, currently relies on (different) fixed format

data = ePSmultiJob(fileBase, verbose = 0)

data.scanFiles()
data.jobsSummary()
*** Warning: Missing records, expected 64, found 48.
*** Warning: Found 16 blank sets of matrix elements, symmetries ['A2']
*** Warning: Missing records, expected 64, found 48.
*** Warning: Found 16 blank sets of matrix elements, symmetries ['A2']
Found 1 directories, with 2 files.

*** Job orb11 details
Key: orb11
Dir /home/paul/ePS/OCS/OCS_survey/orb11, 2 file(s).
{   'batch': 'ePS OCS, batch OCS_survey, orbital orb11',
    'event': ' orb 11 ionization, basic survey run.',
    'orbE': -11.358032524748,
    'orbLabel': '# OCS, orb 11 ionization, basic survey run.'}

System properties

In [8]:
data.molSummary()
*** Molecular structure
*** Molecular orbital list (from ePS output file)
EH = Energy (Hartrees), E = Energy (eV), NOrbGrp, OrbGrp, GrpDegen = degeneracies and corresponding orbital numbering by group in ePS, NormInt = single centre expansion convergence (should be ~1.0).
props Sym EH Occ E NOrbGrp OrbGrp GrpDegen NormInt
orb
1 S -91.9901 2.0 -2503.178121 1.0 1.0 1.0 0.660569
2 S -20.6748 2.0 -562.589964 1.0 2.0 1.0 0.963189
3 S -11.4451 2.0 -311.437034 1.0 3.0 1.0 0.999998
4 S -8.9936 2.0 -244.728321 1.0 4.0 1.0 0.951187
5 S -6.6764 2.0 -181.674098 1.0 5.0 1.0 0.993503
6 P -6.6721 2.0 -181.557089 1.0 6.0 2.0 0.978550
7 P -6.6721 2.0 -181.557089 2.0 6.0 2.0 0.978550
8 S -1.5373 2.0 -41.832064 1.0 7.0 1.0 0.998241
9 S -1.0876 2.0 -29.595103 1.0 8.0 1.0 0.997329
10 S -0.7906 2.0 -21.513322 1.0 9.0 1.0 0.999269
11 P -0.6743 2.0 -18.348638 1.0 10.0 2.0 0.999887
12 P -0.6743 2.0 -18.348638 2.0 10.0 2.0 0.999887
13 S -0.6367 2.0 -17.325489 1.0 11.0 1.0 0.998566
14 P -0.4174 2.0 -11.358033 1.0 12.0 2.0 0.998839
15 P -0.4174 2.0 -11.358033 2.0 12.0 2.0 0.998839
*** Warning: some orbital convergences outside single-center expansion convergence tolerance (0.01):
[[1.         0.66056934]
 [2.         0.96318872]
 [4.         0.95118653]
 [6.         0.9785498 ]
 [7.         0.9785498 ]]

Plot cross-sections and betas

These are from ePolyScat's getCro function, and are LF (unaligned ensemble) results. This provides a good, if general, overview.

Overview (all symmetries, length gauge)

In [9]:
# Comparitive plot over datasets (all symmetries only)
Etype = 'Eke'  # Set for Eke or Ehv energy scale
pGauge = 'L'
# Erange=[0, 100]  # Plot range (full range if not passed to function below)
# data.plotGetCroComp(pType='SIGMA', Etype = Etype, Erange = Erange, backend = 'hv')
data.plotGetCroComp(pType='SIGMA', pGauge = pGauge, Etype = Etype)
In [10]:
# Comparative plot over datasets (all symmetries only)
data.plotGetCroComp(pType='BETA', Etype=Etype)
In [11]:
# Betas vs. Gauge
data.plotGetCro(pType='BETA', Etype=Etype)

Matrix elements

In [ ]:
ep.lmPlot
In [41]:
data.lmPlotOpts = {'selDims':{'Type':'L', 'it':1}, 'cmap':'vlag', 'logFlag':False}
# data.lmPlot(cmap='vlag')
data.lmPlot()
/home/paul/anaconda3/envs/ePSproc-v1.2-dev/lib/python3.7/site-packages/xarray/core/nputils.py:223: RuntimeWarning: All-NaN slice encountered
  result = getattr(npmodule, name)(values, axis=axis, **kwargs)
Plotting data OCS_survey.orb11_E0.1_2.0_30.1eV.inp.out, pType=a, thres=0.01, with Seaborn
In [42]:
# As above, but log10 cmapping
data.lmPlot(logFlag = True)
/home/paul/anaconda3/envs/ePSproc-v1.2-dev/lib/python3.7/site-packages/xarray/core/nputils.py:223: RuntimeWarning: All-NaN slice encountered
  result = getattr(npmodule, name)(values, axis=axis, **kwargs)
/home/paul/anaconda3/envs/ePSproc-v1.2-dev/lib/python3.7/site-packages/xarray/core/computation.py:603: RuntimeWarning: invalid value encountered in log10
  result_data = func(*input_data)
Plotting data OCS_survey.orb11_E0.1_2.0_30.1eV.inp.out, pType=a, thres=0.01, with Seaborn
In [44]:
# Phase plot
data.lmPlotOpts = {'selDims':{'Type':'L', 'it':1}, 'cmap':'vlag', 'logFlag':False}
data.lmPlot(pType='phase')
/home/paul/anaconda3/envs/ePSproc-v1.2-dev/lib/python3.7/site-packages/xarray/core/nputils.py:223: RuntimeWarning: All-NaN slice encountered
  result = getattr(npmodule, name)(values, axis=axis, **kwargs)
Plotting data OCS_survey.orb11_E0.1_2.0_30.1eV.inp.out, pType=phase, thres=0.01, with Seaborn

MF-$\beta_{LM}$

In [129]:
data.MFBLM(selDims = {'Type':'L'})

# Note currently have issues with degenerate state: need to sum not select over these...
data.data['orb11']['MFBLMsum'] = data.data['orb11']['MFBLM'].sum('it')  # Manual fix!  Currently can't easily pass this through initial calc.
/home/paul/anaconda3/envs/ePSproc-v1.2-dev/lib/python3.7/site-packages/xarray/core/nputils.py:223: RuntimeWarning: All-NaN slice encountered
  result = getattr(npmodule, name)(values, axis=axis, **kwargs)
/home/paul/anaconda3/envs/ePSproc-v1.2-dev/lib/python3.7/site-packages/xarray/core/nputils.py:223: RuntimeWarning: All-NaN slice encountered
  result = getattr(npmodule, name)(values, axis=axis, **kwargs)
Return type BLM.
In [139]:
# Currently have ONE unphysical value for (l=0, E=0.1, z-pol) case, which blows up cmap...
# ACTUALLY, it's the renorm - defaults to showing unnormalised l=0!
data.lmPlotOpts = {'selDims':{}, 'cmap':'vlag', 'logFlag':False, 'SFflag':False}  # , 'Erange':[1.1,30.1]
data.lmPlot(dataType = 'MFBLMsum')

# Use functional version instead to subselect...
# ep.lmPlot(data.data['orb11']['MFBLM'].sel(Eke=slice(1.1,30.1)), cmap='vlag');
Set dataType (No dataType)
Plotting data (No filename), pType=a, thres=0.01, with Seaborn
In [141]:
# data.BLMplot(dataType='MFBLM', selDims={'it':1}, col=None, row='Labels', thres = 1e-2) 
data.BLMplot(dataType='MFBLMsum', col=None, row='Labels', thres = 1e-2) 
Dataset: orb11, # OCS, orb 11 ionization, basic survey run., MFBLMsum
In [143]:
# A couple of example MFPADs...

# For z-polarization (cylindrically symmetric)
data.padPlot(keys = 'orb11', Erange = [5, 20, 4], dataType='MFBLM', selDims = {'Labels':'z'})
Using default sph betas.
Summing over dims: {'it'}
Sph plots: Eke: 5.1, plotType: a
Plotting with mpl
Sph plots: Eke: 9.1, plotType: a
Plotting with mpl
Sph plots: Eke: 13.1, plotType: a
Plotting with mpl
Sph plots: Eke: 17.1, plotType: a
Plotting with mpl
In [152]:
# For z-polarization (cylindrically symmetric), full map with sum over phi coord.
data.padPlot(keys = 'orb11', dataType='MFBLM', selDims = {'Labels':'z'}, pStyle='grid', reducePhi='sum') #, squeeze=True)
Using default sph betas.
Summing over dims: {'it'}
Grid plot: # OCS, orb 11 ionization, basic survey run., dataType: MFBLM, plotType: a
In [144]:
# A couple of example MFPADs...

# For x-polarization (identical to y-pol, except frame rotation)
data.padPlot(keys = 'orb11', Erange = [5, 20, 4], dataType='MFBLM', selDims = {'Labels':'x'})
Using default sph betas.
Summing over dims: {'it'}
Sph plots: Eke: 5.1, plotType: a
Plotting with mpl
Sph plots: Eke: 9.1, plotType: a
Plotting with mpl
Sph plots: Eke: 13.1, plotType: a
Plotting with mpl
Sph plots: Eke: 17.1, plotType: a
Plotting with mpl

AF-$\beta_{LM}$

AF defaults tests - should match LF result above if all is working correctly

Current status: almost working, but issue with abs magnitudes and y component inversion (phase) - most likely due to issue with combining degenerate symmetry components.

Relative values and trends should be correct however.

TODO: debug this!

In [156]:
# Defaults - should match LFBLMs above
# Looks like renorm issue here however, B2 values /2...?
data.AFBLM()

# data.lmPlotOpts['selDims'] = {}  # Reset plot options
# data.lmPlotOpts['sumDims'] = {}
data.lmPlotOpts = {'selDims':{}, 'cmap':'vlag', 'logFlag':False}
data.lmPlot(dataType = 'AFBLM', SFflag = False)  # With sumDims B2 looks better... but B0 x2!
/home/paul/anaconda3/envs/ePSproc-v1.2-dev/lib/python3.7/site-packages/xarray/core/nputils.py:223: RuntimeWarning: All-NaN slice encountered
  result = getattr(npmodule, name)(values, axis=axis, **kwargs)
/home/paul/anaconda3/envs/ePSproc-v1.2-dev/lib/python3.7/site-packages/xarray/core/nputils.py:223: RuntimeWarning: All-NaN slice encountered
  result = getattr(npmodule, name)(values, axis=axis, **kwargs)
Plotting data OCS_survey.orb11_E0.1_2.0_30.1eV.inp.out, pType=a, thres=0.01, with Seaborn
In [157]:
# Defaults - should match LFBLMs above
# Looks like renorm issue here however, B2 values /2...?
data.AFBLM(selDims={'Type':'L'})

# Note currently have issues with degenerate state: need to sum not select over these...
data.data['orb11']['AFBLMsum'] = data.data['orb11']['AFBLM'].sum('it')  # Manual fix!  Currently can't easily pass this through initial calc.


# data.lmPlotOpts['selDims'] = {}  # Reset plot options
# data.lmPlotOpts['sumDims'] = {}
data.lmPlotOpts = {'selDims':{}, 'cmap':'vlag', 'logFlag':False}
data.lmPlot(dataType = 'AFBLMsum', SFflag = False)  # With sumDims B2 looks better... but B0 x2!
/home/paul/anaconda3/envs/ePSproc-v1.2-dev/lib/python3.7/site-packages/xarray/core/nputils.py:223: RuntimeWarning: All-NaN slice encountered
  result = getattr(npmodule, name)(values, axis=axis, **kwargs)
/home/paul/anaconda3/envs/ePSproc-v1.2-dev/lib/python3.7/site-packages/xarray/core/nputils.py:223: RuntimeWarning: All-NaN slice encountered
  result = getattr(npmodule, name)(values, axis=axis, **kwargs)
Set dataType (No dataType)
Plotting data (No filename), pType=a, thres=0.01, with Seaborn
In [158]:
# Here (z,x) cases are (almost) OK, y is inverted as it=2 component missing.
data.BLMplot(dataType='AFBLMsum', thres = 1e-2)
Dataset: orb11, # OCS, orb 11 ionization, basic survey run., AFBLMsum
In [71]:
# Defaults - should match LFBLMs above
# Looks like renorm issue here however, B2 values /2...?
# AH, might be default selector, selDims = {'Type':'L', 'it':1} - try overriding...

# data.AFBLM(selDims = {'Type':'L'}, sumDims = ['mu', 'mup', 'l','lp','m','mp','S-Rp', 'it']) # This fails at XR stack, not sure why
# Issue is at mTermSumThres['XSraw'] = mTermSumThres.sel({'L':0,'M':0}).drop('LM').copy() 
# Throws "KeyError: 3" from Xarray, maybe summing over LM accidentally?

# Try summing just for plotting...
data.AFBLM(selDims = {'Type':'L'})

data.lmPlotOpts = {'selDims':{}, 'sumDims':'it', 'cmap':'vlag', 'logFlag':False}
data.lmPlot(dataType = 'AFBLM', SFflag = False, sumDims = ['it'])  # With sumDims B2 looks better... but B0 x2!
/home/paul/anaconda3/envs/ePSproc-v1.2-dev/lib/python3.7/site-packages/xarray/core/nputils.py:223: RuntimeWarning: All-NaN slice encountered
  result = getattr(npmodule, name)(values, axis=axis, **kwargs)
/home/paul/anaconda3/envs/ePSproc-v1.2-dev/lib/python3.7/site-packages/xarray/core/nputils.py:223: RuntimeWarning: All-NaN slice encountered
  result = getattr(npmodule, name)(values, axis=axis, **kwargs)
Plotting data OCS_survey.orb11_E0.1_2.0_30.1eV.inp.out, pType=a, thres=0.01, with Seaborn
In [73]:
# Checking 'it' components - same issue after renorm, so phase/summation/renorm issue somewhere...!
data.BLMplot(dataType='AFBLM', selDims = {'it':1}, thres = 1e-2)
data.BLMplot(dataType='AFBLM', selDims = {'it':2}, thres = 1e-2)
Dataset: orb11, # OCS, orb 11 ionization, basic survey run., AFBLM
Dataset: orb11, # OCS, orb 11 ionization, basic survey run., AFBLM

AF for aligned cases...

In [165]:
# Set ADMs for increasing alignment...
tPoints = 10
# inputADMs = np.asarray([[0,0,0, *np.ones(10)], [2,0,0, *np.linspace(0,1,tPoints)], [4,0,0, *np.linspace(0,0.5,tPoints)]])
inputADMs = [[0,0,0, *np.ones(10)], [2,0,0, *np.linspace(0,1,tPoints)], [4,0,0, *np.linspace(0,0.5,tPoints)]]

ADMs = ep.setADMs(ADMs = inputADMs)
ep.lmPlot(ADMs, xDim='t');
No handles with labels found to put in legend.
Plotting data (No filename), pType=a, thres=0.01, with Seaborn
In [166]:
# Compute AFBLMs for aligned case
data.AFBLM(AKQS = ADMs, selDims = {'Type':'L'})
/home/paul/anaconda3/envs/ePSproc-v1.2-dev/lib/python3.7/site-packages/xarray/core/nputils.py:223: RuntimeWarning: All-NaN slice encountered
  result = getattr(npmodule, name)(values, axis=axis, **kwargs)
/home/paul/anaconda3/envs/ePSproc-v1.2-dev/lib/python3.7/site-packages/xarray/core/nputils.py:223: RuntimeWarning: All-NaN slice encountered
  result = getattr(npmodule, name)(values, axis=axis, **kwargs)
In [167]:
data.lmPlotOpts = {'selDims':{'Labels':'z'}, 'sumDims':'it', 'cmap':'vlag', 'logFlag':False}
data.lmPlot(dataType = 'AFBLM', SFflag = False, sumDims = ['it'])  # With sumDims B2 looks better... but B0 x2!
Plotting data OCS_survey.orb11_E0.1_2.0_30.1eV.inp.out, pType=a, thres=0.01, with Seaborn
In [168]:
# Slicing on l almost works, but messes up side labels (skips l)
# Plot looks OK, and labels should be same as above

data.lmPlotOpts = {'selDims':{'Labels':'z','l':slice(2,6)}, 'sumDims':'it', 'cmap':'vlag', 'logFlag':False, 'SFflag': False}
data.lmPlot(dataType = 'AFBLM')  # With sumDims B2 looks better... but B0 x2!
Plotting data OCS_survey.orb11_E0.1_2.0_30.1eV.inp.out, pType=a, thres=0.01, with Seaborn

Main conclusions (aside from needing to fix plotting routine...)

  • Increasing K=2,4 sharpens features in B2
  • Similarly brings up B4, B6... and eventually significant value start to appear.
  • For cylindrically symmetric case there is (obviously) no odd-L or non-zero m, although these are all prominent in MFPADs.

AF-PADs

Cylindrically symmetric z-pol case only, vs. (Eke, Theta) per t (alignment).

In [174]:
# Reduced phi maps vs. alignment (t) - CURRENTLY NOT WORKING, looks like selection ordering logic is problematic here...?
# ACTUALLY does work if Eke included in facetDims, not sure why however!
# For z-polarization (cylindrically symmetric), full map with sum over phi coord.
# data.padPlot(keys = 'orb11', dataType='AFBLM', selDims = {'Labels':'z'}, pStyle='grid', reducePhi='sum', facetDims=['t'], squeeze=True)
data.padPlot(keys = 'orb11', dataType='AFBLM', selDims = {'Labels':'z'}, pStyle='grid', reducePhi='sum', facetDims=['t', 'Eke'])
Using default sph betas.
Summing over dims: {'it'}
Grid plot: # OCS, orb 11 ionization, basic survey run., dataType: AFBLM, plotType: a

For the trial alignment parameters, these show mainly a feature growing in at $\theta=\pi/2$, and centered at E~15eV, as the degree of alignment increases, and some subtler changes around the poles (i.e. features close to $\theta=0,\pi$).

Versions

In [122]:
# print(data.jobInfo['ePolyScat'][0])
# print('Run: ' + jobInfo['Starting'][0].split('at')[1])
In [123]:
import scooby
scooby.Report(additional=['epsproc', 'xarray', 'jupyter'])
Out[123]:
Wed Jun 09 15:01:49 2021 EDT
OS Linux CPU(s) 64 Machine x86_64
Architecture 64bit Environment Jupyter
Python 3.7.5 (default, Oct 25 2019, 15:51:11) [GCC 7.3.0]
epsproc 1.3.0-dev xarray 0.14.0 jupyter Version unknown
numpy 1.17.3 scipy 1.3.1 IPython 7.9.0
matplotlib 3.1.3 scooby 0.5.6
Intel(R) Math Kernel Library Version 2019.0.4 Product Build 20190411 for Intel(R) 64 architecture applications
In [124]:
# Check current Git commit for local ePSproc version
!git -C {Path(ep.__file__).parent} branch
!git -C {Path(ep.__file__).parent} log --format="%H" -n 1
* dev
  master
16cfad26e658b740f267baa89d1550336b0134bf
In [125]:
# Check current remote commits
!git ls-remote --heads git://github.com/phockett/ePSproc
16cfad26e658b740f267baa89d1550336b0134bf	refs/heads/dev
82d12cf35b19882d4e9a2cde3d4009fe679cfaee	refs/heads/master
69cd89ce5bc0ad6d465a4bd8df6fba15d3fd1aee	refs/heads/numba-tests
ea30878c842f09d525fbf39fa269fa2302a13b57	refs/heads/revert-9-master
In [ ]: