Skip to content
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

adding ENERGY colvar #53

Open
invemichele opened this issue Aug 12, 2021 · 5 comments
Open

adding ENERGY colvar #53

invemichele opened this issue Aug 12, 2021 · 5 comments

Comments

@invemichele
Copy link

Hi,
is it possible to have the ENERGY collective variable implemented, so that it can be biased with plumed?
I would love to be able to run multithermal simulations with OPES and OpenMM, but for that I need to bias the potential energy.

From what I understand it might not be easy to do, because you need to calculate the total energy without the contribution of the PlumedForce. But I am quite new to OpenMM...

@peastman
Copy link
Member

The Plumed plugin can only apply biases based on CVs computed with Plumed. There might be another way of doing what you want though. I'm not familiar with that algorithm. Can you describe how it works?

@invemichele
Copy link
Author

It is a way of sampling an expanded ensemble made of a set of "overlapping" sub-ensembles, in a sense like replica exchange but based on an adaptive bias potential. The bias potential is a function of the difference in the Hamiltonians of the sub-ensembles (e.g. for multithermal ensembles the potential energy is needed) and depends on estimates of the free energy differences between the sub-ensembles. These estimates are based on a reweighting procedure and are updated on-the-fly during the simulation. (details in § IV here)

Since it is not possible to access the potential energy from PLUMED, I guess the only way to run my multithermal simulations with OPES would be to implement it directly in OpenMM. I might start by looking into the openmmtools.multistate.SAMSSampler class, which seems to me the closest one to what I want to do.

@raimis
Copy link

raimis commented Aug 30, 2021

Currently the ENERGY CV isn't supported. OpenMM computes the forces (and energies) concurrently, so the potential energy is not available for the individual force objects.

@peastman is it possible to get the potential energy in CudaCalcPlumedForceKernel::beginComputation?

void CudaCalcPlumedForceKernel::beginComputation(bool includeForces, bool includeEnergy, int groups) {
if ((groups&forceGroupFlag) == 0)
return;
contextImpl.getPositions(positions);
// The actual force computation will be done on a different thread.
cu.getWorkThread().addTask(new ExecuteTask(*this));
}

@peastman
Copy link
Member

It's not available yet then. beginComputation() is called by a ForcePreComputation which is executed right at the start of a force/energy computation, before anything else has been done. That's so we can get Plumed started right away and have it running in parallel while all the other forces are computed.

@GiovanniBussi
Copy link
Contributor

I noticed this issue linked from the plumed mailing list.

Gromacs has a similar issue. We solved it as follows:

  • start plumed computing its dependencies (without computing anything else)
  • check is energy is needed
  • if not do the full calculation immediately
  • if yes, postpone the plumed call to after energy (and forces) have been evaluated.

In this way, with gromacs you pay for the slow down only when you use the energy as a collective variable.

I am not sure this would be easy / feasible with openmm structure. In case I can help in sorting out the correct function call

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants