OpenFreeEnergy / gufe

grand unified free energy by OpenFE
https://gufe.readthedocs.io
MIT License
28 stars 8 forks source link

Settings could take string inputs for unit Quantities #253

Closed richardjgowers closed 6 months ago

richardjgowers commented 11 months ago

Currently to create a Settings object you need something like:

from openff.units import unit

openmm_rfe.equil_rfe_settings.SimulationSettings(equilibration_length=10 * unit.nanosecond, production_length=16 * unit.nanosecond)

It would be handy if this also worked:

openmm_rfe.equil_rfe_settings.SimulationSettings(equilibration_length='10 ns', production_length='16 ns')

Ideally this could be done with a validator through the pydantic tooling(?)

Somewhat related to the CLI tooling as it would make defining Quantity objects a lot easier in the yaml

richardjgowers commented 6 months ago

this works if the type annotation in the model is FloatQuantity['nanosecond'] or similar