Hi Geoff, Thanks for moving this -- I should check autocompleted mailing list addresses more closely ;-)
On Tue, Jan 3, 2012 at 11:51 AM, Geoffrey Hutchison <ge...@geoffhutchison.net> wrote: > On Jan 3, 2012, at 11:44 AM, David Lonie wrote: >> which copies the data in _gradientPtr to _grad1. Trouble is, >> _gradientPtr doesn't seem to be used in this function. Can this be >> removed, or am I missing something? > > No, this object member variable is used by other code, e.g. GetCoordinates() > as the forces on the atoms. GetCoordinates etc read _gradientPtr, but where is it written? >From my reading of the code, ConjugateGradientsInitialize calculates a gradient and stores it into _gradientPtr, but then ConjugateGradientsTakeNSteps calculates and stores a new gradient into _grad1 for each step taken. After the linesearch, this call to memcpy overwrites the gradient at the current step (_grad1) with the initial gradient (_gradientPtr). The comment ("Save the direction") makes this look like a bug to me, since it appears to actually reset the gradient. Perhaps the memcpy args should be reversed? I'm trying to track down a bug somewhere in the forcefields that is causing this to happen: C O N J U G A T E G R A D I E N T S STEPS = 250 STEP n E(n) E(n-1) -------------------------------- 1 757722.040 5890899.081 2 179656.470 179656.470 CONJUGATE GRADIENTS HAS CONVERGED The geometry is not reasonable, though it claims to be converged. Also for step n=2, E(n-1) != E(1). This is not a result of the memcpy (I've tried removing it and the problem persists), but that call does still look buggy to me. Dave ------------------------------------------------------------------------------ Write once. Port to many. Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join http://p.sf.net/sfu/intel-appdev _______________________________________________ OpenBabel-Devel mailing list OpenBabel-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-devel