From owner-chemistry ":at:" ccl.net Fri Nov 18 14:19:00 2005 From: "Konrad Hinsen khinsen::cea.fr" To: CCL Subject: CCL: Tinker: harmonic torsion potential Message-Id: <-30000-051118141443-2613-WHMdOwdiAMMuaDJQp+4Mzg[A]server.ccl.net> X-Original-From: "Konrad Hinsen" Sent to CCL by: "Konrad Hinsen" [khinsen*cea.fr] On 18.11.2005, at 16:10, Mark Thompson mark-x-arguslab.com wrote: > One trick that I've used is to verify MM first derivatives is to write a > numerical gradient routine to go along with analytical first derivative > code. Then choose high symmetry cases (small test systems) centered on > the origin and tricks like that to test that numerical and analytical Another useful tool is automatic derivatives, in particular for non-trivial energy terms, as they permit a simple inspection of intermediate values. For the Python users out there, I provide a nicely packaged potential energy derivative module in my ScientificPython package, which is available at http://dirac.cnrs-orleans.fr/ScientificPython/ An example code for that module is: from Scientific.Physics.Potential import PotentialWithGradients from Scientific.Geometry import Vector def _harmonic(k,r1,r2): dr = r2-r1 return k*dr*dr harmonic = PotentialWithGradients(_harmonic) energy, gradients = harmonic(1., Vector(0,3,1), Vector(1,2,0)) print energy, gradients This prints 3.0 [Vector(-2.0,2.0,2.0), Vector(2.0,-2.0,-2.0)] There is also a version for second derivatives. ScientificPython also has "raw" automatic derivatives of arbitrary order in Scientific.Functions.Derivatives. -- ------------------------------------------------------------------------------- Konrad Hinsen Laboratoire Leon Brillouin (CEA-CNRS), CEA Saclay, 91191 Gif-sur-Yvette Cedex, France Tel.: +33-1 69 08 79 25 Fax: +33-1 69 08 82 61 E-Mail: khinsen*_*cea.fr -------------------------------------------------------------------------------