Index: pcp/src/gramsch.c
===================================================================
--- pcp/src/gramsch.c	(revision 44fa6a1401b64d07b5cb619358e9b6a83e324974)
+++ pcp/src/gramsch.c	(revision 35051fbbb0fbf25fe8ae9049c55ab8699d198831)
@@ -713,5 +713,5 @@
 }
 
-#define max_GramSch_iter 3
+#define max_GramSch_iter 1
 
 /** Test Gram-Schmidt-Orthogonalization.
@@ -731,8 +731,10 @@
   int NotOk;      // counts pairs that are not orthogonal
   int iter = 0;
+  double MaxNotOk = 0.;
   fftw_complex *LPsiDatA, *LPsiDatB;
   
   do {
     NotOk = 0;
+    MaxNotOk = 0.;
     //fprintf(stderr,"(%i) Testing Orthogonality ... \n", P->Par.me);
     for (i=0; i < Psi->MaxPsiOfType+P->Par.Max_me_comm_ST_PsiT; i++) {  // go through all wave functions (plus the extra one for each process)
@@ -781,10 +783,12 @@
                   if (i == LOnePsiB->MyGlobalNo && LOnePsiB->PsiGramSchStatus == (int)IsOrthonormal) {
                     if (fabs(PsiSP -1.0) >= MYEPSILON) {
-                      fprintf(stderr,"(%i)(%i,%i) = %g ?= 1.0 eps(%g >= %g)\n",P->Par.my_color_comm_ST,OnePsiA->MyGlobalNo,LOnePsiB->MyGlobalNo,PsiSP, fabs(PsiSP -1.0), MYEPSILON);
+                      //fprintf(stderr,"(%i)(%i,%i) = %g ?= 1.0 eps(%g >= %g)\n",P->Par.my_color_comm_ST,OnePsiA->MyGlobalNo,LOnePsiB->MyGlobalNo,PsiSP, fabs(PsiSP -1.0), MYEPSILON);
+                      MaxNotOk = (fabs(PsiSP -1.0) > MaxNotOk) ? fabs(PsiSP -1.0) : MaxNotOk;
                       NotOk++;
                     }
                   } else {
                     if (fabs(PsiSP) >= MYEPSILON && (LOnePsiB != OnePsiA && LOnePsiB->PsiType > UnOccupied)) {
-                      fprintf(stderr,"(%i)(%i,%i) = %g ?= 0.0 eps(%g >= %g)\n",P->Par.my_color_comm_ST,OnePsiA->MyGlobalNo,LOnePsiB->MyGlobalNo,PsiSP, fabs(PsiSP), MYEPSILON);
+                      //fprintf(stderr,"(%i)(%i,%i) = %g ?= 0.0 eps(%g >= %g)\n",P->Par.my_color_comm_ST,OnePsiA->MyGlobalNo,LOnePsiB->MyGlobalNo,PsiSP, fabs(PsiSP), MYEPSILON);
+                      MaxNotOk = (fabs(PsiSP) > MaxNotOk) ? fabs(PsiSP) : MaxNotOk;
                       NotOk++;
                     }
@@ -797,5 +801,6 @@
                   if (i == LOnePsiB->MyGlobalNo && LOnePsiB->PsiGramSchStatus == (int)IsOrthonormal) {
                     if (fabs(PsiSP -1.0) >= MYEPSILON) {
-                      fprintf(stderr,"(%i)(%i,%i) = %g != 1.0 eps(%g >= %g)\n",P->Par.my_color_comm_ST,i,LOnePsiB->MyGlobalNo,PsiSP, fabs(PsiSP -1.0), MYEPSILON);
+                      //fprintf(stderr,"(%i)(%i,%i) = %g != 1.0 eps(%g >= %g)\n",P->Par.my_color_comm_ST,i,LOnePsiB->MyGlobalNo,PsiSP, fabs(PsiSP -1.0), MYEPSILON);
+                      MaxNotOk = (fabs(PsiSP -1.0) > MaxNotOk) ? fabs(PsiSP -1.0) : MaxNotOk;
                       NotOk++;
                     } else {
@@ -804,5 +809,6 @@
                   } else {
                     if (fabs(PsiSP) >= MYEPSILON) {
-                      fprintf(stderr,"(%i)(%i,%i) = %g != 0.0 eps(%g >= %g)\n",P->Par.my_color_comm_ST,i,LOnePsiB->MyGlobalNo,PsiSP, fabs(PsiSP), MYEPSILON);
+                      //fprintf(stderr,"(%i)(%i,%i) = %g != 0.0 eps(%g >= %g)\n",P->Par.my_color_comm_ST,i,LOnePsiB->MyGlobalNo,PsiSP, fabs(PsiSP), MYEPSILON);
+                      MaxNotOk = (fabs(PsiSP) > MaxNotOk) ? fabs(PsiSP) : MaxNotOk;
                       NotOk++;
                     } else {
@@ -823,10 +829,12 @@
                   if (i == LOnePsiB->MyGlobalNo && LOnePsiB->PsiGramSchStatus == (int)IsOrthonormal) {
                     if (fabs(PsiSP -1.0) >= MYEPSILON) {
-                      fprintf(stderr,"(%i)(%i,%i) = %g != 1.0 eps(%g >= %g)\n",P->Par.my_color_comm_ST,OnePsiA->MyGlobalNo,LOnePsiB->MyGlobalNo,PsiSP, fabs(PsiSP -1.0), MYEPSILON);
+                      //fprintf(stderr,"(%i)(%i,%i) = %g != 1.0 eps(%g >= %g)\n",P->Par.my_color_comm_ST,OnePsiA->MyGlobalNo,LOnePsiB->MyGlobalNo,PsiSP, fabs(PsiSP -1.0), MYEPSILON);
+                      MaxNotOk = (fabs(PsiSP -1.0) > MaxNotOk) ? fabs(PsiSP -1.0) : MaxNotOk;
                       NotOk++;
                     }
                   } else {
                     if (fabs(PsiSP) >= MYEPSILON && (LOnePsiB->MyGlobalNo != OnePsiA->MyGlobalNo)) {
-                      fprintf(stderr,"(%i)(%i,%i) = %g != 0.0 eps(%g >= %g)\n",P->Par.my_color_comm_ST,OnePsiA->MyGlobalNo,LOnePsiB->MyGlobalNo,PsiSP, fabs(PsiSP), MYEPSILON);
+                      //fprintf(stderr,"(%i)(%i,%i) = %g != 0.0 eps(%g >= %g)\n",P->Par.my_color_comm_ST,OnePsiA->MyGlobalNo,LOnePsiB->MyGlobalNo,PsiSP, fabs(PsiSP), MYEPSILON);
+                      MaxNotOk = (fabs(PsiSP) > MaxNotOk) ? fabs(PsiSP) : MaxNotOk;
                       NotOk++;
                     }
@@ -838,10 +846,12 @@
                   if (i == LOnePsiB->MyGlobalNo && LOnePsiB->PsiGramSchStatus == (int)IsOrthonormal) {
                     if (fabs(PsiSP -1.0) >= MYEPSILON) {
-                      fprintf(stderr,"(%i)(%i,%i) = %g != 1.0 eps(%g >= %g)\n",P->Par.my_color_comm_ST,OnePsiA->MyGlobalNo,LOnePsiB->MyGlobalNo,PsiSP, fabs(PsiSP -1.0), MYEPSILON);
+                      //fprintf(stderr,"(%i)(%i,%i) = %g != 1.0 eps(%g >= %g)\n",P->Par.my_color_comm_ST,OnePsiA->MyGlobalNo,LOnePsiB->MyGlobalNo,PsiSP, fabs(PsiSP -1.0), MYEPSILON);
+                      MaxNotOk = (fabs(PsiSP -1.0) > MaxNotOk) ? fabs(PsiSP -1.0) : MaxNotOk;
                       NotOk++;
                     }
                   } else {
                     if (fabs(PsiSP) >= MYEPSILON) {
-                      fprintf(stderr,"(%i)(%i,%i) = %g != 0.0 eps(%g >= %g)\n",P->Par.my_color_comm_ST,OnePsiA->MyGlobalNo,LOnePsiB->MyGlobalNo,PsiSP, fabs(PsiSP), MYEPSILON);
+                      //fprintf(stderr,"(%i)(%i,%i) = %g != 0.0 eps(%g >= %g)\n",P->Par.my_color_comm_ST,OnePsiA->MyGlobalNo,LOnePsiB->MyGlobalNo,PsiSP, fabs(PsiSP), MYEPSILON);
+                      MaxNotOk = (fabs(PsiSP) > MaxNotOk) ? fabs(PsiSP) : MaxNotOk;
                       NotOk++;
                     }
@@ -854,9 +864,10 @@
       }
     }
-/*    if (NotOk != 0) {
-      fprintf(stderr,"(%i) NotOk %i ... re-orthogonalizing type %i for the %ith time\n",P->Par.me, NotOk, Type2test, ++iter);
+    if (NotOk != 0) {
+      fprintf(stderr,"(%i) NotOk %i with max %lg ... re-orthogonalizing type %i for the %ith time\n",P->Par.me, NotOk, MaxNotOk, Type2test, iter);
       ResetGramSchTagType(P, Psi, Type2test, NotOrthogonal);
       GramSch(P,Lev,Psi,Orthonormalize);
-    }*/
+    }
+    ++iter;
   } while ((NotOk != 0) && (iter < max_GramSch_iter));
   if (P->Call.out[StepLeaderOut]) { // final check if there have been any un-orthogonal pairs
