From ed5e2b12a47538ae21f1ba0c9098e284b6b84681 Mon Sep 17 00:00:00 2001 From: Calvin Date: Thu, 23 Nov 2023 15:16:07 +0200 Subject: [PATCH] Gauss Adapt Fixes Opt is now treated like SCF, whereby param terms are split and recombined into one `opt=(...)` section Added NoSymm --- arc/job/adapters/gaussian.py | 22 ++++++++++++++++++++-- arc/job/adapters/gaussian_test.py | 20 ++++++++++---------- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/arc/job/adapters/gaussian.py b/arc/job/adapters/gaussian.py index e90790bcab..23ed6a1ced 100644 --- a/arc/job/adapters/gaussian.py +++ b/arc/job/adapters/gaussian.py @@ -300,7 +300,10 @@ def write_input_file(self) -> None: input_dict['job_type_2'] = 'freq IOp(7/33=1)' elif self.job_type == 'sp': - input_dict['job_type_1'] = f'scf=(tight, direct) integral=(grid=ultrafine, {integral_algorithm})' + input_dict['job_type_1'] = f'integral=(grid=ultrafine, {integral_algorithm})' + if input_dict['trsh']: + input_dict['trsh'] += ' ' + input_dict['trsh'] += 'scf=(tight, direct)' elif self.job_type == 'scan': scans, scans_strings = list(), list() @@ -317,8 +320,11 @@ def write_input_file(self) -> None: self.torsions = torsions_to_scans(scans, direction=-1) ts = 'ts, ' if self.is_ts else '' - input_dict['job_type_1'] = f'opt=({ts}modredundant, calcfc, noeigentest, maxStep=5) scf=(tight, direct) ' \ + input_dict['job_type_1'] = f'opt=({ts}modredundant, calcfc, noeigentest, maxStep=5)' \ f'integral=(grid=ultrafine, {integral_algorithm})' + if input_dict['trsh']: + input_dict['trsh'] += ' ' + input_dict['trsh'] += 'scf=(tight, direct)' input_dict['scan'] = '\n\n' if not input_dict['scan'] else input_dict['scan'] for scan in scans_strings: input_dict['scan'] += f'D {scan} S {int(360 / self.scan_res)} {self.scan_res:.1f}\n' @@ -361,6 +367,15 @@ def write_input_file(self) -> None: input_dict['job_type_1'] += ' guess=read' if self.checkfile is not None and os.path.isfile(self.checkfile) \ else ' guess=mix' + # Fix OPT + terms_opt = [r'opt=\((.*?)\)', r'opt=(\w+)'] + input_dict, parameters_opt = combine_parameters(input_dict, terms_opt) + # If 'opt' parameters are found, concatenate and reinsert them + if parameters_opt: + # Remove duplicate parameters + combined_opt_params = ','.join(parameters_opt) + input_dict['job_type_1'] = f"opt=({combined_opt_params}) {input_dict['job_type_1']}" + #Fix SCF # This may be redundant due to additional fixes in the above code terms = ['scf=\((.*?)\)', 'scf=(\w+)'] @@ -368,6 +383,9 @@ def write_input_file(self) -> None: if parameters: input_dict['trsh'] += f" scf=({','.join(parameters)})" + # Remove double spaces + input_dict['job_type_1'] = input_dict['job_type_1'].replace(' ', ' ') + with open(os.path.join(self.local_path, input_filenames[self.job_adapter]), 'w') as f: f.write(Template(input_template).render(**input_dict)) diff --git a/arc/job/adapters/gaussian_test.py b/arc/job/adapters/gaussian_test.py index 5b81ce94a0..0c1f876542 100644 --- a/arc/job/adapters/gaussian_test.py +++ b/arc/job/adapters/gaussian_test.py @@ -187,7 +187,7 @@ def setUpClass(cls): # Gaussian: Checkfile error and SCF error # First SCF error - qc,nosymm - job_status = {'keywords': ['SCF']} + job_status = {'keywords': ['SCF', 'NoSymm']} output_errors, ess_trsh_methods, remove_checkfile, level_of_theory, software, job_type, fine, trsh_keyword, \ memory, shift, cpu_cores, couldnt_trsh = trsh.trsh_ess_job(label, level_of_theory, server, job_status, job_type, software, fine, memory_gb, @@ -297,7 +297,7 @@ def test_write_input_file(self): %mem=14336mb %NProcShared=8 -#P opt=(calcfc) cbs-qb3 IOp(2/9=2000) IOp(1/12=5,3/44=0) +#P opt=(calcfc) cbs-qb3 IOp(2/9=2000) IOp(1/12=5,3/44=0) spc1 @@ -333,7 +333,7 @@ def test_write_input_file(self): %mem=14336mb %NProcShared=8 -#P opt=(modredundant, calcfc, noeigentest, maxStep=5) integral=(grid=ultrafine, Acc2E=12) guess=mix wb97xd/def2tzvp IOp(2/9=2000) scf=(tight, direct) +#P opt=(modredundant, calcfc, noeigentest, maxStep=5) integral=(grid=ultrafine, Acc2E=12) guess=mix wb97xd/def2tzvp IOp(2/9=2000) scf=(tight, direct) ethanol @@ -384,7 +384,7 @@ def test_write_input_file(self): %mem=14336mb %NProcShared=8 -#P opt=(calcfc) uwb97xd/def2tzvp IOp(2/9=2000) +#P opt=(calcfc) uwb97xd/def2tzvp IOp(2/9=2000) anion @@ -478,7 +478,7 @@ def test_trsh_write_input_file(self): %mem=14336mb %NProcShared=8 -#P opt=(calcfc, tight, maxstep=5) uwb97xd integral=(grid=ultrafine, Acc2E=14) IOp(2/9=2000) scf=(tight,direct) +#P opt=(calcfc,maxstep=5,tight) uwb97xd integral=(grid=ultrafine, Acc2E=14) IOp(2/9=2000) scf=(direct,tight) anion @@ -496,7 +496,7 @@ def test_trsh_write_input_file(self): %mem=14336mb %NProcShared=8 -#P opt=(calcfc, tight, maxstep=5) guess=mix wb97xd integral=(grid=ultrafine, Acc2E=14) IOp(2/9=2000) scf=(tight,direct) +#P opt=(calcfc,maxstep=5,tight) guess=mix wb97xd integral=(grid=ultrafine, Acc2E=14) IOp(2/9=2000) scf=(direct,tight) ethanol @@ -522,7 +522,7 @@ def test_trsh_write_input_file(self): %mem=14336mb %NProcShared=8 -#P opt=(calcfc, tight, maxstep=5) guess=mix wb97xd integral=(grid=ultrafine, Acc2E=14) IOp(2/9=2000) scf=(tight,direct,xqc,nosymm) +#P opt=(calcfc,maxstep=5,tight) guess=mix wb97xd integral=(grid=ultrafine, Acc2E=14) IOp(2/9=2000) nosymm scf=(direct,tight,xqc) ethanol @@ -548,7 +548,7 @@ def test_trsh_write_input_file(self): %mem=14336mb %NProcShared=8 -#P opt=(calcfc, tight, maxstep=5) guess=mix wb97xd integral=(grid=ultrafine, Acc2E=14) IOp(2/9=2000) scf=(tight,direct,xqc,nosymm,NDump=30) +#P opt=(calcfc,maxstep=5,tight) guess=mix wb97xd integral=(grid=ultrafine, Acc2E=14) IOp(2/9=2000) nosymm scf=(NDump=30,direct,tight,xqc) ethanol @@ -574,7 +574,7 @@ def test_trsh_write_input_file(self): %mem=14336mb %NProcShared=8 -#P opt=(calcfc, tight, maxstep=5) guess=mix wb97xd integral=(grid=ultrafine, Acc2E=14) IOp(2/9=2000) scf=(tight,direct,xqc,nosymm,NDump=30,NoDIIS) +#P opt=(calcfc,maxstep=5,tight) guess=mix wb97xd integral=(grid=ultrafine, Acc2E=14) IOp(2/9=2000) nosymm scf=(NDump=30,NoDIIS,direct,tight,xqc) ethanol @@ -600,7 +600,7 @@ def test_trsh_write_input_file(self): %mem=14336mb %NProcShared=8 -#P opt=(calcfc, tight, maxstep=5) guess=mix wb97xd integral=(grid=ultrafine, Acc2E=14) IOp(2/9=2000) opt=(cartesian,nosymm) scf=(tight,direct,xqc,nosymm,NDump=30,NoDIIS) +#P opt=(calcfc,cartesian,maxstep=5,tight) guess=mix wb97xd integral=(grid=ultrafine, Acc2E=14) IOp(2/9=2000) nosymm scf=(NDump=30,NoDIIS,direct,tight,xqc) ethanol