import sys
sys.path.append("K:\\Simulations\\Lmc\\LmcPython")
import Lmc
dir(Lmc)
sim = Lmc.IsingSimulation()
sim.SetHeightWidth(512,512) # Bigger for better averages
correlationObserver = Lmc.CorrelationObserverFFT()
sim.Attach(correlationObserver)
sim.Sweep()
sim.Notify()
# Make sure your X-windows manager is running.
# JPS home:
sys.path.append("K:\\Simulations\\xmgr") # Your path here
import xmgr
# Early in the semester, we needed this voodoo to get xmgr to work
# File -> Open, K:\Simulations\xmgr\xmgr.py, then close it
graph = xmgr.xmgr()
corr = []
for r in xrange(0,sim.GetWidth()/2):
corr.append([r,correlationObserver.Correlation(r)])
graph.PlotSet(0,corr)
# Measure correlation functions after times 2^n,
# plot them
corrlist = [corr]
def copyCorr():
corr = []
for r in xrange(0,sim.GetWidth()/2):
corr.append([r,correlationObserver.Correlation(r)])
return corr
sim.Sweep()
sim.Notify()
copyCorr()
corrlist.append(copyCorr()) # corrlist[1] is correlation at t=2^1
sim.GetTime()
graph.PlotSet(1,corrlist[1])
n = 2
# LOOP over times 2^n
for i in xrange(0,2**(n-1)):
sim.Sweep()
sim.Notify()
sim.GetTime()
corrlist.append(copyCorr())
graph.PlotSet(n,corrlist[n])
n = n+1
# Repeat until too time-consuming,
# or until the correlations extend to the center
# Rescale the correlation functions by t^-alpha
# Remember, t is 2^n
# Try various alpha until you get a good collapse
alpha = -XXX
# Copy rescaledCorr to new list
# There must be a better way!
def CopyList(listOrig,depth):
if depth == 1:
return listOrig[:]
else:
listNew = []
for item in listOrig:
listNew.append(CopyList(item,depth-1))
return listNew
rescaledCorr = CopyList(corrlist,3)
for i in xrange(0,len(rescaledCorr)):
for r in xrange(0,len(rescaledCorr[i])):
rescaledCorr[i][r][0] = rescaledCorr[i][r][0]*2**(alpha*i)
graph.PlotSets(rescaledCorr[0],rescaledCorr[1],rescaledCorr[2], \
rescaledCorr[3],rescaledCorr[4],rescaledCorr[5], \
rescaledCorr[6],rescaledCorr[7],rescaledCorr[8], \
rescaledCorr[9])
# You'll need to zoom in to see the collapse: use the magnifying-glass button
Statistical Mechanics: Entropy, Order Parameters, and Complexity,
now available at
Oxford University Press
(USA,
Europe).