Skip to content

Commit

Permalink
all in one
Browse files Browse the repository at this point in the history
  • Loading branch information
JintaoWu98 committed Oct 12, 2024
1 parent 7e7530d commit 7d634e1
Show file tree
Hide file tree
Showing 17 changed files with 95 additions and 83 deletions.
4 changes: 2 additions & 2 deletions arc/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ def initialize_job_types(job_types: Optional[dict] = None,
if 'fine_grid' in job_types:
del job_types['fine_grid']

defaults_to_true = ['conformers', 'fine', 'freq', 'irc', 'opt', 'rotors', 'sp']
defaults_to_false = ['bde', 'onedmin', 'orbitals']
defaults_to_true = ['conf_opt', 'fine', 'freq', 'irc', 'opt', 'rotors', 'sp']
defaults_to_false = ['conf_sp', 'bde', 'onedmin', 'orbitals']
if job_types is None:
job_types = default_job_types
logger.info("Job types were not specified, using ARC's defaults")
Expand Down
5 changes: 3 additions & 2 deletions arc/common_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ def setUpClass(cls):
cls.maxDiff = None
cls.rmgdb = make_rmg_database_object()
load_families_only(cls.rmgdb)
cls.default_job_types = {'conformers': True,
cls.default_job_types = {'conf_opt': True,
'opt': True,
'fine': True,
'freq': True,
'sp': True,
'rotors': True,
'irc': True,
'conf_sp': False,
'orbitals': False,
'onedmin': False,
'bde': False,
Expand Down Expand Up @@ -388,7 +389,7 @@ def test_almost_equal_lists(self):

def test_initialize_job_with_given_job_type(self):
"""Test the initialize_job_types() function"""
job_types = {'conformers': False, 'opt': True, 'fine': True, 'freq': True, 'sp': False, 'rotors': False, 'irc': True}
job_types = {'conf_opt': False, 'opt': True, 'fine': True, 'freq': True, 'sp': False, 'rotors': False, 'irc': True}
job_types_expected = copy.deepcopy(self.default_job_types)
job_types_expected.update(job_types)
job_types_initialized = common.initialize_job_types(job_types)
Expand Down
9 changes: 5 additions & 4 deletions arc/job/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ class JobTypeEnum(str, Enum):
The available jon types are a finite set.
"""
composite = 'composite'
conformers = 'conformers' # conformer optimization (not generation)
conf_opt = 'conf_opt' # conformer optimization (not generation)
conf_sp = 'conf_sp' # conformer single point
freq = 'freq'
gen_confs = 'gen_confs' # conformer generation
irc = 'irc'
Expand Down Expand Up @@ -385,9 +386,9 @@ def determine_job_array_parameters(self):
if self.species is not None:
if len(self.species) > 1:
self.iterate_by.append('species')
if job_type == 'conformers':
if job_type == 'conf_opt':
if self.species is not None and sum(len(species.conformers) for species in self.species) > 10:
self.iterate_by.append('conformers')
self.iterate_by.append('conf_opt')
self.number_of_processes += sum([len(species.conformers) for species in self.species])
for species in self.species:
if job_type in ['sp', 'opt', 'freq', 'optfreq', 'composite', 'ornitals', 'onedmin', 'irc']:
Expand Down Expand Up @@ -456,7 +457,7 @@ def write_hdf5(self):
else:
for species in self.species:
data[species.label] = list()
if 'conformers' in self.iterate_by:
if 'conf_opt' in self.iterate_by:
for conformer in species.conformers:
data[species.label].append(DataPoint(charge=species.charge,
job_types=['opt'],
Expand Down
7 changes: 4 additions & 3 deletions arc/job/adapter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ def test_job_enum(self):
def test_job_type_enum(self):
"""Test the JobTypeEnum class"""
self.assertEqual(JobTypeEnum('composite').value, 'composite')
self.assertEqual(JobTypeEnum('conformers').value, 'conformers')
self.assertEqual(JobTypeEnum('conf_opt').value, 'conf_opt')
self.assertEqual(JobTypeEnum('conf_sp').value, 'conf_sp')
self.assertEqual(JobTypeEnum('freq').value, 'freq')
self.assertEqual(JobTypeEnum('gen_confs').value, 'gen_confs')
self.assertEqual(JobTypeEnum('irc').value, 'irc')
Expand Down Expand Up @@ -123,7 +124,7 @@ def setUpClass(cls):
"""
cls.maxDiff = None
cls.job_1 = GaussianAdapter(execution_type='queue',
job_type='conformers',
job_type='conf_opt',
level=Level(method='cbs-qb3'),
project='test',
project_directory=os.path.join(ARC_PATH, 'arc', 'testing', 'test_JobAdapter'),
Expand Down Expand Up @@ -224,7 +225,7 @@ def setUpClass(cls):

def test_determine_job_array_parameters(self):
"""Test determining job array parameters"""
self.assertEqual(self.job_1.iterate_by, ['species', 'conformers'])
self.assertEqual(self.job_1.iterate_by, ['species', 'conf_opt'])
self.assertEqual(self.job_1.number_of_processes, 3 * 6)
self.assertEqual(self.job_1.workers, 4)

Expand Down
2 changes: 1 addition & 1 deletion arc/job/adapters/cfour.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def write_input_file(self) -> None:
input_dict['keywords'] = ''

keywords = list()
if self.job_type in ['opt', 'conformers']:
if self.job_type in ['opt', 'conf_opt']:
keywords.append('METHOD=TS' if self.is_ts else 'METHOD=MANR')
elif self.job_type in ['freq', 'optfreq', 'scan']:
raise NotImplementedError(f'CFour cannot execute frequency computations or scans, '
Expand Down
2 changes: 1 addition & 1 deletion arc/job/adapters/gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def write_input_file(self) -> None:
max_c = int(match.group(1))
break

if self.job_type in ['opt', 'conformers', 'optfreq', 'composite']:
if self.job_type in ['opt', 'conf_opt', 'optfreq', 'composite']:
keywords = ['ts', 'calcfc', 'noeigentest', f'maxcycle={max_c}'] if self.is_ts else ['calcfc']
if self.level.method in ['rocbs-qb3']:
# There are no analytical 2nd derivatives (FC) for this method.
Expand Down
2 changes: 1 addition & 1 deletion arc/job/adapters/molpro.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def write_input_file(self) -> None:
input_dict['restricted'] = 'u'

# Job type specific options
if self.job_type in ['opt', 'optfreq', 'conformers']:
if self.job_type in ['opt', 'optfreq', 'conf_opt']:
keywords = ['optg', 'root=2', 'method=qsd', 'readhess', "savexyz='geometry.xyz'"] if self.is_ts \
else ['optg', "savexyz='geometry.xyz'"]
input_dict['job_type_1'] = ', '.join(key for key in keywords)
Expand Down
2 changes: 1 addition & 1 deletion arc/job/adapters/orca.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def write_input_file(self) -> None:
input_dict['restricted'] = 'r' if is_restricted(self) else 'u'

# Job type specific options
if self.job_type in ['opt', 'conformers', 'optfreq']:
if self.job_type in ['opt', 'conf_opt', 'optfreq']:
opt_convergence_key = 'fine_opt_convergence' if self.fine else 'opt_convergence'
opt_convergence = self.args['keyword'].get(opt_convergence_key, '').lower() or \
orca_default_options_dict['opt']['keyword'].get(opt_convergence_key, '').lower()
Expand Down
2 changes: 1 addition & 1 deletion arc/job/adapters/qchem.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def write_input_file(self) -> None:
input_dict['unrestricted'] = 'True' if not is_restricted(self) else 'False'

# Job type specific options
if self.job_type in ['opt', 'conformers', 'optfreq', 'orbitals', 'scan']:
if self.job_type in ['opt', 'conf_opt', 'optfreq', 'orbitals', 'scan']:
input_dict['job_type_1'] = 'ts' if self.is_ts else 'opt'
if self.fine:
input_dict['fine'] = '\n GEOM_OPT_TOL_GRADIENT 15' \
Expand Down
2 changes: 1 addition & 1 deletion arc/job/adapters/scripts/ob_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def main():
sp = run_sp(mol=mol, ff_method=ff_method)
save_output_file(path = str(args.yml_path), key="sp", val=sp)

if job_type in ['opt', 'conformers', 'directed_scan']:
if job_type in ['opt', 'conf_opt', 'directed_scan']:
constraints = input_dict["constraints"] if "constraints" in input_dict.keys() else None
opt_xyz, sp = constraint_opt(mol=mol, constraints_dict=constraints, ff_method=ff_method)
save_output_file(path = str(args.yml_path), content_dict = {"opt_xyz" : opt_xyz, "sp" : sp})
Expand Down
2 changes: 1 addition & 1 deletion arc/job/adapters/scripts/tani_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def main():
forces = run_force(xyz=xyz, device=device, model=model)
save_output_file(path = str(args.yml_path), key="force", val=forces)

elif job_type in ['opt', 'conformers', 'directed_scan', 'optfreq']:
elif job_type in ['opt', 'conf_opt', 'directed_scan', 'optfreq']:
constraints = input_dict["constraints"] if "constraints" in input_dict.keys() else None
opt_xyz = run_opt(xyz=xyz, constraints=constraints, fmax=input_dict["fmax"], model=model,
steps=input_dict["steps"] if "steps" in input_dict.keys() else None, engine=input_dict["engine"])
Expand Down
4 changes: 2 additions & 2 deletions arc/job/adapters/xtb_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def write_input_file(self) -> None:
directives, block = '', ''
uhf = self.species[0].number_of_radicals or self.multiplicity - 1

if self.job_type in ['opt', 'conformers', 'scan']:
if self.job_type in ['opt', 'conf_opt', 'scan']:
directives += ' --opt'
directives += self.add_accuracy()
if self.constraints and self.job_type != 'scan':
Expand Down Expand Up @@ -291,7 +291,7 @@ def is_opt_ts_job(self) -> bool:
bool: Whether this is a transition state geometry optimization job.
"""
if self.species is not None and len(self.species) and self.species[0].is_ts \
and self.job_type in ['opt', 'conformers']:
and self.job_type in ['opt', 'conf_opt']:
return True
return False

Expand Down
3 changes: 2 additions & 1 deletion arc/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,8 @@ def save_project_info_file(self):
txt = ''
txt += f'ARC v{self.__version__}\n'
txt += f'ARC project {self.project}\n\nLevels of theory used:\n\n'
txt += f'Conformers: {self.conformer_opt_level}\n'
txt += f'Conformer optimization: {self.conformer_opt_level}\n'
txt += f'Conformer single point: {self.conformer_sp_level}\n'
txt += f'TS guesses: {self.ts_guess_level}\n'
if self.composite_method is not None:
txt += f'Composite method: {self.composite_method} {fine_txt}\n'
Expand Down
8 changes: 5 additions & 3 deletions arc/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ def setUpClass(cls):
"""
cls.maxDiff = None
cls.servers = servers.keys()
cls.job_types1 = {'conformers': True,
cls.job_types1 = {'conf_opt': True,
'opt': True,
'fine_grid': False,
'freq': True,
'sp': True,
'conf_sp': False,
'rotors': False,
'orbitals': False,
'lennard_jones': False,
Expand Down Expand Up @@ -114,7 +115,8 @@ def test_as_dict(self):
'software': 'gaussian'},
'job_memory': 14,
'job_types': {'bde': True,
'conformers': True,
'conf_opt': True,
'conf_sp': False,
'fine': False,
'freq': True,
'irc': True,
Expand Down Expand Up @@ -204,7 +206,7 @@ def test_from_dict_specific_job(self):
'project_directory': os.path.join(ARC_PATH, 'Projects', 'unit_test_specific_job'),
}
arc1 = ARC(**restart_dict)
job_type_expected = {'conformers': False, 'opt': True, 'freq': True, 'sp': True, 'rotors': False,
job_type_expected = {'conf_opt': False, 'conf_sp': False, 'opt': True, 'freq': True, 'sp': True, 'rotors': False,
'orbitals': False, 'bde': True, 'onedmin': False, 'fine': True, 'irc': False}
self.assertEqual(arc1.job_types, job_type_expected)

Expand Down
Loading

0 comments on commit 7d634e1

Please sign in to comment.