orto 1.8.3__tar.gz → 1.9.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orto
3
- Version: 1.8.3
3
+ Version: 1.9.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
@@ -0,0 +1 @@
1
+ __version__ = '1.9.0'
@@ -11,6 +11,7 @@ import numpy as np
11
11
  import re
12
12
  from mmap import mmap, ACCESS_READ
13
13
  from shutil import move as shutilmove
14
+ from subto.job import SlurmJob
14
15
 
15
16
  from . import job
16
17
  from . import utils as ut
@@ -329,6 +330,86 @@ def extract_gmatrix_func(uargs, save=True):
329
330
  return
330
331
 
331
332
 
333
+ def gen_spden_func(uargs):
334
+ '''
335
+ Wrapper for CLI gen spin density call
336
+
337
+ Parameters
338
+ ----------
339
+ uargs : argparser object
340
+ User arguments
341
+
342
+ Returns
343
+ -------
344
+ None
345
+ '''
346
+
347
+ # Check orca module
348
+ if len(uargs.orca_load):
349
+ orca_load_val = copy.copy(uargs.orca_load)
350
+ elif os.getenv('orto_orca_load'):
351
+ try:
352
+ if len(os.getenv('orto_orca_load')):
353
+ orca_load_val = os.getenv('orto_orca_load')
354
+ except ValueError:
355
+ ut.red_exit(
356
+ (
357
+ 'Error in orto_orca_load environment variable'
358
+ )
359
+ )
360
+ else:
361
+ ut.red_exit(
362
+ (
363
+ 'Missing orto_orca_load environment variable or '
364
+ '--orca_load argument'
365
+ )
366
+ )
367
+
368
+ # Create string of command numbers for orca plot to follow
369
+ command_nums = '1\\n3\\ny\\n4'
370
+ command_nums += f'\\n{uargs.n_pts:d}'
371
+ command_nums += '\\n5\\n7\\n11\\n12\\n'
372
+
373
+ # Generate job file for orca_plot
374
+ spin_job = SlurmJob(
375
+ pathlib.Path(f'{uargs.gbw_file.stem}_spin_density_job.sh')
376
+ )
377
+
378
+ # Create content of job
379
+ spin_job.content_block = ''
380
+
381
+ spin_job.content_block += '# Load orca module\n'
382
+ spin_job.content_block += f'module load {orca_load_val}\n'
383
+ spin_job.content_block += '# Run orca_plot to generate spin density cube file\n' # noqa
384
+ spin_job.content_block += f'time mpirun -np {uargs.n_procs:d} $(which orca_plot_mpi) {uargs.gbw_file.name} -i aa <<< $\'{command_nums}\'\n\n' # noqa
385
+
386
+ # Set job name
387
+ spin_job.job_name = f'{uargs.gbw_file.stem}_spin_density'
388
+
389
+ spin_job.ntasks_per_node = str(uargs.n_procs)
390
+ spin_job.mem_per_cpu = str(uargs.memory)
391
+
392
+ spin_job.error = f'{uargs.gbw_file.stem}_spin_density.%j.e'
393
+ spin_job.output = f'{uargs.gbw_file.stem}_spin_density.%j.o'
394
+
395
+ # Write job script
396
+ # with submitter configuration options specified
397
+ spin_job.write_script(True)
398
+
399
+ # Submit to queue
400
+ if not uargs.no_sub:
401
+ subprocess.call(
402
+ 'cd {}; {} "{}"; cd ../'.format(
403
+ uargs.gbw_file.parents[0],
404
+ spin_job.SUBMIT_COMMAND,
405
+ spin_job.file_path
406
+ ),
407
+ shell=True
408
+ )
409
+
410
+ return
411
+
412
+
332
413
  def gen_trunc_molden_func(uargs):
333
414
  '''
334
415
  Wrapper for CLI gen truncmolden call
@@ -1649,6 +1730,7 @@ def read_args(arg_list=None):
1649
1730
 
1650
1731
  extract_coords = extract_parser.add_parser(
1651
1732
  'coords',
1733
+ aliases=['coord'],
1652
1734
  description='Extracts coordinates from Orca output file',
1653
1735
  formatter_class=argparse.RawTextHelpFormatter,
1654
1736
  usage=ut.cstring('orto extract coords <output_file> [options]', 'cyan')
@@ -1818,6 +1900,71 @@ def read_args(arg_list=None):
1818
1900
  )
1819
1901
  )
1820
1902
 
1903
+ gen_spden = gen_parser.add_parser(
1904
+ 'spdens',
1905
+ aliases=['spin_density', 'spden'],
1906
+ description='Generate spin density cube file from gbw file', # noqa
1907
+ usage=ut.cstring(
1908
+ 'orto gen spdens <gbw_file> <n_procs> [options]',
1909
+ 'cyan'
1910
+ ),
1911
+ formatter_class=argparse.RawTextHelpFormatter
1912
+ )
1913
+ gen_spden._positionals.title = 'Mandatory Arguments'
1914
+ gen_spden.set_defaults(func=gen_spden_func)
1915
+
1916
+ gen_spden.add_argument(
1917
+ 'gbw_file',
1918
+ type=pathlib.Path,
1919
+ help='Orca gbw file name'
1920
+ )
1921
+
1922
+ gen_spden.add_argument(
1923
+ 'n_procs',
1924
+ type=int,
1925
+ help='Number of processors/cores used in calculation',
1926
+ default=1
1927
+ )
1928
+
1929
+ gen_spden.add_argument(
1930
+ '--n_pts',
1931
+ '-n',
1932
+ type=int,
1933
+ default=100,
1934
+ help=(
1935
+ 'Number of points in each dimension of cube file\n'
1936
+ 'Default: %(default)s'
1937
+ )
1938
+ )
1939
+
1940
+ gen_spden.add_argument(
1941
+ '--memory',
1942
+ '-mem',
1943
+ type=int,
1944
+ default=500,
1945
+ help=(
1946
+ 'Per-core Memory to use in MB\n'
1947
+ 'Default: %(default)s'
1948
+ )
1949
+ )
1950
+
1951
+ gen_spden.add_argument(
1952
+ '-om',
1953
+ '--orca_load',
1954
+ type=str,
1955
+ default='',
1956
+ help='Orca environment module (overrides ORTO_ORCA_LOAD envvar)'
1957
+ )
1958
+
1959
+ gen_spden.add_argument(
1960
+ '--no_sub',
1961
+ '-ns',
1962
+ action='store_true',
1963
+ help=(
1964
+ 'Disables submission of job to queue'
1965
+ )
1966
+ )
1967
+
1821
1968
  gen_job = gen_parser.add_parser(
1822
1969
  'job',
1823
1970
  description=(
@@ -2364,6 +2511,7 @@ def read_args(arg_list=None):
2364
2511
 
2365
2512
  plot_ailft = plot_parser.add_parser(
2366
2513
  'ailft_orbs',
2514
+ aliases=['ailft_orb'],
2367
2515
  description='Plots AI-LFT orbital energies from output file',
2368
2516
  usage=ut.cstring(
2369
2517
  'orto plot ailft_orbs <output_file> [options]',
@@ -29,7 +29,7 @@ class OrcaJob():
29
29
  Orca output file name. Default is same as input with extension \n
30
30
  replaced by .out
31
31
  job_file: pathlib.Path
32
- Submission script name. Default is same as input with extension \n
32
+ Submission script file path. Default is same as input with extension \n
33
33
  replaced by scheduler job file extension e.g. '.slm'
34
34
  job_name: str
35
35
  Job name. Default is same as input without extension
@@ -99,6 +99,9 @@ class OrcaJob():
99
99
 
100
100
  @property
101
101
  def job_file(self) -> pathlib.Path:
102
+ '''
103
+ The submission script file path
104
+ '''
102
105
  return self._job_file
103
106
 
104
107
  @job_file.setter
@@ -164,7 +167,7 @@ class OrcaJob():
164
167
  verbose: bool, default True
165
168
  If True, jobscript location is written to screen
166
169
  **kwargs
167
- The keyword arguments are passed to `subto.job.Job` constructor
170
+ Keyword arguments passed to `subto.job.Job` constructor
168
171
  '''
169
172
 
170
173
  if len(self.load):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orto
3
- Version: 1.8.3
3
+ Version: 1.9.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
@@ -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.8.3'
11
+ __version__ = '1.9.0'
12
12
 
13
13
  setuptools.setup(
14
14
  name='orto',
@@ -1 +0,0 @@
1
- __version__ = '1.8.3'
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