update
[unres.git] / source / wham / src-M-SAXS-homology / read_constr_homology.F
index 2ed24e7..ebd23a9 100644 (file)
@@ -34,7 +34,7 @@ c    &    sigma_odl_temp(maxres,maxres,max_template)
       logical lprn /.true./
       integer ilen
       external ilen
-      logical unres_pdb,liiflag
+      logical liiflag
 c
 c     FP - Nov. 2014 Temporary specifications for new vars
 c
@@ -63,12 +63,12 @@ c Alternative: reading from input
       if (homol_nset.gt.1)then
          call card_concat(controlcard,.true.)
          read(controlcard,*) (waga_homology(i),i=1,homol_nset) 
-         if(me.eq.king .or. .not. out1file .and. fg_rank.eq.0) then
-          write(iout,*) "iset homology_weight "
+c         if(me.eq.king .or. .not. out1file .and. fg_rank.eq.0) then
+c          write(iout,*) "iset homology_weight "
 c         do i=1,homol_nset
 c          write(iout,*) i,waga_homology(i)
 c         enddo
-         endif
+c         endif
          iset=mod(kolor,homol_nset)+1
       else
        iset=1
@@ -141,7 +141,13 @@ c
         tpl_k_rescore="template"//kic2//".sco"
 
         unres_pdb=.false.
-        call readpdb
+        if (read2sigma) then
+          call readpdb_template(k)
+        else
+          call readpdb
+        endif
+
+c        call readpdb
         do i=1,2*nres
           do j=1,3
             crefjlee(j,i)=c(j,i)
@@ -152,9 +158,9 @@ c
           write (iout,'(i5,3f8.3,5x,3f8.3)') i,(crefjlee(j,i),j=1,3),
      &      (crefjlee(j,i+nres),j=1,3)
         enddo
-#endif
         write (iout,*) "read_constr_homology: after reading pdb file"
         call flush(iout)
+#endif
 
 c
 c     Distance restraints
@@ -411,7 +417,7 @@ c Print restraints
 c
       if (.not.lprn) return
 cd      write(iout,*) "waga_theta",waga_theta,"waga_d",waga_d
-      if(me.eq.king .or. .not. out1file .and. fg_rank.eq.0) then
+c      if(me.eq.king .or. .not. out1file .and. fg_rank.eq.0) then
        write (iout,*) "Distance restraints from templates"
        do ii=1,lim_odl
        write(iout,'(3i5,100(2f8.2,1x,l1,4x))') 
@@ -437,7 +443,7 @@ cd      write(iout,*) "waga_theta",waga_theta,"waga_d",waga_d
      &  (xxtpl(ki,i),yytpl(ki,i),zztpl(ki,i),
      &   1.0d0/dsqrt(sigma_d(ki,i)),ki=1,constr_homology)
        enddo
-      endif
+c      endif
 c -----------------------------------------------------------------
       return
       end
@@ -452,6 +458,7 @@ c----------------------------------------------------------------------
 #endif
       include 'COMMON.SETUP'
       include 'COMMON.CONTROL'
+      include 'COMMON.HOMOLOGY'
       include 'COMMON.CHAIN'
       include 'COMMON.IOUNITS'
       include 'COMMON.GEO'
@@ -470,7 +477,7 @@ c----------------------------------------------------------------------
       logical lprn /.true./
       integer ilen
       external ilen
-      logical unres_pdb,liiflag
+      logical liiflag
 c
 c
       double precision rescore_tmp,x12,y12,z12,rescore2_tmp
@@ -483,7 +490,6 @@ c For new homol impl
 c
       include 'COMMON.VAR'
 c
-      double precision chomo(3,maxres2+2,max_template)
       call getenv("FRAGFILE",fragfile) 
       open(ientin,file=fragfile,status="old",err=10)
       read(ientin,*) constr_homology,nclust
@@ -503,12 +509,12 @@ c Read pdb files
         stop
   34    continue
         unres_pdb=.false.
-        call readpdb
-        do i=1,2*nres
-          do j=1,3
-            chomo(j,i,k)=c(j,i)
-          enddo
-        enddo
+        call readpdb_template(k)
+c        do i=1,2*nres
+c          do j=1,3
+c            chomo(j,i,k)=c(j,i)
+c          enddo
+c        enddo
         do i=1,nres
           rescore(k,i)=0.2d0
           rescore2(k,i)=1.0d0
@@ -698,7 +704,12 @@ c
          enddo
         enddo
       endif
-
+#ifdef DEBUG
+      write (iout,*) "ires_homo and jres_homo arrays, lim_odl",lim_odl
+      do i=1,lim_odl
+        write (iout,*) i,ires_homo(i),jres_homo(i)
+      enddo
+#endif
       return
-   10 stop "Error infragment file"
+   10 stop "Error in fragment file"
       end