Skip to content

Commit

Permalink
Merge branch 'better-cp2k-kill' of github.com:exalearn/ExaMol into be…
Browse files Browse the repository at this point in the history
…tter-cp2k-kill
  • Loading branch information
WardLT committed Dec 28, 2023
2 parents 3938335 + 9854533 commit d319b9e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
2 changes: 1 addition & 1 deletion envs/environment-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dependencies:

# Temporary: Use a patched version of ASE
# Fixes a bug in Gaussian parsing and has support for new MOPAC
- git+https://gitlab.com/ase/ase.git
- git+https://gitlab.com/wardlt/ase.git@cp2k-context

# Need torch for BOTorch
- -e ..[botorch,test]
2 changes: 1 addition & 1 deletion examol/simulate/ase/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
&END QS
&SCF
&OUTER_SCF
MAX_SCF 5
MAX_SCF 3
&END OUTER_SCF
&OT T
PRECONDITIONER FULL_ALL
Expand Down
15 changes: 2 additions & 13 deletions examol/simulate/ase/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,8 @@ def make_ephemeral_calculator(calc: Calculator | dict) -> Iterator[Calculator]:
name = calc['name'].lower()
if name == 'cp2k':
from ase.calculators.cp2k import CP2K
calc = CP2K(*args, **kwargs)
yield calc

# Kill the calculator by deleting the object to stop the underlying
# shell and then set the `_shell` parameter of the object so that the
# calculator object's destructor will skip the shell shutdown process
# when the object is finally garbage collected
try:
calc._shell.__del__()
except AssertionError as e: # pragma: no-coverage
logger.warning(f'CP2K was noisy on failure: {e}')
pass
calc._shell = None
with CP2K(*args, **kwargs) as calc:
yield calc
elif name == 'gaussian':
from ase.calculators.gaussian import Gaussian
yield Gaussian(*args, **kwargs)
Expand Down

0 comments on commit d319b9e

Please sign in to comment.