Index: ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp
===================================================================
--- ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp	(revision 18867)
+++ ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp	(revision 18868)
@@ -94,13 +94,17 @@
 	_printf0_("\n");
 	_printf0_("Cost function f(x)   | Gradient norm |g(x)| |  List of contributions\n");
 	_printf0_("____________________________________________________________________\n");
-	indic = 0; //no adjoint required
+
+	/*Initialize Gradient and cost function of M1QN3*/
+	indic = 4; //adjoint and gradient required
 	simul(&indic,&n,X,&f,G,izs,rzs,(void*)femmodel);
-	double f1=f;
 
-	indic = 4; //adjoint and gradient required
+	/*Estimation of the expected decrease in f during the first iteration*/
+	double df1=f;
+
+	/*Call M1QN3 solver*/
 	m1qn3_(costfuncion,prosca,&ctonbe_,&ctcabe_,
-				&n,X,&f,G,&dxmin,&f1,
+				&n,X,&f,G,&dxmin,&df1,
 				&gttol,normtype,&impres,&io,imode,&omode,&niter,&nsim,iz,dz,&ndz,
 				&reverse,&indic,izs,rzs,(void*)femmodel);
 
@@ -196,7 +200,7 @@
 	femmodel->CostFunctionx(pf,&Jlist,NULL);
 	_printf0_("f(x) = "<<setw(12)<<setprecision(7)<<*pf<<"  |  ");
 
-	if(indic==0){
+	if(*indic==0){
 		/*dry run, no gradient required*/
 
 		/*Retrieve objective functions independently*/
