C C $Id: resstep.F,v 1.7 1998/07/16 16:40:39 jjv5 Exp arjan $ C C------------------------------------------------------------------------ subroutine resstep(ires,movedres,ok) C acceptance / rejection criteria for MC NVT ensemble implicit double precision (a-h,o-z) #include "divcon.dim" #include "divcon.h" C parameter: ok == .true. if accepted, false if rejected logical ok dimension ires(maxres) CCC------------------------------------------------------CCC ok = .false. ntry = ntry + 1 denth = etot-etotmc if (smartmc) then C . more complex acceptance criterion: C . see Allen &Tildesley page 225 sumt = 0.0 wt = 0.0 do i=1,movedres ir = ires(i) C . calculate force on residue jbeg = irpnt(ir) jend = irpnt(ir+1)-1 irx = 3*ir-2 iry = irx+1 irz = iry+1 rforc(irx) = 0.0 rforc(iry) = 0.0 rforc(irz) = 0.0 do j=jbeg,jend j3 = 3*j-2 rforc(irx) = rforc(irx) - grad(j3) rforc(iry) = rforc(iry) - grad(j3+1) rforc(irz) = rforc(irz) - grad(j3+2) enddo ir3 = 3*ir-3 do j=1,3 r2 = rforc(ir3+j) r1 = rforcmc(ir3+j) sumt = sumt + (r2+r1)*drx(ir3+j) d = r2-r1 wt = wt + d*d + 2.0*r1*d enddo enddo C . wt in eV wt = 0.25*smarta*wt + sumt/46.122 delta = boltzt*(denth+wt) else C . delta is in eV delta = boltzt*denth endif if (delta .lt. 75.0) then if (delta .le. 0.0) then ok = .true. elseif (exp(-delta) .gt. xrandom(iseed)) then ok = .true. endif endif end