orto 1.11.3__tar.gz → 1.12.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.11.3
3
+ Version: 1.12.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.12.0'
@@ -537,9 +537,99 @@ def extract_gmatrix_func(uargs, save=True):
537
537
  return
538
538
 
539
539
 
540
+ def gen_orbs_func(uargs):
541
+ '''
542
+ Wrapper for CLI gen orbs call
543
+
544
+ Parameters
545
+ ----------
546
+ uargs: argparser object
547
+ User arguments
548
+
549
+ Returns
550
+ -------
551
+ None
552
+ '''
553
+ from subto.job import SlurmJob
554
+
555
+ # Check orca module
556
+ if len(uargs.orca_load):
557
+ orca_load_val = copy.copy(uargs.orca_load)
558
+ elif os.getenv('orto_orca_load'):
559
+ try:
560
+ if len(os.getenv('orto_orca_load')):
561
+ orca_load_val = os.getenv('orto_orca_load')
562
+ except ValueError:
563
+ ut.red_exit(
564
+ (
565
+ 'Error in orto_orca_load environment variable'
566
+ )
567
+ )
568
+ else:
569
+ ut.red_exit(
570
+ (
571
+ 'Missing orto_orca_load environment variable or '
572
+ '--orca_load argument'
573
+ )
574
+ )
575
+
576
+ # Create string of command numbers for orca plot to follow
577
+ command_nums = '1\\n1\\n4'
578
+ command_nums += f'\\n{uargs.n_pts:d}'
579
+ command_nums += '\\n5\\n7'
580
+
581
+ if uargs.beta:
582
+ command_nums += '\\n3\\n1'
583
+
584
+ for orbital_number in uargs.orb_numbers:
585
+ command_nums += '\\n2'
586
+ command_nums += f'\\n{orbital_number:d}'
587
+ command_nums += '\\n11'
588
+ command_nums += '\\n12\\n'
589
+
590
+ # Generate job file for orca_plot
591
+ orb_job = SlurmJob(
592
+ pathlib.Path(f'{uargs.gbw_file.stem}_orbital_job.sh')
593
+ )
594
+
595
+ # Create content of job
596
+ orb_job.content_block = ''
597
+
598
+ orb_job.content_block += '# Load orca module\n'
599
+ orb_job.content_block += f'module load {orca_load_val}\n'
600
+ orb_job.content_block += '# Run orca_plot to generate orbital cube file(s)\n' # noqa
601
+ orb_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
602
+
603
+ # Set job name
604
+ orb_job.job_name = f'{uargs.gbw_file.stem}_orbitals'
605
+
606
+ orb_job.ntasks_per_node = str(uargs.n_procs)
607
+ orb_job.mem_per_cpu = str(uargs.memory)
608
+
609
+ orb_job.error = f'{uargs.gbw_file.stem}_orbitals.%j.e'
610
+ orb_job.output = f'{uargs.gbw_file.stem}_orbitals.%j.o'
611
+
612
+ # Write job script
613
+ # with submitter configuration options specified
614
+ orb_job.write_script(True)
615
+
616
+ # Submit to queue
617
+ if not uargs.no_sub:
618
+ subprocess.call(
619
+ 'cd {}; {} "{}"; cd ../'.format(
620
+ uargs.gbw_file.parents[0],
621
+ orb_job.SUBMIT_COMMAND,
622
+ orb_job.file_path
623
+ ),
624
+ shell=True
625
+ )
626
+
627
+ return
628
+
629
+
540
630
  def gen_spden_func(uargs):
541
631
  '''
542
- Wrapper for CLI gen spin density call
632
+ Wrapper for CLI gen spin_density call
543
633
 
544
634
  Parameters
545
635
  ----------
@@ -868,7 +958,6 @@ def plot_xes_func(uargs):
868
958
  None
869
959
  '''
870
960
  import matplotlib.pyplot as plt
871
- import matplotlib as mpl
872
961
  from . import plotter
873
962
  from . import extractor as oe
874
963
 
@@ -876,7 +965,8 @@ def plot_xes_func(uargs):
876
965
  ut.check_font_envvar()
877
966
 
878
967
  # Change matplotlib font size to be larger
879
- mpl.rcParams.update({'font.size': 12})
968
+ plt.rcParams['font.size'] = 10
969
+ plt.rcParams['legend.fontsize'] = 9
880
970
 
881
971
  version = oe.OrcaVersionExtractor.extract(uargs.output_file)
882
972
 
@@ -986,7 +1076,6 @@ def plot_xas_func(uargs):
986
1076
  None
987
1077
  '''
988
1078
  import matplotlib.pyplot as plt
989
- import matplotlib as mpl
990
1079
  from . import plotter
991
1080
  from . import extractor as oe
992
1081
 
@@ -994,7 +1083,8 @@ def plot_xas_func(uargs):
994
1083
  ut.check_font_envvar()
995
1084
 
996
1085
  # Change matplotlib font size to be larger
997
- mpl.rcParams.update({'font.size': 12})
1086
+ plt.rcParams['font.size'] = 10
1087
+ plt.rcParams['legend.fontsize'] = 9
998
1088
 
999
1089
  version = oe.OrcaVersionExtractor.extract(uargs.output_file)
1000
1090
 
@@ -1102,7 +1192,6 @@ def plot_abs_func(uargs, save_data_only=False):
1102
1192
  from . import extractor as oe
1103
1193
  from . import data as d
1104
1194
 
1105
-
1106
1195
  # Process x_shift argument
1107
1196
  if uargs.x_shift is None:
1108
1197
  uargs.x_shift = [0.0 for _ in uargs.output_file]
@@ -1280,12 +1369,12 @@ def plot_abs_func(uargs, save_data_only=False):
1280
1369
  if save_data_only:
1281
1370
  return
1282
1371
 
1283
- ## Plot all spectra
1372
+ # Plot all spectra
1284
1373
  import matplotlib.pyplot as plt
1285
1374
  import matplotlib.colors as mcolors
1286
1375
 
1287
1376
  # Set font name and size
1288
- plt.rcParams['font.family'] = 'Arial'
1377
+ ut.check_font_envvar()
1289
1378
  plt.rcParams['font.size'] = 10
1290
1379
  plt.rcParams['legend.fontsize'] = 9
1291
1380
  plt.rcParams['legend.loc'] = 'center right'
@@ -1382,7 +1471,7 @@ def plot_ir_func(uargs):
1382
1471
  -------
1383
1472
  None
1384
1473
  '''
1385
- import matplotlib as mpl
1474
+ import matplotlib.pyplot as plt
1386
1475
  from . import plotter
1387
1476
  from . import extractor as oe
1388
1477
 
@@ -1390,7 +1479,8 @@ def plot_ir_func(uargs):
1390
1479
  ut.check_font_envvar()
1391
1480
 
1392
1481
  # Change matplotlib font size to be larger
1393
- mpl.rcParams.update({'font.size': 12})
1482
+ plt.rcParams['font.size'] = 10
1483
+ plt.rcParams['legend.fontsize'] = 9
1394
1484
 
1395
1485
  # Extract frequency information
1396
1486
  data = oe.FrequencyExtractor.extract(uargs.output_file)
@@ -1777,12 +1867,14 @@ def plot_susc_func(uargs) -> None:
1777
1867
 
1778
1868
  '''
1779
1869
  import matplotlib.pyplot as plt
1780
- import matplotlib as mpl
1781
1870
  from . import plotter
1782
1871
  from . import extractor as oe
1783
1872
 
1873
+ # Set user specified font name
1874
+ ut.check_font_envvar()
1784
1875
  # Change matplotlib font size to be larger
1785
- mpl.rcParams.update({'font.size': 12})
1876
+ plt.rcParams['font.size'] = 10
1877
+ plt.rcParams['legend.fontsize'] = 9
1786
1878
 
1787
1879
  # Extract data from file
1788
1880
  data = oe.SusceptibilityExtractor.extract(uargs.output_file)
@@ -1806,7 +1898,8 @@ def plot_susc_func(uargs) -> None:
1806
1898
  exp_data = {'Temperature (K)': [], 'chi*T (cm3*K/mol)': []}
1807
1899
  with open(uargs.exp_file, newline='') as csvfile:
1808
1900
  reader = csv.DictReader(
1809
- row for row in csvfile if not row.startswith('#')
1901
+ [row for row in csvfile if not row.startswith('#')],
1902
+ skipinitialspace=True
1810
1903
  )
1811
1904
  for row in reader:
1812
1905
  exp_data['Temperature (K)'].append(
@@ -1888,12 +1981,14 @@ def plot_ailft_func(uargs) -> None:
1888
1981
  None
1889
1982
  '''
1890
1983
  import matplotlib.pyplot as plt
1891
- import matplotlib as mpl
1892
1984
  from . import plotter
1893
1985
  from . import extractor as oe
1894
1986
 
1987
+ # Set user specified font name
1988
+ ut.check_font_envvar()
1895
1989
  # Change matplotlib font size to be larger
1896
- mpl.rcParams.update({'font.size': 12})
1990
+ plt.rcParams['font.size'] = 10
1991
+ plt.rcParams['legend.fontsize'] = 9
1897
1992
 
1898
1993
  # Create extractor
1899
1994
  data = oe.AILFTOrbEnergyExtractor.extract(uargs.output_file)
@@ -2203,6 +2298,89 @@ def read_args(arg_list=None):
2203
2298
  )
2204
2299
  )
2205
2300
 
2301
+ gen_orbs = gen_parser.add_parser(
2302
+ 'orbs',
2303
+ aliases=['orbitals', 'mos', 'mo'],
2304
+ description='Generate molecular orbital cube file(s) from gbw file', # noqa
2305
+ usage=ut.cstring(
2306
+ 'orto gen orbs <gbw_file> <orbs> <n_procs> [options]',
2307
+ 'cyan'
2308
+ ),
2309
+ formatter_class=argparse.RawTextHelpFormatter
2310
+ )
2311
+ gen_orbs._positionals.title = 'Mandatory Arguments'
2312
+ gen_orbs.set_defaults(func=gen_orbs_func)
2313
+
2314
+ gen_orbs.add_argument(
2315
+ 'gbw_file',
2316
+ type=pathlib.Path,
2317
+ help='Orca gbw file name'
2318
+ )
2319
+
2320
+ gen_orbs.add_argument(
2321
+ 'orb_numbers',
2322
+ type=int,
2323
+ nargs='+',
2324
+ help=(
2325
+ 'Orbital number(s) to generate cube file for'
2326
+ '(these are alpha spin by default)'
2327
+ )
2328
+ )
2329
+
2330
+ gen_orbs.add_argument(
2331
+ 'n_procs',
2332
+ type=int,
2333
+ help='Number of processors/cores used in calculation',
2334
+ default=1
2335
+ )
2336
+
2337
+ gen_orbs.add_argument(
2338
+ '--n_pts',
2339
+ '-n',
2340
+ type=int,
2341
+ default=100,
2342
+ help=(
2343
+ 'Number of points in each dimension of cube file\n'
2344
+ 'Default: %(default)s'
2345
+ )
2346
+ )
2347
+
2348
+ gen_orbs.add_argument(
2349
+ '--memory',
2350
+ '-mem',
2351
+ type=int,
2352
+ default=500,
2353
+ help=(
2354
+ 'Per-core Memory to use in MB\n'
2355
+ 'Default: %(default)s'
2356
+ )
2357
+ )
2358
+
2359
+ gen_orbs.add_argument(
2360
+ '-om',
2361
+ '--orca_load',
2362
+ type=str,
2363
+ default='',
2364
+ help='Orca environment module (overrides ORTO_ORCA_LOAD envvar)'
2365
+ )
2366
+
2367
+ gen_orbs.add_argument(
2368
+ '--beta',
2369
+ action='store_true',
2370
+ help=(
2371
+ 'Plot beta orbitals instead of alpha (for open shell calculations)'
2372
+ )
2373
+ )
2374
+
2375
+ gen_orbs.add_argument(
2376
+ '--no_sub',
2377
+ '-ns',
2378
+ action='store_true',
2379
+ help=(
2380
+ 'Disables submission of job to queue'
2381
+ )
2382
+ )
2383
+
2206
2384
  gen_spden = gen_parser.add_parser(
2207
2385
  'spdens',
2208
2386
  aliases=['spin_density', 'spden'],
@@ -278,13 +278,18 @@ def plot_chit(chit: ArrayLike, temps: ArrayLike, fields: ArrayLike = None,
278
278
  Returns
279
279
  -------
280
280
  plt.Figure
281
- Matplotlib Figure object
281
+ Matplotlib Figure objectwidth
282
282
  plt.Axes
283
283
  Matplotlib Axis object for plot
284
284
  ''' # noqa
285
285
 
286
286
  # Create figure and axes
287
- fig, ax = plt.subplots(1, 1, figsize=(5, 4), num=window_title)
287
+ fig, ax = plt.subplots(
288
+ 1,
289
+ 1,
290
+ figsize=(4 * (1 + np.sqrt(5))/2, 4),
291
+ num=window_title
292
+ )
288
293
 
289
294
  if fields is None:
290
295
  # Plot data as it is
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orto
3
- Version: 1.11.3
3
+ Version: 1.12.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.11.3'
11
+ __version__ = '1.12.0'
12
12
 
13
13
  setuptools.setup(
14
14
  name='orto',
@@ -1 +0,0 @@
1
- __version__ = '1.11.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