Skip to content

Commit

Permalink
Added ess_settings to settings.py instead of the API
Browse files Browse the repository at this point in the history
and removed precedence from servers dictionary
  • Loading branch information
alongd committed Mar 29, 2019
1 parent 30a4396 commit 38c943c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
34 changes: 19 additions & 15 deletions arc/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
from rmgpy.reaction import Reaction

import arc.rmgdb as rmgdb
from arc.settings import arc_path, default_levels_of_theory, check_status_command, servers, valid_chars
from arc.settings import arc_path, default_levels_of_theory, check_status_command, servers, valid_chars,\
ess_settings
from arc.scheduler import Scheduler
from arc.arc_exceptions import InputError, SettingsError, SpeciesError
from arc.species.species import ARCSpecies
Expand Down Expand Up @@ -83,9 +84,9 @@ class ARC(object):
def __init__(self, input_dict=None, project=None, arc_species_list=None, arc_rxn_list=None, level_of_theory='',
conformer_level='', composite_method='', opt_level='', freq_level='', sp_level='', scan_level='',
ts_guess_level='', fine=True, generate_conformers=True, scan_rotors=True, use_bac=True,
model_chemistry='', ess_settings=None, initial_trsh=None, t_min=None, t_max=None, t_count=None,
model_chemistry='', initial_trsh=None, t_min=None, t_max=None, t_count=None, run_orbitals=True,
verbose=logging.INFO, project_directory=None, max_job_time=120, allow_nonisomorphic_2d=False,
job_memory=1500, run_orbitals=True):
job_memory=1500):

self.__version__ = '1.0.0'
self.verbose = verbose
Expand Down Expand Up @@ -324,7 +325,7 @@ def __init__(self, input_dict=None, project=None, arc_species_list=None, arc_rxn
project_directory = project_directory if project_directory is not None\
else os.path.abspath(os.path.dirname(input_dict))
self.from_dict(input_dict=input_dict, project=project, project_directory=project_directory)
if self.ess_settings is None:
if self.ess_settings is None or self.ess_settings = dict():
self.determine_ess()
self.restart_dict = self.as_dict()
self.determine_model_chemistry()
Expand Down Expand Up @@ -892,29 +893,32 @@ def determine_ess(self, diagnostics=False):
if g03 or g09 or g16:
if diagnostics:
logging.info('Found Gaussian on {3}: g03={0}, g09={1}, g16={2}'.format(g03, g09, g16, server))
if self.ess_settings['gaussian'] is None or 'precedence' in servers[server]\
and servers[server]['precedence'] == 'gaussian':
self.ess_settings['gaussian'] = server
if 'gaussian' not in self.ess_settings.keys():
self.ess_settings['gaussian'] = [server]
else:
self.ess_settings['gaussian'].append(server)
elif diagnostics:
logging.info('Did NOT find Gaussian on {3}: g03={0}, g09={1}, g16={2}'.format(g03, g09, g16, server))
cmd = '. ~/.bashrc; which qchem'
qchem, _ = ssh.send_command_to_server(cmd)
if qchem:
if diagnostics:
logging.info('Found QChem on {0}'.format(server))
if self.ess_settings['qchem'] is None or 'precedence' in servers[server]\
and servers[server]['precedence'] == 'qchem':
self.ess_settings['qchem'] = server
if 'qchem' not in self.ess_settings.keys():
self.ess_settings['qchem'] = [server]
else:
self.ess_settings['qchem'].append(server)
elif diagnostics:
logging.info('Did NOT find QChem on {0}'.format(server))
cmd = '. .bashrc; which molpro'
molpro, _ = ssh.send_command_to_server(cmd)
if molpro:
if diagnostics:
logging.info('Found Molpro on {0}'.format(server))
if self.ess_settings['molpro'] is None or 'precedence' in servers[server]\
and servers[server]['precedence'] == 'molpro':
self.ess_settings['molpro'] = server
if 'molpro' not in self.ess_settings.keys():
self.ess_settings['molpro'] = [server]
else:
self.ess_settings['molpro'].append(server)
elif diagnostics:
logging.info('Did NOT find Molpro on {0}'.format(server))
if diagnostics:
Expand All @@ -926,8 +930,8 @@ def determine_ess(self, diagnostics=False):
if self.ess_settings['molpro']:
logging.info('Using Molpro on {0}'.format(self.ess_settings['molpro']))
logging.info('\n')
if not self.ess_settings['gaussian'] and not self.ess_settings['qchem'] and not self.ess_settings['molpro']\
and not diagnostics:
if 'gaussian' not in self.ess_settings[] and 'qchem' not in self.ess_settings[]\
and 'molpro' not in self.ess_settings[] and not diagnostics:
raise SettingsError('Could not find any ESS. Check your .bashrc definitions on the server.\n'
'Alternatively, you could pass a software-server dictionary to arc as `ess_settings`')
elif diagnostics:
Expand Down
10 changes: 9 additions & 1 deletion arc/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
'address': 'server1.host.edu',
'un': '<username>',
'key': 'path_to_rsa_key',
'precedence': 'molpro',
},
'server2': {
'cluster_soft': 'Slurm', # Simple Linux Utility for Resource Management
Expand All @@ -45,6 +44,15 @@
}
}

# List here servers you'd like to associate with specific ESS.
# An ordered list of servers indicates priority
# Keeping this dictionary empty will cause ARC to scan for software on the servers defined above
ess_settings = {
'gaussian': ['server1', 'server2'],
'molpro': 'server2',
'qchem': 'server1',
}

# List here (complete or partial) phrases of methods or basis sets you'd like to associate to specific ESS
# Avoid ascribing the same phrase to more than one server, this may cause undeterministic assignment of software
# Format is levels_ess = {ess: ['phrase1', 'phrase2'], ess2: ['phrase3', 'phrase3']}
Expand Down

0 comments on commit 38c943c

Please sign in to comment.