adding ename to statout with PRINT_COMPON
[unres.git] / source / unres / src_MD / geomout.F
index 460b7be..2c143b7 100644 (file)
@@ -369,6 +369,124 @@ c-----------------------------------------------------------------
 #endif
       return
       end
+c-----------------------------------------------
+      subroutine read_cx(ixdrf,*)
+c     xdrfopen should be called before this subroutine
+      implicit real*8 (a-h,o-z)
+      include 'DIMENSIONS'
+#ifdef MPI
+      include 'mpif.h'
+      include 'COMMON.SETUP'
+#else
+      parameter (me=0)
+#endif
+      include 'COMMON.CHAIN'
+      include 'COMMON.INTERACT'
+      include 'COMMON.NAMES'
+      include 'COMMON.IOUNITS'
+      include 'COMMON.HEADER'
+      include 'COMMON.SBRIDGE'
+      include 'COMMON.DISTFIT'
+      include 'COMMON.MD'
+      include 'COMMON.LOCAL'
+      double precision time
+      integer iret,itmp
+      real xcoord(3,maxres2+2),prec
+      real r_time,r_potE,r_uconst,r_uconst_back,r_t_bath
+
+
+#ifdef AIX
+c      call xdrfopen_(ixdrf,cartname, "r", iret)
+      call xdrffloat_(ixdrf, r_time, iret)
+      if(iret.eq.0) return1
+
+      call xdrffloat_(ixdrf, r_potE), iret)
+      call xdrffloat_(ixdrf, r_uconst), iret)
+      call xdrffloat_(ixdrf, r_uconst_back), iret)
+      call xdrffloat_(ixdrf, r_t_bath), iret)
+      call xdrfint_(ixdrf, nss, iret) 
+      do j=1,nss
+        call xdrfint_(ixdrf, ihpb(j), iret)
+        call xdrfint_(ixdrf, jhpb(j), iret)
+      enddo
+      call xdrfint_(ixdrf, nfrag+npair+3*nfrag_back, iret)
+      do i=1,nfrag
+        call xdrffloat_(ixdrf, real(qfrag(i)), iret)
+      enddo
+      do i=1,npair
+        call xdrffloat_(ixdrf, real(qpair(i)), iret)
+      enddo
+      do i=1,nfrag_back
+        call xdrffloat_(ixdrf, real(utheta(i)), iret)
+        call xdrffloat_(ixdrf, real(ugamma(i)), iret)
+        call xdrffloat_(ixdrf, real(uscdiff(i)), iret)
+      enddo
+#else
+c      call xdrfopen(ixdrf,cartname, "r", iret)
+      call xdrffloat(ixdrf, r_time, iret)
+      if(iret.eq.0) return1
+
+      call xdrffloat(ixdrf, r_potE, iret)
+      call xdrffloat(ixdrf, r_uconst, iret)
+      call xdrffloat(ixdrf, r_uconst_back, iret)
+      call xdrffloat(ixdrf, r_t_bath, iret)
+      call xdrfint(ixdrf, nss, iret) 
+      do j=1,nss
+        call xdrfint(ixdrf, ihpb(j), iret)
+        call xdrfint(ixdrf, jhpb(j), iret)
+      enddo
+      call xdrfint(ixdrf, nfrag+npair+3*nfrag_back, iret)
+      do i=1,nfrag
+        call xdrffloat(ixdrf, real(qfrag(i)), iret)
+      enddo
+      do i=1,npair
+        call xdrffloat(ixdrf, real(qpair(i)), iret)
+      enddo
+      do i=1,nfrag_back
+        call xdrffloat(ixdrf, real(utheta(i)), iret)
+        call xdrffloat(ixdrf, real(ugamma(i)), iret)
+        call xdrffloat(ixdrf, real(uscdiff(i)), iret)
+      enddo
+#endif
+      prec=10000.0
+
+      itmp=nres+nct-nnt+1
+#ifdef AIX
+      call xdrf3dfcoord_(ixdrf, xcoord, itmp, prec, iret)
+c      call xdrfclose_(ixdrf, iret)
+#else
+      call xdrf3dfcoord(ixdrf, xcoord, itmp, prec, iret)
+c      call xdrfclose(ixdrf, iret)
+#endif
+
+      do i=1,nres
+       do j=1,3
+        c(j,i)=xcoord(j,i)
+       enddo
+      enddo
+      do i=nnt,nct
+       do j=1,3
+        c(j,i+nres)=xcoord(j,nres+i-nnt+1)
+       enddo
+      enddo
+
+      call int_from_cart1(.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
+
+      return
+      end
 #endif
 c-----------------------------------------------------------------
       subroutine statout(itime)
@@ -406,16 +524,30 @@ c-----------------------------------------------------------------
 #endif
        if (refstr) then
          call rms_nac_nnc(rms,frac,frac_nn,co,.false.)
+        if(tnp .or. tnp1 .or. tnh) then
+        write (line1,'(i10,f15.2,3f12.3,f12.6,f7.2,4f6.3,3f12.3,i5,$)')
+     &          itime,totT,EK,potE,totE,hhh,
+     &          rms,frac,frac_nn,co,amax,kinetic_T,t_bath,gyrate(),me
+          format1="a145"
+        else
           write (line1,'(i10,f15.2,3f12.3,f7.2,4f6.3,3f12.3,i5,$)')
      &          itime,totT,EK,potE,totE,
      &          rms,frac,frac_nn,co,amax,kinetic_T,t_bath,gyrate(),me
           format1="a133"
+        endif
+       else
+        if(tnp .or. tnp1 .or. tnh) then
+          write (line1,'(i10,f15.2,7f12.3,f12.6,i5,$)')
+     &           itime,totT,EK,potE,totE,hhh,
+     &           amax,kinetic_T,t_bath,gyrate(),me
+          format1="a126"
         else
           write (line1,'(i10,f15.2,7f12.3,i5,$)')
      &           itime,totT,EK,potE,totE,
      &           amax,kinetic_T,t_bath,gyrate(),me
           format1="a114"
         endif
+       endif
         if(usampl.and.totT.gt.eq_time) then
            write(line2,'(i5,2f9.4,300f7.4)') iset,uconst,uconst_back,
      &      (qfrag(ii1),ii1=1,nfrag),(qpair(ii2),ii2=1,npair),
@@ -430,6 +562,12 @@ c-----------------------------------------------------------------
            line2=' '
         endif
         if (print_compon) then
+          if(itime.eq.0) then
+           write(format,'(a1,a4,a1,a4,a10)') "(",format1,",",format2,
+     &                                                     ",20a12)"
+           write (istat,format) "#","",
+     &      (ename(print_order(i)),i=1,nprint_ene)
+          endif
           write(format,'(a1,a4,a1,a4,a10)') "(",format1,",",format2,
      &                                                     ",20f12.3)"
           write (istat,format) line1,line2,