correction for large entropy differences
[unres.git] / source / wham / src-M / wham_calc1.F
index 7c8fe50..6372100 100644 (file)
@@ -239,7 +239,7 @@ c        write (9,'(3i5,f10.5)') i,(iparm,potE(i,iparm),iparm=1,nParmSet)
         do iparm=1,nParmSet
 #ifdef DEBUG
           write (iout,'(2i5,21f8.2)') i,iparm,
-     &     (enetb(k,i,iparm),k=1,22)
+     &     (enetb(k,i,iparm),k=1,max_ene)
 #endif
           call restore_parm(iparm)
 #ifdef DEBUG
@@ -851,8 +851,13 @@ c        ent=-dlog(entfac(t))
      &  WHAM_COMM,IERROR)
       call MPI_Allreduce(entmax_p,entmax,1,MPI_DOUBLE_PRECISION,MPI_MAX,
      &  WHAM_COMM,IERROR)
-      ientmax=entmax-entmin 
-      if (ientmax.gt.2000) ientmax=2000
+C      ientmax=entmax-entmin 
+C      if (ientmax.gt.2000) ientmax=2000
+      if ((-dlog(entmax)-entmin).lt.2000.0d0) then
+      ientmax=-dlog(entmax)-entmin
+      else
+       ientmax=2000
+      endif
       write (iout,*) "entmin",entmin," entmax",entmax," ientmax",ientmax
       call flush(iout)
       do t=1,scount(me1)
@@ -876,8 +881,11 @@ c        ient=-dlog(entfac(t))-entmin
         if (ent.lt.entmin) entmin=ent
         if (ent.gt.entmax) entmax=ent
       enddo
+      if ((-dlog(entmax)-entmin).lt.2000.0d0) then
       ientmax=-dlog(entmax)-entmin
-      if (ientmax.gt.2000) ientmax=2000
+      else
+       ientmax=2000
+      endif
       do t=1,ntot(islice)
         ient=entfac(t)-entmin
         if (ient.le.2000) histent(ient)=histent(ient)+1