orto 1.9.0__py3-none-any.whl → 1.10.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 +8 -1
- orto/extractor.py +112 -0
- {orto-1.9.0.dist-info → orto-1.10.0.dist-info}/METADATA +1 -1
- orto-1.10.0.dist-info/RECORD +17 -0
- orto-1.9.0.dist-info/RECORD +0 -17
- {orto-1.9.0.dist-info → orto-1.10.0.dist-info}/WHEEL +0 -0
- {orto-1.9.0.dist-info → orto-1.10.0.dist-info}/entry_points.txt +0 -0
- {orto-1.9.0.dist-info → orto-1.10.0.dist-info}/licenses/LICENSE +0 -0
- {orto-1.9.0.dist-info → orto-1.10.0.dist-info}/top_level.txt +0 -0
orto/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '1.
|
|
1
|
+
__version__ = '1.10.0'
|
orto/cli.py
CHANGED
|
@@ -217,9 +217,16 @@ def extract_gmatrix_func(uargs, save=True):
|
|
|
217
217
|
'L': oe.GMatrixLExtractor,
|
|
218
218
|
'S': oe.GMatrixSExtractor,
|
|
219
219
|
'eff': oe.GMatrixEffectiveExtractor,
|
|
220
|
+
'dft': oe.GMatrixDFTExtractor
|
|
220
221
|
}
|
|
221
222
|
|
|
222
|
-
|
|
223
|
+
if oe.EPRNMRDetector(uargs.output_file):
|
|
224
|
+
uargs.type = 'dft'
|
|
225
|
+
|
|
226
|
+
try:
|
|
227
|
+
all_data = choices[uargs.type]().extract(uargs.output_file)
|
|
228
|
+
except (DataFormattingError, ValueError) as e:
|
|
229
|
+
ut.red_exit(str(e))
|
|
223
230
|
|
|
224
231
|
if not save:
|
|
225
232
|
for it, data in enumerate(all_data):
|
orto/extractor.py
CHANGED
|
@@ -14,6 +14,19 @@ from .exceptions import DataFormattingError
|
|
|
14
14
|
from . import constants as const
|
|
15
15
|
|
|
16
16
|
|
|
17
|
+
def EPRNMRDetector(file_name: str | pathlib.Path) -> bool:
|
|
18
|
+
'''
|
|
19
|
+
Detects if Orca output file is from EPR/NMR calculation
|
|
20
|
+
'''
|
|
21
|
+
with open(file_name, 'rb') as f:
|
|
22
|
+
file_content = f.read()
|
|
23
|
+
|
|
24
|
+
if re.search(rb'%EPRNMR', file_content):
|
|
25
|
+
return True
|
|
26
|
+
else:
|
|
27
|
+
return False
|
|
28
|
+
|
|
29
|
+
|
|
17
30
|
class OrcaVersionExtractor(extto.LineExtractor):
|
|
18
31
|
'''
|
|
19
32
|
Extracts Orca version from output file
|
|
@@ -2421,6 +2434,100 @@ class SimpleInputExtractor(extto.LineExtractor):
|
|
|
2421
2434
|
return _ext.data
|
|
2422
2435
|
|
|
2423
2436
|
|
|
2437
|
+
class GMatrixDFTExtractor(extto.BetweenExtractor):
|
|
2438
|
+
'''
|
|
2439
|
+
Extracts DFT ELECTRONIC G-MATRIX block from output file
|
|
2440
|
+
'''
|
|
2441
|
+
|
|
2442
|
+
# Regex Start Pattern
|
|
2443
|
+
START_PATTERN = rb'(?<=ELECTRONIC G-MATRIX\s[\S\s]{19}\s)'
|
|
2444
|
+
|
|
2445
|
+
# Regex End Pattern
|
|
2446
|
+
END_PATTERN = rb'(?=EPR g-tensor done in)'
|
|
2447
|
+
|
|
2448
|
+
@property
|
|
2449
|
+
def data(self) -> dict[str, NDArray]:
|
|
2450
|
+
'''
|
|
2451
|
+
G Matrix data:\n
|
|
2452
|
+
A dictionary with keys:\n
|
|
2453
|
+
matrix\n
|
|
2454
|
+
values\n
|
|
2455
|
+
vectors
|
|
2456
|
+
All values are ndarray of floats
|
|
2457
|
+
'''
|
|
2458
|
+
return self._data
|
|
2459
|
+
|
|
2460
|
+
@staticmethod
|
|
2461
|
+
def _process_block(block: str) -> dict[str, NDArray]:
|
|
2462
|
+
'''
|
|
2463
|
+
Converts single block into data entries described in self.data
|
|
2464
|
+
|
|
2465
|
+
Parameters
|
|
2466
|
+
----------
|
|
2467
|
+
block: str
|
|
2468
|
+
String block extracted from file
|
|
2469
|
+
|
|
2470
|
+
Returns
|
|
2471
|
+
-------
|
|
2472
|
+
dict[str, NDArray]
|
|
2473
|
+
'''
|
|
2474
|
+
|
|
2475
|
+
# Trim block to lines after Orientation:
|
|
2476
|
+
|
|
2477
|
+
block = block.split('The g-matrix:')[-1]
|
|
2478
|
+
|
|
2479
|
+
# Get Matrix
|
|
2480
|
+
_matrix = re.findall(
|
|
2481
|
+
r'(\s-?\d\.\d{7}\s+-?\d\.\d{7}\s+-?\d\.\d{7})',
|
|
2482
|
+
block
|
|
2483
|
+
)[:3]
|
|
2484
|
+
|
|
2485
|
+
# Convert to matrix of floats
|
|
2486
|
+
matrix = np.asarray([
|
|
2487
|
+
[float(v) for v in val.split()]
|
|
2488
|
+
for val in _matrix
|
|
2489
|
+
])
|
|
2490
|
+
|
|
2491
|
+
if matrix.shape != (3, 3):
|
|
2492
|
+
raise DataFormattingError(
|
|
2493
|
+
'G-matrix is not the correct shape (3x3)'
|
|
2494
|
+
)
|
|
2495
|
+
|
|
2496
|
+
# Diagonalise g.g^T
|
|
2497
|
+
vals, vecs = la.eigh(matrix @ matrix.T)
|
|
2498
|
+
|
|
2499
|
+
# get g values as sqrt of eigenvalues of g.g^T
|
|
2500
|
+
vals = np.sqrt(vals)
|
|
2501
|
+
|
|
2502
|
+
data = {
|
|
2503
|
+
'matrix': matrix,
|
|
2504
|
+
'values': vals,
|
|
2505
|
+
'vectors': vecs
|
|
2506
|
+
}
|
|
2507
|
+
|
|
2508
|
+
return data
|
|
2509
|
+
|
|
2510
|
+
@classmethod
|
|
2511
|
+
def extract(cls, file_name: str | pathlib.Path) -> list[dict[str, NDArray]]: # noqa
|
|
2512
|
+
'''
|
|
2513
|
+
Convenience method which instantiates class, extracts blocks, and
|
|
2514
|
+
returns processed datasets
|
|
2515
|
+
|
|
2516
|
+
Parameters
|
|
2517
|
+
----------
|
|
2518
|
+
file_name: str | pathlib.Path
|
|
2519
|
+
File to parse
|
|
2520
|
+
|
|
2521
|
+
Returns
|
|
2522
|
+
-------
|
|
2523
|
+
list[dict[str, NDArray]]
|
|
2524
|
+
Each entry contains processed data, as defined in cls.data
|
|
2525
|
+
'''
|
|
2526
|
+
_ext = cls()
|
|
2527
|
+
_ext(file_name, process=True)
|
|
2528
|
+
return _ext.data
|
|
2529
|
+
|
|
2530
|
+
|
|
2424
2531
|
class GMatrixExtractor(extto.BetweenExtractor):
|
|
2425
2532
|
'''
|
|
2426
2533
|
Extracts ELECTRONIC G-MATRIX block from output file
|
|
@@ -2471,6 +2578,11 @@ class GMatrixExtractor(extto.BetweenExtractor):
|
|
|
2471
2578
|
for val in _matrix
|
|
2472
2579
|
])
|
|
2473
2580
|
|
|
2581
|
+
if matrix.shape != (3, 3):
|
|
2582
|
+
raise DataFormattingError(
|
|
2583
|
+
'G-matrix is not the correct shape (3x3)'
|
|
2584
|
+
)
|
|
2585
|
+
|
|
2474
2586
|
# Diagonalise g.g^T
|
|
2475
2587
|
vals, vecs = la.eigh(matrix @ matrix.T)
|
|
2476
2588
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
orto/__init__.py,sha256=IedlltYr3qYZxChNUdz62qogXA9Pos_MUvXdGXqAa0E,41
|
|
2
|
+
orto/__version__.py,sha256=ZXE8njb1SRoMJuadNA6KRGRdfAFsM49XLsgr_fSOXts,23
|
|
3
|
+
orto/cli.py,sha256=XBeO5dTWaZP_mnNA5IR2eZBcnhHEtwW6IuFtLgUPMkA,86309
|
|
4
|
+
orto/constants.py,sha256=anxaiTykO8Q_CXliR7zuOAdnXZrQ2-C4ndaviyl7kGc,419
|
|
5
|
+
orto/data.py,sha256=960LHFeG7l626X_WA-8YxvG2toNAsgNvLo86OoYAmBY,14910
|
|
6
|
+
orto/exceptions.py,sha256=D7oNeAEGeJNt5thzt6PaCn5FY6JcbJOWUE1N1LVhhuE,159
|
|
7
|
+
orto/extractor.py,sha256=oqRdDWLaVPIwB4aZ5nrITWexx60hKn0zghACmymwVfM,80618
|
|
8
|
+
orto/input.py,sha256=uUQV6A-8D0GZpRoY1rKK_aUPmk9kVVTnMzTHuisP5t4,11888
|
|
9
|
+
orto/job.py,sha256=tDiz9omFwinoYJamgz66MZez0Ee9HMhuCIAeHMhXRF8,5916
|
|
10
|
+
orto/plotter.py,sha256=_t9bow6sUMoRAvD6gVFGJTc-_ifW7RmeR0JAPWK_lm4,17799
|
|
11
|
+
orto/utils.py,sha256=GcMZ9uebOSnkPQT_U5O0X49LUtTu8YpXZxEsNKgXNTY,9838
|
|
12
|
+
orto-1.10.0.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
|
|
13
|
+
orto-1.10.0.dist-info/METADATA,sha256=2qdWW5pyurXxTVD-6GXUSvuxZhLJ2BTbkGUtDdPJVoQ,1185
|
|
14
|
+
orto-1.10.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
15
|
+
orto-1.10.0.dist-info/entry_points.txt,sha256=HXenCglMp_03JkN34pK2phkjXK9CFcXTGHKv5QaVY8I,39
|
|
16
|
+
orto-1.10.0.dist-info/top_level.txt,sha256=hQ-z28gTN_FZ2B5Kiwxr_9cUTcCoib9W5HjbkceDXw4,5
|
|
17
|
+
orto-1.10.0.dist-info/RECORD,,
|
orto-1.9.0.dist-info/RECORD
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
orto/__init__.py,sha256=IedlltYr3qYZxChNUdz62qogXA9Pos_MUvXdGXqAa0E,41
|
|
2
|
-
orto/__version__.py,sha256=w-88NSa4AsKUbL8rYWL8WNyh9CtUgEFkmfF69cJJ9ic,22
|
|
3
|
-
orto/cli.py,sha256=i59s8-WthfZPYsHJDPWdMQfZ8ABCJJ8n5loieLeJVCA,86106
|
|
4
|
-
orto/constants.py,sha256=anxaiTykO8Q_CXliR7zuOAdnXZrQ2-C4ndaviyl7kGc,419
|
|
5
|
-
orto/data.py,sha256=960LHFeG7l626X_WA-8YxvG2toNAsgNvLo86OoYAmBY,14910
|
|
6
|
-
orto/exceptions.py,sha256=D7oNeAEGeJNt5thzt6PaCn5FY6JcbJOWUE1N1LVhhuE,159
|
|
7
|
-
orto/extractor.py,sha256=S27297-gasqLaLbMOqW9sj1X0U0mr3OjikxHcz9Es3o,77867
|
|
8
|
-
orto/input.py,sha256=uUQV6A-8D0GZpRoY1rKK_aUPmk9kVVTnMzTHuisP5t4,11888
|
|
9
|
-
orto/job.py,sha256=tDiz9omFwinoYJamgz66MZez0Ee9HMhuCIAeHMhXRF8,5916
|
|
10
|
-
orto/plotter.py,sha256=_t9bow6sUMoRAvD6gVFGJTc-_ifW7RmeR0JAPWK_lm4,17799
|
|
11
|
-
orto/utils.py,sha256=GcMZ9uebOSnkPQT_U5O0X49LUtTu8YpXZxEsNKgXNTY,9838
|
|
12
|
-
orto-1.9.0.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
|
|
13
|
-
orto-1.9.0.dist-info/METADATA,sha256=v6KwljenLuZNETfGZexfXCkb7ECRGHFK2N7tJoat6bs,1184
|
|
14
|
-
orto-1.9.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
15
|
-
orto-1.9.0.dist-info/entry_points.txt,sha256=HXenCglMp_03JkN34pK2phkjXK9CFcXTGHKv5QaVY8I,39
|
|
16
|
-
orto-1.9.0.dist-info/top_level.txt,sha256=hQ-z28gTN_FZ2B5Kiwxr_9cUTcCoib9W5HjbkceDXw4,5
|
|
17
|
-
orto-1.9.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|