src-M MREMD LANG correction
[unres.git] / source / unres / src_MD-M / MREMD.F
index b3db8ab..96b9109 100644 (file)
@@ -1,4 +1,4 @@
-#define DEBUG
+c#define DEBUG
       subroutine MREMD
       implicit real*8 (a-h,o-z)
       include 'DIMENSIONS'
@@ -700,13 +700,14 @@ c Update the time safety limiy
             safety=time001-time00+600
             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()
            synflag=.false.
 
-           write(iout,*) 'REMD before',me,t_bath
+c           write(iout,*) 'REMD before',me,t_bath
 
 c           call mpi_gather(t_bath,1,mpi_double_precision,
 c     &             remd_t_bath,1,mpi_double_precision,king,
@@ -1273,6 +1274,18 @@ co     &    " rescaling weights with temperature",t_bath
            stdfsc(i)=dsqrt(2*Rb*t_bath/d_time)
          enddo
 
+c Compute the standard deviations of stochastic forces for Langevin dynamics
+c if the friction coefficients do not depend on surface area
+      if (lang.gt.0 .and. .not.surfarea) then
+        do i=nnt,nct-1
+          stdforcp(i)=stdfp*dsqrt(gamp)
+        enddo
+        do i=nnt,nct
+          if (itype(i).ne.ntyp1) stdforcsc(i)=stdfsc(iabs(itype(i)))
+     &                *dsqrt(gamsc(iabs(itype(i))))
+        enddo
+      endif
+
 cde         write(iout,*) 'REMD after',me,t_bath
            time08=MPI_WTIME()
            if (me.eq.king .or. .not. out1file) then