orto 0.27.1__tar.gz → 1.0.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-0.27.1 → orto-1.0.1}/PKG-INFO +1 -1
- orto-1.0.1/orto/__version__.py +1 -0
- {orto-0.27.1 → orto-1.0.1}/orto/cli.py +42 -32
- {orto-0.27.1 → orto-1.0.1}/orto/extractor.py +16 -18
- {orto-0.27.1 → orto-1.0.1}/orto.egg-info/PKG-INFO +1 -1
- {orto-0.27.1 → orto-1.0.1}/setup.py +1 -1
- orto-0.27.1/orto/__version__.py +0 -1
- {orto-0.27.1 → orto-1.0.1}/README.md +0 -0
- {orto-0.27.1 → orto-1.0.1}/orto/__init__.py +0 -0
- {orto-0.27.1 → orto-1.0.1}/orto/input.py +0 -0
- {orto-0.27.1 → orto-1.0.1}/orto/job.py +0 -0
- {orto-0.27.1 → orto-1.0.1}/orto/plotter.py +0 -0
- {orto-0.27.1 → orto-1.0.1}/orto/utils.py +0 -0
- {orto-0.27.1 → orto-1.0.1}/orto.egg-info/SOURCES.txt +0 -0
- {orto-0.27.1 → orto-1.0.1}/orto.egg-info/dependency_links.txt +0 -0
- {orto-0.27.1 → orto-1.0.1}/orto.egg-info/entry_points.txt +0 -0
- {orto-0.27.1 → orto-1.0.1}/orto.egg-info/requires.txt +0 -0
- {orto-0.27.1 → orto-1.0.1}/orto.egg-info/top_level.txt +0 -0
- {orto-0.27.1 → orto-1.0.1}/pyproject.toml +0 -0
- {orto-0.27.1 → orto-1.0.1}/setup.cfg +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '1.0.1'
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
import argparse
|
|
2
2
|
import xyz_py as xyzp
|
|
3
|
-
|
|
4
|
-
import matplotlib.pyplot as plt
|
|
5
|
-
import matplotlib as mpl
|
|
3
|
+
from xyz_py.atomic import elements as atomic_elements
|
|
6
4
|
import sys
|
|
7
5
|
import pathlib
|
|
8
6
|
import os
|
|
9
7
|
import copy
|
|
10
8
|
import subprocess
|
|
11
|
-
|
|
9
|
+
from pandas import read_csv
|
|
12
10
|
import scipy.constants as constants
|
|
13
11
|
import numpy as np
|
|
14
|
-
import
|
|
15
|
-
import docx
|
|
12
|
+
from extto import DataNotFoundError
|
|
16
13
|
import re
|
|
17
|
-
import mmap
|
|
18
|
-
import
|
|
14
|
+
from mmap import mmap, ACCESS_READ
|
|
15
|
+
from shutil import move as shutilmove
|
|
19
16
|
|
|
20
17
|
|
|
18
|
+
from docx import Document
|
|
21
19
|
from docx.enum.text import WD_ALIGN_PARAGRAPH
|
|
22
20
|
from docx.enum.table import WD_ALIGN_VERTICAL
|
|
23
21
|
from docx.shared import Pt
|
|
@@ -28,17 +26,6 @@ from . import job
|
|
|
28
26
|
from . import utils as ut
|
|
29
27
|
from . import input as inp
|
|
30
28
|
|
|
31
|
-
# Change matplotlib font size to be larger
|
|
32
|
-
mpl.rcParams.update({'font.size': 12})
|
|
33
|
-
|
|
34
|
-
# Set user specified font name
|
|
35
|
-
if os.getenv('orto_fontname'):
|
|
36
|
-
try:
|
|
37
|
-
plt.rcParams['font.family'] = os.getenv('orto_fontname')
|
|
38
|
-
except ValueError:
|
|
39
|
-
ut.cprint('Error in orto_fontname environment variable', 'red')
|
|
40
|
-
sys.exit(1)
|
|
41
|
-
|
|
42
29
|
_SHOW_CONV = {
|
|
43
30
|
'on': True,
|
|
44
31
|
'save': False,
|
|
@@ -126,7 +113,7 @@ def extract_sf_energies_func(uargs):
|
|
|
126
113
|
title = 'Spin-Free energies'
|
|
127
114
|
|
|
128
115
|
# Create document
|
|
129
|
-
doc =
|
|
116
|
+
doc = Document()
|
|
130
117
|
|
|
131
118
|
doc.add_heading(title, 0)
|
|
132
119
|
|
|
@@ -261,7 +248,7 @@ def extract_gmatrix_func(uargs, save=True):
|
|
|
261
248
|
title = titles[uargs.type]
|
|
262
249
|
|
|
263
250
|
# Create document
|
|
264
|
-
doc =
|
|
251
|
+
doc = Document()
|
|
265
252
|
|
|
266
253
|
doc.add_heading(title, 0)
|
|
267
254
|
|
|
@@ -357,12 +344,12 @@ def gen_trunc_molden_func(uargs):
|
|
|
357
344
|
# occurrences of 'Occup='
|
|
358
345
|
_patt = re.compile(b'Sym=')
|
|
359
346
|
with open(uargs.input_file, mode="r") as file_obj:
|
|
360
|
-
with mmap
|
|
347
|
+
with mmap(file_obj.fileno(), length=0, access=ACCESS_READ) as mmap_obj:
|
|
361
348
|
n_MO = len(_patt.findall(mmap_obj))
|
|
362
349
|
|
|
363
350
|
_patt = re.compile(b'Occup= 0.000000')
|
|
364
351
|
with open(uargs.input_file, mode="r") as file_obj:
|
|
365
|
-
with mmap
|
|
352
|
+
with mmap(file_obj.fileno(), length=0, access=ACCESS_READ) as mmap_obj:
|
|
366
353
|
n_virt = len(_patt.findall(mmap_obj))
|
|
367
354
|
|
|
368
355
|
ut.cprint(
|
|
@@ -399,7 +386,7 @@ def gen_trunc_molden_func(uargs):
|
|
|
399
386
|
# If no output file given
|
|
400
387
|
if uargs.output_file == '.tmp.molden':
|
|
401
388
|
# Copy new file to original name
|
|
402
|
-
|
|
389
|
+
shutilmove(uargs.output_file, uargs.input_file)
|
|
403
390
|
uargs.output_file = uargs.input_file
|
|
404
391
|
|
|
405
392
|
ut.cprint(f'New molden file written to {uargs.output_file}', 'cyan')
|
|
@@ -554,6 +541,19 @@ def plot_abs_func(uargs):
|
|
|
554
541
|
-------
|
|
555
542
|
None
|
|
556
543
|
'''
|
|
544
|
+
import matplotlib.pyplot as plt
|
|
545
|
+
import matplotlib as mpl
|
|
546
|
+
|
|
547
|
+
# Set user specified font name
|
|
548
|
+
if os.getenv('orto_fontname'):
|
|
549
|
+
try:
|
|
550
|
+
plt.rcParams['font.family'] = os.getenv('orto_fontname')
|
|
551
|
+
except ValueError:
|
|
552
|
+
ut.cprint('Error in orto_fontname environment variable', 'red')
|
|
553
|
+
sys.exit(1)
|
|
554
|
+
|
|
555
|
+
# Change matplotlib font size to be larger
|
|
556
|
+
mpl.rcParams.update({'font.size': 12})
|
|
557
557
|
|
|
558
558
|
version = oe.OrcaVersionExtractor.extract(uargs.output_file)
|
|
559
559
|
|
|
@@ -744,7 +744,7 @@ def extract_orbs_func(uargs, save=True) -> None:
|
|
|
744
744
|
# Disable spin if not present in file
|
|
745
745
|
if mult == 1:
|
|
746
746
|
uargs.spin = None
|
|
747
|
-
except
|
|
747
|
+
except DataNotFoundError:
|
|
748
748
|
pass
|
|
749
749
|
|
|
750
750
|
extractors = {
|
|
@@ -772,7 +772,7 @@ def extract_orbs_func(uargs, save=True) -> None:
|
|
|
772
772
|
)
|
|
773
773
|
uargs.flavour = name
|
|
774
774
|
break
|
|
775
|
-
except
|
|
775
|
+
except DataNotFoundError:
|
|
776
776
|
failed += 1
|
|
777
777
|
if failed == len(extractors):
|
|
778
778
|
ut.red_exit(
|
|
@@ -783,7 +783,7 @@ def extract_orbs_func(uargs, save=True) -> None:
|
|
|
783
783
|
data = extractors[uargs.flavour](
|
|
784
784
|
uargs.output_file
|
|
785
785
|
)
|
|
786
|
-
except
|
|
786
|
+
except DataNotFoundError as dne:
|
|
787
787
|
ut.red_exit(str(dne))
|
|
788
788
|
|
|
789
789
|
# Unpack data
|
|
@@ -912,7 +912,7 @@ def extract_freq_func(uargs, save=True):
|
|
|
912
912
|
data[0]['energy (cm^-1)'][:uargs.num],
|
|
913
913
|
data[0]['IR Intensity (km mol^-1)'][:uargs.num]
|
|
914
914
|
):
|
|
915
|
-
print(f'{frq:.
|
|
915
|
+
print(f'{frq:.5f} {inty:.5f}')
|
|
916
916
|
else:
|
|
917
917
|
# Save to new .csv file
|
|
918
918
|
out_name = f'{uargs.output_file.stem}_frequencies.csv'
|
|
@@ -924,7 +924,7 @@ def extract_freq_func(uargs, save=True):
|
|
|
924
924
|
data[0]['energy (cm^-1)'][:uargs.num],
|
|
925
925
|
data[0]['IR Intensity (km mol^-1)'][:uargs.num]
|
|
926
926
|
):
|
|
927
|
-
f.write(f'{frq:.
|
|
927
|
+
f.write(f'{frq:.5f}, {inty:.5f}\n')
|
|
928
928
|
|
|
929
929
|
ut.cprint(f'Data written to {out_name}', 'cyan')
|
|
930
930
|
|
|
@@ -955,7 +955,7 @@ def extract_pop_func(uargs, save=True) -> None:
|
|
|
955
955
|
data = oe.MullikenPopulationExtractorDensities.extract(
|
|
956
956
|
uargs.output_file
|
|
957
957
|
)
|
|
958
|
-
except
|
|
958
|
+
except DataNotFoundError:
|
|
959
959
|
data = oe.MullikenPopulationExtractorPopulations.extract(
|
|
960
960
|
uargs.output_file
|
|
961
961
|
)
|
|
@@ -1018,6 +1018,11 @@ def plot_susc_func(uargs) -> None:
|
|
|
1018
1018
|
None
|
|
1019
1019
|
|
|
1020
1020
|
'''
|
|
1021
|
+
import matplotlib.pyplot as plt
|
|
1022
|
+
import matplotlib as mpl
|
|
1023
|
+
|
|
1024
|
+
# Change matplotlib font size to be larger
|
|
1025
|
+
mpl.rcParams.update({'font.size': 12})
|
|
1021
1026
|
|
|
1022
1027
|
# Extract data from file
|
|
1023
1028
|
data = oe.SusceptibilityExtractor.extract(uargs.output_file)
|
|
@@ -1039,7 +1044,7 @@ def plot_susc_func(uargs) -> None:
|
|
|
1039
1044
|
|
|
1040
1045
|
# Load experimental data if provided
|
|
1041
1046
|
if uargs.exp_file is not None:
|
|
1042
|
-
exp_data =
|
|
1047
|
+
exp_data = read_csv(
|
|
1043
1048
|
uargs.exp_file,
|
|
1044
1049
|
comment='#',
|
|
1045
1050
|
skipinitialspace=True
|
|
@@ -1113,6 +1118,11 @@ def plot_ailft_func(uargs) -> None:
|
|
|
1113
1118
|
-------
|
|
1114
1119
|
None
|
|
1115
1120
|
'''
|
|
1121
|
+
import matplotlib.pyplot as plt
|
|
1122
|
+
import matplotlib as mpl
|
|
1123
|
+
|
|
1124
|
+
# Change matplotlib font size to be larger
|
|
1125
|
+
mpl.rcParams.update({'font.size': 12})
|
|
1116
1126
|
|
|
1117
1127
|
# Create extractor
|
|
1118
1128
|
data = oe.AILFTOrbEnergyExtractor.extract(uargs.output_file)
|
|
@@ -1940,7 +1950,7 @@ def read_args(arg_list=None):
|
|
|
1940
1950
|
'-e',
|
|
1941
1951
|
'--elements',
|
|
1942
1952
|
type=str,
|
|
1943
|
-
default=
|
|
1953
|
+
default=atomic_elements,
|
|
1944
1954
|
nargs='+',
|
|
1945
1955
|
help='Only print contributions from specified element(s) e.g. Ni'
|
|
1946
1956
|
)
|
|
@@ -538,25 +538,23 @@ class FrequencyExtractor(extto.BetweenExtractor):
|
|
|
538
538
|
tz_pattern = re.compile(
|
|
539
539
|
r'\([ -]?\d\.\d{6} *-?\d\.\d{6} *(-?\d\.\d{6})\)'
|
|
540
540
|
)
|
|
541
|
-
|
|
542
|
-
# r'(\d\.\d{6}) *\([ -]?\d\.\d{6} *-?\d\.\d{6} *-?\d\.\d{6}\)'
|
|
543
|
-
# )
|
|
544
|
-
# eps_pat = re.compile(
|
|
545
|
-
# r'\d{,4}: * \d{,4}.\d{2} * (\d.\d{6})'
|
|
546
|
-
# )
|
|
541
|
+
|
|
547
542
|
tx = np.asarray(
|
|
548
|
-
[
|
|
543
|
+
[float(val) for val in tx_pattern.findall(block)]
|
|
549
544
|
)
|
|
550
545
|
ty = np.asarray(
|
|
551
|
-
[
|
|
546
|
+
[float(val) for val in ty_pattern.findall(block)]
|
|
552
547
|
)
|
|
553
548
|
tz = np.asarray(
|
|
554
|
-
[
|
|
549
|
+
[float(val) for val in tz_pattern.findall(block)]
|
|
555
550
|
)
|
|
556
551
|
|
|
557
|
-
#
|
|
558
|
-
|
|
559
|
-
|
|
552
|
+
# t values are missing for first n_zero modes and for imaginary modes
|
|
553
|
+
n_missing = len(wavenumbers) - len(tx)
|
|
554
|
+
z_arr = np.zeros(n_missing)
|
|
555
|
+
tx = np.concatenate((z_arr, tx))
|
|
556
|
+
ty = np.concatenate((z_arr, ty))
|
|
557
|
+
tz = np.concatenate((z_arr, tz))
|
|
560
558
|
|
|
561
559
|
# This is the T2 printed by ORCA
|
|
562
560
|
# (Dipole derivative wrt to MWC)**2 * vibrational overlap**2
|
|
@@ -574,11 +572,10 @@ class FrequencyExtractor(extto.BetweenExtractor):
|
|
|
574
572
|
icm2eh = 100 / sc.physical_constants['hartree-inverse meter relationship'][0] # noqa
|
|
575
573
|
#
|
|
576
574
|
b2 = np.zeros_like(wavenumbers)
|
|
577
|
-
|
|
578
|
-
b2[n_zero:] = 1 / (2 * icm2eh * wavenumbers[n_zero:])
|
|
575
|
+
b2[n_missing:] = 1 / (2 * icm2eh * wavenumbers[n_missing:])
|
|
579
576
|
# divide by sqrt(b2)
|
|
580
577
|
# to give units of e m_e^-1/2
|
|
581
|
-
t[
|
|
578
|
+
t[n_missing:] /= np.sqrt(b2[n_missing:])
|
|
582
579
|
|
|
583
580
|
# Convert to SI
|
|
584
581
|
# First convert electrons to coulombs
|
|
@@ -588,12 +585,13 @@ class FrequencyExtractor(extto.BetweenExtractor):
|
|
|
588
585
|
t *= (sc.m_e)**-0.5
|
|
589
586
|
|
|
590
587
|
# Calculate A_e in units of m mol^-1
|
|
588
|
+
# this is "Intensity" in Orca
|
|
591
589
|
ae = np.ones_like(wavenumbers)
|
|
592
|
-
ae[:
|
|
590
|
+
ae[:n_missing] = 0
|
|
593
591
|
ae *= sc.Avogadro / (12 * sc.epsilon_0 * sc.speed_of_light**2)
|
|
594
|
-
ae[
|
|
592
|
+
ae[n_missing:] *= t[n_missing:] ** 2
|
|
595
593
|
# and convert to km mol^-1
|
|
596
|
-
ae[
|
|
594
|
+
ae[n_missing:] /= 1000
|
|
597
595
|
|
|
598
596
|
# Convert absorbance to linear
|
|
599
597
|
alin = ae / np.log(10)
|
orto-0.27.1/orto/__version__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '0.27.1'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|