In ASAP-Alchemy we are trying to add support for the NonEquilibriumCyclingProtocol which involves building a schema that inherits from NonEquilibriumCyclingSettings to store the settings used in a run for provenance. However we have found that it is not possible to round trip NonEquilibriumCyclingSettings to JSON due to the forcefield_settings type hint defined in the base gufe model here. See the example below, this can be fixed by updating the hint as is done in the RelativeHybridTopologyProtocolSettings.
import json
from gufe.tokenization import JSON_HANDLER
from feflow.protocols import NonEquilibriumCyclingProtocol
from feflow.settings import NonEquilibriumCyclingSettings
from openfe.protocols.openmm_rfe import RelativeHybridTopologyProtocol
from openfe.protocols.openmm_rfe import RelativeHybridTopologyProtocolSettings
# round trip the relative protocol
rel_settings = RelativeHybridTopologyProtocol.default_settings()
ref_json = json.dumps(rel_settings.dict(), cls=JSON_HANDLER.encoder)
# load a new settings from the JSON
rel_settings_2 = RelativeHybridTopologyProtocolSettings.parse_obj(json.loads(ref_json, cls=JSON_HANDLER.decoder))
assert rel_settings == rel_settings_2
# try with NEQ
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
pydantic.error_wrappers.ValidationError: 7 validation errors for NonEquilibriumCyclingSettings
forcefield_settings -> constraints
extra fields not permitted (type=value_error.extra)
forcefield_settings -> forcefields
extra fields not permitted (type=value_error.extra)
forcefield_settings -> hydrogen_mass
extra fields not permitted (type=value_error.extra)
forcefield_settings -> nonbonded_cutoff
extra fields not permitted (type=value_error.extra)
forcefield_settings -> nonbonded_method
extra fields not permitted (type=value_error.extra)
forcefield_settings -> rigid_water
extra fields not permitted (type=value_error.extra)
forcefield_settings -> small_molecule_forcefield
extra fields not permitted (type=value_error.extra)
In ASAP-Alchemy we are trying to add support for the
NonEquilibriumCyclingProtocol
which involves building a schema that inherits fromNonEquilibriumCyclingSettings
to store the settings used in a run for provenance. However we have found that it is not possible to round tripNonEquilibriumCyclingSettings
to JSON due to theforcefield_settings
type hint defined in the base gufe model here. See the example below, this can be fixed by updating the hint as is done in the RelativeHybridTopologyProtocolSettings.