orto 1.0.6__tar.gz → 1.2.0__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.0.6 → orto-1.2.0}/PKG-INFO +2 -2
- orto-1.2.0/orto/__version__.py +1 -0
- {orto-1.0.6 → orto-1.2.0}/orto/cli.py +61 -2
- {orto-1.0.6 → orto-1.2.0}/orto/extractor.py +22 -2
- {orto-1.0.6 → orto-1.2.0}/orto/input.py +114 -0
- {orto-1.0.6 → orto-1.2.0}/orto.egg-info/PKG-INFO +2 -2
- {orto-1.0.6 → orto-1.2.0}/orto.egg-info/requires.txt +1 -1
- {orto-1.0.6 → orto-1.2.0}/setup.py +2 -2
- orto-1.0.6/orto/__version__.py +0 -1
- {orto-1.0.6 → orto-1.2.0}/README.md +0 -0
- {orto-1.0.6 → orto-1.2.0}/orto/__init__.py +0 -0
- {orto-1.0.6 → orto-1.2.0}/orto/constants.py +0 -0
- {orto-1.0.6 → orto-1.2.0}/orto/exceptions.py +0 -0
- {orto-1.0.6 → orto-1.2.0}/orto/job.py +0 -0
- {orto-1.0.6 → orto-1.2.0}/orto/plotter.py +0 -0
- {orto-1.0.6 → orto-1.2.0}/orto/utils.py +0 -0
- {orto-1.0.6 → orto-1.2.0}/orto.egg-info/SOURCES.txt +0 -0
- {orto-1.0.6 → orto-1.2.0}/orto.egg-info/dependency_links.txt +0 -0
- {orto-1.0.6 → orto-1.2.0}/orto.egg-info/entry_points.txt +0 -0
- {orto-1.0.6 → orto-1.2.0}/orto.egg-info/top_level.txt +0 -0
- {orto-1.0.6 → orto-1.2.0}/pyproject.toml +0 -0
- {orto-1.0.6 → orto-1.2.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: orto
|
|
3
|
-
Version: 1.0
|
|
3
|
+
Version: 1.2.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>=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 @@
|
|
|
1
|
+
__version__ = '1.2.0'
|
|
@@ -464,7 +464,7 @@ def gen_job_func(uargs):
|
|
|
464
464
|
|
|
465
465
|
# Check xyz file is present
|
|
466
466
|
try:
|
|
467
|
-
inp.
|
|
467
|
+
inp.check_coord(oj.input_file, uargs.skip_xyz)
|
|
468
468
|
except (DataNotFoundError, DataFormattingError) as e:
|
|
469
469
|
ut.red_exit(str(e))
|
|
470
470
|
|
|
@@ -504,6 +504,28 @@ def gen_job_func(uargs):
|
|
|
504
504
|
# Use orca file value
|
|
505
505
|
config['mem_per_cpu'] = maxcore
|
|
506
506
|
|
|
507
|
+
# Check if NBO is requested
|
|
508
|
+
if inp.get_nbo(oj.input_file):
|
|
509
|
+
# Check if NBO module has been provided to orto
|
|
510
|
+
try:
|
|
511
|
+
if os.getenv('orto_nbo_load') is not None:
|
|
512
|
+
nbo_module = os.getenv('orto_nbo_load')
|
|
513
|
+
else:
|
|
514
|
+
ut.red_exit(
|
|
515
|
+
'Missing orto_nbo_load environment variable'
|
|
516
|
+
)
|
|
517
|
+
except ValueError:
|
|
518
|
+
ut.red_exit(
|
|
519
|
+
(
|
|
520
|
+
'Missing or malformed orto_nbo_load'
|
|
521
|
+
'environment variable'
|
|
522
|
+
)
|
|
523
|
+
)
|
|
524
|
+
oj.pre_orca += f'module load {nbo_module}\n'
|
|
525
|
+
oj.pre_orca += f'export NBOFIL={oj.input_file.stem}\n'
|
|
526
|
+
else:
|
|
527
|
+
nbo_module = None
|
|
528
|
+
|
|
507
529
|
# Set SLURM error and output file names
|
|
508
530
|
config['error'] = 'slurm.%j.e'
|
|
509
531
|
config['output'] = 'slurm.%j.o'
|
|
@@ -835,9 +857,22 @@ def extract_orbs_func(uargs, save=True) -> None:
|
|
|
835
857
|
dtype=int
|
|
836
858
|
)
|
|
837
859
|
])
|
|
860
|
+
elif uargs.num is not None:
|
|
861
|
+
keep = uargs.num
|
|
838
862
|
else:
|
|
839
863
|
keep = range(len(contributions))
|
|
840
864
|
|
|
865
|
+
# Remove orbital indices which do not exist
|
|
866
|
+
keep = [val for val in keep if val < len(contributions)]
|
|
867
|
+
|
|
868
|
+
if not len(keep):
|
|
869
|
+
ut.red_exit(
|
|
870
|
+
(
|
|
871
|
+
r'Selected orbital indices do not exist!'
|
|
872
|
+
f'\nNORBS = {len(contributions):d}'
|
|
873
|
+
)
|
|
874
|
+
)
|
|
875
|
+
|
|
841
876
|
contributions = contributions.loc[:, keep]
|
|
842
877
|
|
|
843
878
|
# Remove contributions from unwanted orbitals
|
|
@@ -2058,13 +2093,37 @@ def read_args(arg_list=None):
|
|
|
2058
2093
|
)
|
|
2059
2094
|
)
|
|
2060
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
|
+
|
|
2061
2121
|
orb_group.add_argument(
|
|
2062
2122
|
'-hl',
|
|
2063
2123
|
'--homo_lumo',
|
|
2064
2124
|
nargs='?',
|
|
2065
2125
|
type=int,
|
|
2066
2126
|
metavar='NUMBER',
|
|
2067
|
-
const=0,
|
|
2068
2127
|
default=None,
|
|
2069
2128
|
help=(
|
|
2070
2129
|
'Print specified number of orbitals either side of HOMO and LUMO'
|
|
@@ -1880,7 +1880,7 @@ class MOInpExtractor(extto.LineExtractor):
|
|
|
1880
1880
|
|
|
1881
1881
|
class XYZInputExtractor(extto.LineExtractor):
|
|
1882
1882
|
'''
|
|
1883
|
-
Extracts
|
|
1883
|
+
Extracts *xyz line of an input file
|
|
1884
1884
|
|
|
1885
1885
|
*xyz charge multiplicity
|
|
1886
1886
|
'''
|
|
@@ -1936,6 +1936,26 @@ class XYZInputExtractor(extto.LineExtractor):
|
|
|
1936
1936
|
return _ext.data
|
|
1937
1937
|
|
|
1938
1938
|
|
|
1939
|
+
class IntInputExtractor(XYZInputExtractor):
|
|
1940
|
+
'''
|
|
1941
|
+
Extracts *int line of an input file
|
|
1942
|
+
|
|
1943
|
+
*int charge multiplicity
|
|
1944
|
+
'''
|
|
1945
|
+
|
|
1946
|
+
# Regex pattern for line
|
|
1947
|
+
PATTERN = rb'\* *int *-?\d+ *\d'
|
|
1948
|
+
|
|
1949
|
+
MODIFIERS = [re.IGNORECASE]
|
|
1950
|
+
|
|
1951
|
+
@property
|
|
1952
|
+
def data(self) -> list[str]:
|
|
1953
|
+
'''
|
|
1954
|
+
*int line, one entry per match
|
|
1955
|
+
'''
|
|
1956
|
+
return self._data
|
|
1957
|
+
|
|
1958
|
+
|
|
1939
1959
|
class MaxCoreInputExtractor(extto.LineExtractor):
|
|
1940
1960
|
'''
|
|
1941
1961
|
Extracts maxcore from input file\n
|
|
@@ -2006,7 +2026,7 @@ class SimpleInputExtractor(extto.LineExtractor):
|
|
|
2006
2026
|
# Regex pattern for line
|
|
2007
2027
|
PATTERN = rb'^ *!.*'
|
|
2008
2028
|
|
|
2009
|
-
MODIFIERS = [re.IGNORECASE]
|
|
2029
|
+
MODIFIERS = [re.IGNORECASE, re.MULTILINE]
|
|
2010
2030
|
|
|
2011
2031
|
@property
|
|
2012
2032
|
def data(self) -> list[str]:
|
|
@@ -9,6 +9,45 @@ from . import extractor as oe
|
|
|
9
9
|
from . import utils as ut
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
def get_nbo(file_name: str | Path) -> bool:
|
|
13
|
+
'''
|
|
14
|
+
Check if NBO is present in the simple input line.\n
|
|
15
|
+
|
|
16
|
+
Parameters
|
|
17
|
+
----------
|
|
18
|
+
file_name: str | Path
|
|
19
|
+
Orca input file as either name or Path object
|
|
20
|
+
|
|
21
|
+
Returns
|
|
22
|
+
-------
|
|
23
|
+
bool
|
|
24
|
+
True if NBO is present, False otherwise
|
|
25
|
+
'''
|
|
26
|
+
# Check for simple input line beginning with !
|
|
27
|
+
try:
|
|
28
|
+
simple = oe.SimpleInputExtractor.extract(file_name)
|
|
29
|
+
except DataNotFoundError:
|
|
30
|
+
ut.red_exit(
|
|
31
|
+
'Error: Missing simple input line (or !) in input file'
|
|
32
|
+
)
|
|
33
|
+
# Check for NBO in simple input
|
|
34
|
+
nbo_simple = re.findall(
|
|
35
|
+
r'NBO',
|
|
36
|
+
simple[0],
|
|
37
|
+
flags=re.IGNORECASE
|
|
38
|
+
)
|
|
39
|
+
if len(nbo_simple):
|
|
40
|
+
# Set to True if found
|
|
41
|
+
if nbo_simple is None:
|
|
42
|
+
_nbo = True
|
|
43
|
+
else:
|
|
44
|
+
_nbo = True
|
|
45
|
+
else:
|
|
46
|
+
_nbo = False
|
|
47
|
+
|
|
48
|
+
return _nbo
|
|
49
|
+
|
|
50
|
+
|
|
12
51
|
def get_nprocs(file_name: str | Path) -> int:
|
|
13
52
|
'''
|
|
14
53
|
Get the number of processors from the input file.\n
|
|
@@ -124,6 +163,81 @@ def get_maxcore(file_name: str | Path) -> int:
|
|
|
124
163
|
return maxcore
|
|
125
164
|
|
|
126
165
|
|
|
166
|
+
def check_coord(file_name: str | Path, skip_check) -> None:
|
|
167
|
+
'''
|
|
168
|
+
Check *xyz, *xyzfile, or *int line is present in input file.\n
|
|
169
|
+
If xyzfile is given, then also checks if this exists and is formatted \n
|
|
170
|
+
correctly.\n
|
|
171
|
+
|
|
172
|
+
Parameters
|
|
173
|
+
----------
|
|
174
|
+
file_name: str | Path
|
|
175
|
+
Orca input file as either name or Path object
|
|
176
|
+
skip_check: bool
|
|
177
|
+
If True, skip the xyz file check
|
|
178
|
+
|
|
179
|
+
Returns
|
|
180
|
+
-------
|
|
181
|
+
None
|
|
182
|
+
|
|
183
|
+
Raises
|
|
184
|
+
------
|
|
185
|
+
DataNotFoundError
|
|
186
|
+
If neither *xyzfile, *xyz, nor *int are present in the input file
|
|
187
|
+
DataFormattingError
|
|
188
|
+
If xyz file is not formatted correctly
|
|
189
|
+
'''
|
|
190
|
+
|
|
191
|
+
# Get xyz file name and check it exists and is formatted correctly
|
|
192
|
+
try:
|
|
193
|
+
xyz_file = oe.XYZFileInputExtractor.extract(file_name)
|
|
194
|
+
except DataNotFoundError:
|
|
195
|
+
xyz_file = []
|
|
196
|
+
|
|
197
|
+
try:
|
|
198
|
+
xyzline = oe.XYZInputExtractor.extract(file_name)
|
|
199
|
+
except DataNotFoundError:
|
|
200
|
+
xyzline = []
|
|
201
|
+
|
|
202
|
+
try:
|
|
203
|
+
intline = oe.IntInputExtractor.extract(file_name)
|
|
204
|
+
except DataNotFoundError:
|
|
205
|
+
intline = []
|
|
206
|
+
|
|
207
|
+
lens = [len(xyz_file), len(xyzline), len(intline)]
|
|
208
|
+
|
|
209
|
+
if not sum(lens):
|
|
210
|
+
ut.red_exit(
|
|
211
|
+
'Error: missing or incorrect *xyzfile or *xyz line in input'
|
|
212
|
+
)
|
|
213
|
+
elif sum(lens) > 1:
|
|
214
|
+
ut.red_exit(
|
|
215
|
+
(
|
|
216
|
+
'Error: multiple *xyzfile or *xyz lines in input.\n'
|
|
217
|
+
'Only one can be present'
|
|
218
|
+
)
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
if len(xyz_file):
|
|
222
|
+
xyz_file = Path(xyz_file[0])
|
|
223
|
+
if not xyz_file.is_file():
|
|
224
|
+
ut.red_exit(
|
|
225
|
+
'Error: xyz file specified in input cannot be found'
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
if not skip_check:
|
|
229
|
+
try:
|
|
230
|
+
xyzp.check_xyz(
|
|
231
|
+
xyz_file.absolute(),
|
|
232
|
+
allow_indices=False
|
|
233
|
+
)
|
|
234
|
+
except xyzp.XYZError as e:
|
|
235
|
+
raise DataFormattingError(
|
|
236
|
+
f'{e}\n Use -sx to skip this check at your peril'
|
|
237
|
+
)
|
|
238
|
+
return
|
|
239
|
+
|
|
240
|
+
|
|
127
241
|
def check_xyz(file_name: str | Path, skip_check) -> None:
|
|
128
242
|
'''
|
|
129
243
|
Check *xyz or *xyzfile line is present in input file.\n
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: orto
|
|
3
|
-
Version: 1.0
|
|
3
|
+
Version: 1.2.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>=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
|
|
@@ -8,7 +8,7 @@ Please see the `orto` documentation for more details.
|
|
|
8
8
|
|
|
9
9
|
# DO NOT EDIT THIS NUMBER!
|
|
10
10
|
# IT IS AUTOMATICALLY CHANGED BY python-semantic-release
|
|
11
|
-
__version__ = '1.0
|
|
11
|
+
__version__ = '1.2.0'
|
|
12
12
|
|
|
13
13
|
setuptools.setup(
|
|
14
14
|
name='orto',
|
|
@@ -35,7 +35,7 @@ setuptools.setup(
|
|
|
35
35
|
'numpy>=2.1.2',
|
|
36
36
|
'xyz_py>=5.13.1',
|
|
37
37
|
'matplotlib>=3.9.2',
|
|
38
|
-
'extto>=0.
|
|
38
|
+
'extto>=1.0.1',
|
|
39
39
|
'pandas>=2.2.3',
|
|
40
40
|
'subto>=0.1.1',
|
|
41
41
|
'python-docx>=1.1.2'
|
orto-1.0.6/orto/__version__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '1.0.6'
|
|
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
|