Skip to content

Commit

Permalink
Gauss trsh fix (#716)
Browse files Browse the repository at this point in the history
NDamp was misspelled (appears to have been for a while but never
noticed)
`L502/L1002,Inaccurate quadrature in CalDSu.` - This error can appear
has multiple ways to attempt to solve (but not always successful). Have
attempted to provide guess=INDO now as an option if this error continues
to occur.

https://github.com/liyuanhe211/Solution_for_Every_Gaussian_Error_Message#arrow_forward-l502l1002inaccurate-quadrature-in-caldsu-hourglass_flowing_sand

https://wongzit.github.io/gaussian-common-errors-and-solutions/#inaccurate-quadrature-in-caldsu
  • Loading branch information
calvinp0 authored Nov 28, 2023
2 parents 36c361d + 051e692 commit 2b5e18d
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 17 deletions.
10 changes: 8 additions & 2 deletions arc/job/adapters/gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,14 @@ def write_input_file(self) -> None:
input_dict['job_type_1'] += f' SCRF=({self.level.solvation_method}, Solvent={self.level.solvent})'

if self.species[0].number_of_atoms > 1:
input_dict['job_type_1'] += ' guess=read' if self.checkfile is not None and os.path.isfile(self.checkfile) \
else ' guess=mix'
if input_dict['job_type_1']:
input_dict['job_type_1'] += ' '
if 'guess=INDO' in input_dict['trsh']:
input_dict['job_type_1'] += 'guess=INDO'
input_dict['trsh'] = input_dict['trsh'].replace('guess=INDO', '')
else:
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+)']
Expand Down
14 changes: 7 additions & 7 deletions arc/job/adapters/gaussian_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def setUpClass(cls):
)

# Gaussian: Additional SCF error
# Second SCF error - Includes previous SCF error and NDump=30
# Second SCF error - Includes previous SCF error and NDamp=30
job_status = {'keywords': ['SCF']}
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,
Expand Down Expand Up @@ -518,7 +518,7 @@ def test_trsh_write_input_file(self):
%mem=14336mb
%NProcShared=8
#P opt=(calcfc,maxstep=5,tight) guess=mix wb97xd integral=(grid=ultrafine, Acc2E=14) IOp(2/9=2000) scf=(direct,tight)
#P opt=(calcfc,maxstep=5,tight) guess=mix wb97xd integral=(grid=ultrafine, Acc2E=14) IOp(2/9=2000) scf=(direct,tight)
ethanol
Expand All @@ -544,7 +544,7 @@ def test_trsh_write_input_file(self):
%mem=14336mb
%NProcShared=8
#P opt=(calcfc,maxstep=5,tight) guess=mix wb97xd integral=(grid=ultrafine, Acc2E=14) IOp(2/9=2000) nosymm scf=(direct,tight,xqc)
#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 @@ -570,7 +570,7 @@ def test_trsh_write_input_file(self):
%mem=14336mb
%NProcShared=8
#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)
#P opt=(calcfc,maxstep=5,tight) guess=mix wb97xd integral=(grid=ultrafine, Acc2E=14) IOp(2/9=2000) nosymm scf=(NDamp=30,direct,tight,xqc)
ethanol
Expand All @@ -596,7 +596,7 @@ def test_trsh_write_input_file(self):
%mem=14336mb
%NProcShared=8
#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)
#P opt=(calcfc,maxstep=5,tight) guess=mix wb97xd integral=(grid=ultrafine, Acc2E=14) IOp(2/9=2000) nosymm scf=(NDamp=30,NoDIIS,direct,tight,xqc)
ethanol
Expand All @@ -622,7 +622,7 @@ def test_trsh_write_input_file(self):
%mem=14336mb
%NProcShared=8
#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)
#P opt=(calcfc,cartesian,maxstep=5,tight) guess=mix wb97xd integral=(grid=ultrafine, Acc2E=14) IOp(2/9=2000) nosymm scf=(NDamp=30,NoDIIS,direct,tight,xqc)
ethanol
Expand All @@ -649,7 +649,7 @@ def test_trsh_write_input_file(self):
%mem=14336mb
%NProcShared=8
#P opt=(cartesian) integral=(grid=ultrafine, Acc2E=14) guess=mix wb97xd IOp(2/9=2000) nosymm scf=(NDump=30,NoDIIS,direct,tight,xqc)
#P opt=(cartesian) integral=(grid=ultrafine, Acc2E=14) guess=INDO wb97xd IOp(2/9=2000) nosymm scf=(NDamp=30,NoDIIS,direct,tight,xqc)
ethanol
Expand Down
26 changes: 19 additions & 7 deletions arc/job/trsh.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ def trsh_ess_job(label: str,
logger_info = []
couldnt_trsh = True
fine = False

attempted_ess_trsh_methods = ess_trsh_methods.copy() if ess_trsh_methods else None
# Check if Checkfile removal is in the keywords. Removal occurs when:
# - Basis Set Mismatch
# - Corrupt or Incomplete Data
Expand All @@ -877,8 +877,8 @@ def trsh_ess_job(label: str,

# Check if SCF is in the keyword
ess_trsh_methods, trsh_keyword, couldnt_trsh = trsh_keyword_scf(job_status, ess_trsh_methods, trsh_keyword, couldnt_trsh)
if 'scf=(NDump=30)' in ess_trsh_methods:
logger_info.append('using scf=(NDump=30)')
if 'scf=(NDamp=30)' in ess_trsh_methods:
logger_info.append('using scf=(NDamp=30)')
if 'scf=(qc)' in ess_trsh_methods:
logger_info.append('using scf=(qc)')
if 'scf=(NoDIIS)' in ess_trsh_methods:
Expand All @@ -894,6 +894,7 @@ def trsh_ess_job(label: str,
if fine:
logger_info.append('using a fine grid')


# Check if memory is in the keyword
if 'Memory' in job_status['keywords'] and 'too high' not in job_status['error'] and server is not None:
# Increase memory allocation
Expand All @@ -904,8 +905,15 @@ def trsh_ess_job(label: str,
logger.info(f'Troubleshooting {job_type} job in {software} for {label} using more memory: {memory} GB '
f'instead of {memory_gb} GB')
ess_trsh_methods.append('memory')
# Log information
if logger_info:

if attempted_ess_trsh_methods:
if attempted_ess_trsh_methods == ess_trsh_methods:
logger.info(f'{logger_phrase} was not successful. Already attempted all possible troubleshooting methods. Will not troubleshoot again.')
couldnt_trsh = True
else:
if logger_info:
logger.info(f'{logger_phrase} {", ".join(logger_info)}')
elif logger_info:
logger.info(f'{logger_phrase} {", ".join(logger_info)}')

elif software == 'qchem':
Expand Down Expand Up @@ -1594,13 +1602,17 @@ def trsh_keyword_scf(job_status, ess_trsh_methods, trsh_keyword, couldnt_trsh) -
# try both qc and nosymm
ess_trsh_methods.append('scf=(qc)')
couldnt_trsh = False
elif 'SCF' in job_status['keywords'] and 'scf=(NDump=30)' not in ess_trsh_methods:
elif 'SCF' in job_status['keywords'] and 'scf=(NDamp=30)' not in ess_trsh_methods:
# Switching off Pulay's Direct Inversion
ess_trsh_methods.append('scf=(NDump=30)')
ess_trsh_methods.append('scf=(NDamp=30)')
couldnt_trsh = False
elif 'SCF' in job_status['keywords'] and 'scf=(NoDIIS)' not in ess_trsh_methods:
ess_trsh_methods.append('scf=(NoDIIS)')
couldnt_trsh = False
elif 'SCF' in job_status['keywords'] and 'guess=INDO' not in ess_trsh_methods:
ess_trsh_methods.append('guess=INDO')
couldnt_trsh = False
trsh_keyword.append('guess=INDO')
if any('scf' in keyword for keyword in ess_trsh_methods):
scf_list = [match for element in ess_trsh_methods for match in re.findall(scf_pattern, element)] if any(re.search(scf_pattern, element) for element in ess_trsh_methods) else []
trsh_keyword.append('scf=(' + ','.join(scf_list) + ')')
Expand Down
10 changes: 10 additions & 0 deletions arc/job/trsh_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,16 @@ def test_trsh_ess_job(self):
self.assertTrue(couldnt_trsh)
self.assertIn('Error: Could not troubleshoot opt for ethanol! The job ran out of disc space on server1; ', output_errors)

# Gaussian: test 6
job_status = {'keywords': ['SCF', 'GL502', 'NoSymm']}
ess_trsh_methods = ['scf=(NoDIIS)', 'int=(Acc2E=14)', 'checkfile=None', 'scf=(qc)', 'NoSymm','scf=(NDamp=30)', 'guess=INDO' ]
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,
num_heavy_atoms, cpu_cores, ess_trsh_methods)
self.assertTrue(couldnt_trsh)
self.assertIn("Error: Could not troubleshoot opt for ethanol! Tried troubleshooting with the following methods: ['scf=(NoDIIS)', 'int=(Acc2E=14)', 'checkfile=None', 'scf=(qc)', 'NoSymm', 'scf=(NDamp=30)', 'guess=INDO']; ", output_errors)

# Test Q-Chem
software = 'qchem'
ess_trsh_methods = ['change_node']
Expand Down
2 changes: 1 addition & 1 deletion arc/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def test_as_dict(self):
three_params=False,
ts_adapters=['heuristics', 'AutoTST', 'GCN', 'xtb_gsm'],
)
arc0.freq_level.args['keyword']['general'] = 'scf=(NDump=30)'
arc0.freq_level.args['keyword']['general'] = 'scf=(NDamp=30)'
restart_dict = arc0.as_dict()
long_thermo_description = restart_dict['species'][0]['long_thermo_description']
self.assertIn('Bond corrections:', long_thermo_description)
Expand Down

0 comments on commit 2b5e18d

Please sign in to comment.