Skip to content

Commit

Permalink
Merge pull request #399 from ReactionMechanismGenerator/level
Browse files Browse the repository at this point in the history
Organize the level of theory representation in ARC
  • Loading branch information
alongd committed Jun 4, 2020
2 parents 2e71a1a + 35ba12b commit b10352a
Show file tree
Hide file tree
Showing 84 changed files with 4,408 additions and 4,903 deletions.
13 changes: 8 additions & 5 deletions ARC.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ def parse_command_line_arguments(command_line_args=None):
Args:
command_line_args: The command line arguments.
Returns:
The parsed command-line arguments by key words.
"""

parser = argparse.ArgumentParser(description='Automatic Rate Calculator (ARC)')
Expand Down Expand Up @@ -47,18 +50,18 @@ def main():
input_file = args.file
project_directory = os.path.abspath(os.path.dirname(args.file))
input_dict = read_yaml_file(path=input_file, project_directory=project_directory)
try:
input_dict['project']
except KeyError:
print('A project name must be provided!')
if 'project' not in list(input_dict.keys()):
raise ValueError('A project name must be provided!')

verbose = logging.INFO
if args.debug:
verbose = logging.DEBUG
elif args.quiet:
verbose = logging.WARNING
input_dict['verbose'] = input_dict['verbose'] if 'verbose' in input_dict else verbose
arc_object = ARC(input_dict=input_dict, project_directory=project_directory)
if 'project_directory' not in input_dict or not input_dict['project_directory']:
input_dict['project_directory'] = project_directory
arc_object = ARC(**input_dict)
arc_object.execute()


Expand Down
4 changes: 1 addition & 3 deletions arc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#!/usr/bin/env python3
# encoding: utf-8

import arc.exceptions
import arc.main
from arc.main import ARC
import arc.common
import arc.level
import arc.parser
import arc.plotter
import arc.processor
Expand Down
257 changes: 67 additions & 190 deletions arc/common.py

Large diffs are not rendered by default.

300 changes: 47 additions & 253 deletions arc/commonTest.py

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions arc/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env python3
# encoding: utf-8

"""
This module contains classes which extend Exception for usage in the RMG module.
"""
Expand Down
3 changes: 0 additions & 3 deletions arc/job/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env python3
# encoding: utf-8

import arc.job.inputs
import arc.job.job
import arc.job.local
Expand Down
13 changes: 5 additions & 8 deletions arc/job/inputs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env python3
# encoding: utf-8

"""
parameters for input files:
Expand Down Expand Up @@ -47,7 +44,7 @@
%mem={memory}mb
%NProcShared={cpus}
#P {job_type_1} {restricted}{method}{slash}{basis}{slash_2}{auxiliary_basis} {job_type_2} {fine} {trsh} iop(2/9=2000) {job_options_keywords} {shortcut_keywords} {dispersion}
#P {job_type_1} {restricted}{method}{slash}{basis}{slash_2}{auxiliary_basis} {job_type_2} {fine} iop(2/9=2000) {job_options_keywords} {dispersion}
name
Expand All @@ -59,7 +56,7 @@
""",

'orca': """!{restricted}{method_class} {method} {basis} {auxiliary_basis} {job_options_keywords} {shortcut_keywords}
'orca': """!{restricted}{method_class} {method} {basis} {auxiliary_basis} {job_options_keywords}
! NRSCF # using Newton–Raphson SCF algorithm
!{job_type_1}
{job_type_2}
Expand Down Expand Up @@ -88,7 +85,7 @@
JOBTYPE {job_type_1}
METHOD {method}
UNRESTRICTED {restricted}
BASIS {basis}{fine}{trsh}{constraint}
BASIS {basis}{fine}{job_options_keywords}{constraint}
$end
{scan}
Expand Down Expand Up @@ -117,7 +114,7 @@
'terachem': """chkfile teracheck.chk
jobname output
run {job_type_1}
{trsh}
{job_options_keywords}
coordinates coord.xyz
gpumem {memory}
Expand Down Expand Up @@ -175,7 +172,7 @@
opticalIsomers = {optical}
energy = {{'{sp_level}': Log('{sp_path}')}}
energy = Log('{sp_path}')
geometry = Log('{opt_path}')
Expand Down
911 changes: 351 additions & 560 deletions arc/job/job.py

Large diffs are not rendered by default.

133 changes: 44 additions & 89 deletions arc/job/jobTest.py

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions arc/job/local.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env python3
# encoding: utf-8

"""
A module for running jobs on the local machine.
When transitioning to Python 3, use
Expand Down
29 changes: 14 additions & 15 deletions arc/job/ssh.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env python3
# encoding: utf-8

"""
A module for SSHing into servers.
Used for giving commands, uploading, and downloading files.
Expand Down Expand Up @@ -94,7 +91,7 @@ def __exit__(self, exc_type, exc_value, exc_traceback) -> None:
@check_connections
def _send_command_to_server(self,
command: Union[str, list],
remote_path: Optional[str] = '',
remote_path: str = '',
) -> Tuple[list, list]:
"""
A wrapper for exec_command in paramiko.SSHClient. Send commands to the server.
Expand Down Expand Up @@ -123,20 +120,20 @@ def _send_command_to_server(self,
try:
_, stdout, stderr = self._ssh.exec_command(command)
except Exception as e: # SSHException: Timeout opening channel.
logger.debug(f'ssh timed-out in the first trial. Got:{e}')
logger.debug(f'ssh timed-out in the first trial. Got: {e}')
try: # try again
_, stdout, stderr = self._ssh.exec_command(command)
except Exception as e:
logger.debug(f'ssh timed-out after two trials. Got:{e}')
return ['',], ['ssh timed-out after two trials',]
logger.debug(f'ssh timed-out after two trials. Got: {e}')
return ['', ], ['ssh timed-out after two trials', ]
stdout = stdout.readlines()
stderr = stderr.readlines()
return stdout, stderr

def upload_file(self,
remote_file_path: str,
local_file_path: Optional[str] = '',
file_string: Optional[str] = '',
local_file_path: str = '',
file_string: str = '',
) -> None:
"""
Upload a local file or contents from a string to the remote server.
Expand Down Expand Up @@ -257,7 +254,7 @@ def delete_jobs(self,
Delete all of the jobs on a specific server.
Args:
jobs (Optional[List[str, int]]): Specific ARC job IDs to delete.
jobs (List[str, int], optional): Specific ARC job IDs to delete.
"""
jobs_message = f'{len(jobs)}' if jobs is not None else 'all'
print(f'\nDeleting {jobs_message} ARC jobs from {self.server}...')
Expand Down Expand Up @@ -444,18 +441,18 @@ def list_available_nodes(self) -> list:
def change_mode(self,
mode: str,
path: str,
recursive: Optional[bool] = False,
remote_path: Optional[str] = '',
recursive: bool = False,
remote_path: str = '',
) -> None:
"""
Change the mode to a file or a directory.
Args:
mode (str): The mode change to be applied, can be either octal or symbolic.
path (str): The path to the file or the directory to be changed.
recursive (Optional[bool]): Whether to recursively change the mode to all files
recursive (bool, optional): Whether to recursively change the mode to all files
under a directory.``True`` for recursively change.
remote_path (Optional[str]): The directory path at which the command will be executed.
remote_path (str, optional): The directory path at which the command will be executed.
"""
recursive = '-R' if recursive else ''
command = f'chmod {recursive} {mode} {path}'
Expand Down Expand Up @@ -549,7 +546,9 @@ def check_job_status_in_stdout(job_id: int,
raise ValueError(f'Unknown cluster software {servers[server]["cluster_soft"]}')


def delete_all_arc_jobs(server_list: list, jobs: Optional[List[str]] = None) -> None:
def delete_all_arc_jobs(server_list: list,
jobs: Optional[List[str]] = None,
) -> None:
"""
Delete all ARC-spawned jobs (with job name starting with `a` and a digit) from :list:servers
(`servers` could also be a string of one server name)
Expand Down
3 changes: 0 additions & 3 deletions arc/job/submit.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env python3
# encoding: utf-8

"""
Submit scripts
sorted in a dictionary with server names as keys
Expand Down

0 comments on commit b10352a

Please sign in to comment.