Removed the obsolete histent array from WHAM
authorAdam Liwo <adam@piasek4.chem.univ.gda.pl>
Wed, 19 Apr 2017 11:26:46 +0000 (13:26 +0200)
committerAdam Liwo <adam@piasek4.chem.univ.gda.pl>
Wed, 19 Apr 2017 11:26:46 +0000 (13:26 +0200)
Fixed (hopefully) tha NaNs problem in VTS/A-MTS; need to test on systems that previously crashed

source/unres/MD.f90
source/unres/cinfo.f90

index 15fdf68..c378ece 100644 (file)
 ! Calculate energy and forces
         call zerograd
         call etotal(potEcomp)
+! AL 4/17/17: Reduce the steps if NaNs occurred.
+        if (potEcomp(0).gt.0.99e20 .or. isnan(potEcomp(0)).gt.0) then
+          d_time=d_time/2
+          cycle
+        endif
+! end change
         if (large.and. mod(itime,ntwe).eq.0) &
           call enerprint(potEcomp)
 #ifdef TIMING_ENE
 ! Calculate energy and forces
         call zerograd
         call etotal_short(energia_short)
+! AL 4/17/17: Exit itime_split loop when energy goes infinite
+        if (energia_short(0).gt.0.99e20 .or. isnan(energia_short(0)) ) then
+          if (PRINT_AMTS_MSG) &
+          write (iout,*) "Infinities/NaNs in energia_short",energia_short(0),"; increasing ntime_split to",ntime_split
+          ntime_split=ntime_split*2
+          if (ntime_split.gt.maxtime_split) then
+#ifdef MPI
+          write (iout,*) &
+     "Cannot rescue the run; aborting job. Retry with a smaller time step"
+          call flush(iout)
+          call MPI_Abort(MPI_COMM_WORLD,IERROR,ERRCODE)
+#else
+          write (iout,*) &
+     "Cannot rescue the run; terminating. Retry with a smaller time step"
+#endif
+          endif
+          exit
+        endif
+! End change
         if (large.and. mod(itime,ntwe).eq.0) &
           call enerprint(energia_short)
 #ifdef TIMING_ENE
           if (ntime_split.lt.maxtime_split) then
             scale=.true.
             ntime_split=ntime_split*2
+! AL 4/17/17: We should exit the itime_split loop when acceleration change is too big
+            exit
             do i=0,2*nres
               do j=1,3
                 dc_old(j,i)=dc_old0(j,i)
 #endif
       call zerograd
       call etotal_long(energia_long)
+      if (energia_long(0).gt.0.99e20 .or. isnan(energia_long(0))) then
+#ifdef MPI
+        write (iout,*) &
+              "Infinitied/NaNs in energia_long, Aborting MPI job."
+        call flush(iout)
+        call MPI_Abort(MPI_COMM_WORLD,IERROR,ERRCODE)
+#else
+        write (iout,*) "Infinitied/NaNs in energia_long, terminating."
+        stop
+#endif
+      endif
       if (large.and. mod(itime,ntwe).eq.0) &
           call enerprint(energia_long)
 #ifdef TIMING_ENE
index 0e022a0..21be40d 100644 (file)
@@ -1,11 +1,11 @@
 ! DO NOT EDIT THIS FILE - IT HAS BEEN GENERATED BY COMPINFO.C
-! 0 40376 77
+! 0 40376 81
       subroutine cinfo
 !      include 'COMMON.IOUNITS'
       use io_units
       write(iout,*)'++++ Compile info ++++'
-      write(iout,*)'Version 0.40376 build 77'
-      write(iout,*)'compiled Mon Apr 17 12:44:50 2017'
+      write(iout,*)'Version 0.40376 build 81'
+      write(iout,*)'compiled Wed Apr 19 12:39:43 2017'
       write(iout,*)'compiled by adam@piasek4'
       write(iout,*)'OS name:    Linux '
       write(iout,*)'OS release: 3.2.0-124-generic '