ctest xdrf2pdb
authorCezary Czaplewski <czarek@chem.univ.gda.pl>
Sat, 14 Mar 2020 18:52:37 +0000 (19:52 +0100)
committerCezary Czaplewski <czarek@chem.univ.gda.pl>
Sat, 14 Mar 2020 18:52:37 +0000 (19:52 +0100)
CMakeLists.txt
source/xdrfpdb/src-M/CMakeLists.txt
source/xdrfpdb/src-M/geomout.F
source/xdrfpdb/src-M/xdrf2pdb-m.F
source/xdrfpdb/src-M/xdrf2pdb.F
source/xdrfpdb/src-M/xdrf2pdb1.f [new file with mode: 0644]
source/xdrfpdb/src-M/xdrf2x1.f [new file with mode: 0644]

index d7e574f..bc36b17 100644 (file)
@@ -175,22 +175,22 @@ find_package (Threads)
 
 add_subdirectory(source/lib/xdrf)
 
-add_subdirectory(source/unres/src_MD)
+#add_subdirectory(source/unres/src_MD)
 
 if(UNRES_WITH_MPI)
-    add_subdirectory(source/unres/src_MD-M)
-    add_subdirectory(source/unres/src_MD_DFA)
+#    add_subdirectory(source/unres/src_MD-M)
+#    add_subdirectory(source/unres/src_MD_DFA)
     add_subdirectory(source/unres/src_CSA)
-    add_subdirectory(source/unres/src_CSA_DiL)
-    add_subdirectory(source/wham/src)
-    add_subdirectory(source/wham/src-M)
-    add_subdirectory(source/cluster/wham/src)
-    add_subdirectory(source/cluster/wham/src-M)
+#    add_subdirectory(source/unres/src_CSA_DiL)
+#    add_subdirectory(source/wham/src)
+#    add_subdirectory(source/wham/src-M)
+#    add_subdirectory(source/cluster/wham/src)
+#    add_subdirectory(source/cluster/wham/src-M)
 endif(UNRES_WITH_MPI)
 
-add_subdirectory(source/unres/src_MIN)
+#add_subdirectory(source/unres/src_MIN)
 add_subdirectory(source/cluster/unres/src)
-add_subdirectory(source/xdrfpdb/src)
+#add_subdirectory(source/xdrfpdb/src)
 add_subdirectory(source/xdrfpdb/src-M)
-add_subdirectory(source/maxlik/src_CSA)
-add_subdirectory(source/unres-dock)
+#add_subdirectory(source/maxlik/src_CSA)
+#add_subdirectory(source/unres-dock)
index 49748e2..2a4ce69 100644 (file)
@@ -16,7 +16,7 @@
 #
 # 9/23/2010 A. Liwo
 #
-# CMake file by D. JagieÅ‚a
+# CMake file by D. Jagie?a
 # 
 
 set(UNRES_XDRF_XDRF2PDB_SRC-M
@@ -61,12 +61,12 @@ set_property(SOURCE ${UNRES_XDRF_PP_SRC-M} PROPERTY COMPILE_DEFINITIONS ${CPPFLA
 #=========================================
 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_target_properties(UNRES_XDRF2PDB_BIN-M PROPERTIES OUTPUT_NAME xdrf2pdb )
 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_target_properties(UNRES_XDRF2PDBM_BIN-M PROPERTIES OUTPUT_NAME xdrf2pdb-m )
 set_property(TARGET UNRES_XDRF2PDBM_BIN-M PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
 
 
@@ -76,3 +76,44 @@ set_property(TARGET UNRES_XDRF2PDBM_BIN-M PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CM
 install(TARGETS UNRES_XDRF2PDB_BIN-M DESTINATION ${CMAKE_INSTALL_PREFIX}/xdrfpdb)
 install(TARGETS UNRES_XDRF2PDBM_BIN-M DESTINATION ${CMAKE_INSTALL_PREFIX}/xdrfpdb)
 
+
+#=========================================
+# TESTS
+#=========================================
+
+
+# Create files needed for tests
+
+file(  COPY ${CMAKE_SOURCE_DIR}/ctest/ala10one.seq
+       DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
+
+file(  COPY ${CMAKE_SOURCE_DIR}/ctest/ala10three.seq 
+       DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
+
+file(  COPY ${CMAKE_SOURCE_DIR}/ctest/1L2Yone.seq
+       DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
+
+file(  COPY ${CMAKE_SOURCE_DIR}/ctest/1L2Ythree.seq
+       DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
+
+file(  COPY ${CMAKE_SOURCE_DIR}/ctest/ala10MD.cx 
+       DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
+
+file(  COPY ${CMAKE_SOURCE_DIR}/ctest/1L2Y_MREMD_MD000.cx 
+       DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
+
+
+# Test xdrf2pdb 
+add_test(NAME XDRF2PDB-one   COMMAND ${CMAKE_BINARY_DIR}/bin/xdrf2pdb one ala10one.seq ala10MD.cx )
+add_test(NAME XDRF2PDB-three COMMAND ${CMAKE_BINARY_DIR}/bin/xdrf2pdb three ala10three.seq ala10MD.cx )
+
+# Test xdrf2pdb-m
+add_test(NAME XDRF2PDB-M-one   COMMAND ${CMAKE_BINARY_DIR}/bin/xdrf2pdb-m one 1L2Yone.seq 1L2Y_MREMD_MD000.cx 32 30 )
+add_test(NAME XDRF2PDB-M-three COMMAND ${CMAKE_BINARY_DIR}/bin/xdrf2pdb-m three 1L2Ythree.seq 1L2Y_MREMD_MD000.cx 32 30 )
+
+# Test xdrf2ang
+#add_test(NAME XDRF2ANG-one   COMMAND ${CMAKE_BINARY_DIR}/bin/xdrf2ang one ala10one.seq ala10MD.cx )
+#add_test(NAME XDRF2ANG-three COMMAND ${CMAKE_BINARY_DIR}/bin/xdrf2ang three ala10three.seq ala10MD.cx )
+
+
+
index e8101a2..4b871b8 100644 (file)
@@ -10,7 +10,8 @@
 c      include 'COMMON.DISTFIT'
 c      include 'COMMON.MD'
       character*50 tytul
-      character*1 chainid(10) /'A','B','C','D','E','F','G','H','I','J'/
+      character*1 chainid(26) /'A','B','C','D','E','F','G','H','I','J',
+     &  'K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'/
       dimension ica(maxres)
       write (iunit,'(3a,1pe15.5)') 'REMARK ',tytul,' ENERGY ',etot
 cmodel      write (iunit,'(a5,i6)') 'MODEL',1
@@ -94,7 +95,7 @@ c      endif
         iatom=iatom+1
         ica(i)=iatom
         iti=itype(i)
-        if (iti.eq.21) then
+        if (iti.eq.ntyp1) then
           ichain=ichain+1
           ires=0
           write (iunit,'(a)') 'TER'
@@ -102,24 +103,25 @@ c      endif
         ires=ires+1
         iatom=iatom+1
         ica(i)=iatom
-        write (iunit,10) iatom,restyp(iti),chainid(ichain),
+        write (iunit,10) iatom,restyp(iti),chainid(1+mod(ichain/2,26)),
      &     ires,(c(j,i),j=1,3)!,vtot(i)
         if (iti.ne.10) then
           iatom=iatom+1
-          write (iunit,20) iatom,restyp(iti),chainid(ichain),
-     &     ires,(c(j,nres+i),j=1,3)!,
+          write (iunit,20) iatom,restyp(iti),
+     &     chainid(1+mod(ichain/2,26)),ires,(c(j,nres+i),j=1,3)
+!,
 !     &      vtot(i+nres)
         endif
         endif
       enddo
       write (iunit,'(a)') 'TER'
       do i=nnt,nct-1
-        if (itype(i).eq.21) cycle
-        if (itype(i).eq.10 .and. itype(i+1).ne.21) then
+        if (itype(i).eq.ntyp1) cycle
+        if (itype(i).eq.10 .and. itype(i+1).ne.ntyp1) then
           write (iunit,30) ica(i),ica(i+1)
-        else if (itype(i).ne.10 .and. itype(i+1).ne.21) then
+        else if (itype(i).ne.10 .and. itype(i+1).ne.ntyp1) then
           write (iunit,30) ica(i),ica(i+1),ica(i)+1
-        else if (itype(i).ne.10 .and. itype(i+1).eq.21) then
+        else if (itype(i).ne.10 .and. itype(i+1).eq.ntyp1) then
           write (iunit,30) ica(i),ica(i)+1
         endif
       enddo
index ec14da2..d2d7d9c 100644 (file)
@@ -85,9 +85,9 @@
 c      print *,"ifreq",ifreq," ntraj",ntraj," itraj",itraj
       open(9,file=pdbfile)
       nnt = 1
-      if (itype(1).eq.21) nnt = 2
+      if (itype(1).eq.ntyp1) nnt = 2
       nct=nres
-      if (itype(nres).eq.21) nct = nres-1
+      if (itype(nres).eq.ntyp1) nct = nres-1
       print *,"nnt",nnt," nct",nct
       call xdrfopen(ixdrf,arg, "r", iret)
       kk = 0
@@ -97,9 +97,9 @@ c      print *,"ifreq",ifreq," ntraj",ntraj," itraj",itraj
        kk = kk + 1
        call xdrffloat(ixdrf, potE, iret)
        call xdrffloat(ixdrf, uconst, iret)
-#ifdef NEWUNRES
-       call xdrffloat(ixdrf, uconst_back, iret)
-#endif
+c#ifdef NEWUNRES
+c       call xdrffloat(ixdrf, uconst_back, iret)
+c#endif
        call xdrffloat(ixdrf, t_bath, iret)
        call xdrfint(ixdrf, nss, iret) 
        do j=1,nss
@@ -107,11 +107,12 @@ c      print *,"ifreq",ifreq," ntraj",ntraj," itraj",itraj
         call xdrfint(ixdrf, jhpb(j), iret)
        enddo
        call xdrfint(ixdrf, nfrag, iret)
+       call xdrfint(ixdrf, iset, iret)
        do i=1,nfrag
         call xdrffloat(ixdrf, qfrag(i), iret)
        enddo
        prec=10000.0
-
+c       print *,'nss=',nss,'nfrag=',nfrag,'iset=',iset
        isize=0
        call xdrf3dfcoord(ixdrf, coord, isize, prec, iret)
 
@@ -137,7 +138,8 @@ c       write (*,'(8f10.5)') ((coord(k,j),k=1,3),j=1,isize)
            enddo
          enddo
          etot=potE
-         write (tytul,'(a,i6)') "Structure",kk
+         write (tytul,'(a1,i6,a8,f6.1,a6,f10.1)') "#",kk," t_bath ",
+     &             t_bath, " time ",time
          call pdbout(etot,tytul,9)
        endif
       enddo
index c87e9ff..503d7d7 100644 (file)
@@ -88,9 +88,9 @@
       endif
       open(9,file=pdbfile)
       nnt = 1
-      if (itype(1).eq.21) nnt = 2
+      if (itype(1).eq.ntyp1) nnt = 2
       nct=nres
-      if (itype(nres).eq.21) nct = nres-1
+      if (itype(nres).eq.ntyp1) nct = nres-1
       print *,"nnt",nnt," nct",nct
       print *,"file",arg
       call xdrfopen(ixdrf,arg, "r", iret)
diff --git a/source/xdrfpdb/src-M/xdrf2pdb1.f b/source/xdrfpdb/src-M/xdrf2pdb1.f
new file mode 100644 (file)
index 0000000..7409d7d
--- /dev/null
@@ -0,0 +1,140 @@
+      implicit real*8 (a-h,o-z)
+      include 'DIMENSIONS'
+      include 'COMMON.CHAIN'
+      include 'COMMON.INTERACT'
+      include 'COMMON.SBRIDGE'
+      real*4 coord(3,1000)
+      real*4 prec,potE,efree,rmsdev
+      real*8 etot
+      character*80 arg,seqfile,pdbfile
+      character*3 sequenc(maxres)
+      character*50 tytul
+      character*8 onethree,cfreq
+      character*8 ucase
+      external ucase
+      logical oneletter
+      integer rescode
+      external rescode
+      logical ilen,iblnk
+      
+      ifreq=1
+      if (iargc().lt.4) then
+        print '(a)',
+     &    "Usage: xdrf2pdb one/three seqfile cxfile conf [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)=rescode(i,sequenc(i),1)
+        enddo
+      else
+        read(1,'(20(a3,1x))',end=11,err=11) (sequenc(i),i=1,maxres)
+   11   continue
+        nres=i
+        print *,"nres",nres
+        do i=1,nres
+          print *,i," ",sequenc(i)
+        enddo
+        print *
+        i=0
+        do while (.not.iblnk(sequenc(i+1)(1:1)))
+          print *,i+1," ",sequenc(i+1)," ",sequenc(i+1)(1:1)
+          i=i+1
+        enddo 
+        nres=i
+        print *,"nres",nres
+        do i=1,nres
+          itype(i)=rescode(i,sequenc(i),0)
+        enddo
+        print *,(itype(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
+      print *,"arg ",arg
+      call getarg(4,cfreq)
+      read (cfreq,*) iconf
+      print *,"iconf",iconf
+      if (iargc().gt.4) then
+        call getarg(5,pdbfile)
+      else
+        pdbfile=arg(:iext)//'.pdb'
+      endif
+      open(9,file=pdbfile)
+      nnt = 1
+      if (itype(1).eq.21) nnt = 2
+      nct=nres
+      if (itype(nres).eq.21) nct = nres-1
+c      if (nct.eq.nres-1) nres=nres-1
+c      if (nnt.eq.2) nres=nres-1
+
+      print *,"nres",nres," nnt",nnt," nct",nct
+
+      call xdrfopen(ixdrf,arg, "r", iret)
+      print *,"iret",iret 
+      kk = 0
+      do while(.true.) 
+       prec=10000.0
+       isize=0
+       call xdrf3dfcoord(ixdrf, coord, isize, prec, iret)
+       call xdrfint(ixdrf, nss, iret) 
+       do j=1,nss
+        call xdrfint(ixdrf, ihpb(j), iret)
+        call xdrfint(ixdrf, jhpb(j), iret)
+       enddo
+       call xdrffloat(ixdrf, potE, iret)
+       if(iret.eq.0) exit
+       kk = kk + 1
+       call xdrffloat(ixdrf, efree, iret)
+       call xdrffloat(ixdrf, rmsdev, iret)
+       call xdrfint(ixdrf, iscor, iret)
+       if (kk.eq.iconf) then
+         print *,"pote",pote," efree",efree," rmsdev",rmsdev
+
+         print *,"isize",isize
+
+         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)
+         stop
+       endif
+      enddo
+     
+      end
diff --git a/source/xdrfpdb/src-M/xdrf2x1.f b/source/xdrfpdb/src-M/xdrf2x1.f
new file mode 100644 (file)
index 0000000..53f8fb0
--- /dev/null
@@ -0,0 +1,67 @@
+      implicit real*8 (a-h,o-z)
+      integer ihpb(100),jhpb(100)
+      real*4 coord(3,1000)
+      real*4 prec,potE,efree,rmsdev,qfrag(100)
+      real*8 etot
+      character*80 arg,xfile
+      character*8 ucase,cfreq
+      external ucase
+      logical oneletter
+      integer rescode
+      external rescode
+      
+      ifreq=1
+      if (iargc().lt.2) then
+        print '(a)',
+     &    "Usage: xdrf2x1 cxfile conf [pdbfile]"
+        stop
+      endif
+      call getarg(1,arg)
+      iext = index(arg,'.cx') - 1
+      if (iext.lt.0) then
+        print *,"Error - not a cx file"
+        stop
+      endif
+      print *,"arg ",arg
+      call getarg(2,cfreq)
+      read (cfreq,*) iconf
+      print *,"iconf",iconf
+      if (iargc().gt.2) then
+        call getarg(3,pdbfile)
+      else
+        xfile=arg(:iext)//'.x'
+      endif
+      open(9,file=xfile)
+
+      call xdrfopen(ixdrf,arg, "r", iret)
+      print *,"iret",iret 
+      kk = 0
+      do while(.true.) 
+       prec=10000.0
+       isize=0
+       call xdrf3dfcoord(ixdrf, coord, isize, prec, iret)
+       call xdrfint(ixdrf, nss, iret) 
+       do j=1,nss
+        call xdrfint(ixdrf, ihpb(j), iret)
+        call xdrfint(ixdrf, jhpb(j), iret)
+       enddo
+       call xdrffloat(ixdrf, potE, iret)
+       if(iret.eq.0) exit
+       kk = kk + 1
+       call xdrffloat(ixdrf, efree, iret)
+       call xdrffloat(ixdrf, rmsdev, iret)
+       call xdrfint(ixdrf, iscor, iret)
+       if (kk.eq.iconf) then
+         print *,"pote",pote," efree",efree," rmsdev",rmsdev
+
+         print *,"isize",isize
+
+         write (9,'(e15.8,2e15.5,f12.5,$)') time,potE,uconst,t_bath
+         write (9,'(i4,$)') nss,(ihpb(j),jhpb(j),j=1,nss)
+         write (9,'(i4,20f7.4)') nfrag,(qfrag(i),i=1,nfrag)
+         write (9,'(8f10.5)') ((coord(k,j),k=1,3),j=1,isize)
+         stop
+       endif
+      enddo
+     
+      end