plt.close()
    plt.figure(2)
    plt.close()


##Main execution of program

# define model grid
grd = IsingGrid(dim, sizeN)
if gridMode == 1:
    grd = PottsGrid(dim, sizeN, 10)
if gridMode == 2:
    grd = SpinGlass(dim, sizeN)

# set magnetic field
grd.fieldB = magField

# run....
output = wangLandau(grd)

# write to file!
dataOut = []
for i in range(0, len(output[0])):
    dataOut.append([output[2][i], output[0][i]])
plotArrayToFile(dataOut, fileOut)

thermalizationSweeps, measurementSweeps = 10000, 50000
plotRange = [0.0, 2.0, 30]

MetropolisModule.runAlgorithm(grd, plotRange, thermalizationSweeps, measurementSweeps, 5, fileOut + "_Metropolis")
    plt.figure(2)
    plt.close()


##Main execution of program

#define model grid
grd = IsingGrid(dim, sizeN)
if (gridMode == 1):
    grd = PottsGrid(dim, sizeN, 10)
if (gridMode == 2):
    grd = SpinGlass(dim, sizeN)

#set magnetic field
grd.fieldB = magField

#run....
output = wangLandau(grd)

#write to file!
dataOut = []
for i in range(0, len(output[0])):
    dataOut.append([output[2][i], output[0][i]])
plotArrayToFile(dataOut, fileOut)

thermalizationSweeps, measurementSweeps = 10000, 50000
plotRange = [0.0, 2.0, 30]

MetropolisModule.runAlgorithm(grd, plotRange, thermalizationSweeps,
                              measurementSweeps, 5, fileOut + "_Metropolis")
Exemplo n.º 3
0
        gridSize = int(sys.argv[i + 1])
    if (sys.argv[i] == '-t'):
        thermalizationSweeps = int(sys.argv[i + 1])
    if (sys.argv[i] == '-r'):
        plotRange[0] = float(sys.argv[i + 1])
        plotRange[1] = float(sys.argv[i + 2])
        plotRange[2] = int(sys.argv[i + 3])
    if (sys.argv[i] == '-m'):
        measurementSweeps = int(sys.argv[i + 1])
    if (sys.argv[i] == '-a'):
        numAverages = int(sys.argv[i + 1])
    if (sys.argv[i] == '--mode'):
        gridMode = int(sys.argv[i + 1])
    if (sys.argv[i] == '--help'):
        print "\n-o\t[Filename]\tOutput file name\n-d\t[dimension]\tDimensions of problem.\n-n\t[Size]\t\tSize of grid.\nIteration stop point order of magnitude\n-m\t[sweeps]\tMeasurement Sweeps\n-t\t[sweeps]\tThermalization Sweeps"
        sys.exit()

if (gridMode == 0):
    grid = IsingGrid(dim, gridSize)
if (gridMode == 1):
    grid = PottsGrid(dim, gridSize, 10)
if (gridMode == 2):
    grid = SpinGlass(dim, gridSize)
else:
    print "Unrecognized grid mode"
    sys.exit()

print '-------------------------------------------------\Running Metropolis Algoritn\n' + 'Thermalization Sweeps:' + str(
    thermalizationSweeps) + '\tMeasurement Sweeps:' + str(measurementSweeps)
MetropolisModule.runAlgorithm(grid, plotRange, thermalizationSweeps,
                              measurementSweeps, numAverages, fileOut)
Exemplo n.º 4
0
    if(sys.argv[i] == '-n'):
        gridSize=int(sys.argv[i+1])
    if(sys.argv[i] == '-t'):
        thermalizationSweeps=int(sys.argv[i+1])
    if(sys.argv[i] == '-r'):
        plotRange[0]=float(sys.argv[i+1])
        plotRange[1]=float(sys.argv[i+2])
        plotRange[2]=int(sys.argv[i+3])
    if(sys.argv[i] == '-m'):
        measurementSweeps=int(sys.argv[i+1])
    if(sys.argv[i] == '-a'):
        numAverages=int(sys.argv[i+1])
    if(sys.argv[i] == '--mode'):
        gridMode=int(sys.argv[i+1])
    if(sys.argv[i] == '--help'):
        print "\n-o\t[Filename]\tOutput file name\n-d\t[dimension]\tDimensions of problem.\n-n\t[Size]\t\tSize of grid.\nIteration stop point order of magnitude\n-m\t[sweeps]\tMeasurement Sweeps\n-t\t[sweeps]\tThermalization Sweeps"
        sys.exit()
    
if(gridMode == 0):
    grid = IsingGrid(dim,gridSize)
if(gridMode == 1):
    grid = PottsGrid(dim,gridSize,10)
if(gridMode == 2):
    grid = SpinGlass(dim,gridSize)
else:
    print "Unrecognized grid mode"
    sys.exit()
    
print '-------------------------------------------------\Running Metropolis Algoritn\n' + 'Thermalization Sweeps:' + str(thermalizationSweeps) + '\tMeasurement Sweeps:'+ str(measurementSweeps)
MetropolisModule.runAlgorithm(grid, plotRange, thermalizationSweeps, measurementSweeps, numAverages, fileOut)