Skip to content

Commit

Permalink
Merge pull request #458 from ReactionMechanismGenerator/gromacs
Browse files Browse the repository at this point in the history
Deprecate Gromacs support
  • Loading branch information
alongd committed Jun 6, 2021
2 parents d5a10b1 + 800b238 commit 2ca32d9
Show file tree
Hide file tree
Showing 16 changed files with 80 additions and 725 deletions.
2 changes: 1 addition & 1 deletion arc/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def check_ess_settings(ess_settings: Optional[dict] = None) -> dict:
f'strings. Got: {server_list} which is a {type(server_list)}')
# run checks:
for ess, server_list in settings_dict.items():
if ess.lower() not in ['gaussian', 'qchem', 'molpro', 'orca', 'terachem', 'onedmin', 'gromacs']:
if ess.lower() not in ['gaussian', 'qchem', 'molpro', 'orca', 'terachem', 'onedmin']:
raise SettingsError(f'Recognized ESS software are Gaussian, QChem, Molpro, Orca, TeraChem or OneDMin. '
f'Got: {ess}')
for server in server_list:
Expand Down
58 changes: 3 additions & 55 deletions arc/job/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ class Job(object):
determine it). Defaults to None. Important, e.g., if a Species is a bi-rad
singlet, in which case the job should be unrestricted with
multiplicity = 1.
conformers (str, optional): A path to the YAML file conformer coordinates for a Gromacs MD job.
radius (float, optional): The species radius in Angstrom.
directed_scans (list): Entries are lists of four-atom dihedral scan indices to constrain during a directed scan.
directed_dihedrals (list): The dihedral angles of a directed scan job corresponding to ``directed_scans``.
Expand All @@ -111,7 +110,6 @@ class Job(object):
radius (float): The species radius in Angstrom.
n_atoms (int): The number of atoms in self.xyz.
conformer (int): Conformer number if optimizing conformers.
conformers (str): A path to the YAML file conformer coordinates for a Gromacs MD job.
is_ts (bool): Whether this species represents a transition structure.
level (Level): The level of theory to use.
job_type (str): The job's type.
Expand Down Expand Up @@ -214,7 +212,6 @@ def __init__(self,
scan_res: Optional[int] = None,
checkfile: Optional[str] = None,
number_of_radicals: Optional[int] = None,
conformers: Optional[str] = None,
radius: Optional[float] = None,
directed_scan_type: Optional[str] = None,
directed_scans: Optional[list] = None,
Expand Down Expand Up @@ -254,7 +251,6 @@ def __init__(self,
self.directed_dihedrals = [float(d) for d in directed_dihedrals] if directed_dihedrals is not None \
else directed_scans # it's a string in the restart dict
self.conformer = conformer
self.conformers = conformers
self.is_ts = is_ts
self.ess_trsh_methods = ess_trsh_methods or list()
self.args = {'keyword': {'general': args}} if isinstance(args, str) else args or dict()
Expand Down Expand Up @@ -289,13 +285,11 @@ def __init__(self,

# allowed job types:
job_types = ['conformer', 'opt', 'freq', 'optfreq', 'sp', 'composite', 'bde', 'scan', 'directed_scan',
'gsm', 'irc', 'ts_guess', 'orbitals', 'onedmin', 'ff_param_fit', 'gromacs']
'gsm', 'irc', 'ts_guess', 'orbitals', 'onedmin']
if self.job_type not in job_types:
raise ValueError(f'Job type {self.job_type} not understood. Must be one of the following:\n{job_types}')
if self.xyz is None and not self.job_type == 'gromacs':
if self.xyz is None:
raise InputError(f'{self.job_type} Job of species {self.species_name} got None for xyz')
if self.job_type == 'gromacs' and self.conformers is None:
raise InputError(f'{self.job_type} Job of species {self.species_name} got None for conformers')
if self.job_type == 'directed_scan' and (self.directed_dihedrals is None or self.directed_scans is None
or self.directed_scan_type is None):
raise InputError(f'Must have the directed_dihedrals, directed_scans, and directed_scan_type attributes '
Expand Down Expand Up @@ -412,8 +406,6 @@ def as_dict(self) -> dict:
job_dict['rotor_index'] = self.rotor_index
if self.checkfile is not None:
job_dict['checkfile'] = self.checkfile
if self.conformers is not None:
job_dict['conformers'] = self.conformers
if self.radius is not None:
job_dict['radius'] = self.radius
if self.irc_direction is not None:
Expand Down Expand Up @@ -806,24 +798,6 @@ def write_input_file(self):
'PRINT_ORBITALS TRUE\n GUI 2',
key1='block')

elif self.job_type == 'ff_param_fit' and self.software == 'gaussian':
job_type_1, job_type_2 = 'opt', 'freq'
self.input += """
--Link1--
%chk=check.chk
%mem={memory}mb
%NProcShared={cpus}
# HF/6-31G(d) SCF=Tight Pop=MK IOp(6/33=2,6/41=10,6/42=17) scf(maxcyc=500) guess=read geom=check Maxdisk=2GB
name
{charge} {multiplicity}
"""

elif self.job_type == 'freq':
if self.software == 'gaussian':
job_type_2 = 'freq iop(7/33=1) scf=(tight, direct) integral=(grid=ultrafine, Acc2E=12)'
Expand Down Expand Up @@ -1526,10 +1500,9 @@ def set_cpu_and_mem(self):
elif self.software.lower() in ['orca']:
# Orca's memory is per cpu core and in MB
self.input_file_memory = math.ceil(self.total_job_memory_gb * 1024 / self.cpu_cores)
elif self.software.lower() in ['qchem', 'gromacs']:
elif self.software.lower() in ['qchem']:
# QChem manages its memory automatically, for now ARC will not intervene
# see http://www.q-chem.com/qchem-website/manual/qchem44_manual/CCparallel.html
# Also not managing memory for Gromacs
self.input_file_memory = math.ceil(self.total_job_memory_gb)

def set_file_paths(self):
Expand Down Expand Up @@ -1580,31 +1553,6 @@ def set_file_paths(self):
self.additional_files_to_upload.append({'name': 'qc.mol', 'source': 'input_files', 'make_x': False,
'local': 'onedmin.qc.mol',
'remote': os.path.join(self.remote_path, 'qc.mol')})
if self.job_type == 'gromacs':
self.additional_files_to_upload.append({'name': 'gaussian.out', 'source': 'path', 'make_x': False,
'local': os.path.join(self.project_directory, 'calcs', 'Species',
self.species_name, 'ff_param_fit',
'gaussian.out'),
'remote': os.path.join(self.remote_path, 'gaussian.out')})
self.additional_files_to_upload.append({'name': 'coords.yml', 'source': 'path', 'make_x': False,
'local': self.conformers,
'remote': os.path.join(self.remote_path, 'coords.yml')})
self.additional_files_to_upload.append({'name': 'acpype.py', 'source': 'path', 'make_x': False,
'local': os.path.join(ARC_PATH, 'arc', 'scripts', 'conformers',
'acpype.py'),
'remote': os.path.join(self.remote_path, 'acpype.py')})
self.additional_files_to_upload.append({'name': 'mdconf.py', 'source': 'path', 'make_x': False,
'local': os.path.join(ARC_PATH, 'arc', 'scripts', 'conformers',
'mdconf.py'),
'remote': os.path.join(self.remote_path, 'mdconf.py')})
self.additional_files_to_upload.append({'name': 'M00.tleap', 'source': 'path', 'make_x': False,
'local': os.path.join(ARC_PATH, 'arc', 'scripts', 'conformers',
'M00.tleap'),
'remote': os.path.join(self.remote_path, 'M00.tleap')})
self.additional_files_to_upload.append({'name': 'mdp.mdp', 'source': 'path', 'make_x': False,
'local': os.path.join(ARC_PATH, 'arc', 'scripts', 'conformers',
'mdp.mdp'),
'remote': os.path.join(self.remote_path, 'mdp.mdp')})
if self.software == 'terachem':
self.additional_files_to_upload.append({'name': 'geo', 'source': 'path', 'make_x': False,
'local': os.path.join(self.local_path, 'coord.xyz'),
Expand Down
39 changes: 0 additions & 39 deletions arc/job/jobTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,45 +317,6 @@ def test_set_file_paths(self):
self.assertIn('qc.mol', self.job1.additional_files_to_upload[2]['remote'])
self.assertEqual(self.job1.additional_files_to_upload[2]['local'], 'onedmin.qc.mol')

self.job1.job_type = 'gromacs'
self.job1.set_file_paths()
self.assertEqual(len(self.job1.additional_files_to_upload), 6)

self.assertEqual(self.job1.additional_files_to_upload[0]['source'], 'path')
self.assertEqual(self.job1.additional_files_to_upload[0]['name'], 'gaussian.out')
self.assertFalse(self.job1.additional_files_to_upload[0]['make_x'])
self.assertIn('gaussian.out', self.job1.additional_files_to_upload[0]['remote'])
self.assertIn('gaussian.out', self.job1.additional_files_to_upload[0]['local'])

self.assertEqual(self.job1.additional_files_to_upload[1]['source'], 'path')
self.assertEqual(self.job1.additional_files_to_upload[1]['name'], 'coords.yml')
self.assertFalse(self.job1.additional_files_to_upload[1]['make_x'])
self.assertIn('coords.yml', self.job1.additional_files_to_upload[1]['remote'])

self.assertEqual(self.job1.additional_files_to_upload[2]['source'], 'path')
self.assertEqual(self.job1.additional_files_to_upload[2]['name'], 'acpype.py')
self.assertFalse(self.job1.additional_files_to_upload[2]['make_x'])
self.assertIn('acpype.py', self.job1.additional_files_to_upload[2]['remote'])
self.assertIn('acpype.py', self.job1.additional_files_to_upload[2]['local'])

self.assertEqual(self.job1.additional_files_to_upload[3]['source'], 'path')
self.assertEqual(self.job1.additional_files_to_upload[3]['name'], 'mdconf.py')
self.assertFalse(self.job1.additional_files_to_upload[3]['make_x'])
self.assertIn('mdconf.py', self.job1.additional_files_to_upload[3]['remote'])
self.assertIn('mdconf.py', self.job1.additional_files_to_upload[3]['local'])

self.assertEqual(self.job1.additional_files_to_upload[4]['source'], 'path')
self.assertEqual(self.job1.additional_files_to_upload[4]['name'], 'M00.tleap')
self.assertFalse(self.job1.additional_files_to_upload[4]['make_x'])
self.assertIn('M00.tleap', self.job1.additional_files_to_upload[4]['remote'])
self.assertIn('M00.tleap', self.job1.additional_files_to_upload[4]['local'])

self.assertEqual(self.job1.additional_files_to_upload[5]['source'], 'path')
self.assertEqual(self.job1.additional_files_to_upload[5]['name'], 'mdp.mdp')
self.assertFalse(self.job1.additional_files_to_upload[5]['make_x'])
self.assertIn('mdp.mdp', self.job1.additional_files_to_upload[5]['remote'])
self.assertIn('mdp.mdp', self.job1.additional_files_to_upload[5]['local'])

def test_format_max_job_time(self):
"""Test that the maximum job time can be formatted properly, including days, minutes, and seconds"""
test_job = Job.__new__(Job)
Expand Down
9 changes: 1 addition & 8 deletions arc/level.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,13 +465,6 @@ def deduce_software(self,
f'levels_ess is:\n{levels_ess}')
self.software = 'onedmin'

# Gromacs
if job_type == 'gromacs':
if 'gromacs' not in supported_ess:
raise ValueError(f'Could not find the Gromacs software to run the MD job {self.method}.\n'
f'levels_ess is:\n{levels_ess}')
self.software = 'gromacs'

# QChem
if job_type == 'orbitals':
# currently we only have a script to print orbitals on QChem,
Expand All @@ -488,7 +481,7 @@ def deduce_software(self,
self.software = 'orca'

# Gaussian
if self.method_type == 'composite' or job_type == 'composite' or job_type == 'ff_param_fit' or job_type == 'irc' \
if self.method_type == 'composite' or job_type == 'composite' or job_type == 'irc' \
or any([sum(['iop' in value.lower() for value in subdict.values()]) for subdict in self.args.values()]):
if 'gaussian' not in supported_ess:
raise ValueError(f'Could not find Gaussian to run the {self.method}.\n'
Expand Down
15 changes: 11 additions & 4 deletions arc/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -868,8 +868,13 @@ def save_conformers_file(project_directory: str,

# *** Torsions ***

def plot_torsion_angles(torsion_angles, torsions_sampling_points=None, wells_dict=None, e_conformers=None,
de_threshold=5.0, plot_path=None):
def plot_torsion_angles(torsion_angles,
torsions_sampling_points=None,
wells_dict=None,
e_conformers=None,
de_threshold=5.0,
plot_path=None,
):
"""
Plot the torsion angles of the generated conformers.
Expand Down Expand Up @@ -904,7 +909,8 @@ def plot_torsion_angles(torsion_angles, torsions_sampling_points=None, wells_dic
np.zeros_like(np.arange(len(sampling_points[tuple(torsion)]))), 'ro', alpha=0.35, ms=7)
axs.frameon = False
axs.set_ylabel(str(torsion), labelpad=10)
axs.set_yticklabels(['' for _ in range(len(torsions))])
axs.set_yticks(axs.get_yticks().tolist())
axs.set_yticklabels(['' for _ in range(len(axs.get_yticks().tolist()))])
axs.tick_params(axis='y', # changes apply to the x-axis
which='both', # both major and minor ticks are affected
left=False, # ticks along the bottom edge are off
Expand Down Expand Up @@ -956,7 +962,8 @@ def plot_torsion_angles(torsion_angles, torsions_sampling_points=None, wells_dic
axs[i].set_ylabel(str(torsion), labelpad=10)
# axs[i].yaxis.label.set_rotation(0)
if e_conformers is None:
axs[i].set_yticklabels(['' for _ in range(len(torsions))])
axs[i].set_yticks(axs[i].get_yticks().tolist())
axs[i].set_yticklabels(['' for _ in range(len(axs[i].get_yticks().tolist()))])
axs[i].tick_params(axis='y', # changes apply to the x-axis
which='both', # both major and minor ticks are affected
left=False, # ticks along the bottom edge are off
Expand Down

0 comments on commit 2ca32d9

Please sign in to comment.