How to move particles in a variational Monte Carlo simulation?

I'm attempting to implement some code that moves particles and then calculated the acceptance/rejection of the move, but I'm stuck in a rut. Here is my Python code:

def VMC(WF,numSteps):
seed=5   ### my random number seed
EnergyList=[]
R=numpy.zeros((2,3),float)
movesAttempted=0.0
movesAccepted=0.0
print "num-steps: ",numSteps
for i in range(numSteps):

OldPos= R.copy()
oldWfc= WF.WaveFunction(R)
for ptcl in xrange(0,len(R)):
R[ptcl] = numpy.add( R[ptcl], (numpy.random.rand(3) - 0.5)*3.0 )
newWfc= WF.WaveFunction(R)

ratio = (newWfc**2/oldWfc**2)

rander = numpy.random.rand(1)
if ratio > rander:
Eloc = WF.LocalEnergy(R)
EnergyList.append(Eloc)
movesAttempted+=1
movesAccepted+=1
else:
movesAttempted+=1
R = OldPos
print "movesAcepted: ",movesAccepted
print "  movesAttempted: ", movesAttempted
print "Acceptance Ratio", movesAccepted/movesAttempted
return EnergyList


Here is a pastebin of more of the code: http://pastebin.com/7nTLDesy I'm getting a ridiculous value of the acceptance ratio, which makes me think I'm not getting the concept of how the electrons should be moved at all.

Specifically: When I run this code I get an acceptance ratio of 0.478, while for VMC calculations, moving a particle in a box of length 1.5 (in each direction) around its current position (moving in 3d) the acceptance ratio is supposed to be 0.323.

My problem is mainly to know how atoms are supposed to be moved in a VMC calculation and whether how I'm doing it is o.k.

I've seen an implementation in Fortran (metropolis), and I was wondering how different mine is and how I can correct it to give better results.

• Your question is missing many of the parts that would make it simpler for people to help you. For example, there is nothing we can get from your question without actually running the code. You say you're getting a "ridiculous value", but what is it? What do you observe? How many steps do you run? Etc. Without this you're really asking us to do all the work while doing none yourself. See also here: dealii.sourceforge.net/index.php/… Sep 28 '12 at 12:51
• @mike What is the size of the physical domain, and how does that relate to 0.5 * 3.0? Have you plotted traces of the energies and particle locations so see if they look "reasonable"? Are you throwing away some burn in samples? How many? Sep 28 '12 at 20:57
• The particles are supposed to move is a box of size 1.5, that is why i chose 0.5*3.0, i havent plotted traces of the particle positions and if i understand you right, i have plotted the energy vs sample and it looks quite spiky,
– mike
Sep 28 '12 at 21:21
• From glancing at your code it doesn't look like the particles are constrained, so they'll escape your box (but perhaps I misunderstood your comment). Sep 29 '12 at 2:04
• @MatthewEmmett The motion i meant is the sense described here: physics.princeton.edu/~bclark/Tutorials/VMCIntroTutorial/… about a third of the way down there's as section on building monte carlo code, you will see a description of moving a particle by 1.5 in each direction, thats what i'm trying to do.
– mike
Sep 29 '12 at 12:01