VES module: multiple calculations in a single time step

89 views
Skip to first unread message

steven.va...@ugent.be

unread,
Jul 16, 2019, 8:30:12 AM7/16/19
to PLUMED users
Hello,

I am trying to couple PLUMED to our in-house code, and mostly things are working fine. I however stumbled upon the following problem when doing multiple force calculations during a single time step using VES.

Our barostat requires that forces are evaluated three times during a single time step. To me, it seems logical that the bias potential needs to be calculated at every force calculation, but that algorithms such as umbrella sampling or VES should only take the configuration at the end of the time step into account. Schematically, my approach looked like this:

# start timestep
PLUMED command: "setTimeStep"
update pos/cell
calculate forces: PLUMED commands "prepareCalc" and "performCalcNoUpdate"
update pos/cell
calculate forces: PLUMED commands "prepareCalc" and "performCalcNoUpdate"
update pos/cell
calculate forces: PLUMED commands "prepareCalc", "performCalcNoUpdate" and "update"
# end timestep

It seems however that even when the "performCalcNoUpdate" command is issued, the current state of the system is stored by VES and used when updating the VES expansion coefficients. To show this, I constructed a MWE. It is just a single atom moving on a harmonic potential, so you only need the PLUMED Python interface in order to run it.
What I see is that the VES output is different when PLUMED calculates the bias twice (two times for the same configuration) in a single time step, from the VES output when PLUMED calculates the bias only once. You can trigger the different behavior by commenting out line 69 of the attached python script.

Does anybody know why this is happening? In short, I would like to be able to compute the bias multiple times, but only affect the VES algorithm every few calculations.

I am using PLUMED version 2.5.1

Thanks,

Steven Vandenbrande
nve_harmonic_oscillator.py
plumed.dat

Giovanni Bussi

unread,
Jul 16, 2019, 8:33:23 AM7/16/19
to plumed...@googlegroups.com
Hi,

as a double check, if you run METAD do things behave correctly? I mean: do you get Gaussians added only once per step (assuming PACE=1)?

Giovanni

--
You received this message because you are subscribed to the Google Groups "PLUMED users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plumed-users...@googlegroups.com.
To post to this group, send email to plumed...@googlegroups.com.
Visit this group at https://groups.google.com/group/plumed-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/plumed-users/b9ceedc0-6ac2-4e3e-8922-7288137a5d64%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

steven.va...@ugent.be

unread,
Jul 16, 2019, 8:49:22 AM7/16/19
to PLUMED users
Hello Giovanni,

Yes. When performing metadynamics the output is exactly the same, irrespective of whether forces are calculated once or twice.

However, it could be that even in metadynamics, every force calculation is taken into account by the sampling algorithm.
For the example I posted, the CV is calculated twice for exactly the same configuration. So if you only need the average of the CV during the past steps, this is still independent of how many times you calculate it each step.

I am not entirely sure why this reasoning is not valid for VES, perhaps of the specific way averages and covariances are computed?

Steven
To unsubscribe from this group and stop receiving emails from it, send an email to plumed...@googlegroups.com.
plumed_metad.dat
nve_harmonic_oscillator.py

Gareth Tribello

unread,
Jul 16, 2019, 9:07:16 AM7/16/19
to plumed...@googlegroups.com
Hello

I think I know the answer to this.  I discussed it with Omar at some stage so he will probably step in to correct the things that I am saying that are potentially wrong.  Here goes though:

So for metadynamics calculate (which is called when you do performCalculateNoUpdate) calculates the bias and update (which is called when you call update) updates the bias - i.e. this action adds the Gaussian.

Within VES, however, Omar coded it so that calculate does some updating of the bias.  The reason being that if it were done in the metadynamics way you would have to do some expensive calculation twice during every MD step (once when calculate is called and once when update is called.)

This perhaps hasn’t caused any big problems thus far because no one has tried VES with a multiple tilmestep algorithm or with parallel tempering.  I think it is something that Omar is aware of and that he is planning to fix.

I hope this helps
Gareth



To unsubscribe from this group and stop receiving emails from it, send an email to plumed-users...@googlegroups.com.

To post to this group, send email to plumed...@googlegroups.com.
Visit this group at https://groups.google.com/group/plumed-users.

For more options, visit https://groups.google.com/d/optout.
<plumed_metad.dat><nve_harmonic_oscillator.py>

Giovanni Bussi

unread,
Jul 16, 2019, 10:21:02 AM7/16/19
to plumed...@googlegroups.com
It might be that VES does not do the update of parameters in the update() virtual function, I think Omar is the one that knows the answer

To unsubscribe from this group and stop receiving emails from it, send an email to plumed-users...@googlegroups.com.

To post to this group, send email to plumed...@googlegroups.com.
Visit this group at https://groups.google.com/group/plumed-users.

For more options, visit https://groups.google.com/d/optout.
--
Sent from Gmail mobile

Omar Valsson

unread,
Jul 16, 2019, 12:05:58 PM7/16/19
to Giovanni Bussi, plumed...@googlegroups.com
Hello Steven, 

Yes, indeed the reason is the one that Gareth and Giovanni have discussed. The value needed for the averages and covariances are computed and accumulated in calculate(), not in update(). [However, the update of the bias which is done every 1000 MD steps or so is indeed done in update()]. I did this like this as at the time I did not see a way to do this differently without doing the calculation of the bias and values needed for the averages twice. 

I have to admit that I was aware of this issue but because I hadn’t personally come across a case where this was a major issue it didn’t bother me that much. However, I also had a recent case where this was indeed an issue, but I didn’t have time to fix this in a way that I am very happy with. Anyway, this needs to be fixed so I will start to look into this as soon as possible. I will let you know once this issue has been fixed. 

I am sorry about this. 

Best regards,
Omar 

steven.va...@ugent.be

unread,
Jul 17, 2019, 5:53:37 AM7/17/19
to PLUMED users
Hello Omar,

Thanks for your response, this clears things up.

I do know that in the i-PI code, the same approach is used: "performCalcNoUpdate" is called for force calculations, while the "update" command is only issued on completion of a time step. I am not sure whether anyone has already used i-PI in combination with VES however.

Is the computational burden of calculating the bias twice really too high, or is more a matter of avoiding redundant code? I would guess that for many realistic systems most computational time is spent in calculating other parts of the PES anyways, but my experience with VES simulations is very limited.

Steven
--
Sent from Gmail mobile
--
You received this message because you are subscribed to the Google Groups "PLUMED users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plumed...@googlegroups.com.
To post to this group, send email to plumed...@googlegroups.com.
Visit this group at https://groups.google.com/group/plumed-users.

Omar Valsson

unread,
Aug 8, 2019, 3:11:26 AM8/8/19
to steven.va...@ugent.be, plumed...@googlegroups.com
Hello Steven, 

This issue should now be fixed on the v2.5 and master branches. So if you get the latest version from the GitHub then you should not be having the issue. 

Thanks for the simple python MD code. It was very useful for testing the fix. 

Best regards,
Omar 
To unsubscribe from this group and stop receiving emails from it, send an email to plumed-users...@googlegroups.com.

To post to this group, send email to plumed...@googlegroups.com.
Visit this group at https://groups.google.com/group/plumed-users.

Steven Vandenbrande

unread,
Aug 12, 2019, 4:22:40 AM8/12/19
to Omar Valsson, plumed...@googlegroups.com
Hello Omar,

Thanks for fixing this. At first sight, it seems that the code shows the wanted behavior now.

Steven
Reply all
Reply to author
Forward
0 new messages