Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
43d6007
Migrate validation to Protocol._validate
IAlibay Dec 5, 2025
2cd56ba
some fixes
IAlibay Dec 5, 2025
70e6d7a
Merge branch 'main' into validate-rfe
IAlibay Dec 5, 2025
f330562
move some things around
IAlibay Dec 8, 2025
95b92b3
Merge branch 'main' into validate-rfe
IAlibay Dec 15, 2025
1e0153e
add validate endstate tests
IAlibay Dec 15, 2025
fe2b879
Merge branch 'validate-rfe' of github.com:OpenFreeEnergy/openfe into …
IAlibay Dec 15, 2025
fbc4554
validate mapping tests
IAlibay Dec 15, 2025
c2f49d2
net charge validation tests
IAlibay Dec 15, 2025
c50f99c
more stuff
IAlibay Dec 22, 2025
9e0d29b
remove old tests
IAlibay Dec 24, 2025
2fe8ff9
make hybrid samplers not rely on htf
IAlibay Dec 24, 2025
4a0bd26
fix up test
IAlibay Dec 24, 2025
5848adc
fix up some slow tests
IAlibay Dec 24, 2025
1aaef87
Merge branch 'main' into multistate-nohtf
IAlibay Dec 24, 2025
b6d5ecd
Fix up the one test
IAlibay Dec 26, 2025
0605d11
fix a few things
IAlibay Dec 26, 2025
48106a2
fix the remaining tests
IAlibay Dec 26, 2025
5af66e8
cleanup imports
IAlibay Dec 26, 2025
ad0b5fb
Merge branch 'validate-rfe' into move-rfe-protocol
IAlibay Dec 26, 2025
45e004c
Merge branch 'multistate-nohtf' into move-rfe-protocol
IAlibay Dec 26, 2025
58dd71c
Migrate protocol, units, and results for the hybridtop protocol
IAlibay Dec 26, 2025
792996e
Add news item
IAlibay Dec 26, 2025
91f1788
Merge branch 'validate-rfe' into move-rfe-protocol
IAlibay Dec 26, 2025
527b870
Merge branch 'main' into validate-rfe
IAlibay Dec 26, 2025
7d17998
fix redefine
IAlibay Dec 27, 2025
43eb947
start modularising everything
IAlibay Dec 27, 2025
d1bd736
Add charge validation for smcs when dealing with ismorphic molecules
IAlibay Dec 27, 2025
51a6de1
break down the rfe units into bits
IAlibay Dec 29, 2025
6a5a76a
more broadly disallow oechem as a backend when creating systems
IAlibay Dec 29, 2025
cdd3da0
fix issue with nc being undefined
IAlibay Dec 29, 2025
e0a8e2a
Merge branch 'validate-rfe' into move-rfe-protocol
IAlibay Dec 29, 2025
a0ef737
Merge branch 'move-rfe-protocol' into breakdown-rfe-protocolunit
IAlibay Dec 29, 2025
b826803
Fix missing import
IAlibay Dec 29, 2025
42ddbcf
Merge branch 'move-rfe-protocol' into breakdown-rfe-protocolunit
IAlibay Dec 29, 2025
063e8ce
Fix comp getter
IAlibay Dec 29, 2025
3844bb5
Merge branch 'move-rfe-protocol' into breakdown-rfe-protocolunit
IAlibay Dec 29, 2025
a98c799
update module name
IAlibay Dec 30, 2025
5d0bc7e
Merge branch 'move-rfe-protocol' into breakdown-rfe-protocolunit
IAlibay Dec 30, 2025
7c915ed
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 3, 2026
951ac15
move a few things around to make life easier
IAlibay Jan 3, 2026
b9f8264
Merge branch 'main' into breakdown-rfe-protocolunit
IAlibay Jan 7, 2026
2e4b455
fix typo
IAlibay Jan 7, 2026
7182805
fix some merge issues
IAlibay Jan 7, 2026
28b4381
fix test failures due to integrator checks
IAlibay Jan 7, 2026
726f517
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 7, 2026
1587673
try to make mypy happy
IAlibay Jan 7, 2026
5cca950
Merge branch 'breakdown-rfe-protocolunit' of github.com:OpenFreeEnerg…
IAlibay Jan 7, 2026
1fbec7d
add early exist if there's no molecules
IAlibay Jan 7, 2026
3cd758e
Apply suggestions from code review
IAlibay Jan 7, 2026
6622428
Update openfe/protocols/openmm_rfe/hybridtop_units.py
IAlibay Jan 7, 2026
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
Prev Previous commit
Next Next commit
fix the remaining tests
  • Loading branch information
IAlibay committed Dec 26, 2025
commit 48106a297237fffb9e76ca16d2ed99a3d6834bac
10 changes: 6 additions & 4 deletions openfe/protocols/openmm_rfe/equil_rfe_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,15 +690,15 @@ def _validate_simulation_settings(
_ = settings_validation.divmod_time_and_check(
numerator=output_settings.positions_write_frequency,
denominator=simulation_settings.time_per_iteration,
numerator_name="output settings' position_write_frequency",
numerator_name="output settings' positions_write_frequency",
denominator_name="sampler settings' time_per_iteration",
)

if output_settings.velocities_write_frequency is not None:
_ = settings_validation.divmod_time_and_check(
numerator=output_settings.velocities_write_frequency,
denominator=simulation_settings.time_per_iteration,
numerator_name="output settings' velocity_write_frequency",
numerator_name="output settings' velocities_write_frequency",
denominator_name="sampler settings' time_per_iteration",
)

Expand Down Expand Up @@ -768,8 +768,10 @@ def _validate(
# PR #125 temporarily pin lambda schedule spacing to n_replicas
if self.settings.simulation_settings.n_replicas != self.settings.lambda_settings.lambda_windows:
errmsg = (
"Number of replicas in simulation_settings must equal "
"number of lambda windows in lambda_settings."
"Number of replicas in ``simulation_settings``: "
f"{self.settings.simulation_settings.n_replicas} must equal "
"the number of lambda windows in lambda_settings: "
f"{self.settings.lambda_settings.lambda_windows}."
)
raise ValueError(errmsg)

Expand Down
33 changes: 17 additions & 16 deletions openfe/protocols/openmm_utils/system_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,24 @@ def validate_solvent(state: ChemicalSystem, nonbonded_method: str):
`nocutoff`.
* If the SolventComponent solvent is not water.
"""
solv = [comp for comp in state.values() if isinstance(comp, SolventComponent)]
solv_comps = state.get_components_of_type(SolventComponent)

if len(solv) > 0 and nonbonded_method.lower() == "nocutoff":
errmsg = "nocutoff cannot be used for solvent transformations"
raise ValueError(errmsg)
if len(solv_comps) > 0:
if nonbonded_method.lower() == "nocutoff":
errmsg = "nocutoff cannot be used for solvent transformations"
raise ValueError(errmsg)

if len(solv) == 0 and nonbonded_method.lower() == "pme":
errmsg = "PME cannot be used for vacuum transform"
raise ValueError(errmsg)
if len(solv_comps) > 1:
errmsg = "Multiple SolventComponent found, only one is supported"
raise ValueError(errmsg)

if len(solv) > 1:
errmsg = "Multiple SolventComponent found, only one is supported"
raise ValueError(errmsg)

if len(solv) > 0 and solv[0].smiles != "O":
errmsg = "Non water solvent is not currently supported"
raise ValueError(errmsg)
if solv_comps[0].smiles != "O":
errmsg = "Non water solvent is not currently supported"
raise ValueError(errmsg)
else:
if nonbonded_method.lower() == "pme":
errmsg = "PME cannot be used for vacuum transform"
raise ValueError(errmsg)


def validate_protein(state: ChemicalSystem):
Expand All @@ -129,9 +130,9 @@ def validate_protein(state: ChemicalSystem):
ValueError
If there are multiple ProteinComponent in the ChemicalSystem.
"""
nprot = sum(1 for comp in state.values() if isinstance(comp, ProteinComponent))
prot_comps = state.get_components_of_type(ProteinComponent)

if nprot > 1:
if len(prot_comps) > 1:
errmsg = "Multiple ProteinComponent found, only one is supported"
raise ValueError(errmsg)

Expand Down
94 changes: 0 additions & 94 deletions openfe/tests/protocols/openmm_rfe/test_hybrid_top_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,63 +948,6 @@ def test_lambda_schedule(windows):
assert len(lambdas.lambda_schedule) == windows


def test_hightimestep(
benzene_vacuum_system,
toluene_vacuum_system,
benzene_to_toluene_mapping,
vac_settings,
tmpdir,
):
vac_settings.forcefield_settings.hydrogen_mass = 1.0

p = openmm_rfe.RelativeHybridTopologyProtocol(
settings=vac_settings,
)

dag = p.create(
stateA=benzene_vacuum_system,
stateB=toluene_vacuum_system,
mapping=benzene_to_toluene_mapping,
)
dag_unit = list(dag.protocol_units)[0]

errmsg = "too large for hydrogen mass"
with tmpdir.as_cwd():
with pytest.raises(ValueError, match=errmsg):
dag_unit.run(dry=True)


def test_element_change_warning(atom_mapping_basic_test_files):
# check a mapping with element change gets rejected early
l1 = atom_mapping_basic_test_files["2-methylnaphthalene"]
l2 = atom_mapping_basic_test_files["2-naftanol"]

# We use the 'old' lomap defaults because the
# basic test files inputs we use aren't fully aligned
mapper = setup.LomapAtomMapper(
time=20, threed=True, max3d=1000.0, element_change=True, seed="", shift=True
)

mapping = next(mapper.suggest_mappings(l1, l2))

sys1 = openfe.ChemicalSystem(
{"ligand": l1, "solvent": openfe.SolventComponent()},
)
sys2 = openfe.ChemicalSystem(
{"ligand": l2, "solvent": openfe.SolventComponent()},
)

p = openmm_rfe.RelativeHybridTopologyProtocol(
settings=openmm_rfe.RelativeHybridTopologyProtocol.default_settings(),
)
with pytest.warns(UserWarning, match="Element change"):
_ = p.create(
stateA=sys1,
stateB=sys2,
mapping=mapping,
)


def test_ligand_overlap_warning(
benzene_vacuum_system, toluene_vacuum_system, benzene_to_toluene_mapping, vac_settings, tmpdir
):
Expand Down Expand Up @@ -2023,40 +1966,3 @@ def test_dry_run_vacuum_write_frequency(
assert reporter.velocity_interval == velocities_write_frequency.m
else:
assert reporter.velocity_interval == 0


@pytest.mark.parametrize(
"positions_write_frequency,velocities_write_frequency",
[
[100.1 * unit.picosecond, 100 * unit.picosecond],
[100 * unit.picosecond, 100.1 * unit.picosecond],
],
)
def test_pos_write_frequency_not_divisible(
benzene_vacuum_system,
toluene_vacuum_system,
benzene_to_toluene_mapping,
positions_write_frequency,
velocities_write_frequency,
tmpdir,
vac_settings,
):
vac_settings.output_settings.positions_write_frequency = positions_write_frequency
vac_settings.output_settings.velocities_write_frequency = velocities_write_frequency

protocol = openmm_rfe.RelativeHybridTopologyProtocol(
settings=vac_settings,
)

# create DAG from protocol and take first (and only) work unit from within
dag = protocol.create(
stateA=benzene_vacuum_system,
stateB=toluene_vacuum_system,
mapping=benzene_to_toluene_mapping,
)
dag_unit = list(dag.protocol_units)[0]

with tmpdir.as_cwd():
errmsg = "The output settings' "
with pytest.raises(ValueError, match=errmsg):
dag_unit.run(dry=True)["debug"]["sampler"]
Loading
Loading