orto 1.8.2__tar.gz → 1.8.3__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.8.2 → orto-1.8.3}/PKG-INFO +1 -1
- orto-1.8.3/orto/__version__.py +1 -0
- {orto-1.8.2 → orto-1.8.3}/orto/cli.py +17 -0
- {orto-1.8.2 → orto-1.8.3}/orto/extractor.py +79 -0
- {orto-1.8.2 → orto-1.8.3}/orto/input.py +72 -0
- {orto-1.8.2 → orto-1.8.3}/orto.egg-info/PKG-INFO +1 -1
- {orto-1.8.2 → orto-1.8.3}/setup.py +1 -1
- orto-1.8.2/orto/__version__.py +0 -1
- {orto-1.8.2 → orto-1.8.3}/LICENSE +0 -0
- {orto-1.8.2 → orto-1.8.3}/README.md +0 -0
- {orto-1.8.2 → orto-1.8.3}/orto/__init__.py +0 -0
- {orto-1.8.2 → orto-1.8.3}/orto/constants.py +0 -0
- {orto-1.8.2 → orto-1.8.3}/orto/data.py +0 -0
- {orto-1.8.2 → orto-1.8.3}/orto/exceptions.py +0 -0
- {orto-1.8.2 → orto-1.8.3}/orto/job.py +0 -0
- {orto-1.8.2 → orto-1.8.3}/orto/plotter.py +0 -0
- {orto-1.8.2 → orto-1.8.3}/orto/utils.py +0 -0
- {orto-1.8.2 → orto-1.8.3}/orto.egg-info/SOURCES.txt +0 -0
- {orto-1.8.2 → orto-1.8.3}/orto.egg-info/dependency_links.txt +0 -0
- {orto-1.8.2 → orto-1.8.3}/orto.egg-info/entry_points.txt +0 -0
- {orto-1.8.2 → orto-1.8.3}/orto.egg-info/requires.txt +0 -0
- {orto-1.8.2 → orto-1.8.3}/orto.egg-info/top_level.txt +0 -0
- {orto-1.8.2 → orto-1.8.3}/pyproject.toml +0 -0
- {orto-1.8.2 → orto-1.8.3}/setup.cfg +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '1.8.3'
|
|
@@ -527,6 +527,14 @@ def gen_job_func(uargs):
|
|
|
527
527
|
else:
|
|
528
528
|
nbo_module = None
|
|
529
529
|
|
|
530
|
+
# Check structure in input file or xyz file
|
|
531
|
+
# unless skip_structure flag is set
|
|
532
|
+
if not uargs.skip_structure:
|
|
533
|
+
try:
|
|
534
|
+
inp.check_structure(oj.input_file)
|
|
535
|
+
except (DataNotFoundError, DataFormattingError) as e:
|
|
536
|
+
ut.red_exit(str(e))
|
|
537
|
+
|
|
530
538
|
# Set SLURM error and output file names
|
|
531
539
|
config['error'] = 'slurm.%j.e'
|
|
532
540
|
config['output'] = 'slurm.%j.o'
|
|
@@ -1880,6 +1888,15 @@ def read_args(arg_list=None):
|
|
|
1880
1888
|
)
|
|
1881
1889
|
)
|
|
1882
1890
|
|
|
1891
|
+
gen_job.add_argument(
|
|
1892
|
+
'--skip_structure',
|
|
1893
|
+
'-ss',
|
|
1894
|
+
action='store_true',
|
|
1895
|
+
help=(
|
|
1896
|
+
'Disables checking of structure in input file or xyz file'
|
|
1897
|
+
)
|
|
1898
|
+
)
|
|
1899
|
+
|
|
1883
1900
|
gen_job.add_argument(
|
|
1884
1901
|
'-om',
|
|
1885
1902
|
'--orca_load',
|
|
@@ -2204,6 +2204,85 @@ class XYZInputExtractor(extto.LineExtractor):
|
|
|
2204
2204
|
return _ext.data
|
|
2205
2205
|
|
|
2206
2206
|
|
|
2207
|
+
class StructureInputExtractor(extto.BetweenExtractor):
|
|
2208
|
+
'''
|
|
2209
|
+
Extracts structure from xyz file
|
|
2210
|
+
'''
|
|
2211
|
+
|
|
2212
|
+
# Regex Start Pattern
|
|
2213
|
+
START_PATTERN = rb'(?<=\*xyz )'
|
|
2214
|
+
|
|
2215
|
+
# Regex End Pattern
|
|
2216
|
+
END_PATTERN = rb'(?=\*)'
|
|
2217
|
+
|
|
2218
|
+
@property
|
|
2219
|
+
def data(self) -> tuple[list[str], NDArray]:
|
|
2220
|
+
'''
|
|
2221
|
+
list of atom labels and ndarray of coordinates (N, 3)
|
|
2222
|
+
'''
|
|
2223
|
+
return self._data
|
|
2224
|
+
|
|
2225
|
+
@staticmethod
|
|
2226
|
+
def _process_block(block: str) -> tuple[list[str], NDArray]:
|
|
2227
|
+
'''
|
|
2228
|
+
Converts single block into data entries described in self.data
|
|
2229
|
+
|
|
2230
|
+
Parameters
|
|
2231
|
+
----------
|
|
2232
|
+
block: str
|
|
2233
|
+
String block extracted from file
|
|
2234
|
+
|
|
2235
|
+
Returns
|
|
2236
|
+
-------
|
|
2237
|
+
tuple[list[str], NDArray]
|
|
2238
|
+
'''
|
|
2239
|
+
|
|
2240
|
+
# Get labels and coordinates
|
|
2241
|
+
all_info = re.findall(
|
|
2242
|
+
r'([A-Za-z]+\s*-?\d\.\d*\s+-?\d\.\d*\s+-?\d\.\d*)',
|
|
2243
|
+
block
|
|
2244
|
+
)
|
|
2245
|
+
|
|
2246
|
+
labels = re.findall(
|
|
2247
|
+
r'([A-Za-z]+)',
|
|
2248
|
+
block
|
|
2249
|
+
)
|
|
2250
|
+
|
|
2251
|
+
coords = np.asarray([
|
|
2252
|
+
[float(v) for v in val.split()[1:]]
|
|
2253
|
+
for val in all_info
|
|
2254
|
+
])
|
|
2255
|
+
|
|
2256
|
+
if len(labels) != coords.shape[0]:
|
|
2257
|
+
raise DataFormattingError(
|
|
2258
|
+
'Number of atom labels does not match number of coordinates'
|
|
2259
|
+
)
|
|
2260
|
+
|
|
2261
|
+
data = (labels, coords)
|
|
2262
|
+
|
|
2263
|
+
return data
|
|
2264
|
+
|
|
2265
|
+
@classmethod
|
|
2266
|
+
def extract(cls, file_name: str | pathlib.Path) -> tuple[list[str], NDArray]: # noqa
|
|
2267
|
+
'''
|
|
2268
|
+
Convenience method which instantiates class, extracts blocks, and
|
|
2269
|
+
returns processed datasets
|
|
2270
|
+
|
|
2271
|
+
Parameters
|
|
2272
|
+
----------
|
|
2273
|
+
file_name: str | pathlib.Path
|
|
2274
|
+
File to parse
|
|
2275
|
+
|
|
2276
|
+
Returns
|
|
2277
|
+
-------
|
|
2278
|
+
tuple[list[str], NDArray]
|
|
2279
|
+
Each entry contains processed data, as defined in cls.data
|
|
2280
|
+
'''
|
|
2281
|
+
_ext = cls()
|
|
2282
|
+
_ext(file_name, process=True)
|
|
2283
|
+
return _ext.data
|
|
2284
|
+
|
|
2285
|
+
|
|
2207
2286
|
class IntInputExtractor(XYZInputExtractor):
|
|
2208
2287
|
'''
|
|
2209
2288
|
Extracts *int line of an input file
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
2
|
import re
|
|
3
3
|
import numpy as np
|
|
4
|
+
import numpy.linalg as la
|
|
4
5
|
import copy
|
|
5
6
|
import xyz_py as xyzp
|
|
6
7
|
|
|
@@ -304,6 +305,77 @@ def check_xyz(file_name: str | Path, skip_check) -> None:
|
|
|
304
305
|
return
|
|
305
306
|
|
|
306
307
|
|
|
308
|
+
def check_structure(file_name: str | Path, threshold: float = 0.1) -> None:
|
|
309
|
+
'''
|
|
310
|
+
Checks that no atoms of the structure are overlapping.\n
|
|
311
|
+
|
|
312
|
+
Parameters
|
|
313
|
+
----------
|
|
314
|
+
file_name: str | Path
|
|
315
|
+
Orca input file as either name or Path object
|
|
316
|
+
threshold: float
|
|
317
|
+
Minimum allowed distance between atoms in Angstroms
|
|
318
|
+
|
|
319
|
+
Returns
|
|
320
|
+
-------
|
|
321
|
+
None
|
|
322
|
+
|
|
323
|
+
Raises
|
|
324
|
+
------
|
|
325
|
+
DataFormattingError
|
|
326
|
+
If any atoms are overlapping
|
|
327
|
+
'''
|
|
328
|
+
|
|
329
|
+
# Get xyz file name and check it exists and is formatted correctly
|
|
330
|
+
try:
|
|
331
|
+
xyz_file = oe.XYZFileInputExtractor.extract(file_name)
|
|
332
|
+
except DataNotFoundError:
|
|
333
|
+
xyz_file = []
|
|
334
|
+
|
|
335
|
+
try:
|
|
336
|
+
xyzline = oe.XYZInputExtractor.extract(file_name)
|
|
337
|
+
except DataNotFoundError:
|
|
338
|
+
xyzline = []
|
|
339
|
+
|
|
340
|
+
if not len(xyz_file) and not len(xyzline):
|
|
341
|
+
ut.red_exit(
|
|
342
|
+
'Error: missing or incorrect *xyzfile or *xyz line in input'
|
|
343
|
+
)
|
|
344
|
+
|
|
345
|
+
if len(xyz_file):
|
|
346
|
+
# Load structure from xyz file
|
|
347
|
+
xyz_file = Path(xyz_file[0])
|
|
348
|
+
labels, coords = xyzp.load_xyz(xyz_file)
|
|
349
|
+
else:
|
|
350
|
+
# Extract structure from input file
|
|
351
|
+
labels, coords = oe.StructureInputExtractor.extract(file_name)[0]
|
|
352
|
+
|
|
353
|
+
# Compute pairwise differences using broadcasting
|
|
354
|
+
# Broadcast to shape (N, N, 3)
|
|
355
|
+
# from (N, 1, 3) and (1, N, 3)
|
|
356
|
+
diffs = coords[:, np.newaxis, :] - coords[np.newaxis, :, :]
|
|
357
|
+
|
|
358
|
+
# Compute Euclidean distances
|
|
359
|
+
distances = la.norm(diffs, axis=-1) # shape (N, N)
|
|
360
|
+
|
|
361
|
+
# Add large value to diagonal to avoid zero self-distances
|
|
362
|
+
distances += np.diag([100]*len(labels))
|
|
363
|
+
# Find index of zero distances
|
|
364
|
+
zero_dist = np.where(
|
|
365
|
+
distances < threshold
|
|
366
|
+
)
|
|
367
|
+
# and report
|
|
368
|
+
if len(zero_dist[0]):
|
|
369
|
+
raise DataFormattingError(
|
|
370
|
+
'Error: Overlapping atoms detected in structure'
|
|
371
|
+
' at atom numbers:\n' + ', '.join(
|
|
372
|
+
str(i+1) for i in zero_dist[0]
|
|
373
|
+
)
|
|
374
|
+
)
|
|
375
|
+
|
|
376
|
+
return
|
|
377
|
+
|
|
378
|
+
|
|
307
379
|
def check_moinp_moread(file_name: str | Path) -> None:
|
|
308
380
|
'''
|
|
309
381
|
Checks if MORead and/or MOInp are present in the input file.\n
|
orto-1.8.2/orto/__version__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '1.8.2'
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|