<div dir="ltr">Hi,<div><br></div><div>Great. Is there something we can document/report better?</div><div><br></div><div>Mark</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jul 13, 2016 at 12:08 PM Jan Henning Peters &lt;<a href="mailto:jan.henning.peters@fu-berlin.de">jan.henning.peters@fu-berlin.de</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Am Dienstag, den 12.07.2016, 21:22 +0200 schrieb David van der Spoel:<br>
&gt; On 12/07/16 15:42, Jan Henning Peters wrote:<br>
&gt; &gt; Dear GROMACS developers,<br>
&gt; &gt;<br>
&gt; &gt; I&#39;ve been trying to implement the generalized reaction field<br>
&gt; &gt; electrostatic potential using user tables, but noticed that the value<br>
&gt; &gt; for the parameter kappa I arrived at strongly differs from that used by<br>
&gt; &gt; GROMACS (according to md.log) for the same parameters. To understand the<br>
&gt; &gt; difference, I had a closer look at the implementation (in GROMACS 5.0.7,<br>
&gt; &gt; 5.1.2 and the current git master), and I am a bit confused about it -<br>
&gt; &gt; maybe someone here can enlighten me.<br>
&gt; &gt;<br>
&gt; &gt; In the manual (sec 4.1.4), kappa is defined by<br>
&gt; &gt;<br>
&gt; &gt; kappa^2 = (2*I*F^2)/(epsilon_0*epsilon_rf*R*T)<br>
&gt; &gt;<br>
&gt; &gt; where F is Faraday&#39;s constant, R is the ideal gas constant and T is the<br>
&gt; &gt; absolute temperature (this is the same as in Tironi et al.). In the<br>
&gt; &gt; source code (function calc_rffac in src/gromacs/mdlib), this is<br>
&gt; &gt; implemented as<br>
&gt; &gt;<br>
&gt; &gt; *kappa  = std::sqrt(2*I/(EPSILON0*eps_rf*BOLTZ*Temp));<br>
&gt; &gt;<br>
&gt; &gt; now EPSILON0 is not the SI value of the dielectric constant, but<br>
&gt; &gt; defined (in src/gromacs/math/units.h) as<br>
&gt; &gt;<br>
&gt; &gt; #define EPSILON0<br>
&gt; &gt; (EPSILON0_SI*NANO*KILO)/(E_CHARGE*E_CHARGE*AVOGADRO)<br>
&gt; &gt;<br>
&gt; &gt; while<br>
&gt; &gt;<br>
&gt; &gt; #define BOLTZ            (RGAS/KILO)<br>
&gt; &gt;<br>
&gt; &gt; substituting this into the source code, we get<br>
&gt; &gt;<br>
&gt; &gt; *kappa  =<br>
&gt; &gt; std::sqrt(2*I*E_CHARGE*E_CHARGE*AVOGADRO*KILO/(EPSILON0_SI*NANO*KILO*eps_rf*RGAS*Temp));<br>
&gt; &gt;<br>
&gt; &gt; and since the Faraday constant is FARADAY = (E_CHARGE*AVOGADRO),<br>
&gt; &gt;<br>
&gt; &gt; this results in<br>
&gt; &gt;<br>
&gt; &gt; *kappa  =<br>
&gt; &gt; std::sqrt(2*I*E_CHARGE*FARADAY/(EPSILON0_SI*NANO*eps_rf*RGAS*Temp));<br>
&gt; &gt;<br>
&gt; &gt; I have not substituted RGAS, as this seems indeed to be the ideal gas<br>
&gt; &gt; constant from the original formula (also, since<br>
&gt; &gt; RGAS=(BOLTZMANN*AVOGADRO), this would actually divide the other FARADAY<br>
&gt; &gt; into E_CHARGE).<br>
&gt; &gt;<br>
&gt; &gt; Comparing this with the original formula, the resulting value for kappa<br>
&gt; &gt; appears to be off by a factor of sqrt(AVOGADRO/NANO) or about 7.76e15.<br>
&gt; &gt; Suprisingly, this difference seems to result only in a small numerical<br>
&gt; &gt; change of the resulting potential, but unless I missed something, it<br>
&gt; &gt; still seems to be not correct.<br>
&gt; &gt;<br>
&gt; &gt; Regards,<br>
&gt; &gt; Jan<br>
&gt; &gt;<br>
&gt; Isn&#39;t kappa printed to the log file if you use it in the mdp file?<br>
&gt; How does it compare to your expectation?<br>
<br>
It is printed out, and it was the difference between this printed out<br>
value and those I calculated that prompted me to look at the source code<br>
in the first place.<br>
<br>
On a second look, I think I have it figured out now. The ionic strength<br>
here seems to be given in 1/nm^3 instead of mol/l. This would introduce<br>
another factor of &quot;AVOGADRO&quot; and the formula in the code works out<br>
again.<br>
<br>
Sorry for the confusion.<br>
<br>
Jan<br>
<br>
--<br>
Gromacs Developers mailing list<br>
<br>
* Please search the archive at <a href="http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List" rel="noreferrer" target="_blank">http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List</a> before posting!<br>
<br>
* Can&#39;t post? Read <a href="http://www.gromacs.org/Support/Mailing_Lists" rel="noreferrer" target="_blank">http://www.gromacs.org/Support/Mailing_Lists</a><br>
<br>
* For (un)subscribe requests visit<br>
<a href="https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers" rel="noreferrer" target="_blank">https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers</a> or send a mail to <a href="mailto:gmx-developers-request@gromacs.org" target="_blank">gmx-developers-request@gromacs.org</a>.<br>
</blockquote></div>