Skip to content

Commit

Permalink
Merge branch 'main' into multi_map
Browse files Browse the repository at this point in the history
  • Loading branch information
IAlibay authored Sep 24, 2024
2 parents 55b8765 + 75f966e commit cc8735c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions feflow/settings/nonequilibrium_cycling.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
OpenFFPartialChargeSettings,
)

from gufe.settings import Settings
from gufe.settings import Settings, OpenMMSystemGeneratorFFSettings
from pydantic.v1 import root_validator
from openfe.protocols.openmm_utils.omm_settings import (
OpenMMSolvationSettings,
Expand Down Expand Up @@ -58,7 +58,7 @@ class Config:
forcefield_cache: Optional[str] = (
"db.json" # TODO: Remove once it has been integrated with openfe settings
)

forcefield_settings: OpenMMSystemGeneratorFFSettings
# Solvation settings
solvation_settings: OpenMMSolvationSettings
partial_charge_settings: OpenFFPartialChargeSettings
Expand Down
17 changes: 17 additions & 0 deletions feflow/tests/test_nonequilibrium_cycling.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
import pytest

from feflow.protocols import NonEquilibriumCyclingProtocol
from feflow.settings import NonEquilibriumCyclingSettings
from gufe.protocols.protocoldag import ProtocolDAGResult, execute_DAG
from gufe.protocols.protocolunit import ProtocolUnitResult
from gufe.tokenization import JSON_HANDLER

import json


def partial_charges_config():
Expand Down Expand Up @@ -605,3 +609,16 @@ def _assign_random_partial_charges(offmol: Molecule, seed: int = 42):

# Finally check that the charges are as expected
_check_htf_charges(htf, benzene_orig_charges, toluene_orig_charges)


def test_settings_round_trip():
"""
Make sure we can round trip the settings class to and from json,
related to <https://github.com/OpenFreeEnergy/feflow/issues/87>.
"""
neq_settings = NonEquilibriumCyclingProtocol.default_settings()
neq_json = json.dumps(neq_settings.dict(), cls=JSON_HANDLER.encoder)
neq_settings_2 = NonEquilibriumCyclingSettings.parse_obj(
json.loads(neq_json, cls=JSON_HANDLER.decoder)
)
assert neq_settings == neq_settings_2

0 comments on commit cc8735c

Please sign in to comment.