orto 1.4.0__py3-none-any.whl → 1.6.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 +486 -37
- orto/constants.py +2 -0
- orto/data.py +351 -0
- orto/extractor.py +210 -3
- orto/plotter.py +128 -194
- orto/utils.py +123 -0
- {orto-1.4.0.dist-info → orto-1.6.0.dist-info}/METADATA +3 -1
- orto-1.6.0.dist-info/RECORD +17 -0
- orto-1.6.0.dist-info/licenses/LICENSE +165 -0
- orto-1.4.0.dist-info/RECORD +0 -15
- {orto-1.4.0.dist-info → orto-1.6.0.dist-info}/WHEEL +0 -0
- {orto-1.4.0.dist-info → orto-1.6.0.dist-info}/entry_points.txt +0 -0
- {orto-1.4.0.dist-info → orto-1.6.0.dist-info}/top_level.txt +0 -0
orto/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '1.
|
|
1
|
+
__version__ = '1.6.0'
|
orto/cli.py
CHANGED
|
@@ -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 = {
|
|
@@ -554,9 +555,9 @@ def gen_job_func(uargs):
|
|
|
554
555
|
return
|
|
555
556
|
|
|
556
557
|
|
|
557
|
-
def
|
|
558
|
+
def plot_xes_func(uargs):
|
|
558
559
|
'''
|
|
559
|
-
Wrapper for CLI plot
|
|
560
|
+
Wrapper for CLI plot xes call
|
|
560
561
|
|
|
561
562
|
Parameters
|
|
562
563
|
----------
|
|
@@ -573,12 +574,7 @@ def plot_abs_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})
|
|
@@ -592,28 +588,137 @@ def plot_abs_func(uargs):
|
|
|
592
588
|
)
|
|
593
589
|
version = [6, 0, 0]
|
|
594
590
|
|
|
595
|
-
if version[0]
|
|
591
|
+
if version[0] >= 6:
|
|
596
592
|
if uargs.intensities == 'electric':
|
|
597
|
-
all_data = oe.
|
|
593
|
+
all_data = oe.XESElectricDipoleExtractor.extract(
|
|
598
594
|
uargs.output_file
|
|
599
595
|
)
|
|
600
596
|
elif uargs.intensities == 'velocity':
|
|
601
|
-
all_data = oe.
|
|
597
|
+
all_data = oe.XESVelocityDipoleExtractor.extract(
|
|
598
|
+
uargs.output_file
|
|
599
|
+
)
|
|
600
|
+
elif uargs.intensities == 'semi-classical':
|
|
601
|
+
all_data = oe.XESSemiClassicalDipoleExtractor.extract(
|
|
602
|
+
uargs.output_file
|
|
603
|
+
)
|
|
604
|
+
elif uargs.intensities == 'so_electric':
|
|
605
|
+
all_data = oe.SOXESElectricDipoleExtractor.extract(
|
|
606
|
+
uargs.output_file
|
|
607
|
+
)
|
|
608
|
+
elif uargs.intensities == 'so_velocity':
|
|
609
|
+
all_data = oe.SOXESVelocityDipoleExtractor.extract(
|
|
610
|
+
uargs.output_file
|
|
611
|
+
)
|
|
612
|
+
elif uargs.intensities == 'so_semi-classical':
|
|
613
|
+
all_data = oe.SOXESSemiClassicalDipoleExtractor.extract(
|
|
602
614
|
uargs.output_file
|
|
603
615
|
)
|
|
604
|
-
elif version[0]
|
|
616
|
+
elif version[0] < 6:
|
|
617
|
+
ut.red_exit('Unsupported version of Orca for XES extraction', 'red')
|
|
618
|
+
|
|
619
|
+
ut.cprint('Using intensities: {}'.format(uargs.intensities), 'cyan')
|
|
620
|
+
|
|
621
|
+
# Plot each section
|
|
622
|
+
for it, data in enumerate(all_data):
|
|
623
|
+
|
|
624
|
+
if len(all_data) > 1:
|
|
625
|
+
save_name = f'emission_spectrum_section_{it:d}.png'
|
|
626
|
+
else:
|
|
627
|
+
save_name = 'emission_spectrum.png'
|
|
628
|
+
|
|
629
|
+
if uargs.x_unit == 'wavenumber':
|
|
630
|
+
x_values = np.asarray(data['energy (cm^-1)'])
|
|
631
|
+
elif uargs.x_unit == 'wavelength':
|
|
632
|
+
x_values = 1E7 / np.asarray(data['energy (cm^-1)'])
|
|
633
|
+
elif uargs.x_unit == 'energy':
|
|
634
|
+
x_values = np.asarray(data['energy (ev)'])
|
|
635
|
+
|
|
636
|
+
data['fosc'] = np.asarray(data['fosc'])
|
|
637
|
+
|
|
638
|
+
# Remove transitions with zero oscillator strength from
|
|
639
|
+
# beginning and end of spectrum
|
|
640
|
+
if not uargs.no_trim:
|
|
641
|
+
# Find first non-zero oscillator strength
|
|
642
|
+
first_nonzero = np.where(data['fosc'] > 1E-6)[0][0]
|
|
643
|
+
# Find last non-zero oscillator strength
|
|
644
|
+
last_nonzero = np.where(data['fosc'] > 1E-6)[0][-1]
|
|
645
|
+
|
|
646
|
+
# Trim data
|
|
647
|
+
x_values = x_values[first_nonzero:last_nonzero + 1]
|
|
648
|
+
data['fosc'] = data['fosc'][first_nonzero:last_nonzero + 1]
|
|
649
|
+
|
|
650
|
+
# Plot emission spectrum
|
|
651
|
+
fig, ax = plotter.plot_abs(
|
|
652
|
+
x_values,
|
|
653
|
+
uargs.x_unit,
|
|
654
|
+
data['fosc'],
|
|
655
|
+
show=_SHOW_CONV[uargs.plot],
|
|
656
|
+
save=_SAVE_CONV[uargs.plot],
|
|
657
|
+
save_name=save_name,
|
|
658
|
+
x_lim=uargs.x_lim,
|
|
659
|
+
y_lim=uargs.y_lim,
|
|
660
|
+
x_shift=uargs.shift,
|
|
661
|
+
linewidth=uargs.linewidth,
|
|
662
|
+
lineshape=uargs.lineshape,
|
|
663
|
+
window_title=f'Emission Spectrum from {uargs.output_file}',
|
|
664
|
+
osc_style=uargs.osc_style,
|
|
665
|
+
normalise=uargs.normalise,
|
|
666
|
+
plot_type='emission'
|
|
667
|
+
)
|
|
668
|
+
|
|
669
|
+
if uargs.x_unit == 'wavenumber':
|
|
670
|
+
ax[0].set_xlim([0, 50000])
|
|
671
|
+
plt.show()
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
def plot_xas_func(uargs):
|
|
675
|
+
'''
|
|
676
|
+
Wrapper for CLI plot xas call
|
|
677
|
+
|
|
678
|
+
Parameters
|
|
679
|
+
----------
|
|
680
|
+
uargs : argparser object
|
|
681
|
+
User arguments
|
|
682
|
+
|
|
683
|
+
Returns
|
|
684
|
+
-------
|
|
685
|
+
None
|
|
686
|
+
'''
|
|
687
|
+
import matplotlib.pyplot as plt
|
|
688
|
+
import matplotlib as mpl
|
|
689
|
+
from . import plotter
|
|
690
|
+
from . import extractor as oe
|
|
691
|
+
|
|
692
|
+
# Set user specified font name
|
|
693
|
+
ut.check_font_envvar()
|
|
694
|
+
|
|
695
|
+
# Change matplotlib font size to be larger
|
|
696
|
+
mpl.rcParams.update({'font.size': 12})
|
|
697
|
+
|
|
698
|
+
version = oe.OrcaVersionExtractor.extract(uargs.output_file)
|
|
699
|
+
|
|
700
|
+
if not len(version):
|
|
701
|
+
ut.cprint(
|
|
702
|
+
'Warning: Cannot find version number in Orca output file',
|
|
703
|
+
'black_yellowbg'
|
|
704
|
+
)
|
|
705
|
+
version = [6, 0, 0]
|
|
706
|
+
|
|
707
|
+
if version[0] >= 6:
|
|
605
708
|
if uargs.intensities == 'electric':
|
|
606
|
-
all_data = oe.
|
|
709
|
+
all_data = oe.XASElectricDipoleExtractor.extract(
|
|
607
710
|
uargs.output_file
|
|
608
711
|
)
|
|
609
712
|
elif uargs.intensities == 'velocity':
|
|
610
|
-
all_data = oe.
|
|
713
|
+
all_data = oe.XASVelocityDipoleExtractor.extract(
|
|
611
714
|
uargs.output_file
|
|
612
715
|
)
|
|
613
716
|
elif uargs.intensities == 'semi-classical':
|
|
614
|
-
all_data = oe.
|
|
717
|
+
all_data = oe.XASSemiClassicalDipoleExtractor.extract(
|
|
615
718
|
uargs.output_file
|
|
616
719
|
)
|
|
720
|
+
elif version[0] < 6:
|
|
721
|
+
ut.red_exit('Unsupported version of Orca for XAS extraction', 'red')
|
|
617
722
|
|
|
618
723
|
ut.cprint('Using intensities: {}'.format(uargs.intensities), 'cyan')
|
|
619
724
|
|
|
@@ -626,11 +731,25 @@ def plot_abs_func(uargs):
|
|
|
626
731
|
save_name = 'absorption_spectrum.png'
|
|
627
732
|
|
|
628
733
|
if uargs.x_unit == 'wavenumber':
|
|
629
|
-
x_values = data['energy (cm^-1)']
|
|
734
|
+
x_values = np.asarray(data['energy (cm^-1)'])
|
|
630
735
|
elif uargs.x_unit == 'wavelength':
|
|
631
|
-
x_values = 1E7 / data['energy (cm^-1)']
|
|
736
|
+
x_values = 1E7 / np.asarray(data['energy (cm^-1)'])
|
|
632
737
|
elif uargs.x_unit == 'energy':
|
|
633
|
-
x_values = data['energy (ev)']
|
|
738
|
+
x_values = np.asarray(data['energy (ev)'])
|
|
739
|
+
|
|
740
|
+
data['fosc'] = np.asarray(data['fosc'])
|
|
741
|
+
|
|
742
|
+
# Remove transitions with zero oscillator strength from
|
|
743
|
+
# beginning and end of spectrum
|
|
744
|
+
if not uargs.no_trim:
|
|
745
|
+
# Find first non-zero oscillator strength
|
|
746
|
+
first_nonzero = np.where(data['fosc'] > 1E-6)[0][0]
|
|
747
|
+
# Find last non-zero oscillator strength
|
|
748
|
+
last_nonzero = np.where(data['fosc'] > 1E-6)[0][-1]
|
|
749
|
+
|
|
750
|
+
# Trim data
|
|
751
|
+
x_values = x_values[first_nonzero:last_nonzero + 1]
|
|
752
|
+
data['fosc'] = data['fosc'][first_nonzero:last_nonzero + 1]
|
|
634
753
|
|
|
635
754
|
# Plot absorption spectrum
|
|
636
755
|
fig, ax = plotter.plot_abs(
|
|
@@ -647,7 +766,7 @@ def plot_abs_func(uargs):
|
|
|
647
766
|
lineshape=uargs.lineshape,
|
|
648
767
|
window_title=f'Absorption Spectrum from {uargs.output_file}',
|
|
649
768
|
osc_style=uargs.osc_style,
|
|
650
|
-
normalise=uargs.
|
|
769
|
+
normalise=uargs.normalise
|
|
651
770
|
)
|
|
652
771
|
|
|
653
772
|
if uargs.x_unit == 'wavenumber':
|
|
@@ -657,6 +776,194 @@ def plot_abs_func(uargs):
|
|
|
657
776
|
return
|
|
658
777
|
|
|
659
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(
|
|
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=True
|
|
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
|
+
|
|
660
967
|
def plot_ir_func(uargs):
|
|
661
968
|
'''
|
|
662
969
|
Wrapper for CLI plot_ir call
|
|
@@ -676,12 +983,7 @@ def plot_ir_func(uargs):
|
|
|
676
983
|
from . import extractor as oe
|
|
677
984
|
|
|
678
985
|
# Set user specified font name
|
|
679
|
-
|
|
680
|
-
try:
|
|
681
|
-
plt.rcParams['font.family'] = os.getenv('orto_fontname')
|
|
682
|
-
except ValueError:
|
|
683
|
-
ut.cprint('Error in orto_fontname environment variable', 'red')
|
|
684
|
-
sys.exit(1)
|
|
986
|
+
ut.check_font_envvar()
|
|
685
987
|
|
|
686
988
|
# Change matplotlib font size to be larger
|
|
687
989
|
mpl.rcParams.update({'font.size': 12})
|
|
@@ -1593,7 +1895,7 @@ def read_args(arg_list=None):
|
|
|
1593
1895
|
|
|
1594
1896
|
plot_abs = plot_parser.add_parser(
|
|
1595
1897
|
'abs',
|
|
1596
|
-
description='Plots absorption spectrum from CI calculation output',
|
|
1898
|
+
description='Plots absorption spectrum from TDDFT/CI calculation output', # noqa
|
|
1597
1899
|
usage=ut.cstring('orto plot abs <output_file> [options]', 'cyan'),
|
|
1598
1900
|
formatter_class=argparse.RawTextHelpFormatter
|
|
1599
1901
|
)
|
|
@@ -1604,6 +1906,7 @@ def read_args(arg_list=None):
|
|
|
1604
1906
|
plot_abs.add_argument(
|
|
1605
1907
|
'output_file',
|
|
1606
1908
|
type=pathlib.Path,
|
|
1909
|
+
nargs='+',
|
|
1607
1910
|
help='Orca output file name'
|
|
1608
1911
|
)
|
|
1609
1912
|
|
|
@@ -1620,20 +1923,20 @@ def read_args(arg_list=None):
|
|
|
1620
1923
|
'--linewidth',
|
|
1621
1924
|
'-lw',
|
|
1622
1925
|
type=float,
|
|
1623
|
-
default=
|
|
1926
|
+
default=1,
|
|
1624
1927
|
help=(
|
|
1625
1928
|
'Width of signal (FWHM for Gaussian, Width for Lorentzian),'
|
|
1626
|
-
' in
|
|
1929
|
+
' in same unit as x axis'
|
|
1627
1930
|
)
|
|
1628
1931
|
)
|
|
1629
1932
|
|
|
1630
1933
|
plot_abs.add_argument(
|
|
1631
1934
|
'--osc_style',
|
|
1632
1935
|
type=str,
|
|
1633
|
-
default='
|
|
1936
|
+
default='separate',
|
|
1634
1937
|
help=(
|
|
1635
1938
|
'Style of oscillators to plot\n'
|
|
1636
|
-
' - \'separate\' plots oscillator strengths as stems on separate axis\n'
|
|
1939
|
+
' - \'separate\' plots oscillator strengths as stems on separate axis\n' # noqa
|
|
1637
1940
|
' - \'combined\' plots oscillator strengths on intensity axis\n'
|
|
1638
1941
|
' - \'off\' does not plot oscillator strengths\n'
|
|
1639
1942
|
'Default: %(default)s'
|
|
@@ -1669,17 +1972,28 @@ def read_args(arg_list=None):
|
|
|
1669
1972
|
plot_abs.add_argument(
|
|
1670
1973
|
'--x_unit',
|
|
1671
1974
|
type=str,
|
|
1672
|
-
choices=['
|
|
1673
|
-
default='
|
|
1975
|
+
choices=['energy', 'wavelength', 'wavenumber'],
|
|
1976
|
+
default='energy',
|
|
1674
1977
|
help='x units to use for spectrum'
|
|
1675
1978
|
)
|
|
1676
1979
|
|
|
1677
1980
|
plot_abs.add_argument(
|
|
1678
|
-
'--
|
|
1981
|
+
'--x_shift',
|
|
1679
1982
|
type=float,
|
|
1680
|
-
default=
|
|
1983
|
+
default=None,
|
|
1984
|
+
nargs='+',
|
|
1681
1985
|
help=(
|
|
1682
1986
|
'Shift spectrum by this amount in x units\n'
|
|
1987
|
+
'Default: 0.'
|
|
1988
|
+
)
|
|
1989
|
+
)
|
|
1990
|
+
|
|
1991
|
+
plot_abs.add_argument(
|
|
1992
|
+
'--no_trim',
|
|
1993
|
+
action='store_true',
|
|
1994
|
+
default=False,
|
|
1995
|
+
help=(
|
|
1996
|
+
'Do not trim spectrum to non-zero oscillator strength\n'
|
|
1683
1997
|
'Default: %(default)s'
|
|
1684
1998
|
)
|
|
1685
1999
|
)
|
|
@@ -1699,12 +2013,147 @@ def read_args(arg_list=None):
|
|
|
1699
2013
|
)
|
|
1700
2014
|
|
|
1701
2015
|
plot_abs.add_argument(
|
|
1702
|
-
'--
|
|
1703
|
-
'-
|
|
2016
|
+
'--normalise',
|
|
2017
|
+
'-n',
|
|
2018
|
+
action='store_true',
|
|
2019
|
+
default=False,
|
|
2020
|
+
help=(
|
|
2021
|
+
'Normalises spectrum to maximum value\n'
|
|
2022
|
+
'Default: %(default)s'
|
|
2023
|
+
)
|
|
2024
|
+
)
|
|
2025
|
+
|
|
2026
|
+
plot_xes = plot_parser.add_parser(
|
|
2027
|
+
'xes',
|
|
2028
|
+
description='Plots XES from CI calculation output',
|
|
2029
|
+
usage=ut.cstring('orto plot xes <output_file>', 'cyan'),
|
|
2030
|
+
formatter_class=argparse.RawTextHelpFormatter
|
|
2031
|
+
)
|
|
2032
|
+
plot_xes._positionals.title = 'Mandatory Arguments'
|
|
2033
|
+
|
|
2034
|
+
plot_xes.set_defaults(func=plot_xes_func)
|
|
2035
|
+
|
|
2036
|
+
plot_xes.add_argument(
|
|
2037
|
+
'output_file',
|
|
2038
|
+
type=pathlib.Path,
|
|
2039
|
+
help='Orca output file name'
|
|
2040
|
+
)
|
|
2041
|
+
|
|
2042
|
+
plot_xes.add_argument(
|
|
2043
|
+
'--intensities',
|
|
2044
|
+
'-i',
|
|
2045
|
+
type=str,
|
|
2046
|
+
choices=[
|
|
2047
|
+
'velocity',
|
|
2048
|
+
'electric',
|
|
2049
|
+
'semi-classical',
|
|
2050
|
+
'so_velocity',
|
|
2051
|
+
'so_electric',
|
|
2052
|
+
'so_semi-classical',
|
|
2053
|
+
],
|
|
2054
|
+
default='electric',
|
|
2055
|
+
help='Type of intensity to plot (orca_mapspc uses electric)'
|
|
2056
|
+
)
|
|
2057
|
+
|
|
2058
|
+
plot_xes.add_argument(
|
|
2059
|
+
'--linewidth',
|
|
2060
|
+
'-lw',
|
|
2061
|
+
type=float,
|
|
2062
|
+
default=2000,
|
|
2063
|
+
help=(
|
|
2064
|
+
'Width of signal (FWHM for Gaussian, Width for Lorentzian),'
|
|
2065
|
+
' in Wavenumbers'
|
|
2066
|
+
)
|
|
2067
|
+
)
|
|
2068
|
+
|
|
2069
|
+
plot_xes.add_argument(
|
|
2070
|
+
'--osc_style',
|
|
2071
|
+
type=str,
|
|
2072
|
+
default='combined',
|
|
2073
|
+
help=(
|
|
2074
|
+
'Style of oscillators to plot\n'
|
|
2075
|
+
' - \'separate\' plots oscillator strengths as stems on separate axis\n' # noqa
|
|
2076
|
+
' - \'combined\' plots oscillator strengths on intensity axis\n'
|
|
2077
|
+
' - \'off\' does not plot oscillator strengths\n'
|
|
2078
|
+
'Default: %(default)s'
|
|
2079
|
+
)
|
|
2080
|
+
)
|
|
2081
|
+
|
|
2082
|
+
plot_xes.add_argument(
|
|
2083
|
+
'--plot',
|
|
2084
|
+
'-p',
|
|
2085
|
+
choices=['on', 'show', 'save', 'off'],
|
|
2086
|
+
metavar='<str>',
|
|
2087
|
+
type=str,
|
|
2088
|
+
default='on',
|
|
2089
|
+
help=(
|
|
2090
|
+
'Controls plot appearance/save \n'
|
|
2091
|
+
' - \'on\' shows and saves the plots\n'
|
|
2092
|
+
' - \'show\' shows the plots\n'
|
|
2093
|
+
' - \'save\' saves the plots\n'
|
|
2094
|
+
' - \'off\' neither shows nor saves\n'
|
|
2095
|
+
'Default: %(default)s'
|
|
2096
|
+
)
|
|
2097
|
+
)
|
|
2098
|
+
|
|
2099
|
+
plot_xes.add_argument(
|
|
2100
|
+
'--lineshape',
|
|
2101
|
+
'-ls',
|
|
2102
|
+
type=str,
|
|
2103
|
+
choices=['gaussian', 'lorentzian'],
|
|
2104
|
+
default='lorentzian',
|
|
2105
|
+
help='Lineshape to use for each signal'
|
|
2106
|
+
)
|
|
2107
|
+
|
|
2108
|
+
plot_xes.add_argument(
|
|
2109
|
+
'--x_unit',
|
|
2110
|
+
type=str,
|
|
2111
|
+
choices=['wavenumber', 'energy', 'wavelength'],
|
|
2112
|
+
default='wavenumber',
|
|
2113
|
+
help='x units to use for spectrum'
|
|
2114
|
+
)
|
|
2115
|
+
|
|
2116
|
+
plot_xes.add_argument(
|
|
2117
|
+
'--shift',
|
|
2118
|
+
type=float,
|
|
2119
|
+
default=0.,
|
|
2120
|
+
help=(
|
|
2121
|
+
'Shift spectrum by this amount in x units\n'
|
|
2122
|
+
'Default: %(default)s'
|
|
2123
|
+
)
|
|
2124
|
+
)
|
|
2125
|
+
|
|
2126
|
+
plot_xes.add_argument(
|
|
2127
|
+
'--no_trim',
|
|
2128
|
+
action='store_true',
|
|
2129
|
+
default=False,
|
|
2130
|
+
help=(
|
|
2131
|
+
'Do not trim spectrum to non-zero oscillator strength\n'
|
|
2132
|
+
'Default: %(default)s'
|
|
2133
|
+
)
|
|
2134
|
+
)
|
|
2135
|
+
|
|
2136
|
+
plot_xes.add_argument(
|
|
2137
|
+
'--x_lim',
|
|
2138
|
+
nargs=2,
|
|
2139
|
+
default=['auto', 'auto'],
|
|
2140
|
+
help='x limits of spectrum'
|
|
2141
|
+
)
|
|
2142
|
+
|
|
2143
|
+
plot_xes.add_argument(
|
|
2144
|
+
'--y_lim',
|
|
2145
|
+
nargs=2,
|
|
2146
|
+
default=[0., 'auto'],
|
|
2147
|
+
help='Epsilon limits of spectrum in cm^-1 mol^-1 L'
|
|
2148
|
+
)
|
|
2149
|
+
|
|
2150
|
+
plot_xes.add_argument(
|
|
2151
|
+
'--normalise',
|
|
2152
|
+
'-n',
|
|
1704
2153
|
action='store_true',
|
|
1705
2154
|
default=False,
|
|
1706
2155
|
help=(
|
|
1707
|
-
'Normalises
|
|
2156
|
+
'Normalises spectrum to maximum value\n'
|
|
1708
2157
|
'Default: %(default)s'
|
|
1709
2158
|
)
|
|
1710
2159
|
)
|
orto/constants.py
CHANGED