Adam's unres update
[unres.git] / source / unres / src-HCD-5D / MD_A-MTS.F
index e504cbd..8cebc8f 100644 (file)
@@ -65,6 +65,7 @@ c
       t_enegrad=0.0d0
       t_sdsetup=0.0d0
       write (iout,'(20(1h=),a20,20(1h=))') "MD calculation started"
+      write (iout,*) "Restart frequency:",irest_freq
 #ifdef MPI
       tt0=MPI_Wtime()
 #else
@@ -261,7 +262,7 @@ C          call check_ecartint
              call cartout(totT)
           endif
         endif
-        if (rstcount.eq.1000.or.itime.eq.n_timestep) then
+        if (rstcount.eq.irest_freq.or.itime.eq.n_timestep) then
            open(irest2,file=rest2name,status='unknown')
            write(irest2,*) totT,EK,potE,totE,t_bath
            do i=0,2*nres-1
@@ -290,7 +291,7 @@ C          call check_ecartint
      & '  End of MD calculation  '
 #ifdef TIMING_ENE
       write (iout,*) "time for etotal",t_etotal," elong",t_elong,
-     &  " eshort",t_eshort
+     &  " eshort",t_eshort," list",time_list
       write (iout,*) "time_fric",time_fric," time_stoch",time_stoch,
      & " time_fricmatmult",time_fricmatmult," time_fsample ",
      & time_fsample
@@ -429,7 +430,7 @@ c 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
+        if (potEcomp(0).gt.0.99e20 .or. isnan(potEcomp(0))) then
           d_time=d_time/2
           cycle
         endif
@@ -1672,6 +1673,7 @@ c  Set up the initial conditions of a MD simulation
       double precision etot
       logical fail
       integer i_start_models(0:nodes-1)
+      double precision potEcomp_long(0:Max_Ene)
       write (iout,*) "init_MD INDPDB",indpdb
       d_time0=d_time
 c      write(iout,*) "d_time", d_time
@@ -1810,7 +1812,7 @@ c      rest2name = prefix(:ilen(prefix))//'.rst'
       if(me.eq.king.or..not.out1file)then
        write (iout,*) "Initial velocities"
        do i=0,nres
-         write (iout,'(i3,3f10.5,3x,3f10.5)') i,(d_t(j,i),j=1,3),
+         write (iout,'(i7,3f10.5,3x,3f10.5)') i,(d_t(j,i),j=1,3),
      &   (d_t(j,i+nres),j=1,3)
        enddo
       endif
@@ -2080,6 +2082,7 @@ C 8/22/17 AL Minimize initial structure
       call zerograd
       call etotal(potEcomp)
       if (large) call enerprint(potEcomp)
+      if (RESPA) call etotal_long(potEcomp_long)
 #ifdef TIMING_ENE
 #ifdef MPI
       t_etotal=t_etotal+MPI_Wtime()-tt0
@@ -2092,7 +2095,7 @@ c      write (iout,*) "PotE-homology",potE-potEcomp(27)
       call cartgrad
       call lagrangian
       call max_accel
-      if (amax*d_time .gt. dvmax) then
+      if (amax*d_time .gt. dvmax .and. .not. respa) then
         d_time=d_time*dvmax/amax
         if(me.eq.king.or..not.out1file) write (iout,*) 
      &   "Time step reduced to",d_time,