! qmc.f90: Feynman path integral (quantum Monte Carlo) for ! ground state wave function ! ! From: "A SURVEY OF COMPUTATIONAL PHYSICS" ! by RH Landau, MJ Paez, and CC BORDEIANU ! Copyright Princeton University Press, Princeton, 2008. ! Electronic Materials copyright: R Landau, Oregon State Univ, 2008; ! MJ Paez, Univ Antioquia, 2008; and CC BORDEIANU, Univ Bucharest, 2008. ! Supported by the US National Science Foundation ! program qmc Implicit none integer ::i, j, max, element, prop(100) real*8 ::change, random, energy, newE, oldE, out, path(100) max = 250000 open(9, FILE='qmc.dat', Status='Unknown') ! initial path and initial probability do j=1,100 path(j)=0.0 prop(j)=0 end do ! find energy of initial path oldE = energy(path, 100) do i=1,max ! pick one random element element = random()*100+1 ! change it by an random value -0.9..0.9 change = ((random()-0.5)*2) path(element)=path(element)+change ! find the new energy newE=energy(path, 100) ! reject change if new energy is greater and the Boltzmann factor ! is less than another random number if ((newE>oldE) .AND. (exp(-newE+oldE)