# **************************************************************************** # # ALPS Project: Algorithms and Libraries for Physics Simulations # # ALPS Libraries # # Copyright (C) 2009-2010 by Matthias Troyer # # This software is part of the ALPS libraries, published under the ALPS # Library License; you can use, redistribute it and/or modify it under # the terms of the license, either version 1 or (at your option) any later # version. # # You should have received a copy of the ALPS Library License along with # the ALPS Libraries; see the file LICENSE.txt. If not, the license is also # available from http://alps.comp-phys.org/. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT # SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE # FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. # # **************************************************************************** import pyalps import matplotlib.pyplot as plt import pyalps.plot #prepare the input parameters parms = [] for l in [2,4,8,16,32,48]: parms.append( { 'LATTICE' : "square lattice", 'T' : 2.269186, 'J' : 1 , 'THERMALIZATION' : 10000, 'SWEEPS' : 50000, 'UPDATE' : "local", 'MODEL' : "Ising", 'L' : l } ) #write the input file and run the simulation input_file = pyalps.writeInputFiles('parm1a',parms) pyalps.runApplication('spinmc',input_file,Tmin=5) #load the binning analysis for the absolute value of the magnetization binning = pyalps.loadBinningAnalysis(pyalps.getResultFiles(prefix='parm1a'),'|Magnetization|') binning = pyalps.flatten(binning) #make one plot with all data for dataset in binning: dataset.props['label'] = 'L='+str(dataset.props['L']) plt.figure() plt.xlabel('binning level') plt.ylabel('Error of |Magnetization|') pyalps.plot.plot(binning) plt.legend() plt.show() # make individual plots for each system size for dataset in binning: plt.figure() plt.title('Binning analysis for L='+str(dataset.props['L'])) plt.xlabel('binning level') plt.ylabel('Error of |Magnetization|') pyalps.plot.plot(dataset) plt.show()