<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Hi,<br><br>I have an optimal leap-frog v-rescale thermostat implemented for CVS head.<br>This will be in Gromacs 4.1.<br>Gromacs 4.1 will probably also have a velocity verlet integrator,<br>for which we can also remove the last very small drift in the v-rescale implementation.<br><br>Berk<br><br>&gt; From: servaas.michielssens@student.kuleuven.be<br>&gt; To: gmx-users@gromacs.org<br>&gt; Date: Tue, 12 May 2009 13:25:02 +0200<br>&gt; Subject: [gmx-users] Re: v-rescale - harmonic oscillator<br>&gt; <br>&gt; Dear Dr. Bussi,<br>&gt; <br>&gt; Thank you very much for the explanation of this problem. <br>&gt; <br>&gt; So I understand that a problem remains with the integrator used in<br>&gt; GROMACS for small systems and that Berk is fixing this (and also a small<br>&gt; error is comming from using leap frog instead of velocity verlet). <br>&gt; <br>&gt; I don't use this thermostat in my hybrid monte carlo algoritm I just<br>&gt; compared the results from a hybrid monte carlo run the results with<br>&gt; v-rescale. So for me there is no hurry the implement the different<br>&gt; integrator, since Berk is already working on it I think it is not very<br>&gt; useful if I also start doing this. I am prepared to help with it or test<br>&gt; it if this is required.<br>&gt; <br>&gt; <br>&gt; Kind regards,<br>&gt; <br>&gt; Servaas<br>&gt; <br>&gt; &gt; -----------------------------<br>&gt; &gt; <br>&gt; &gt; Message: 1<br>&gt; &gt; Date: Tue, 12 May 2009 09:06:52 +0200<br>&gt; &gt; From: Giovanni Bussi &lt;giovanni.bussi@gmail.com&gt;<br>&gt; &gt; Subject: [gmx-users] Re: v-rescale - harmonic oscillator<br>&gt; &gt; To: gmx-users@gromacs.org<br>&gt; &gt; Message-ID:<br>&gt; &gt;         &lt;3297c3ca0905120006l2f8e630dv34c2ed4b6cd02801@mail.gmail.com&gt;<br>&gt; &gt; Content-Type: text/plain; charset=ISO-8859-1<br>&gt; &gt; <br>&gt; &gt; Dear Servaas,<br>&gt; &gt; <br>&gt; &gt; the problem that you found is not related to the stochastic rescaling<br>&gt; &gt; itself, but to the way the effective energy is calculated in gromacs.<br>&gt; &gt; In particular, the increment in the integral part is not consistent<br>&gt; &gt; with the applied scaling. You can correct for this by changing<br>&gt; &gt; src/mdlib/coupling.c, line 462:<br>&gt; &gt; <br>&gt; &gt; // NEW:<br>&gt; &gt;      if (Ek + dEk &lt;= 0) {<br>&gt; &gt;         ekind-&gt;tcstat[i].lambda = 0.0;<br>&gt; &gt;         therm_integral[i] -= -Ek;<br>&gt; &gt;       } else {<br>&gt; &gt;         ekind-&gt;tcstat[i].lambda = sqrt((Ek + dEk)/Ek);<br>&gt; &gt;         ekind-&gt;tcstat[i].lambda = max(min(1.25,ekind-&gt;tcstat[i].lambda),0.8);<br>&gt; &gt;         therm_integral[i] -=<br>&gt; &gt; Ek*(ekind-&gt;tcstat[i].lambda*ekind-&gt;tcstat[i].lambda-1.0);<br>&gt; &gt;       }<br>&gt; &gt; // OLD:<br>&gt; &gt; //      if (Ek + dEk &lt;= 0) {<br>&gt; &gt; //      ekind-&gt;tcstat[i].lambda = 0.0;<br>&gt; &gt; //      } else {<br>&gt; &gt; //      ekind-&gt;tcstat[i].lambda = sqrt((Ek + dEk)/Ek);<br>&gt; &gt; //      ekind-&gt;tcstat[i].lambda = max(min(1.25,ekind-&gt;tcstat[i].lambda),0.8);<br>&gt; &gt; //      }<br>&gt; &gt; //      therm_integral[i] -= dEk;<br>&gt; &gt; <br>&gt; &gt; Note that this is a problem only when lambda is very different from<br>&gt; &gt; one, and this happens in very small systems. The effect for large<br>&gt; &gt; systems should be negligible. Furthermore, you should combine this<br>&gt; &gt; with the fix that Berk posted a few days ago, which is in file<br>&gt; &gt; src/mdlid/update.c, line 165:<br>&gt; &gt; // OLD:<br>&gt; &gt; //          vv             = lg*(vn + f[n][d]*w_dt);<br>&gt; &gt; // NEW:<br>&gt; &gt;           vv             = lg*vn + f[n][d]*w_dt;<br>&gt; &gt; <br>&gt; &gt; These fixes will give you a much better energy conservation.<br>&gt; &gt; <br>&gt; &gt; Consider also the following comments:<br>&gt; &gt; <br>&gt; &gt; * For very small systems, the special cases for lambda (max(min...))<br>&gt; &gt; introduce small artifacts in the ensemble which are out of control.<br>&gt; &gt; Thus, I don't think that you can really use this scheme to perform<br>&gt; &gt; rigorous hybrid Monte Carlo. A possible solution is to use a better<br>&gt; &gt; integrator for the thermostat (the one discussed in the appendix of<br>&gt; &gt; Bussi, Donadio and Parrinello, JCP 2007), which works for every choice<br>&gt; &gt; of taut and any number of degrees of freedom, thus it does not need<br>&gt; &gt; any special case for lambda. I can send you an implementation of it<br>&gt; &gt; for gromacs. Berk is also working on that, and will probabily<br>&gt; &gt; introduce it soon in the official gromacs (4.1 or the cvs).<br>&gt; &gt; <br>&gt; &gt; * Even with all these fixes (including the better integrator), there<br>&gt; &gt; still a (small) drift in the effective energy for the harmonic<br>&gt; &gt; oscillator. I did not test, but I guess that it originates from the<br>&gt; &gt; fact that gromacs uses leapfrog and not velocity-Verlet, and leapfrog<br>&gt; &gt; is not easily combined with our stochastic scheme which is ultimately<br>&gt; &gt; based on Trotter decomposition. The drift should *completely*<br>&gt; &gt; disappear for a harmonic system integrated with velocity-Verlet. If<br>&gt; &gt; you are interested, we have proven this for a different thermostat<br>&gt; &gt; (Bussi Parrinello, PRE 2007, for Langevin dynamics). The demonstration<br>&gt; &gt; can be straightforwardly ported to the velocity-rescaling thermostat.<br>&gt; &gt; <br>&gt; &gt; * A part from the two previous implementation issues, I do not expect<br>&gt; &gt; any problem with the stochastic rescaling applied to the harmonic<br>&gt; &gt; oscillator. In particular, lack of ergodicity in harmonic systems<br>&gt; &gt; (which is the big pain in Nose-Hoover) should not be a problem at all.<br>&gt; &gt; Furthermore, the algorithm should work and provide the proper ensemble<br>&gt; &gt; also on very small systems.<br>&gt; &gt; <br>&gt; &gt; Best regards,<br>&gt; &gt; <br>&gt; &gt; Giovanni Bussi<br>&gt; &gt; <br>&gt; &gt; <br>&gt; &gt; ------------------------------<br>&gt; <br>&gt; _______________________________________________<br>&gt; gmx-users mailing list    gmx-users@gromacs.org<br>&gt; http://www.gromacs.org/mailman/listinfo/gmx-users<br>&gt; Please search the archive at http://www.gromacs.org/search before posting!<br>&gt; Please don't post (un)subscribe requests to the list. Use the <br>&gt; www interface or send it to gmx-users-request@gromacs.org.<br>&gt; Can't post? Read http://www.gromacs.org/mailing_lists/users.php<br><br /><hr />See all the ways you can stay connected <a href='http://www.microsoft.com/windows/windowslive/default.aspx' target='_new'>to friends and family</a></body>
</html>