Skip to content
Merged
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 environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ dependencies:
# Control blas/openmp threads
- threadpoolctl
- pip:
- git+https://github.com/OpenFreeEnergy/gufe@v1.2.0
- git+https://github.com/OpenFreeEnergy/gufe@main
1 change: 1 addition & 0 deletions openfe/protocols/openmm_afe/equil_solvation_afe_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ class AbsoluteSolvationProtocol(gufe.Protocol):
:class:`openfe.protocols.openmm_afe.AbsoluteSolvationSolventUnit`
"""
result_cls = AbsoluteSolvationProtocolResult
_settings_cls = AbsoluteSolvationSettings
_settings: AbsoluteSolvationSettings

@classmethod
Expand Down
1 change: 1 addition & 0 deletions openfe/protocols/openmm_md/plain_md_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class PlainMDProtocol(gufe.Protocol):
:class:`openfe.protocols.openmm_md.PlainMDProtocolResult`
"""
result_cls = PlainMDProtocolResult
_settings_cls = PlainMDProtocolSettings
_settings: PlainMDProtocolSettings

@classmethod
Expand Down
1 change: 1 addition & 0 deletions openfe/protocols/openmm_rfe/equil_rfe_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ class RelativeHybridTopologyProtocol(gufe.Protocol):
:class:`openfe.protocols.openmm_rfe.RelativeHybridTopologyProtocolUnit`
"""
result_cls = RelativeHybridTopologyProtocolResult
_settings_cls = RelativeHybridTopologyProtocolSettings
_settings: RelativeHybridTopologyProtocolSettings

@classmethod
Expand Down
26 changes: 15 additions & 11 deletions openfecli/tests/commands/test_charge_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from openfecli.commands.generate_partial_charges import charge_molecules
from openff.toolkit import Molecule
from openff.units import unit
import logging
import numpy as np
from openff.utilities.testing import skip_if_missing

Expand Down Expand Up @@ -48,17 +49,16 @@ def test_write_charges_to_input(methane, tmpdir):
], catch_exceptions=False
)

def test_charge_molecules_default(methane, tmpdir):
def test_charge_molecules_default(methane, tmpdir, caplog):

runner = CliRunner()
mol_path = tmpdir / "methane.sdf"
methane.to_file(str(mol_path), "sdf")
output_file = str(tmpdir / "charged_methane.sdf")

caplog.set_level(logging.INFO)
with runner.isolated_filesystem():
# make sure the charges are picked up
with pytest.warns(match="Partial charges have been provided, these will "):
result = runner.invoke(
result = runner.invoke(
charge_molecules,
[
"-M",
Expand All @@ -69,6 +69,7 @@ def test_charge_molecules_default(methane, tmpdir):
)

assert result.exit_code == 0
assert "Partial charges are present for" in caplog.text
assert "Partial Charge Generation: am1bcc" in result.output
# make sure the charges have been saved
methane = SmallMoleculeComponent.from_sdf_file(filename=output_file)
Expand All @@ -80,7 +81,7 @@ def test_charge_molecules_default(methane, tmpdir):
pytest.param(False, [-1.0, 0.25, 0.25, 0.25, 0.25], id="Don't overwrite"),
pytest.param(True, [-0.1084, 0.0271, 0.0271, 0.0271, 0.0271], id="Overwrite")
])
def test_charge_molecules_overwrite(overwrite, tmpdir, methane_with_charges, expected_charges):
def test_charge_molecules_overwrite(overwrite, tmpdir, caplog, methane_with_charges, expected_charges):
runner = CliRunner()
mol_path = tmpdir / "methane.sdf"
methane_with_charges.to_file(str(mol_path), "sdf")
Expand All @@ -97,13 +98,14 @@ def test_charge_molecules_overwrite(overwrite, tmpdir, methane_with_charges, exp

with runner.isolated_filesystem():
# make sure the charges are picked up
with pytest.warns(match="Partial charges have been provided, these will "):
result = runner.invoke(
caplog.set_level(logging.INFO)
result = runner.invoke(
charge_molecules,
args,
)

assert result.exit_code == 0

assert "Partial charges are present for" in caplog.text
assert "Partial Charge Generation: am1bcc" in result.output
if overwrite:
assert "Overwriting partial charges" in result.output
Expand All @@ -120,7 +122,7 @@ def test_charge_molecules_overwrite(overwrite, tmpdir, methane_with_charges, exp
])
@skip_if_missing("openff.nagl")
@skip_if_missing("openff.nagl_models")
def test_charge_settings(methane, tmpdir, yaml_nagl_settings, ncores):
def test_charge_settings(methane, tmpdir, caplog, yaml_nagl_settings, ncores):
runner = CliRunner()
mol_path = tmpdir / "methane.sdf"
methane.to_file(str(mol_path), "sdf")
Expand All @@ -132,9 +134,9 @@ def test_charge_settings(methane, tmpdir, yaml_nagl_settings, ncores):
f.write(yaml_nagl_settings)

with runner.isolated_filesystem():
caplog.set_level(logging.INFO)
# make sure the charges are picked up
with pytest.warns(match="Partial charges have been provided, these will "):
result = runner.invoke(
result = runner.invoke(
charge_molecules,
[
"-M",
Expand All @@ -149,6 +151,8 @@ def test_charge_settings(methane, tmpdir, yaml_nagl_settings, ncores):
)

assert result.exit_code == 0

assert "Partial charges are present for" in caplog.text
assert "Partial Charge Generation: nagl" in result.output
# make sure the charges have been saved
methane = SmallMoleculeComponent.from_sdf_file(filename=output_file)
Expand Down
55 changes: 28 additions & 27 deletions openfecli/tests/test_rbfe_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from openfecli.commands.quickrun import quickrun
from openfecli.commands.gather import gather

from .utils import assert_click_success

@pytest.fixture
def tyk2_ligands():
Expand All @@ -32,24 +33,26 @@ def tyk2_protein():

@pytest.fixture
def expected_transformations():
return ['rbfe_lig_ejm_31_complex_lig_ejm_46_complex.json',
'rbfe_lig_ejm_31_complex_lig_ejm_47_complex.json',
'rbfe_lig_ejm_31_complex_lig_ejm_48_complex.json',
'rbfe_lig_ejm_31_complex_lig_ejm_50_complex.json',
'rbfe_lig_ejm_31_solvent_lig_ejm_46_solvent.json',
'rbfe_lig_ejm_31_solvent_lig_ejm_47_solvent.json',
'rbfe_lig_ejm_31_solvent_lig_ejm_48_solvent.json',
'rbfe_lig_ejm_31_solvent_lig_ejm_50_solvent.json',
'rbfe_lig_ejm_42_complex_lig_ejm_43_complex.json',
'rbfe_lig_ejm_42_complex_lig_ejm_50_complex.json',
'rbfe_lig_ejm_42_solvent_lig_ejm_43_solvent.json',
'rbfe_lig_ejm_42_solvent_lig_ejm_50_solvent.json',
'rbfe_lig_ejm_46_solvent_lig_jmc_23_solvent.json',
'rbfe_lig_ejm_46_complex_lig_jmc_23_complex.json',
'rbfe_lig_jmc_23_complex_lig_jmc_27_complex.json',
'rbfe_lig_jmc_23_solvent_lig_jmc_27_solvent.json',
'rbfe_lig_jmc_23_solvent_lig_jmc_28_solvent.json',
'rbfe_lig_jmc_23_complex_lig_jmc_28_complex.json']
return [
"rbfe_lig_ejm_31_solvent_lig_ejm_48_solvent.json",
"rbfe_lig_ejm_46_solvent_lig_jmc_28_solvent.json",
"rbfe_lig_jmc_27_complex_lig_jmc_28_complex.json",
"rbfe_lig_jmc_23_solvent_lig_jmc_28_solvent.json",
"rbfe_lig_ejm_42_solvent_lig_ejm_50_solvent.json",
"rbfe_lig_ejm_31_complex_lig_ejm_46_complex.json",
"rbfe_lig_ejm_31_solvent_lig_ejm_50_solvent.json",
"rbfe_lig_ejm_42_solvent_lig_ejm_43_solvent.json",
"rbfe_lig_ejm_31_complex_lig_ejm_47_complex.json",
"rbfe_lig_jmc_27_solvent_lig_jmc_28_solvent.json",
"rbfe_lig_jmc_23_complex_lig_jmc_28_complex.json",
"rbfe_lig_ejm_42_complex_lig_ejm_50_complex.json",
"rbfe_lig_ejm_31_solvent_lig_ejm_46_solvent.json",
"rbfe_lig_ejm_31_complex_lig_ejm_50_complex.json",
"rbfe_lig_ejm_42_complex_lig_ejm_43_complex.json",
"rbfe_lig_ejm_31_solvent_lig_ejm_47_solvent.json",
"rbfe_lig_ejm_31_complex_lig_ejm_48_complex.json",
"rbfe_lig_ejm_46_complex_lig_jmc_28_complex.json",
]


def test_plan_tyk2(tyk2_ligands, tyk2_protein, expected_transformations):
Expand All @@ -58,9 +61,7 @@ def test_plan_tyk2(tyk2_ligands, tyk2_protein, expected_transformations):
with runner.isolated_filesystem():
result = runner.invoke(plan_rbfe_network, ['-M', tyk2_ligands,
'-p', tyk2_protein])

assert result.exit_code == 0

assert_click_success(result)
assert path.exists('alchemicalNetwork/transformations')
for f in expected_transformations:
assert path.exists(
Expand Down Expand Up @@ -97,9 +98,9 @@ def ref_gather():
lig_ejm_31\tlig_ejm_50\t0.0\t0.0
lig_ejm_42\tlig_ejm_43\t0.0\t0.0
lig_ejm_42\tlig_ejm_50\t0.0\t0.0
lig_ejm_46\tlig_jmc_23\t0.0\t0.0
lig_jmc_23\tlig_jmc_27\t0.0\t0.0
lig_ejm_46\tlig_jmc_28\t0.0\t0.0
lig_jmc_23\tlig_jmc_28\t0.0\t0.0
lig_jmc_27\tlig_jmc_28\t0.0\t0.0
"""


Expand All @@ -110,14 +111,14 @@ def test_run_tyk2(tyk2_ligands, tyk2_protein, expected_transformations,
result = runner.invoke(plan_rbfe_network, ['-M', tyk2_ligands,
'-p', tyk2_protein])

assert result.exit_code == 0
assert_click_success(result)

for f in expected_transformations:
fn = path.join('alchemicalNetwork/transformations', f)
result2 = runner.invoke(quickrun, [fn])
assert result2.exit_code == 0
assert_click_success(result2)

gather_result = runner.invoke(gather, ["--report", "ddg", '.'])

assert gather_result.exit_code == 0
assert gather_result.stdout == ref_gather
assert_click_success(gather_result)
assert gather_result.stdout == ref_gather
Loading