<div dir="ltr"><div><div><div><div><div><div><div>Hi Sun,<br><br></div>I implemented a few colvars last year. I tested the derivatives simply my finite differences. I wrote a subroutine for testing, that shifts each atom (for each direction) by plus/minus a small delta. For each of the shifted positions you can calculate your colvar. Do something like this:<br> dx=0.0001_dp<br> DO iparticle=1,SIZE(my_particles)<br> dsdr_numerical = 0._dp<br> DO dir=1,3<br> DO shift=1,2<br> std_value = my_particles(iparticle)%r(dir)<br> my_particles(iparticle)%r(dir) = std_value - (-1.0_dp)**shift*dx<br></div><div> Calculate colvar(shift)=.... <br> my_particles(iparticle)%r(dir)<wbr>=std_value<br></div> ENDDO<br></div><div> dsdr_numerical =0.5_dp*(colvar(1) - colvar(2))/dx<br></div> ENDDO<br></div> ENDDO<br><br></div>dsdr_numerical should correspond to what you calculated analytically.<br><br></div>Best regards,<br></div>Dorothea<br></div><div class="gmail_extra"><br><div class="gmail_quote">2017-04-20 17:56 GMT+03:00 Sun Tao <span dir="ltr"><<a href="mailto:taosun...@gmail.com" target="_blank">taosun...@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dear CP2K users/developers:<div><br></div><div>I have coded a new collective variable into CP2K, in order to do some umbrella sampling. I have implemented the calculation of the CV's value and its derivative. The value is already tested and gives correct results. However, I am wondering how to test the correctness of the derivative, since this is essential if I want to do umbrella sampling simulations.</div><div><br></div><div>If you have some experience in implementing CV's in CP2K, I would like to know how you tested the correctness of your implementation. I would appreciate if you could help me.</div><div><br></div><div>Thanks ~</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Tao</div></font></span></div><span class="HOEnZb"><font color="#888888">
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups "cp2k" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:cp2k+uns...@googlegroups.com" target="_blank">cp2k+unsubscribe@googlegroups.<wbr>com</a>.<br>
To post to this group, send email to <a href="mailto:cp...@googlegroups.com" target="_blank">cp...@googlegroups.com</a>.<br>
Visit this group at <a href="https://groups.google.com/group/cp2k" target="_blank">https://groups.google.com/<wbr>group/cp2k</a>.<br>
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank">https://groups.google.com/d/<wbr>optout</a>.<br>
</font></span></blockquote></div><br></div>