xdrf2pdb-m-mult time t_bath printout
[unres.git] / source / unres / src_MD / MD_A-MTS.F
index 29e4fcb..a785ef0 100644 (file)
@@ -1096,7 +1096,7 @@ c Backup the coordinates, velocities, and accelerations
 
        if(tnp .or. tnp1) then
 #ifndef G77
-        write (iout,'(a3,7f)') "TTT",EK,s_np,potE,pi_np,Csplit,
+        write (iout,'(a3,7f20.10)') "TTT",EK,s_np,potE,pi_np,Csplit,
      &                          E_long,energia_short(0)
 #else
         write (iout,'(a3,7f20.10)') "TTT",EK,s_np,potE,pi_np,Csplit,
@@ -1806,6 +1806,7 @@ c      rest2name = prefix(:ilen(prefix))//'.rst'
          write (iout,'(i3,3f10.5,3x,3f10.5)') i,(d_t(j,i),j=1,3),
      &   (d_t(j,i+nres),j=1,3)
        enddo                    
+       call flush(iout)
 c  Zeroing the total angular momentum of the system
        write(iout,*) "Calling the zero-angular 
      & momentum subroutine"
@@ -1823,10 +1824,36 @@ c Removing the velocity of the center of mass
       if(me.eq.king.or..not.out1file)then
        write (iout,*) "vcm right after adjustment:"
        write (iout,*) (vcm(j),j=1,3) 
+       call flush(iout)
       endif
       if (.not.rest) then              
+         if (start_from_model) then
+          i_model=iran_num(1,constr_homology)
+          write (iout,*) 'starting from model ',i_model
+          do i=1,2*nres
+           do j=1,3
+            c(j,i)=chomo(j,i,i_model)
+           enddo
+          enddo
+
+          call int_from_cart(.true.,.false.)
+          call sc_loc_geom(.false.)
+          do i=1,nres-1
+            do j=1,3
+             dc(j,i)=c(j,i+1)-c(j,i)
+             dc_norm(j,i)=dc(j,i)*vbld_inv(i+1)
+            enddo
+          enddo
+          do i=2,nres-1
+            do j=1,3
+             dc(j,i+nres)=c(j,i+nres)-c(j,i)
+             dc_norm(j,i+nres)=dc(j,i+nres)*vbld_inv(i+nres)
+            enddo
+          enddo
+         endif
          call chainbuild
-         if(iranconf.ne.0) then
+         write (iout,*) "PREMINIM ",preminim
+         if(iranconf.ne.0 .or. preminim) then
           if (overlapsc) then 
            print *, 'Calling OVERLAP_SC'
            call overlap_sc(fail)
@@ -1848,14 +1875,18 @@ c Removing the velocity of the center of mass
            call minimize(etot,varia,iretcode,nfun)
            call var_to_geom(nvar,varia)
           endif
-          if(me.eq.king.or..not.out1file)
-     &       write(iout,*) 'SUMSL return code is',iretcode,' eval ',nfun
+          if(me.eq.king.or..not.out1file) then
+             write(iout,*) "Minimized energy is",etot
+             write(iout,*) 'SUMSL return code is',iretcode,' eval ',nfun
+             call etotal(potEcomp)
+             call enerprint(potEcomp)
+          endif
          endif
       endif      
       call chainbuild_cart
       call kinetic(EK)
       if (tbf) then
-        call verlet_bath(EK)
+        call verlet_bath
       endif      
       kinetic_T=2.0d0/(dimen3*Rb)*EK
       if(me.eq.king.or..not.out1file)then
@@ -1907,7 +1938,7 @@ c Removing the velocity of the center of mass
       call cartgrad
       call lagrangian
       call max_accel
-      if (amax*d_time .gt. dvmax) then
+      if (.not.RESPA .and. amax*d_time .gt. dvmax) then
         d_time=d_time*dvmax/amax
         if(me.eq.king.or..not.out1file) write (iout,*) 
      &   "Time step reduced to",d_time,
@@ -2078,6 +2109,7 @@ c          write (iout,*) "i",i," ii",ii," geigen",geigen(i),
 c     &      " d_t_work_new",d_t_work_new(ii)
         enddo
       enddo
+      call flush(iout)
 c diagnostics
 c      Ek1=0.0d0
 c      ii=0
@@ -2116,6 +2148,7 @@ c Transfer to the d_t vector
 c      do i=0,nres-1
 c        write (iout,*) "d_t",i,(d_t(j,i),j=1,3)
 c      enddo
+c      call flush(iout)
       do i=nnt,nct
         if (itype(i).ne.10) then
           do j=1,3