C C $Id: rottr.F,v 1.4 1998/07/16 16:40:40 jjv5 Exp arjan $ C C------------------------------------------------------------------------ subroutine rottr(ir) implicit double precision(a-h,o-z) #include "divcon.dim" #include "divcon.h" dimension gccp(3) C needed for random number generator later on: don't change it! irnd = 3 ir3 = 3*ir-3 do 70 i=1,3 gccp(i) = gcmc(i,ir) 70 continue ibeg = irpnt(ir) iend = irpnt(ir+1)-1 C shift the coordinates do 81 i=ibeg,iend do 80 j=1,3 xyz(j,i) = xyzmc(j,i) - gccp(j) 80 continue 81 continue C now rotate do a random rotation about one of the internal axes C of the molecule [Chem.Phys.Lett 3 ('69) 144-145] da = (2.0*xrandom(iseed)-1.0)*dangle s = sin(da) c = cos(da) ii=irandom(iseed,irnd) call av(da,ndangle(ii),sdangle(ii),fdangle(ii),hdangle(ii)) if (ii.eq.1) then C . rotation round internal x-axis do i=ibeg,iend y = xyz(2,i) z = xyz(3,i) xyz(2,i) = c*y + s*z xyz(3,i) = -s*y + c*z enddo elseif (ii.eq.2) then C . rotation round internal y-axis do i=ibeg,iend x = xyz(1,i) z = xyz(3,i) xyz(1,i) = c*x - s*z xyz(3,i) = s*x + c*z enddo elseif (ii.eq.3) then C . rotation round internal z-axis do i=ibeg,iend x = xyz(1,i) y = xyz(2,i) xyz(1,i) = c*x + s*y xyz(2,i) = -s*x + c*y enddo endif C translate if (smartmc) then C . multiply forces on residue by A and beta and add in a random C . number from the gaussian distribution to get the random C . move (have to save drx because of resstep) x = grandom(iseed,smarta2) y = grandom(iseed,smarta2) z = grandom(iseed,smarta2) xx = smarta*rforcmc(ir3+1) yy = smarta*rforcmc(ir3+2) zz = smarta*rforcmc(ir3+3) drx(ir3+1) = xx + x drx(ir3+2) = yy + y drx(ir3+3) = zz + z else drx(ir3+1) = drmc*(2.0*xrandom(iseed)-1.0) drx(ir3+2) = drmc*(2.0*xrandom(iseed)-1.0) drx(ir3+3) = drmc*(2.0*xrandom(iseed)-1.0) endif do 240 i=1,3 dr = drx(ir3+i) + gccp(i) if (dr.gt.boxmax(i))then dr = dr - dbox(i) else if (dr.lt.boxmin(i))then dr = dr + dbox(i) endif call av(drx(ir3+i),ndrmc(i),sdrmc(i),fdrmc(i),hdrmc(i)) do 230 j=ibeg,iend xyz(i,j) = xyz(i,j) + dr gcres(i,j) = dr 230 continue gc(i,ir) = dr 240 continue end