Skip to content
Draft
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
2 changes: 1 addition & 1 deletion .github/workflows/rc-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ defaults:
jobs:
tests:
runs-on: ${{ matrix.os }}-latest
name: "💻-${{matrix.os }} 🐍-${{ matrix.python-version }}"
name: "💻-${{matrix.os }} 🐍-${{ matrix.python-version }} OpenFE RC"
strategy:
fail-fast: false
matrix:
Expand Down
20 changes: 16 additions & 4 deletions feflow/protocols/nonequilibrium_cycling.py
Original file line number Diff line number Diff line change
Expand Up @@ -913,15 +913,27 @@ def _create(
self,
stateA: ChemicalSystem,
stateB: ChemicalSystem,
mapping: Optional[dict[str, ComponentMapping]] = None,
mapping: Optional[ComponentMapping],
extends: Optional[ProtocolDAGResult] = None,
) -> list[ProtocolUnit]:
# Handle parameters
if mapping is None:
raise ValueError("`mapping` is required for this Protocol")
from feflow.utils import system_validation

# TODO: enable extending https://github.com/choderalab/feflow/pull/44
if extends:
raise NotImplementedError("Can't extend simulations yet")

# TODO: Validate mapping -- comps gufe keys are the same
system_validation.validate_mappings(stateA, stateB, mapping)

# Validate alchemical components
alchem_comps = system_validation.get_alchemical_components(stateA, stateB)
system_validation.validate_alchemical_components(alchem_comps, mapping)

# Validate protein and solvent components
system_validation.validate_protein(stateA)
nonbonded = self.settings.forcefield_settings.nonbonded_method
system_validation.validate_solvent(stateA, nonbonded)

# inputs to `ProtocolUnit.__init__` should either be `Gufe` objects
# or JSON-serializable objects
num_cycles = self.settings.num_cycles
Expand Down
31 changes: 31 additions & 0 deletions feflow/utils/system_validation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""
Utility functions that can help validating chemical systems and its components such that they
make sense for protocols to use.
"""

# TODO: Migrate utility functions from openfe to this module
from openfe.protocols.openmm_utils.system_validation import (
get_alchemical_components as _ofe_get_alchemical_components,
)
from openfe.protocols.openmm_utils.system_validation import (
validate_solvent as _ofe_validate_solvent,
)
from openfe.protocols.openmm_utils.system_validation import (
validate_protein as _ofe_validate_protein,
)
from openfe.protocols.openmm_rfe.equil_rfe_methods import (
_validate_alchemical_components,
)

get_alchemical_components = _ofe_get_alchemical_components
validate_solvent = _ofe_validate_solvent
validate_protein = _ofe_validate_protein
validate_alchemical_components = _validate_alchemical_components


# TODO: Implement function to validate mappings -- comps are the same gufe key compared to state
def validate_mappings(state_a, state_b, mapping):
"""
Validate that the components in the states and the mapping are the correct ones.
"""
raise NotImplementedError("Function not implemented.")