Author: bugman Date: Fri Mar 1 17:41:31 2013 New Revision: 18587 URL: http://svn.gna.org/viewcvs/relax?rev=18587&view=rev Log: The structure.find_pivot user function now uses the logarithmic barrier function. This is for constrained optimisation and requires the newest minfx code. The pivot position is constrained within a box of +/- 1000 Angstroms from zero. This is needed for when the solution is an infinite line - i.e. a rotation axis and not a pivot point. Previously the simplex optimisation would head toward + or - infinity. But now with a logarithmic barrier, the simplex algorithm can stabilise and find a point on the axis very quickly, long before reaching the edges of the box. Modified: trunk/generic_fns/structure/main.py Modified: trunk/generic_fns/structure/main.py URL: http://svn.gna.org/viewcvs/relax/trunk/generic_fns/structure/main.py?rev=18587&r1=18586&r2=18587&view=diff ============================================================================== --- trunk/generic_fns/structure/main.py (original) +++ trunk/generic_fns/structure/main.py Fri Mar 1 17:41:31 2013 @@ -246,9 +246,18 @@ coord[-1] = array(coord[-1]) coord = array(coord) + # Linear constraints for the pivot position (between -1000 and 1000 Angstrom). + A = zeros((6, 3), float64) + b = zeros(6, float64) + for i in range(3): + A[2*i, i] = 1 + A[2*i+1, i] = -1 + b[2*i] = -1000 + b[2*i+1] = -1000 + # The target function. finder = Pivot_finder(models, coord) - results = generic_minimise(func=finder.func, x0=init_pos, min_algor='simplex', func_tol=func_tol, print_flag=2) + results = generic_minimise(func=finder.func, x0=init_pos, min_algor='Log barrier', min_options=('simplex',), A=A, b=b, func_tol=func_tol, print_flag=1) # No result. if results == None: