changes in ions
[unres4.git] / source / unres / MREMD.F90
index 87953ac..3416526 100644 (file)
@@ -85,7 +85,7 @@
 
       real(kind=8) :: remd_t_bath(Nprocs) !(maxprocs)
       integer :: iremd_iset(Nprocs) !(maxprocs)
-      integer(kind=2) :: i_index(Nprocs,Nprocs,Nprocs,Nprocs)
+      integer(kind=2) :: i_index(Nprocs/2,Nprocs/2,Nprocs/10,Nprocs/10)
 ! (maxprocs/4,maxprocs/20,maxprocs/200,maxprocs/200)
       real(kind=8) :: remd_ene(0:n_ene+4,Nprocs) !(0:n_ene+4,maxprocs)
       integer :: iremd_acc(Nprocs),iremd_tot(Nprocs) !(maxprocs)
@@ -94,7 +94,7 @@
 !el      external ilen
       character(len=50) :: tytul
 !el      common /gucio/ cm
-      integer :: itime
+!      integer :: itime
 !old      integer nup(0:maxprocs),ndown(0:maxprocs)
       integer :: rep2i(0:Nprocs),ireqi(Nprocs) !(maxprocs)
       integer :: icache_all(Nprocs) !(maxprocs)
                  econstr_temp_iex
       integer :: k,il,il1,i,j,nharp,ii,ierr,itime_master,irr,iex,&
             i_set_temp,itmp,i_temp,i_mult,i_iset,i_mset,i_dir,i_temp1,&
-            i_mult1,i_iset1,i_mset1,ierror
+            i_mult1,i_iset1,i_mset1,ierror,itime
       integer,dimension(4,nres/3) :: iharp     !(4,nres/3)(4,maxres/3)
 !deb      imin_itime_old=0
       integer :: nres2 !el
       tt0=tcpu()
 #endif
       itime=0
+      itime_mat=itime
       end_of_run=.false.
 
       do while(.not.end_of_run)
         itime=itime+1
+        itime_mat=itime
         if(itime.eq.n_timestep.and.me.eq.king) end_of_run=.true.
         if(mremdsync.and.itime.eq.n_timestep) end_of_run=.true.
         rstcount=rstcount+1
           stop
 #endif
         endif
+        itime_mat=itime
         if(ntwe.ne.0) then
           if (mod(itime,ntwe).eq.0) then
               call statout(itime)
               ugamma_cache(i,ntwx_cache)=ugamma(i)
               uscdiff_cache(i,ntwx_cache)=uscdiff(i)
             enddo
-!            call returnbox
+            call returnbox
             do i=1,nres*2
              do j=1,3
               c_cache(j,i,ntwx_cache)=c(j,i)
            synflag=.true.
            if (me.eq.king .or. .not. out1file) &
             write(iout,*) 'REMD synchro at1',itime,ntwx_cache,Nprocs,nodes
-!!!!!! TRIAL OF MINIM SYNC
-            if (me.eq.king) then
-           do i=1,nodes-1
-              call mpi_isend(itime,1,MPI_INTEGER,i,101, &
-                                      CG_COMM, ireqi(i), ierr)
-!d            write(iout,*) 'REMD synchro with',i
-!d            call flush(iout)
-           enddo
-           call mpi_waitall(nodes-1,ireqi,statusi,ierr)
-           call mpi_barrier(CG_COMM, ierr)
-           time01=MPI_WTIME()
-            endif
+!!!!!!! TRIAL OF MINIM SYNC
+!            if (me.eq.king) then
+!           do i=1,nodes-1
+!              call mpi_isend(itime,1,MPI_INTEGER,i,101, &
+!                                      CG_COMM, ireqi(i), ierr)
+!!d            write(iout,*) 'REMD synchro with',i
+!!d            call flush(iout)
+!           enddo
+!           call mpi_waitall(nodes-1,ireqi,statusi,ierr)
+!           call mpi_barrier(CG_COMM, ierr)
+!           time01=MPI_WTIME()
+!            endif
 !!!!!!!!!!!!!!!!
-           if (me.ne.king) then
-               call mpi_recv(itime_master, 1, MPI_INTEGER,&
-                                   0,101,CG_COMM, status, ierr)
-               call mpi_barrier(CG_COMM, ierr)
+!           if (me.ne.king) then
+!               call mpi_recv(itime_master, 1, MPI_INTEGER,&
+!                                   0,101,CG_COMM, status, ierr)
+!               call mpi_barrier(CG_COMM, ierr)
 !deb               if (out1file.or.traj1file) then
 !
-            endif
+!            endif
             write(iout,*) icache_all
             if(traj1file) then
               write(iout,*) "before mpi_gather ntwx_cache"