cleaning - unecessary files deleted
[unres.git] / source / unres / src_CSA / together.F
index 558dbad..5737b48 100644 (file)
@@ -210,6 +210,8 @@ c Output to $mol.reminimized
        if (irestart.eq.1) goto 111
 c  soldier - perform energy minimization
  334   call minim_jlee
+
+
       ENDIF
 
 ccccccccccccccccccccccccccccccccccc
@@ -309,12 +311,17 @@ c
 
       call find_max
       call find_min
-
-      call get_diff
+      if (tm_score) then
+       call get_diff_p
+      else
+       call get_diff
+      endif
       if(nbank.eq.nconf.and.irestart.eq.0) then
        adif=avedif
       endif
 
+      write (iout,*) "AVEDIF",avedif
       cutdif=adif/cut1
       ctdif1=adif/cut2
 
@@ -401,6 +408,27 @@ ct            print *,'waiting ',MPI_WTIME()
             irecv=irecv+1
             call recv(0,ifrom,xout,eout,ind,timeout)
 ct            print *,'   ',irecv,' received from',ifrom,MPI_WTIME()
+
+            if(tm_score) then
+              nft=nft+ind(3)
+              movernx(irecv)=iabs(ind(5))
+              call getx(ind,xout,eout,cout,rad,iw_pdb,irecv)
+              if(vdisulf) then
+               nss_out(irecv)=nss
+               do i=1,nss
+                iss_out(i,irecv)=ihpb(i)
+                jss_out(i,irecv)=jhpb(i)  
+               enddo
+              endif
+              if(iw_pdb.gt.0) 
+     &          call write_csa_pdb(xout,eout,nft,irecv,iw_pdb)
+            endif
+
+            if(tm_score.and.eout(1).lt.ebmax) then
+             if(iref.eq.0   .or.
+     &         (rmsn(irecv).le.rmscut.and.pncn(irecv).ge.pnccut))
+     &         call refresh_bank_master_tmscore(ifrom,eout(1),irecv)
+            endif
        else
             ifrom=ifrom+1
        endif
@@ -410,7 +438,7 @@ ct            print *,'sending to',ifrom,MPI_WTIME()
 ct            print *,isent,' sent ',MPI_WTIME()
 
 c store results -----------------------------------------------
-       if (isent.ge.nodes.or.iter.gt.0)  then
+       if ((isent.ge.nodes.or.iter.gt.0).and..not.tm_score)  then
          nft=nft+ind(3)
          movernx(irecv)=iabs(ind(5))
          call getx(ind,xout,eout,cout,rad,iw_pdb,irecv)
@@ -443,7 +471,18 @@ c--------------------------------------------------------------
               iter=iter+1
 c----------------- call update(ntry-nodes+1) -------------------
               nstep=nstep+ntry-nseed-(nodes-1)
-              call refresh_bank(ntry-nodes+1)
+              if (tm_score) then
+ctm               call refresh_bank(ntry)
+               call print_mv_stat
+                  do i=0,mxmv
+                   do j=1,3
+                    nstatnx_tot(i,j)=nstatnx_tot(i,j)+nstatnx(i,j)
+                    nstatnx(i,j)=0
+                   enddo
+                  enddo
+              else
+               call refresh_bank(ntry-nodes+1)
+              endif
 c!bankt              call refresh_bankt(ntry-nodes+1)
            else
 c----------------- call update(ntry) ---------------------------
@@ -451,7 +490,18 @@ c----------------- call update(ntry) ---------------------------
               print *,'UPDATING ',ntry,irecv
               write(iout,*) 'UPDATING ',ntry
               nstep=nstep+ntry-nseed
-              call refresh_bank(ntry)
+              if (tm_score) then
+ctm               call refresh_bank(ntry)
+               call print_mv_stat
+                  do i=0,mxmv
+                   do j=1,3
+                    nstatnx_tot(i,j)=nstatnx_tot(i,j)+nstatnx(i,j)
+                    nstatnx(i,j)=0
+                   enddo
+                  enddo
+              else
+               call refresh_bank(ntry)
+              endif
 c!bankt              call refresh_bankt(ntry)
            endif         
 c----------------------------------------------------------------- 
@@ -611,6 +661,9 @@ c!bankt            call write_bankt(jlee,nft)
            irecv=0
        endif
       ELSE
+       if (tm_score) then
+        call get_diff_p
+       endif
 c  soldier - perform energy minimization
         call minim_jlee
         print *,'End of minim, proc',me,'time ',MPI_WTIME()-time_start
@@ -1206,6 +1259,7 @@ c  halt soldier
 c        print *,'sending halt to ',man
         write(iout,*) 'sending halt to ',man
         info(1)=0
+        info(2)=0
         call mpi_send(info,12,mpi_integer,man,idint,CG_COMM,ierr)
        endif
       return