Commit new changes 10/26/14
[unres.git] / source / unres / src_MD / MREMD.F
index 9ddb9e9..0e4045f 100644 (file)
@@ -782,6 +782,7 @@ ctime            call flush(iout)
                remd_t_bath(i)=remd_ene(n_ene+1,i)
                iremd_iset(i)=remd_ene(n_ene+2,i)
             enddo
+#ifdef DEBUG
             if(lmuca) then
 co             write(iout,*) 'REMD exchange temp,ene,elow,ehigh'
              do i=1,nodes
@@ -795,20 +796,27 @@ co             write(iout,*) 'REMD exchange temp,ene,elow,ehigh'
                 write(iout,'(6f12.5)') (remd_ene(j,i),j=1,n_ene)
               enddo
             endif
+#endif
 c-------------------------------------           
            IF(.not.usampl.and.hremd.eq.0) THEN
+#ifdef DEBUG
             write (iout,*) "Enter exchnge, remd_m",remd_m(1),
      &        " nodes",nodes
 ctime            call flush(iout)
             write (iout,*) "remd_m(1)",remd_m(1)
+#endif
             do irr=1,remd_m(1)
                i=ifirst(iran_num(1,remd_m(1)))
+#ifdef DEBUG
              write (iout,*) "i",i
+#endif
 ctime             call flush(iout)
 
              do ii=1,nodes-1
 
+#ifdef DEBUG
               write (iout,*) "i",i," nupa(0,i)",int(nupa(0,i))
+#endif
              if(i.gt.0.and.nupa(0,i).gt.0) then
               iex=i
 c              if (i.eq.1 .and. int(nupa(0,i)).eq.1) then
@@ -1820,6 +1828,7 @@ ctime        call flush(iout)
       integer*2 i_index
      &            (maxprocs/4,maxprocs/20,maxprocs/200,maxprocs/200)
       common /przechowalnia/ d_restart1
+      integer i2set_(0:maxprocs)
       write (*,*) "Processor",me," called read1restart"
 
          if(me.eq.king)then
@@ -1978,13 +1987,16 @@ c     &                (d_restart1(j,i+2*nres*il),j=1,3)
               enddo
              endif
 #endif
-              call mpi_scatter(i2set,1,mpi_integer,
-     &           iset,1,mpi_integer,king,
-     &           CG_COMM,ierr) 
-
+c Corrected AL 8/19/2014: each processor needs whole iset array not only its
+c own element
+c              call mpi_scatter(i2set,1,mpi_integer,
+c     &           iset,1,mpi_integer,king,
+c     &           CG_COMM,ierr) 
+              call mpi_bcast(i2set(0),nodes,mpi_integer,king,
+     &         CG_COMM,ierr)
+              iset=i2set(me)
            endif
 
-
         if(me.eq.king) close(irest2)
         return
         end