Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

184 do not run a calculation if its set up failed #185

Merged
merged 3 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/tcutility/job/adf.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,14 @@ def functional(self, funtional_name: str, dispersion: str = None):
self._functional = functional

if functional == 'r2SCAN-3c' and self._basis_set != 'mTZ2P':
log.warn(f'Switching basis set from {self._basis_set} to mTZ2P for r2SCAN-3c.')
log.info(f'Switching basis set from {self._basis_set} to mTZ2P for r2SCAN-3c.')
self.basis_set('mTZ2P')

if functional == 'SSB-D':
log.error('There are two functionals called SSB-D, please use "GGA:SSB-D" or "MetaGGA:SSB-D".')
return
raise ValueError('There are two functionals called SSB-D, please use "GGA:SSB-D" or "MetaGGA:SSB-D".')

if not data.functionals.get(functional):
log.warn(f'XC-functional {functional} not found. Please ask a TheoCheM developer to add it. Adding functional as LibXC.')
self.settings.input.adf.XC.LibXC = functional
raise ValueError(f'XC-functional {functional} not found.')
else:
func = data.functionals.get(functional)
self.settings.input.adf.update(func.adf_settings)
Expand Down
6 changes: 5 additions & 1 deletion src/tcutility/job/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ def __init__(self, test_mode: bool = False, overwrite: bool = False, wait_for_fi
def __enter__(self):
return self

def __exit__(self, *args):
def __exit__(self, exc_type, exc_value, exc_tb):
if exc_type:
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
log.error(f'Job set-up failed with exception: {exc_type.__name__}({exc_value}) in File "{fname}", line {exc_tb.tb_lineno}.')
return True
self.run()

def can_skip(self):
Expand Down
Loading