# [gmx-developers] Re: Buckingham potential force calculation correct ?

David van der Spoel spoel at xray.bmc.uu.se
Mon Oct 2 19:26:30 CEST 2006

```Mathias PUETZ wrote:
>
> Hi David,
>
> sorry, I found my mistake: the factor of r in my derivate of the exp()
> is incorrect and then the generated GROMACS code is actually correct.
>

Nevermind, we are very happy to have people look at the code with their
eyes open.

> Mathias PUETZ wrote:
>  >/
> />/ Hi,
> />/
> />/ while tuning the force kernels for BlueGene I stumbled across the
> />/ following.
> />/
> />/ The C (also Fortran) code generated by mknb for calculating the
> />/ Buckingham potential is the following:
> />/
> />/   rinvsq = rinv * rinv
> />/   br = cexp2 * rsq * rinv
> />/   Vvdwexp = cexp1 * exp (-br)
> />/   Vvdw6 = C6 / (rinvsq*rinvsq*rinvsq)
> />/   fscal = (br * Vvdwexp - 6.0 * Vvdw6) * rinvsq;
> />/
> />/   fx = dx * fscal
> />/   fy = dy * fscal
> />/   fz = dz * fscal
> />/
> />/ This does not look right to me, because the br * Vvdwexp part in the
> />/ calculation of
> />/ fscal should only be scaled by rinv and not rinvsq as deduced by
> />/ following calculation:
> />/
> />/ The Buckingham potential is defined by the following form:
> />/
> />/   V(r) =   C1 * exp ( - C2 * r) -  C6 / r**6
> />/
> />/ The force on particle 1 is calculated by the formula:
> />/
> />/   Fx = -  dx / r  *  d/dr V(r)
> />/        =  -dx / r  * { - C1*C2*r * exp( -C2 * r)  + 6.0 * C6 / r**7 }
> />/        = -dx *  { 1/r**2  * 6.0 * C6 / r**6  + 1/r * br * C1 * exp (-C2
> />/ * r) }
> />/        = -dx * { rinvsq * 6.0 * Vvdw6  + rinv * br * Vvdwexp }
> />/
> />/       != -dx * rinvsq * { 6.0 * Vvdw6  + br * Vvdwexp }
> />/
> />/ Am I making a mistake here or is the GROMACS code wrong ?
> />/
> />/ Viele Grüsse / Best regards,
> />/ Dr. Mathias Pütz
> />/
> />/ IT Specialist for Application Perfomance
> />/
> />/ Deep Computing - Strategic Growth Business
> />/ IBM Systems & Technology Group
> />/
> />/ e-mail:  //_mpuetz at de.ibm.com_/
> <http://www.gromacs.org/mailman/listinfo/gmx-developers>/
> />/ mobile: + 49-(0)160-7120602
> />/ fax:         + 49-(0)6131-84-6660
> />/
> />/ snailmail:
> />/  IBM Deutschland GmbH
> />/  Department B458
> />/  Hechtsheimer Str. 2 / Building 12
> />/  55131 Mainz
> />/  Germany
> />/
> />/
> />/ ------------------------------------------------------------------------
> />/
> />/ _______________________________________________
> />/ gmx-developers mailing list
> />/ //_gmx-developers at gromacs.org_/
> <http://www.gromacs.org/mailman/listinfo/gmx-developers>/
> />/ //_http://www.gromacs.org/mailman/listinfo/gmx-developers_//
> />/ Please don't post (un)subscribe requests to the list. Use the
> />/ www interface or send it to //_gmx-developers-request at
> gromacs.org._/ <http://www.gromacs.org/mailman/listinfo/gmx-developers>/
> /I think it is correct because there is an extra r in the br term.
>
> --
> David.
> ________________________________________________________________________
> David van der Spoel, PhD, Assoc. Prof., Molecular Biophysics group,
> Dept. of Cell and Molecular Biology, Uppsala University.
> Husargatan 3, Box 596,                   75124 Uppsala, Sweden
> phone:                 46 18 471 4205
>  fax: 46 18 511 755
> _spoel at xray.bmc.uu.se_
> <http://www.gromacs.org/mailman/listinfo/gmx-developers>
> _spoel at gromacs.org_
> <http://www.gromacs.org/mailman/listinfo/gmx-developers>
> _http://folding.bmc.uu.se_ <http://folding.bmc.uu.se/>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Viele Grüsse / Best regards,
> Dr. Mathias Pütz
>
> IT Specialist for Application Perfomance
>
> Deep Computing - Strategic Growth Business
> IBM Systems & Technology Group
>
> e-mail:  mpuetz at de.ibm.com
> mobile: + 49-(0)160-7120602
> fax:         + 49-(0)6131-84-6660
>
> snailmail:
>  IBM Deutschland GmbH
>  Department B458
>  Hechtsheimer Str. 2 / Building 12
>  55131 Mainz
>  Germany
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> gmx-developers mailing list
> gmx-developers at gromacs.org
> http://www.gromacs.org/mailman/listinfo/gmx-developers
> Please don't post (un)subscribe requests to the list. Use the
> www interface or send it to gmx-developers-request at gromacs.org.

--
David.
________________________________________________________________________
David van der Spoel, PhD, Assoc. Prof., Molecular Biophysics group,
Dept. of Cell and Molecular Biology, Uppsala University.
Husargatan 3, Box 596,  	75124 Uppsala, Sweden
phone:	46 18 471 4205		fax: 46 18 511 755
spoel at xray.bmc.uu.se	spoel at gromacs.org   http://folding.bmc.uu.se
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

```