orto 1.0.1__py3-none-any.whl → 1.0.2__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 CHANGED
@@ -1 +1 @@
1
- __version__ = '1.0.1'
1
+ __version__ = '1.0.2'
orto/cli.py CHANGED
@@ -6,25 +6,16 @@ import pathlib
6
6
  import os
7
7
  import copy
8
8
  import subprocess
9
- from pandas import read_csv
10
- import scipy.constants as constants
9
+ import csv
11
10
  import numpy as np
12
- from extto import DataNotFoundError
13
11
  import re
14
12
  from mmap import mmap, ACCESS_READ
15
13
  from shutil import move as shutilmove
16
14
 
17
-
18
- from docx import Document
19
- from docx.enum.text import WD_ALIGN_PARAGRAPH
20
- from docx.enum.table import WD_ALIGN_VERTICAL
21
- from docx.shared import Pt
22
-
23
- from . import plotter
24
- from . import extractor as oe
25
15
  from . import job
26
16
  from . import utils as ut
27
- from . import input as inp
17
+ from . import constants as cst
18
+ from .exceptions import DataNotFoundError, DataFormattingError
28
19
 
29
20
  _SHOW_CONV = {
30
21
  'on': True,
@@ -56,6 +47,7 @@ def extract_coords_func(uargs, save=True):
56
47
  -------
57
48
  None
58
49
  '''
50
+ from . import extractor as oe
59
51
 
60
52
  # Open file and extract coordinates
61
53
  labels, coords = oe.get_coords(
@@ -83,6 +75,11 @@ def extract_sf_energies_func(uargs):
83
75
  '''
84
76
  Wrapper for cli call to extract spin-free energies
85
77
  '''
78
+ from . import extractor as oe
79
+ from docx import Document
80
+ from docx.enum.text import WD_ALIGN_PARAGRAPH
81
+ from docx.enum.table import WD_ALIGN_VERTICAL
82
+ from docx.shared import Pt
86
83
 
87
84
  all_data = oe.SpinFreeEnergyExtractor().extract(
88
85
  uargs.output_file
@@ -166,6 +163,7 @@ def extract_so_energies_func(uargs):
166
163
  '''
167
164
  Wrapper for cli call to extract spin-orbit energies
168
165
  '''
166
+ from . import extractor as oe
169
167
 
170
168
  all_energies = oe.SpinOrbitEnergyExtractor().extract(
171
169
  uargs.output_file
@@ -206,6 +204,11 @@ def extract_gmatrix_func(uargs, save=True):
206
204
  -------
207
205
  None
208
206
  '''
207
+ from . import extractor as oe
208
+ from docx import Document
209
+ from docx.enum.text import WD_ALIGN_PARAGRAPH
210
+ from docx.enum.table import WD_ALIGN_VERTICAL
211
+ from docx.shared import Pt
209
212
 
210
213
  choices = {
211
214
  'total': oe.GMatrixExtractor,
@@ -407,6 +410,7 @@ def gen_job_func(uargs):
407
410
  -------
408
411
  None
409
412
  '''
413
+ from . import input as inp
410
414
 
411
415
  for input_file in uargs.input_files:
412
416
 
@@ -461,13 +465,13 @@ def gen_job_func(uargs):
461
465
  # Check xyz file is present
462
466
  try:
463
467
  inp.check_xyz(oj.input_file, uargs.skip_xyz)
464
- except (oe.DataNotFoundError, oe.DataFormattingError) as e:
468
+ except (DataNotFoundError, DataFormattingError) as e:
465
469
  ut.red_exit(str(e))
466
470
 
467
471
  # Check for moread and moinp
468
472
  try:
469
473
  inp.check_moinp_moread(oj.input_file)
470
- except (oe.DataNotFoundError, oe.DataFormattingError) as e:
474
+ except (DataNotFoundError, DataFormattingError) as e:
471
475
  ut.red_exit(str(e))
472
476
 
473
477
  # Submitter configuration options
@@ -478,7 +482,7 @@ def gen_job_func(uargs):
478
482
  try:
479
483
  n_procs = inp.get_nprocs(oj.input_file)
480
484
  maxcore = inp.get_maxcore(oj.input_file)
481
- except (oe.DataNotFoundError, oe.DataFormattingError) as e:
485
+ except (DataNotFoundError, DataFormattingError) as e:
482
486
  ut.red_exit(str(e))
483
487
 
484
488
  # If memory and procs specified as arguments, give warning when
@@ -543,6 +547,8 @@ def plot_abs_func(uargs):
543
547
  '''
544
548
  import matplotlib.pyplot as plt
545
549
  import matplotlib as mpl
550
+ from . import plotter
551
+ from . import extractor as oe
546
552
 
547
553
  # Set user specified font name
548
554
  if os.getenv('orto_fontname'):
@@ -655,6 +661,21 @@ def plot_ir_func(uargs):
655
661
  -------
656
662
  None
657
663
  '''
664
+ import matplotlib.pyplot as plt
665
+ import matplotlib as mpl
666
+ from . import plotter
667
+ from . import extractor as oe
668
+
669
+ # Set user specified font name
670
+ if os.getenv('orto_fontname'):
671
+ try:
672
+ plt.rcParams['font.family'] = os.getenv('orto_fontname')
673
+ except ValueError:
674
+ ut.cprint('Error in orto_fontname environment variable', 'red')
675
+ sys.exit(1)
676
+
677
+ # Change matplotlib font size to be larger
678
+ mpl.rcParams.update({'font.size': 12})
658
679
 
659
680
  # Extract frequency information
660
681
  data = oe.FrequencyExtractor.extract(uargs.output_file)
@@ -665,7 +686,7 @@ def plot_ir_func(uargs):
665
686
  data = data[0]
666
687
 
667
688
  # Plot infrared spectrum
668
- fig, ax = plotter.plot_ir(
689
+ plotter.plot_ir(
669
690
  data['energy (cm^-1)'],
670
691
  data['epsilon (L mol^-1 cm^-1)'],
671
692
  linewidth=uargs.linewidth,
@@ -691,6 +712,7 @@ def distort_func(uargs):
691
712
  None
692
713
 
693
714
  '''
715
+ from . import extractor as oe
694
716
 
695
717
  # Open file and extract coordinates
696
718
  labels, coords = oe.get_coords(
@@ -737,6 +759,7 @@ def extract_orbs_func(uargs, save=True) -> None:
737
759
  -------
738
760
  None
739
761
  '''
762
+ from . import extractor as oe
740
763
 
741
764
  # Check for spin in file, if present
742
765
  try:
@@ -896,6 +919,7 @@ def extract_freq_func(uargs, save=True):
896
919
  -------
897
920
  None
898
921
  '''
922
+ from . import extractor as oe
899
923
 
900
924
  # Extract frequency information
901
925
  data = oe.FrequencyExtractor.extract(uargs.output_file)
@@ -945,6 +969,7 @@ def extract_pop_func(uargs, save=True) -> None:
945
969
  -------
946
970
  None
947
971
  '''
972
+ from . import extractor as oe
948
973
 
949
974
  if uargs.flavour in ['loewdin', 'lowdin']:
950
975
  data = oe.LoewdinPopulationExtractor.extract(
@@ -1020,6 +1045,8 @@ def plot_susc_func(uargs) -> None:
1020
1045
  '''
1021
1046
  import matplotlib.pyplot as plt
1022
1047
  import matplotlib as mpl
1048
+ from . import plotter
1049
+ from . import extractor as oe
1023
1050
 
1024
1051
  # Change matplotlib font size to be larger
1025
1052
  mpl.rcParams.update({'font.size': 12})
@@ -1042,22 +1069,28 @@ def plot_susc_func(uargs) -> None:
1042
1069
  'green'
1043
1070
  )
1044
1071
 
1045
- # Load experimental data if provided
1046
1072
  if uargs.exp_file is not None:
1047
- exp_data = read_csv(
1048
- uargs.exp_file,
1049
- comment='#',
1050
- skipinitialspace=True
1051
- )
1073
+ exp_data = {'Temperature (K)': [], 'chi*T (cm3*K/mol)': []}
1074
+ with open(uargs.exp_file, newline='') as csvfile:
1075
+ reader = csv.DictReader(
1076
+ row for row in csvfile if not row.startswith('#')
1077
+ )
1078
+ for row in reader:
1079
+ exp_data['Temperature (K)'].append(
1080
+ float(row['Temperature (K)'])
1081
+ )
1082
+ exp_data['chi*T (cm3*K/mol)'].append(
1083
+ float(row['chi*T (cm3*K/mol)'])
1084
+ )
1052
1085
 
1053
1086
  # Conversion factors from cm3 K mol^-1 to ...
1054
1087
  convs = {
1055
- 'A3 K': 1E24 / constants.Avogadro,
1088
+ 'A3 K': 1E24 / cst.AVOGADRO,
1056
1089
  'A3 mol-1 K': 1E24,
1057
- 'cm3 K': 1 / constants.Avogadro,
1090
+ 'cm3 K': 1 / cst.AVOGADRO,
1058
1091
  'cm3 mol-1 K': 1,
1059
- 'emu K': 1 / (4 * constants.pi * constants.Avogadro),
1060
- 'emu mol-1 K': 1 / (4 * constants.pi)
1092
+ 'emu K': 1 / (4 * np.pi * cst.AVOGADRO),
1093
+ 'emu mol-1 K': 1 / (4 * np.pi)
1061
1094
  }
1062
1095
 
1063
1096
  unit_labels = {
@@ -1083,7 +1116,10 @@ def plot_susc_func(uargs) -> None:
1083
1116
  if uargs.exp_file is not None:
1084
1117
  ax.plot(
1085
1118
  exp_data['Temperature (K)'],
1086
- exp_data['chi*T (cm3*K/mol)'] * convs[uargs.esusc_units],
1119
+ [
1120
+ val * convs[uargs.esusc_units]
1121
+ for val in exp_data['chi*T (cm3*K/mol)']
1122
+ ],
1087
1123
  lw=0,
1088
1124
  marker='o',
1089
1125
  fillstyle='none',
@@ -1120,6 +1156,8 @@ def plot_ailft_func(uargs) -> None:
1120
1156
  '''
1121
1157
  import matplotlib.pyplot as plt
1122
1158
  import matplotlib as mpl
1159
+ from . import plotter
1160
+ from . import extractor as oe
1123
1161
 
1124
1162
  # Change matplotlib font size to be larger
1125
1163
  mpl.rcParams.update({'font.size': 12})
orto/constants.py ADDED
@@ -0,0 +1,8 @@
1
+ AVOGADRO = 6.02214076e23 # mol^-1
2
+ HARTREE2INVERSE_M = 2.194746313705E7 # m^-1
3
+ HARTREE2INVERSE_CM = 100 / HARTREE2INVERSE_M
4
+ ELECTRON_CHARGE = 1.602176487e-19 # C
5
+ ELECTRON_MASS = 9.10938215E-31 # kg
6
+ EPSILON_0 = 8.8541878128E-12 # F m^-1
7
+ SPEED_OF_LIGHT_M_S = 299792458.0 # m s^-1
8
+ SPEED_OF_LIGHT_CM_S = SPEED_OF_LIGHT_M_S * 100.0 # cm s^-1
orto/exceptions.py ADDED
@@ -0,0 +1,5 @@
1
+ from extto import DataNotFoundError as exttoDNF
2
+ from extto import DataFormattingError as exttoDFE
3
+
4
+ DataNotFoundError = exttoDNF
5
+ DataFormattingError = exttoDFE
orto/extractor.py CHANGED
@@ -7,12 +7,10 @@ import re
7
7
  import pandas as pd
8
8
  from io import StringIO
9
9
  import pathlib
10
- import scipy.constants as sc
11
10
  import copy
12
11
 
13
- # Reimplemented for convenience
14
- DataNotFoundError = extto.DataNotFoundError
15
- DataFormattingError = extto.DataFormattingError
12
+ from .exceptions import DataFormattingError
13
+ from . import constants as const
16
14
 
17
15
 
18
16
  class OrcaVersionExtractor(extto.LineExtractor):
@@ -569,26 +567,24 @@ class FrequencyExtractor(extto.BetweenExtractor):
569
567
  # in atomic units
570
568
  # b^2 = hbar/(2*c*nubar) --> 1/(2*nubar)
571
569
  # m_e^-1/2 a_0
572
- icm2eh = 100 / sc.physical_constants['hartree-inverse meter relationship'][0] # noqa
573
- #
574
570
  b2 = np.zeros_like(wavenumbers)
575
- b2[n_missing:] = 1 / (2 * icm2eh * wavenumbers[n_missing:])
571
+ b2[n_missing:] = 1 / (2 * const.HARTREE2INVERSE_CM * wavenumbers[n_missing:]) # noqa
576
572
  # divide by sqrt(b2)
577
573
  # to give units of e m_e^-1/2
578
574
  t[n_missing:] /= np.sqrt(b2[n_missing:])
579
575
 
580
576
  # Convert to SI
581
577
  # First convert electrons to coulombs
582
- t *= sc.e
578
+ t *= const.ELECTRON_CHARGE
583
579
 
584
580
  # and then reciprocal atomic mass units (m_e^-1/2) to kg^-1/2
585
- t *= (sc.m_e)**-0.5
581
+ t *= (const.ELECTRON_MASS)**-0.5
586
582
 
587
583
  # Calculate A_e in units of m mol^-1
588
584
  # this is "Intensity" in Orca
589
585
  ae = np.ones_like(wavenumbers)
590
586
  ae[:n_missing] = 0
591
- ae *= sc.Avogadro / (12 * sc.epsilon_0 * sc.speed_of_light**2)
587
+ ae *= const.AVOGADRO / (12 * const.EPSILON_0 * const.SPEED_OF_LIGHT_M_S**2) # noqa
592
588
  ae[n_missing:] *= t[n_missing:] ** 2
593
589
  # and convert to km mol^-1
594
590
  ae[n_missing:] /= 1000
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orto
3
- Version: 1.0.1
3
+ Version: 1.0.2
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
@@ -0,0 +1,15 @@
1
+ orto/__init__.py,sha256=iSR4TAfpJn1_mwTnnncgwmWBz3q_ImdmhnOORKcOvE0,63
2
+ orto/__version__.py,sha256=ZTipNH6wyC6qsq1H_lZsvJyVruUa1nu3y4EysMdkpuU,22
3
+ orto/cli.py,sha256=yckaw1kryADOWz-NZPzXpXYTp8L9X89TVqUErfg3RsY,61241
4
+ orto/constants.py,sha256=2obWYg306Lce4U9Qs4MHg1yZq7SHFkazG-cnkD5svpo,343
5
+ orto/exceptions.py,sha256=D7oNeAEGeJNt5thzt6PaCn5FY6JcbJOWUE1N1LVhhuE,159
6
+ orto/extractor.py,sha256=tO2oFf6Cgwdnh_m1v8r1rXQO2_FL7s-1KBqLPy6zNco,67384
7
+ orto/input.py,sha256=UMYNPGeqOCNKvPYJVfVS2JU7Ost_xM1ZG28t5f9-Er0,7084
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.0.2.dist-info/METADATA,sha256=CLX4q02Rz1nw7wH1ShlOOa0QHUyo7yadjv17Wjj9nXc,1140
12
+ orto-1.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
13
+ orto-1.0.2.dist-info/entry_points.txt,sha256=HXenCglMp_03JkN34pK2phkjXK9CFcXTGHKv5QaVY8I,39
14
+ orto-1.0.2.dist-info/top_level.txt,sha256=hQ-z28gTN_FZ2B5Kiwxr_9cUTcCoib9W5HjbkceDXw4,5
15
+ orto-1.0.2.dist-info/RECORD,,
@@ -1,13 +0,0 @@
1
- orto/__init__.py,sha256=iSR4TAfpJn1_mwTnnncgwmWBz3q_ImdmhnOORKcOvE0,63
2
- orto/__version__.py,sha256=3KXfAcA5rzzQXMtfwpHphgbJNZdA0XWaW96kdWVSZJw,22
3
- orto/cli.py,sha256=xRcJw_65gQmpBsmruRe46r2gd7fBdLpoh9Z0oPLPcM8,59795
4
- orto/extractor.py,sha256=kJnVI_Zwz7yorbojWdgxN-NSspJIY9pKoDb1RD2dHUg,67488
5
- orto/input.py,sha256=UMYNPGeqOCNKvPYJVfVS2JU7Ost_xM1ZG28t5f9-Er0,7084
6
- orto/job.py,sha256=SM0nlc_bqhhPvfuuykhMvaUnkwC3Gp-6RvYw_a0TyGc,5855
7
- orto/plotter.py,sha256=ICrO03T_HGe-H1XKZ2qzsKYdPY44E0PKiXqIQQawd7I,15633
8
- orto/utils.py,sha256=gVfGplkfc6xGYgLMi_7I_yAdWG-QKRaqQdy9v5F4Mck,7279
9
- orto-1.0.1.dist-info/METADATA,sha256=tkPj-dCGN-DhaYdlyGkXVysH-4STdCAf4kPr-hXYbfU,1140
10
- orto-1.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
- orto-1.0.1.dist-info/entry_points.txt,sha256=HXenCglMp_03JkN34pK2phkjXK9CFcXTGHKv5QaVY8I,39
12
- orto-1.0.1.dist-info/top_level.txt,sha256=hQ-z28gTN_FZ2B5Kiwxr_9cUTcCoib9W5HjbkceDXw4,5
13
- orto-1.0.1.dist-info/RECORD,,
File without changes