orto 1.5.0__tar.gz → 1.6.1__tar.gz
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-1.6.1/LICENSE +165 -0
- {orto-1.5.0 → orto-1.6.1}/PKG-INFO +3 -1
- orto-1.6.1/orto/__version__.py +1 -0
- {orto-1.5.0 → orto-1.6.1}/orto/cli.py +222 -43
- {orto-1.5.0 → orto-1.6.1}/orto/constants.py +2 -0
- orto-1.6.1/orto/data.py +356 -0
- {orto-1.5.0 → orto-1.6.1}/orto/extractor.py +151 -10
- {orto-1.5.0 → orto-1.6.1}/orto/plotter.py +124 -200
- {orto-1.5.0 → orto-1.6.1}/orto/utils.py +124 -0
- {orto-1.5.0 → orto-1.6.1}/orto.egg-info/PKG-INFO +3 -1
- {orto-1.5.0 → orto-1.6.1}/orto.egg-info/SOURCES.txt +3 -0
- {orto-1.5.0 → orto-1.6.1}/setup.py +1 -1
- orto-1.5.0/orto/__version__.py +0 -1
- {orto-1.5.0 → orto-1.6.1}/README.md +0 -0
- {orto-1.5.0 → orto-1.6.1}/orto/__init__.py +0 -0
- {orto-1.5.0 → orto-1.6.1}/orto/exceptions.py +0 -0
- {orto-1.5.0 → orto-1.6.1}/orto/input.py +0 -0
- {orto-1.5.0 → orto-1.6.1}/orto/job.py +0 -0
- {orto-1.5.0 → orto-1.6.1}/orto.egg-info/dependency_links.txt +0 -0
- {orto-1.5.0 → orto-1.6.1}/orto.egg-info/entry_points.txt +0 -0
- {orto-1.5.0 → orto-1.6.1}/orto.egg-info/requires.txt +0 -0
- {orto-1.5.0 → orto-1.6.1}/orto.egg-info/top_level.txt +0 -0
- {orto-1.5.0 → orto-1.6.1}/pyproject.toml +0 -0
- {orto-1.5.0 → orto-1.6.1}/setup.cfg +0 -0
orto-1.6.1/LICENSE
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
11
|
+
License, supplemented by the additional permissions listed below.
|
|
12
|
+
|
|
13
|
+
0. Additional Definitions.
|
|
14
|
+
|
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
|
20
|
+
other than an Application or a Combined Work as defined below.
|
|
21
|
+
|
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
+
of using an interface provided by the Library.
|
|
26
|
+
|
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
+
Application with the Library. The particular version of the Library
|
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
|
30
|
+
Version".
|
|
31
|
+
|
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
+
based on the Application, and not on the Linked Version.
|
|
36
|
+
|
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
+
object code and/or source code for the Application, including any data
|
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
+
|
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
+
|
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
|
46
|
+
|
|
47
|
+
2. Conveying Modified Versions.
|
|
48
|
+
|
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
|
51
|
+
that uses the facility (other than as an argument passed when the
|
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
|
53
|
+
version:
|
|
54
|
+
|
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
|
56
|
+
ensure that, in the event an Application does not supply the
|
|
57
|
+
function or data, the facility still operates, and performs
|
|
58
|
+
whatever part of its purpose remains meaningful, or
|
|
59
|
+
|
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
61
|
+
this License applicable to that copy.
|
|
62
|
+
|
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
64
|
+
|
|
65
|
+
The object code form of an Application may incorporate material from
|
|
66
|
+
a header file that is part of the Library. You may convey such object
|
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
|
68
|
+
material is not limited to numerical parameters, data structure
|
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
|
71
|
+
|
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
|
73
|
+
Library is used in it and that the Library and its use are
|
|
74
|
+
covered by this License.
|
|
75
|
+
|
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
77
|
+
document.
|
|
78
|
+
|
|
79
|
+
4. Combined Works.
|
|
80
|
+
|
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
|
82
|
+
taken together, effectively do not restrict modification of the
|
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
|
85
|
+
the following:
|
|
86
|
+
|
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
88
|
+
the Library is used in it and that the Library and its use are
|
|
89
|
+
covered by this License.
|
|
90
|
+
|
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
92
|
+
document.
|
|
93
|
+
|
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
|
95
|
+
execution, include the copyright notice for the Library among
|
|
96
|
+
these notices, as well as a reference directing the user to the
|
|
97
|
+
copies of the GNU GPL and this license document.
|
|
98
|
+
|
|
99
|
+
d) Do one of the following:
|
|
100
|
+
|
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
+
License, and the Corresponding Application Code in a form
|
|
103
|
+
suitable for, and under terms that permit, the user to
|
|
104
|
+
recombine or relink the Application with a modified version of
|
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
+
Corresponding Source.
|
|
108
|
+
|
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
111
|
+
a copy of the Library already present on the user's computer
|
|
112
|
+
system, and (b) will operate properly with a modified version
|
|
113
|
+
of the Library that is interface-compatible with the Linked
|
|
114
|
+
Version.
|
|
115
|
+
|
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
117
|
+
be required to provide such information under section 6 of the
|
|
118
|
+
GNU GPL, and only to the extent that such information is
|
|
119
|
+
necessary to install and execute a modified version of the
|
|
120
|
+
Combined Work produced by recombining or relinking the
|
|
121
|
+
Application with a modified version of the Linked Version. (If
|
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
126
|
+
for conveying Corresponding Source.)
|
|
127
|
+
|
|
128
|
+
5. Combined Libraries.
|
|
129
|
+
|
|
130
|
+
You may place library facilities that are a work based on the
|
|
131
|
+
Library side by side in a single library together with other library
|
|
132
|
+
facilities that are not Applications and are not covered by this
|
|
133
|
+
License, and convey such a combined library under terms of your
|
|
134
|
+
choice, if you do both of the following:
|
|
135
|
+
|
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
|
137
|
+
on the Library, uncombined with any other library facilities,
|
|
138
|
+
conveyed under the terms of this License.
|
|
139
|
+
|
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
|
141
|
+
is a work based on the Library, and explaining where to find the
|
|
142
|
+
accompanying uncombined form of the same work.
|
|
143
|
+
|
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
145
|
+
|
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
148
|
+
versions will be similar in spirit to the present version, but may
|
|
149
|
+
differ in detail to address new problems or concerns.
|
|
150
|
+
|
|
151
|
+
Each version is given a distinguishing version number. If the
|
|
152
|
+
Library as you received it specifies that a certain numbered version
|
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
|
154
|
+
applies to it, you have the option of following the terms and
|
|
155
|
+
conditions either of that published version or of any later version
|
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
|
160
|
+
|
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
164
|
+
permanent authorization for you to choose that version for the
|
|
165
|
+
Library.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: orto
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6.1
|
|
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
|
|
@@ -12,6 +12,7 @@ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
|
12
12
|
Classifier: Operating System :: OS Independent
|
|
13
13
|
Requires-Python: >=3.10
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
15
16
|
Requires-Dist: numpy>=2.1.2
|
|
16
17
|
Requires-Dist: xyz_py>=5.13.1
|
|
17
18
|
Requires-Dist: matplotlib>=3.9.2
|
|
@@ -25,6 +26,7 @@ Dynamic: classifier
|
|
|
25
26
|
Dynamic: description
|
|
26
27
|
Dynamic: description-content-type
|
|
27
28
|
Dynamic: home-page
|
|
29
|
+
Dynamic: license-file
|
|
28
30
|
Dynamic: project-url
|
|
29
31
|
Dynamic: requires-dist
|
|
30
32
|
Dynamic: requires-python
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '1.6.1'
|
|
@@ -15,6 +15,7 @@ from shutil import move as shutilmove
|
|
|
15
15
|
from . import job
|
|
16
16
|
from . import utils as ut
|
|
17
17
|
from . import constants as cst
|
|
18
|
+
from . import data as d
|
|
18
19
|
from .exceptions import DataNotFoundError, DataFormattingError
|
|
19
20
|
|
|
20
21
|
_SHOW_CONV = {
|
|
@@ -573,12 +574,7 @@ def plot_xes_func(uargs):
|
|
|
573
574
|
from . import extractor as oe
|
|
574
575
|
|
|
575
576
|
# Set user specified font name
|
|
576
|
-
|
|
577
|
-
try:
|
|
578
|
-
plt.rcParams['font.family'] = os.getenv('orto_fontname')
|
|
579
|
-
except ValueError:
|
|
580
|
-
ut.cprint('Error in orto_fontname environment variable', 'red')
|
|
581
|
-
sys.exit(1)
|
|
577
|
+
ut.check_font_envvar()
|
|
582
578
|
|
|
583
579
|
# Change matplotlib font size to be larger
|
|
584
580
|
mpl.rcParams.update({'font.size': 12})
|
|
@@ -618,7 +614,7 @@ def plot_xes_func(uargs):
|
|
|
618
614
|
uargs.output_file
|
|
619
615
|
)
|
|
620
616
|
elif version[0] < 6:
|
|
621
|
-
ut.
|
|
617
|
+
ut.red_exit('Unsupported version of Orca for XES extraction', 'red')
|
|
622
618
|
|
|
623
619
|
ut.cprint('Using intensities: {}'.format(uargs.intensities), 'cyan')
|
|
624
620
|
|
|
@@ -675,9 +671,9 @@ def plot_xes_func(uargs):
|
|
|
675
671
|
plt.show()
|
|
676
672
|
|
|
677
673
|
|
|
678
|
-
def
|
|
674
|
+
def plot_xas_func(uargs):
|
|
679
675
|
'''
|
|
680
|
-
Wrapper for CLI plot
|
|
676
|
+
Wrapper for CLI plot xas call
|
|
681
677
|
|
|
682
678
|
Parameters
|
|
683
679
|
----------
|
|
@@ -694,12 +690,7 @@ def plot_abs_func(uargs):
|
|
|
694
690
|
from . import extractor as oe
|
|
695
691
|
|
|
696
692
|
# Set user specified font name
|
|
697
|
-
|
|
698
|
-
try:
|
|
699
|
-
plt.rcParams['font.family'] = os.getenv('orto_fontname')
|
|
700
|
-
except ValueError:
|
|
701
|
-
ut.cprint('Error in orto_fontname environment variable', 'red')
|
|
702
|
-
sys.exit(1)
|
|
693
|
+
ut.check_font_envvar()
|
|
703
694
|
|
|
704
695
|
# Change matplotlib font size to be larger
|
|
705
696
|
mpl.rcParams.update({'font.size': 12})
|
|
@@ -713,28 +704,21 @@ def plot_abs_func(uargs):
|
|
|
713
704
|
)
|
|
714
705
|
version = [6, 0, 0]
|
|
715
706
|
|
|
716
|
-
if version[0]
|
|
717
|
-
if uargs.intensities == 'electric':
|
|
718
|
-
all_data = oe.OldAbsorptionElectricDipoleExtractor.extract(
|
|
719
|
-
uargs.output_file
|
|
720
|
-
)
|
|
721
|
-
elif uargs.intensities == 'velocity':
|
|
722
|
-
all_data = oe.OldAbsorptionVelocityDipoleExtractor.extract(
|
|
723
|
-
uargs.output_file
|
|
724
|
-
)
|
|
725
|
-
elif version[0] >= 6:
|
|
707
|
+
if version[0] >= 6:
|
|
726
708
|
if uargs.intensities == 'electric':
|
|
727
|
-
all_data = oe.
|
|
709
|
+
all_data = oe.XASElectricDipoleExtractor.extract(
|
|
728
710
|
uargs.output_file
|
|
729
711
|
)
|
|
730
712
|
elif uargs.intensities == 'velocity':
|
|
731
|
-
all_data = oe.
|
|
713
|
+
all_data = oe.XASVelocityDipoleExtractor.extract(
|
|
732
714
|
uargs.output_file
|
|
733
715
|
)
|
|
734
716
|
elif uargs.intensities == 'semi-classical':
|
|
735
|
-
all_data = oe.
|
|
717
|
+
all_data = oe.XASSemiClassicalDipoleExtractor.extract(
|
|
736
718
|
uargs.output_file
|
|
737
719
|
)
|
|
720
|
+
elif version[0] < 6:
|
|
721
|
+
ut.red_exit('Unsupported version of Orca for XAS extraction', 'red')
|
|
738
722
|
|
|
739
723
|
ut.cprint('Using intensities: {}'.format(uargs.intensities), 'cyan')
|
|
740
724
|
|
|
@@ -792,6 +776,194 @@ def plot_abs_func(uargs):
|
|
|
792
776
|
return
|
|
793
777
|
|
|
794
778
|
|
|
779
|
+
def plot_abs_func(uargs):
|
|
780
|
+
'''
|
|
781
|
+
Wrapper for CLI plot abs call\n\n
|
|
782
|
+
|
|
783
|
+
Plots ABSORPTION blocks from orca output\n
|
|
784
|
+
- UVVIS (TDDFT)\n
|
|
785
|
+
- XAS (TDDFT)\n\n
|
|
786
|
+
|
|
787
|
+
Parameters
|
|
788
|
+
----------
|
|
789
|
+
uargs : argparser object
|
|
790
|
+
User arguments
|
|
791
|
+
|
|
792
|
+
Returns
|
|
793
|
+
-------
|
|
794
|
+
None
|
|
795
|
+
'''
|
|
796
|
+
import matplotlib.pyplot as plt
|
|
797
|
+
import matplotlib as mpl
|
|
798
|
+
import matplotlib.colors as mcolors
|
|
799
|
+
from . import plotter
|
|
800
|
+
from . import extractor as oe
|
|
801
|
+
|
|
802
|
+
# Change matplotlib font size to be larger
|
|
803
|
+
mpl.rcParams.update({'font.size': 12})
|
|
804
|
+
# Set user specified font name
|
|
805
|
+
ut.check_font_envvar()
|
|
806
|
+
|
|
807
|
+
# Change matplotlib font size to be larger
|
|
808
|
+
mpl.rcParams.update({'font.size': 12})
|
|
809
|
+
|
|
810
|
+
if len(uargs.output_file) == 1:
|
|
811
|
+
colours = ['black']
|
|
812
|
+
else:
|
|
813
|
+
colours = list(mcolors.TABLEAU_COLORS.values())
|
|
814
|
+
|
|
815
|
+
fig, ax = plt.subplots(1, 1, figsize=(6, 4))
|
|
816
|
+
oax = ax.twinx()
|
|
817
|
+
|
|
818
|
+
# Find unique name from multiple file names
|
|
819
|
+
if len(uargs.output_file) > 1:
|
|
820
|
+
base_names = [of.stem for of in uargs.output_file]
|
|
821
|
+
unique_names = ut.find_unique_substring(base_names)
|
|
822
|
+
legend = True
|
|
823
|
+
else:
|
|
824
|
+
legend = False
|
|
825
|
+
unique_names = ['']
|
|
826
|
+
|
|
827
|
+
# Handle x_shift argument
|
|
828
|
+
if uargs.x_shift is None:
|
|
829
|
+
uargs.x_shift = [0.0 for _ in uargs.output_file]
|
|
830
|
+
elif len(uargs.x_shift) != len(uargs.output_file):
|
|
831
|
+
ut.red_exit(
|
|
832
|
+
'Number of x_shift values must match number of output files'
|
|
833
|
+
)
|
|
834
|
+
|
|
835
|
+
for it, output_file in enumerate(uargs.output_file):
|
|
836
|
+
|
|
837
|
+
version = oe.OrcaVersionExtractor.extract(output_file)
|
|
838
|
+
|
|
839
|
+
if not len(version):
|
|
840
|
+
ut.cprint(
|
|
841
|
+
'Warning: Cannot find version number in Orca output file',
|
|
842
|
+
'black_yellowbg'
|
|
843
|
+
)
|
|
844
|
+
version = [6, 0, 0]
|
|
845
|
+
|
|
846
|
+
if version[0] < 6:
|
|
847
|
+
if uargs.intensities == 'electric':
|
|
848
|
+
all_datasets = oe.OldAbsorptionElectricDipoleExtractor.extract(
|
|
849
|
+
output_file
|
|
850
|
+
)
|
|
851
|
+
elif uargs.intensities == 'velocity':
|
|
852
|
+
all_datasets = oe.OldAbsorptionVelocityDipoleExtractor.extract(
|
|
853
|
+
output_file
|
|
854
|
+
)
|
|
855
|
+
elif version[0] >= 6:
|
|
856
|
+
if uargs.intensities == 'electric':
|
|
857
|
+
all_datasets = oe.AbsorptionElectricDipoleExtractor.extract(
|
|
858
|
+
output_file
|
|
859
|
+
)
|
|
860
|
+
elif uargs.intensities == 'velocity':
|
|
861
|
+
all_datasets = oe.AbsorptionVelocityDipoleExtractor.extract(
|
|
862
|
+
output_file
|
|
863
|
+
)
|
|
864
|
+
elif uargs.intensities == 'semi-classical':
|
|
865
|
+
all_datasets = oe.AbsorptionSemiClassicalDipoleExtractor.extract( # noqa
|
|
866
|
+
output_file
|
|
867
|
+
)
|
|
868
|
+
|
|
869
|
+
ut.cprint('Using intensities: {}'.format(uargs.intensities), 'cyan')
|
|
870
|
+
|
|
871
|
+
all_abs_data = [
|
|
872
|
+
d.AbsorptionData.from_extractor_dataset(
|
|
873
|
+
dataset,
|
|
874
|
+
uargs.intensities,
|
|
875
|
+
remove_zero_osc=uargs.zero_osc
|
|
876
|
+
)
|
|
877
|
+
for dataset in all_datasets
|
|
878
|
+
]
|
|
879
|
+
|
|
880
|
+
if len(all_abs_data) == 0:
|
|
881
|
+
ut.red_exit(
|
|
882
|
+
f'No ABSORPTION data found in file {output_file}', 'red'
|
|
883
|
+
)
|
|
884
|
+
elif len(all_abs_data) > 1:
|
|
885
|
+
ut.cprint(
|
|
886
|
+
f'Found {len(all_abs_data)} ABSORPTION sections in '
|
|
887
|
+
f'file {output_file}\n'
|
|
888
|
+
f'Plotting final section ONLY',
|
|
889
|
+
'cyan'
|
|
890
|
+
)
|
|
891
|
+
|
|
892
|
+
abs_data = all_abs_data[-1]
|
|
893
|
+
|
|
894
|
+
if uargs.x_unit == 'wavenumber':
|
|
895
|
+
x_vals = abs_data.wavenumbers
|
|
896
|
+
min_factor = 0.8
|
|
897
|
+
max_factor = 1.1
|
|
898
|
+
elif uargs.x_unit == 'wavelength':
|
|
899
|
+
x_vals = abs_data.wavelengths
|
|
900
|
+
max_factor = 1.1
|
|
901
|
+
min_factor = 0.8
|
|
902
|
+
elif uargs.x_unit == 'energy':
|
|
903
|
+
x_vals = abs_data.energies
|
|
904
|
+
min_factor = 0.9995
|
|
905
|
+
max_factor = 1.0005
|
|
906
|
+
|
|
907
|
+
# Set x_min and x_max
|
|
908
|
+
if isinstance(uargs.x_lim[0], str):
|
|
909
|
+
if uargs.x_lim[0] == 'auto':
|
|
910
|
+
x_min = min(x_vals) * min_factor
|
|
911
|
+
elif ut.is_floatable(uargs.x_lim[0]):
|
|
912
|
+
x_min = float(uargs.x_lim[0])
|
|
913
|
+
else:
|
|
914
|
+
raise ValueError(f'Invalid x_min value: {uargs.x_lim[0]}')
|
|
915
|
+
else:
|
|
916
|
+
x_min = uargs.x_lim[0]
|
|
917
|
+
|
|
918
|
+
if isinstance(uargs.x_lim[1], str):
|
|
919
|
+
if uargs.x_lim[1] == 'auto':
|
|
920
|
+
x_max = max(x_vals) * max_factor
|
|
921
|
+
elif ut.is_floatable(uargs.x_lim[1]):
|
|
922
|
+
x_max = float(uargs.x_lim[1])
|
|
923
|
+
else:
|
|
924
|
+
raise ValueError(f'Invalid x_max value: {uargs.x_lim[1]}')
|
|
925
|
+
else:
|
|
926
|
+
x_max = uargs.xlim[1]
|
|
927
|
+
|
|
928
|
+
# Generate spectrum
|
|
929
|
+
abs_data.generate_spectrum(
|
|
930
|
+
fwhm=uargs.linewidth,
|
|
931
|
+
lineshape=uargs.lineshape,
|
|
932
|
+
x_type=uargs.x_unit,
|
|
933
|
+
num_points=10000,
|
|
934
|
+
x_min=x_min,
|
|
935
|
+
x_max=x_max,
|
|
936
|
+
comment=unique_names[it]
|
|
937
|
+
)
|
|
938
|
+
|
|
939
|
+
# Plot absorption spectrum
|
|
940
|
+
plotter.plot_absorption_spectrum(
|
|
941
|
+
abs_data,
|
|
942
|
+
linecolor=colours[it],
|
|
943
|
+
stickcolour=colours[it],
|
|
944
|
+
osc_style=uargs.osc_style,
|
|
945
|
+
normalise=uargs.normalise,
|
|
946
|
+
window_title='',
|
|
947
|
+
fig=fig,
|
|
948
|
+
ax=ax,
|
|
949
|
+
oax=oax,
|
|
950
|
+
show=False,
|
|
951
|
+
save=False,
|
|
952
|
+
x_lim=[x_min, x_max],
|
|
953
|
+
y_lim=uargs.y_lim,
|
|
954
|
+
x_shift=uargs.x_shift[it],
|
|
955
|
+
legend=legend
|
|
956
|
+
)
|
|
957
|
+
|
|
958
|
+
if _SAVE_CONV[uargs.plot]:
|
|
959
|
+
plt.savefig('absorption_spectrum.png', dpi=500)
|
|
960
|
+
|
|
961
|
+
if _SHOW_CONV[uargs.plot]:
|
|
962
|
+
plt.show()
|
|
963
|
+
|
|
964
|
+
return
|
|
965
|
+
|
|
966
|
+
|
|
795
967
|
def plot_ir_func(uargs):
|
|
796
968
|
'''
|
|
797
969
|
Wrapper for CLI plot_ir call
|
|
@@ -811,12 +983,7 @@ def plot_ir_func(uargs):
|
|
|
811
983
|
from . import extractor as oe
|
|
812
984
|
|
|
813
985
|
# Set user specified font name
|
|
814
|
-
|
|
815
|
-
try:
|
|
816
|
-
plt.rcParams['font.family'] = os.getenv('orto_fontname')
|
|
817
|
-
except ValueError:
|
|
818
|
-
ut.cprint('Error in orto_fontname environment variable', 'red')
|
|
819
|
-
sys.exit(1)
|
|
986
|
+
ut.check_font_envvar()
|
|
820
987
|
|
|
821
988
|
# Change matplotlib font size to be larger
|
|
822
989
|
mpl.rcParams.update({'font.size': 12})
|
|
@@ -1728,7 +1895,7 @@ def read_args(arg_list=None):
|
|
|
1728
1895
|
|
|
1729
1896
|
plot_abs = plot_parser.add_parser(
|
|
1730
1897
|
'abs',
|
|
1731
|
-
description='Plots absorption spectrum from CI calculation output',
|
|
1898
|
+
description='Plots absorption spectrum from TDDFT/CI calculation output', # noqa
|
|
1732
1899
|
usage=ut.cstring('orto plot abs <output_file> [options]', 'cyan'),
|
|
1733
1900
|
formatter_class=argparse.RawTextHelpFormatter
|
|
1734
1901
|
)
|
|
@@ -1739,6 +1906,7 @@ def read_args(arg_list=None):
|
|
|
1739
1906
|
plot_abs.add_argument(
|
|
1740
1907
|
'output_file',
|
|
1741
1908
|
type=pathlib.Path,
|
|
1909
|
+
nargs='+',
|
|
1742
1910
|
help='Orca output file name'
|
|
1743
1911
|
)
|
|
1744
1912
|
|
|
@@ -1755,17 +1923,17 @@ def read_args(arg_list=None):
|
|
|
1755
1923
|
'--linewidth',
|
|
1756
1924
|
'-lw',
|
|
1757
1925
|
type=float,
|
|
1758
|
-
default=
|
|
1926
|
+
default=1,
|
|
1759
1927
|
help=(
|
|
1760
1928
|
'Width of signal (FWHM for Gaussian, Width for Lorentzian),'
|
|
1761
|
-
' in
|
|
1929
|
+
' in same unit as x axis'
|
|
1762
1930
|
)
|
|
1763
1931
|
)
|
|
1764
1932
|
|
|
1765
1933
|
plot_abs.add_argument(
|
|
1766
1934
|
'--osc_style',
|
|
1767
1935
|
type=str,
|
|
1768
|
-
default='
|
|
1936
|
+
default='separate',
|
|
1769
1937
|
help=(
|
|
1770
1938
|
'Style of oscillators to plot\n'
|
|
1771
1939
|
' - \'separate\' plots oscillator strengths as stems on separate axis\n' # noqa
|
|
@@ -1804,18 +1972,19 @@ def read_args(arg_list=None):
|
|
|
1804
1972
|
plot_abs.add_argument(
|
|
1805
1973
|
'--x_unit',
|
|
1806
1974
|
type=str,
|
|
1807
|
-
choices=['
|
|
1808
|
-
default='
|
|
1975
|
+
choices=['energy', 'wavelength', 'wavenumber'],
|
|
1976
|
+
default='energy',
|
|
1809
1977
|
help='x units to use for spectrum'
|
|
1810
1978
|
)
|
|
1811
1979
|
|
|
1812
1980
|
plot_abs.add_argument(
|
|
1813
|
-
'--
|
|
1981
|
+
'--x_shift',
|
|
1814
1982
|
type=float,
|
|
1815
|
-
default=
|
|
1983
|
+
default=None,
|
|
1984
|
+
nargs='+',
|
|
1816
1985
|
help=(
|
|
1817
1986
|
'Shift spectrum by this amount in x units\n'
|
|
1818
|
-
'Default:
|
|
1987
|
+
'Default: 0.'
|
|
1819
1988
|
)
|
|
1820
1989
|
)
|
|
1821
1990
|
|
|
@@ -1854,6 +2023,16 @@ def read_args(arg_list=None):
|
|
|
1854
2023
|
)
|
|
1855
2024
|
)
|
|
1856
2025
|
|
|
2026
|
+
plot_abs.add_argument(
|
|
2027
|
+
'--zero_osc',
|
|
2028
|
+
default=1E-5,
|
|
2029
|
+
type=float,
|
|
2030
|
+
help=(
|
|
2031
|
+
'Oscillator strengths below this value are treated as zero\n'
|
|
2032
|
+
'Default: %(default)s'
|
|
2033
|
+
)
|
|
2034
|
+
)
|
|
2035
|
+
|
|
1857
2036
|
plot_xes = plot_parser.add_parser(
|
|
1858
2037
|
'xes',
|
|
1859
2038
|
description='Plots XES from CI calculation output',
|