orto 1.1.0__py3-none-any.whl → 1.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- orto/__version__.py +1 -1
- orto/cli.py +83 -46
- orto/extractor.py +62 -1
- orto/plotter.py +80 -26
- {orto-1.1.0.dist-info → orto-1.3.0.dist-info}/METADATA +2 -2
- orto-1.3.0.dist-info/RECORD +15 -0
- orto-1.1.0.dist-info/RECORD +0 -15
- {orto-1.1.0.dist-info → orto-1.3.0.dist-info}/WHEEL +0 -0
- {orto-1.1.0.dist-info → orto-1.3.0.dist-info}/entry_points.txt +0 -0
- {orto-1.1.0.dist-info → orto-1.3.0.dist-info}/top_level.txt +0 -0
orto/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '1.
|
|
1
|
+
__version__ = '1.3.0'
|
orto/cli.py
CHANGED
|
@@ -597,7 +597,7 @@ def plot_abs_func(uargs):
|
|
|
597
597
|
all_data = oe.OldAbsorptionElectricDipoleExtractor.extract(
|
|
598
598
|
uargs.output_file
|
|
599
599
|
)
|
|
600
|
-
|
|
600
|
+
elif uargs.intensity_type == 'velocity':
|
|
601
601
|
all_data = oe.OldAbsorptionVelocityDipoleExtractor.extract(
|
|
602
602
|
uargs.output_file
|
|
603
603
|
)
|
|
@@ -606,65 +606,50 @@ def plot_abs_func(uargs):
|
|
|
606
606
|
all_data = oe.AbsorptionElectricDipoleExtractor.extract(
|
|
607
607
|
uargs.output_file
|
|
608
608
|
)
|
|
609
|
-
|
|
609
|
+
elif uargs.intensity_type == 'velocity':
|
|
610
610
|
all_data = oe.AbsorptionVelocityDipoleExtractor.extract(
|
|
611
611
|
uargs.output_file
|
|
612
612
|
)
|
|
613
|
+
elif uargs.intensity_type == 'semi-classical':
|
|
614
|
+
all_data = oe.AbsorptionSemiClassicalDipoleExtractor.extract(
|
|
615
|
+
uargs.output_file
|
|
616
|
+
)
|
|
613
617
|
|
|
614
618
|
# Plot each section
|
|
615
619
|
for it, data in enumerate(all_data):
|
|
616
620
|
|
|
617
|
-
if uargs.x_lim is None:
|
|
618
|
-
if uargs.x_unit == 'wavenumber':
|
|
619
|
-
uargs.x_lim = [0, max(data['energy (cm^-1)'])]
|
|
620
|
-
if uargs.x_unit == 'wavelength':
|
|
621
|
-
# 1 to 2000 nm
|
|
622
|
-
uargs.x_lim = [5000., 10000000.]
|
|
623
|
-
|
|
624
|
-
if uargs.x_cut is None:
|
|
625
|
-
iup = -2
|
|
626
|
-
ilow = 0
|
|
627
|
-
else:
|
|
628
|
-
ilow = min(
|
|
629
|
-
[
|
|
630
|
-
it
|
|
631
|
-
for it, val in enumerate(data['energy (cm^-1)'])
|
|
632
|
-
if (val - uargs.x_cut[0]) > 0
|
|
633
|
-
]
|
|
634
|
-
)
|
|
635
|
-
iup = max(
|
|
636
|
-
[
|
|
637
|
-
it
|
|
638
|
-
for it, val in enumerate(data['energy (cm^-1)'])
|
|
639
|
-
if (uargs.x_cut[1] - val) > 0
|
|
640
|
-
]
|
|
641
|
-
)
|
|
642
|
-
|
|
643
621
|
if len(all_data) > 1:
|
|
644
622
|
save_name = f'absorption_spectrum_section_{it:d}.png'
|
|
645
623
|
else:
|
|
646
|
-
save_name = '
|
|
624
|
+
save_name = 'absorption_spectrum.png'
|
|
625
|
+
|
|
626
|
+
if uargs.x_unit == 'wavenumber':
|
|
627
|
+
x_values = data['energy (cm^-1)']
|
|
628
|
+
elif uargs.x_unit == 'wavelength':
|
|
629
|
+
x_values = 1E7 / data['energy (cm^-1)']
|
|
630
|
+
elif uargs.x_unit == 'energy':
|
|
631
|
+
x_values = data['energy (ev)']
|
|
647
632
|
|
|
648
633
|
# Plot absorption spectrum
|
|
649
634
|
fig, ax = plotter.plot_abs(
|
|
650
|
-
|
|
651
|
-
|
|
635
|
+
x_values,
|
|
636
|
+
uargs.x_unit,
|
|
637
|
+
data['fosc'],
|
|
652
638
|
show=_SHOW_CONV[uargs.plot],
|
|
653
639
|
save=_SAVE_CONV[uargs.plot],
|
|
654
640
|
save_name=save_name,
|
|
655
641
|
x_lim=uargs.x_lim,
|
|
656
642
|
y_lim=uargs.y_lim,
|
|
657
|
-
|
|
643
|
+
x_shift=uargs.shift,
|
|
658
644
|
linewidth=uargs.linewidth,
|
|
659
645
|
lineshape=uargs.lineshape,
|
|
660
646
|
window_title=f'Absorption Spectrum from {uargs.output_file}',
|
|
661
|
-
show_osc=not uargs.no_osc
|
|
647
|
+
show_osc=not uargs.no_osc,
|
|
648
|
+
normalise=uargs.normalise_absorption
|
|
662
649
|
)
|
|
663
650
|
|
|
664
651
|
if uargs.x_unit == 'wavenumber':
|
|
665
652
|
ax[0].set_xlim([0, 50000])
|
|
666
|
-
if uargs.x_unit == 'wavelength':
|
|
667
|
-
ax[0].set_xlim([0, 2000])
|
|
668
653
|
plt.show()
|
|
669
654
|
|
|
670
655
|
return
|
|
@@ -857,9 +842,22 @@ def extract_orbs_func(uargs, save=True) -> None:
|
|
|
857
842
|
dtype=int
|
|
858
843
|
)
|
|
859
844
|
])
|
|
845
|
+
elif uargs.num is not None:
|
|
846
|
+
keep = uargs.num
|
|
860
847
|
else:
|
|
861
848
|
keep = range(len(contributions))
|
|
862
849
|
|
|
850
|
+
# Remove orbital indices which do not exist
|
|
851
|
+
keep = [val for val in keep if val < len(contributions)]
|
|
852
|
+
|
|
853
|
+
if not len(keep):
|
|
854
|
+
ut.red_exit(
|
|
855
|
+
(
|
|
856
|
+
r'Selected orbital indices do not exist!'
|
|
857
|
+
f'\nNORBS = {len(contributions):d}'
|
|
858
|
+
)
|
|
859
|
+
)
|
|
860
|
+
|
|
863
861
|
contributions = contributions.loc[:, keep]
|
|
864
862
|
|
|
865
863
|
# Remove contributions from unwanted orbitals
|
|
@@ -1609,8 +1607,9 @@ def read_args(arg_list=None):
|
|
|
1609
1607
|
|
|
1610
1608
|
plot_abs.add_argument(
|
|
1611
1609
|
'--intensity_type',
|
|
1610
|
+
'-i',
|
|
1612
1611
|
type=str,
|
|
1613
|
-
choices=['velocity', 'electric'],
|
|
1612
|
+
choices=['velocity', 'electric', 'semi-classical'],
|
|
1614
1613
|
default='electric',
|
|
1615
1614
|
help='Type of intensity to plot (orca_mapspc uses electric)'
|
|
1616
1615
|
)
|
|
@@ -1663,32 +1662,46 @@ def read_args(arg_list=None):
|
|
|
1663
1662
|
plot_abs.add_argument(
|
|
1664
1663
|
'--x_unit',
|
|
1665
1664
|
type=str,
|
|
1666
|
-
choices=['wavenumber', 'wavelength'],
|
|
1665
|
+
choices=['wavenumber', 'energy', 'wavelength'],
|
|
1667
1666
|
default='wavenumber',
|
|
1668
1667
|
help='x units to use for spectrum'
|
|
1669
1668
|
)
|
|
1670
1669
|
|
|
1671
1670
|
plot_abs.add_argument(
|
|
1672
|
-
'--
|
|
1671
|
+
'--shift',
|
|
1673
1672
|
type=float,
|
|
1674
|
-
|
|
1675
|
-
help=
|
|
1673
|
+
default=0.,
|
|
1674
|
+
help=(
|
|
1675
|
+
'Shift spectrum by this amount in x units\n'
|
|
1676
|
+
'Default: %(default)s'
|
|
1677
|
+
)
|
|
1676
1678
|
)
|
|
1677
1679
|
|
|
1678
1680
|
plot_abs.add_argument(
|
|
1679
|
-
'--
|
|
1680
|
-
type=float,
|
|
1681
|
+
'--x_lim',
|
|
1681
1682
|
nargs=2,
|
|
1682
|
-
|
|
1683
|
+
default=['auto', 'auto'],
|
|
1684
|
+
help='x limits of spectrum'
|
|
1683
1685
|
)
|
|
1684
1686
|
|
|
1685
1687
|
plot_abs.add_argument(
|
|
1686
1688
|
'--y_lim',
|
|
1687
1689
|
nargs=2,
|
|
1688
|
-
default=[
|
|
1690
|
+
default=[0., 'auto'],
|
|
1689
1691
|
help='Epsilon limits of spectrum in cm^-1 mol^-1 L'
|
|
1690
1692
|
)
|
|
1691
1693
|
|
|
1694
|
+
plot_abs.add_argument(
|
|
1695
|
+
'--normalise_absorption',
|
|
1696
|
+
'-na',
|
|
1697
|
+
action='store_true',
|
|
1698
|
+
default=False,
|
|
1699
|
+
help=(
|
|
1700
|
+
'Normalises absorption spectrum to maximum value\n'
|
|
1701
|
+
'Default: %(default)s'
|
|
1702
|
+
)
|
|
1703
|
+
)
|
|
1704
|
+
|
|
1692
1705
|
plot_ailft = plot_parser.add_parser(
|
|
1693
1706
|
'ailft_orbs',
|
|
1694
1707
|
description='Plots AI-LFT orbital energies from output file',
|
|
@@ -1898,7 +1911,7 @@ def read_args(arg_list=None):
|
|
|
1898
1911
|
default=5,
|
|
1899
1912
|
help=(
|
|
1900
1913
|
'Width of signal (FWHM for Gaussian, Width for Lorentzian),'
|
|
1901
|
-
' in
|
|
1914
|
+
' in same unit as plot x unit'
|
|
1902
1915
|
)
|
|
1903
1916
|
)
|
|
1904
1917
|
|
|
@@ -2080,13 +2093,37 @@ def read_args(arg_list=None):
|
|
|
2080
2093
|
)
|
|
2081
2094
|
)
|
|
2082
2095
|
|
|
2096
|
+
def gte_zero(x):
|
|
2097
|
+
'''
|
|
2098
|
+
Custom type for argparse to ensure that the input
|
|
2099
|
+
\nis greater than or equal to zero
|
|
2100
|
+
'''
|
|
2101
|
+
value = int(x)
|
|
2102
|
+
if value < 0:
|
|
2103
|
+
raise argparse.ArgumentTypeError(
|
|
2104
|
+
f'{x} is not a valid index (must be >= 0)'
|
|
2105
|
+
)
|
|
2106
|
+
return value
|
|
2107
|
+
|
|
2108
|
+
orb_group.add_argument(
|
|
2109
|
+
'-n',
|
|
2110
|
+
'--num',
|
|
2111
|
+
nargs='+',
|
|
2112
|
+
type=gte_zero,
|
|
2113
|
+
metavar='NUMBER',
|
|
2114
|
+
default=None,
|
|
2115
|
+
help=(
|
|
2116
|
+
'Print specified orbitals using index starting from 0\n'
|
|
2117
|
+
'(same as Orca)\n'
|
|
2118
|
+
)
|
|
2119
|
+
)
|
|
2120
|
+
|
|
2083
2121
|
orb_group.add_argument(
|
|
2084
2122
|
'-hl',
|
|
2085
2123
|
'--homo_lumo',
|
|
2086
2124
|
nargs='?',
|
|
2087
2125
|
type=int,
|
|
2088
2126
|
metavar='NUMBER',
|
|
2089
|
-
const=0,
|
|
2090
2127
|
default=None,
|
|
2091
2128
|
help=(
|
|
2092
2129
|
'Print specified number of orbitals either side of HOMO and LUMO'
|
orto/extractor.py
CHANGED
|
@@ -1359,7 +1359,7 @@ class AbsorptionElectricDipoleExtractor(extto.BetweenExtractor):
|
|
|
1359
1359
|
'''
|
|
1360
1360
|
|
|
1361
1361
|
result = re.findall(
|
|
1362
|
-
r'\s+(\d
|
|
1362
|
+
r'\s+(\d+[A-Za-z]*-\d*[A-Za-z]\s+->\s+\d+[A-Za-z]*-\d*[A-Za-z])\s+(\d+\.\d+)\s+(\d+\.\d+)\s+(\d+\.\d+)\s+(\d+\.\d+)\s+(\d\.\d{5})\s+(-*\d\.\d{5})\s+(-*\d\.\d{5})\s+(-*\d\.\d{5})', # noqa
|
|
1363
1363
|
block
|
|
1364
1364
|
)
|
|
1365
1365
|
|
|
@@ -1415,6 +1415,67 @@ class AbsorptionVelocityDipoleExtractor(AbsorptionElectricDipoleExtractor):
|
|
|
1415
1415
|
END_PATTERN = rb'(?=-{77})'
|
|
1416
1416
|
|
|
1417
1417
|
|
|
1418
|
+
class AbsorptionSemiClassicalDipoleExtractor(AbsorptionElectricDipoleExtractor): # noqa
|
|
1419
|
+
'''
|
|
1420
|
+
Extracts ABSORPTION SPECTRUM VIA FULL SEMI-CLASSICAL FORMULATION table
|
|
1421
|
+
from ORCA output file for versions newer than 6.
|
|
1422
|
+
'''
|
|
1423
|
+
|
|
1424
|
+
# Regex Start Pattern
|
|
1425
|
+
START_PATTERN = rb'(?<=ABSORPTION SPECTRUM VIA FULL SEMI-CLASSICAL FORMULATION\s[\S\s]{408}\s)' # noqa
|
|
1426
|
+
|
|
1427
|
+
# Regex End Pattern
|
|
1428
|
+
END_PATTERN = rb'(?=-{77})'
|
|
1429
|
+
|
|
1430
|
+
@property
|
|
1431
|
+
def data(self) -> dict[str, list[str | float]]:
|
|
1432
|
+
'''
|
|
1433
|
+
Absorption spectrum data:\n
|
|
1434
|
+
A dictionary with keys:\n
|
|
1435
|
+
transition\n
|
|
1436
|
+
energy (cm^-1)\n
|
|
1437
|
+
energy (ev)\n
|
|
1438
|
+
wavelength (nm)\n
|
|
1439
|
+
fosc\n
|
|
1440
|
+
All values are list[float], but 'transition' entries are list[str]
|
|
1441
|
+
'''
|
|
1442
|
+
return self._data
|
|
1443
|
+
|
|
1444
|
+
@staticmethod
|
|
1445
|
+
def _process_block(block: str) -> dict[str, list[int | float]]: # noqa
|
|
1446
|
+
'''
|
|
1447
|
+
Converts single block into data entries described in self.data
|
|
1448
|
+
|
|
1449
|
+
Parameters
|
|
1450
|
+
----------
|
|
1451
|
+
block: str
|
|
1452
|
+
String block extracted from file
|
|
1453
|
+
|
|
1454
|
+
Returns
|
|
1455
|
+
-------
|
|
1456
|
+
dict[str, list[float]]
|
|
1457
|
+
'''
|
|
1458
|
+
|
|
1459
|
+
result = re.findall(
|
|
1460
|
+
r'\s+(\d+[A-Za-z]*-\d*[A-Za-z]\s+->\s+\d+[A-Za-z]*-\d*[A-Za-z])\s+(\d+\.\d+)\s+(\d+\.\d+)\s+(\d+\.\d+)\s+(\d+\.\d+)', # noqa
|
|
1461
|
+
block
|
|
1462
|
+
)
|
|
1463
|
+
|
|
1464
|
+
result = np.asarray(result, dtype=str).T
|
|
1465
|
+
|
|
1466
|
+
fresult = result[1:].astype(float)
|
|
1467
|
+
|
|
1468
|
+
data = {
|
|
1469
|
+
'state': result[0].tolist(),
|
|
1470
|
+
'energy (ev)': fresult[0].tolist(),
|
|
1471
|
+
'energy (cm^-1)': fresult[1].tolist(),
|
|
1472
|
+
'wavelength (nm)': fresult[2].tolist(),
|
|
1473
|
+
'fosc': fresult[3].tolist(),
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
return data
|
|
1477
|
+
|
|
1478
|
+
|
|
1418
1479
|
class OldAbsorptionElectricDipoleExtractor(extto.BetweenExtractor):
|
|
1419
1480
|
'''
|
|
1420
1481
|
Extracts ABSORPTION SPECTRUM VIA TRANSITION ELECTRIC DIPOLE MOMENTS table
|
orto/plotter.py
CHANGED
|
@@ -75,35 +75,43 @@ def lorentzian(p: ArrayLike, fwhm, p0, area) -> NDArray:
|
|
|
75
75
|
return lor
|
|
76
76
|
|
|
77
77
|
|
|
78
|
-
def plot_abs(
|
|
78
|
+
def plot_abs(x_values: ArrayLike, x_type: str, foscs: ArrayLike,
|
|
79
79
|
lineshape: str = 'gaussian', linewidth: float = 100.,
|
|
80
|
-
x_lim: list[float] =
|
|
81
|
-
abs_type: str = 'napierian',
|
|
80
|
+
x_lim: list[float] = ['auto', 'auto'],
|
|
81
|
+
abs_type: str = 'napierian',
|
|
82
|
+
y_lim: list[float] = [0., 'auto'],
|
|
83
|
+
x_shift: float = 0., normalise: bool = False,
|
|
82
84
|
show_osc: bool = True, save: bool = False,
|
|
83
85
|
save_name: str = 'absorption_spectrum.png', show: bool = False,
|
|
84
86
|
window_title: str = 'Absorption Spectrum') -> tuple[plt.Figure, list[plt.Axes]]: # noqa
|
|
85
87
|
'''
|
|
86
|
-
Plots absorption spectrum with oscillator
|
|
88
|
+
Plots absorption spectrum with intensity specified by oscillator strength.\n # noqa
|
|
89
|
+
Spectrum is computed as a sum of Gaussian or Lorentzian lineshapes.\n
|
|
90
|
+
The x_values can be either wavenumbers [cm^-1], wavelengths [nm] or\n
|
|
91
|
+
energies [eV].\n
|
|
87
92
|
|
|
88
93
|
Parameters
|
|
89
94
|
----------
|
|
90
|
-
|
|
91
|
-
|
|
95
|
+
x_values: array_like
|
|
96
|
+
x_values for each transition, either wavenumber, wavelength or energy\n
|
|
97
|
+
with unit type specified by x_type
|
|
98
|
+
x_type: str {'wavenumber', 'wavelength', 'energy'}
|
|
99
|
+
Type of x_values, either wavenumber [cm^-1], wavelength [nm] or\n
|
|
100
|
+
energy [eV].
|
|
92
101
|
foscs: array_like
|
|
93
102
|
Oscillator strength of each transition
|
|
94
103
|
lineshape: str {'gaussian', 'lorentzian'}
|
|
95
104
|
Lineshape function to use for each transition/signal
|
|
96
105
|
linewidth: float
|
|
97
106
|
Linewidth used in lineshape [cm^-1]
|
|
98
|
-
x_lim: list[float], default [
|
|
107
|
+
x_lim: list[float], default ['auto', 'auto']
|
|
99
108
|
Minimum and maximum x-values to plot [cm^-1 or nm]
|
|
100
|
-
y_lim: list[float | str], default 'auto'
|
|
109
|
+
y_lim: list[float | str], default [0., 'auto']
|
|
101
110
|
Minimum and maximum y-values to plot [cm^-1 mol^-1 L]
|
|
102
|
-
x_unit: str {'wavenumber', 'wavelength'}
|
|
103
|
-
X-unit to use, data will be converted internally.\n
|
|
104
|
-
Assumes cm^-1 for wavenumber and nm for wavelength.
|
|
105
111
|
abs_type: str {'napierian', 'logarithmic'}
|
|
106
112
|
Absorbance (and epsilon) type to use. Orca_mapspc uses napierian
|
|
113
|
+
normalise: bool, default False
|
|
114
|
+
If True, normalise the absorption spectrum to the maximum value.
|
|
107
115
|
show_osc: bool, default True
|
|
108
116
|
If True, show oscillator strength stemplots
|
|
109
117
|
save: bool, default False
|
|
@@ -114,6 +122,7 @@ def plot_abs(wavenumbers: ArrayLike, foscs: ArrayLike,
|
|
|
114
122
|
If True, plot is shown on screen
|
|
115
123
|
window_title: str, default 'UV-Visible Absorption Spectrum'
|
|
116
124
|
Title of figure window, not of plot
|
|
125
|
+
|
|
117
126
|
Returns
|
|
118
127
|
-------
|
|
119
128
|
plt.Figure
|
|
@@ -123,6 +132,11 @@ def plot_abs(wavenumbers: ArrayLike, foscs: ArrayLike,
|
|
|
123
132
|
Matplotlib Axis object for twinx oscillator strength axis
|
|
124
133
|
'''
|
|
125
134
|
|
|
135
|
+
x_values = np.asarray(x_values) + x_shift
|
|
136
|
+
foscs = np.asarray(foscs)
|
|
137
|
+
if len(x_values) != len(foscs):
|
|
138
|
+
raise ValueError('x_values and foscs must have the same length')
|
|
139
|
+
|
|
126
140
|
fig, ax = plt.subplots(1, 1, num=window_title)
|
|
127
141
|
|
|
128
142
|
ls_func = {
|
|
@@ -130,7 +144,38 @@ def plot_abs(wavenumbers: ArrayLike, foscs: ArrayLike,
|
|
|
130
144
|
'lorentzian': lorentzian
|
|
131
145
|
}
|
|
132
146
|
|
|
133
|
-
|
|
147
|
+
if not isinstance(x_lim, list):
|
|
148
|
+
raise ValueError('`x_lim` must be a list of values')
|
|
149
|
+
|
|
150
|
+
if x_lim[0] != x_lim[1]:
|
|
151
|
+
if isinstance(x_lim[0], str):
|
|
152
|
+
if x_lim[0] == 'auto':
|
|
153
|
+
x_lim[0] = ax.get_ylim()[0]
|
|
154
|
+
else:
|
|
155
|
+
x_lim[0] = float(x_lim[0])
|
|
156
|
+
if isinstance(x_lim[1], str):
|
|
157
|
+
if x_lim[1] == 'auto':
|
|
158
|
+
x_lim[1] = ax.get_ylim()[1]
|
|
159
|
+
else:
|
|
160
|
+
x_lim[1] = float(x_lim[1])
|
|
161
|
+
else:
|
|
162
|
+
x_lim = [np.min(x_values), np.max(x_values)]
|
|
163
|
+
|
|
164
|
+
# Set limits and range of continuous variable
|
|
165
|
+
ax.set_xlim([x_lim[0], x_lim[1]])
|
|
166
|
+
x_grid = np.linspace(x_lim[0], x_lim[1], 100000)
|
|
167
|
+
|
|
168
|
+
# Exclude values of x_values out of the range of x_lim
|
|
169
|
+
x_values = np.asarray(
|
|
170
|
+
[val for val in x_values if x_lim[0] <= val <= x_lim[1]]
|
|
171
|
+
)
|
|
172
|
+
# Exclude oscillator strengths for those values
|
|
173
|
+
foscs = np.asarray(
|
|
174
|
+
[
|
|
175
|
+
fosc
|
|
176
|
+
for val, fosc in zip(x_values, foscs)
|
|
177
|
+
if x_lim[0] <= val <= x_lim[1]]
|
|
178
|
+
)
|
|
134
179
|
|
|
135
180
|
# Conversion from oscillator strength to napierian integrated absorption
|
|
136
181
|
# coefficient
|
|
@@ -143,26 +188,29 @@ def plot_abs(wavenumbers: ArrayLike, foscs: ArrayLike,
|
|
|
143
188
|
|
|
144
189
|
# Spectrum as sum of signals. Always computed in wavenumbers.
|
|
145
190
|
spectrum = np.sum([
|
|
146
|
-
ls_func[lineshape](
|
|
147
|
-
for x_value, A_log in zip(
|
|
191
|
+
ls_func[lineshape](x_grid, linewidth, x_value, A_log)
|
|
192
|
+
for x_value, A_log in zip(x_values, A_logs)
|
|
148
193
|
], axis=0)
|
|
149
194
|
|
|
150
|
-
|
|
195
|
+
if normalise:
|
|
196
|
+
# Normalise the spectrum to the maximum value
|
|
197
|
+
spectrum /= np.max(spectrum)
|
|
198
|
+
ax.set_ylabel('Normalised Absorbance (arbitrary units)') # noqa
|
|
199
|
+
else:
|
|
200
|
+
ax.set_ylabel(r'$\epsilon$ (cm$^\mathregular{-1}$ mol$^\mathregular{-1}$ L)') # noqa
|
|
151
201
|
|
|
152
|
-
|
|
153
|
-
if x_unit == 'wavelength':
|
|
154
|
-
x_range = 1E7 / x_range
|
|
155
|
-
wavenumbers = [1E7 / wn for wn in wavenumbers]
|
|
202
|
+
np.savetxt('spectrum.txt', np.vstack([x_grid, spectrum]).T, fmt='%.5f')
|
|
156
203
|
|
|
157
204
|
# Main spectrum
|
|
158
|
-
ax.plot(
|
|
205
|
+
ax.plot(x_grid, spectrum, color='k')
|
|
159
206
|
|
|
160
207
|
if show_osc:
|
|
161
208
|
fax = ax.twinx()
|
|
162
209
|
# Oscillator strength twin axis
|
|
163
|
-
plt.stem(
|
|
210
|
+
plt.stem(x_values, foscs, basefmt=' ')
|
|
164
211
|
fax.yaxis.set_minor_locator(AutoMinorLocator())
|
|
165
212
|
fax.set_ylabel(r'$f_\mathregular{osc}$')
|
|
213
|
+
fax.set_ylim([0., fax.get_ylim()[1]])
|
|
166
214
|
else:
|
|
167
215
|
fax = None
|
|
168
216
|
plt.subplots_adjust(right=0.2)
|
|
@@ -171,21 +219,27 @@ def plot_abs(wavenumbers: ArrayLike, foscs: ArrayLike,
|
|
|
171
219
|
|
|
172
220
|
if y_lim[0] != y_lim[1]:
|
|
173
221
|
if isinstance(y_lim[0], str):
|
|
174
|
-
y_lim[0]
|
|
222
|
+
if y_lim[0] == 'auto':
|
|
223
|
+
y_lim[0] = ax.get_ylim()[0]
|
|
224
|
+
else:
|
|
225
|
+
y_lim[0] = float(y_lim[0])
|
|
175
226
|
if isinstance(y_lim[1], str):
|
|
176
|
-
y_lim[1]
|
|
227
|
+
if y_lim[1] == 'auto':
|
|
228
|
+
y_lim[1] = ax.get_ylim()[1]
|
|
229
|
+
else:
|
|
230
|
+
y_lim[1] = float(y_lim[1])
|
|
177
231
|
ax.set_ylim([y_lim[0], y_lim[1]])
|
|
178
232
|
|
|
179
233
|
ax.xaxis.set_minor_locator(AutoMinorLocator())
|
|
180
234
|
ax.yaxis.set_minor_locator(AutoMinorLocator())
|
|
181
235
|
|
|
182
|
-
|
|
236
|
+
xtype_to_label = {
|
|
183
237
|
'wavenumber': r'Wavenumber (cm$^\mathregular{-1}$)',
|
|
184
238
|
'wavelength': 'Wavelength (nm)',
|
|
239
|
+
'energy': r'Energy (eV)'
|
|
185
240
|
}
|
|
186
241
|
|
|
187
|
-
ax.set_xlabel(
|
|
188
|
-
ax.set_ylabel(r'$\epsilon$ (cm$^\mathregular{-1}$ mol$^\mathregular{-1}$ L)') # noqa
|
|
242
|
+
ax.set_xlabel(xtype_to_label[x_type.lower()])
|
|
189
243
|
|
|
190
244
|
fig.tight_layout()
|
|
191
245
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: orto
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: A package to make life easier when performing Orca calculations.
|
|
5
5
|
Home-page: https://orto.kragskow.group
|
|
6
6
|
Author: Jon Kragskow
|
|
@@ -15,7 +15,7 @@ Description-Content-Type: text/markdown
|
|
|
15
15
|
Requires-Dist: numpy>=2.1.2
|
|
16
16
|
Requires-Dist: xyz_py>=5.13.1
|
|
17
17
|
Requires-Dist: matplotlib>=3.9.2
|
|
18
|
-
Requires-Dist: extto>=1.0.
|
|
18
|
+
Requires-Dist: extto>=1.0.1
|
|
19
19
|
Requires-Dist: pandas>=2.2.3
|
|
20
20
|
Requires-Dist: subto>=0.1.1
|
|
21
21
|
Requires-Dist: python-docx>=1.1.2
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
orto/__init__.py,sha256=IedlltYr3qYZxChNUdz62qogXA9Pos_MUvXdGXqAa0E,41
|
|
2
|
+
orto/__version__.py,sha256=zi_LaUT_OsChAtsPXbOeRpQkCohSsOyeXfavQPM0GoE,22
|
|
3
|
+
orto/cli.py,sha256=_PVQjeH1mIy_P-WegHllvpGWzhNaEpQuAA8Ht-PkLKQ,63161
|
|
4
|
+
orto/constants.py,sha256=2obWYg306Lce4U9Qs4MHg1yZq7SHFkazG-cnkD5svpo,343
|
|
5
|
+
orto/exceptions.py,sha256=D7oNeAEGeJNt5thzt6PaCn5FY6JcbJOWUE1N1LVhhuE,159
|
|
6
|
+
orto/extractor.py,sha256=NJaqpH6iLtzEMuYGJrpbZ5vKJrtE5rQOXLLPjm0acGQ,69536
|
|
7
|
+
orto/input.py,sha256=N8JbySSVEC_qmXZ7ppJsZ7Z1qel6PfalGYRtnX1hJ6U,9900
|
|
8
|
+
orto/job.py,sha256=SM0nlc_bqhhPvfuuykhMvaUnkwC3Gp-6RvYw_a0TyGc,5855
|
|
9
|
+
orto/plotter.py,sha256=vXEfFLxdejt0YbKgCI4PUgBBX3a7SfGlqOQY0Mh4Wak,17562
|
|
10
|
+
orto/utils.py,sha256=gVfGplkfc6xGYgLMi_7I_yAdWG-QKRaqQdy9v5F4Mck,7279
|
|
11
|
+
orto-1.3.0.dist-info/METADATA,sha256=1fJYXo4-HhO0oB_CPjen8HldS-iatuOeSzm7KDiHLB0,1140
|
|
12
|
+
orto-1.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
13
|
+
orto-1.3.0.dist-info/entry_points.txt,sha256=HXenCglMp_03JkN34pK2phkjXK9CFcXTGHKv5QaVY8I,39
|
|
14
|
+
orto-1.3.0.dist-info/top_level.txt,sha256=hQ-z28gTN_FZ2B5Kiwxr_9cUTcCoib9W5HjbkceDXw4,5
|
|
15
|
+
orto-1.3.0.dist-info/RECORD,,
|
orto-1.1.0.dist-info/RECORD
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
orto/__init__.py,sha256=IedlltYr3qYZxChNUdz62qogXA9Pos_MUvXdGXqAa0E,41
|
|
2
|
-
orto/__version__.py,sha256=b6-WiVk0Li5MaV2rBnHYl104TsouINojSWKqHDas0js,22
|
|
3
|
-
orto/cli.py,sha256=ywJuTP9X_hyD4bEwxU5vVkLDQm4YJGsWaLZ8TFCNxeo,62167
|
|
4
|
-
orto/constants.py,sha256=2obWYg306Lce4U9Qs4MHg1yZq7SHFkazG-cnkD5svpo,343
|
|
5
|
-
orto/exceptions.py,sha256=D7oNeAEGeJNt5thzt6PaCn5FY6JcbJOWUE1N1LVhhuE,159
|
|
6
|
-
orto/extractor.py,sha256=aeZK130lBIERS4Pj1jvTlxCwVB_AhFLUB16zQrDhcbM,67767
|
|
7
|
-
orto/input.py,sha256=N8JbySSVEC_qmXZ7ppJsZ7Z1qel6PfalGYRtnX1hJ6U,9900
|
|
8
|
-
orto/job.py,sha256=SM0nlc_bqhhPvfuuykhMvaUnkwC3Gp-6RvYw_a0TyGc,5855
|
|
9
|
-
orto/plotter.py,sha256=ICrO03T_HGe-H1XKZ2qzsKYdPY44E0PKiXqIQQawd7I,15633
|
|
10
|
-
orto/utils.py,sha256=gVfGplkfc6xGYgLMi_7I_yAdWG-QKRaqQdy9v5F4Mck,7279
|
|
11
|
-
orto-1.1.0.dist-info/METADATA,sha256=TfXaxaTmcxbT1fbq5yQI9r24aV_1g7P0cj4g9mZlxic,1140
|
|
12
|
-
orto-1.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
13
|
-
orto-1.1.0.dist-info/entry_points.txt,sha256=HXenCglMp_03JkN34pK2phkjXK9CFcXTGHKv5QaVY8I,39
|
|
14
|
-
orto-1.1.0.dist-info/top_level.txt,sha256=hQ-z28gTN_FZ2B5Kiwxr_9cUTcCoib9W5HjbkceDXw4,5
|
|
15
|
-
orto-1.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|