-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Renaming and moving some of the protocol settings #689
Conversation
Hello @hannahbaumann! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2024-02-06 11:50:51 UTC |
steps_per_iteration = 250 * 4 fs | ||
--> The free energy would be analyzed every 250 ps (250 * 250 * 4 fs) | ||
""" | ||
early_termination_target_error: FloatQuantity = 0.0 * unit.boltzmann_constant * unit.kelvin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this unit correct or does it need to be changed? Should this be 0.0 * boltzmann_constant * temperature * unit.boltzmann_constant * unit.kelvin
? Not sure...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change this to unit kcal/mol
Simulation control settings, including simulation lengths and record-keeping. | ||
Simulation control settings, including simulation lengths. | ||
""" | ||
output_settings: OutputSettings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can probably wait, but this OutputSettings idea could percolate back to gufe where iirc there's a proto-Settings object which tries to define the pattern all should follow
Number of integration timesteps between each time the MCMC move | ||
is applied. Default 250 * unit.timestep. | ||
""" | ||
real_time_analysis_interval: Optional[int] = 250 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't unit.timestep
as it's a multiple of steps_per_iteration right? So the default is 250 * 250?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is answered in the docstring below >.<
steps_per_iteration = 250 * 4 fs | ||
--> The free energy would be analyzed every 250 ps (250 * 250 * 4 fs) | ||
""" | ||
early_termination_target_error: FloatQuantity = 0.0 * unit.boltzmann_constant * unit.kelvin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe can wait, but possibly making this Optional
is a better way to toggle the behaviour on/off, rather than using 0.0
@@ -134,62 +134,72 @@ class Config: | |||
or `independent` (independently sampled lambda windows). | |||
Default `repex`. | |||
""" | |||
online_analysis_interval: Optional[int] = 250 | |||
steps_per_iteration = 250 * unit.timestep # todo: IntQuantity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this, would it technically also be 250 * timestep * unit.timestep
? Or just make it an IntQuantity that has to be used together with timestep
to be a useful quantity?
""" | ||
Number of integration timesteps between each time the MCMC move | ||
is applied. Default 250 * unit.timestep. | ||
""" | ||
reassign_velocities = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potentially move to AlchemicalSamplerSettings
or change doc string to explain what move
means here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this for reassign_velocities
? seems like an integrator thing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reassign velocities is specific to the behaviour that exists when doing multi state moves, not the timestep integration itself, that makes it a property of the sampler not the integrator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Second half of review
openfe/protocols/openmm_afe/base.py
Outdated
@@ -234,10 +235,11 @@ def _handle_settings(self): | |||
* solvation_settings : SolvationSettings | |||
* alchemical_settings : AlchemicalSettings | |||
* lambda_settings : LambdaSettings | |||
* sampler_settings : AlchemicalSamplerSettings | |||
* sampler_settings : MultiStateSimulationSettings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove both sampler_settings and system_settings
openfe/protocols/openmm_afe/base.py
Outdated
|
||
Returns | ||
------- | ||
integrator : openmmtools.mcmc.LangevinDynamicsMove | ||
A configured integrator object. | ||
""" | ||
# TODO: Check this is correct | ||
tpi_fs = simulation_settings.time_per_iteration.to(unit.femtosecond).m |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be using whatever got added to openmm_utils?
from typing import ( | ||
Literal, | ||
Optional, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not seeing either of these being used in the diff?
@@ -71,3 +71,95 @@ def get_simsteps(sim_length: unit.Quantity, | |||
raise ValueError(errmsg) | |||
|
|||
return sim_steps | |||
|
|||
|
|||
def convert_steps_per_iteration( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going over the MD protocol - I'm probably missing something really obvious but isn't this method exactly the same as using get_simsteps
but with an MC value of 1 (like we do there)?
settings.vacuum_simulation_settings.equilibration_length = 10 * unit.picosecond | ||
settings.vacuum_simulation_settings.production_length = 1000 * unit.picosecond | ||
settings.vacuum_simulation_settings.production_length = 10 * unit.picosecond |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried this several times below 1 ns and it fails on the regular. It ends up wasting a lot more time re-running everything than just running the full nanosecond.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #689 +/- ##
==========================================
+ Coverage 91.36% 91.43% +0.07%
==========================================
Files 132 132
Lines 9174 9333 +159
==========================================
+ Hits 8382 8534 +152
- Misses 792 799 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the docs build is failing because of missing references to settings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of extra comments, none blocking.
Would be nice to think about moving non-unit conversions somewhere eventually - it's going to be necessary going forward to have a good place to do kt->kj->kcal->kt etc...
def must_be_positive(cls, v): | ||
if v <= 0: | ||
errmsg = f"protocol_repeats must be a positive value, got {v}." | ||
raise ValueError(errmsg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be worth a test to check that the validators kick in properly at this level?
integrator_settings: IntegratorSettings = protocol_settings.integrator_settings | ||
|
||
# is the timestep good for the mass? | ||
settings_validation.validate_timestep( | ||
forcefield_settings.hydrogen_mass, | ||
integrator_settings.timestep | ||
) | ||
# TODO: Also validate various conversions? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible, please raise an issue if there's a todo.
def must_be_positive_or_zero(cls, v): | ||
if v < 0: | ||
errmsg = ("collision_rate, and n_restart_attempts must be " | ||
"zero or positive values") | ||
errmsg = ("langevin_collision_rate, and n_restart_attempts must be" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I won't point to all the codecov stuff - but there's a lot of stuff that's not covered, worth raising an issue to make sure we test it all?
return rta_its, rta_min_its | ||
|
||
|
||
def convert_target_error_from_kcal_per_mole_to_kT( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not going to block here, but would it make sense rename this to be "convert_kcal_per_mole_to_kT" instead? Long term is might be good if we had a series of conversions somewhere else that we can use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
Developers certificate of origin