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

HTF migration #24

Merged
merged 27 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6f7778c
WIP -- Starting HTF migration
ijpulidos Jan 22, 2024
a3be504
remove flatten torsions option
richardjgowers Feb 27, 2024
e604cb6
reinclude fix from openfe #675 (perses #1230)
richardjgowers Feb 27, 2024
352227e
HTF: simplify _add_nonbonded_force_terms
richardjgowers Feb 27, 2024
643b640
Merge pull request #26 from choderalab/htf-migration_openfe_patches
ijpulidos Feb 27, 2024
c0a12ef
port openfe version of LambdaProtocol into feflow
richardjgowers Feb 27, 2024
e57eaf4
fixup attempt to be clever...
richardjgowers Feb 27, 2024
c46b0ba
port tests from perses to feflow
richardjgowers Feb 27, 2024
f13f272
Merge pull request #28 from choderalab/include_LambdaProtocol
richardjgowers Feb 27, 2024
dfa67a9
Upgraded badges and acknowledgements
ijpulidos Feb 12, 2024
68a4dd0
Removing non-relevant tests (protein mut., REST, etc.). Style formatt…
ijpulidos Feb 27, 2024
7649d35
using gufe tests path fixture
ijpulidos Feb 27, 2024
70402ca
Comments on why lists objs are needed
ijpulidos Feb 27, 2024
2941436
Start of organized module for HTF testing -- WIP
ijpulidos Feb 27, 2024
819b8b4
Renaming to lambda_protocol.py
ijpulidos Feb 27, 2024
f1f3092
Ingesting tests/utils from perses
ijpulidos Feb 27, 2024
d247cb2
Need openeye for testing
ijpulidos Feb 27, 2024
bcfc3a8
old positions with old system. Fix callable.
ijpulidos Feb 29, 2024
b804428
Utility function to extract HTF data from perses top proposal
ijpulidos Feb 29, 2024
100e51c
Adapt HTF signature. Skipping difficult ones.
ijpulidos Feb 29, 2024
7d59d63
Need to pin minimum openfe version for CI
ijpulidos Feb 29, 2024
277a10d
Testing convergence difficult overlap
ijpulidos Feb 29, 2024
a1850b2
Modular testing. Software vs science test modules.
ijpulidos Feb 29, 2024
e78d16e
Skip hard to converge test.
ijpulidos Feb 29, 2024
a6d37ac
Fix proposal from perses obj
ijpulidos Feb 29, 2024
40486a2
fixup lambdaprotocol tests
richardjgowers Mar 5, 2024
f3fcf7a
Migrate tests for "new" HTF features (#32)
IAlibay Mar 8, 2024
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
11 changes: 10 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: "CI"
on:
pull_request:
branches:
- main
push:
branches:
- main
Expand Down Expand Up @@ -36,6 +35,8 @@ jobs:
include:
- os: "macos"
python-version: "3.11"
env:
OE_LICENSE: ${{ github.workspace }}/oe_license.txt

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -66,6 +67,14 @@ jobs:
micromamba info
micromamba list

- name: Decrypt OpenEye license
shell: bash -l {0}
env:
OE_LICENSE_TEXT: ${{ secrets.OE_LICENSE }}
run: |
echo "${OE_LICENSE_TEXT}" > ${OE_LICENSE}
python -c "import openeye; assert openeye.oechem.OEChemIsLicensed(), 'OpenEye license checks failed!'"

- name: "Run tests"
env:
# Set the OFE_SLOW_TESTS to True if running a Cron job
Expand Down
171 changes: 171 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
# custom ignores
.duecredit.p
.xxrun
.idea/
.vscode/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
*~

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
_version.py

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/
docs/reference/api/generated

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# vim
*.swp

# vscode
.vscode/

# Rever
rever/

9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
FE Flow
==============================
[//]: # (Badges)
[![GitHub Actions Build Status](https://github.com/REPLACE_WITH_OWNER_ACCOUNT/feflow/workflows/CI/badge.svg)](https://github.com/REPLACE_WITH_OWNER_ACCOUNT/feflow/actions?query=workflow%3ACI)
[![codecov](https://codecov.io/gh/REPLACE_WITH_OWNER_ACCOUNT/feflow/branch/main/graph/badge.svg)](https://codecov.io/gh/REPLACE_WITH_OWNER_ACCOUNT/feflow/branch/main)
[![GitHub Actions Build Status](https://github.com/choderalab/feflow/actions/workflows/ci.yaml/badge.svg)](https://github.com/choderalab/feflow/actions/workflows/ci.yaml)
[![codecov](https://codecov.io/gh/choderalab/feflow/branch/main/graph/badge.svg)](https://codecov.io/gh/choderalab/feflow/branch/main)


Recipes and protocols for molecular free energy calculations using the openmmtools/perses and Open Free Energy toolkits
Recipes, utilities, and protocols for molecular free energy calculations using the openmmtools/perses and Open Free Energy toolkits

### Copyright

Copyright (c) 2023, ChoderaLab


#### Acknowledgements

[Choderalab -- Perses](https://github.com/choderalab/perses)
[Open Free energy Consortium](https://openfree.energy/)
Project based on the
[Computational Molecular Science Python Cookiecutter](https://github.com/molssi/cookiecutter-cms) version 1.1.
6 changes: 5 additions & 1 deletion devtools/conda-envs/test_env.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
name: feflow-test
channels:
- conda-forge
- openeye
dependencies:
# Base depends
- gufe >=0.9.5
- numpy
- openfe # TODO: Remove once we don't depend on openfe
- openfe >=0.15 # TODO: Remove once we don't depend on openfe
- openff-units
- openmm
- pymbar <4
- pydantic=1 # TODO: Modify when we support pydantic 2
- python

# Testing
- openeye-toolkits
- openmoltools # TODO: Remove once we refactor tests
- perses # TODO: Remove once we don't depend on perses for tests
- pytest
- pytest-cov
- pytest-xdist
Expand Down
3 changes: 2 additions & 1 deletion feflow/protocols/nonequilibrium_cycling.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,12 @@ def _execute(self, ctx, *, state_a, state_b, mapping, settings, **inputs):
"""
# needed imports
import openmm
import numpy as np
from openff.units.openmm import ensure_quantity
from openmmtools.integrators import PeriodicNonequilibriumIntegrator
from gufe.components import SmallMoleculeComponent
from openfe.protocols.openmm_rfe import _rfe_utils
from feflow.utils.hybrid_topology import HybridTopologyFactoryModded as HybridTopologyFactory
from feflow.utils.hybrid_topology import HybridTopologyFactory

# Check compatibility between states (same receptor and solvent)
self._check_states_compatibility(state_a, state_b)
Expand Down
18 changes: 12 additions & 6 deletions feflow/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@
from gufe.mapping import LigandAtomMapping


@pytest.fixture
def benzene_modifications():
source = files("gufe.tests.data").joinpath("benzene_modifications.sdf")
@pytest.fixture(scope='session')
def gufe_data_dir():
path = files("gufe.tests.data")
return path


@pytest.fixture(scope='session')
def benzene_modifications(gufe_data_dir):
source = gufe_data_dir.joinpath("benzene_modifications.sdf")
with as_file(source) as f:
supp = Chem.SDMolSupplier(str(f), removeHs=False)
mols = list(supp)
Expand All @@ -23,12 +29,12 @@ def solvent_comp():
yield gufe.SolventComponent(positive_ion="Na", negative_ion="Cl")


@pytest.fixture
@pytest.fixture(scope='session')
def benzene(benzene_modifications):
return gufe.SmallMoleculeComponent(benzene_modifications["benzene"])


@pytest.fixture
@pytest.fixture(scope='session')
def toluene(benzene_modifications):
return gufe.SmallMoleculeComponent(benzene_modifications["toluene"])

Expand Down Expand Up @@ -130,7 +136,7 @@ def production_settings(short_settings):

# Mappings fixtures

@pytest.fixture
@pytest.fixture(scope='session')
def mapping_benzene_toluene(benzene, toluene):
"""Mapping from toluene to benzene"""
mapping_toluene_to_benzene = {0: 4, 1: 5, 2: 6, 3: 7, 4: 8, 5: 9, 6: 10, 7: 11, 8: 12, 9: 13, 11: 14}
Expand Down
Loading
Loading