Index: trunk/psLib/src/math/psMinimizeLMM.h
===================================================================
--- trunk/psLib/src/math/psMinimizeLMM.h	(revision 23486)
+++ trunk/psLib/src/math/psMinimizeLMM.h	(revision 28998)
@@ -33,6 +33,7 @@
 #define PS_MAX_LMM_ITERATIONS 100
 #define PS_MAX_MINIMIZE_ITERATIONS 100
-#define P_PSMINIMIZATION_SET_MAXITER(m,val) *(int*)&m->maxIter = val
-        #define P_PSMINIMIZATION_SET_TOL(m,val) *(float*)&m->tol = val
+#define P_PSMINIMIZATION_SET_MAXITER(m,val) { *(int*)&m->maxIter  = val; }
+#define P_PSMINIMIZATION_SET_MIN_TOL(m,val) { *(float*)&m->minTol = val; }
+#define P_PSMINIMIZATION_SET_MAX_TOL(m,val) { *(float*)&m->maxTol = val; }
 
                 typedef enum {
@@ -75,9 +76,11 @@
 typedef struct
 {
-    const int maxIter;                 ///< Convergence limit
-    const float tol;                   ///< Error Tolerance
+    const int maxIter;			///< Convergence limit
+    const float minTol;			///< Convergence Tolerance (stop if we reach this value)
+    const float maxTol;			///< Max Tolerance (accept fit if last improvement was this good)
     float value;                       ///< Value of function at minimum
     int iter;                          ///< Number of iterations to date
     float lastDelta;                   ///< The last difference for the fit
+    float maxChisqDOF;		       ///< for Chisq minimization, require that we reach here before checking tolerance
 }
 psMinimization;
@@ -102,5 +105,6 @@
 psMinimization *psMinimizationAlloc(
     int maxIter,                       ///< Number of minimization iterations to perform.
-    float tol                          ///< Requested error tolerance
+    float minTol,		       ///< stop if tolerance is less than this
+    float maxTol		       ///< accept fit if tolerance is less than this
 ) PS_ATTR_MALLOC;
 
