Skip to content

Commit

Permalink
Add gaussian quadrature test (#87)
Browse files Browse the repository at this point in the history
* Add files via upload

Add an Amber gaussian quadrature test

* Add files via upload

correct a mistake in rst file

* Add files via upload

* Add files via upload

* Add files via upload

Add a testset for multi-lambda simulations with gromacs

* Add files via upload

add test for new dataset

* Add files via upload

new test

* Delete src/alchemtest/gmx/ethanol directory

* Add files via upload

new test

* Add files via upload

test

---------

Co-authored-by: Zhiyi Wu <[email protected]>
  • Loading branch information
hl2500 and xiki-tempula authored Jul 8, 2023
1 parent 897218d commit 4620f2a
Show file tree
Hide file tree
Showing 59 changed files with 145 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/alchemtest/amber/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from .access import load_bace_improper
from .access import load_bace_example
from .access import load_tyk2_example
from .access import load_simplesolvated
from .access import load_invalidfiles
from .access import load_testfiles
21 changes: 21 additions & 0 deletions src/alchemtest/amber/access.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,27 @@ def load_bace_example():
return Bunch(data=data,
DESCR=fdescr)

def load_tyk2_example():
"""Load Amber TYK2 example perturbation.
Returns
-------
data: Bunch
Dictionary-like object, the interesting attributes are:
- 'data' : the data files by system and alchemical leg
"""
module_path = Path(__file__).parent
data = {'complex': list(map(str, module_path.glob('tyk2_ejm_47~ejm_31/complex/*/ti-*.out.bz2'))),
'solvated': list(map(str, module_path.glob('tyk2_ejm_47~ejm_31/solvated/*/ti-*.out.bz2')))
}

with open(module_path / 'tyk2_ejm_47~ejm_31' / 'descr.rst') as rst_file:
fdescr = rst_file.read()

return Bunch(data=data,
DESCR=fdescr)

def load_simplesolvated():
"""Load the Amber solvated dataset.
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
43 changes: 43 additions & 0 deletions src/alchemtest/amber/tyk2_ejm_47~ejm_31/descr.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Amber: Small molecule thermodynamic integration free energy difference in water
===============================================================================

TYK2 complex and solvated small molecule perturbation, alchemical perturbation of ligand 1 into ligand
2. This example uses ligands ejm_47 to ejm_31 from [Wang2015a]_.


Notes
-----
Data Set Characteristics:
:Number of Legs: 1 (1 step concerted)
:Number of Windows: 12 for each leg
:Length of Windows: 5ns
:System Size: 24229 atoms (complex), 9932 atoms (solvated)
:Temperature: 300 K
:Pressure: 1 bar
:Alchemical Pathway: ligand 1 --> ligand 2,
smoothstep softcore (SSC) potential [Lee2020a]_
used in both complex and solvated legs
:Experimental Free Energy difference: 0.16 kcal/mol
:Missing Values: None
:Energy unit: kcal/mol
:Time unit: ps
:Date: March 2023
:License: `CC0 <https://creativecommons.org/publicdomain/zero/1.0/>`_
Public Domain Dedication

This dataset was generated using the `Amber <http://www.ambermd.org/>`_
molecular dynamics engine.


.. [Wang2015a] L. Wang, Y. Wu, Y. Deng, B. Kim, L. Pierce, G. Krilov, D. Lupyan, S. Robinson, M. K. Dahlgren, J. Greenwood, D. L. Romero, C. Masse, J. L. Knight, T. Steinbrecher, T. Beuming, W. Damm, E. Harder, W. Sherman, M. Brewer, R. Wester, M. Murcko, L. Frye, R. Farid, T. Lin, D. L. Mobley, W. L. Jorgensen, B. J. Berne, R. A. Friesner,
and R. Abel. Accurate and reliable prediction of
relative ligand binding potency in prospective drug
discovery by way of a modern free-energy calculation
protocol and force field. Journal of the American
Chemical Society,
137(7):2695–2703, 2015. PMID: 25625324. DOI:
`10.1021/ja512751q <https://doi.org/10.1021/ja512751q>`_.
.. [Lee2020a] T.-S. Lee, Z. Lin, B. K. Allen, C. Lin, B. K. Radak, Y. Tao, H.-C. Tsai, W. Sherman and D. M. York. Improved Alchemical Free Energy Calculations with Optimized Smoothstep Softcore Potentials. Journal of Chemical Theory and Computation,
16(9):5512–5525, 2020. PMID: 32672455. DOI:
`10.1021/acs.jctc.0c00237 <https://doi.org/10.1021/acs.jctc.0c00237>`_.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion src/alchemtest/gmx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

from .access import load_benzene
from .access import (load_benzene, load_ABFE,
from .access import (load_benzene, load_ethanol, load_ABFE,
load_expanded_ensemble_case_1,
load_expanded_ensemble_case_2,
load_expanded_ensemble_case_3,
Expand Down
24 changes: 24 additions & 0 deletions src/alchemtest/gmx/access.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,30 @@ def load_benzene():
return Bunch(data=data,
DESCR=fdescr)

def load_ethanol():
"""Load the Gromacs ethanol dataset.
Returns
-------
data : Bunch
Dictionary-like object, the interesting attributes are:
- 'data' : the data files by alchemical leg
- 'DESCR': the full description of the dataset
"""

module_path = dirname(__file__)

data = {'Coulomb': sorted(glob(join(module_path, 'ethanol', 'Coulomb', 'dhdl.*.xvg.bz2'))),
'VDW': sorted(glob(join(module_path, 'ethanol', 'VDW', 'dhdl.*.xvg.bz2')))}

with open(join(module_path, 'ethanol', 'descr.rst')) as rst_file:
fdescr = rst_file.read()

return Bunch(data=data,
DESCR=fdescr)

def load_ABFE():
"""Load the Gromacs ABFE dataset.
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added src/alchemtest/gmx/ethanol/VDW/dhdl.1.xvg.bz2
Binary file not shown.
Binary file added src/alchemtest/gmx/ethanol/VDW/dhdl.10.xvg.bz2
Binary file not shown.
Binary file added src/alchemtest/gmx/ethanol/VDW/dhdl.11.xvg.bz2
Binary file not shown.
Binary file added src/alchemtest/gmx/ethanol/VDW/dhdl.12.xvg.bz2
Binary file not shown.
Binary file added src/alchemtest/gmx/ethanol/VDW/dhdl.13.xvg.bz2
Binary file not shown.
Binary file added src/alchemtest/gmx/ethanol/VDW/dhdl.2.xvg.bz2
Binary file not shown.
Binary file added src/alchemtest/gmx/ethanol/VDW/dhdl.3.xvg.bz2
Binary file not shown.
Binary file added src/alchemtest/gmx/ethanol/VDW/dhdl.4.xvg.bz2
Binary file not shown.
Binary file added src/alchemtest/gmx/ethanol/VDW/dhdl.5.xvg.bz2
Binary file not shown.
Binary file added src/alchemtest/gmx/ethanol/VDW/dhdl.6.xvg.bz2
Binary file not shown.
Binary file added src/alchemtest/gmx/ethanol/VDW/dhdl.7.xvg.bz2
Binary file not shown.
Binary file added src/alchemtest/gmx/ethanol/VDW/dhdl.8.xvg.bz2
Binary file not shown.
Binary file added src/alchemtest/gmx/ethanol/VDW/dhdl.9.xvg.bz2
Binary file not shown.
32 changes: 32 additions & 0 deletions src/alchemtest/gmx/ethanol/descr.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Gromacs: Ethanol in water
=========================

Ethanol in water, alchemically turned into ethanol in vacuum separated from water

Notes
-----
Data Set Characteristics:
:Number of Legs: 2 (Coulomb, VDW)
:Number of Windows: 14 for Coulomb, 13 for VDW
:Length of Windows: 6ns
:System Size: 2694 atoms
:Temperature: 300 K
:Pressure: 1 bar
:Alchemical Pathway: vdw + coul --> vdw --> vacuum
:Experimental Hydration Free Energy: -5.00 +- 0.6 kcal/mol
:Missing Values: None
:Energy unit: kJ/mol
:Time unit: ps
:Date: April 2023
:License: `CC0
<https://creativecommons.org/publicdomain/zero/1.0/>`_
Public Domain Dedication

This dataset was generated using input files from `GROMACS 4.6 example: Direct ethanol solvation free energy <http://www.alchemistry.org/wiki/GROMACS_4.6_example:_Direct_ethanol_solvation_free_energy>`_, with
the `Gromacs <http://www.gromacs.org/>`_ molecular dynamics engine.

Experimental value sourced from [Mobley2013]_.

.. [Mobley2013] Mobley, David L. (2013). Experimental and Calculated Small
Molecule Hydration Free Energies. UC Irvine: Department of Pharmaceutical
Sciences, UCI. Retrieved from: http://escholarship.org/uc/item/6sd403pz
22 changes: 21 additions & 1 deletion src/alchemtest/tests/test_amber.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from alchemtest import Bunch
from alchemtest.amber import (load_bace_improper, load_bace_example,
load_simplesolvated, load_invalidfiles,
load_testfiles, )
load_testfiles, load_tyk2_example)



Expand Down Expand Up @@ -67,6 +67,26 @@ def dataset(self, request):
return super(TestBACEexample, self).dataset(request)


# test tyk2 example
def _load_tyk2_example():
dset = load_tyk2_example()
return Bunch(data=dset.data,
DESCR="TYK2 example:")

class TestTYK2example(BaseDatasetTest):
# use pytest.param to add the id for nicer pytest -v output
@pytest.fixture(scope="class",
params = [
pytest.param(
(_load_tyk2_example,
('complex', 'solvated'),
(12, 12)),
id="tyk2"),
])
def dataset(self, request):
return super(TestTYK2example, self).dataset(request)


# The invalidfiles dataset does not conform to the API. load_invalidfiles()
# returns a listv with just one element as data (and not a dict) so we create a
# fake dataset:
Expand Down
3 changes: 2 additions & 1 deletion src/alchemtest/tests/test_gmx.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'''Tests for all the gromacs dataset'''
import pytest

from alchemtest.gmx import (load_benzene, load_ABFE,
from alchemtest.gmx import (load_benzene, load_ABFE, load_ethanol,
load_expanded_ensemble_case_1,
load_expanded_ensemble_case_2,
load_expanded_ensemble_case_3,
Expand All @@ -17,6 +17,7 @@ class TestGROMACS(BaseDatasetTest):
@pytest.fixture(scope="class",
params = [(load_benzene, ('Coulomb', 'VDW'), (5, 16)),
(load_ABFE, ('complex', 'ligand'), (30, 20)),
(load_ethanol, ('Coulomb', 'VDW'), (14, 13)),
(load_expanded_ensemble_case_1, ('AllStates', ), (1,)),
(load_expanded_ensemble_case_2, ('AllStates', ), (2,)),
(load_expanded_ensemble_case_3, ('AllStates', ), (32,)),
Expand Down

0 comments on commit 4620f2a

Please sign in to comment.