Index: src/main/optim.c
===================================================================
--- src/main/optim.c	(revision 45155)
+++ src/main/optim.c	(working copy)
@@ -268,6 +268,7 @@
     else if (strcmp(tn, "SANN") == 0) {
         tmax = asInteger(getListElement(options, "tmax"));
         temp = asReal(getListElement(options, "temp"));
+        if (trace) trace = asInteger(getListElement(options, "REPORT"));
         if (tmax == NA_INTEGER) error(_("'tmax' is not an integer"));
         if (!isNull(gr)) {
             if (!isFunction(gr)) error(_("'gr' is not a function"));
@@ -1082,7 +1083,6 @@
 
 
 #define E1 1.7182818  /* exp(1.0)-1.0 */
-#define STEPS 100
 
 void samin(int n, double *pb, double *yb, optimfn fminfn, int maxit,
 	   int tmax, double ti, int trace, void *ex)
@@ -1100,6 +1100,9 @@
     int k, its, itdoc;
     double t, y, dy, ytry, scale;
     double *p, *dp, *ptry;
+    
+    if (trace <= 0)
+  error(_("REPORT must be > 0 (method = \"SANN\")"));
 
     if(n == 0) { /* don't even attempt to optimize */
 	*yb = fminfn(n, pb, ex);
@@ -1138,7 +1141,7 @@
 	    }
 	    its++; k++;
 	}
-	if ((trace) && ((itdoc % STEPS) == 0))
+	if ((trace) && ((itdoc % trace) == 0))
 	    Rprintf("iter %8d value %f\n", its - 1, *yb);
 	itdoc++;
     }
@@ -1151,4 +1154,3 @@
 }
 
 #undef E1
-#undef STEPS
