Skip to content

Commit

Permalink
Gauss Adapt Fixes
Browse files Browse the repository at this point in the history
Opt is now treated like SCF, whereby param terms are split and recombined into one `opt=(...)` section
Added NoSymm
  • Loading branch information
calvinp0 committed Nov 23, 2023
1 parent 25e13c1 commit ed5e2b1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 12 deletions.
22 changes: 20 additions & 2 deletions arc/job/adapters/gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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'
Expand Down Expand Up @@ -361,13 +367,25 @@ 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+)']
input_dict, parameters = combine_parameters(input_dict, terms)
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))

Expand Down
20 changes: 10 additions & 10 deletions arc/job/adapters/gaussian_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit ed5e2b1

Please sign in to comment.