From b55951485588233f0c2cf95fa52503cec572662d Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Tue, 9 Jan 2024 09:26:02 +0000 Subject: [PATCH 1/4] Add emle-sire instructions and environment file. --- README.md | 24 ++++++++++++++++++++++++ environment_sire.yaml | 22 ++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 environment_sire.yaml diff --git a/README.md b/README.md index faed8f4..e40e398 100644 --- a/README.md +++ b/README.md @@ -306,6 +306,30 @@ similar to that shown below. The columns specify the current step, the current 50 1.000000000000 -495.725952148438 -0.020683377981 -495.725952148438 ``` +## OpenMM integration + +We provide an interface between `emle-engine` and [OpenMM](https://openmm.org) via the +[Sire](https://sire.openbiosim.org/) molecular simulation framework. This allows QM/MM simulations +to be run with OpenMM using EMLE for the embedding model. This provides improved +performance and flexibility in comparison to the `sander` interface, although +the implementation should currently be treated as being _experimental_. + +To use, first create an `emle-sire` conda environment: + +```sh +conda env create -f environment_sire.yaml +conda activate emle-sire +``` + +Next install `emle-engine` into the environment: + +```sh +python setup.py install +``` + +For instructions on how to use the `emle-sire` interface, see the tutorial +documentation [here](https://github.com/OpenBioSim/sire/blob/feature_emle/doc/source/tutorial/part07/01_qmmm.rst) + ## Issues The [DeePMD-kit](https://docs.deepmodeling.com/projects/deepmd/en/master/index.html) conda package pulls in a version of MPI which may cause diff --git a/environment_sire.yaml b/environment_sire.yaml new file mode 100644 index 0000000..9da87cb --- /dev/null +++ b/environment_sire.yaml @@ -0,0 +1,22 @@ +name: emle-sire + +channels: + - conda-forge + - openbiosim/label/emle + +dependencies: + - ambertools + - ase + - compilers + - deepmd-kit + - eigen + - openmm >= 8.1 + - pip + - pybind11 + - pytorch + - python < 3.11 + - sire + - torchani + - xtb-python + - pip: + - git+https://github.com/lab-cosmo/librascal.git From 36fd7d282b694fca950747ddcff0cfebd8e63eda Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Thu, 11 Jan 2024 11:30:27 +0000 Subject: [PATCH 2/4] Move EMLECalculator class into calculator.py module. --- MANIFEST.in | 2 +- bin/emle-server | 8 ++++---- emle/{emle.py => calculator.py} | 0 3 files changed, 5 insertions(+), 5 deletions(-) rename emle/{emle.py => calculator.py} (100%) diff --git a/MANIFEST.in b/MANIFEST.in index d618259..2a9f595 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1 @@ -include mlmm/*.mat +include emle/*.mat diff --git a/bin/emle-server b/bin/emle-server index 4d04c73..0353668 100755 --- a/bin/emle-server +++ b/bin/emle-server @@ -518,11 +518,11 @@ except: # Import the EMLE calculator here so that we avoid the import overhead when the # script is called to check if an existing server is running, e.g. when called # as a background process by the orca executable. -from emle.emle import EMLECalculator +from emle.calculator import EMLECalculator # Initialise the EMLE calculator. print("Initialising EMLE calculator...") -mle_calculator = EMLECalculator(**args) +emle_calculator = EMLECalculator(**args) while True: print("Waiting for a connection...") @@ -535,7 +535,7 @@ while True: # Try to run the EMLE calculation. print("Running EMLE calculation...") try: - mle_calculator.run(path=path) + emle_calculator.run(path=path) msg = "7:emlefin" print("Finished!") except Exception as e: @@ -549,7 +549,7 @@ while True: # Try to update the interpolation lambda parameter. print("Updating interpolation lambda...") try: - mle_calculator.set_lambda_interpolate(float(path)) + emle_calculator.set_lambda_interpolate(float(path)) msg = "13:emlelambdaset" print("Lambda set!") except Exception as e: diff --git a/emle/emle.py b/emle/calculator.py similarity index 100% rename from emle/emle.py rename to emle/calculator.py From 728cc6ebfa29a15c1d8c59f30e3839c441e790b5 Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Thu, 11 Jan 2024 11:34:53 +0000 Subject: [PATCH 3/4] Formatting tweak. [ci skip] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e40e398..eca4dcd 100644 --- a/README.md +++ b/README.md @@ -328,7 +328,7 @@ python setup.py install ``` For instructions on how to use the `emle-sire` interface, see the tutorial -documentation [here](https://github.com/OpenBioSim/sire/blob/feature_emle/doc/source/tutorial/part07/01_qmmm.rst) +documentation [here](https://github.com/OpenBioSim/sire/blob/feature_emle/doc/source/tutorial/part07/01_qmmm.rst). ## Issues From 4d4a2399d7691cb29e0fc54a063a745aadbd4a5b Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Thu, 11 Jan 2024 11:40:14 +0000 Subject: [PATCH 4/4] Fix import. --- emle/sander_calculator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emle/sander_calculator.py b/emle/sander_calculator.py index 3d0eab9..c30399f 100644 --- a/emle/sander_calculator.py +++ b/emle/sander_calculator.py @@ -87,7 +87,7 @@ def calculate( # Update the positions. sander.set_positions(positions) - from .emle import KCAL_MOL_TO_HARTREE, BOHR_TO_ANGSTROM + from .calculator import KCAL_MOL_TO_HARTREE, BOHR_TO_ANGSTROM # Compute the energy and forces. energy, forces = sander.energy_forces()