double precision function funmin ( xmer, nmer ) implicit none integer nmer double precision xmer(nmer) include 'sizes.i' include 'files.i' include 'inform.i' include 'iounit.i' include 'math.i' include 'omega.i' include 'zcoord.i' include 'usage.i' include 'atoms.i' integer mnat, i, ixyz, nunit double precision energy, fl integer ifirst save ifirst data ifirst / 0 / if (ifirst.eq.0) then ifirst = 1 call initial call getint call mechanic nomega = 0 mnat = n do i=4,mnat if (iz(4,i).eq.0) then nomega = nomega+1 iomega(1,nomega) = iz(1,i) iomega(2,nomega) = iz(2,i) dihed(nomega) = ztors(i)/radian zline(nomega) = i end if end do do i=1,mnat use(i) = .true. end do if (nomega.ne.nmer) stop 'NMER NOMEGA' do i = 1, nomega call setx1(i,ztors(zline(i))) end do end if do i = 1, nomega ztors(zline(i)) = xmer(i) end do call makexyz funmin = energy() call getfla(1,fl) if (fl.ne.0.) then fl = 0. call setfla(1,fl) ixyz = nunit() if (ixyz.eq.-1) stop 'ERR: NO FREE UNIT' call prtxyz(ixyz) end if end subroutine granal ( nmer, xmer, gmer ) implicit none integer nmer double precision xmer(nmer), gmer(nmer) include 'sizes.i' include 'omega.i' include 'zcoord.i' include 'atoms.i' integer i double precision energy, radian do i=1,nomega ztors(zline(i)) = xmer(i) end do call makexyz call gradrot(energy,gmer) radian = 57.29577951308232088d0 do i=1,nomega gmer(i) = gmer(i)/radian end do end