orto 0.25.1__tar.gz → 0.26.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.25.1 → orto-0.26.1}/PKG-INFO +1 -1
- orto-0.26.1/orto/__version__.py +1 -0
- {orto-0.25.1 → orto-0.26.1}/orto/cli.py +92 -3
- {orto-0.25.1 → orto-0.26.1}/orto/extractor.py +1 -0
- {orto-0.25.1 → orto-0.26.1}/orto.egg-info/PKG-INFO +1 -1
- {orto-0.25.1 → orto-0.26.1}/setup.py +1 -1
- orto-0.25.1/orto/__version__.py +0 -1
- {orto-0.25.1 → orto-0.26.1}/README.md +0 -0
- {orto-0.25.1 → orto-0.26.1}/orto/__init__.py +0 -0
- {orto-0.25.1 → orto-0.26.1}/orto/input.py +0 -0
- {orto-0.25.1 → orto-0.26.1}/orto/job.py +0 -0
- {orto-0.25.1 → orto-0.26.1}/orto/plotter.py +0 -0
- {orto-0.25.1 → orto-0.26.1}/orto/utils.py +0 -0
- {orto-0.25.1 → orto-0.26.1}/orto.egg-info/SOURCES.txt +0 -0
- {orto-0.25.1 → orto-0.26.1}/orto.egg-info/dependency_links.txt +0 -0
- {orto-0.25.1 → orto-0.26.1}/orto.egg-info/entry_points.txt +0 -0
- {orto-0.25.1 → orto-0.26.1}/orto.egg-info/requires.txt +0 -0
- {orto-0.25.1 → orto-0.26.1}/orto.egg-info/top_level.txt +0 -0
- {orto-0.25.1 → orto-0.26.1}/pyproject.toml +0 -0
- {orto-0.25.1 → orto-0.26.1}/setup.cfg +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '0.26.1'
|
|
@@ -13,6 +13,11 @@ import scipy.constants as constants
|
|
|
13
13
|
import numpy as np
|
|
14
14
|
import extto
|
|
15
15
|
import docx
|
|
16
|
+
import re
|
|
17
|
+
import mmap
|
|
18
|
+
import shutil
|
|
19
|
+
|
|
20
|
+
|
|
16
21
|
from docx.enum.text import WD_ALIGN_PARAGRAPH
|
|
17
22
|
from docx.enum.table import WD_ALIGN_VERTICAL
|
|
18
23
|
from docx.shared import Pt
|
|
@@ -347,10 +352,57 @@ def gen_trunc_molden_func(uargs):
|
|
|
347
352
|
None
|
|
348
353
|
'''
|
|
349
354
|
|
|
350
|
-
# Read molden file in
|
|
355
|
+
# Read molden file in as binary string
|
|
356
|
+
# and find number of MOs by counting number of
|
|
357
|
+
# occurrences of 'Occup='
|
|
358
|
+
_patt = re.compile(b'Sym=')
|
|
359
|
+
with open(uargs.input_file, mode="r") as file_obj:
|
|
360
|
+
with mmap.mmap(file_obj.fileno(), length=0, access=mmap.ACCESS_READ) as mmap_obj: # noqa
|
|
361
|
+
n_MO = len(_patt.findall(mmap_obj))
|
|
362
|
+
|
|
363
|
+
_patt = re.compile(b'Occup= 0.000000')
|
|
364
|
+
with open(uargs.input_file, mode="r") as file_obj:
|
|
365
|
+
with mmap.mmap(file_obj.fileno(), length=0, access=mmap.ACCESS_READ) as mmap_obj: # noqa
|
|
366
|
+
n_virt = len(_patt.findall(mmap_obj))
|
|
367
|
+
|
|
368
|
+
ut.cprint(
|
|
369
|
+
(
|
|
370
|
+
f'{n_virt}/{n_MO} MOs are virtual...'
|
|
371
|
+
),
|
|
372
|
+
'cyan'
|
|
373
|
+
)
|
|
374
|
+
|
|
375
|
+
if uargs.output_file is None:
|
|
376
|
+
# If no output file specified, use input file name
|
|
377
|
+
# with .molden extension
|
|
378
|
+
uargs.output_file = '.tmp.molden'
|
|
379
|
+
|
|
380
|
+
# Trim file
|
|
381
|
+
_count = 0
|
|
382
|
+
final = False
|
|
383
|
+
with open(uargs.input_file, mode="r") as old:
|
|
384
|
+
with open(uargs.output_file, mode="w") as new:
|
|
385
|
+
# Read in molden file line by line
|
|
386
|
+
for line in old:
|
|
387
|
+
if 'Occup= 0.000000' in line:
|
|
388
|
+
_count += 1
|
|
389
|
+
if _count == uargs.n_virt:
|
|
390
|
+
final = True
|
|
391
|
+
if line.startswith(f'{n_MO:d}') and final:
|
|
392
|
+
new.write(line)
|
|
393
|
+
break
|
|
394
|
+
else:
|
|
395
|
+
new.write(line)
|
|
396
|
+
|
|
397
|
+
ut.cprint(f'... trimming to {uargs.n_virt} virtual orbitals\n', 'cyan')
|
|
351
398
|
|
|
352
|
-
#
|
|
399
|
+
# If no output file given
|
|
400
|
+
if uargs.output_file == '.tmp.molden':
|
|
401
|
+
# Copy new file to original name
|
|
402
|
+
shutil.move(uargs.output_file, uargs.input_file)
|
|
403
|
+
uargs.output_file = uargs.input_file
|
|
353
404
|
|
|
405
|
+
ut.cprint(f'New molden file written to {uargs.output_file}', 'cyan')
|
|
354
406
|
|
|
355
407
|
return
|
|
356
408
|
|
|
@@ -468,6 +520,9 @@ def gen_job_func(uargs):
|
|
|
468
520
|
# Add call to orca_2mkl to create molden file from gbw
|
|
469
521
|
if not uargs.no_molden:
|
|
470
522
|
oj.post_orca += 'orca_2mkl {} -molden'.format(oj.input_file.stem)
|
|
523
|
+
oj.post_orca += '\norto gen trunc_molden {}.molden.input'.format(
|
|
524
|
+
oj.input_file.stem
|
|
525
|
+
)
|
|
471
526
|
|
|
472
527
|
# Write job script
|
|
473
528
|
# with submitter configuration options specified
|
|
@@ -798,7 +853,7 @@ def extract_orbs_func(uargs, save=True) -> None:
|
|
|
798
853
|
_output = ''
|
|
799
854
|
for row, val in mo.items():
|
|
800
855
|
if val > uargs.threshold and row[1] in uargs.elements:
|
|
801
|
-
_output += f' {row[1]+str(row[0]):5} {row[2]:5} : {val:>5.1f} %\n'
|
|
856
|
+
_output += f' {row[1]+str(row[0]):5} {row[2]:5} : {val:>5.1f} %\n' # noqa
|
|
802
857
|
if len(_output):
|
|
803
858
|
print(_output)
|
|
804
859
|
|
|
@@ -1306,6 +1361,40 @@ def read_args(arg_list=None):
|
|
|
1306
1361
|
# If argument list is empty then call help function
|
|
1307
1362
|
gen_subprog.set_defaults(func=lambda _: gen_subprog.print_help())
|
|
1308
1363
|
|
|
1364
|
+
gen_trunc_molden = gen_parser.add_parser(
|
|
1365
|
+
'trunc_molden',
|
|
1366
|
+
description='Generate truncated molden file',
|
|
1367
|
+
usage=ut.cstring('orto gen trunc_molden <input_file> [options]', 'cyan'), # noqa
|
|
1368
|
+
formatter_class=argparse.RawTextHelpFormatter
|
|
1369
|
+
)
|
|
1370
|
+
gen_trunc_molden._positionals.title = 'Mandatory Arguments'
|
|
1371
|
+
gen_trunc_molden.set_defaults(func=gen_trunc_molden_func)
|
|
1372
|
+
gen_trunc_molden.add_argument(
|
|
1373
|
+
'input_file',
|
|
1374
|
+
type=pathlib.Path,
|
|
1375
|
+
help='Name of molden file to truncate'
|
|
1376
|
+
)
|
|
1377
|
+
|
|
1378
|
+
gen_trunc_molden.add_argument(
|
|
1379
|
+
'--output_file',
|
|
1380
|
+
type=pathlib.Path,
|
|
1381
|
+
help=(
|
|
1382
|
+
'Name of truncated molden file',
|
|
1383
|
+
'If not specified, molden file will be truncated in place'
|
|
1384
|
+
),
|
|
1385
|
+
default=None
|
|
1386
|
+
)
|
|
1387
|
+
|
|
1388
|
+
gen_trunc_molden.add_argument(
|
|
1389
|
+
'--n_virt',
|
|
1390
|
+
type=int,
|
|
1391
|
+
default=100,
|
|
1392
|
+
help=(
|
|
1393
|
+
'Number of virtual orbitals to keep in truncated molden file\n'
|
|
1394
|
+
'Default: %(default)s'
|
|
1395
|
+
)
|
|
1396
|
+
)
|
|
1397
|
+
|
|
1309
1398
|
gen_job = gen_parser.add_parser(
|
|
1310
1399
|
'job',
|
|
1311
1400
|
description=(
|
|
@@ -574,6 +574,7 @@ class FrequencyExtractor(extto.BetweenExtractor):
|
|
|
574
574
|
|
|
575
575
|
# Calculate A_e in units of m mol^-1
|
|
576
576
|
ae = np.ones_like(wavenumbers)
|
|
577
|
+
ae[:n_zero] = 0
|
|
577
578
|
ae *= sc.Avogadro / (12 * sc.epsilon_0 * sc.speed_of_light**2)
|
|
578
579
|
ae[n_zero:] *= t[n_zero:] ** 2
|
|
579
580
|
# and convert to km mol^-1
|
orto-0.25.1/orto/__version__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '0.25.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
|