[SciPy-User] optimize.fmin_cg and optimize.fmin_bgfs optimize to 0

Patrick Holvey pholvey at gmail.com
Tue Jun 14 13:08:20 EDT 2011


Thanks Pauli!  That fixed the issue I was having.  The minimization is
proceeding like it should!

Most sincerely,

Patrick

On Wed, Jun 8, 2011 at 10:00 AM, Pauli Virtanen <pav at iki.fi> wrote:

> Tue, 07 Jun 2011 15:23:46 -0400, Patrick Holvey wrote:
> [clip]
> > However, when
> > I use the gradient in the optimization, all of the atom positions shoot
> > right to the origin (so they're all at 0,0,0) after just 2 function
> > calls and 1 gradient call, which seems very odd to me.  So I tried
> > fmin_bgfs with the gradient and the same thing happened.  Does anyone
> > have any experience with analytic gradients where this has happened to
> > them?  I'm confused as to whether the problem is in my gradient
> > implementation or in how I'm passing the gradient or what.
>
> Your Box.Forces(self, xyz) method modifies the input `xyz` argument.
> This you should not do --- the optimizer expects that you do not alter
> the current position this way.
>
> Try replacing
>
>        vectorfield=xyz
>
> with
>
>        vectorfield = numpy.zeros_like(xyz)
>
> or put
>
>        xyz = xyz.copy()
>
> in the beginning of the routine.
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>



-- 
Patrick Holvey
Graduate Student
Dept. of Materials Science and Engineering
Johns Hopkins University
pholvey1 at jhu.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20110614/bf3952dc/attachment.html>


More information about the SciPy-User mailing list