added xdrfpdb
authorEmilia Lubecka <emilia.lubecka@ug.edu.pl>
Wed, 18 Apr 2018 10:04:31 +0000 (12:04 +0200)
committerEmilia Lubecka <emilia.lubecka@ug.edu.pl>
Wed, 18 Apr 2018 10:04:31 +0000 (12:04 +0200)
source/xdrfpdb/CMakeLists.txt [new file with mode: 0644]
source/xdrfpdb/Makefile [new symlink]
source/xdrfpdb/Makefile_gfortran [new file with mode: 0644]
source/xdrfpdb/Makefile_ifort [new file with mode: 0644]
source/xdrfpdb/xdrf [new symlink]
source/xdrfpdb/xdrf2pdb-m.F90 [new file with mode: 0644]
source/xdrfpdb/xdrf2pdb.F90 [new file with mode: 0644]
source/xdrfpdb/xdrf2x.F90 [new file with mode: 0644]

diff --git a/source/xdrfpdb/CMakeLists.txt b/source/xdrfpdb/CMakeLists.txt
new file mode 100644 (file)
index 0000000..37e6d13
--- /dev/null
@@ -0,0 +1,78 @@
+# Set of programs to convert UNRES xdrf format (compressed Cartesian coordinates) to PDF
+# or raw-Cartesian format (*.x) or to extract backbone angular coordinates (*.ang)
+# The pdb files can be constructed from canonical or MREMD trajectories.
+#
+# The xdrf library is required
+#
+# Programs
+#
+# xdrf2pdb   : converts a single cx trajectory file to PDB format
+# xdrf2x     : converts a single cx trajectory file to raw-coordinate (x) format
+# xdrf2ang   : extracts backbone angles from a cx trajectory file
+# xdrf2pdb-m : converts a selected trajectory of a MREMD run dumpend into a cx file to PDB format
+#
+# xdrf2pdb1  : converts conformation(s) selected from a wham post-processing run into PDB format
+# xdrf2x1    : converts conformation(s) selected from a wham post-processing run into raw (x) format.
+#
+# 9/23/2010 A. Liwo
+#
+# CMake file by D. JagieÅ‚a
+# 
+
+set(UNRES_XDRF_XDRF2PDB_SRC-M
+       xdrf2pdb.F
+       geomout.F
+       misc.f
+       rescode.f
+       nazwy.f
+)
+
+set(UNRES_XDRF_XDRF2PDB-M_SRC-M
+       xdrf2pdb-m.F
+       geomout.F
+       misc.f
+       rescode.f
+       nazwy.f
+)
+
+
+set(UNRES_XDRF_PP_SRC-M
+       geomout.F
+       xdrf2pdb.F
+       xdrf2pdb-m.F
+       xdrf2x.F        
+)
+
+set(CPPFLAGS "PROCOR -DUNRES -DMP -DMPI -DSPLITELE -DNEWUNRES -DXDRFPDB" )
+
+#=========================================
+# System specific flags
+#=========================================
+if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+  set(CPPFLAGS "${CPPFLAGS} -DLINUX")
+endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+
+# Apply preprocesor flags to *.F files
+set_property(SOURCE ${UNRES_XDRF_PP_SRC-M} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )
+
+#=========================================
+# Build the binaries
+#=========================================
+add_executable(UNRES_XDRF2PDB_BIN-M   ${UNRES_XDRF_XDRF2PDB_SRC-M} )
+target_link_libraries(UNRES_XDRF2PDB_BIN-M xdrf )
+set_target_properties(UNRES_XDRF2PDB_BIN-M PROPERTIES OUTPUT_NAME xdrf-M2pdb )
+set_property(TARGET UNRES_XDRF2PDB_BIN-M PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
+
+add_executable(UNRES_XDRF2PDBM_BIN-M ${UNRES_XDRF_XDRF2PDB-M_SRC-M} )
+target_link_libraries( UNRES_XDRF2PDBM_BIN-M xdrf )
+set_target_properties(UNRES_XDRF2PDBM_BIN-M PROPERTIES OUTPUT_NAME xdrf-M2pdb-m )
+set_property(TARGET UNRES_XDRF2PDBM_BIN-M PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
+
+
+#=========================================
+# Install Path
+#=========================================
+install(TARGETS UNRES_XDRF2PDB_BIN-M DESTINATION ${CMAKE_INSTALL_PREFIX}/xdrfpdb)
+install(TARGETS UNRES_XDRF2PDBM_BIN-M DESTINATION ${CMAKE_INSTALL_PREFIX}/xdrfpdb)
+
diff --git a/source/xdrfpdb/Makefile b/source/xdrfpdb/Makefile
new file mode 120000 (symlink)
index 0000000..696c70e
--- /dev/null
@@ -0,0 +1 @@
+Makefile_ifort
\ No newline at end of file
diff --git a/source/xdrfpdb/Makefile_gfortran b/source/xdrfpdb/Makefile_gfortran
new file mode 100644 (file)
index 0000000..f950535
--- /dev/null
@@ -0,0 +1,57 @@
+# Set of programs to convert UNRES xdrf format (compressed Cartesian coordinates) to PDF
+# or raw-Cartesian format (*.x) or to extract backbone angular coordinates (*.ang)
+# The pdb files can be constructed from canonical or MREMD trajectories.
+#
+# The xdrf library is required
+#
+# Programs
+#
+# xdrf2pdb   : converts a single cx trajectory file to PDB format
+# xdrf2x     : converts a single cx trajectory file to raw-coordinate (x) format
+# xdrf2ang   : extracts backbone angles from a cx trajectory file
+# xdrf2pdb-m : converts a selected trajectory of a MREMD run dumpend into a cx file to PDB format
+#
+# xdrf2pdb1  : converts conformation(s) selected from a wham post-processing run into PDB format
+# xdrf2x1    : converts conformation(s) selected from a wham post-processing run into raw (x) format.
+#
+# 9/23/2010 A. Liwo
+
+FC=gfortran
+
+BINDIR = ../../../bin/xdrfpdb
+
+#OPT =  -fast
+OPT = 
+
+FFLAGS = -c ${OPT} 
+
+CPPFLAGS = -DLINUX -DUNRES -DMP -DMPI -DSPLITELE -DPROCOR -DNEWUNRES
+
+M4     = m4
+M4FILE = underscore.m4
+
+.SUFFIXES: .F
+.F.o:
+       ${FC} ${FFLAGS} ${CPPFLAGS} $*.F
+.f.o:
+       ${FC} ${FFLAGS} ${CPPFLAGS} $*.f
+.c.o:
+       ${CC} -c  ${CPPFLAGS} $*.c
+
+xdrf2pdb: xdrf2pdb.o geomout.o misc.o rescode.o nazwy.o xdrf/libxdrf.a
+       ${FC} -Bstatic -o ${BINDIR}/xdrf2pdb-mult xdrf2pdb.o geomout.o rescode.o misc.o nazwy.o xdrf/libxdrf.a
+
+xdrf2pdb1: xdrf2pdb1.o geomout.o misc.o rescode.o nazwy.o xdrf/libxdrf.a
+       ${FC} -Bstatic -o ${BINDIR}/xdrf2pdb1-mult xdrf2pdb1.o geomout.o rescode.o misc.o nazwy.o xdrf/libxdrf.a
+
+xdrf2pdb-m: xdrf2pdb-m.o geomout.o misc.o rescode.o nazwy.o xdrf/libxdrf.a
+       ${FC} -Bstatic -o ${BINDIR}/xdrf2pdb-m-mult xdrf2pdb-m.o geomout.o rescode.o misc.o nazwy.o xdrf/libxdrf.a
+
+xdrf2x: xdrf2x.o xdrf/libxdrf.a
+       ${FC} -o xdrf2x xdrf2x-mult.o xdrf/libxdrf.a
+
+xdrf2x1: xdrf2x1.o xdrf/libxdrf.a
+       ${FC} -o xdrf2x1-mult xdrf2x1.o xdrf/libxdrf.a 
+
+clean:
+       rm -f *.o
diff --git a/source/xdrfpdb/Makefile_ifort b/source/xdrfpdb/Makefile_ifort
new file mode 100644 (file)
index 0000000..d190a1d
--- /dev/null
@@ -0,0 +1,88 @@
+# Set of programs to convert UNRES xdrf format (compressed Cartesian coordinates) to PDF
+# or raw-Cartesian format (*.x) or to extract backbone angular coordinates (*.ang)
+# The pdb files can be constructed from canonical or MREMD trajectories.
+#
+# The xdrf library is required
+#
+# Programs
+#
+# xdrf2pdb   : converts a single cx trajectory file to PDB format
+# xdrf2x     : converts a single cx trajectory file to raw-coordinate (x) format
+# xdrf2ang   : extracts backbone angles from a cx trajectory file
+# xdrf2pdb-m : converts a selected trajectory of a MREMD run dumpend into a cx file to PDB format
+#
+# xdrf2pdb1  : converts conformation(s) selected from a wham post-processing run into PDB format
+# xdrf2x1    : converts conformation(s) selected from a wham post-processing run into raw (x) format.
+#
+# 9/23/2010 A. Liwo
+
+#FC=ifort
+INSTALL_DIR = /users/software/mpich2-1.4.1p1_intel
+FC= ${INSTALL_DIR}/bin/mpif90
+BINDIR = ../../bin
+
+#OPT =  -fast
+OPT = #-CA -CB
+
+FFLAGS = -fpp -c ${OPT} 
+
+CPPFLAGS = -DLINUX -DUNRES -DMP -DMPI -DSPLITELE -DPROCOR -DNEWUNRES -DXDRFPDB
+
+M4     = m4
+M4FILE = underscore.m4
+
+.SUFFIXES: .F90
+.F90.o:
+       ${FC} ${FFLAGS} ${CPPFLAGS} $*.F90
+.f90.o:
+       ${FC} ${FFLAGS} ${CPPFLAGS} $*.f90
+.c.o:
+       ${CC} -c  ${CPPFLAGS} $*.c
+
+DATA_FILE= ../unres/data
+
+data = names.o io_units.o compare_data.o energy_data.o geometry_data.o MD_data.o
+data2 = names.o energy_data.o geometry_data.o
+
+xdrf2pdb: ${data} io_base.o xdrf2pdb.o xdrf/libxdrf.a
+       ${FC} -Bstatic -o ${BINDIR}/xdrf2pdb-mult ${data} io_base.o xdrf2pdb.o xdrf/libxdrf.a
+
+#xdrf2pdb1: xdrf2pdb1.o geomout.o misc.o rescode.o nazwy.o xdrf/libxdrf.a
+#      ${FC} -Bstatic -o ${BINDIR}/xdrf2pdb1-mult xdrf2pdb1.o geomout.o rescode.o misc.o nazwy.o xdrf/libxdrf.a
+
+xdrf2pdb-m: ${data} io_base.o xdrf2pdb-m.o xdrf/libxdrf.a
+       ${FC} -Bstatic -o ${BINDIR}/xdrf2pdb-m-mult ${data} io_base.o xdrf2pdb-m.o xdrf/libxdrf.a
+
+xdrf2x: ${data2} xdrf2x.o xdrf/libxdrf.a
+       ${FC} -o ${BINDIR}/xdrf2x-mult ${data2} xdrf2x.o xdrf/libxdrf.a
+
+#xdrf2x1: xdrf2x1.o xdrf/libxdrf.a
+#      ${FC} -o xdrf2x1-mult xdrf2x1.o xdrf/libxdrf.a 
+
+xdrf/libxdrf.a:
+       cd xdrf && make
+
+clean:
+       rm -f *.o *.mod
+
+
+names.o: ${DATA_FILE}/names.f90
+       ${FC} ${FFLAGS} ${CPPFLAGS} ${DATA_FILE}/names.f90
+
+io_units.o: ${DATA_FILE}/io_units.f90
+       ${FC} ${FFLAGS} ${CPPFLAGS} ${DATA_FILE}/io_units.f90
+
+compare_data.o: ${DATA_FILE}/compare_data.f90
+       ${FC} ${FFLAGS} ${CPPFLAGS} ${DATA_FILE}/compare_data.f90
+
+energy_data.o: ${DATA_FILE}/energy_data.f90
+       ${FC} ${FFLAGS} ${CPPFLAGS} ${DATA_FILE}/energy_data.f90
+
+geometry_data.o: ${DATA_FILE}/geometry_data.f90
+       ${FC} ${FFLAGS} ${CPPFLAGS} ${DATA_FILE}/geometry_data.f90
+
+MD_data.o: ${DATA_FILE}/MD_data.f90
+       ${FC} ${FFLAGS} ${CPPFLAGS} ${DATA_FILE}/MD_data.f90
+
+io_base.o: ../unres/io_base.f90
+       ${FC} ${FFLAGS} ${CPPFLAGS} ../unres/io_base.f90
diff --git a/source/xdrfpdb/xdrf b/source/xdrfpdb/xdrf
new file mode 120000 (symlink)
index 0000000..038166c
--- /dev/null
@@ -0,0 +1 @@
+../xdrf
\ No newline at end of file
diff --git a/source/xdrfpdb/xdrf2pdb-m.F90 b/source/xdrfpdb/xdrf2pdb-m.F90
new file mode 100644 (file)
index 0000000..2fed947
--- /dev/null
@@ -0,0 +1,159 @@
+      program xdrfpdb_m
+!      implicit real*8 (a-h,o-z)
+!      include 'DIMENSIONS'
+!      include 'COMMON.CHAIN'
+!      include 'COMMON.INTERACT'
+!      include 'COMMON.SBRIDGE'
+      use geometry_data, only: nres,c,nfrag
+      use energy_data, only: itype,nnt,nct,nss,ihpb,jhpb,uconst_back
+      use io_base!, only: maxres,ucase,iblnk,rescode,pdbout
+
+      implicit none
+      real(kind=4),allocatable,dimension(:,:) :: coord !(3,2*maxres)
+      real(kind=4) :: prec,time,potE,uconst,t_bath,qfrag(100)
+      real(kind=8) :: etot
+      character(len=80) :: arg,seqfile,pdbfileX
+      character(len=3),allocatable,dimension(:) :: sequenc !(maxres)
+      character(len=50) :: tytul
+      character(len=8) :: onethree,cfreq,cntraj,citraj
+      character(len=3) :: licz
+!      external ucase
+      logical oneletter !,iblnk
+!      integer rescode
+!      external rescode
+      integer :: i,ii,j,k,kk,is,ie,ifreq,mnum,molec,iext,isize
+      integer :: iret,ixdrf,itraj,ntraj
+      
+      ifreq=1
+      nres=0
+      mnum=1
+      molec=1
+      allocate(sequenc(maxres))
+      allocate(itype(maxres,5))
+      if (iargc().lt.5) then
+        print '(2a)',&
+         "Usage: xdrf2pdb-m one/three seqfile cxfile ntraj itraj",&
+         " [pdbfile] [freq]"
+        stop
+      endif
+      call getarg(1,onethree)
+      onethree = ucase(onethree)
+      if (onethree.eq.'ONE') then
+        oneletter = .true.
+      else if (onethree.eq.'THREE') then
+        oneletter = .false.
+      else
+        print *,"ONE or THREE must be specified"
+      endif
+      call getarg(2,seqfile)
+      open (1,file=seqfile,status='old')
+      if (oneletter) then
+        read(1,'(80a1)',end=10,err=10) (sequenc(i)(1:1),i=1,maxres)
+   10   continue
+        nres=i
+        i=0
+        do while (.not.iblnk(sequenc(i+1)(1:1)))
+          i=i+1
+        enddo 
+        nres=i
+        do i=1,nres
+          itype(i,mnum)=rescode(i,sequenc(i),1,molec)
+        enddo
+      else
+        read(1,'(20(a3,1x))',end=11,err=11) (sequenc(i),i=1,maxres)
+   11   continue
+        nres=i
+        i=0
+        do while (.not.iblnk(sequenc(i+1)(1:1)))
+          i=i+1
+        enddo 
+        nres=i
+        do i=1,nres
+          itype(i,mnum)=rescode(i,sequenc(i),0,molec)
+        enddo
+        print *,nres
+        print '(20(a3,1x))',(sequenc(i),i=1,nres)
+      endif
+      call getarg(3,arg)
+      iext = index(arg,'.cx') - 1
+      if (iext.lt.0) then
+        print *,"Error - not a cx file"
+        stop
+      endif
+      call getarg(4,cntraj)
+      read (cntraj,*) ntraj
+      call getarg(5,citraj)
+      read (citraj,*) itraj
+      if (iargc().gt.5) then
+        call getarg(6,pdbfileX)
+      else
+        write(licz,'(bz,i3.3)') itraj
+        pdbfileX=arg(:iext)//'_'//licz//'.pdb'
+      endif
+      if (iargc().gt.6) then
+        call getarg(7,cfreq)
+        read (cfreq,*) ifreq
+      endif
+!      print *,"ifreq",ifreq," ntraj",ntraj," itraj",itraj
+      open(9,file=pdbfileX)
+      nnt = 1
+      if (itype(1,mnum).eq.ntyp1) nnt = 2
+      nct=nres
+      if (itype(nres,mnum).eq.ntyp1) nct = nres-1
+      print *,"nnt",nnt," nct",nct
+      call xdrfopen(ixdrf,arg, "r", iret)
+      kk = 0
+      allocate(coord(3,2*nres))
+      allocate(c(3,2*nres))
+      do while(.true.) 
+       call xdrffloat(ixdrf, time, iret)
+       if(iret.eq.0) exit
+       kk = kk + 1
+       call xdrffloat(ixdrf, potE, iret)
+       call xdrffloat(ixdrf, uconst, iret)
+#ifdef NEWUNRES
+       call xdrffloat(ixdrf, uconst_back, iret)
+#endif
+       call xdrffloat(ixdrf, 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, iret)
+       do i=1,nfrag
+        call xdrffloat(ixdrf, qfrag(i), iret)
+       enddo
+       prec=10000.0
+
+       isize=0
+       call xdrf3dfcoord(ixdrf, coord, isize, prec, iret)
+
+
+!       write (*,'(e15.8,2e15.5,f12.5,$)') time,potE,uconst,t_bath
+!       write (*,'(i4,$)') nss,(ihpb(j),jhpb(j),j=1,nss)
+!       write (*,'(i4,20f7.4)') nfrag,(qfrag(i),i=1,nfrag)
+!       write (*,'(8f10.5)') ((coord(k,j),k=1,3),j=1,isize)
+       if (mod(kk/ntraj,ifreq).eq.0 .and. mod(kk,ntraj).eq.itraj) then
+         if (isize .ne. nres+nct-nnt+1) then
+           print *,"Error: inconsistent sizes",isize,nres+nct-nnt+1
+         endif
+         do i=1,nres
+           do j=1,3
+             c(j,i)=coord(j,i)
+           enddo
+         enddo
+         ii = 0
+         do i=nnt,nct
+           ii = ii + 1 
+           do j=1,3
+             c(j,i+nres)=coord(j,ii+nres)
+           enddo
+         enddo
+         etot=potE
+         write (tytul,'(a,i6)') "Structure",kk
+         call pdbout(etot,tytul,9)
+       endif
+      enddo
+     
+      end
diff --git a/source/xdrfpdb/xdrf2pdb.F90 b/source/xdrfpdb/xdrf2pdb.F90
new file mode 100644 (file)
index 0000000..f211501
--- /dev/null
@@ -0,0 +1,181 @@
+      program xdrfpdb
+!      implicit real*8 (a-h,o-z)
+!      include 'DIMENSIONS'
+!      include 'COMMON.CHAIN'
+!      include 'COMMON.INTERACT'
+!      include 'COMMON.SBRIDGE'
+      use geometry_data, only: nres,c,nfrag
+      use energy_data, only: itype,nnt,nct,nss,ihpb,jhpb,uconst_back
+      use io_base!, only: maxres,ucase,iblnk,rescode,pdbout
+
+      implicit none
+      real(kind=4),allocatable,dimension(:,:) :: coord !(3,2*maxres)
+      real(kind=4) :: prec,time,potE,uconst,t_bath,qfrag(100)
+      real(kind=8) :: etot
+      character(len=80) arg,seqfile,pdbfileX
+      character(len=3),allocatable,dimension(:) :: sequenc !(maxres)
+      character(len=50) tytul
+      character(len=8) onethree,cfreq
+!      external ucase
+      logical :: oneletter
+!      integer rescode
+!      external rescode
+!      logical iblnk
+!      external iblnk
+!el local variables      
+      integer :: i,ii,j,k,kk,is,ie,ifreq,mnum,molec,iext,isize
+      integer :: iret,ixdrf
+
+      ifreq=1
+      is=1
+      ie=1000000000
+      nres=0
+      mnum=1
+      molec=1
+      allocate(sequenc(maxres))
+      allocate(itype(maxres,5))
+!      allocate(c(3,2*maxres+2))
+      if (iargc().lt.3) then
+        print '(2a)',&
+          "Usage: xdrf2pdb one/three seqfile cxfile [freq]",&
+          " [start] [end] [pdbfile]"
+        stop
+      endif
+      call getarg(1,onethree)
+      onethree = ucase(onethree)
+      if (onethree.eq.'ONE') then
+        oneletter = .true.
+      else if (onethree.eq.'THREE') then
+        oneletter = .false.
+      else
+        print *,"ONE or THREE must be specified"
+      endif
+      call getarg(2,seqfile)
+      open (1,file=seqfile,status='old')
+      if (oneletter) then
+        read(1,'(80a1)',end=10,err=10) (sequenc(i)(1:1),i=1,maxres)
+   10   continue
+        nres=i
+        i=0
+        do while (.not.iblnk(sequenc(i+1)(1:1)))
+          i=i+1
+        enddo 
+        nres=i
+        do i=1,nres
+          itype(i,mnum)=rescode(i,sequenc(i),1,molec)
+        enddo
+      else
+        read(1,'(20(a3,1x))',end=11,err=11) (sequenc(i),i=1,maxres)
+   11   continue
+        nres=i
+        i=0
+        do while (.not.iblnk(sequenc(i+1)(1:1)))
+          i=i+1
+        enddo 
+        nres=i
+        do i=1,nres
+          itype(i,mnum)=rescode(i,sequenc(i),0,molec)
+        enddo
+      endif
+      call getarg(3,arg)
+      iext = index(arg,'.cx') - 1
+      if (iext.lt.0) then
+        print *,"Error - not a cx file"
+        stop
+      endif
+      if (iargc().gt.3) then
+        call getarg(4,cfreq)
+        read (cfreq,*) ifreq
+      endif
+      if (iargc().gt.4) then
+        call getarg(5,cfreq)
+        read (cfreq,*) is
+      endif
+      if (iargc().gt.5) then
+        call getarg(6,cfreq)
+        read (cfreq,*) ie
+      endif
+      if (iargc().gt.6) then
+        call getarg(7,pdbfileX)
+      else
+        pdbfileX=arg(:iext)//'.pdb'
+      endif
+      open(9,file=pdbfileX)
+      nnt = 1
+      if (itype(1,mnum).eq.ntyp1) nnt = 2
+      nct=nres
+      if (itype(nres,mnum).eq.ntyp1) nct = nres-1
+      print *,"nnt",nnt," nct",nct," nres",nres
+      print *,"file",arg
+      call xdrfopen(ixdrf,arg, "r", iret)
+      if (iret.eq.0) stop
+      print *,"iret",iret
+      print *,"is",is," ie",ie
+      kk = 0
+      allocate(coord(3,2*nres))
+      allocate(c(3,2*nres))
+      do while(is.eq.0 .or. kk.lt.ie) 
+       call xdrffloat(ixdrf, time, iret)
+       print *,"time",time," iret",iret
+       if(iret.eq.0) exit
+       kk = kk + 1
+       call xdrffloat(ixdrf, potE, iret)
+       call xdrffloat(ixdrf, uconst, iret)
+       print *,"potE",potE," uconst",uconst
+       call xdrffloat(ixdrf, uconst_back, iret)
+       call xdrffloat(ixdrf, t_bath, iret)
+       print *,"t_bath",t_bath
+!#ifdef NEWUNRES
+!#endif
+       print *,"uconst_back",uconst_back
+!       call xdrffloat(ixdrf, t_bath, iret)
+!       print *,"t_bath",t_bath
+       call xdrfint(ixdrf, nss, iret) 
+       do j=1,nss
+        call xdrfint(ixdrf, ihpb(j), iret)
+        call xdrfint(ixdrf, jhpb(j), iret)
+       enddo
+       print *,"nss",nss
+!       call xdrffloat(ixdrf, t_bath, iret)
+!       print *,"t_bath",t_bath
+       call xdrfint(ixdrf, nfrag, iret)
+       do i=1,nfrag
+        call xdrffloat(ixdrf, qfrag(i), iret)
+       enddo
+       print *,"nfrag",nfrag
+       prec=10000.0
+
+       isize=0
+       call xdrf3dfcoord(ixdrf, coord, isize, prec, iret)
+
+
+!       write (*,'(e15.8,2e15.5,f12.5,$)') time,potE,uconst,t_bath
+!       write (*,'(i4,$)') nss,(ihpb(j),jhpb(j),j=1,nss)
+!       write (*,'(i4,20f7.4)') nfrag,(qfrag(i),i=1,nfrag)
+!       write (*,'(8f10.5)') ((coord(k,j),k=1,3),j=1,isize)
+       if (kk.ge.is .and. mod(kk,ifreq).eq.0) then
+         if (isize .ne. nres+nct-nnt+1) then
+           print *,"Error: inconsistent sizes",isize,nres+nct-nnt+1
+         endif
+         do i=1,nres
+           do j=1,3
+             c(j,i)=coord(j,i)
+           enddo
+         enddo
+         ii = 0
+         do i=nnt,nct
+           ii = ii + 1 
+           do j=1,3
+             c(j,i+nres)=coord(j,ii+nres)
+           enddo
+         enddo
+!       do j=1,nres
+!         write (*,'(8f10.5)') (c(k,j),k=1,3),(c(i,j+nres),i=1,3)
+!       enddo
+         etot=potE
+         write (tytul,'(a,i6,a,f8.3)') "Structure",kk,"Temp",t_bath
+         call pdbout(etot,tytul,9)
+       endif
+      enddo
+     
+      end
diff --git a/source/xdrfpdb/xdrf2x.F90 b/source/xdrfpdb/xdrf2x.F90
new file mode 100644 (file)
index 0000000..178a2c7
--- /dev/null
@@ -0,0 +1,83 @@
+      program xdrf2x
+      use geometry_data, only: nfrag
+      use energy_data, only: nss,uconst_back
+
+      implicit none
+      real(kind=4) :: coord(3,2000)
+      real(kind=4) :: prec,time,potE,uconst,t_bath,qfrag(100)
+      integer :: ihpb(100),jhpb(100)
+      character(len=80) :: arg,ctime_start,&!=(/"0"/),&
+                           ctime_end,&!=(/"1000000000"/),&
+                           cfreq!=(/"1"/)
+      real(kind=8) :: time_start,time_end
+      integer :: i,j,k,kk,licz,isize,freq
+      integer :: iret,ixdrf
+      
+      ctime_start="0"
+      ctime_end="1000000000"
+      cfreq="1"
+      call getarg(1,arg)
+      if (iargc().eq.0) stop
+      if (iargc().gt.1) then
+        call getarg(2,ctime_start)
+        read (ctime_start,*) time_start
+      else
+        time_start=0.0d0
+      endif
+      if (iargc().gt.2) then
+        call getarg(3,ctime_end)
+        read (ctime_end,*) time_end
+      else
+        time_end=1.0d10
+      endif
+      if (iargc().gt.3) then
+        call getarg(4,cfreq)
+        read (cfreq,*) freq
+      else
+        freq=1
+      endif
+
+      call xdrfopen(ixdrf,arg, "r", iret)
+       
+      licz=0
+      do while(.true.) 
+       call xdrffloat(ixdrf, time, iret)
+!       print *,"time",time," iret",iret
+       if(iret.eq.0) exit
+       kk = kk + 1
+       call xdrffloat(ixdrf, potE, iret)
+       call xdrffloat(ixdrf, uconst, iret)
+!       print *,"potE",potE," uconst",uconst
+#ifdef NEWUNRES
+       call xdrffloat(ixdrf, uconst_back, iret)
+#endif
+!       print *,"uconst_back",uconst_back
+       call xdrffloat(ixdrf, t_bath, iret)
+!       print *,"t_bath",t_bath
+       call xdrfint(ixdrf, nss, iret) 
+       do j=1,nss
+        call xdrfint(ixdrf, ihpb(j), iret)
+        call xdrfint(ixdrf, jhpb(j), iret)
+       enddo
+!       print *,"nss",nss
+       call xdrfint(ixdrf, nfrag, iret)
+       do i=1,nfrag
+        call xdrffloat(ixdrf, qfrag(i), iret)
+       enddo
+       prec=10000.0
+
+       isize=0
+       call xdrf3dfcoord(ixdrf, coord, isize, prec, iret)
+
+       licz=licz+1
+!       print *,licz,time_start,time_end,freq,mod(licz,freq)
+       if (licz.gt.time_end) exit
+       if (licz.ge.time_start .and. mod(licz,freq).eq.0) then
+       write (*,'(e15.8,2e15.5,f12.5,$)') time,potE,uconst,t_bath
+       write (*,'(i4,$)') nss,(ihpb(j),jhpb(j),j=1,nss)
+       write (*,'(i4,20f7.4)') nfrag,(qfrag(i),i=1,nfrag)
+       write (*,'(8f10.5)') ((coord(k,j),k=1,3),j=1,isize)
+       endif
+      enddo
+     
+      end