subroutine cutoff_violation implicit none include "DIMENSIONS" include "DIMENSIONS.ZSCOPT" #ifdef MPI include "mpif.h" integer IERROR include "COMMON.MPI" #endif include "COMMON.WEIGHTS" include "COMMON.WEIGHTDER" include "COMMON.ENERGIES" include "COMMON.CLASSES" include "COMMON.VMCPAR" include "COMMON.IOUNITS" include "COMMON.COMPAR" C Define local variables include "COMMON.TIME1" integer i,j,k,iprot,ibatch,ib double precision Evar_aux(maxT,maxbatch,maxprot), & Esum_aux(maxT,maxbatch,maxprot),Elowp(maxT,maxbatch,maxprot), & Esum(maxT,maxbatch,maxprot),aux,etot_rel,etot_rel_orig logical lprn lprn=.true. #ifdef DEBUG write (iout,*) "Processor",me,me1," calling CUTOFF_VIOLATION" #endif cutoffviol=.false. do iprot=1,nprot do ibatch=1,natlike(iprot)+2 do ib=1,nbeta(ibatch,iprot) Evar_aux(ib,ibatch,iprot)=0.0d0 Esum_aux(ib,ibatch,iprot)=0.0d0 enddo enddo enddo do iprot=1,nprot #ifdef DEBUG write (iout,*) "Protein",iprot," E_TOTAL ETOT_ORIG EMIN_ORIG" #endif call restore_molinfo(iprot) #ifdef MPI do j=indstart(me1,iprot),indend(me1,iprot) #else do j=1,ntot_work(iprot) #endif do ibatch=1,natlike(iprot)+2 do ib=1,nbeta(ibatch,iprot) aux = betaT(ib,ibatch,iprot) & *(etot_orig(j,iprot)-emin_orig(ib,ibatch,iprot))+ & entfac(j,iprot) if (aux .gt. 50.0d0) then aux=0.0d0 else aux=dexp(-aux) endif etot_rel = e_total(j,iprot)+entfac(j,iprot)/ & betaT(ib,ibatch,iprot)-elowp(ib,ibatch,iprot) etot_rel_orig = etot_orig(j,iprot)+entfac(j,iprot)/ & betaT(ib,ibatch,iprot)-emin_orig(ib,ibatch,iprot) Evar_aux(ib,ibatch,iprot)=Evar_aux(ib,ibatch,iprot)+ & aux*(etot_rel-etot_rel_orig)**2 Esum_aux(ib,ibatch,iprot) = Esum_aux(ib,ibatch,iprot) + aux #ifdef DEBUG write (iout,'(i7,i3,4e15.5)') j,ibatch,e_total(j,iprot), & etot_orig(j,iprot),emin_orig(ib,ibatch,iprot),aux call flush(iout) #endif enddo enddo enddo #ifdef MPI #ifdef DEBUG write (iout,*) "Processor",me,me1," before MPI_REDUCE" write (iout,*) "Evar_aux", & ((Evar_aux(ib,k,iprot),ib=1,nbeta(ibatch,iprot)), & k=1,nbatch(iprot)) call flush(iout) #endif call MPI_Reduce(Evar_aux(1,1,iprot), Evar(1,1,iprot), & (natlike(iprot)+2)*MaxT, MPI_DOUBLE_PRECISION, & MPI_SUM, Master, Comm1, IERROR) call MPI_Reduce(Esum_aux(1,1,iprot), Esum(1,1,iprot), & (natlike(iprot)+2)*MaxT, MPI_DOUBLE_PRECISION, & MPI_SUM, Master, Comm1, IERROR) #ifdef DEBUG write (iout,*) "Processor",me,me1," after MPI_REDUCE" write (iout,*) "Evar_aux", & ((Evar_aux(ib,k,iprot),ib=1,nbeta(ibatch,iprot)), & k=1,nbatch(iprot)) call flush(iout) #endif #endif enddo do iprot=1,nprot do ibatch=1,natlike(iprot)+2 do ib=1,nbeta(ibatch,iprot) #ifdef DEBUG write (iout,*) "ib",ib," ibatch",ibatch," iprot",iprot, & " Evar",Evar(ib,ibatch,iprot)," Esum",Esum(ib,ibatch,iprot) call flush(iout) #endif if (Esum(ib,ibatch,iprot) .gt. 0.0d0) then Evar(ib,ibatch,iprot)=dsqrt(Evar(ib,ibatch,iprot)/ & Esum(ib,ibatch,iprot)) else Evar(ib,ibatch,iprot)=0.0d0 endif if (Evar(ib,ibatch,iprot)*betaT(ib,ibatch,iprot) & .gt.enecut(iprot)-0.5d0*enecut_min(iprot)+1.0D-3) & cutoffviol=.true. #ifdef DEBUG write (iout,*) "iprot",iprot," ibatch",ibatch," beta", & betaT(ib,ibatch,iprot), & " Evar",Evar(ib,ibatch,iprot)," enecut",enecut(iprot), & " cutoffviol",cutoffviol call flush(iout) #endif enddo enddo enddo return end