Error in ExternalPerturbationLangevinIntegrator protocol_work handling
See original GitHub issueThe ExternalPerturbationLangevinIntegrator doesn’t handle the protocol work correctly for the first step because the first time add_integrator steps is called the “protocol_work” variable is still set to 0. https://github.com/choderalab/openmmtools/blob/master/openmmtools/integrators.py#L1547-L1551
Here’s a short code snippet that reproduces the error:
from simtk import unit, openmm
from openmmtools import testsystems
from openmmtools.integrators import ExternalPerturbationLangevinIntegrator
testsystem = testsystems.AlanineDipeptideVacuum()
temperature = 300.0*unit.kelvin
md_integrator = ExternalPerturbationLangevinIntegrator()
md_simulation = openmm.app.simulation.Simulation(topology=testsystem.topology, system=testsystem.system, integrator=md_integrator)
md_simulation.context.setPositions(testsystem.positions)
md_simulation.context.setVelocitiesToTemperature(temperature)
nstepsMD = 10
niter = 4
for iter in range(niter):
print('BEFORE step')
print('protocol_work', md_integrator.getGlobalVariableByName('protocol_work'))
md_simulation.step(nstepsMD)
print('AFTER')
print('protocol_work', md_integrator.getGlobalVariableByName('protocol_work'))
Output:
('BEFORE step')
('total', 0.0)
AFTER
('total', -88.08856348693371)
('BEFORE step')
('total', -88.08856348693371)
AFTER
('total', -88.08856348693371)
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Quantifying Configuration-Sampling Error in Langevin ... - NCBI
Finally, we show how this approach to quantifying sampling bias can be applied to a wide variety of stochastic integrators by following a...
Read more >An Investigation of New Methods for Numerical Stochastic ...
Numerical stochastic perturbation theory is a powerful tool for estimating high-order perturbative expansions in lattice field theory.
Read more >Comparison of Langevin integrators in terms of phase- ...
Here the differences between exact and discrete configurational measures are plotted above the contours of the phase space density, for four values of...
Read more >Temporal Integrators for Langevin Equations with ...
integrators for these equations which again employ our RFD method to efficiently handle the stochastic drift. This approach is agnostic to the choice...
Read more >Efficient molecular dynamics using geodesic integration and ...
We present an approach to Langevin dynamics in the presence of holonomic constraints based on decomposition of the system into components ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think it’s actually totally reasonable to discuss what the appropriate logical way for people to use these integrators should be, especially after getting some feedback from external users. If we want people to use these methods, find them convenient, and make few errors in doing so, ensuring we’ve presented them in the right way is not a waste of time.
NonequilibriumLangevinIntegrator
andExternalPerturbationLangevinIntegrator
. Both are nonequilibrium integrators, but they handle the Hamiltonian updates differently.ExternalPerturbationLangevinIntegrator
wrong in his talk today, so naming could clearly benefit from some refinementNonequilibriumIntegrator
also maintains encapsulation of the relevant code into separate function modules, and in fact would reduce code duplication. All one would need to do inupdateProtocolWork(context)
would be to addand make sure
measure_shadow_work
isTrue
.We can discuss more when I get back.
The updateProtocolWork method could work. I have no need for it, but if someone else wants to implement that, please go ahead. I’d prefer to keep the ExternalPerturbationLangevinIntegrator as a separate class though, so please DO NOT unify it with the NonEquilibriumLangevinIntegrator.
I don’t know why this keeps coming up in these discussions. All-in-one Integrators are not a useful concept, and we need to stop discussing that as an option already every time we need a new feature. We made it easy to subclass exactly because we don’t want complexity to sneak into the code. It’ll make it that much harder to optimize for people’s individual needs, and will complicate the base usage. Suddenly everyone would have to add things like wanting 0 switching steps for a NonEquilibrium trajectory where I’m not even looking to use Nonequilibrium. Just make a new subclass that has the new feature we need.