X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=blobdiff_plain;f=source%2Funres%2Fsrc_MD%2FMREMD.F;h=e443ec7d01e36b139c72ce07b5069fdfa9719aaf;hb=37982ff2ef784ba689f3f1c1cbf3337d9daa0cd9;hp=1a97f1beb288d008ab684043504e22be577727db;hpb=20a997fb0be2fb5ac4cfddc9ffc99f675b5f8ad7;p=unres.git diff --git a/source/unres/src_MD/MREMD.F b/source/unres/src_MD/MREMD.F index 1a97f1b..e443ec7 100644 --- a/source/unres/src_MD/MREMD.F +++ b/source/unres/src_MD/MREMD.F @@ -29,7 +29,7 @@ integer iremd_iset(maxprocs) integer*2 i_index & (maxprocs/4,maxprocs/20,maxprocs/200,maxprocs/200) - double precision remd_ene(0:n_ene+4,maxprocs),t_bath_old + double precision remd_ene(0:n_ene+4,maxprocs),t_bath_old,e_tmp integer iremd_acc(maxprocs),iremd_tot(maxprocs) integer iremd_acc_usa(maxprocs),iremd_tot_usa(maxprocs) integer ilen,rstcount @@ -59,7 +59,7 @@ cdeb imin_itime_old=0 endif mremd_rst_name=prefix(:ilen(prefix))//"_mremd.rst" -cd print *,'MREMD',nodes +cd print *,'MREMD',nodes,homol_nset cd print *,'mmm',me,remd_mlist,(remd_m(i),i=1,nrep) cde write (iout,*) "Start MREMD: me",me," t_bath",t_bath @@ -290,6 +290,11 @@ cd print *,'ttt',me,remd_tlist,(remd_t(i),i=1,nrep) endif if(usampl.or.hremd.gt.0.or.homol_nset.gt.1) then iset=i2set(me) +c broadcast iset to slaves + if (nfgtasks.gt.1) then + call MPI_Bcast(11,1,MPI_INTEGER,king,FG_COMM,IERROR) + call MPI_Bcast(iset,1,MPI_INTEGER,king,FG_COMM,IERROR) + endif if (hremd.gt.0) call set_hweights(iset) if(me.eq.king.or..not.out1file) & write(iout,*) me,"iset=",iset,"t_bath=",t_bath @@ -714,7 +719,8 @@ c Update the time safety limiy if (me.eq.king .or. .not. out1file) & write (iout,*) "****** SAFETY increased to",safety," s" endif - if (ovrtim()) end_of_run=.true. + if (ovrtim() .and. me.eq.king) end_of_run=.true. + call MPI_Bcast(end_of_run,1,MPI_LOGICAL,king,CG_COMM,IERR) endif if(synflag.and..not.end_of_run) then time02=MPI_WTIME() @@ -734,25 +740,61 @@ c write(iout,*) potEcomp(n_ene+1),potEcomp(n_ene+2),iset,nset i_set_temp=iset iset=iset+1 if (homol_nset.gt.1) then - call e_modeller(potEcomp(n_ene+3)) +c broadcast iset to slaves and reduce energy + if (nfgtasks.gt.1) then + call MPI_Bcast(12,1,MPI_INTEGER,king,FG_COMM,IERROR) + call MPI_Bcast(iset,1,MPI_INTEGER,king,FG_COMM,IERROR) + call e_modeller(e_tmp) +c write(iout,*) "iset+1 before reduce",e_tmp + call MPI_Barrier(FG_COMM,IERR) + call MPI_Reduce(e_tmp,potEcomp(n_ene+3),1, + & MPI_DOUBLE_PRECISION,MPI_SUM,king,FG_COMM,IERR) + else + call e_modeller(potEcomp(n_ene+3)) + endif c write(iout,*) "iset+1",potEcomp(n_ene+3) else call EconstrQ potEcomp(n_ene+3)=Uconst endif iset=i_set_temp +c broadcast iset to slaves + if (nfgtasks.gt.1) then + call MPI_Bcast(11,1,MPI_INTEGER,king,FG_COMM,IERROR) + call MPI_Bcast(iset,1,MPI_INTEGER,king,FG_COMM,IERROR) + endif + else + potEcomp(n_ene+3)=0.0 endif if (iset.gt.1) then i_set_temp=iset iset=iset-1 if (homol_nset.gt.1) then - call e_modeller(potEcomp(n_ene+4)) +c broadcast iset to slaves and reduce energy + if (nfgtasks.gt.1) then + call MPI_Bcast(12,1,MPI_INTEGER,king,FG_COMM,IERROR) + call MPI_Bcast(iset,1,MPI_INTEGER,king,FG_COMM,IERROR) + call e_modeller(e_tmp) +c write(iout,*) "iset-1 before reduce",e_tmp + call MPI_Barrier(FG_COMM,IERR) + call MPI_Reduce(e_tmp,potEcomp(n_ene+4),1, + & MPI_DOUBLE_PRECISION,MPI_SUM,king,FG_COMM,IERR) + else + call e_modeller(potEcomp(n_ene+4)) + endif c write(iout,*) "iset-1",potEcomp(n_ene+4) else call EconstrQ potEcomp(n_ene+4)=Uconst endif iset=i_set_temp +c broadcast iset to slaves + if (nfgtasks.gt.1) then + call MPI_Bcast(11,1,MPI_INTEGER,king,FG_COMM,IERROR) + call MPI_Bcast(iset,1,MPI_INTEGER,king,FG_COMM,IERROR) + endif + else + potEcomp(n_ene+4)=0.0 endif endif if(hremd.gt.0) potEcomp(n_ene+2)=iset @@ -1373,10 +1415,17 @@ cd call flush(iout) & CG_COMM,ierr) cd write (iout,*) "After scatter" cd call flush(iout) - if(usampl.or.hremd.gt.0.or.homol_nset.gt.1) - & call mpi_scatter(iremd_iset,1,mpi_integer, + if(usampl.or.hremd.gt.0.or.homol_nset.gt.1) then + call mpi_scatter(iremd_iset,1,mpi_integer, & iset,1,mpi_integer,king, & CG_COMM,ierr) +c 8/31/2015 Correction by AL: send new iset to slaves + if (nfgtasks.gt.1) then + call MPI_Bcast(11,1,MPI_INTEGER,king,FG_COMM,IERROR) + call MPI_Bcast(iset,1,MPI_INTEGER,king,FG_COMM,IERROR) + endif + + endif time07=MPI_WTIME() if (me.eq.king .or. .not. out1file) then @@ -1468,6 +1517,7 @@ c----------------------------------------------------------------------- include 'COMMON.CHAIN' include 'COMMON.SBRIDGE' include 'COMMON.INTERACT' + include 'COMMON.CONTROL' real d_restart1(3,2*maxres*maxprocs),r_d(3,2*maxres), & d_restart2(3,2*maxres*maxprocs) @@ -1868,6 +1918,7 @@ ctime call flush(iout) include 'COMMON.CHAIN' include 'COMMON.SBRIDGE' include 'COMMON.INTERACT' + include 'COMMON.CONTROL' real d_restart1(3,2*maxres*maxprocs),r_d(3,2*maxres), & t5_restart1(5) integer*2 i_index @@ -1955,6 +2006,14 @@ c & (d_restart1(j,i+2*nres*il),j=1,3) #endif enddo enddo +#ifdef DEBUG + write (iout,*) "Conformation read",il + do i=1,nres + write (iout,'(i5,3f10.5,5x,3f10.5)') + & i,(d_restart1(j,i+2*nres*il),j=1,3), + & (d_restart1(j,nres+i+2*nres*il),j=1,3) + enddo +#endif enddo endif call mpi_scatter(d_restart1,3*2*nres,mpi_real, @@ -2039,7 +2098,11 @@ c & CG_COMM,ierr) call mpi_bcast(i2set(0),nodes,mpi_integer,king, & CG_COMM,ierr) iset=i2set(me) - +c broadcast iset to slaves + if (nfgtasks.gt.1) then + call MPI_Bcast(11,1,MPI_INTEGER,king,FG_COMM,IERROR) + call MPI_Bcast(iset,1,MPI_INTEGER,king,FG_COMM,IERROR) + endif endif