Mechdude
- 108
- 1
Homework Statement
im trying to get concept of moving a particle in a Variational Monte Carlo calcualation and i still haven't a clue on how to do that, all i get are really bad acceptance ratios
Homework Equations
Here is my code:
Code:
def VMC(WF,numSteps):
EnergyList=[] ####
R=numpy.zeros((2,3),float) ### positions of two particles
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)): #### looping over the partices
R[ptcl] = numpy.add( R[ptcl],numpy.random.rand(3)*1.5) ## new pos?
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 # restore old R , we rejected a move here
print "movesAcepted: ", movesAccepted, ", movesAttempted: ", movesAttempted
print "Acceptance Ratio", movesAccepted/movesAttempted
return EnergyList
How is the move algorith done? I'm trying to follow the school here:
http://cms.mcc.uiuc.edu/pimcpp/index.php/VMC_Tutorial
Thanks.