From 3c73f4b7386c7a57445a770f79abe988d06da55a Mon Sep 17 00:00:00 2001 From: Marcus Rosales Date: Mon, 10 Aug 2026 13:01:55 -0400 Subject: [PATCH 1/4] Serve MCS tutorial downloads locally instead of linking to GitHub The parameter-file and script links on the Monte Carlo tutorial pages pointed at github.com/ALPSim/ALPS blob URLs. The `download` attribute is ignored on cross-origin links, so clicking one navigated the reader off to GitHub rather than saving the file. Vendor the 46 linked files under content/en/tutorials/mcs/codes/, mirroring the layout already used by the ED tutorials, and repoint every link at ../codes//. Same-origin links honour `download`, so readers now stay on the page. Files are copied verbatim from ALPSim/ALPS master. Several parameter files differ from the code blocks shown on the pages (parm2a, parm2b, parm3a, parm3b, parm4, parm6a, parm6d); reconciling those is left to a follow-up. Co-Authored-By: Claude Opus 5 --- .../mcs/codes/mc-01-autocorrelations/parm1a | 13 ++ .../mcs/codes/mc-01-autocorrelations/parm1b | 13 ++ .../mc-01-autocorrelations/tutorial1a.py | 79 +++++++ .../mc-01-autocorrelations/tutorial1b.py | 77 +++++++ .../parm1a | 8 + .../tutorial1a.py | 71 +++++++ .../mcs/codes/mc-02-susceptibilities/parm2a | 24 +++ .../mcs/codes/mc-02-susceptibilities/parm2b | 26 +++ .../mcs/codes/mc-02-susceptibilities/parm2c | 24 +++ .../mcs/codes/mc-02-susceptibilities/parm2d | 22 ++ .../mc-02-susceptibilities/tutorial2a.py | 66 ++++++ .../mc-02-susceptibilities/tutorial2b.py | 64 ++++++ .../mc-02-susceptibilities/tutorial2c.py | 64 ++++++ .../mc-02-susceptibilities/tutorial2d.py | 65 ++++++ .../mc-02-susceptibilities/tutorial2full.py | 64 ++++++ .../mcs/codes/mc-03-magnetization/parm3a | 28 +++ .../mcs/codes/mc-03-magnetization/parm3b | 29 +++ .../codes/mc-03-magnetization/tutorial3a.py | 64 ++++++ .../codes/mc-03-magnetization/tutorial3b.py | 65 ++++++ .../mc-03-magnetization/tutorial3full.py | 51 +++++ .../mcs/codes/mc-04-measurements/parm4 | 13 ++ .../mcs/codes/mc-04-measurements/tutorial4.py | 60 ++++++ .../tutorials/mcs/codes/mc-05-bosons/parm5a | 25 +++ .../tutorials/mcs/codes/mc-05-bosons/parm5b | 37 ++++ .../mcs/codes/mc-05-bosons/tutorial5a.py | 64 ++++++ .../mcs/codes/mc-05-bosons/tutorial5b.py | 71 +++++++ .../en/tutorials/mcs/codes/mc-06-qwl/parm6a | 10 + .../en/tutorials/mcs/codes/mc-06-qwl/parm6b | 7 + .../en/tutorials/mcs/codes/mc-06-qwl/parm6c | 7 + .../en/tutorials/mcs/codes/mc-06-qwl/parm6d | 11 + .../mcs/codes/mc-06-qwl/tutorial6a.py | 55 +++++ .../mcs/codes/mc-06-qwl/tutorial6b.py | 55 +++++ .../mcs/codes/mc-06-qwl/tutorial6c.py | 55 +++++ .../mcs/codes/mc-06-qwl/tutorial6d.py | 74 +++++++ .../mcs/codes/mc-07-phase-transition/parm7a | 85 ++++++++ .../mcs/codes/mc-07-phase-transition/parm7b | 58 ++++++ .../mc-07-phase-transition/tutorial7a.py | 109 ++++++++++ .../mc-07-phase-transition/tutorial7b.py | 197 ++++++++++++++++++ .../mc-08-quantum-phase-transition/parm8a | 71 +++++++ .../mc-08-quantum-phase-transition/parm8b | 52 +++++ .../mc-08-quantum-phase-transition/parm8c | 60 ++++++ .../mc-08-quantum-phase-transition/parm8d | 63 ++++++ .../tutorial8a.py | 85 ++++++++ .../tutorial8b.py | 79 +++++++ .../tutorial8c.py | 79 +++++++ .../tutorial8d.py | 79 +++++++ content/en/tutorials/mcs/mc01a.md | 8 +- content/en/tutorials/mcs/mc01b.md | 4 +- content/en/tutorials/mcs/mc02.md | 18 +- content/en/tutorials/mcs/mc03.md | 10 +- content/en/tutorials/mcs/mc04.md | 4 +- content/en/tutorials/mcs/mc05.md | 8 +- content/en/tutorials/mcs/mc06.md | 12 +- content/en/tutorials/mcs/mc07.md | 8 +- content/en/tutorials/mcs/mc08.md | 12 +- 55 files changed, 2520 insertions(+), 42 deletions(-) create mode 100644 content/en/tutorials/mcs/codes/mc-01-autocorrelations/parm1a create mode 100644 content/en/tutorials/mcs/codes/mc-01-autocorrelations/parm1b create mode 100644 content/en/tutorials/mcs/codes/mc-01-autocorrelations/tutorial1a.py create mode 100644 content/en/tutorials/mcs/codes/mc-01-autocorrelations/tutorial1b.py create mode 100644 content/en/tutorials/mcs/codes/mc-01b-equilibration-and-convergence/parm1a create mode 100644 content/en/tutorials/mcs/codes/mc-01b-equilibration-and-convergence/tutorial1a.py create mode 100644 content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2a create mode 100644 content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2b create mode 100644 content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2c create mode 100644 content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2d create mode 100644 content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2a.py create mode 100644 content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2b.py create mode 100644 content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2c.py create mode 100644 content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2d.py create mode 100644 content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2full.py create mode 100644 content/en/tutorials/mcs/codes/mc-03-magnetization/parm3a create mode 100644 content/en/tutorials/mcs/codes/mc-03-magnetization/parm3b create mode 100644 content/en/tutorials/mcs/codes/mc-03-magnetization/tutorial3a.py create mode 100644 content/en/tutorials/mcs/codes/mc-03-magnetization/tutorial3b.py create mode 100644 content/en/tutorials/mcs/codes/mc-03-magnetization/tutorial3full.py create mode 100644 content/en/tutorials/mcs/codes/mc-04-measurements/parm4 create mode 100644 content/en/tutorials/mcs/codes/mc-04-measurements/tutorial4.py create mode 100644 content/en/tutorials/mcs/codes/mc-05-bosons/parm5a create mode 100644 content/en/tutorials/mcs/codes/mc-05-bosons/parm5b create mode 100644 content/en/tutorials/mcs/codes/mc-05-bosons/tutorial5a.py create mode 100644 content/en/tutorials/mcs/codes/mc-05-bosons/tutorial5b.py create mode 100644 content/en/tutorials/mcs/codes/mc-06-qwl/parm6a create mode 100644 content/en/tutorials/mcs/codes/mc-06-qwl/parm6b create mode 100644 content/en/tutorials/mcs/codes/mc-06-qwl/parm6c create mode 100644 content/en/tutorials/mcs/codes/mc-06-qwl/parm6d create mode 100644 content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6a.py create mode 100644 content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6b.py create mode 100644 content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6c.py create mode 100644 content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6d.py create mode 100644 content/en/tutorials/mcs/codes/mc-07-phase-transition/parm7a create mode 100644 content/en/tutorials/mcs/codes/mc-07-phase-transition/parm7b create mode 100644 content/en/tutorials/mcs/codes/mc-07-phase-transition/tutorial7a.py create mode 100644 content/en/tutorials/mcs/codes/mc-07-phase-transition/tutorial7b.py create mode 100644 content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8a create mode 100644 content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8b create mode 100644 content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8c create mode 100644 content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8d create mode 100644 content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8a.py create mode 100644 content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8b.py create mode 100644 content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8c.py create mode 100644 content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8d.py diff --git a/content/en/tutorials/mcs/codes/mc-01-autocorrelations/parm1a b/content/en/tutorials/mcs/codes/mc-01-autocorrelations/parm1a new file mode 100644 index 00000000..2c874bc7 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-01-autocorrelations/parm1a @@ -0,0 +1,13 @@ +LATTICE="square lattice" +T=2.269186 +J=1 +THERMALIZATION=10000 +SWEEPS=50000 +UPDATE="local" +MODEL="Ising" +{L=2;} +{L=4;} +{L=8;} +{L=16;} +{L=32;} +{L=48;} diff --git a/content/en/tutorials/mcs/codes/mc-01-autocorrelations/parm1b b/content/en/tutorials/mcs/codes/mc-01-autocorrelations/parm1b new file mode 100644 index 00000000..4dbd416f --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-01-autocorrelations/parm1b @@ -0,0 +1,13 @@ +LATTICE="square lattice" +T=2.269186 +J=1 +THERMALIZATION=1000 +SWEEPS=100000 +UPDATE="cluster" +MODEL="Ising" +{L=2;} +{L=4;} +{L=8;} +{L=16;} +{L=32;} +{L=48;} diff --git a/content/en/tutorials/mcs/codes/mc-01-autocorrelations/tutorial1a.py b/content/en/tutorials/mcs/codes/mc-01-autocorrelations/tutorial1a.py new file mode 100644 index 00000000..9bf822ba --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-01-autocorrelations/tutorial1a.py @@ -0,0 +1,79 @@ +# **************************************************************************** +# +# 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() + + + diff --git a/content/en/tutorials/mcs/codes/mc-01-autocorrelations/tutorial1b.py b/content/en/tutorials/mcs/codes/mc-01-autocorrelations/tutorial1b.py new file mode 100644 index 00000000..12359c02 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-01-autocorrelations/tutorial1b.py @@ -0,0 +1,77 @@ +# **************************************************************************** +# +# 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' : 1000, + 'SWEEPS' : 100000, + 'UPDATE' : "cluster", + 'MODEL' : "Ising", + 'L' : l + } + ) + +#write the input file and run the simulation +input_file = pyalps.writeInputFiles('parm1b',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='parm1b'),'|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.title('Binning analysis for cluster updates') +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() diff --git a/content/en/tutorials/mcs/codes/mc-01b-equilibration-and-convergence/parm1a b/content/en/tutorials/mcs/codes/mc-01b-equilibration-and-convergence/parm1a new file mode 100644 index 00000000..28f9fd62 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-01b-equilibration-and-convergence/parm1a @@ -0,0 +1,8 @@ +LATTICE="square lattice" +T=2.269186 +J=1 +THERMALIZATION=10000 +SWEEPS=50000 +UPDATE="local" +MODEL="Ising" +{L=48;} diff --git a/content/en/tutorials/mcs/codes/mc-01b-equilibration-and-convergence/tutorial1a.py b/content/en/tutorials/mcs/codes/mc-01b-equilibration-and-convergence/tutorial1a.py new file mode 100644 index 00000000..3d58bbf8 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-01b-equilibration-and-convergence/tutorial1a.py @@ -0,0 +1,71 @@ +from __future__ import print_function +############################################################################# +# +# ALPS Project Applications: Directed Worm Algorithm +# +# Copyright (C) 2013 by Lode Pollet +# Ping Nang Ma +# 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. +# +############################################################################# + +# The headers +import pyalps + +# Set up a python list of parameters (python) dictionaries: +parms = [{ + 'LATTICE' : "square lattice", + 'MODEL' : "Ising", + 'L' : 48, + 'J' : 1., + 'T' : 2.269186, + 'THERMALIZATION' : 10000, + 'SWEEPS' : 50000, +}] + +# Write into XML input file: +input_file = pyalps.writeInputFiles('parm1a',parms) + +# and run the application spinmc: +pyalps.runApplication('spinmc', input_file, Tmin=10, writexml=True) + +# We first get the list of all hdf5 result files via: +files = pyalps.getResultFiles(prefix='parm1a') + +# and then extract, say the timeseries of the |Magnetization| measurements: +ts_M = pyalps.loadTimeSeries(files[0], '|Magnetization|'); + +# We can then visualize graphically: +import matplotlib.pyplot as plt +plt.plot(ts_M) +plt.show() + +# ALPS Python provides a convenient tool to check whether a measurement observable(s) has (have) reached steady state equilibrium. +# +# Here is one example: +print(pyalps.checkSteadyState(outfile=files[0], observable='|Magnetization|', confidenceInterval=0.95)) +print() + +# and another one: +observables = pyalps.loadMeasurements(files, ['|Magnetization|', 'Energy']) +observables = pyalps.checkSteadyState(observables, confidenceInterval=0.95) +for o in observables: + print('{}:\t{}'.format(o.props['observable'], o.props['checkSteadyState'])) + diff --git a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2a b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2a new file mode 100644 index 00000000..f1036e49 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2a @@ -0,0 +1,24 @@ +LATTICE="chain lattice" +L=60 +J=-1 +THERMALIZATION=15000 +SWEEPS=150000 +UPDATE="cluster" +MODEL="Heisenberg" +{T=0.05;} +{T=0.1;} +{T=0.2;} +{T=0.3;} +{T=0.4;} +{T=0.5;} +{T=0.6;} +{T=0.7;} +SWEEPS=500000 +{T=0.8;} +{T=0.9;} +{T=1.0;} +{T=1.25;} +{T=1.5;} +{T=1.75;} +{T=2.0;} + diff --git a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2b b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2b new file mode 100644 index 00000000..1a40be04 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2b @@ -0,0 +1,26 @@ +LATTICE="ladder" +L=60 +J0=-1 +J1=-1 +THERMALIZATION=15000 +SWEEPS=150000 +UPDATE="cluster" +MODEL="Heisenberg" +{T=0.05;} +{T=0.1;} +{T=0.2;} +{T=0.3;} +{T=0.4;} +{T=0.5;} +{T=0.6;} +SWEEPS=500000 +{T=0.7;} +{T=0.8;} +{T=0.9;} +{T=1.0;} +{T=1.25;} +{T=1.5;} +{T=1.75;} +{T=2.0;} + + diff --git a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2c b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2c new file mode 100644 index 00000000..04a85fae --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2c @@ -0,0 +1,24 @@ +LATTICE="chain lattice" +MODEL="spin" +local_S=1/2 +L=60 +J=1 +THERMALIZATION=5000 +SWEEPS=50000 +ALGORITHM="loop" +{T=0.05;} +{T=0.1;} +{T=0.2;} +{T=0.3;} +{T=0.4;} +{T=0.5;} +{T=0.6;} +{T=0.7;} +{T=0.75;} +{T=0.8;} +{T=0.9;} +{T=1.0;} +{T=1.25;} +{T=1.5;} +{T=1.75;} +{T=2.0;} diff --git a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2d b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2d new file mode 100644 index 00000000..39595480 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2d @@ -0,0 +1,22 @@ +LATTICE="ladder" +MODEL="spin" +local_S=1/2 +L=60 +J0=1 +J1=1 +THERMALIZATION=5000 +SWEEPS=50000 +ALGORITHM="loop" +{T=0.1;} +{T=0.2;} +{T=0.3;} +{T=0.4;} +{T=0.5;} +{T=0.6;} +{T=0.7;} +{T=0.8;} +{T=1.0;} +{T=1.25;} +{T=1.5;} +{T=1.75;} +{T=2.0;} diff --git a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2a.py b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2a.py new file mode 100644 index 00000000..a772b796 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2a.py @@ -0,0 +1,66 @@ +# **************************************************************************** +# +# 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 +#skip this part if you already ran the simulation from the command line +parms = [] +for t in [0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.25, 1.5, 1.75, 2.0]: + parms.append( + { + 'LATTICE' : "chain lattice", + 'T' : t, + 'J' : -1 , + 'THERMALIZATION' : 10000, + 'SWEEPS' : 500000, + 'UPDATE' : "cluster", + 'MODEL' : "Heisenberg", + 'L' : 60 + } + ) + +#write the input file and run the simulation +#skip this part if you already ran the simulation from the command line +input_file = pyalps.writeInputFiles('parm2a',parms) +pyalps.runApplication('spinmc',input_file,Tmin=5) + + +#load the susceptibility and collect it as function of temperature T +data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm2a'),'Susceptibility') +susceptibility = pyalps.collectXY(data,x='T',y='Susceptibility') + +#make plot +plt.figure() +pyalps.plot.plot(susceptibility) +plt.xlabel('Temperature $T/J$') +plt.ylabel('Susceptibility $\chi J$') +plt.ylim(0,0.22) +plt.title('Classical Heisenberg chain') +plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2b.py b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2b.py new file mode 100644 index 00000000..6f9e22ab --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2b.py @@ -0,0 +1,64 @@ +# **************************************************************************** +# +# 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 t in [0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.25, 1.5, 1.75, 2.0]: + parms.append( + { + 'LATTICE' : "ladder", + 'T' : t, + 'J0' : -1 , + 'J1' : -1 , + 'THERMALIZATION' : 10000, + 'SWEEPS' : 500000, + 'UPDATE' : "cluster", + 'MODEL' : "Heisenberg", + 'L' : 60 + } + ) + +#write the input file and run the simulation +input_file = pyalps.writeInputFiles('parm2b',parms) +pyalps.runApplication('spinmc',input_file,Tmin=5) + +#load the susceptibility and collect it as function of temperature T +data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm2b'),'Susceptibility') +susceptibility = pyalps.collectXY(data,x='T',y='Susceptibility') + +#make plot +plt.figure() +pyalps.plot.plot(susceptibility) +plt.xlabel('Temperature $T/J$') +plt.ylabel('Susceptibility $\chi J$') +plt.ylim(0,0.22) +plt.title('Heisenberg ladder') +plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2c.py b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2c.py new file mode 100644 index 00000000..4c36407c --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2c.py @@ -0,0 +1,64 @@ +# **************************************************************************** +# +# 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 t in [0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.25, 1.5, 1.75, 2.0]: + parms.append( + { + 'LATTICE' : "chain lattice", + 'MODEL' : "spin", + 'local_S' : 0.5, + 'T' : t, + 'J' : 1 , + 'THERMALIZATION' : 5000, + 'SWEEPS' : 50000, + 'L' : 60, + 'ALGORITHM' : "loop" + } + ) + +#write the input file and run the simulation +input_file = pyalps.writeInputFiles('parm2c',parms) +pyalps.runApplication('loop',input_file) + +#load the susceptibility and collect it as function of temperature T +data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm2c'),'Susceptibility') +susceptibility = pyalps.collectXY(data,x='T',y='Susceptibility') + +#make plot +plt.figure() +pyalps.plot.plot(susceptibility) +plt.xlabel('Temperature $T/J$') +plt.ylabel('Susceptibility $\chi J$') +plt.ylim(0,0.22) +plt.title('Quantum Heisenberg chain') +plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2d.py b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2d.py new file mode 100644 index 00000000..5ac6ea11 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2d.py @@ -0,0 +1,65 @@ +# **************************************************************************** +# +# 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 t in [0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.25, 1.5, 1.75, 2.0]: + parms.append( + { + 'LATTICE' : "ladder", + 'MODEL' : "spin", + 'local_S' : 0.5, + 'T' : t, + 'J0' : 1 , + 'J1' : 1 , + 'THERMALIZATION' : 5000, + 'SWEEPS' : 50000, + 'L' : 60, + 'ALGORITHM' : "loop" + } + ) + +#write the input file and run the simulation +input_file = pyalps.writeInputFiles('parm2d',parms) +pyalps.runApplication('loop',input_file) + +#load the susceptibility and collect it as function of temperature T +data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm2d'),'Susceptibility') +susceptibility = pyalps.collectXY(data,x='T',y='Susceptibility') + +#make plot +plt.figure() +pyalps.plot.plot(susceptibility) +plt.xlabel('Temperature $T/J$') +plt.ylabel('Susceptibility $\chi J$') +plt.ylim(0,0.22) +plt.title('Quantum Heisenberg ladder') +plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2full.py b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2full.py new file mode 100644 index 00000000..4e60645f --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2full.py @@ -0,0 +1,64 @@ +# **************************************************************************** +# +# 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. +# +# **************************************************************************** + +# Please run all four other tutorials before running this one. +# This tutorial relies on the results created in those tutorials + +import pyalps +import matplotlib.pyplot as plt +import pyalps.plot + +# load all files +data = pyalps.loadMeasurements(pyalps.getResultFiles(),'Susceptibility') + +#flatten the hierarchical structure +data = pyalps.flatten(data) + +# collect the susceptibility +susceptibility = pyalps.collectXY(data,x='T',y='Susceptibility',foreach=['MODEL','LATTICE']) + +# assign labels to the data depending on the properties +for s in susceptibility: + # print s.props + if s.props['LATTICE']=='chain lattice': + s.props['label'] = "chain" + elif s.props['LATTICE']=='ladder': + s.props['label'] = "ladder" + if s.props['MODEL']=='spin': + s.props['label'] = "quantum " + s.props['label'] + elif s.props['MODEL']=='Heisenberg': + s.props['label'] = "classical " + s.props['label'] + +#make plot +plt.figure() +pyalps.plot.plot(susceptibility) +plt.xlabel('Temperature $T/J$') +plt.ylabel('Susceptibility $\chi J$') +plt.ylim(0,0.25) +plt.legend() +plt.show() + diff --git a/content/en/tutorials/mcs/codes/mc-03-magnetization/parm3a b/content/en/tutorials/mcs/codes/mc-03-magnetization/parm3a new file mode 100644 index 00000000..aecb8c6f --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-03-magnetization/parm3a @@ -0,0 +1,28 @@ +LATTICE="chain lattice" +MODEL = "spin" +local_S=1/2 +L=20 +J=1 +T=0.08 +THERMALIZATION=1000 +SWEEPS=10000 +{h=0;} +{h=0.1;} +{h=0.2;} +{h=0.3;} +{h=0.4;} +{h=0.5;} +{h=0.6;} +{h=0.7;} +{h=0.8;} +{h=0.9;} +{h=1.0;} +SWEEPS=10000; +{h=1.2;} +{h=1.4;} +{h=1.6;} +{h=1.8;} +{h=2.0;} +{h=2.2;} +{h=2.4;} +{h=2.5;} diff --git a/content/en/tutorials/mcs/codes/mc-03-magnetization/parm3b b/content/en/tutorials/mcs/codes/mc-03-magnetization/parm3b new file mode 100644 index 00000000..642868d7 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-03-magnetization/parm3b @@ -0,0 +1,29 @@ +LATTICE="ladder" +MODEL = "spin" +local_S=1/2 +L=20 +J0=1 +J1=1 +T=0.08 +THERMALIZATION=1000 +SWEEPS=10000 +{h=0;} +{h=0.1;} +{h=0.2;} +{h=0.3;} +{h=0.4;} +{h=0.5;} +{h=0.6;} +{h=0.8;} +{h=1.0;} +{h=1.25;} +SWEEPS=5000 +{h=1.5;} +{h=1.75;} +{h=2.0;} +{h=2.25;} +{h=2.5;} +{h=2.75;} +{h=3.0;} +{h=3.25;} +{h=3.5;} diff --git a/content/en/tutorials/mcs/codes/mc-03-magnetization/tutorial3a.py b/content/en/tutorials/mcs/codes/mc-03-magnetization/tutorial3a.py new file mode 100644 index 00000000..8beb785b --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-03-magnetization/tutorial3a.py @@ -0,0 +1,64 @@ +# **************************************************************************** +# +# 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 h in [0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.5]: + parms.append( + { + 'LATTICE' : "chain lattice", + 'MODEL' : "spin", + 'local_S' : 0.5, + 'T' : 0.08, + 'J' : 1 , + 'THERMALIZATION' : 1000, + 'SWEEPS' : 10000, + 'L' : 20, + 'h' : h + } + ) + +#write the input file and run the simulation +input_file = pyalps.writeInputFiles('parm3a',parms) +res = pyalps.runApplication('dirloop_sse',input_file,Tmin=5) + +#load the magnetization and collect it as function of field h +data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm3a'),'Magnetization Density') +magnetization = pyalps.collectXY(data,x='h',y='Magnetization Density') + +#make plot +plt.figure() +pyalps.plot.plot(magnetization) +plt.xlabel('Field $h$') +plt.ylabel('Magnetization $m$') +plt.ylim(0.0,0.5) +plt.title('Quantum Heisenberg chain') +plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-03-magnetization/tutorial3b.py b/content/en/tutorials/mcs/codes/mc-03-magnetization/tutorial3b.py new file mode 100644 index 00000000..8bc76d54 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-03-magnetization/tutorial3b.py @@ -0,0 +1,65 @@ +# **************************************************************************** +# +# 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 h in [0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75, 3.0, 3.25, 3.5]: + parms.append( + { + 'LATTICE' : "ladder", + 'MODEL' : "spin", + 'local_S' : 0.5, + 'T' : 0.08, + 'J0' : 1 , + 'J1' : 1 , + 'THERMALIZATION' : 1000, + 'SWEEPS' : 10000, + 'L' : 20, + 'h' : h + } + ) + +#write the input file and run the simulation +input_file = pyalps.writeInputFiles('parm3b',parms) +res = pyalps.runApplication('dirloop_sse',input_file,Tmin=5) + +#load the magnetization and collect it as function of field h +data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm3b'),'Magnetization Density') +magnetization = pyalps.collectXY(data,x='h',y='Magnetization Density') + +#make plot +plt.figure() +pyalps.plot.plot(magnetization) +plt.xlabel('Field $h$') +plt.ylabel('Magnetization $m$') +plt.ylim(0.0,0.5) +plt.title('Quantum Heisenberg ladder') +plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-03-magnetization/tutorial3full.py b/content/en/tutorials/mcs/codes/mc-03-magnetization/tutorial3full.py new file mode 100644 index 00000000..84c4103c --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-03-magnetization/tutorial3full.py @@ -0,0 +1,51 @@ +# **************************************************************************** +# +# 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. +# +# **************************************************************************** + +# Please run the two other tutorials before running this one. +# This tutorial relies on the results created in those tutorials + +import pyalps +import matplotlib.pyplot as plt +import pyalps.plot + +# load all files +data = pyalps.loadMeasurements(pyalps.getResultFiles(),'Magnetization Density') + +#flatten the hierarchical structure +data = pyalps.flatten(data) + +#load the magnetization and collect it as function of field h +magnetization = pyalps.collectXY(data,x='h',y='Magnetization Density',foreach=['LATTICE']) + +#make plot +plt.figure() +pyalps.plot.plot(magnetization) +plt.xlabel('Field $h$') +plt.ylabel('Magnetization $m$') +plt.ylim(0.0,0.5) +plt.legend() +plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-04-measurements/parm4 b/content/en/tutorials/mcs/codes/mc-04-measurements/parm4 new file mode 100644 index 00000000..eaa02b1f --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-04-measurements/parm4 @@ -0,0 +1,13 @@ +MODEL="spin"; +LATTICE="square lattice"; +REPRESENTATION="SSE"; +MEASURE[Correlations]=true; +MEASURE[Structure Factor]=true; +MEASURE[Green Function]=true; +THERMALIZATION=10000; +SWEEPS=500000; +J=1; +L=4; +W=4; +T=0.3; +{h=0.1;} diff --git a/content/en/tutorials/mcs/codes/mc-04-measurements/tutorial4.py b/content/en/tutorials/mcs/codes/mc-04-measurements/tutorial4.py new file mode 100644 index 00000000..a70421fc --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-04-measurements/tutorial4.py @@ -0,0 +1,60 @@ +from __future__ import print_function +# **************************************************************************** +# +# 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 + +#prepare the input parameters +parms = [{ + 'LATTICE' : "square lattice", + 'MODEL' : "spin", + 'MEASURE[Correlations]' : True, + 'MEASURE[Structure Factor]' : True, + 'MEASURE[Green Function]' : True, + 'local_S' : 0.5, + 'T' : 0.3, + 'J' : 1 , + 'THERMALIZATION' : 10000, + 'SWEEPS' : 500000, + 'L' : 4, + 'h' : 0.1 + }] + +#write the input file and run the simulation +input_file = pyalps.writeInputFiles('parm4',parms) +res = pyalps.runApplication('dirloop_sse',input_file,Tmin=5) + +#load the magnetization and collect it as function of field h +data = pyalps.loadMeasurements(pyalps.getResultFiles()) + +# print all measurements +for s in pyalps.flatten(data): + if len(s.x)==1: + print(s.props['observable'], ' : ', s.y[0]) + else: + for (x,y) in zip(s.x,s.y): + print(s.props['observable'], x, ' : ', y) diff --git a/content/en/tutorials/mcs/codes/mc-05-bosons/parm5a b/content/en/tutorials/mcs/codes/mc-05-bosons/parm5a new file mode 100644 index 00000000..f0909af1 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-05-bosons/parm5a @@ -0,0 +1,25 @@ + LATTICE="square lattice"; + L=4; + + MODEL="boson Hubbard"; + NONLOCAL=0; + U = 1.0; + mu = 0.5; + Nmax = 2; + + T = 0.1; + + SWEEPS=500000; + THERMALIZATION=10000; + + { t=0.01; } + { t=0.02; } + { t=0.03; } + { t=0.04; } + { t=0.05; } + { t=0.06; } + { t=0.07; } + { t=0.08; } + { t=0.09; } + { t=0.1; } + diff --git a/content/en/tutorials/mcs/codes/mc-05-bosons/parm5b b/content/en/tutorials/mcs/codes/mc-05-bosons/parm5b new file mode 100644 index 00000000..71aa761b --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-05-bosons/parm5b @@ -0,0 +1,37 @@ + LATTICE="square lattice"; + + MODEL="boson Hubbard"; + NONLOCAL = 0; + U = 1.0; + mu = 0.5; + Nmax = 2; + + T = 0.05; + + SWEEPS=600000; + THERMALIZATION=15000; + + { L=4; t=0.045; } + { L=4; t=0.05; } + { L=4; t=0.0525; } + { L=4; t=0.055; } + { L=4; t=0.0575; } + { L=4; t=0.06; } + { L=4; t=0.065; } + + { L=6; t=0.045; } + { L=6; t=0.05; } + { L=6; t=0.0525; } + { L=6; t=0.055; } + { L=6; t=0.0575; } + { L=6; t=0.06; } + { L=6; t=0.065; } + + { L=8; t=0.045; } + { L=8; t=0.05; } + { L=8; t=0.0525; } + { L=8; t=0.055; } + { L=8; t=0.0575; } + { L=8; t=0.06; } + { L=8; t=0.065; } + diff --git a/content/en/tutorials/mcs/codes/mc-05-bosons/tutorial5a.py b/content/en/tutorials/mcs/codes/mc-05-bosons/tutorial5a.py new file mode 100644 index 00000000..e62a1565 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-05-bosons/tutorial5a.py @@ -0,0 +1,64 @@ +# **************************************************************************** +# +# 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 t in [0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1]: + parms.append( + { + 'LATTICE' : "square lattice", + 'MODEL' : "boson Hubbard", + 'T' : 0.1, + 'L' : 4 , + 't' : t , + 'mu' : 0.5, + 'U' : 1.0 , + 'NONLOCAL' : 0 , + 'Nmax' : 2 , + 'THERMALIZATION' : 10000, + 'SWEEPS' : 500000 + } + ) + +#write the input file and run the simulation +input_file = pyalps.writeInputFiles('parm5a',parms) +res = pyalps.runApplication('worm',input_file,Tmin=5) + +#load the magnetization and collect it as function of field h +data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm5a'),'Stiffness') +rhos = pyalps.collectXY(data,x='t',y='Stiffness') + +#make plot +plt.figure() +pyalps.plot.plot(rhos) +plt.xlabel('Hopping $t/U$') +plt.ylabel('Superfluid density $\\rho _s$') +plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-05-bosons/tutorial5b.py b/content/en/tutorials/mcs/codes/mc-05-bosons/tutorial5b.py new file mode 100644 index 00000000..534aa039 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-05-bosons/tutorial5b.py @@ -0,0 +1,71 @@ +# **************************************************************************** +# +# 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 t in [0.045, 0.05, 0.0525, 0.055, 0.0575, 0.06, 0.065]: + for l in [4, 6, 8]: + parms.append( + { + 'LATTICE' : "square lattice", + 'MODEL' : "boson Hubbard", + 'T' : 0.05, + 'L' : l , + 't' : t , + 'U' : 1.0 , + 'mu' : 0.5, + 'NONLOCAL' : 0 , + 'Nmax' : 2 , + 'THERMALIZATION' : 15000, + 'SWEEPS' : 600000 + } + ) + +#write the input file and run the simulation +input_file = pyalps.writeInputFiles('parm5b',parms) +res = pyalps.runApplication('worm',input_file,Tmin=5) + +#load the magnetization and collect it as function of field h +data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm5b'),'Stiffness') +rhos = pyalps.collectXY(data,x='t',y='Stiffness',foreach=['L']) + +# multiply with the system size for the scaling plot +for s in rhos: + s.y = s.y * float(s.props['L']) + +#make plot +plt.figure() +pyalps.plot.plot(rhos) +plt.xlabel('Hopping $t/U$') +plt.ylabel('$\\rho _sL$') +plt.legend() +plt.title('Scaling plot for Bose-Hubbard model') +plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-06-qwl/parm6a b/content/en/tutorials/mcs/codes/mc-06-qwl/parm6a new file mode 100644 index 00000000..142654e8 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-06-qwl/parm6a @@ -0,0 +1,10 @@ +LATTICE="chain lattice" +MODEL="spin" +local_S=1/2 +L=40 +T_MIN = 0.1 +T_MAX = 10.0 +DELTA_T = 0.1 +CUTOFF = 500 +{J = -1} + diff --git a/content/en/tutorials/mcs/codes/mc-06-qwl/parm6b b/content/en/tutorials/mcs/codes/mc-06-qwl/parm6b new file mode 100644 index 00000000..9fbef812 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-06-qwl/parm6b @@ -0,0 +1,7 @@ +LATTICE="chain lattice" +MODEL="spin" +local_S=1/2 +L=40 +CUTOFF = 500 +{J = 1} + diff --git a/content/en/tutorials/mcs/codes/mc-06-qwl/parm6c b/content/en/tutorials/mcs/codes/mc-06-qwl/parm6c new file mode 100644 index 00000000..44634c13 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-06-qwl/parm6c @@ -0,0 +1,7 @@ +LATTICE="simple cubic lattice" +MODEL="spin" +local_S=1/2 +J=1 +CUTOFF = 500 +{L = 4} + diff --git a/content/en/tutorials/mcs/codes/mc-06-qwl/parm6d b/content/en/tutorials/mcs/codes/mc-06-qwl/parm6d new file mode 100644 index 00000000..c7a56525 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-06-qwl/parm6d @@ -0,0 +1,11 @@ +LATTICE="simple cubic lattice" +MODEL="spin" +local_S=1/2 +T=0.946 +J=1 +T_MIN = 0.5 +T_MAX = 5.0 +DELTA_T = 0.05 +CUTOFF = 1000 +{L = 6} + diff --git a/content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6a.py b/content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6a.py new file mode 100644 index 00000000..a237ed05 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6a.py @@ -0,0 +1,55 @@ +# **************************************************************************** +# +# 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 = [{ + 'LATTICE' : "chain lattice", + 'MODEL' : "spin", + 'local_S' : 0.5, + 'L' : 40, + 'J' : -1 , + 'CUTOFF' : 1000 + }] + +#write the input file and run the simulation +input_file = pyalps.writeInputFiles('parm6a',parms) +res = pyalps.runApplication('qwl',input_file) + +#run the evaluation and load all the plots +data = pyalps.evaluateQWL(pyalps.getResultFiles(prefix='parm6a'),DELTA_T=0.1, T_MIN=0.1, T_MAX=10.0) + +#make plot +for s in pyalps.flatten(data): + plt.figure() + plt.title("Ferromagnetic Heisenberg chain") + pyalps.plot.plot(s) + +plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6b.py b/content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6b.py new file mode 100644 index 00000000..835bb741 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6b.py @@ -0,0 +1,55 @@ +# **************************************************************************** +# +# 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 = [{ + 'LATTICE' : "chain lattice", + 'MODEL' : "spin", + 'local_S' : 0.5, + 'L' : 40, + 'J' : 1 , + 'CUTOFF' : 500 + }] + +#write the input file and run the simulation +input_file = pyalps.writeInputFiles('parm6b',parms) +res = pyalps.runApplication('qwl',input_file) + +#run the evaluation and load all the plots +data = pyalps.evaluateQWL(pyalps.getResultFiles(prefix='parm6b'),DELTA_T=0.1, T_MIN=0.1, T_MAX=10.0) + +#make plot +for s in pyalps.flatten(data): + plt.figure() + plt.title("Antiferromagnetic Heisenberg chain") + pyalps.plot.plot(s) + +plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6c.py b/content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6c.py new file mode 100644 index 00000000..3f548e8c --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6c.py @@ -0,0 +1,55 @@ +# **************************************************************************** +# +# 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 = [{ + 'LATTICE' : "simple cubic lattice", + 'MODEL' : "spin", + 'local_S' : 0.5, + 'L' : 4, + 'J' : 1 , + 'CUTOFF' : 500 + }] + +#write the input file and run the simulation +input_file = pyalps.writeInputFiles('parm6c',parms) +res = pyalps.runApplication('qwl',input_file) + +#run the evaluation and load all the plots +data = pyalps.evaluateQWL(pyalps.getResultFiles(prefix='parm6c'),DELTA_T=0.05, T_MIN=0.5, T_MAX=5.0) + +#make plot +for s in pyalps.flatten(data): + plt.figure() + plt.title("Cubic lattice Heisenberg antiferromagnet L=4") + pyalps.plot.plot(s) + +plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6d.py b/content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6d.py new file mode 100644 index 00000000..e594b398 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6d.py @@ -0,0 +1,74 @@ +from __future__ import print_function +# **************************************************************************** +# +# 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 +import copy + +#prepare the input parameters +parms=[] + +for (l,c) in [(4,500),( 6,1000)]: + parms.append( + { + 'LATTICE' : "simple cubic lattice", + 'MODEL' : "spin", + 'local_S' : 0.5, + 'L' : l, + 'J' : 1 , + 'CUTOFF' : c + } + ) + +#write the input file and run the simulation +input_file = pyalps.writeInputFiles('parm6d',parms) +pyalps.runApplication('qwl',input_file) + +#run the evaluation and load all the plots +results = pyalps.evaluateQWL(pyalps.getResultFiles(prefix='parm6d'),DELTA_T=0.05, T_MIN=0.5, T_MAX=1.5) + +#extract just the staggered structure factor S(Q) and rescale it by L^{-2+\eta} +data = [] +for s in pyalps.flatten(results): + if s.props['ylabel']=='Staggered Structure Factor per Site': + print('yes') + d = copy.deepcopy(s) # make a deep copy to not change the original + l = s.props['L'] + d.props['label']='L='+str(l) + d.y = d.y * pow(float(l),-1.97) + data.append(d) + +#make plot +plt.figure() +plt.title("Scaling plot for cubic lattice Heisenberg antiferromagnet") +pyalps.plot.plot(data) +plt.legend() +plt.xlabel('Temperature $T/J$') +plt.ylabel('$S(\pi,\pi,\pi) L^{-2+\eta}$') +plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-07-phase-transition/parm7a b/content/en/tutorials/mcs/codes/mc-07-phase-transition/parm7a new file mode 100644 index 00000000..e762527e --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-07-phase-transition/parm7a @@ -0,0 +1,85 @@ +LATTICE="square lattice" +T=2.269186 +J=1 +THERMALIZATION=1000 +UPDATE="cluster" +MODEL="Ising" + +L=4 +SWEEPS=400000 +{ T=5.0; } +{ T=4.5; } +{ T=4.0; } +{ T=3.5; } +{ T=3.0; } +{ T=2.9; } +{ T=2.8; } +{ T=2.7; } + +SWEEPS=40000 +{ T=2.6; } +{ T=2.5; } +{ T=2.4; } +{ T=2.3; } +{ T=2.2; } +{ T=2.1; } +{ T=2.0; } +{ T=1.9; } +{ T=1.8; } +{ T=1.7; } +{ T=1.6; } +{ T=1.5; } +{ T=1.2; } + + +L=8 +SWEEPS=400000 +{ T=5.0; } +{ T=4.5; } +{ T=4.0; } +{ T=3.5; } +{ T=3.0; } +{ T=2.9; } +{ T=2.8; } +{ T=2.7; } + +SWEEPS=40000 +{ T=2.6; } +{ T=2.5; } +{ T=2.4; } +{ T=2.3; } +{ T=2.2; } +{ T=2.1; } +{ T=2.0; } +{ T=1.9; } +{ T=1.8; } +{ T=1.7; } +{ T=1.6; } +{ T=1.5; } +{ T=1.2; } + +L=16 +SWEEPS=400000 +{ T=5.0; } +{ T=4.5; } +{ T=4.0; } +{ T=3.5; } +{ T=3.0; } +{ T=2.9; } +{ T=2.8; } + +SWEEPS=40000 +{ T=2.7; } +{ T=2.6; } +{ T=2.5; } +{ T=2.4; } +{ T=2.3; } +{ T=2.2; } +{ T=2.1; } +{ T=2.0; } +{ T=1.9; } +{ T=1.8; } +{ T=1.7; } +{ T=1.6; } +{ T=1.5; } +{ T=1.2; } diff --git a/content/en/tutorials/mcs/codes/mc-07-phase-transition/parm7b b/content/en/tutorials/mcs/codes/mc-07-phase-transition/parm7b new file mode 100644 index 00000000..400debf6 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-07-phase-transition/parm7b @@ -0,0 +1,58 @@ +LATTICE="square lattice" +T=2.269186 +J=1 +THERMALIZATION=5000 +SWEEPS=60000 +UPDATE="cluster" +MODEL="Ising" + +L=32 +SWEEPS=120000 +{T=2.24;} +{T=2.25;} +{T=2.26;} +{T=2.27;} +{T=2.28;} +{T=2.29;} +{T=2.30;} +{T=2.31;} +{T=2.32;} +{T=2.33;} +{T=2.34;} +{T=2.35;} + +L=48 +SWEEPS=200000 + + +{T=2.24;} +{T=2.25;} +{T=2.26;} +{T=2.27;} +{T=2.28;} +{T=2.29;} +{T=2.30;} +{T=2.31;} +{T=2.32;} +{T=2.33;} + + +L=64 +SWEEPS=200000 + +{T=2.24;} +{T=2.25;} +{T=2.26;} +{T=2.27;} +{T=2.28;} +{T=2.29;} +{T=2.30;} +{T=2.31;} +{T=2.32;} +{T=2.33;} + + + + + + diff --git a/content/en/tutorials/mcs/codes/mc-07-phase-transition/tutorial7a.py b/content/en/tutorials/mcs/codes/mc-07-phase-transition/tutorial7a.py new file mode 100644 index 00000000..7739414e --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-07-phase-transition/tutorial7a.py @@ -0,0 +1,109 @@ +# **************************************************************************** +# +# ALPS Project: Algorithms and Libraries for Physics Simulations +# +# ALPS Libraries +# +# Copyright (C) 2009-2010 by Brigitte Surer +# +# 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 [4,8,16]: + for t in [5.0,4.5,4.0,3.5,3.0,2.9,2.8,2.7]: + parms.append( + { + 'LATTICE' : "square lattice", + 'T' : t, + 'J' : 1 , + 'THERMALIZATION' : 1000, + 'SWEEPS' : 400000, + 'UPDATE' : "cluster", + 'MODEL' : "Ising", + 'L' : l + } + ) + for t in [2.6, 2.5, 2.4, 2.3, 2.2, 2.1, 2.0, 1.9, 1.8, 1.7, 1.6, 1.5, 1.2]: + parms.append( + { + 'LATTICE' : "square lattice", + 'T' : t, + 'J' : 1 , + 'THERMALIZATION' : 1000, + 'SWEEPS' : 40000, + 'UPDATE' : "cluster", + 'MODEL' : "Ising", + 'L' : l + } + ) + +#write the input file and run the simulation +input_file = pyalps.writeInputFiles('parm7a',parms) +pyalps.runApplication('spinmc',input_file,Tmin=5) +# use the following instead if you have MPI +#pyalps.runApplication('spinmc',input_file,Tmin=5,MPI=2) + +pyalps.evaluateSpinMC(pyalps.getResultFiles(prefix='parm7a')) + +#load the susceptibility and collect it as function of temperature T +data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm7a'),['|Magnetization|', 'Connected Susceptibility', 'Specific Heat', 'Binder Cumulant', 'Binder Cumulant U2']) +magnetization_abs = pyalps.collectXY(data,x='T',y='|Magnetization|',foreach=['L']) +connected_susc = pyalps.collectXY(data,x='T',y='Connected Susceptibility',foreach=['L']) +spec_heat = pyalps.collectXY(data,x='T',y='Specific Heat',foreach=['L']) +binder_u4 = pyalps.collectXY(data,x='T',y='Binder Cumulant',foreach=['L']) +binder_u2 = pyalps.collectXY(data,x='T',y='Binder Cumulant U2',foreach=['L']) + +#make plots +plt.figure() +pyalps.plot.plot(magnetization_abs) +plt.xlabel('Temperature $T$') +plt.ylabel('Magnetization $|m|$') +plt.title('2D Ising model') + +plt.figure() +pyalps.plot.plot(connected_susc) +plt.xlabel('Temperature $T$') +plt.ylabel('Connected Susceptibility $\chi_c$') +plt.title('2D Ising model') + +plt.figure() +pyalps.plot.plot(spec_heat) +plt.xlabel('Temperature $T$') +plt.ylabel('Specific Heat $c_v$') +plt.title('2D Ising model') + +plt.figure() +pyalps.plot.plot(binder_u4) +plt.xlabel('Temperature $T$') +plt.ylabel('Binder Cumulant U4 $g$') +plt.title('2D Ising model') + +plt.figure() +pyalps.plot.plot(binder_u2) +plt.xlabel('Temperature $T$') +plt.ylabel('Binder Cumulant U2 $g$') +plt.title('2D Ising model') +plt.show() + diff --git a/content/en/tutorials/mcs/codes/mc-07-phase-transition/tutorial7b.py b/content/en/tutorials/mcs/codes/mc-07-phase-transition/tutorial7b.py new file mode 100644 index 00000000..d1627a2f --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-07-phase-transition/tutorial7b.py @@ -0,0 +1,197 @@ +# **************************************************************************** +# +# ALPS Project: Algorithms and Libraries for Physics Simulations +# +# ALPS Libraries +# +# Copyright (C) 2009-2010 by Brigitte Surer +# +# 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 +import numpy as np +import pyalps.fit_wrapper as fw + +#prepare the input parameters +parms = [] +for l in [32,48,64]: + for t in [2.24, 2.25, 2.26, 2.27, 2.28, 2.29, 2.30, 2.31, 2.32, 2.33, 2.34, 2.35]: + parms.append( + { + 'LATTICE' : "square lattice", + 'T' : t, + 'J' : 1 , + 'THERMALIZATION' : 5000, + 'SWEEPS' : 150000, + 'UPDATE' : "cluster", + 'MODEL' : "Ising", + 'L' : l + } + ) + +#write the input file and run the simulation +input_file = pyalps.writeInputFiles('parm7b',parms) +pyalps.runApplication('spinmc',input_file,Tmin=5) +# use the following instead if you have MPI +#pyalps.runApplication('spinmc',input_file,Tmin=5,MPI=4) + +pyalps.evaluateSpinMC(pyalps.getResultFiles(prefix='parm7b')) + +#load the susceptibility and collect it as function of temperature T +# data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm7b'),['|Magnetization|', 'Connected Susceptibility', 'Specific Heat', 'Binder Cumulant', 'Binder Cumulant U2']) +# magnetization_abs = pyalps.collectXY(data,x='T',y='|Magnetization|',foreach=['L']) +# connected_susc = pyalps.collectXY(data,x='T',y='Connected Susceptibility',foreach=['L']) +# spec_heat = pyalps.collectXY(data,x='T',y='Specific Heat',foreach=['L']) +# binder_u4 = pyalps.collectXY(data,x='T',y='Binder Cumulant',foreach=['L']) +# binder_u2 = pyalps.collectXY(data,x='T',y='Binder Cumulant U2',foreach=['L']) +# +# #make a plot of the Binder cumulant: +# plt.figure() +# pyalps.plot.plot(binder_u4) +# plt.xlabel('Temperature $T$') +# plt.ylabel('Binder Cumulant U4 $g$') +# plt.title('2D Ising model') +# plt.show() +# +# #perform a data collapse of the Binder cumulant: +# Tc=2.269 #your estimate +# a=1 #your estimate +# +# for d in binder_u4: +# d.x -= Tc +# d.x = d.x/Tc +# l = d.props['L'] +# d.x = d.x * pow(float(l),a) +# +# plt.figure() +# pyalps.plot.plot(binder_u4) +# plt.xlabel('Rescaled Temperature $(T-T_c)/T_c L^{1/\nu}$') +# plt.ylabel('Binder Cumulant U4 $g$') +# plt.title('2D Ising model') +# plt.show() +# +# #make a plot of the specific heat and connected susceptibility: +# plt.figure() +# pyalps.plot.plot(connected_susc) +# plt.xlabel('Temperature $T$') +# plt.ylabel('Connected Susceptibility $\chi_c$') +# plt.title('2D Ising model') +# +# plt.figure() +# pyalps.plot.plot(spec_heat) +# plt.xlabel('Temperature $T$') +# plt.ylabel('Specific Heat $c_v$') +# plt.title('2D Ising model') +# plt.show() +# +# #make a fit of the connected susceptibility as a function of L: +# cs_mean=[] +# for q in connected_susc: +# cs_mean.append(np.array([d.mean for d in q.y])) +# +# peak_cs = pyalps.DataSet() +# peak_cs.props = pyalps.dict_intersect([q.props for q in connected_susc]) +# peak_cs.y = np.array([np.max(q) for q in cs_mean]) +# peak_cs.x = np.array([q.props['L'] for q in connected_susc]) +# +# sel = np.argsort(peak_cs.x) +# peak_cs.y = peak_cs.y[sel] +# peak_cs.x = peak_cs.x[sel] +# +# pars = [fw.Parameter(1), fw.Parameter(1)] +# f = lambda self, x, pars: pars[0]()*np.power(x,pars[1]()) +# fw.fit(None, f, pars, peak_cs.y, peak_cs.x) +# prefactor = pars[0].get() +# gamma_nu = pars[1].get() +# +# plt.figure() +# plt.plot(peak_cs.x, f(None, peak_cs.x, pars)) +# pyalps.plot.plot(peak_cs) +# plt.xlabel('System Size $L$') +# plt.ylabel('Connected Susceptibility $\chi_c(T_c)$') +# plt.title('2D Ising model, $\gamma$ is %.4s' % gamma_nu) +# plt.show() +# +# #make a fit of the specific heat as a function of L: +# sh_mean=[] +# for q in spec_heat: +# sh_mean.append(np.array([d.mean for d in q.y])) +# +# peak_sh = pyalps.DataSet() +# peak_sh.props = pyalps.dict_intersect([q.props for q in spec_heat]) +# peak_sh.y = np.array([np.max(q) for q in sh_mean]) +# peak_sh.x = np.array([q.props['L'] for q in spec_heat]) +# +# sel = np.argsort(peak_sh.x) +# peak_sh.y = peak_sh.y[sel] +# peak_sh.x = peak_sh.x[sel] +# +# pars = [fw.Parameter(1), fw.Parameter(1)] +# f = lambda self, x, pars: pars[0]()*np.power(x,pars[1]()) +# fw.fit(None, f, pars, peak_sh.y, peak_sh.x) +# prefactor = pars[0].get() +# alpha_nu = pars[1].get() +# +# plt.figure() +# plt.plot(peak_sh.x, f(None, peak_sh.x, pars)) +# pyalps.plot.plot(peak_cs) +# plt.xlabel('System Size $L$') +# plt.ylabel('Specific Heat $c_v(T_c)$') +# plt.title(r'2D Ising model, $\alpha$ is %.4s' % alpha_nu) +# plt.show() +# +# #make a data collapse of the connected susceptibility as a function of (T-Tc)/Tc: +# for d in connected_susc: +# d.x -= Tc +# d.x = d.x/Tc +# l = d.props['L'] +# d.x = d.x * pow(float(l),a) +# +# two_minus_eta=1.75 #your estimate +# for d in connected_susc: +# l = d.props['L'] +# d.y = d.y/pow(float(l),two_minus_eta) +# +# plt.figure() +# pyalps.plot.plot(connected_susc) +# plt.xlabel('Temperature $T$') +# plt.ylabel('Connected Susceptibility $\chi_c$') +# plt.title('2D Ising model') +# plt.show() +# +# #make a data collapse of the |magnetization| as a function of (T-Tc)/Tc +# for d in magnetization_abs: +# d.x -= Tc +# d.x = d.x/Tc +# l = d.props['L'] +# d.x = d.x * pow(float(l),a) +# beta_over_nu=... #your estimate +# for d in magnetization_abs: +# l = d.props['L'] +# d.y = d.y / pow(float(l),-beta_over_nu) +# +# plt.figure() +# pyalps.plot.plot(magnetization_abs) +# plt.xlabel('Temperature $T$') +# plt.ylabel('Magnetization $|m|$') +# plt.title('2D Ising model') +# plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8a b/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8a new file mode 100644 index 00000000..db3fe82d --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8a @@ -0,0 +1,71 @@ +LATTICE="coupled ladders" +MODEL="spin" +local_S=1/2 + +J0=1 +J1=1 + +THERMALIZATION=5000 +SWEEPS=50000 +ALGORITHM="loop" +SEED=0 + +L=8 +W=4 + +J2=0; + +{ T=3.0;} +{ T=2.8;} +{ T=2.6;} +{ T=2.4;} +{ T=2.2;} +{ T=2.0;} +{ T=1.9;} +{ T=1.8;} +{ T=1.7;} +{ T=1.6;} +{ T=1.5;} +{ T=1.4;} +{ T=1.3;} +{ T=1.2;} +{ T=1.1;} +{ T=1.0;} +{ T=0.9;} +{ T=0.8;} +{ T=0.7;} +{ T=0.6;} +{ T=0.5;} +{ T=0.4;} +{ T=0.3;} +{ T=0.2;} +{ T=0.1;} + +J2=1.; + +{ T=3.0;} +{ T=2.8;} +{ T=2.6;} +{ T=2.4;} +{ T=2.2;} +{ T=2.0;} +{ T=1.9;} +{ T=1.8;} +{ T=1.7;} +{ T=1.6;} +{ T=1.5;} +{ T=1.4;} +{ T=1.3;} +{ T=1.2;} +{ T=1.1;} +{ T=1.0;} +{ T=0.9;} +{ T=0.8;} +{ T=0.7;} +{ T=0.6;} +{ T=0.5;} +{ T=0.4;} +{ T=0.3;} +{ T=0.2;} +{ T=0.1;} + diff --git a/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8b b/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8b new file mode 100644 index 00000000..261c0322 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8b @@ -0,0 +1,52 @@ +LATTICE="coupled ladders" +MODEL="spin" +local_S=1/2 + +J0=1 +J1=1 + +THERMALIZATION=5000 +SWEEPS=50000 +ALGORITHM="loop" +SEED=0 + +L=8 +W=4 +BETA=16 + +{ J2=0.2;} +{ J2=0.25;} +{ J2=0.3;} +{ J2=0.35;} +{ J2=0.4;} + +L=10 +W=5 +BETA=20 + +{ J2=0.2;} +{ J2=0.25;} +{ J2=0.3;} +{ J2=0.35;} +{ J2=0.4;} + +L=12 +W=6 +BETA=24 + +{ J2=0.2;} +{ J2=0.25;} +{ J2=0.3;} +{ J2=0.35;} +{ J2=0.4;} + +L=16 +W=8 +BETA=32 + +{ J2=0.2;} +{ J2=0.25;} +{ J2=0.3;} +{ J2=0.35;} +{ J2=0.4;} + diff --git a/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8c b/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8c new file mode 100644 index 00000000..477d5efb --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8c @@ -0,0 +1,60 @@ +LATTICE="coupled ladders" +MODEL="spin" +local_S=1/2 + +J0=1 +J1=1 + +THERMALIZATION=5000 +SWEEPS=50000 +ALGORITHM="loop" +SEED=0 + +L=8 +W=4 +BETA=16 + +{ J2=1.8;} +{ J2=1.85;} +{ J2=1.9;} +{ J2=1.95;} +{ J2=2.;} +{ J2=2.05;} +{ J2=2.1;} + +L=10 +W=5 +BETA=20 + +{ J2=1.8;} +{ J2=1.85;} +{ J2=1.9;} +{ J2=1.95;} +{ J2=2.;} +{ J2=2.05;} +{ J2=2.1;} + +L=12 +W=6 +BETA=24 + +{ J2=1.8;} +{ J2=1.85;} +{ J2=1.9;} +{ J2=1.95;} +{ J2=2.;} +{ J2=2.05;} +{ J2=2.1;} + +L=16 +W=8 +BETA=32 + +{ J2=1.8;} +{ J2=1.85;} +{ J2=1.9;} +{ J2=1.95;} +{ J2=2.;} +{ J2=2.05;} +{ J2=2.1;} + diff --git a/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8d b/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8d new file mode 100644 index 00000000..340dd440 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8d @@ -0,0 +1,63 @@ +LATTICE="coupled ladders" +MODEL="spin" +local_S=1/2 + +J0=1 +J1=1 + +THERMALIZATION=5000 +SWEEPS=50000 +ALGORITHM="loop" +SEED=0 + +L=16 +W=8 +BETA=32 + +{ J2=0.31;} +{ J2=0.311;} +{ J2=0.312;} +{ J2=0.313;} +{ J2=0.314;} +{ J2=0.315;} +{ J2=0.316;} +{ J2=0.317;} +{ J2=0.318;} +{ J2=0.319;} +{ J2=0.32;} + +L=32 +W=16 +BETA=64 + +{ J2=0.31;} +{ J2=0.311;} +{ J2=0.312;} +{ J2=0.313;} +{ J2=0.314;} +{ J2=0.315;} +{ J2=0.316;} +{ J2=0.317;} +{ J2=0.318;} +{ J2=0.319;} +{ J2=0.32;} + +L=64 +W=32 +BETA=128 + +{ J2=0.312;} +{ J2=0.313;} +{ J2=0.314;} +{ J2=0.315;} +{ J2=0.316;} + +L=128 +W=64 +BETA=256 + +{ J2=0.312;} +{ J2=0.313;} +{ J2=0.314;} +{ J2=0.315;} +{ J2=0.316;} diff --git a/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8a.py b/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8a.py new file mode 100644 index 00000000..1debcc6d --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8a.py @@ -0,0 +1,85 @@ +from __future__ import print_function +# **************************************************************************** +# +# ALPS Project: Algorithms and Libraries for Physics Simulations +# +# ALPS Libraries +# +# Copyright (C) 2010 by Brigitte Surer +# +# 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 +import numpy as np +import pyalps.fit_wrapper as fw +from math import sqrt + +#prepare the input parameters +parms = [] +for j2 in [0.,1.]: + for t in [0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0,2.2,2.4,2.6,2.8,3.0]: + parms.append( + { + 'LATTICE' : "coupled ladders", + 'local_S' : 0.5, + 'ALGORITHM' : 'loop', + 'SEED' : 0, + 'T' : t, + 'J0' : 1 , + 'J1' : 1, + 'J2' : j2, + 'THERMALIZATION' : 5000, + 'SWEEPS' : 50000, + 'MODEL' : "spin", + 'L' : 8, + 'W' : 4 + } + ) + +#write the input file and run the simulation +input_file = pyalps.writeInputFiles('parm8a',parms) +pyalps.runApplication('loop',input_file) + +data = pyalps.loadMeasurements(pyalps.getResultFiles(pattern='parm8a.task*.out.h5'),['Staggered Susceptibility','Susceptibility']) +susc1=pyalps.collectXY(data,x='T',y='Susceptibility', foreach=['J2']) + +lines = [] +for data in susc1: + pars = [fw.Parameter(1), fw.Parameter(1)] + data.y= data.y[data.x < 1] + data.x= data.x[data.x < 1] + f = lambda self, x, pars: (pars[0]()/np.sqrt(x))*np.exp(-pars[1]()/x) + fw.fit(None, f, pars, np.array([v.mean for v in data.y]), data.x) + prefactor = pars[0].get() + gap = pars[1].get() + print(prefactor,gap) + + lines += plt.plot(data.x, f(None, data.x, pars)) + lines[-1].set_label('$J_2=%.4s$: $\chi = \\frac{%.4s}{T}\exp(\\frac{-%.4s}{T})$' % (data.props['J2'], prefactor,gap)) + +plt.figure() +pyalps.plot.plot(susc1) +plt.xlabel(r'$T$') +plt.ylabel(r'$\chi$') +plt.title('gap is %.4s' % gap) +plt.legend() +plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8b.py b/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8b.py new file mode 100644 index 00000000..77a7e1b1 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8b.py @@ -0,0 +1,79 @@ +# **************************************************************************** +# +# ALPS Project: Algorithms and Libraries for Physics Simulations +# +# ALPS Libraries +# +# Copyright (C) 2010 by Brigitte Surer +# +# 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 +import numpy as np + +#prepare the input parameters +parms = [] +for l in [8,10,12,16]: + for j2 in [0.2,0.25,0.3,0.35,0.4]: + parms.append( + { + 'LATTICE' : "coupled ladders", + 'local_S' : 0.5, + 'ALGORITHM' : 'loop', + 'SEED' : 0, + 'BETA' : 2*l, + 'J0' : 1 , + 'J1' : 1, + 'J2' : j2, + 'THERMALIZATION' : 5000, + 'SWEEPS' : 50000, + 'MODEL' : "spin", + 'L' : l, + 'W' : l/2 + } + ) + +#write the input file and run the simulation +input_file = pyalps.writeInputFiles('parm8b',parms) +pyalps.runApplication('loop',input_file) + +data = pyalps.loadMeasurements(pyalps.getResultFiles(pattern='parm8b.task*.out.h5'),['Binder Ratio of Staggered Magnetization','Stiffness']) + +binder=pyalps.collectXY(data,x='J2',y='Binder Ratio of Staggered Magnetization', foreach=['L']) +stiffness =pyalps.collectXY(data,x='J2',y='Stiffness', foreach=['L']) + +for q in stiffness: + q.y = q.y*q.props['L'] + +#make plot +plt.figure() +pyalps.plot.plot(stiffness) +plt.xlabel(r'$J2$') +plt.ylabel(r'Stiffness $\rho_s L$') +plt.title('coupled ladders') + +plt.figure() +pyalps.plot.plot(binder) +plt.xlabel(r'$J_2$') +plt.ylabel(r'$g(m_s)$') +plt.title('coupled ladders') +plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8c.py b/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8c.py new file mode 100644 index 00000000..1adee051 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8c.py @@ -0,0 +1,79 @@ +# **************************************************************************** +# +# ALPS Project: Algorithms and Libraries for Physics Simulations +# +# ALPS Libraries +# +# Copyright (C) 2010 by Brigitte Surer +# +# 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 +import numpy as np + +#prepare the input parameters +parms = [] +for l in [8,10,12,16]: + for j2 in [1.8,1.85,1.9,1.95,2.,2.05,2.1]: + parms.append( + { + 'LATTICE' : "coupled ladders", + 'local_S' : 0.5, + 'ALGORITHM' : 'loop', + 'SEED' : 0, + 'BETA' : 2*l, + 'J0' : 1 , + 'J1' : 1, + 'J2' : j2, + 'THERMALIZATION' : 5000, + 'SWEEPS' : 50000, + 'MODEL' : "spin", + 'L' : l, + 'W' : l/2 + } + ) + +#write the input file and run the simulation +input_file = pyalps.writeInputFiles('parm8c',parms) +pyalps.runApplication('loop',input_file) + +data = pyalps.loadMeasurements(pyalps.getResultFiles(pattern='parm8c.task*.out.h5'),['Binder Ratio of Staggered Magnetization','Stiffness']) + +binder=pyalps.collectXY(data,x='J2',y='Binder Ratio of Staggered Magnetization', foreach=['L']) +stiffness =pyalps.collectXY(data,x='J2',y='Stiffness', foreach=['L']) + +for q in stiffness: + q.y = q.y*q.props['L'] + +#make plot +plt.figure() +pyalps.plot.plot(stiffness) +plt.xlabel(r'$J2$') +plt.ylabel(r'Stiffness $\rho_s L$') +plt.title('coupled ladders') + +plt.figure() +pyalps.plot.plot(binder) +plt.xlabel(r'$J_2$') +plt.ylabel(r'$g(m_s)$') +plt.title('coupled ladders') +plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8d.py b/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8d.py new file mode 100644 index 00000000..d91f66b2 --- /dev/null +++ b/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8d.py @@ -0,0 +1,79 @@ +# **************************************************************************** +# +# ALPS Project: Algorithms and Libraries for Physics Simulations +# +# ALPS Libraries +# +# Copyright (C) 2010 by Brigitte Surer +# +# 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 +import numpy as np + +#prepare the input parameters +parms = [] +for l in [8,10,12,16]: + for j2 in [1.8,1.85,1.9,1.95,2.,2.05,2.1]: + parms.append( + { + 'LATTICE' : "coupled ladders", + 'local_S' : 0.5, + 'ALGORITHM' : 'loop', + 'SEED' : 0, + 'BETA' : l, + 'J0' : 1 , + 'J1' : 1, + 'J2' : j2, + 'THERMALIZATION' : 5000, + 'SWEEPS' : 50000, + 'MODEL' : "spin", + 'L' : l, + 'W' : l/2 + } + ) + +#write the input file and run the simulation +input_file = pyalps.writeInputFiles('parm8d',parms) +pyalps.runApplication('loop',input_file) + +data = pyalps.loadMeasurements(pyalps.getResultFiles(pattern='parm8d.task*.out.h5'),['Binder Ratio of Staggered Magnetization','Stiffness']) + +binder=pyalps.collectXY(data,x='J2',y='Binder Ratio of Staggered Magnetization', foreach=['L']) +stiffness =pyalps.collectXY(data,x='J2',y='Stiffness', foreach=['L']) + +for q in stiffness: + q.y = q.y*q.props['L'] + +#make plot +plt.figure() +pyalps.plot.plot(stiffness) +plt.xlabel(r'$J2$') +plt.ylabel(r'Stiffness $\rho_s L$') +plt.title('coupled ladders') + +plt.figure() +pyalps.plot.plot(binder) +plt.xlabel(r'$J_2$') +plt.ylabel(r'$g(m_s)$') +plt.title('coupled ladders') +plt.show() diff --git a/content/en/tutorials/mcs/mc01a.md b/content/en/tutorials/mcs/mc01a.md index f12b3149..d2e5ed64 100644 --- a/content/en/tutorials/mcs/mc01a.md +++ b/content/en/tutorials/mcs/mc01a.md @@ -23,7 +23,7 @@ This tutorial can be run either on the command line or in Python. We recommend t ### Setting up and running the simulation on the command line -To set up and run the simulation on the command line, we first create a parameter file that specifies the parameters of the simulation(s). The downloadable file will be titled `parm1a`, with the following contents: +To set up and run the simulation on the command line, we first create a parameter file that specifies the parameters of the simulation(s). The downloadable file will be titled `parm1a`, with the following contents: ``` LATTICE="square lattice" @@ -100,7 +100,7 @@ Look at all six tasks and, by studying the binning analysis in the files `parm1a The `pyalps` package is a wrapper for ALPS: All it does is call the commands described in the previous section as if they were run in a terminal. It is superior for plotting because the output of the simulation can be read directly into a Python data structure and accessed by `matplotlib`. It also comes with a wrapper `pyalps.plot` for certain matplotlib functions to neatly plot data generated by `pyalps`. -To set up and run the simulation in Python, we create a script named `tutorial1a.py`. The first part of this script must import the required modules and prepare the input job and task files. Instead of writing a parameter file and using `convert2xml`, we store a list containing each task's parameters as a dictionary, like so: +To set up and run the simulation in Python, we create a script named `tutorial1a.py`. The first part of this script must import the required modules and prepare the input job and task files. Instead of writing a parameter file and using `convert2xml`, we store a list containing each task's parameters as a dictionary, like so: ```Python import pyalps @@ -197,7 +197,7 @@ We therefore repeat the simulations with cluster updates, using fewer thermaliza ### Command line -The downloadable parameter file `parm1b` has the following contents: +The downloadable parameter file `parm1b` has the following contents: ``` LATTICE="square lattice" @@ -224,7 +224,7 @@ spinmc --Tmin 10 --write-xml parm1b.in.xml ### Python -The script `tutorial1b.py` follows the same structure as `tutorial1a.py`, with the updated parameters and `parm1b` as the file prefix: +The script `tutorial1b.py` follows the same structure as `tutorial1a.py`, with the updated parameters and `parm1b` as the file prefix: ```Python import pyalps diff --git a/content/en/tutorials/mcs/mc01b.md b/content/en/tutorials/mcs/mc01b.md index 35503c86..46446982 100644 --- a/content/en/tutorials/mcs/mc01b.md +++ b/content/en/tutorials/mcs/mc01b.md @@ -22,7 +22,7 @@ Both are checked by inspecting the time series of a measured observable — in t ### Preparing and running the simulation on the command line -The parameter file `parm1a` sets up a single simulation of the Ising model on a $48 \times 48$ square lattice at the critical temperature: +The parameter file `parm1a` sets up a single simulation of the Ising model on a $48 \times 48$ square lattice at the critical temperature: ``` LATTICE="square lattice" @@ -44,7 +44,7 @@ spinmc --Tmin 10 --write-xml parm1a.in.xml ### Preparing and running the simulation in Python -The full script is available as `tutorial1a.py`. +The full script is available as `tutorial1a.py`. It begins by importing the required modules and defining the simulation parameters: ```Python diff --git a/content/en/tutorials/mcs/mc02.md b/content/en/tutorials/mcs/mc02.md index 760506c0..d7a7823f 100644 --- a/content/en/tutorials/mcs/mc02.md +++ b/content/en/tutorials/mcs/mc02.md @@ -20,7 +20,7 @@ The comparison highlights two key contrasts: how quantum fluctuations modify the #### Setting up and running on the command line -The parameter file `parm2a` sets up simulations of the classical ferromagnetic Heisenberg model on a chain of 60 sites across a range of temperatures: +The parameter file `parm2a` sets up simulations of the classical ferromagnetic Heisenberg model on a chain of 60 sites across a range of temperatures: ``` LATTICE="chain lattice" @@ -56,7 +56,7 @@ spinmc --Tmin 10 --write-xml parm2a.in.xml #### Setting up and running in Python -The script `tutorial2a.py` sets up and runs the same simulation. Place it in the same folder as `parm2a`: +The script `tutorial2a.py` sets up and runs the same simulation. Place it in the same folder as `parm2a`: ```Python import pyalps @@ -110,7 +110,7 @@ Aside from the lattice change and the two couplings, the simulation setup is ide #### Setting up and running on the command line -Download `parm2b` and place it in the same folder: +Download `parm2b` and place it in the same folder: ``` LATTICE="ladder" @@ -147,7 +147,7 @@ spinmc --Tmin 10 --write-xml parm2b.in.xml #### Setting up and running in Python -The script `tutorial2b.py` is a copy of `tutorial2a.py` with three changes: the prefix renamed to `parm2b`, `LATTICE` set to `"ladder"`, and `J` replaced by `J0` and `J1` (both `-1`). +The script `tutorial2b.py` is a copy of `tutorial2a.py` with three changes: the prefix renamed to `parm2b`, `LATTICE` set to `"ladder"`, and `J` replaced by `J0` and `J1` (both `-1`). ## Quantum Heisenberg models @@ -162,7 +162,7 @@ The key parameter changes, relative to the classical case, are: #### Setting up and running on the command line -Download `parm2c`: +Download `parm2c`: ``` LATTICE="chain lattice" @@ -200,7 +200,7 @@ loop parm2c.in.xml #### Setting up and running in Python -The script `tutorial2c.py` adapts `tutorial2a.py` to the quantum parameters and calls `loop` instead of `spinmc`: +The script `tutorial2c.py` adapts `tutorial2a.py` to the quantum parameters and calls `loop` instead of `spinmc`: ```Python input_file = pyalps.writeInputFiles('parm2c', parms) @@ -223,7 +223,7 @@ Unlike the gapless chain, the two-leg antiferromagnetic Heisenberg ladder has a #### Setting up and running on the command line -Download `parm2d`: +Download `parm2d`: ``` LATTICE="ladder" @@ -257,11 +257,11 @@ loop parm2d.in.xml #### Setting up and running in Python -The script `tutorial2d.py` adapts `tutorial2c.py`: rename the prefix to `parm2d`, change `LATTICE` to `"ladder"`, and replace `J` with `J0` and `J1` (both `1`). +The script `tutorial2d.py` adapts `tutorial2c.py`: rename the prefix to `parm2d`, change `LATTICE` to `"ladder"`, and replace `J` with `J0` and `J1` (both `1`). ## Combining all four simulations -After running all four simulations in the same folder, the script `tutorial2full.py` loads all results together and overlays them on a single plot. +After running all four simulations in the same folder, the script `tutorial2full.py` loads all results together and overlays them on a single plot. ```Python import pyalps diff --git a/content/en/tutorials/mcs/mc03.md b/content/en/tutorials/mcs/mc03.md index 14b56500..b19bcacd 100644 --- a/content/en/tutorials/mcs/mc03.md +++ b/content/en/tutorials/mcs/mc03.md @@ -20,7 +20,7 @@ The temperature is low enough that the results are close to the ground-state mag #### Setting up and running on the command line -The parameter file `parm3a`: +The parameter file `parm3a`: ``` LATTICE="chain lattice" @@ -61,7 +61,7 @@ dirloop_sse --Tmin 10 --write-xml parm3a.in.xml #### Setting up and running in Python -The script `tutorial3a.py`: +The script `tutorial3a.py`: ```Python import pyalps @@ -114,7 +114,7 @@ We use 20 rungs (40 sites total) and extend the field range to $h = 3.5$ to reac #### Setting up and running on the command line -The parameter file `parm3b` uses the same structure as `parm3a` with these changes: +The parameter file `parm3b` uses the same structure as `parm3a` with these changes: ``` LATTICE="ladder" @@ -154,7 +154,7 @@ dirloop_sse --Tmin 10 --write-xml parm3b.in.xml #### Setting up and running in Python -The script `tutorial3b.py` adapts `tutorial3a.py`: rename the prefix to `parm3b`, change `LATTICE` to `"ladder"`, replace `J` with `J0=J1=1`, and extend the field scan to 3.5. +The script `tutorial3b.py` adapts `tutorial3a.py`: rename the prefix to `parm3b`, change `LATTICE` to `"ladder"`, replace `J` with `J0=J1=1`, and extend the field scan to 3.5. #### Evaluating and plotting @@ -175,7 +175,7 @@ In contrast to the chain, the ladder magnetization is zero up to a finite lower ## Combining both simulations -After running both simulations in the same folder, the script `tutorial3full.py` overlays the two magnetization curves on a single plot: +After running both simulations in the same folder, the script `tutorial3full.py` overlays the two magnetization curves on a single plot: ```Python import pyalps diff --git a/content/en/tutorials/mcs/mc04.md b/content/en/tutorials/mcs/mc04.md index 626cf0e0..185165e3 100644 --- a/content/en/tutorials/mcs/mc04.md +++ b/content/en/tutorials/mcs/mc04.md @@ -20,7 +20,7 @@ The small system size allows a fast simulation; finite-size effects are signific ### Command line -The parameter file `parm4` enables three additional measurement flags alongside the standard parameters: +The parameter file `parm4` enables three additional measurement flags alongside the standard parameters: ``` MODEL="spin" @@ -53,7 +53,7 @@ dirloop_sse --Tmin 10 --write-xml parm4.in.xml ### Python -The script `tutorial4.py`: +The script `tutorial4.py`: ```Python import pyalps diff --git a/content/en/tutorials/mcs/mc05.md b/content/en/tutorials/mcs/mc05.md index 98cffae6..c29233d8 100644 --- a/content/en/tutorials/mcs/mc05.md +++ b/content/en/tutorials/mcs/mc05.md @@ -22,7 +22,7 @@ The Hilbert space is truncated at `Nmax=2` bosons per site, which is a good appr ### Command line -The parameter file `parm5a`: +The parameter file `parm5a`: ``` LATTICE="square lattice" @@ -58,7 +58,7 @@ worm --Tmin 10 --write-xml parm5a.in.xml ### Python -The script `tutorial5a.py`: +The script `tutorial5a.py`: ```Python import pyalps @@ -115,7 +115,7 @@ We simulate three system sizes $L = 4, 6, 8$ on a fine grid of hopping values ar ### Command line -The parameter file `parm5b`: +The parameter file `parm5b`: ``` LATTICE="square lattice" @@ -159,7 +159,7 @@ worm --Tmin 10 --write-xml parm5b.in.xml ### Python -The script `tutorial5b.py`: +The script `tutorial5b.py`: ```Python import pyalps diff --git a/content/en/tutorials/mcs/mc06.md b/content/en/tutorials/mcs/mc06.md index ae713c5c..43bd172a 100644 --- a/content/en/tutorials/mcs/mc06.md +++ b/content/en/tutorials/mcs/mc06.md @@ -14,7 +14,7 @@ From a single simulation one can then evaluate thermodynamic observables — ene ### The ferromagnetic Heisenberg chain -The parameter file `parm6a` sets up a QWL simulation of the $S=\frac{1}{2}$ Heisenberg ferromagnet on a chain of 40 sites: +The parameter file `parm6a` sets up a QWL simulation of the $S=\frac{1}{2}$ Heisenberg ferromagnet on a chain of 40 sites: ``` LATTICE="chain lattice" @@ -64,7 +64,7 @@ The tools `plot2xmgr` (Grace) and `plot2gp` (Gnuplot) produce equivalent output ### Python -The script `tutorial6a.py` sets up and runs the simulation, then evaluates all observables in one call: +The script `tutorial6a.py` sets up and runs the simulation, then evaluates all observables in one call: ```python import pyalps @@ -85,7 +85,7 @@ For the ferromagnet ($J=-1$) you should see a broad specific-heat peak at low te ### The antiferromagnetic Heisenberg chain To simulate the antiferromagnetic chain set $J=1$ instead of $J=-1$. -The parameters are in `parm6b` and the Python script in `tutorial6b.py`; everything else is identical to the ferromagnetic case. +The parameters are in `parm6b` and the Python script in `tutorial6b.py`; everything else is identical to the ferromagnetic case. For the antiferromagnet the uniform susceptibility remains finite as $T\to 0$ (a signature of the spin-liquid ground state of the 1D antiferromagnet), while the specific-heat peak shifts and broadens differently. @@ -93,8 +93,8 @@ For the antiferromagnet the uniform susceptibility remains finite as $T\to 0$ (a ### Simulating the 3D quantum Heisenberg antiferromagnet -The parameter file `parm6c` sets up a QWL simulation of the $S=\frac{1}{2}$ Heisenberg antiferromagnet on a simple cubic lattice with $4^3=64$ sites. -The Python script is `tutorial6c.py`. +The parameter file `parm6c` sets up a QWL simulation of the $S=\frac{1}{2}$ Heisenberg antiferromagnet on a simple cubic lattice with $4^3=64$ sites. +The Python script is `tutorial6c.py`. Run and evaluate exactly as for the chain above. The staggered structure factor $S(\pi,\pi,\pi)$ should start rising steeply near $T\approx 1$, signaling the onset of antiferromagnetic correlations. @@ -105,7 +105,7 @@ The specific heat shows a corresponding peak and the entropy decreases rapidly i Finite-size scaling predicts that the staggered structure factor at the critical point scales as $S(L) \propto L^{2-\eta}$ with $\eta \approx 0.034$ (3D classical Heisenberg universality class). A plot of $S(L)/L^{2-\eta}$ vs. temperature should show curves for different $L$ crossing at the critical temperature $T_c$. -The parameter file `parm6d` (or `tutorial6d.py`) runs the cubic antiferromagnet for two system sizes ($L=4$ and $L=6$) with a larger `CUTOFF=1000` to maintain accuracy at lower temperatures. +The parameter file `parm6d` (or `tutorial6d.py`) runs the cubic antiferromagnet for two system sizes ($L=4$ and $L=6$) with a larger `CUTOFF=1000` to maintain accuracy at lower temperatures. After running, load the results: ```python diff --git a/content/en/tutorials/mcs/mc07.md b/content/en/tutorials/mcs/mc07.md index a3c6d420..bdc42781 100644 --- a/content/en/tutorials/mcs/mc07.md +++ b/content/en/tutorials/mcs/mc07.md @@ -19,7 +19,7 @@ Start the fine-grid simulations now so they run while you work through the rest ### Command line -Download `parm7b` and run: +Download `parm7b` and run: ``` parameter2xml parm7b @@ -30,7 +30,7 @@ The `--Tmin 10` flag sets a checkpoint interval of 10 seconds, allowing the simu ### Python -The first part of `tutorial7b.py` sets up and launches the same simulation: +The first part of `tutorial7b.py` sets up and launches the same simulation: ```Python import pyalps @@ -65,7 +65,7 @@ We first make a coarse temperature scan on small systems to locate the critical ### Command line -Download `parm7a` and run: +Download `parm7a` and run: ``` parameter2xml parm7a @@ -74,7 +74,7 @@ spinmc --Tmin 5 parm7a.in.xml ### Python -Using `tutorial7a.py`: +Using `tutorial7a.py`: ```Python import pyalps diff --git a/content/en/tutorials/mcs/mc08.md b/content/en/tutorials/mcs/mc08.md index 092a4886..810b5ce6 100644 --- a/content/en/tutorials/mcs/mc08.md +++ b/content/en/tutorials/mcs/mc08.md @@ -38,7 +38,7 @@ Start it now so it runs in the background while you work through the rest of the ### Command line -Download `parm8b` and run: +Download `parm8b` and run: ``` parameter2xml parm8b @@ -47,20 +47,20 @@ loop parm8b.in.xml & ### Python -Run the first part of `tutorial8b.py` (the setup and `pyalps.runApplication` call) in a separate terminal or as a background process before continuing. +Run the first part of `tutorial8b.py` (the setup and `pyalps.runApplication` call) in a separate terminal or as a background process before continuing. ## Identify the different phases We begin by considering the two simple limits: decoupled ladders ($J_2=0$) and the isotropic square lattice ($J_2=1$). The decoupled ladders have a ground state with short-range correlations and exhibit a finite spin gap: this is a spin liquid phase. The square lattice, by contrast, displays long-range order with a finite staggered magnetization: this is an antiferromagnetic Néel phase. -A clear way to probe these two phases is through the magnetic susceptibility $\chi$. Simulate an $8\times 8$ system over a range of temperatures for both cases and compare the results. For decoupled ladders the susceptibility exhibits activated behavior at low temperature due to the spin gap; on the square lattice it tends to a finite constant as $T\to 0$. Note that on any finite system $\chi$ will eventually tend to zero at low enough temperature due to the finite-size gap, but this is not our focus here. Run the simulation on the command line with parameter file `parm8a`: +A clear way to probe these two phases is through the magnetic susceptibility $\chi$. Simulate an $8\times 8$ system over a range of temperatures for both cases and compare the results. For decoupled ladders the susceptibility exhibits activated behavior at low temperature due to the spin gap; on the square lattice it tends to a finite constant as $T\to 0$. Note that on any finite system $\chi$ will eventually tend to zero at low enough temperature due to the finite-size gap, but this is not our focus here. Run the simulation on the command line with parameter file `parm8a`: ``` parameter2xml parm8a loop parm8a.in.xml ``` -or with the Python script `tutorial8a.py`. +or with the Python script `tutorial8a.py`. ```Python import pyalps @@ -201,7 +201,7 @@ Both observables crossing (rather than one diverging) confirms that the transiti You have obtained a rough estimate of the quantum critical point $J_2^c$. As in the classical case, extracting the critical exponents requires a more precise determination of $J_2^c$. -This is done by running larger system sizes on a finer grid of $J_2$ values, as set up in `parm8d` and `tutorial8d.py`. Note that these simulations are CPU-intensive and are left as an exercise. Plot the Binder cumulant $U_4$ and the rescaled stiffness $\rho_s L$ for different system sizes; the crossing point gives a refined estimate of $J_2^c$. To extract $\nu$, consider how the derivatives of these quantities with respect to $J_2$, evaluated at $J_2^c$, scale with system size. These derivatives can in principle be measured directly in the Monte Carlo, but for this tutorial it is sufficient to compute them by numerical differentiation using the fine $J_2$ grid. +This is done by running larger system sizes on a finer grid of $J_2$ values, as set up in `parm8d` and `tutorial8d.py`. Note that these simulations are CPU-intensive and are left as an exercise. Plot the Binder cumulant $U_4$ and the rescaled stiffness $\rho_s L$ for different system sizes; the crossing point gives a refined estimate of $J_2^c$. To extract $\nu$, consider how the derivatives of these quantities with respect to $J_2$, evaluated at $J_2^c$, scale with system size. These derivatives can in principle be measured directly in the Monte Carlo, but for this tutorial it is sufficient to compute them by numerical differentiation using the fine $J_2$ grid. Perform the numerical differentiations for the different system sizes for both quantities, and plot their values at $J_2^c$ as a function of system size. Data should scale as a power law: @@ -225,7 +225,7 @@ When $J_2$ is very large, the inter-ladder coupling dominates over the intra-lad This is again a gapped spin liquid phase, so the phase diagram has the structure: spin liquid → Néel AFM → spin liquid as $J_2$ increases from 0 to large values. There must therefore be a second quantum critical point $J_2^{c_2}$ at which the Néel order is destroyed. -We repeat the finite-size scaling analysis in the parameter regime $J_2 \in [1.8, 2.1]$ using the parameter file `parm8c` or the script `tutorial8c.py`, which use the same system sizes and $\beta=2L$ as `parm8b` but scan the higher-$J_2$ range. +We repeat the finite-size scaling analysis in the parameter regime $J_2 \in [1.8, 2.1]$ using the parameter file `parm8c` or the script `tutorial8c.py`, which use the same system sizes and $\beta=2L$ as `parm8b` but scan the higher-$J_2$ range. ### Command line From 6322871d3aa5241e88848b95949388583eaad9bf Mon Sep 17 00:00:00 2001 From: Marcus Rosales Date: Tue, 11 Aug 2026 15:05:28 -0400 Subject: [PATCH 2/4] Download MCS scripts from ALPSim/ALPS instead of vendoring them Same change as the DMFT branch, in response to the review there: keeping copies of the tutorial scripts in the website repo means two copies that inevitably drift apart. Drop the 46 vendored files under content/en/tutorials/mcs/codes/ and point the links back at ALPSim/ALPS. To keep the reader on the page -- the reason the copies were vendored -- add a click handler that fetches the raw file and saves it via a blob URL. The HTML download attribute is ignored cross-origin, but raw.githubusercontent.com sends access-control-allow-origin: *, so the fetch is permitted and the blob counts as same-origin for the purposes of download. The links are pinned to daa7392 rather than tracking master, matching the DMFT branch: the pages reproduce each file inline, so tracking master would let the displayed text and the downloaded file diverge silently. All 46 paths were confirmed to resolve at that commit. The handler and its baseof.html wiring are byte-identical to the copies on feat/dmft-local-downloads, so the two branches merge cleanly in either order. Whichever lands second contributes only its content changes. Co-Authored-By: Claude Opus 5 --- .../mcs/codes/mc-01-autocorrelations/parm1a | 13 -- .../mcs/codes/mc-01-autocorrelations/parm1b | 13 -- .../mc-01-autocorrelations/tutorial1a.py | 79 ------- .../mc-01-autocorrelations/tutorial1b.py | 77 ------- .../parm1a | 8 - .../tutorial1a.py | 71 ------- .../mcs/codes/mc-02-susceptibilities/parm2a | 24 --- .../mcs/codes/mc-02-susceptibilities/parm2b | 26 --- .../mcs/codes/mc-02-susceptibilities/parm2c | 24 --- .../mcs/codes/mc-02-susceptibilities/parm2d | 22 -- .../mc-02-susceptibilities/tutorial2a.py | 66 ------ .../mc-02-susceptibilities/tutorial2b.py | 64 ------ .../mc-02-susceptibilities/tutorial2c.py | 64 ------ .../mc-02-susceptibilities/tutorial2d.py | 65 ------ .../mc-02-susceptibilities/tutorial2full.py | 64 ------ .../mcs/codes/mc-03-magnetization/parm3a | 28 --- .../mcs/codes/mc-03-magnetization/parm3b | 29 --- .../codes/mc-03-magnetization/tutorial3a.py | 64 ------ .../codes/mc-03-magnetization/tutorial3b.py | 65 ------ .../mc-03-magnetization/tutorial3full.py | 51 ----- .../mcs/codes/mc-04-measurements/parm4 | 13 -- .../mcs/codes/mc-04-measurements/tutorial4.py | 60 ------ .../tutorials/mcs/codes/mc-05-bosons/parm5a | 25 --- .../tutorials/mcs/codes/mc-05-bosons/parm5b | 37 ---- .../mcs/codes/mc-05-bosons/tutorial5a.py | 64 ------ .../mcs/codes/mc-05-bosons/tutorial5b.py | 71 ------- .../en/tutorials/mcs/codes/mc-06-qwl/parm6a | 10 - .../en/tutorials/mcs/codes/mc-06-qwl/parm6b | 7 - .../en/tutorials/mcs/codes/mc-06-qwl/parm6c | 7 - .../en/tutorials/mcs/codes/mc-06-qwl/parm6d | 11 - .../mcs/codes/mc-06-qwl/tutorial6a.py | 55 ----- .../mcs/codes/mc-06-qwl/tutorial6b.py | 55 ----- .../mcs/codes/mc-06-qwl/tutorial6c.py | 55 ----- .../mcs/codes/mc-06-qwl/tutorial6d.py | 74 ------- .../mcs/codes/mc-07-phase-transition/parm7a | 85 -------- .../mcs/codes/mc-07-phase-transition/parm7b | 58 ------ .../mc-07-phase-transition/tutorial7a.py | 109 ---------- .../mc-07-phase-transition/tutorial7b.py | 197 ------------------ .../mc-08-quantum-phase-transition/parm8a | 71 ------- .../mc-08-quantum-phase-transition/parm8b | 52 ----- .../mc-08-quantum-phase-transition/parm8c | 60 ------ .../mc-08-quantum-phase-transition/parm8d | 63 ------ .../tutorial8a.py | 85 -------- .../tutorial8b.py | 79 ------- .../tutorial8c.py | 79 ------- .../tutorial8d.py | 79 ------- content/en/tutorials/mcs/mc01a.md | 8 +- content/en/tutorials/mcs/mc01b.md | 4 +- content/en/tutorials/mcs/mc02.md | 18 +- content/en/tutorials/mcs/mc03.md | 10 +- content/en/tutorials/mcs/mc04.md | 4 +- content/en/tutorials/mcs/mc05.md | 8 +- content/en/tutorials/mcs/mc06.md | 12 +- content/en/tutorials/mcs/mc07.md | 8 +- content/en/tutorials/mcs/mc08.md | 12 +- 55 files changed, 42 insertions(+), 2520 deletions(-) delete mode 100644 content/en/tutorials/mcs/codes/mc-01-autocorrelations/parm1a delete mode 100644 content/en/tutorials/mcs/codes/mc-01-autocorrelations/parm1b delete mode 100644 content/en/tutorials/mcs/codes/mc-01-autocorrelations/tutorial1a.py delete mode 100644 content/en/tutorials/mcs/codes/mc-01-autocorrelations/tutorial1b.py delete mode 100644 content/en/tutorials/mcs/codes/mc-01b-equilibration-and-convergence/parm1a delete mode 100644 content/en/tutorials/mcs/codes/mc-01b-equilibration-and-convergence/tutorial1a.py delete mode 100644 content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2a delete mode 100644 content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2b delete mode 100644 content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2c delete mode 100644 content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2d delete mode 100644 content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2a.py delete mode 100644 content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2b.py delete mode 100644 content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2c.py delete mode 100644 content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2d.py delete mode 100644 content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2full.py delete mode 100644 content/en/tutorials/mcs/codes/mc-03-magnetization/parm3a delete mode 100644 content/en/tutorials/mcs/codes/mc-03-magnetization/parm3b delete mode 100644 content/en/tutorials/mcs/codes/mc-03-magnetization/tutorial3a.py delete mode 100644 content/en/tutorials/mcs/codes/mc-03-magnetization/tutorial3b.py delete mode 100644 content/en/tutorials/mcs/codes/mc-03-magnetization/tutorial3full.py delete mode 100644 content/en/tutorials/mcs/codes/mc-04-measurements/parm4 delete mode 100644 content/en/tutorials/mcs/codes/mc-04-measurements/tutorial4.py delete mode 100644 content/en/tutorials/mcs/codes/mc-05-bosons/parm5a delete mode 100644 content/en/tutorials/mcs/codes/mc-05-bosons/parm5b delete mode 100644 content/en/tutorials/mcs/codes/mc-05-bosons/tutorial5a.py delete mode 100644 content/en/tutorials/mcs/codes/mc-05-bosons/tutorial5b.py delete mode 100644 content/en/tutorials/mcs/codes/mc-06-qwl/parm6a delete mode 100644 content/en/tutorials/mcs/codes/mc-06-qwl/parm6b delete mode 100644 content/en/tutorials/mcs/codes/mc-06-qwl/parm6c delete mode 100644 content/en/tutorials/mcs/codes/mc-06-qwl/parm6d delete mode 100644 content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6a.py delete mode 100644 content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6b.py delete mode 100644 content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6c.py delete mode 100644 content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6d.py delete mode 100644 content/en/tutorials/mcs/codes/mc-07-phase-transition/parm7a delete mode 100644 content/en/tutorials/mcs/codes/mc-07-phase-transition/parm7b delete mode 100644 content/en/tutorials/mcs/codes/mc-07-phase-transition/tutorial7a.py delete mode 100644 content/en/tutorials/mcs/codes/mc-07-phase-transition/tutorial7b.py delete mode 100644 content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8a delete mode 100644 content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8b delete mode 100644 content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8c delete mode 100644 content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8d delete mode 100644 content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8a.py delete mode 100644 content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8b.py delete mode 100644 content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8c.py delete mode 100644 content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8d.py diff --git a/content/en/tutorials/mcs/codes/mc-01-autocorrelations/parm1a b/content/en/tutorials/mcs/codes/mc-01-autocorrelations/parm1a deleted file mode 100644 index 2c874bc7..00000000 --- a/content/en/tutorials/mcs/codes/mc-01-autocorrelations/parm1a +++ /dev/null @@ -1,13 +0,0 @@ -LATTICE="square lattice" -T=2.269186 -J=1 -THERMALIZATION=10000 -SWEEPS=50000 -UPDATE="local" -MODEL="Ising" -{L=2;} -{L=4;} -{L=8;} -{L=16;} -{L=32;} -{L=48;} diff --git a/content/en/tutorials/mcs/codes/mc-01-autocorrelations/parm1b b/content/en/tutorials/mcs/codes/mc-01-autocorrelations/parm1b deleted file mode 100644 index 4dbd416f..00000000 --- a/content/en/tutorials/mcs/codes/mc-01-autocorrelations/parm1b +++ /dev/null @@ -1,13 +0,0 @@ -LATTICE="square lattice" -T=2.269186 -J=1 -THERMALIZATION=1000 -SWEEPS=100000 -UPDATE="cluster" -MODEL="Ising" -{L=2;} -{L=4;} -{L=8;} -{L=16;} -{L=32;} -{L=48;} diff --git a/content/en/tutorials/mcs/codes/mc-01-autocorrelations/tutorial1a.py b/content/en/tutorials/mcs/codes/mc-01-autocorrelations/tutorial1a.py deleted file mode 100644 index 9bf822ba..00000000 --- a/content/en/tutorials/mcs/codes/mc-01-autocorrelations/tutorial1a.py +++ /dev/null @@ -1,79 +0,0 @@ -# **************************************************************************** -# -# 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() - - - diff --git a/content/en/tutorials/mcs/codes/mc-01-autocorrelations/tutorial1b.py b/content/en/tutorials/mcs/codes/mc-01-autocorrelations/tutorial1b.py deleted file mode 100644 index 12359c02..00000000 --- a/content/en/tutorials/mcs/codes/mc-01-autocorrelations/tutorial1b.py +++ /dev/null @@ -1,77 +0,0 @@ -# **************************************************************************** -# -# 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' : 1000, - 'SWEEPS' : 100000, - 'UPDATE' : "cluster", - 'MODEL' : "Ising", - 'L' : l - } - ) - -#write the input file and run the simulation -input_file = pyalps.writeInputFiles('parm1b',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='parm1b'),'|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.title('Binning analysis for cluster updates') -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() diff --git a/content/en/tutorials/mcs/codes/mc-01b-equilibration-and-convergence/parm1a b/content/en/tutorials/mcs/codes/mc-01b-equilibration-and-convergence/parm1a deleted file mode 100644 index 28f9fd62..00000000 --- a/content/en/tutorials/mcs/codes/mc-01b-equilibration-and-convergence/parm1a +++ /dev/null @@ -1,8 +0,0 @@ -LATTICE="square lattice" -T=2.269186 -J=1 -THERMALIZATION=10000 -SWEEPS=50000 -UPDATE="local" -MODEL="Ising" -{L=48;} diff --git a/content/en/tutorials/mcs/codes/mc-01b-equilibration-and-convergence/tutorial1a.py b/content/en/tutorials/mcs/codes/mc-01b-equilibration-and-convergence/tutorial1a.py deleted file mode 100644 index 3d58bbf8..00000000 --- a/content/en/tutorials/mcs/codes/mc-01b-equilibration-and-convergence/tutorial1a.py +++ /dev/null @@ -1,71 +0,0 @@ -from __future__ import print_function -############################################################################# -# -# ALPS Project Applications: Directed Worm Algorithm -# -# Copyright (C) 2013 by Lode Pollet -# Ping Nang Ma -# 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. -# -############################################################################# - -# The headers -import pyalps - -# Set up a python list of parameters (python) dictionaries: -parms = [{ - 'LATTICE' : "square lattice", - 'MODEL' : "Ising", - 'L' : 48, - 'J' : 1., - 'T' : 2.269186, - 'THERMALIZATION' : 10000, - 'SWEEPS' : 50000, -}] - -# Write into XML input file: -input_file = pyalps.writeInputFiles('parm1a',parms) - -# and run the application spinmc: -pyalps.runApplication('spinmc', input_file, Tmin=10, writexml=True) - -# We first get the list of all hdf5 result files via: -files = pyalps.getResultFiles(prefix='parm1a') - -# and then extract, say the timeseries of the |Magnetization| measurements: -ts_M = pyalps.loadTimeSeries(files[0], '|Magnetization|'); - -# We can then visualize graphically: -import matplotlib.pyplot as plt -plt.plot(ts_M) -plt.show() - -# ALPS Python provides a convenient tool to check whether a measurement observable(s) has (have) reached steady state equilibrium. -# -# Here is one example: -print(pyalps.checkSteadyState(outfile=files[0], observable='|Magnetization|', confidenceInterval=0.95)) -print() - -# and another one: -observables = pyalps.loadMeasurements(files, ['|Magnetization|', 'Energy']) -observables = pyalps.checkSteadyState(observables, confidenceInterval=0.95) -for o in observables: - print('{}:\t{}'.format(o.props['observable'], o.props['checkSteadyState'])) - diff --git a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2a b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2a deleted file mode 100644 index f1036e49..00000000 --- a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2a +++ /dev/null @@ -1,24 +0,0 @@ -LATTICE="chain lattice" -L=60 -J=-1 -THERMALIZATION=15000 -SWEEPS=150000 -UPDATE="cluster" -MODEL="Heisenberg" -{T=0.05;} -{T=0.1;} -{T=0.2;} -{T=0.3;} -{T=0.4;} -{T=0.5;} -{T=0.6;} -{T=0.7;} -SWEEPS=500000 -{T=0.8;} -{T=0.9;} -{T=1.0;} -{T=1.25;} -{T=1.5;} -{T=1.75;} -{T=2.0;} - diff --git a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2b b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2b deleted file mode 100644 index 1a40be04..00000000 --- a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2b +++ /dev/null @@ -1,26 +0,0 @@ -LATTICE="ladder" -L=60 -J0=-1 -J1=-1 -THERMALIZATION=15000 -SWEEPS=150000 -UPDATE="cluster" -MODEL="Heisenberg" -{T=0.05;} -{T=0.1;} -{T=0.2;} -{T=0.3;} -{T=0.4;} -{T=0.5;} -{T=0.6;} -SWEEPS=500000 -{T=0.7;} -{T=0.8;} -{T=0.9;} -{T=1.0;} -{T=1.25;} -{T=1.5;} -{T=1.75;} -{T=2.0;} - - diff --git a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2c b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2c deleted file mode 100644 index 04a85fae..00000000 --- a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2c +++ /dev/null @@ -1,24 +0,0 @@ -LATTICE="chain lattice" -MODEL="spin" -local_S=1/2 -L=60 -J=1 -THERMALIZATION=5000 -SWEEPS=50000 -ALGORITHM="loop" -{T=0.05;} -{T=0.1;} -{T=0.2;} -{T=0.3;} -{T=0.4;} -{T=0.5;} -{T=0.6;} -{T=0.7;} -{T=0.75;} -{T=0.8;} -{T=0.9;} -{T=1.0;} -{T=1.25;} -{T=1.5;} -{T=1.75;} -{T=2.0;} diff --git a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2d b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2d deleted file mode 100644 index 39595480..00000000 --- a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/parm2d +++ /dev/null @@ -1,22 +0,0 @@ -LATTICE="ladder" -MODEL="spin" -local_S=1/2 -L=60 -J0=1 -J1=1 -THERMALIZATION=5000 -SWEEPS=50000 -ALGORITHM="loop" -{T=0.1;} -{T=0.2;} -{T=0.3;} -{T=0.4;} -{T=0.5;} -{T=0.6;} -{T=0.7;} -{T=0.8;} -{T=1.0;} -{T=1.25;} -{T=1.5;} -{T=1.75;} -{T=2.0;} diff --git a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2a.py b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2a.py deleted file mode 100644 index a772b796..00000000 --- a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2a.py +++ /dev/null @@ -1,66 +0,0 @@ -# **************************************************************************** -# -# 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 -#skip this part if you already ran the simulation from the command line -parms = [] -for t in [0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.25, 1.5, 1.75, 2.0]: - parms.append( - { - 'LATTICE' : "chain lattice", - 'T' : t, - 'J' : -1 , - 'THERMALIZATION' : 10000, - 'SWEEPS' : 500000, - 'UPDATE' : "cluster", - 'MODEL' : "Heisenberg", - 'L' : 60 - } - ) - -#write the input file and run the simulation -#skip this part if you already ran the simulation from the command line -input_file = pyalps.writeInputFiles('parm2a',parms) -pyalps.runApplication('spinmc',input_file,Tmin=5) - - -#load the susceptibility and collect it as function of temperature T -data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm2a'),'Susceptibility') -susceptibility = pyalps.collectXY(data,x='T',y='Susceptibility') - -#make plot -plt.figure() -pyalps.plot.plot(susceptibility) -plt.xlabel('Temperature $T/J$') -plt.ylabel('Susceptibility $\chi J$') -plt.ylim(0,0.22) -plt.title('Classical Heisenberg chain') -plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2b.py b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2b.py deleted file mode 100644 index 6f9e22ab..00000000 --- a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2b.py +++ /dev/null @@ -1,64 +0,0 @@ -# **************************************************************************** -# -# 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 t in [0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.25, 1.5, 1.75, 2.0]: - parms.append( - { - 'LATTICE' : "ladder", - 'T' : t, - 'J0' : -1 , - 'J1' : -1 , - 'THERMALIZATION' : 10000, - 'SWEEPS' : 500000, - 'UPDATE' : "cluster", - 'MODEL' : "Heisenberg", - 'L' : 60 - } - ) - -#write the input file and run the simulation -input_file = pyalps.writeInputFiles('parm2b',parms) -pyalps.runApplication('spinmc',input_file,Tmin=5) - -#load the susceptibility and collect it as function of temperature T -data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm2b'),'Susceptibility') -susceptibility = pyalps.collectXY(data,x='T',y='Susceptibility') - -#make plot -plt.figure() -pyalps.plot.plot(susceptibility) -plt.xlabel('Temperature $T/J$') -plt.ylabel('Susceptibility $\chi J$') -plt.ylim(0,0.22) -plt.title('Heisenberg ladder') -plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2c.py b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2c.py deleted file mode 100644 index 4c36407c..00000000 --- a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2c.py +++ /dev/null @@ -1,64 +0,0 @@ -# **************************************************************************** -# -# 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 t in [0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.25, 1.5, 1.75, 2.0]: - parms.append( - { - 'LATTICE' : "chain lattice", - 'MODEL' : "spin", - 'local_S' : 0.5, - 'T' : t, - 'J' : 1 , - 'THERMALIZATION' : 5000, - 'SWEEPS' : 50000, - 'L' : 60, - 'ALGORITHM' : "loop" - } - ) - -#write the input file and run the simulation -input_file = pyalps.writeInputFiles('parm2c',parms) -pyalps.runApplication('loop',input_file) - -#load the susceptibility and collect it as function of temperature T -data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm2c'),'Susceptibility') -susceptibility = pyalps.collectXY(data,x='T',y='Susceptibility') - -#make plot -plt.figure() -pyalps.plot.plot(susceptibility) -plt.xlabel('Temperature $T/J$') -plt.ylabel('Susceptibility $\chi J$') -plt.ylim(0,0.22) -plt.title('Quantum Heisenberg chain') -plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2d.py b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2d.py deleted file mode 100644 index 5ac6ea11..00000000 --- a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2d.py +++ /dev/null @@ -1,65 +0,0 @@ -# **************************************************************************** -# -# 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 t in [0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.25, 1.5, 1.75, 2.0]: - parms.append( - { - 'LATTICE' : "ladder", - 'MODEL' : "spin", - 'local_S' : 0.5, - 'T' : t, - 'J0' : 1 , - 'J1' : 1 , - 'THERMALIZATION' : 5000, - 'SWEEPS' : 50000, - 'L' : 60, - 'ALGORITHM' : "loop" - } - ) - -#write the input file and run the simulation -input_file = pyalps.writeInputFiles('parm2d',parms) -pyalps.runApplication('loop',input_file) - -#load the susceptibility and collect it as function of temperature T -data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm2d'),'Susceptibility') -susceptibility = pyalps.collectXY(data,x='T',y='Susceptibility') - -#make plot -plt.figure() -pyalps.plot.plot(susceptibility) -plt.xlabel('Temperature $T/J$') -plt.ylabel('Susceptibility $\chi J$') -plt.ylim(0,0.22) -plt.title('Quantum Heisenberg ladder') -plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2full.py b/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2full.py deleted file mode 100644 index 4e60645f..00000000 --- a/content/en/tutorials/mcs/codes/mc-02-susceptibilities/tutorial2full.py +++ /dev/null @@ -1,64 +0,0 @@ -# **************************************************************************** -# -# 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. -# -# **************************************************************************** - -# Please run all four other tutorials before running this one. -# This tutorial relies on the results created in those tutorials - -import pyalps -import matplotlib.pyplot as plt -import pyalps.plot - -# load all files -data = pyalps.loadMeasurements(pyalps.getResultFiles(),'Susceptibility') - -#flatten the hierarchical structure -data = pyalps.flatten(data) - -# collect the susceptibility -susceptibility = pyalps.collectXY(data,x='T',y='Susceptibility',foreach=['MODEL','LATTICE']) - -# assign labels to the data depending on the properties -for s in susceptibility: - # print s.props - if s.props['LATTICE']=='chain lattice': - s.props['label'] = "chain" - elif s.props['LATTICE']=='ladder': - s.props['label'] = "ladder" - if s.props['MODEL']=='spin': - s.props['label'] = "quantum " + s.props['label'] - elif s.props['MODEL']=='Heisenberg': - s.props['label'] = "classical " + s.props['label'] - -#make plot -plt.figure() -pyalps.plot.plot(susceptibility) -plt.xlabel('Temperature $T/J$') -plt.ylabel('Susceptibility $\chi J$') -plt.ylim(0,0.25) -plt.legend() -plt.show() - diff --git a/content/en/tutorials/mcs/codes/mc-03-magnetization/parm3a b/content/en/tutorials/mcs/codes/mc-03-magnetization/parm3a deleted file mode 100644 index aecb8c6f..00000000 --- a/content/en/tutorials/mcs/codes/mc-03-magnetization/parm3a +++ /dev/null @@ -1,28 +0,0 @@ -LATTICE="chain lattice" -MODEL = "spin" -local_S=1/2 -L=20 -J=1 -T=0.08 -THERMALIZATION=1000 -SWEEPS=10000 -{h=0;} -{h=0.1;} -{h=0.2;} -{h=0.3;} -{h=0.4;} -{h=0.5;} -{h=0.6;} -{h=0.7;} -{h=0.8;} -{h=0.9;} -{h=1.0;} -SWEEPS=10000; -{h=1.2;} -{h=1.4;} -{h=1.6;} -{h=1.8;} -{h=2.0;} -{h=2.2;} -{h=2.4;} -{h=2.5;} diff --git a/content/en/tutorials/mcs/codes/mc-03-magnetization/parm3b b/content/en/tutorials/mcs/codes/mc-03-magnetization/parm3b deleted file mode 100644 index 642868d7..00000000 --- a/content/en/tutorials/mcs/codes/mc-03-magnetization/parm3b +++ /dev/null @@ -1,29 +0,0 @@ -LATTICE="ladder" -MODEL = "spin" -local_S=1/2 -L=20 -J0=1 -J1=1 -T=0.08 -THERMALIZATION=1000 -SWEEPS=10000 -{h=0;} -{h=0.1;} -{h=0.2;} -{h=0.3;} -{h=0.4;} -{h=0.5;} -{h=0.6;} -{h=0.8;} -{h=1.0;} -{h=1.25;} -SWEEPS=5000 -{h=1.5;} -{h=1.75;} -{h=2.0;} -{h=2.25;} -{h=2.5;} -{h=2.75;} -{h=3.0;} -{h=3.25;} -{h=3.5;} diff --git a/content/en/tutorials/mcs/codes/mc-03-magnetization/tutorial3a.py b/content/en/tutorials/mcs/codes/mc-03-magnetization/tutorial3a.py deleted file mode 100644 index 8beb785b..00000000 --- a/content/en/tutorials/mcs/codes/mc-03-magnetization/tutorial3a.py +++ /dev/null @@ -1,64 +0,0 @@ -# **************************************************************************** -# -# 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 h in [0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.5]: - parms.append( - { - 'LATTICE' : "chain lattice", - 'MODEL' : "spin", - 'local_S' : 0.5, - 'T' : 0.08, - 'J' : 1 , - 'THERMALIZATION' : 1000, - 'SWEEPS' : 10000, - 'L' : 20, - 'h' : h - } - ) - -#write the input file and run the simulation -input_file = pyalps.writeInputFiles('parm3a',parms) -res = pyalps.runApplication('dirloop_sse',input_file,Tmin=5) - -#load the magnetization and collect it as function of field h -data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm3a'),'Magnetization Density') -magnetization = pyalps.collectXY(data,x='h',y='Magnetization Density') - -#make plot -plt.figure() -pyalps.plot.plot(magnetization) -plt.xlabel('Field $h$') -plt.ylabel('Magnetization $m$') -plt.ylim(0.0,0.5) -plt.title('Quantum Heisenberg chain') -plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-03-magnetization/tutorial3b.py b/content/en/tutorials/mcs/codes/mc-03-magnetization/tutorial3b.py deleted file mode 100644 index 8bc76d54..00000000 --- a/content/en/tutorials/mcs/codes/mc-03-magnetization/tutorial3b.py +++ /dev/null @@ -1,65 +0,0 @@ -# **************************************************************************** -# -# 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 h in [0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75, 3.0, 3.25, 3.5]: - parms.append( - { - 'LATTICE' : "ladder", - 'MODEL' : "spin", - 'local_S' : 0.5, - 'T' : 0.08, - 'J0' : 1 , - 'J1' : 1 , - 'THERMALIZATION' : 1000, - 'SWEEPS' : 10000, - 'L' : 20, - 'h' : h - } - ) - -#write the input file and run the simulation -input_file = pyalps.writeInputFiles('parm3b',parms) -res = pyalps.runApplication('dirloop_sse',input_file,Tmin=5) - -#load the magnetization and collect it as function of field h -data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm3b'),'Magnetization Density') -magnetization = pyalps.collectXY(data,x='h',y='Magnetization Density') - -#make plot -plt.figure() -pyalps.plot.plot(magnetization) -plt.xlabel('Field $h$') -plt.ylabel('Magnetization $m$') -plt.ylim(0.0,0.5) -plt.title('Quantum Heisenberg ladder') -plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-03-magnetization/tutorial3full.py b/content/en/tutorials/mcs/codes/mc-03-magnetization/tutorial3full.py deleted file mode 100644 index 84c4103c..00000000 --- a/content/en/tutorials/mcs/codes/mc-03-magnetization/tutorial3full.py +++ /dev/null @@ -1,51 +0,0 @@ -# **************************************************************************** -# -# 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. -# -# **************************************************************************** - -# Please run the two other tutorials before running this one. -# This tutorial relies on the results created in those tutorials - -import pyalps -import matplotlib.pyplot as plt -import pyalps.plot - -# load all files -data = pyalps.loadMeasurements(pyalps.getResultFiles(),'Magnetization Density') - -#flatten the hierarchical structure -data = pyalps.flatten(data) - -#load the magnetization and collect it as function of field h -magnetization = pyalps.collectXY(data,x='h',y='Magnetization Density',foreach=['LATTICE']) - -#make plot -plt.figure() -pyalps.plot.plot(magnetization) -plt.xlabel('Field $h$') -plt.ylabel('Magnetization $m$') -plt.ylim(0.0,0.5) -plt.legend() -plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-04-measurements/parm4 b/content/en/tutorials/mcs/codes/mc-04-measurements/parm4 deleted file mode 100644 index eaa02b1f..00000000 --- a/content/en/tutorials/mcs/codes/mc-04-measurements/parm4 +++ /dev/null @@ -1,13 +0,0 @@ -MODEL="spin"; -LATTICE="square lattice"; -REPRESENTATION="SSE"; -MEASURE[Correlations]=true; -MEASURE[Structure Factor]=true; -MEASURE[Green Function]=true; -THERMALIZATION=10000; -SWEEPS=500000; -J=1; -L=4; -W=4; -T=0.3; -{h=0.1;} diff --git a/content/en/tutorials/mcs/codes/mc-04-measurements/tutorial4.py b/content/en/tutorials/mcs/codes/mc-04-measurements/tutorial4.py deleted file mode 100644 index a70421fc..00000000 --- a/content/en/tutorials/mcs/codes/mc-04-measurements/tutorial4.py +++ /dev/null @@ -1,60 +0,0 @@ -from __future__ import print_function -# **************************************************************************** -# -# 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 - -#prepare the input parameters -parms = [{ - 'LATTICE' : "square lattice", - 'MODEL' : "spin", - 'MEASURE[Correlations]' : True, - 'MEASURE[Structure Factor]' : True, - 'MEASURE[Green Function]' : True, - 'local_S' : 0.5, - 'T' : 0.3, - 'J' : 1 , - 'THERMALIZATION' : 10000, - 'SWEEPS' : 500000, - 'L' : 4, - 'h' : 0.1 - }] - -#write the input file and run the simulation -input_file = pyalps.writeInputFiles('parm4',parms) -res = pyalps.runApplication('dirloop_sse',input_file,Tmin=5) - -#load the magnetization and collect it as function of field h -data = pyalps.loadMeasurements(pyalps.getResultFiles()) - -# print all measurements -for s in pyalps.flatten(data): - if len(s.x)==1: - print(s.props['observable'], ' : ', s.y[0]) - else: - for (x,y) in zip(s.x,s.y): - print(s.props['observable'], x, ' : ', y) diff --git a/content/en/tutorials/mcs/codes/mc-05-bosons/parm5a b/content/en/tutorials/mcs/codes/mc-05-bosons/parm5a deleted file mode 100644 index f0909af1..00000000 --- a/content/en/tutorials/mcs/codes/mc-05-bosons/parm5a +++ /dev/null @@ -1,25 +0,0 @@ - LATTICE="square lattice"; - L=4; - - MODEL="boson Hubbard"; - NONLOCAL=0; - U = 1.0; - mu = 0.5; - Nmax = 2; - - T = 0.1; - - SWEEPS=500000; - THERMALIZATION=10000; - - { t=0.01; } - { t=0.02; } - { t=0.03; } - { t=0.04; } - { t=0.05; } - { t=0.06; } - { t=0.07; } - { t=0.08; } - { t=0.09; } - { t=0.1; } - diff --git a/content/en/tutorials/mcs/codes/mc-05-bosons/parm5b b/content/en/tutorials/mcs/codes/mc-05-bosons/parm5b deleted file mode 100644 index 71aa761b..00000000 --- a/content/en/tutorials/mcs/codes/mc-05-bosons/parm5b +++ /dev/null @@ -1,37 +0,0 @@ - LATTICE="square lattice"; - - MODEL="boson Hubbard"; - NONLOCAL = 0; - U = 1.0; - mu = 0.5; - Nmax = 2; - - T = 0.05; - - SWEEPS=600000; - THERMALIZATION=15000; - - { L=4; t=0.045; } - { L=4; t=0.05; } - { L=4; t=0.0525; } - { L=4; t=0.055; } - { L=4; t=0.0575; } - { L=4; t=0.06; } - { L=4; t=0.065; } - - { L=6; t=0.045; } - { L=6; t=0.05; } - { L=6; t=0.0525; } - { L=6; t=0.055; } - { L=6; t=0.0575; } - { L=6; t=0.06; } - { L=6; t=0.065; } - - { L=8; t=0.045; } - { L=8; t=0.05; } - { L=8; t=0.0525; } - { L=8; t=0.055; } - { L=8; t=0.0575; } - { L=8; t=0.06; } - { L=8; t=0.065; } - diff --git a/content/en/tutorials/mcs/codes/mc-05-bosons/tutorial5a.py b/content/en/tutorials/mcs/codes/mc-05-bosons/tutorial5a.py deleted file mode 100644 index e62a1565..00000000 --- a/content/en/tutorials/mcs/codes/mc-05-bosons/tutorial5a.py +++ /dev/null @@ -1,64 +0,0 @@ -# **************************************************************************** -# -# 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 t in [0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1]: - parms.append( - { - 'LATTICE' : "square lattice", - 'MODEL' : "boson Hubbard", - 'T' : 0.1, - 'L' : 4 , - 't' : t , - 'mu' : 0.5, - 'U' : 1.0 , - 'NONLOCAL' : 0 , - 'Nmax' : 2 , - 'THERMALIZATION' : 10000, - 'SWEEPS' : 500000 - } - ) - -#write the input file and run the simulation -input_file = pyalps.writeInputFiles('parm5a',parms) -res = pyalps.runApplication('worm',input_file,Tmin=5) - -#load the magnetization and collect it as function of field h -data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm5a'),'Stiffness') -rhos = pyalps.collectXY(data,x='t',y='Stiffness') - -#make plot -plt.figure() -pyalps.plot.plot(rhos) -plt.xlabel('Hopping $t/U$') -plt.ylabel('Superfluid density $\\rho _s$') -plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-05-bosons/tutorial5b.py b/content/en/tutorials/mcs/codes/mc-05-bosons/tutorial5b.py deleted file mode 100644 index 534aa039..00000000 --- a/content/en/tutorials/mcs/codes/mc-05-bosons/tutorial5b.py +++ /dev/null @@ -1,71 +0,0 @@ -# **************************************************************************** -# -# 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 t in [0.045, 0.05, 0.0525, 0.055, 0.0575, 0.06, 0.065]: - for l in [4, 6, 8]: - parms.append( - { - 'LATTICE' : "square lattice", - 'MODEL' : "boson Hubbard", - 'T' : 0.05, - 'L' : l , - 't' : t , - 'U' : 1.0 , - 'mu' : 0.5, - 'NONLOCAL' : 0 , - 'Nmax' : 2 , - 'THERMALIZATION' : 15000, - 'SWEEPS' : 600000 - } - ) - -#write the input file and run the simulation -input_file = pyalps.writeInputFiles('parm5b',parms) -res = pyalps.runApplication('worm',input_file,Tmin=5) - -#load the magnetization and collect it as function of field h -data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm5b'),'Stiffness') -rhos = pyalps.collectXY(data,x='t',y='Stiffness',foreach=['L']) - -# multiply with the system size for the scaling plot -for s in rhos: - s.y = s.y * float(s.props['L']) - -#make plot -plt.figure() -pyalps.plot.plot(rhos) -plt.xlabel('Hopping $t/U$') -plt.ylabel('$\\rho _sL$') -plt.legend() -plt.title('Scaling plot for Bose-Hubbard model') -plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-06-qwl/parm6a b/content/en/tutorials/mcs/codes/mc-06-qwl/parm6a deleted file mode 100644 index 142654e8..00000000 --- a/content/en/tutorials/mcs/codes/mc-06-qwl/parm6a +++ /dev/null @@ -1,10 +0,0 @@ -LATTICE="chain lattice" -MODEL="spin" -local_S=1/2 -L=40 -T_MIN = 0.1 -T_MAX = 10.0 -DELTA_T = 0.1 -CUTOFF = 500 -{J = -1} - diff --git a/content/en/tutorials/mcs/codes/mc-06-qwl/parm6b b/content/en/tutorials/mcs/codes/mc-06-qwl/parm6b deleted file mode 100644 index 9fbef812..00000000 --- a/content/en/tutorials/mcs/codes/mc-06-qwl/parm6b +++ /dev/null @@ -1,7 +0,0 @@ -LATTICE="chain lattice" -MODEL="spin" -local_S=1/2 -L=40 -CUTOFF = 500 -{J = 1} - diff --git a/content/en/tutorials/mcs/codes/mc-06-qwl/parm6c b/content/en/tutorials/mcs/codes/mc-06-qwl/parm6c deleted file mode 100644 index 44634c13..00000000 --- a/content/en/tutorials/mcs/codes/mc-06-qwl/parm6c +++ /dev/null @@ -1,7 +0,0 @@ -LATTICE="simple cubic lattice" -MODEL="spin" -local_S=1/2 -J=1 -CUTOFF = 500 -{L = 4} - diff --git a/content/en/tutorials/mcs/codes/mc-06-qwl/parm6d b/content/en/tutorials/mcs/codes/mc-06-qwl/parm6d deleted file mode 100644 index c7a56525..00000000 --- a/content/en/tutorials/mcs/codes/mc-06-qwl/parm6d +++ /dev/null @@ -1,11 +0,0 @@ -LATTICE="simple cubic lattice" -MODEL="spin" -local_S=1/2 -T=0.946 -J=1 -T_MIN = 0.5 -T_MAX = 5.0 -DELTA_T = 0.05 -CUTOFF = 1000 -{L = 6} - diff --git a/content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6a.py b/content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6a.py deleted file mode 100644 index a237ed05..00000000 --- a/content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6a.py +++ /dev/null @@ -1,55 +0,0 @@ -# **************************************************************************** -# -# 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 = [{ - 'LATTICE' : "chain lattice", - 'MODEL' : "spin", - 'local_S' : 0.5, - 'L' : 40, - 'J' : -1 , - 'CUTOFF' : 1000 - }] - -#write the input file and run the simulation -input_file = pyalps.writeInputFiles('parm6a',parms) -res = pyalps.runApplication('qwl',input_file) - -#run the evaluation and load all the plots -data = pyalps.evaluateQWL(pyalps.getResultFiles(prefix='parm6a'),DELTA_T=0.1, T_MIN=0.1, T_MAX=10.0) - -#make plot -for s in pyalps.flatten(data): - plt.figure() - plt.title("Ferromagnetic Heisenberg chain") - pyalps.plot.plot(s) - -plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6b.py b/content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6b.py deleted file mode 100644 index 835bb741..00000000 --- a/content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6b.py +++ /dev/null @@ -1,55 +0,0 @@ -# **************************************************************************** -# -# 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 = [{ - 'LATTICE' : "chain lattice", - 'MODEL' : "spin", - 'local_S' : 0.5, - 'L' : 40, - 'J' : 1 , - 'CUTOFF' : 500 - }] - -#write the input file and run the simulation -input_file = pyalps.writeInputFiles('parm6b',parms) -res = pyalps.runApplication('qwl',input_file) - -#run the evaluation and load all the plots -data = pyalps.evaluateQWL(pyalps.getResultFiles(prefix='parm6b'),DELTA_T=0.1, T_MIN=0.1, T_MAX=10.0) - -#make plot -for s in pyalps.flatten(data): - plt.figure() - plt.title("Antiferromagnetic Heisenberg chain") - pyalps.plot.plot(s) - -plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6c.py b/content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6c.py deleted file mode 100644 index 3f548e8c..00000000 --- a/content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6c.py +++ /dev/null @@ -1,55 +0,0 @@ -# **************************************************************************** -# -# 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 = [{ - 'LATTICE' : "simple cubic lattice", - 'MODEL' : "spin", - 'local_S' : 0.5, - 'L' : 4, - 'J' : 1 , - 'CUTOFF' : 500 - }] - -#write the input file and run the simulation -input_file = pyalps.writeInputFiles('parm6c',parms) -res = pyalps.runApplication('qwl',input_file) - -#run the evaluation and load all the plots -data = pyalps.evaluateQWL(pyalps.getResultFiles(prefix='parm6c'),DELTA_T=0.05, T_MIN=0.5, T_MAX=5.0) - -#make plot -for s in pyalps.flatten(data): - plt.figure() - plt.title("Cubic lattice Heisenberg antiferromagnet L=4") - pyalps.plot.plot(s) - -plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6d.py b/content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6d.py deleted file mode 100644 index e594b398..00000000 --- a/content/en/tutorials/mcs/codes/mc-06-qwl/tutorial6d.py +++ /dev/null @@ -1,74 +0,0 @@ -from __future__ import print_function -# **************************************************************************** -# -# 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 -import copy - -#prepare the input parameters -parms=[] - -for (l,c) in [(4,500),( 6,1000)]: - parms.append( - { - 'LATTICE' : "simple cubic lattice", - 'MODEL' : "spin", - 'local_S' : 0.5, - 'L' : l, - 'J' : 1 , - 'CUTOFF' : c - } - ) - -#write the input file and run the simulation -input_file = pyalps.writeInputFiles('parm6d',parms) -pyalps.runApplication('qwl',input_file) - -#run the evaluation and load all the plots -results = pyalps.evaluateQWL(pyalps.getResultFiles(prefix='parm6d'),DELTA_T=0.05, T_MIN=0.5, T_MAX=1.5) - -#extract just the staggered structure factor S(Q) and rescale it by L^{-2+\eta} -data = [] -for s in pyalps.flatten(results): - if s.props['ylabel']=='Staggered Structure Factor per Site': - print('yes') - d = copy.deepcopy(s) # make a deep copy to not change the original - l = s.props['L'] - d.props['label']='L='+str(l) - d.y = d.y * pow(float(l),-1.97) - data.append(d) - -#make plot -plt.figure() -plt.title("Scaling plot for cubic lattice Heisenberg antiferromagnet") -pyalps.plot.plot(data) -plt.legend() -plt.xlabel('Temperature $T/J$') -plt.ylabel('$S(\pi,\pi,\pi) L^{-2+\eta}$') -plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-07-phase-transition/parm7a b/content/en/tutorials/mcs/codes/mc-07-phase-transition/parm7a deleted file mode 100644 index e762527e..00000000 --- a/content/en/tutorials/mcs/codes/mc-07-phase-transition/parm7a +++ /dev/null @@ -1,85 +0,0 @@ -LATTICE="square lattice" -T=2.269186 -J=1 -THERMALIZATION=1000 -UPDATE="cluster" -MODEL="Ising" - -L=4 -SWEEPS=400000 -{ T=5.0; } -{ T=4.5; } -{ T=4.0; } -{ T=3.5; } -{ T=3.0; } -{ T=2.9; } -{ T=2.8; } -{ T=2.7; } - -SWEEPS=40000 -{ T=2.6; } -{ T=2.5; } -{ T=2.4; } -{ T=2.3; } -{ T=2.2; } -{ T=2.1; } -{ T=2.0; } -{ T=1.9; } -{ T=1.8; } -{ T=1.7; } -{ T=1.6; } -{ T=1.5; } -{ T=1.2; } - - -L=8 -SWEEPS=400000 -{ T=5.0; } -{ T=4.5; } -{ T=4.0; } -{ T=3.5; } -{ T=3.0; } -{ T=2.9; } -{ T=2.8; } -{ T=2.7; } - -SWEEPS=40000 -{ T=2.6; } -{ T=2.5; } -{ T=2.4; } -{ T=2.3; } -{ T=2.2; } -{ T=2.1; } -{ T=2.0; } -{ T=1.9; } -{ T=1.8; } -{ T=1.7; } -{ T=1.6; } -{ T=1.5; } -{ T=1.2; } - -L=16 -SWEEPS=400000 -{ T=5.0; } -{ T=4.5; } -{ T=4.0; } -{ T=3.5; } -{ T=3.0; } -{ T=2.9; } -{ T=2.8; } - -SWEEPS=40000 -{ T=2.7; } -{ T=2.6; } -{ T=2.5; } -{ T=2.4; } -{ T=2.3; } -{ T=2.2; } -{ T=2.1; } -{ T=2.0; } -{ T=1.9; } -{ T=1.8; } -{ T=1.7; } -{ T=1.6; } -{ T=1.5; } -{ T=1.2; } diff --git a/content/en/tutorials/mcs/codes/mc-07-phase-transition/parm7b b/content/en/tutorials/mcs/codes/mc-07-phase-transition/parm7b deleted file mode 100644 index 400debf6..00000000 --- a/content/en/tutorials/mcs/codes/mc-07-phase-transition/parm7b +++ /dev/null @@ -1,58 +0,0 @@ -LATTICE="square lattice" -T=2.269186 -J=1 -THERMALIZATION=5000 -SWEEPS=60000 -UPDATE="cluster" -MODEL="Ising" - -L=32 -SWEEPS=120000 -{T=2.24;} -{T=2.25;} -{T=2.26;} -{T=2.27;} -{T=2.28;} -{T=2.29;} -{T=2.30;} -{T=2.31;} -{T=2.32;} -{T=2.33;} -{T=2.34;} -{T=2.35;} - -L=48 -SWEEPS=200000 - - -{T=2.24;} -{T=2.25;} -{T=2.26;} -{T=2.27;} -{T=2.28;} -{T=2.29;} -{T=2.30;} -{T=2.31;} -{T=2.32;} -{T=2.33;} - - -L=64 -SWEEPS=200000 - -{T=2.24;} -{T=2.25;} -{T=2.26;} -{T=2.27;} -{T=2.28;} -{T=2.29;} -{T=2.30;} -{T=2.31;} -{T=2.32;} -{T=2.33;} - - - - - - diff --git a/content/en/tutorials/mcs/codes/mc-07-phase-transition/tutorial7a.py b/content/en/tutorials/mcs/codes/mc-07-phase-transition/tutorial7a.py deleted file mode 100644 index 7739414e..00000000 --- a/content/en/tutorials/mcs/codes/mc-07-phase-transition/tutorial7a.py +++ /dev/null @@ -1,109 +0,0 @@ -# **************************************************************************** -# -# ALPS Project: Algorithms and Libraries for Physics Simulations -# -# ALPS Libraries -# -# Copyright (C) 2009-2010 by Brigitte Surer -# -# 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 [4,8,16]: - for t in [5.0,4.5,4.0,3.5,3.0,2.9,2.8,2.7]: - parms.append( - { - 'LATTICE' : "square lattice", - 'T' : t, - 'J' : 1 , - 'THERMALIZATION' : 1000, - 'SWEEPS' : 400000, - 'UPDATE' : "cluster", - 'MODEL' : "Ising", - 'L' : l - } - ) - for t in [2.6, 2.5, 2.4, 2.3, 2.2, 2.1, 2.0, 1.9, 1.8, 1.7, 1.6, 1.5, 1.2]: - parms.append( - { - 'LATTICE' : "square lattice", - 'T' : t, - 'J' : 1 , - 'THERMALIZATION' : 1000, - 'SWEEPS' : 40000, - 'UPDATE' : "cluster", - 'MODEL' : "Ising", - 'L' : l - } - ) - -#write the input file and run the simulation -input_file = pyalps.writeInputFiles('parm7a',parms) -pyalps.runApplication('spinmc',input_file,Tmin=5) -# use the following instead if you have MPI -#pyalps.runApplication('spinmc',input_file,Tmin=5,MPI=2) - -pyalps.evaluateSpinMC(pyalps.getResultFiles(prefix='parm7a')) - -#load the susceptibility and collect it as function of temperature T -data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm7a'),['|Magnetization|', 'Connected Susceptibility', 'Specific Heat', 'Binder Cumulant', 'Binder Cumulant U2']) -magnetization_abs = pyalps.collectXY(data,x='T',y='|Magnetization|',foreach=['L']) -connected_susc = pyalps.collectXY(data,x='T',y='Connected Susceptibility',foreach=['L']) -spec_heat = pyalps.collectXY(data,x='T',y='Specific Heat',foreach=['L']) -binder_u4 = pyalps.collectXY(data,x='T',y='Binder Cumulant',foreach=['L']) -binder_u2 = pyalps.collectXY(data,x='T',y='Binder Cumulant U2',foreach=['L']) - -#make plots -plt.figure() -pyalps.plot.plot(magnetization_abs) -plt.xlabel('Temperature $T$') -plt.ylabel('Magnetization $|m|$') -plt.title('2D Ising model') - -plt.figure() -pyalps.plot.plot(connected_susc) -plt.xlabel('Temperature $T$') -plt.ylabel('Connected Susceptibility $\chi_c$') -plt.title('2D Ising model') - -plt.figure() -pyalps.plot.plot(spec_heat) -plt.xlabel('Temperature $T$') -plt.ylabel('Specific Heat $c_v$') -plt.title('2D Ising model') - -plt.figure() -pyalps.plot.plot(binder_u4) -plt.xlabel('Temperature $T$') -plt.ylabel('Binder Cumulant U4 $g$') -plt.title('2D Ising model') - -plt.figure() -pyalps.plot.plot(binder_u2) -plt.xlabel('Temperature $T$') -plt.ylabel('Binder Cumulant U2 $g$') -plt.title('2D Ising model') -plt.show() - diff --git a/content/en/tutorials/mcs/codes/mc-07-phase-transition/tutorial7b.py b/content/en/tutorials/mcs/codes/mc-07-phase-transition/tutorial7b.py deleted file mode 100644 index d1627a2f..00000000 --- a/content/en/tutorials/mcs/codes/mc-07-phase-transition/tutorial7b.py +++ /dev/null @@ -1,197 +0,0 @@ -# **************************************************************************** -# -# ALPS Project: Algorithms and Libraries for Physics Simulations -# -# ALPS Libraries -# -# Copyright (C) 2009-2010 by Brigitte Surer -# -# 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 -import numpy as np -import pyalps.fit_wrapper as fw - -#prepare the input parameters -parms = [] -for l in [32,48,64]: - for t in [2.24, 2.25, 2.26, 2.27, 2.28, 2.29, 2.30, 2.31, 2.32, 2.33, 2.34, 2.35]: - parms.append( - { - 'LATTICE' : "square lattice", - 'T' : t, - 'J' : 1 , - 'THERMALIZATION' : 5000, - 'SWEEPS' : 150000, - 'UPDATE' : "cluster", - 'MODEL' : "Ising", - 'L' : l - } - ) - -#write the input file and run the simulation -input_file = pyalps.writeInputFiles('parm7b',parms) -pyalps.runApplication('spinmc',input_file,Tmin=5) -# use the following instead if you have MPI -#pyalps.runApplication('spinmc',input_file,Tmin=5,MPI=4) - -pyalps.evaluateSpinMC(pyalps.getResultFiles(prefix='parm7b')) - -#load the susceptibility and collect it as function of temperature T -# data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm7b'),['|Magnetization|', 'Connected Susceptibility', 'Specific Heat', 'Binder Cumulant', 'Binder Cumulant U2']) -# magnetization_abs = pyalps.collectXY(data,x='T',y='|Magnetization|',foreach=['L']) -# connected_susc = pyalps.collectXY(data,x='T',y='Connected Susceptibility',foreach=['L']) -# spec_heat = pyalps.collectXY(data,x='T',y='Specific Heat',foreach=['L']) -# binder_u4 = pyalps.collectXY(data,x='T',y='Binder Cumulant',foreach=['L']) -# binder_u2 = pyalps.collectXY(data,x='T',y='Binder Cumulant U2',foreach=['L']) -# -# #make a plot of the Binder cumulant: -# plt.figure() -# pyalps.plot.plot(binder_u4) -# plt.xlabel('Temperature $T$') -# plt.ylabel('Binder Cumulant U4 $g$') -# plt.title('2D Ising model') -# plt.show() -# -# #perform a data collapse of the Binder cumulant: -# Tc=2.269 #your estimate -# a=1 #your estimate -# -# for d in binder_u4: -# d.x -= Tc -# d.x = d.x/Tc -# l = d.props['L'] -# d.x = d.x * pow(float(l),a) -# -# plt.figure() -# pyalps.plot.plot(binder_u4) -# plt.xlabel('Rescaled Temperature $(T-T_c)/T_c L^{1/\nu}$') -# plt.ylabel('Binder Cumulant U4 $g$') -# plt.title('2D Ising model') -# plt.show() -# -# #make a plot of the specific heat and connected susceptibility: -# plt.figure() -# pyalps.plot.plot(connected_susc) -# plt.xlabel('Temperature $T$') -# plt.ylabel('Connected Susceptibility $\chi_c$') -# plt.title('2D Ising model') -# -# plt.figure() -# pyalps.plot.plot(spec_heat) -# plt.xlabel('Temperature $T$') -# plt.ylabel('Specific Heat $c_v$') -# plt.title('2D Ising model') -# plt.show() -# -# #make a fit of the connected susceptibility as a function of L: -# cs_mean=[] -# for q in connected_susc: -# cs_mean.append(np.array([d.mean for d in q.y])) -# -# peak_cs = pyalps.DataSet() -# peak_cs.props = pyalps.dict_intersect([q.props for q in connected_susc]) -# peak_cs.y = np.array([np.max(q) for q in cs_mean]) -# peak_cs.x = np.array([q.props['L'] for q in connected_susc]) -# -# sel = np.argsort(peak_cs.x) -# peak_cs.y = peak_cs.y[sel] -# peak_cs.x = peak_cs.x[sel] -# -# pars = [fw.Parameter(1), fw.Parameter(1)] -# f = lambda self, x, pars: pars[0]()*np.power(x,pars[1]()) -# fw.fit(None, f, pars, peak_cs.y, peak_cs.x) -# prefactor = pars[0].get() -# gamma_nu = pars[1].get() -# -# plt.figure() -# plt.plot(peak_cs.x, f(None, peak_cs.x, pars)) -# pyalps.plot.plot(peak_cs) -# plt.xlabel('System Size $L$') -# plt.ylabel('Connected Susceptibility $\chi_c(T_c)$') -# plt.title('2D Ising model, $\gamma$ is %.4s' % gamma_nu) -# plt.show() -# -# #make a fit of the specific heat as a function of L: -# sh_mean=[] -# for q in spec_heat: -# sh_mean.append(np.array([d.mean for d in q.y])) -# -# peak_sh = pyalps.DataSet() -# peak_sh.props = pyalps.dict_intersect([q.props for q in spec_heat]) -# peak_sh.y = np.array([np.max(q) for q in sh_mean]) -# peak_sh.x = np.array([q.props['L'] for q in spec_heat]) -# -# sel = np.argsort(peak_sh.x) -# peak_sh.y = peak_sh.y[sel] -# peak_sh.x = peak_sh.x[sel] -# -# pars = [fw.Parameter(1), fw.Parameter(1)] -# f = lambda self, x, pars: pars[0]()*np.power(x,pars[1]()) -# fw.fit(None, f, pars, peak_sh.y, peak_sh.x) -# prefactor = pars[0].get() -# alpha_nu = pars[1].get() -# -# plt.figure() -# plt.plot(peak_sh.x, f(None, peak_sh.x, pars)) -# pyalps.plot.plot(peak_cs) -# plt.xlabel('System Size $L$') -# plt.ylabel('Specific Heat $c_v(T_c)$') -# plt.title(r'2D Ising model, $\alpha$ is %.4s' % alpha_nu) -# plt.show() -# -# #make a data collapse of the connected susceptibility as a function of (T-Tc)/Tc: -# for d in connected_susc: -# d.x -= Tc -# d.x = d.x/Tc -# l = d.props['L'] -# d.x = d.x * pow(float(l),a) -# -# two_minus_eta=1.75 #your estimate -# for d in connected_susc: -# l = d.props['L'] -# d.y = d.y/pow(float(l),two_minus_eta) -# -# plt.figure() -# pyalps.plot.plot(connected_susc) -# plt.xlabel('Temperature $T$') -# plt.ylabel('Connected Susceptibility $\chi_c$') -# plt.title('2D Ising model') -# plt.show() -# -# #make a data collapse of the |magnetization| as a function of (T-Tc)/Tc -# for d in magnetization_abs: -# d.x -= Tc -# d.x = d.x/Tc -# l = d.props['L'] -# d.x = d.x * pow(float(l),a) -# beta_over_nu=... #your estimate -# for d in magnetization_abs: -# l = d.props['L'] -# d.y = d.y / pow(float(l),-beta_over_nu) -# -# plt.figure() -# pyalps.plot.plot(magnetization_abs) -# plt.xlabel('Temperature $T$') -# plt.ylabel('Magnetization $|m|$') -# plt.title('2D Ising model') -# plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8a b/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8a deleted file mode 100644 index db3fe82d..00000000 --- a/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8a +++ /dev/null @@ -1,71 +0,0 @@ -LATTICE="coupled ladders" -MODEL="spin" -local_S=1/2 - -J0=1 -J1=1 - -THERMALIZATION=5000 -SWEEPS=50000 -ALGORITHM="loop" -SEED=0 - -L=8 -W=4 - -J2=0; - -{ T=3.0;} -{ T=2.8;} -{ T=2.6;} -{ T=2.4;} -{ T=2.2;} -{ T=2.0;} -{ T=1.9;} -{ T=1.8;} -{ T=1.7;} -{ T=1.6;} -{ T=1.5;} -{ T=1.4;} -{ T=1.3;} -{ T=1.2;} -{ T=1.1;} -{ T=1.0;} -{ T=0.9;} -{ T=0.8;} -{ T=0.7;} -{ T=0.6;} -{ T=0.5;} -{ T=0.4;} -{ T=0.3;} -{ T=0.2;} -{ T=0.1;} - -J2=1.; - -{ T=3.0;} -{ T=2.8;} -{ T=2.6;} -{ T=2.4;} -{ T=2.2;} -{ T=2.0;} -{ T=1.9;} -{ T=1.8;} -{ T=1.7;} -{ T=1.6;} -{ T=1.5;} -{ T=1.4;} -{ T=1.3;} -{ T=1.2;} -{ T=1.1;} -{ T=1.0;} -{ T=0.9;} -{ T=0.8;} -{ T=0.7;} -{ T=0.6;} -{ T=0.5;} -{ T=0.4;} -{ T=0.3;} -{ T=0.2;} -{ T=0.1;} - diff --git a/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8b b/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8b deleted file mode 100644 index 261c0322..00000000 --- a/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8b +++ /dev/null @@ -1,52 +0,0 @@ -LATTICE="coupled ladders" -MODEL="spin" -local_S=1/2 - -J0=1 -J1=1 - -THERMALIZATION=5000 -SWEEPS=50000 -ALGORITHM="loop" -SEED=0 - -L=8 -W=4 -BETA=16 - -{ J2=0.2;} -{ J2=0.25;} -{ J2=0.3;} -{ J2=0.35;} -{ J2=0.4;} - -L=10 -W=5 -BETA=20 - -{ J2=0.2;} -{ J2=0.25;} -{ J2=0.3;} -{ J2=0.35;} -{ J2=0.4;} - -L=12 -W=6 -BETA=24 - -{ J2=0.2;} -{ J2=0.25;} -{ J2=0.3;} -{ J2=0.35;} -{ J2=0.4;} - -L=16 -W=8 -BETA=32 - -{ J2=0.2;} -{ J2=0.25;} -{ J2=0.3;} -{ J2=0.35;} -{ J2=0.4;} - diff --git a/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8c b/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8c deleted file mode 100644 index 477d5efb..00000000 --- a/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8c +++ /dev/null @@ -1,60 +0,0 @@ -LATTICE="coupled ladders" -MODEL="spin" -local_S=1/2 - -J0=1 -J1=1 - -THERMALIZATION=5000 -SWEEPS=50000 -ALGORITHM="loop" -SEED=0 - -L=8 -W=4 -BETA=16 - -{ J2=1.8;} -{ J2=1.85;} -{ J2=1.9;} -{ J2=1.95;} -{ J2=2.;} -{ J2=2.05;} -{ J2=2.1;} - -L=10 -W=5 -BETA=20 - -{ J2=1.8;} -{ J2=1.85;} -{ J2=1.9;} -{ J2=1.95;} -{ J2=2.;} -{ J2=2.05;} -{ J2=2.1;} - -L=12 -W=6 -BETA=24 - -{ J2=1.8;} -{ J2=1.85;} -{ J2=1.9;} -{ J2=1.95;} -{ J2=2.;} -{ J2=2.05;} -{ J2=2.1;} - -L=16 -W=8 -BETA=32 - -{ J2=1.8;} -{ J2=1.85;} -{ J2=1.9;} -{ J2=1.95;} -{ J2=2.;} -{ J2=2.05;} -{ J2=2.1;} - diff --git a/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8d b/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8d deleted file mode 100644 index 340dd440..00000000 --- a/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/parm8d +++ /dev/null @@ -1,63 +0,0 @@ -LATTICE="coupled ladders" -MODEL="spin" -local_S=1/2 - -J0=1 -J1=1 - -THERMALIZATION=5000 -SWEEPS=50000 -ALGORITHM="loop" -SEED=0 - -L=16 -W=8 -BETA=32 - -{ J2=0.31;} -{ J2=0.311;} -{ J2=0.312;} -{ J2=0.313;} -{ J2=0.314;} -{ J2=0.315;} -{ J2=0.316;} -{ J2=0.317;} -{ J2=0.318;} -{ J2=0.319;} -{ J2=0.32;} - -L=32 -W=16 -BETA=64 - -{ J2=0.31;} -{ J2=0.311;} -{ J2=0.312;} -{ J2=0.313;} -{ J2=0.314;} -{ J2=0.315;} -{ J2=0.316;} -{ J2=0.317;} -{ J2=0.318;} -{ J2=0.319;} -{ J2=0.32;} - -L=64 -W=32 -BETA=128 - -{ J2=0.312;} -{ J2=0.313;} -{ J2=0.314;} -{ J2=0.315;} -{ J2=0.316;} - -L=128 -W=64 -BETA=256 - -{ J2=0.312;} -{ J2=0.313;} -{ J2=0.314;} -{ J2=0.315;} -{ J2=0.316;} diff --git a/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8a.py b/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8a.py deleted file mode 100644 index 1debcc6d..00000000 --- a/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8a.py +++ /dev/null @@ -1,85 +0,0 @@ -from __future__ import print_function -# **************************************************************************** -# -# ALPS Project: Algorithms and Libraries for Physics Simulations -# -# ALPS Libraries -# -# Copyright (C) 2010 by Brigitte Surer -# -# 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 -import numpy as np -import pyalps.fit_wrapper as fw -from math import sqrt - -#prepare the input parameters -parms = [] -for j2 in [0.,1.]: - for t in [0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0,2.2,2.4,2.6,2.8,3.0]: - parms.append( - { - 'LATTICE' : "coupled ladders", - 'local_S' : 0.5, - 'ALGORITHM' : 'loop', - 'SEED' : 0, - 'T' : t, - 'J0' : 1 , - 'J1' : 1, - 'J2' : j2, - 'THERMALIZATION' : 5000, - 'SWEEPS' : 50000, - 'MODEL' : "spin", - 'L' : 8, - 'W' : 4 - } - ) - -#write the input file and run the simulation -input_file = pyalps.writeInputFiles('parm8a',parms) -pyalps.runApplication('loop',input_file) - -data = pyalps.loadMeasurements(pyalps.getResultFiles(pattern='parm8a.task*.out.h5'),['Staggered Susceptibility','Susceptibility']) -susc1=pyalps.collectXY(data,x='T',y='Susceptibility', foreach=['J2']) - -lines = [] -for data in susc1: - pars = [fw.Parameter(1), fw.Parameter(1)] - data.y= data.y[data.x < 1] - data.x= data.x[data.x < 1] - f = lambda self, x, pars: (pars[0]()/np.sqrt(x))*np.exp(-pars[1]()/x) - fw.fit(None, f, pars, np.array([v.mean for v in data.y]), data.x) - prefactor = pars[0].get() - gap = pars[1].get() - print(prefactor,gap) - - lines += plt.plot(data.x, f(None, data.x, pars)) - lines[-1].set_label('$J_2=%.4s$: $\chi = \\frac{%.4s}{T}\exp(\\frac{-%.4s}{T})$' % (data.props['J2'], prefactor,gap)) - -plt.figure() -pyalps.plot.plot(susc1) -plt.xlabel(r'$T$') -plt.ylabel(r'$\chi$') -plt.title('gap is %.4s' % gap) -plt.legend() -plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8b.py b/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8b.py deleted file mode 100644 index 77a7e1b1..00000000 --- a/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8b.py +++ /dev/null @@ -1,79 +0,0 @@ -# **************************************************************************** -# -# ALPS Project: Algorithms and Libraries for Physics Simulations -# -# ALPS Libraries -# -# Copyright (C) 2010 by Brigitte Surer -# -# 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 -import numpy as np - -#prepare the input parameters -parms = [] -for l in [8,10,12,16]: - for j2 in [0.2,0.25,0.3,0.35,0.4]: - parms.append( - { - 'LATTICE' : "coupled ladders", - 'local_S' : 0.5, - 'ALGORITHM' : 'loop', - 'SEED' : 0, - 'BETA' : 2*l, - 'J0' : 1 , - 'J1' : 1, - 'J2' : j2, - 'THERMALIZATION' : 5000, - 'SWEEPS' : 50000, - 'MODEL' : "spin", - 'L' : l, - 'W' : l/2 - } - ) - -#write the input file and run the simulation -input_file = pyalps.writeInputFiles('parm8b',parms) -pyalps.runApplication('loop',input_file) - -data = pyalps.loadMeasurements(pyalps.getResultFiles(pattern='parm8b.task*.out.h5'),['Binder Ratio of Staggered Magnetization','Stiffness']) - -binder=pyalps.collectXY(data,x='J2',y='Binder Ratio of Staggered Magnetization', foreach=['L']) -stiffness =pyalps.collectXY(data,x='J2',y='Stiffness', foreach=['L']) - -for q in stiffness: - q.y = q.y*q.props['L'] - -#make plot -plt.figure() -pyalps.plot.plot(stiffness) -plt.xlabel(r'$J2$') -plt.ylabel(r'Stiffness $\rho_s L$') -plt.title('coupled ladders') - -plt.figure() -pyalps.plot.plot(binder) -plt.xlabel(r'$J_2$') -plt.ylabel(r'$g(m_s)$') -plt.title('coupled ladders') -plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8c.py b/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8c.py deleted file mode 100644 index 1adee051..00000000 --- a/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8c.py +++ /dev/null @@ -1,79 +0,0 @@ -# **************************************************************************** -# -# ALPS Project: Algorithms and Libraries for Physics Simulations -# -# ALPS Libraries -# -# Copyright (C) 2010 by Brigitte Surer -# -# 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 -import numpy as np - -#prepare the input parameters -parms = [] -for l in [8,10,12,16]: - for j2 in [1.8,1.85,1.9,1.95,2.,2.05,2.1]: - parms.append( - { - 'LATTICE' : "coupled ladders", - 'local_S' : 0.5, - 'ALGORITHM' : 'loop', - 'SEED' : 0, - 'BETA' : 2*l, - 'J0' : 1 , - 'J1' : 1, - 'J2' : j2, - 'THERMALIZATION' : 5000, - 'SWEEPS' : 50000, - 'MODEL' : "spin", - 'L' : l, - 'W' : l/2 - } - ) - -#write the input file and run the simulation -input_file = pyalps.writeInputFiles('parm8c',parms) -pyalps.runApplication('loop',input_file) - -data = pyalps.loadMeasurements(pyalps.getResultFiles(pattern='parm8c.task*.out.h5'),['Binder Ratio of Staggered Magnetization','Stiffness']) - -binder=pyalps.collectXY(data,x='J2',y='Binder Ratio of Staggered Magnetization', foreach=['L']) -stiffness =pyalps.collectXY(data,x='J2',y='Stiffness', foreach=['L']) - -for q in stiffness: - q.y = q.y*q.props['L'] - -#make plot -plt.figure() -pyalps.plot.plot(stiffness) -plt.xlabel(r'$J2$') -plt.ylabel(r'Stiffness $\rho_s L$') -plt.title('coupled ladders') - -plt.figure() -pyalps.plot.plot(binder) -plt.xlabel(r'$J_2$') -plt.ylabel(r'$g(m_s)$') -plt.title('coupled ladders') -plt.show() diff --git a/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8d.py b/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8d.py deleted file mode 100644 index d91f66b2..00000000 --- a/content/en/tutorials/mcs/codes/mc-08-quantum-phase-transition/tutorial8d.py +++ /dev/null @@ -1,79 +0,0 @@ -# **************************************************************************** -# -# ALPS Project: Algorithms and Libraries for Physics Simulations -# -# ALPS Libraries -# -# Copyright (C) 2010 by Brigitte Surer -# -# 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 -import numpy as np - -#prepare the input parameters -parms = [] -for l in [8,10,12,16]: - for j2 in [1.8,1.85,1.9,1.95,2.,2.05,2.1]: - parms.append( - { - 'LATTICE' : "coupled ladders", - 'local_S' : 0.5, - 'ALGORITHM' : 'loop', - 'SEED' : 0, - 'BETA' : l, - 'J0' : 1 , - 'J1' : 1, - 'J2' : j2, - 'THERMALIZATION' : 5000, - 'SWEEPS' : 50000, - 'MODEL' : "spin", - 'L' : l, - 'W' : l/2 - } - ) - -#write the input file and run the simulation -input_file = pyalps.writeInputFiles('parm8d',parms) -pyalps.runApplication('loop',input_file) - -data = pyalps.loadMeasurements(pyalps.getResultFiles(pattern='parm8d.task*.out.h5'),['Binder Ratio of Staggered Magnetization','Stiffness']) - -binder=pyalps.collectXY(data,x='J2',y='Binder Ratio of Staggered Magnetization', foreach=['L']) -stiffness =pyalps.collectXY(data,x='J2',y='Stiffness', foreach=['L']) - -for q in stiffness: - q.y = q.y*q.props['L'] - -#make plot -plt.figure() -pyalps.plot.plot(stiffness) -plt.xlabel(r'$J2$') -plt.ylabel(r'Stiffness $\rho_s L$') -plt.title('coupled ladders') - -plt.figure() -pyalps.plot.plot(binder) -plt.xlabel(r'$J_2$') -plt.ylabel(r'$g(m_s)$') -plt.title('coupled ladders') -plt.show() diff --git a/content/en/tutorials/mcs/mc01a.md b/content/en/tutorials/mcs/mc01a.md index d2e5ed64..08f91074 100644 --- a/content/en/tutorials/mcs/mc01a.md +++ b/content/en/tutorials/mcs/mc01a.md @@ -23,7 +23,7 @@ This tutorial can be run either on the command line or in Python. We recommend t ### Setting up and running the simulation on the command line -To set up and run the simulation on the command line, we first create a parameter file that specifies the parameters of the simulation(s). The downloadable file will be titled `parm1a`, with the following contents: +To set up and run the simulation on the command line, we first create a parameter file that specifies the parameters of the simulation(s). The downloadable file will be titled `parm1a`, with the following contents: ``` LATTICE="square lattice" @@ -100,7 +100,7 @@ Look at all six tasks and, by studying the binning analysis in the files `parm1a The `pyalps` package is a wrapper for ALPS: All it does is call the commands described in the previous section as if they were run in a terminal. It is superior for plotting because the output of the simulation can be read directly into a Python data structure and accessed by `matplotlib`. It also comes with a wrapper `pyalps.plot` for certain matplotlib functions to neatly plot data generated by `pyalps`. -To set up and run the simulation in Python, we create a script named `tutorial1a.py`. The first part of this script must import the required modules and prepare the input job and task files. Instead of writing a parameter file and using `convert2xml`, we store a list containing each task's parameters as a dictionary, like so: +To set up and run the simulation in Python, we create a script named `tutorial1a.py`. The first part of this script must import the required modules and prepare the input job and task files. Instead of writing a parameter file and using `convert2xml`, we store a list containing each task's parameters as a dictionary, like so: ```Python import pyalps @@ -197,7 +197,7 @@ We therefore repeat the simulations with cluster updates, using fewer thermaliza ### Command line -The downloadable parameter file `parm1b` has the following contents: +The downloadable parameter file `parm1b` has the following contents: ``` LATTICE="square lattice" @@ -224,7 +224,7 @@ spinmc --Tmin 10 --write-xml parm1b.in.xml ### Python -The script `tutorial1b.py` follows the same structure as `tutorial1a.py`, with the updated parameters and `parm1b` as the file prefix: +The script `tutorial1b.py` follows the same structure as `tutorial1a.py`, with the updated parameters and `parm1b` as the file prefix: ```Python import pyalps diff --git a/content/en/tutorials/mcs/mc01b.md b/content/en/tutorials/mcs/mc01b.md index 46446982..a3330986 100644 --- a/content/en/tutorials/mcs/mc01b.md +++ b/content/en/tutorials/mcs/mc01b.md @@ -22,7 +22,7 @@ Both are checked by inspecting the time series of a measured observable — in t ### Preparing and running the simulation on the command line -The parameter file `parm1a` sets up a single simulation of the Ising model on a $48 \times 48$ square lattice at the critical temperature: +The parameter file `parm1a` sets up a single simulation of the Ising model on a $48 \times 48$ square lattice at the critical temperature: ``` LATTICE="square lattice" @@ -44,7 +44,7 @@ spinmc --Tmin 10 --write-xml parm1a.in.xml ### Preparing and running the simulation in Python -The full script is available as `tutorial1a.py`. +The full script is available as `tutorial1a.py`. It begins by importing the required modules and defining the simulation parameters: ```Python diff --git a/content/en/tutorials/mcs/mc02.md b/content/en/tutorials/mcs/mc02.md index d7a7823f..8a15a661 100644 --- a/content/en/tutorials/mcs/mc02.md +++ b/content/en/tutorials/mcs/mc02.md @@ -20,7 +20,7 @@ The comparison highlights two key contrasts: how quantum fluctuations modify the #### Setting up and running on the command line -The parameter file `parm2a` sets up simulations of the classical ferromagnetic Heisenberg model on a chain of 60 sites across a range of temperatures: +The parameter file `parm2a` sets up simulations of the classical ferromagnetic Heisenberg model on a chain of 60 sites across a range of temperatures: ``` LATTICE="chain lattice" @@ -56,7 +56,7 @@ spinmc --Tmin 10 --write-xml parm2a.in.xml #### Setting up and running in Python -The script `tutorial2a.py` sets up and runs the same simulation. Place it in the same folder as `parm2a`: +The script `tutorial2a.py` sets up and runs the same simulation. Place it in the same folder as `parm2a`: ```Python import pyalps @@ -110,7 +110,7 @@ Aside from the lattice change and the two couplings, the simulation setup is ide #### Setting up and running on the command line -Download `parm2b` and place it in the same folder: +Download `parm2b` and place it in the same folder: ``` LATTICE="ladder" @@ -147,7 +147,7 @@ spinmc --Tmin 10 --write-xml parm2b.in.xml #### Setting up and running in Python -The script `tutorial2b.py` is a copy of `tutorial2a.py` with three changes: the prefix renamed to `parm2b`, `LATTICE` set to `"ladder"`, and `J` replaced by `J0` and `J1` (both `-1`). +The script `tutorial2b.py` is a copy of `tutorial2a.py` with three changes: the prefix renamed to `parm2b`, `LATTICE` set to `"ladder"`, and `J` replaced by `J0` and `J1` (both `-1`). ## Quantum Heisenberg models @@ -162,7 +162,7 @@ The key parameter changes, relative to the classical case, are: #### Setting up and running on the command line -Download `parm2c`: +Download `parm2c`: ``` LATTICE="chain lattice" @@ -200,7 +200,7 @@ loop parm2c.in.xml #### Setting up and running in Python -The script `tutorial2c.py` adapts `tutorial2a.py` to the quantum parameters and calls `loop` instead of `spinmc`: +The script `tutorial2c.py` adapts `tutorial2a.py` to the quantum parameters and calls `loop` instead of `spinmc`: ```Python input_file = pyalps.writeInputFiles('parm2c', parms) @@ -223,7 +223,7 @@ Unlike the gapless chain, the two-leg antiferromagnetic Heisenberg ladder has a #### Setting up and running on the command line -Download `parm2d`: +Download `parm2d`: ``` LATTICE="ladder" @@ -257,11 +257,11 @@ loop parm2d.in.xml #### Setting up and running in Python -The script `tutorial2d.py` adapts `tutorial2c.py`: rename the prefix to `parm2d`, change `LATTICE` to `"ladder"`, and replace `J` with `J0` and `J1` (both `1`). +The script `tutorial2d.py` adapts `tutorial2c.py`: rename the prefix to `parm2d`, change `LATTICE` to `"ladder"`, and replace `J` with `J0` and `J1` (both `1`). ## Combining all four simulations -After running all four simulations in the same folder, the script `tutorial2full.py` loads all results together and overlays them on a single plot. +After running all four simulations in the same folder, the script `tutorial2full.py` loads all results together and overlays them on a single plot. ```Python import pyalps diff --git a/content/en/tutorials/mcs/mc03.md b/content/en/tutorials/mcs/mc03.md index b19bcacd..e228cb1b 100644 --- a/content/en/tutorials/mcs/mc03.md +++ b/content/en/tutorials/mcs/mc03.md @@ -20,7 +20,7 @@ The temperature is low enough that the results are close to the ground-state mag #### Setting up and running on the command line -The parameter file `parm3a`: +The parameter file `parm3a`: ``` LATTICE="chain lattice" @@ -61,7 +61,7 @@ dirloop_sse --Tmin 10 --write-xml parm3a.in.xml #### Setting up and running in Python -The script `tutorial3a.py`: +The script `tutorial3a.py`: ```Python import pyalps @@ -114,7 +114,7 @@ We use 20 rungs (40 sites total) and extend the field range to $h = 3.5$ to reac #### Setting up and running on the command line -The parameter file `parm3b` uses the same structure as `parm3a` with these changes: +The parameter file `parm3b` uses the same structure as `parm3a` with these changes: ``` LATTICE="ladder" @@ -154,7 +154,7 @@ dirloop_sse --Tmin 10 --write-xml parm3b.in.xml #### Setting up and running in Python -The script `tutorial3b.py` adapts `tutorial3a.py`: rename the prefix to `parm3b`, change `LATTICE` to `"ladder"`, replace `J` with `J0=J1=1`, and extend the field scan to 3.5. +The script `tutorial3b.py` adapts `tutorial3a.py`: rename the prefix to `parm3b`, change `LATTICE` to `"ladder"`, replace `J` with `J0=J1=1`, and extend the field scan to 3.5. #### Evaluating and plotting @@ -175,7 +175,7 @@ In contrast to the chain, the ladder magnetization is zero up to a finite lower ## Combining both simulations -After running both simulations in the same folder, the script `tutorial3full.py` overlays the two magnetization curves on a single plot: +After running both simulations in the same folder, the script `tutorial3full.py` overlays the two magnetization curves on a single plot: ```Python import pyalps diff --git a/content/en/tutorials/mcs/mc04.md b/content/en/tutorials/mcs/mc04.md index 185165e3..52c94dd4 100644 --- a/content/en/tutorials/mcs/mc04.md +++ b/content/en/tutorials/mcs/mc04.md @@ -20,7 +20,7 @@ The small system size allows a fast simulation; finite-size effects are signific ### Command line -The parameter file `parm4` enables three additional measurement flags alongside the standard parameters: +The parameter file `parm4` enables three additional measurement flags alongside the standard parameters: ``` MODEL="spin" @@ -53,7 +53,7 @@ dirloop_sse --Tmin 10 --write-xml parm4.in.xml ### Python -The script `tutorial4.py`: +The script `tutorial4.py`: ```Python import pyalps diff --git a/content/en/tutorials/mcs/mc05.md b/content/en/tutorials/mcs/mc05.md index c29233d8..e32ac40d 100644 --- a/content/en/tutorials/mcs/mc05.md +++ b/content/en/tutorials/mcs/mc05.md @@ -22,7 +22,7 @@ The Hilbert space is truncated at `Nmax=2` bosons per site, which is a good appr ### Command line -The parameter file `parm5a`: +The parameter file `parm5a`: ``` LATTICE="square lattice" @@ -58,7 +58,7 @@ worm --Tmin 10 --write-xml parm5a.in.xml ### Python -The script `tutorial5a.py`: +The script `tutorial5a.py`: ```Python import pyalps @@ -115,7 +115,7 @@ We simulate three system sizes $L = 4, 6, 8$ on a fine grid of hopping values ar ### Command line -The parameter file `parm5b`: +The parameter file `parm5b`: ``` LATTICE="square lattice" @@ -159,7 +159,7 @@ worm --Tmin 10 --write-xml parm5b.in.xml ### Python -The script `tutorial5b.py`: +The script `tutorial5b.py`: ```Python import pyalps diff --git a/content/en/tutorials/mcs/mc06.md b/content/en/tutorials/mcs/mc06.md index 43bd172a..a9ba693f 100644 --- a/content/en/tutorials/mcs/mc06.md +++ b/content/en/tutorials/mcs/mc06.md @@ -14,7 +14,7 @@ From a single simulation one can then evaluate thermodynamic observables — ene ### The ferromagnetic Heisenberg chain -The parameter file `parm6a` sets up a QWL simulation of the $S=\frac{1}{2}$ Heisenberg ferromagnet on a chain of 40 sites: +The parameter file `parm6a` sets up a QWL simulation of the $S=\frac{1}{2}$ Heisenberg ferromagnet on a chain of 40 sites: ``` LATTICE="chain lattice" @@ -64,7 +64,7 @@ The tools `plot2xmgr` (Grace) and `plot2gp` (Gnuplot) produce equivalent output ### Python -The script `tutorial6a.py` sets up and runs the simulation, then evaluates all observables in one call: +The script `tutorial6a.py` sets up and runs the simulation, then evaluates all observables in one call: ```python import pyalps @@ -85,7 +85,7 @@ For the ferromagnet ($J=-1$) you should see a broad specific-heat peak at low te ### The antiferromagnetic Heisenberg chain To simulate the antiferromagnetic chain set $J=1$ instead of $J=-1$. -The parameters are in `parm6b` and the Python script in `tutorial6b.py`; everything else is identical to the ferromagnetic case. +The parameters are in `parm6b` and the Python script in `tutorial6b.py`; everything else is identical to the ferromagnetic case. For the antiferromagnet the uniform susceptibility remains finite as $T\to 0$ (a signature of the spin-liquid ground state of the 1D antiferromagnet), while the specific-heat peak shifts and broadens differently. @@ -93,8 +93,8 @@ For the antiferromagnet the uniform susceptibility remains finite as $T\to 0$ (a ### Simulating the 3D quantum Heisenberg antiferromagnet -The parameter file `parm6c` sets up a QWL simulation of the $S=\frac{1}{2}$ Heisenberg antiferromagnet on a simple cubic lattice with $4^3=64$ sites. -The Python script is `tutorial6c.py`. +The parameter file `parm6c` sets up a QWL simulation of the $S=\frac{1}{2}$ Heisenberg antiferromagnet on a simple cubic lattice with $4^3=64$ sites. +The Python script is `tutorial6c.py`. Run and evaluate exactly as for the chain above. The staggered structure factor $S(\pi,\pi,\pi)$ should start rising steeply near $T\approx 1$, signaling the onset of antiferromagnetic correlations. @@ -105,7 +105,7 @@ The specific heat shows a corresponding peak and the entropy decreases rapidly i Finite-size scaling predicts that the staggered structure factor at the critical point scales as $S(L) \propto L^{2-\eta}$ with $\eta \approx 0.034$ (3D classical Heisenberg universality class). A plot of $S(L)/L^{2-\eta}$ vs. temperature should show curves for different $L$ crossing at the critical temperature $T_c$. -The parameter file `parm6d` (or `tutorial6d.py`) runs the cubic antiferromagnet for two system sizes ($L=4$ and $L=6$) with a larger `CUTOFF=1000` to maintain accuracy at lower temperatures. +The parameter file `parm6d` (or `tutorial6d.py`) runs the cubic antiferromagnet for two system sizes ($L=4$ and $L=6$) with a larger `CUTOFF=1000` to maintain accuracy at lower temperatures. After running, load the results: ```python diff --git a/content/en/tutorials/mcs/mc07.md b/content/en/tutorials/mcs/mc07.md index bdc42781..14808c14 100644 --- a/content/en/tutorials/mcs/mc07.md +++ b/content/en/tutorials/mcs/mc07.md @@ -19,7 +19,7 @@ Start the fine-grid simulations now so they run while you work through the rest ### Command line -Download `parm7b` and run: +Download `parm7b` and run: ``` parameter2xml parm7b @@ -30,7 +30,7 @@ The `--Tmin 10` flag sets a checkpoint interval of 10 seconds, allowing the simu ### Python -The first part of `tutorial7b.py` sets up and launches the same simulation: +The first part of `tutorial7b.py` sets up and launches the same simulation: ```Python import pyalps @@ -65,7 +65,7 @@ We first make a coarse temperature scan on small systems to locate the critical ### Command line -Download `parm7a` and run: +Download `parm7a` and run: ``` parameter2xml parm7a @@ -74,7 +74,7 @@ spinmc --Tmin 5 parm7a.in.xml ### Python -Using `tutorial7a.py`: +Using `tutorial7a.py`: ```Python import pyalps diff --git a/content/en/tutorials/mcs/mc08.md b/content/en/tutorials/mcs/mc08.md index 810b5ce6..ab9a0caf 100644 --- a/content/en/tutorials/mcs/mc08.md +++ b/content/en/tutorials/mcs/mc08.md @@ -38,7 +38,7 @@ Start it now so it runs in the background while you work through the rest of the ### Command line -Download `parm8b` and run: +Download `parm8b` and run: ``` parameter2xml parm8b @@ -47,20 +47,20 @@ loop parm8b.in.xml & ### Python -Run the first part of `tutorial8b.py` (the setup and `pyalps.runApplication` call) in a separate terminal or as a background process before continuing. +Run the first part of `tutorial8b.py` (the setup and `pyalps.runApplication` call) in a separate terminal or as a background process before continuing. ## Identify the different phases We begin by considering the two simple limits: decoupled ladders ($J_2=0$) and the isotropic square lattice ($J_2=1$). The decoupled ladders have a ground state with short-range correlations and exhibit a finite spin gap: this is a spin liquid phase. The square lattice, by contrast, displays long-range order with a finite staggered magnetization: this is an antiferromagnetic Néel phase. -A clear way to probe these two phases is through the magnetic susceptibility $\chi$. Simulate an $8\times 8$ system over a range of temperatures for both cases and compare the results. For decoupled ladders the susceptibility exhibits activated behavior at low temperature due to the spin gap; on the square lattice it tends to a finite constant as $T\to 0$. Note that on any finite system $\chi$ will eventually tend to zero at low enough temperature due to the finite-size gap, but this is not our focus here. Run the simulation on the command line with parameter file `parm8a`: +A clear way to probe these two phases is through the magnetic susceptibility $\chi$. Simulate an $8\times 8$ system over a range of temperatures for both cases and compare the results. For decoupled ladders the susceptibility exhibits activated behavior at low temperature due to the spin gap; on the square lattice it tends to a finite constant as $T\to 0$. Note that on any finite system $\chi$ will eventually tend to zero at low enough temperature due to the finite-size gap, but this is not our focus here. Run the simulation on the command line with parameter file `parm8a`: ``` parameter2xml parm8a loop parm8a.in.xml ``` -or with the Python script `tutorial8a.py`. +or with the Python script `tutorial8a.py`. ```Python import pyalps @@ -201,7 +201,7 @@ Both observables crossing (rather than one diverging) confirms that the transiti You have obtained a rough estimate of the quantum critical point $J_2^c$. As in the classical case, extracting the critical exponents requires a more precise determination of $J_2^c$. -This is done by running larger system sizes on a finer grid of $J_2$ values, as set up in `parm8d` and `tutorial8d.py`. Note that these simulations are CPU-intensive and are left as an exercise. Plot the Binder cumulant $U_4$ and the rescaled stiffness $\rho_s L$ for different system sizes; the crossing point gives a refined estimate of $J_2^c$. To extract $\nu$, consider how the derivatives of these quantities with respect to $J_2$, evaluated at $J_2^c$, scale with system size. These derivatives can in principle be measured directly in the Monte Carlo, but for this tutorial it is sufficient to compute them by numerical differentiation using the fine $J_2$ grid. +This is done by running larger system sizes on a finer grid of $J_2$ values, as set up in `parm8d` and `tutorial8d.py`. Note that these simulations are CPU-intensive and are left as an exercise. Plot the Binder cumulant $U_4$ and the rescaled stiffness $\rho_s L$ for different system sizes; the crossing point gives a refined estimate of $J_2^c$. To extract $\nu$, consider how the derivatives of these quantities with respect to $J_2$, evaluated at $J_2^c$, scale with system size. These derivatives can in principle be measured directly in the Monte Carlo, but for this tutorial it is sufficient to compute them by numerical differentiation using the fine $J_2$ grid. Perform the numerical differentiations for the different system sizes for both quantities, and plot their values at $J_2^c$ as a function of system size. Data should scale as a power law: @@ -225,7 +225,7 @@ When $J_2$ is very large, the inter-ladder coupling dominates over the intra-lad This is again a gapped spin liquid phase, so the phase diagram has the structure: spin liquid → Néel AFM → spin liquid as $J_2$ increases from 0 to large values. There must therefore be a second quantum critical point $J_2^{c_2}$ at which the Néel order is destroyed. -We repeat the finite-size scaling analysis in the parameter regime $J_2 \in [1.8, 2.1]$ using the parameter file `parm8c` or the script `tutorial8c.py`, which use the same system sizes and $\beta=2L$ as `parm8b` but scan the higher-$J_2$ range. +We repeat the finite-size scaling analysis in the parameter regime $J_2 \in [1.8, 2.1]$ using the parameter file `parm8c` or the script `tutorial8c.py`, which use the same system sizes and $\beta=2L$ as `parm8b` but scan the higher-$J_2$ range. ### Command line From 6d743960bd4fdabb489a31adeb69d4c820de34ba Mon Sep 17 00:00:00 2001 From: Marcus Rosales Date: Wed, 12 Aug 2026 13:39:15 -0400 Subject: [PATCH 3/4] Track ALPS master for MCS downloads, sync ja/zh-cn Point the MCS downloads at the master branch of ALPSim/ALPS instead of pinning them to commit daa7392, so the tutorials serve the current source rather than a snapshot that silently goes stale. Bring the Japanese and Chinese MCS pages in line with the English ones. They still used ``, which does not download: the `download` attribute is ignored cross-origin, and a blob/ URL serves GitHub's HTML page rather than the file, so those links navigated the reader away from the tutorial. They now use the same alps-download anchors against raw.githubusercontent.com. Note: en mc08 has two links (parm8c, tutorial8c.py) with no counterpart in the translations, which predates this change and is left alone. Co-Authored-By: Claude Opus 5 --- content/en/tutorials/mcs/mc01a.md | 8 ++++---- content/en/tutorials/mcs/mc01b.md | 4 ++-- content/en/tutorials/mcs/mc02.md | 18 +++++++++--------- content/en/tutorials/mcs/mc03.md | 10 +++++----- content/en/tutorials/mcs/mc04.md | 4 ++-- content/en/tutorials/mcs/mc05.md | 8 ++++---- content/en/tutorials/mcs/mc06.md | 12 ++++++------ content/en/tutorials/mcs/mc07.md | 8 ++++---- content/en/tutorials/mcs/mc08.md | 12 ++++++------ content/ja/tutorials/mcs/mc01a.md | 8 ++++---- content/ja/tutorials/mcs/mc01b.md | 4 ++-- content/ja/tutorials/mcs/mc02.md | 18 +++++++++--------- content/ja/tutorials/mcs/mc03.md | 10 +++++----- content/ja/tutorials/mcs/mc04.md | 4 ++-- content/ja/tutorials/mcs/mc05.md | 8 ++++---- content/ja/tutorials/mcs/mc06.md | 10 +++++----- content/ja/tutorials/mcs/mc07.md | 8 ++++---- content/ja/tutorials/mcs/mc08.md | 8 ++++---- content/zh-cn/tutorials/mcs/mc01a.md | 8 ++++---- content/zh-cn/tutorials/mcs/mc01b.md | 4 ++-- content/zh-cn/tutorials/mcs/mc02.md | 18 +++++++++--------- content/zh-cn/tutorials/mcs/mc03.md | 10 +++++----- content/zh-cn/tutorials/mcs/mc04.md | 4 ++-- content/zh-cn/tutorials/mcs/mc05.md | 8 ++++---- content/zh-cn/tutorials/mcs/mc06.md | 10 +++++----- content/zh-cn/tutorials/mcs/mc07.md | 8 ++++---- content/zh-cn/tutorials/mcs/mc08.md | 8 ++++---- 27 files changed, 120 insertions(+), 120 deletions(-) diff --git a/content/en/tutorials/mcs/mc01a.md b/content/en/tutorials/mcs/mc01a.md index 08f91074..edc353ee 100644 --- a/content/en/tutorials/mcs/mc01a.md +++ b/content/en/tutorials/mcs/mc01a.md @@ -23,7 +23,7 @@ This tutorial can be run either on the command line or in Python. We recommend t ### Setting up and running the simulation on the command line -To set up and run the simulation on the command line, we first create a parameter file that specifies the parameters of the simulation(s). The downloadable file will be titled `parm1a`, with the following contents: +To set up and run the simulation on the command line, we first create a parameter file that specifies the parameters of the simulation(s). The downloadable file will be titled `parm1a`, with the following contents: ``` LATTICE="square lattice" @@ -100,7 +100,7 @@ Look at all six tasks and, by studying the binning analysis in the files `parm1a The `pyalps` package is a wrapper for ALPS: All it does is call the commands described in the previous section as if they were run in a terminal. It is superior for plotting because the output of the simulation can be read directly into a Python data structure and accessed by `matplotlib`. It also comes with a wrapper `pyalps.plot` for certain matplotlib functions to neatly plot data generated by `pyalps`. -To set up and run the simulation in Python, we create a script named `tutorial1a.py`. The first part of this script must import the required modules and prepare the input job and task files. Instead of writing a parameter file and using `convert2xml`, we store a list containing each task's parameters as a dictionary, like so: +To set up and run the simulation in Python, we create a script named `tutorial1a.py`. The first part of this script must import the required modules and prepare the input job and task files. Instead of writing a parameter file and using `convert2xml`, we store a list containing each task's parameters as a dictionary, like so: ```Python import pyalps @@ -197,7 +197,7 @@ We therefore repeat the simulations with cluster updates, using fewer thermaliza ### Command line -The downloadable parameter file `parm1b` has the following contents: +The downloadable parameter file `parm1b` has the following contents: ``` LATTICE="square lattice" @@ -224,7 +224,7 @@ spinmc --Tmin 10 --write-xml parm1b.in.xml ### Python -The script `tutorial1b.py` follows the same structure as `tutorial1a.py`, with the updated parameters and `parm1b` as the file prefix: +The script `tutorial1b.py` follows the same structure as `tutorial1a.py`, with the updated parameters and `parm1b` as the file prefix: ```Python import pyalps diff --git a/content/en/tutorials/mcs/mc01b.md b/content/en/tutorials/mcs/mc01b.md index a3330986..5939c746 100644 --- a/content/en/tutorials/mcs/mc01b.md +++ b/content/en/tutorials/mcs/mc01b.md @@ -22,7 +22,7 @@ Both are checked by inspecting the time series of a measured observable — in t ### Preparing and running the simulation on the command line -The parameter file `parm1a` sets up a single simulation of the Ising model on a $48 \times 48$ square lattice at the critical temperature: +The parameter file `parm1a` sets up a single simulation of the Ising model on a $48 \times 48$ square lattice at the critical temperature: ``` LATTICE="square lattice" @@ -44,7 +44,7 @@ spinmc --Tmin 10 --write-xml parm1a.in.xml ### Preparing and running the simulation in Python -The full script is available as `tutorial1a.py`. +The full script is available as `tutorial1a.py`. It begins by importing the required modules and defining the simulation parameters: ```Python diff --git a/content/en/tutorials/mcs/mc02.md b/content/en/tutorials/mcs/mc02.md index 8a15a661..871f2580 100644 --- a/content/en/tutorials/mcs/mc02.md +++ b/content/en/tutorials/mcs/mc02.md @@ -20,7 +20,7 @@ The comparison highlights two key contrasts: how quantum fluctuations modify the #### Setting up and running on the command line -The parameter file `parm2a` sets up simulations of the classical ferromagnetic Heisenberg model on a chain of 60 sites across a range of temperatures: +The parameter file `parm2a` sets up simulations of the classical ferromagnetic Heisenberg model on a chain of 60 sites across a range of temperatures: ``` LATTICE="chain lattice" @@ -56,7 +56,7 @@ spinmc --Tmin 10 --write-xml parm2a.in.xml #### Setting up and running in Python -The script `tutorial2a.py` sets up and runs the same simulation. Place it in the same folder as `parm2a`: +The script `tutorial2a.py` sets up and runs the same simulation. Place it in the same folder as `parm2a`: ```Python import pyalps @@ -110,7 +110,7 @@ Aside from the lattice change and the two couplings, the simulation setup is ide #### Setting up and running on the command line -Download `parm2b` and place it in the same folder: +Download `parm2b` and place it in the same folder: ``` LATTICE="ladder" @@ -147,7 +147,7 @@ spinmc --Tmin 10 --write-xml parm2b.in.xml #### Setting up and running in Python -The script `tutorial2b.py` is a copy of `tutorial2a.py` with three changes: the prefix renamed to `parm2b`, `LATTICE` set to `"ladder"`, and `J` replaced by `J0` and `J1` (both `-1`). +The script `tutorial2b.py` is a copy of `tutorial2a.py` with three changes: the prefix renamed to `parm2b`, `LATTICE` set to `"ladder"`, and `J` replaced by `J0` and `J1` (both `-1`). ## Quantum Heisenberg models @@ -162,7 +162,7 @@ The key parameter changes, relative to the classical case, are: #### Setting up and running on the command line -Download `parm2c`: +Download `parm2c`: ``` LATTICE="chain lattice" @@ -200,7 +200,7 @@ loop parm2c.in.xml #### Setting up and running in Python -The script `tutorial2c.py` adapts `tutorial2a.py` to the quantum parameters and calls `loop` instead of `spinmc`: +The script `tutorial2c.py` adapts `tutorial2a.py` to the quantum parameters and calls `loop` instead of `spinmc`: ```Python input_file = pyalps.writeInputFiles('parm2c', parms) @@ -223,7 +223,7 @@ Unlike the gapless chain, the two-leg antiferromagnetic Heisenberg ladder has a #### Setting up and running on the command line -Download `parm2d`: +Download `parm2d`: ``` LATTICE="ladder" @@ -257,11 +257,11 @@ loop parm2d.in.xml #### Setting up and running in Python -The script `tutorial2d.py` adapts `tutorial2c.py`: rename the prefix to `parm2d`, change `LATTICE` to `"ladder"`, and replace `J` with `J0` and `J1` (both `1`). +The script `tutorial2d.py` adapts `tutorial2c.py`: rename the prefix to `parm2d`, change `LATTICE` to `"ladder"`, and replace `J` with `J0` and `J1` (both `1`). ## Combining all four simulations -After running all four simulations in the same folder, the script `tutorial2full.py` loads all results together and overlays them on a single plot. +After running all four simulations in the same folder, the script `tutorial2full.py` loads all results together and overlays them on a single plot. ```Python import pyalps diff --git a/content/en/tutorials/mcs/mc03.md b/content/en/tutorials/mcs/mc03.md index e228cb1b..26825e41 100644 --- a/content/en/tutorials/mcs/mc03.md +++ b/content/en/tutorials/mcs/mc03.md @@ -20,7 +20,7 @@ The temperature is low enough that the results are close to the ground-state mag #### Setting up and running on the command line -The parameter file `parm3a`: +The parameter file `parm3a`: ``` LATTICE="chain lattice" @@ -61,7 +61,7 @@ dirloop_sse --Tmin 10 --write-xml parm3a.in.xml #### Setting up and running in Python -The script `tutorial3a.py`: +The script `tutorial3a.py`: ```Python import pyalps @@ -114,7 +114,7 @@ We use 20 rungs (40 sites total) and extend the field range to $h = 3.5$ to reac #### Setting up and running on the command line -The parameter file `parm3b` uses the same structure as `parm3a` with these changes: +The parameter file `parm3b` uses the same structure as `parm3a` with these changes: ``` LATTICE="ladder" @@ -154,7 +154,7 @@ dirloop_sse --Tmin 10 --write-xml parm3b.in.xml #### Setting up and running in Python -The script `tutorial3b.py` adapts `tutorial3a.py`: rename the prefix to `parm3b`, change `LATTICE` to `"ladder"`, replace `J` with `J0=J1=1`, and extend the field scan to 3.5. +The script `tutorial3b.py` adapts `tutorial3a.py`: rename the prefix to `parm3b`, change `LATTICE` to `"ladder"`, replace `J` with `J0=J1=1`, and extend the field scan to 3.5. #### Evaluating and plotting @@ -175,7 +175,7 @@ In contrast to the chain, the ladder magnetization is zero up to a finite lower ## Combining both simulations -After running both simulations in the same folder, the script `tutorial3full.py` overlays the two magnetization curves on a single plot: +After running both simulations in the same folder, the script `tutorial3full.py` overlays the two magnetization curves on a single plot: ```Python import pyalps diff --git a/content/en/tutorials/mcs/mc04.md b/content/en/tutorials/mcs/mc04.md index 52c94dd4..016d6b3c 100644 --- a/content/en/tutorials/mcs/mc04.md +++ b/content/en/tutorials/mcs/mc04.md @@ -20,7 +20,7 @@ The small system size allows a fast simulation; finite-size effects are signific ### Command line -The parameter file `parm4` enables three additional measurement flags alongside the standard parameters: +The parameter file `parm4` enables three additional measurement flags alongside the standard parameters: ``` MODEL="spin" @@ -53,7 +53,7 @@ dirloop_sse --Tmin 10 --write-xml parm4.in.xml ### Python -The script `tutorial4.py`: +The script `tutorial4.py`: ```Python import pyalps diff --git a/content/en/tutorials/mcs/mc05.md b/content/en/tutorials/mcs/mc05.md index e32ac40d..1c126757 100644 --- a/content/en/tutorials/mcs/mc05.md +++ b/content/en/tutorials/mcs/mc05.md @@ -22,7 +22,7 @@ The Hilbert space is truncated at `Nmax=2` bosons per site, which is a good appr ### Command line -The parameter file `parm5a`: +The parameter file `parm5a`: ``` LATTICE="square lattice" @@ -58,7 +58,7 @@ worm --Tmin 10 --write-xml parm5a.in.xml ### Python -The script `tutorial5a.py`: +The script `tutorial5a.py`: ```Python import pyalps @@ -115,7 +115,7 @@ We simulate three system sizes $L = 4, 6, 8$ on a fine grid of hopping values ar ### Command line -The parameter file `parm5b`: +The parameter file `parm5b`: ``` LATTICE="square lattice" @@ -159,7 +159,7 @@ worm --Tmin 10 --write-xml parm5b.in.xml ### Python -The script `tutorial5b.py`: +The script `tutorial5b.py`: ```Python import pyalps diff --git a/content/en/tutorials/mcs/mc06.md b/content/en/tutorials/mcs/mc06.md index a9ba693f..8b54100e 100644 --- a/content/en/tutorials/mcs/mc06.md +++ b/content/en/tutorials/mcs/mc06.md @@ -14,7 +14,7 @@ From a single simulation one can then evaluate thermodynamic observables — ene ### The ferromagnetic Heisenberg chain -The parameter file `parm6a` sets up a QWL simulation of the $S=\frac{1}{2}$ Heisenberg ferromagnet on a chain of 40 sites: +The parameter file `parm6a` sets up a QWL simulation of the $S=\frac{1}{2}$ Heisenberg ferromagnet on a chain of 40 sites: ``` LATTICE="chain lattice" @@ -64,7 +64,7 @@ The tools `plot2xmgr` (Grace) and `plot2gp` (Gnuplot) produce equivalent output ### Python -The script `tutorial6a.py` sets up and runs the simulation, then evaluates all observables in one call: +The script `tutorial6a.py` sets up and runs the simulation, then evaluates all observables in one call: ```python import pyalps @@ -85,7 +85,7 @@ For the ferromagnet ($J=-1$) you should see a broad specific-heat peak at low te ### The antiferromagnetic Heisenberg chain To simulate the antiferromagnetic chain set $J=1$ instead of $J=-1$. -The parameters are in `parm6b` and the Python script in `tutorial6b.py`; everything else is identical to the ferromagnetic case. +The parameters are in `parm6b` and the Python script in `tutorial6b.py`; everything else is identical to the ferromagnetic case. For the antiferromagnet the uniform susceptibility remains finite as $T\to 0$ (a signature of the spin-liquid ground state of the 1D antiferromagnet), while the specific-heat peak shifts and broadens differently. @@ -93,8 +93,8 @@ For the antiferromagnet the uniform susceptibility remains finite as $T\to 0$ (a ### Simulating the 3D quantum Heisenberg antiferromagnet -The parameter file `parm6c` sets up a QWL simulation of the $S=\frac{1}{2}$ Heisenberg antiferromagnet on a simple cubic lattice with $4^3=64$ sites. -The Python script is `tutorial6c.py`. +The parameter file `parm6c` sets up a QWL simulation of the $S=\frac{1}{2}$ Heisenberg antiferromagnet on a simple cubic lattice with $4^3=64$ sites. +The Python script is `tutorial6c.py`. Run and evaluate exactly as for the chain above. The staggered structure factor $S(\pi,\pi,\pi)$ should start rising steeply near $T\approx 1$, signaling the onset of antiferromagnetic correlations. @@ -105,7 +105,7 @@ The specific heat shows a corresponding peak and the entropy decreases rapidly i Finite-size scaling predicts that the staggered structure factor at the critical point scales as $S(L) \propto L^{2-\eta}$ with $\eta \approx 0.034$ (3D classical Heisenberg universality class). A plot of $S(L)/L^{2-\eta}$ vs. temperature should show curves for different $L$ crossing at the critical temperature $T_c$. -The parameter file `parm6d` (or `tutorial6d.py`) runs the cubic antiferromagnet for two system sizes ($L=4$ and $L=6$) with a larger `CUTOFF=1000` to maintain accuracy at lower temperatures. +The parameter file `parm6d` (or `tutorial6d.py`) runs the cubic antiferromagnet for two system sizes ($L=4$ and $L=6$) with a larger `CUTOFF=1000` to maintain accuracy at lower temperatures. After running, load the results: ```python diff --git a/content/en/tutorials/mcs/mc07.md b/content/en/tutorials/mcs/mc07.md index 14808c14..1b3b8dce 100644 --- a/content/en/tutorials/mcs/mc07.md +++ b/content/en/tutorials/mcs/mc07.md @@ -19,7 +19,7 @@ Start the fine-grid simulations now so they run while you work through the rest ### Command line -Download `parm7b` and run: +Download `parm7b` and run: ``` parameter2xml parm7b @@ -30,7 +30,7 @@ The `--Tmin 10` flag sets a checkpoint interval of 10 seconds, allowing the simu ### Python -The first part of `tutorial7b.py` sets up and launches the same simulation: +The first part of `tutorial7b.py` sets up and launches the same simulation: ```Python import pyalps @@ -65,7 +65,7 @@ We first make a coarse temperature scan on small systems to locate the critical ### Command line -Download `parm7a` and run: +Download `parm7a` and run: ``` parameter2xml parm7a @@ -74,7 +74,7 @@ spinmc --Tmin 5 parm7a.in.xml ### Python -Using `tutorial7a.py`: +Using `tutorial7a.py`: ```Python import pyalps diff --git a/content/en/tutorials/mcs/mc08.md b/content/en/tutorials/mcs/mc08.md index ab9a0caf..c9c7cde5 100644 --- a/content/en/tutorials/mcs/mc08.md +++ b/content/en/tutorials/mcs/mc08.md @@ -38,7 +38,7 @@ Start it now so it runs in the background while you work through the rest of the ### Command line -Download `parm8b` and run: +Download `parm8b` and run: ``` parameter2xml parm8b @@ -47,20 +47,20 @@ loop parm8b.in.xml & ### Python -Run the first part of `tutorial8b.py` (the setup and `pyalps.runApplication` call) in a separate terminal or as a background process before continuing. +Run the first part of `tutorial8b.py` (the setup and `pyalps.runApplication` call) in a separate terminal or as a background process before continuing. ## Identify the different phases We begin by considering the two simple limits: decoupled ladders ($J_2=0$) and the isotropic square lattice ($J_2=1$). The decoupled ladders have a ground state with short-range correlations and exhibit a finite spin gap: this is a spin liquid phase. The square lattice, by contrast, displays long-range order with a finite staggered magnetization: this is an antiferromagnetic Néel phase. -A clear way to probe these two phases is through the magnetic susceptibility $\chi$. Simulate an $8\times 8$ system over a range of temperatures for both cases and compare the results. For decoupled ladders the susceptibility exhibits activated behavior at low temperature due to the spin gap; on the square lattice it tends to a finite constant as $T\to 0$. Note that on any finite system $\chi$ will eventually tend to zero at low enough temperature due to the finite-size gap, but this is not our focus here. Run the simulation on the command line with parameter file `parm8a`: +A clear way to probe these two phases is through the magnetic susceptibility $\chi$. Simulate an $8\times 8$ system over a range of temperatures for both cases and compare the results. For decoupled ladders the susceptibility exhibits activated behavior at low temperature due to the spin gap; on the square lattice it tends to a finite constant as $T\to 0$. Note that on any finite system $\chi$ will eventually tend to zero at low enough temperature due to the finite-size gap, but this is not our focus here. Run the simulation on the command line with parameter file `parm8a`: ``` parameter2xml parm8a loop parm8a.in.xml ``` -or with the Python script `tutorial8a.py`. +or with the Python script `tutorial8a.py`. ```Python import pyalps @@ -201,7 +201,7 @@ Both observables crossing (rather than one diverging) confirms that the transiti You have obtained a rough estimate of the quantum critical point $J_2^c$. As in the classical case, extracting the critical exponents requires a more precise determination of $J_2^c$. -This is done by running larger system sizes on a finer grid of $J_2$ values, as set up in `parm8d` and `tutorial8d.py`. Note that these simulations are CPU-intensive and are left as an exercise. Plot the Binder cumulant $U_4$ and the rescaled stiffness $\rho_s L$ for different system sizes; the crossing point gives a refined estimate of $J_2^c$. To extract $\nu$, consider how the derivatives of these quantities with respect to $J_2$, evaluated at $J_2^c$, scale with system size. These derivatives can in principle be measured directly in the Monte Carlo, but for this tutorial it is sufficient to compute them by numerical differentiation using the fine $J_2$ grid. +This is done by running larger system sizes on a finer grid of $J_2$ values, as set up in `parm8d` and `tutorial8d.py`. Note that these simulations are CPU-intensive and are left as an exercise. Plot the Binder cumulant $U_4$ and the rescaled stiffness $\rho_s L$ for different system sizes; the crossing point gives a refined estimate of $J_2^c$. To extract $\nu$, consider how the derivatives of these quantities with respect to $J_2$, evaluated at $J_2^c$, scale with system size. These derivatives can in principle be measured directly in the Monte Carlo, but for this tutorial it is sufficient to compute them by numerical differentiation using the fine $J_2$ grid. Perform the numerical differentiations for the different system sizes for both quantities, and plot their values at $J_2^c$ as a function of system size. Data should scale as a power law: @@ -225,7 +225,7 @@ When $J_2$ is very large, the inter-ladder coupling dominates over the intra-lad This is again a gapped spin liquid phase, so the phase diagram has the structure: spin liquid → Néel AFM → spin liquid as $J_2$ increases from 0 to large values. There must therefore be a second quantum critical point $J_2^{c_2}$ at which the Néel order is destroyed. -We repeat the finite-size scaling analysis in the parameter regime $J_2 \in [1.8, 2.1]$ using the parameter file `parm8c` or the script `tutorial8c.py`, which use the same system sizes and $\beta=2L$ as `parm8b` but scan the higher-$J_2$ range. +We repeat the finite-size scaling analysis in the parameter regime $J_2 \in [1.8, 2.1]$ using the parameter file `parm8c` or the script `tutorial8c.py`, which use the same system sizes and $\beta=2L$ as `parm8b` but scan the higher-$J_2$ range. ### Command line diff --git a/content/ja/tutorials/mcs/mc01a.md b/content/ja/tutorials/mcs/mc01a.md index 162abc8d..462fdc49 100644 --- a/content/ja/tutorials/mcs/mc01a.md +++ b/content/ja/tutorials/mcs/mc01a.md @@ -23,7 +23,7 @@ This tutorial can be run either on the command line or in Python. We recommend t ### Setting up and running the simulation on the command line -To set up and run the simulation on the command line, we first create a parameter file that specifies the parameters of the simulation(s). The downloadable file will be titled `parm1a`, with the following contents: +To set up and run the simulation on the command line, we first create a parameter file that specifies the parameters of the simulation(s). The downloadable file will be titled `parm1a`, with the following contents: ``` LATTICE="square lattice" @@ -100,7 +100,7 @@ Look at all six tasks and, by studying the binning analysis in the files `parm1a The `pyalps` package is a wrapper for ALPS: All it does is call the commands described in the previous section as if they were run in a terminal. It is superior for plotting because the output of the simulation can be read directly into a Python data structure and accessed by `matplotlib`, and it also comes with a wrapper `pyalps.plot` for certain matplotlib functions to neatly plot data generated by `pyalps`. -To set up and run the simulation in Python, we create a script named `tutorial1a.py`. The first part of this script must import the required modules and prepare the input job and task files. Instead of writing a parameter file and using `convert2xml`, we store a list containing each task's parameters as a dictionary, like so: +To set up and run the simulation in Python, we create a script named `tutorial1a.py`. The first part of this script must import the required modules and prepare the input job and task files. Instead of writing a parameter file and using `convert2xml`, we store a list containing each task's parameters as a dictionary, like so: ```Python import pyalps @@ -197,7 +197,7 @@ We therefore repeat the simulations with cluster updates, using fewer thermaliza ### Command line -The downloadable parameter file `parm1b` has the following contents: +The downloadable parameter file `parm1b` has the following contents: ``` LATTICE="square lattice" @@ -224,7 +224,7 @@ spinmc --Tmin 10 --write-xml parm1b.in.xml ### Python -The script `tutorial1b.py` follows the same structure as `tutorial1a.py`, with the updated parameters and `parm1b` as the file prefix: +The script `tutorial1b.py` follows the same structure as `tutorial1a.py`, with the updated parameters and `parm1b` as the file prefix: ```Python import pyalps diff --git a/content/ja/tutorials/mcs/mc01b.md b/content/ja/tutorials/mcs/mc01b.md index e9583814..e13351ad 100644 --- a/content/ja/tutorials/mcs/mc01b.md +++ b/content/ja/tutorials/mcs/mc01b.md @@ -22,7 +22,7 @@ Both are checked by inspecting the time series of a measured observable — in t ### Preparing and running the simulation on the command line -The parameter file `parm1a` sets up a single simulation of the Ising model on a $48 \times 48$ square lattice at the critical temperature: +The parameter file `parm1a` sets up a single simulation of the Ising model on a $48 \times 48$ square lattice at the critical temperature: ``` LATTICE="square lattice" @@ -44,7 +44,7 @@ spinmc --Tmin 10 --write-xml parm1a.in.xml ### Preparing and running the simulation in Python -The full script is available as `tutorial1a.py`. +The full script is available as `tutorial1a.py`. It begins by importing the required modules and defining the simulation parameters: ```Python diff --git a/content/ja/tutorials/mcs/mc02.md b/content/ja/tutorials/mcs/mc02.md index cad2a240..0bc0fcd0 100644 --- a/content/ja/tutorials/mcs/mc02.md +++ b/content/ja/tutorials/mcs/mc02.md @@ -20,7 +20,7 @@ The comparison highlights two key contrasts: how quantum fluctuations modify the #### Setting up and running on the command line -The parameter file `parm2a` sets up simulations of the classical ferromagnetic Heisenberg model on a chain of 60 sites across a range of temperatures: +The parameter file `parm2a` sets up simulations of the classical ferromagnetic Heisenberg model on a chain of 60 sites across a range of temperatures: ``` LATTICE="chain lattice" @@ -56,7 +56,7 @@ spinmc --Tmin 10 --write-xml parm2a.in.xml #### Setting up and running in Python -The script `tutorial2a.py` sets up and runs the same simulation. Place it in the same folder as `parm2a`: +The script `tutorial2a.py` sets up and runs the same simulation. Place it in the same folder as `parm2a`: ```Python import pyalps @@ -110,7 +110,7 @@ Aside from the lattice change and the two couplings, the simulation setup is ide #### Setting up and running on the command line -Download `parm2b` and place it in the same folder: +Download `parm2b` and place it in the same folder: ``` LATTICE="ladder" @@ -147,7 +147,7 @@ spinmc --Tmin 10 --write-xml parm2b.in.xml #### Setting up and running in Python -The script `tutorial2b.py` is a copy of `tutorial2a.py` with three changes: the prefix renamed to `parm2b`, `LATTICE` set to `"ladder"`, and `J` replaced by `J0` and `J1` (both `-1`). +The script `tutorial2b.py` is a copy of `tutorial2a.py` with three changes: the prefix renamed to `parm2b`, `LATTICE` set to `"ladder"`, and `J` replaced by `J0` and `J1` (both `-1`). ## Quantum Heisenberg models @@ -162,7 +162,7 @@ The key parameter changes from the classical case are: #### Setting up and running on the command line -Download `parm2c`: +Download `parm2c`: ``` LATTICE="chain lattice" @@ -200,7 +200,7 @@ loop parm2c.in.xml #### Setting up and running in Python -The script `tutorial2c.py` adapts `tutorial2a.py` to the quantum parameters and calls `loop` instead of `spinmc`: +The script `tutorial2c.py` adapts `tutorial2a.py` to the quantum parameters and calls `loop` instead of `spinmc`: ```Python input_file = pyalps.writeInputFiles('parm2c', parms) @@ -214,7 +214,7 @@ Unlike the gapless chain, the two-leg antiferromagnetic Heisenberg ladder has a #### Setting up and running on the command line -Download `parm2d`: +Download `parm2d`: ``` LATTICE="ladder" @@ -248,11 +248,11 @@ loop parm2d.in.xml #### Setting up and running in Python -The script `tutorial2d.py` adapts `tutorial2c.py`: rename the prefix to `parm2d`, change `LATTICE` to `"ladder"`, and replace `J` with `J0` and `J1` (both `1`). +The script `tutorial2d.py` adapts `tutorial2c.py`: rename the prefix to `parm2d`, change `LATTICE` to `"ladder"`, and replace `J` with `J0` and `J1` (both `1`). ## Combining all four simulations -After running all four simulations in the same folder, the script `tutorial2full.py` loads all results together and overlays them on a single plot. +After running all four simulations in the same folder, the script `tutorial2full.py` loads all results together and overlays them on a single plot. ```Python import pyalps diff --git a/content/ja/tutorials/mcs/mc03.md b/content/ja/tutorials/mcs/mc03.md index 191169b9..b374abc3 100644 --- a/content/ja/tutorials/mcs/mc03.md +++ b/content/ja/tutorials/mcs/mc03.md @@ -14,7 +14,7 @@ In this tutorial we will look at magnetization curves of quantum spin models usi #### Preparing and running the simulation from the command line -The parameter file `parm3a` sets up Monte Carlo simulations of the quantum mechanical S=1/2 Heisenberg model on a one-dimensional chain with 20 sites at fixed temperature T=0.08 for a couple of magnetic fields (h=0, 0.1, ..., 2.5). +The parameter file `parm3a` sets up Monte Carlo simulations of the quantum mechanical S=1/2 Heisenberg model on a one-dimensional chain with 20 sites at fixed temperature T=0.08 for a couple of magnetic fields (h=0, 0.1, ..., 2.5). ```Python LATTICE="chain lattice" @@ -55,7 +55,7 @@ dirloop_sse --Tmin 10 --write-xml parm3a.in.xml #### Preparing and running the simulation using Python -Setting up and running the simulation in Python is as before, with the script `tutorial3a.py`: +Setting up and running the simulation in Python is as before, with the script `tutorial3a.py`: ```Python import pyalps @@ -107,7 +107,7 @@ plt.show() ### One-dimensional Heisenberg ladder in a magnetic field -The parameter file `parm3b` sets up Monte Carlo simulations of the quantum mechanical S=1/2 Heisenberg model on a one-dimensional ladder with 40 sites at fixed temperature T=0.08 for a couple of magnetic fields (h=0, 0.1, ..., 3.5). +The parameter file `parm3b` sets up Monte Carlo simulations of the quantum mechanical S=1/2 Heisenberg model on a one-dimensional ladder with 40 sites at fixed temperature T=0.08 for a couple of magnetic fields (h=0, 0.1, ..., 3.5). ```Python LATTICE="ladder" @@ -119,11 +119,11 @@ J1=1 T=0.08 ``` -The rest of the input file is as above and simulations are run in the same way. The corresponding script is downloadable here. +The rest of the input file is as above and simulations are run in the same way. The corresponding script is downloadable here. ### Combining all simulations -The procedure to combine all results into one plot after running both simulations is extremely similar to the previous tutorial. The script is downloadable here. Here is the combined plot: +The procedure to combine all results into one plot after running both simulations is extremely similar to the previous tutorial. The script is downloadable here. Here is the combined plot: ![](/figs/mcs03mvsh.png) diff --git a/content/ja/tutorials/mcs/mc04.md b/content/ja/tutorials/mcs/mc04.md index 4d6dbe8a..148b69eb 100644 --- a/content/ja/tutorials/mcs/mc04.md +++ b/content/ja/tutorials/mcs/mc04.md @@ -14,7 +14,7 @@ In this tutorial, we will measure correlation functions with the directed loop a #### Preparing and running the simulation from the command line -The parameter file `parm4` sets up Monte Carlo simulations of the quantum mechanical S=1/2 Heisenberg model on a square lattice, and enables various measurement options: +The parameter file `parm4` sets up Monte Carlo simulations of the quantum mechanical S=1/2 Heisenberg model on a square lattice, and enables various measurement options: ``` MODEL="spin"; @@ -41,7 +41,7 @@ dirloop_sse --Tmin 10 --write-xml parm4.in.xml #### Preparing and running the simulation using Python -To set up and run the simulation in Python we use the script `tutorial4.py`: +To set up and run the simulation in Python we use the script `tutorial4.py`: ``` import pyalps diff --git a/content/ja/tutorials/mcs/mc05.md b/content/ja/tutorials/mcs/mc05.md index 79f4a8a3..6fb34b1e 100644 --- a/content/ja/tutorials/mcs/mc05.md +++ b/content/ja/tutorials/mcs/mc05.md @@ -14,7 +14,7 @@ As an example of the worm QMC code, we will study a quantum phase transition in #### Preparing and running the simulation from the command line -The parameter file `parm5a` with the following contents sets up Monte Carlo simulations of the quantum Bose Hubbard model on a square lattice with 4x4 sites for a couple of hopping parameters (t=0.01, 0.02, ..., 0.1) using the worm code. +The parameter file `parm5a` with the following contents sets up Monte Carlo simulations of the quantum Bose Hubbard model on a square lattice with 4x4 sites for a couple of hopping parameters (t=0.01, 0.02, ..., 0.1) using the worm code. ``` LATTICE="square lattice"; @@ -39,7 +39,7 @@ THERMALIZATION=10000; { t=0.1; } ``` -The corresponding Python script is found at `tutorial5a.py`. +The corresponding Python script is found at `tutorial5a.py`. #### Evaluating the simulation and preparing plots using Python @@ -70,7 +70,7 @@ We next want to pin down the location of the phase transition more accurately. F #### Preparing and running the simulation from the command line -In the parameter file `parm5b` we focus on the region around the critical point for three system sizes L=4, 6, and 8: +In the parameter file `parm5b` we focus on the region around the critical point for three system sizes L=4, 6, and 8: ``` LATTICE="square lattice"; @@ -105,7 +105,7 @@ THERMALIZATION=150000; { L=8; t=0.065; } ``` -The corresponding Python script is found at `tutorial5b.py`. +The corresponding Python script is found at `tutorial5b.py`. #### Evaluating the simulation using Python diff --git a/content/ja/tutorials/mcs/mc06.md b/content/ja/tutorials/mcs/mc06.md index cca44f63..50d7601b 100644 --- a/content/ja/tutorials/mcs/mc06.md +++ b/content/ja/tutorials/mcs/mc06.md @@ -16,7 +16,7 @@ We will start with a quick tutorial on using the ALPS qwl code for a spin chain. #### Using the command line -The parameter file `parm6a` sets up a Monte Carlo simulation of the quantum mechanical Heisenberg ferromagnet on a one-dimensional chain with 40 sites, using the quantum Wang-Landau (QWL) method. +The parameter file `parm6a` sets up a Monte Carlo simulation of the quantum mechanical Heisenberg ferromagnet on a one-dimensional chain with 40 sites, using the quantum Wang-Landau (QWL) method. ``` LATTICE="chain lattice" @@ -70,7 +70,7 @@ Similarly the tool `plot2gp` produces Gnuplot scripts and `plot2text` converts t #### Using Python -To set up and run the simulation in Python we use the script `tutorial6a.py`, which imports modules, prepares the parameters, and runs the simulation as usual. Then, it runs the evaluation program on all output files +To set up and run the simulation in Python we use the script `tutorial6a.py`, which imports modules, prepares the parameters, and runs the simulation as usual. Then, it runs the evaluation program on all output files ``` data = pyalps.evaluateQWL(pyalps.getResultFiles(prefix='parm6a'),DELTA_T=0.1, T_MIN=0.1, T_MAX=10.0) @@ -88,7 +88,7 @@ for s in pyalps.flatten(data): ### The antiferromagnetic Heisenberg chain -To simulate the antiferromagnetic chain, we prepare new simulations setting J=1 instead of J=-1. The parameters should be in `parm6b`, the Python script in `tutorial6b.py`. +To simulate the antiferromagnetic chain, we prepare new simulations setting J=1 instead of J=-1. The parameters should be in `parm6b`, the Python script in `tutorial6b.py`. #### Questions @@ -102,7 +102,7 @@ To simulate the antiferromagnetic chain, we prepare new simulations setting J=1 ### Simulating the 3D quantum Heisenberg antiferromegnet -The parameter file `parm6c` should set up a Monte Carlo simulation of the quantum mechanical Heisenberg antiferromagnet on a three-dimensional simple cubic lattice with $4^3$ sites, using the QWL method. The Python script should be `tutorial6c.py`. +The parameter file `parm6c` should set up a Monte Carlo simulation of the quantum mechanical Heisenberg antiferromagnet on a three-dimensional simple cubic lattice with $4^3$ sites, using the QWL method. The Python script should be `tutorial6c.py`. The simulations are set up and run as above. #### Questions @@ -112,7 +112,7 @@ The simulations are set up and run as above. ### Finite size scaling analysis to determine the critical point -Finite size scaling theory predics the staggered structure factor $S(L)$ for this transition to scale at the critical point as $L^{2-\eta}$, where $\eta\approx 0.034$. A scaling plot of $S(L)/L^{2-\eta}$ vs. temperature is expected to show a crossing of curves for different linear system sizes L at the critical temperature $T_c$. In order to produce such a scaling plot, we set up a further simulation of the cubic antiferromagnet, for a larger system with $L=4$ and a cutoff at 1000, in the parameter file `parm6d` or the Python script `tutorial6d.py`. +Finite size scaling theory predics the staggered structure factor $S(L)$ for this transition to scale at the critical point as $L^{2-\eta}$, where $\eta\approx 0.034$. A scaling plot of $S(L)/L^{2-\eta}$ vs. temperature is expected to show a crossing of curves for different linear system sizes L at the critical temperature $T_c$. In order to produce such a scaling plot, we set up a further simulation of the cubic antiferromagnet, for a larger system with $L=4$ and a cutoff at 1000, in the parameter file `parm6d` or the Python script `tutorial6d.py`. Evaluation now requires multiplication of the results with $L^{2-\eta}$ which is easiest done in Python. After running the simulation we first load the results: ``` diff --git a/content/ja/tutorials/mcs/mc07.md b/content/ja/tutorials/mcs/mc07.md index d6848798..63f895cf 100644 --- a/content/ja/tutorials/mcs/mc07.md +++ b/content/ja/tutorials/mcs/mc07.md @@ -12,14 +12,14 @@ The goal of this tutorial is to learn how to detect a second-order phase transit Almost everything is known about the phase transition in the 2d Ising model since it is exactly solvable. In this tutotial, we will try to recover the location of the critical point, as well as critical exponents as if we would not know them in order to illustrate the methods. To make precise estimations requires quite some time. For this let us start the final simulation parameters in the background while doing the first part of the tutorial. -You can start the second simulation in the background with the parameter file `parm7b` and type: +You can start the second simulation in the background with the parameter file `parm7b` and type: ``` parameter2xml parm7b spinmc --Tmin 10 parm7b.in.xml & ``` -or run the first part of `tutorial7b.py`: +or run the first part of `tutorial7b.py`: ``` import pyalps @@ -59,14 +59,14 @@ pyalps.runApplication('spinmc',input_file,Tmin=5) ## Locate roughly the phase transition -First, we make a rough temperature scan on small systems, in order to locate roughly the critical range. We use the parameter file `parm7a` and the command +First, we make a rough temperature scan on small systems, in order to locate roughly the critical range. We use the parameter file `parm7a` and the command ``` parameter2xml parm7a spinmc --Tmin 5 parm7a.in.xml ``` -Alternatively, we can run the simulations in Python with the file `tutorial7a.py`: +Alternatively, we can run the simulations in Python with the file `tutorial7a.py`: ``` import pyalps diff --git a/content/ja/tutorials/mcs/mc08.md b/content/ja/tutorials/mcs/mc08.md index 9289a8e7..caa8a66a 100644 --- a/content/ja/tutorials/mcs/mc08.md +++ b/content/ja/tutorials/mcs/mc08.md @@ -12,14 +12,14 @@ In this tutorial we will learn how to detect quantum critical points in a quantu First of all, we consider the two simple limits of decoupled ladders ($J_2=0$) and of the isotropic square lattice ($J_2=1$). The decoupled ladders have a ground-state with short-range correlations and exhibit a finite spin gap: this is a spin liquid phase. On the other hand, the square lattice displays long-range order with a finite staggered magnetization: this is an antiferromagnetic Néel phase. -A simple and illustrative way of probing these two different physics is by looking at the magnetic susceptibility $\chi$. Let us simulate an 8x8 system using the following set of temperatures in the two different cases. Plot and compare the magnetic susceptibility in both the decoupled ($J_2=0$) and isotropic ($J_2=1$) situations. For decoupled ladders, the susceptibility exhibits an activated behaviour at low temperature due to the presence of the spin gap, whereas on the square lattice the susceptibility tends to a constant at low T. Please note that on a finite system, $\chi$ will always eventually tend to zero at small enough temperature due to the presence of a finite-size gap - this is however not our topic of interest here. You can run the simulation on the command line using a parameter file `parm8a`: +A simple and illustrative way of probing these two different physics is by looking at the magnetic susceptibility $\chi$. Let us simulate an 8x8 system using the following set of temperatures in the two different cases. Plot and compare the magnetic susceptibility in both the decoupled ($J_2=0$) and isotropic ($J_2=1$) situations. For decoupled ladders, the susceptibility exhibits an activated behaviour at low temperature due to the presence of the spin gap, whereas on the square lattice the susceptibility tends to a constant at low T. Please note that on a finite system, $\chi$ will always eventually tend to zero at small enough temperature due to the presence of a finite-size gap - this is however not our topic of interest here. You can run the simulation on the command line using a parameter file `parm8a`: ``` parameter2xml parm8a loop parm8a.in.xml ``` -or by creating a python script `tutorial8a.py`. +or by creating a python script `tutorial8a.py`. ```Python import pyalps @@ -92,7 +92,7 @@ plt.show() ## Locate the phase transition -Having identified two different phases at $J_2=0$ and $J_2=1$, there must be (at least) one quantum phase transition separating them. We scan the coupling range $J_2 \in [0.2,0.4]$ for system sizes $L=8,10,12,16$ and simulate the model at an inverse temperate $\beta=2L$ using the parameter-file `parm8b` or the python script `tutorial8b.py`: +Having identified two different phases at $J_2=0$ and $J_2=1$, there must be (at least) one quantum phase transition separating them. We scan the coupling range $J_2 \in [0.2,0.4]$ for system sizes $L=8,10,12,16$ and simulate the model at an inverse temperate $\beta=2L$ using the parameter-file `parm8b` or the python script `tutorial8b.py`: ```python import pyalps @@ -170,7 +170,7 @@ Second, why did we choose inverse temperature $\beta$ to be proportionnal to $L$ You have obtained a rough estimate of the quantum critical point $J_2^c$. As in the classical case, extracting the critical exponents require more work and in particular a more precise determination of $J_2^c$. -We will obtain one by considering larger system sizes on a finer grid of $J_2^c$. The parameters for this should be specified in `parm8d` and the script in `tutorial8d.py`. Please note that these simulations will take quite some CPU time and we therefore leave it to you as an exercise. Plot again the Binder cumulant of the staggered magnetization $U_4$ as well as the stiffness multiplied by system size $\rho_s L$ for different system sizes. The crossings of these curves should allow a more precise estimate of $J_2^c$. To obtain the critical exponent $\nu$ related to the divergence of the correlation length, it is useful to consider the scaling with system size of the derivative (with respect to $J_2^c$) of these quantities, when taken precisely at $J_2^c$. These derivatives $\frac{dU_4}{d J_2}$ and $L \frac{d\rho_s}{d J_2}$ can be obtained in principle as a Monte Carlo measurement, however for this tutorial, it is sufficient to perform a numerical differentiation which is possible thanks to the fine grid in $J_2$. +We will obtain one by considering larger system sizes on a finer grid of $J_2^c$. The parameters for this should be specified in `parm8d` and the script in `tutorial8d.py`. Please note that these simulations will take quite some CPU time and we therefore leave it to you as an exercise. Plot again the Binder cumulant of the staggered magnetization $U_4$ as well as the stiffness multiplied by system size $\rho_s L$ for different system sizes. The crossings of these curves should allow a more precise estimate of $J_2^c$. To obtain the critical exponent $\nu$ related to the divergence of the correlation length, it is useful to consider the scaling with system size of the derivative (with respect to $J_2^c$) of these quantities, when taken precisely at $J_2^c$. These derivatives $\frac{dU_4}{d J_2}$ and $L \frac{d\rho_s}{d J_2}$ can be obtained in principle as a Monte Carlo measurement, however for this tutorial, it is sufficient to perform a numerical differentiation which is possible thanks to the fine grid in $J_2$. Perform the numerical differentiations for the different system sizes for both quantities, and plot their values at $J_2^c$ as a function of system size. Data should scale as a power law : $\frac{dU_4}{d J_2}(J_2^c) \propto L \frac{d\rho_s}{d J_2}(J_2^c) \propto L^{1/\nu}$. Which value of $\nu$ do you obtain? diff --git a/content/zh-cn/tutorials/mcs/mc01a.md b/content/zh-cn/tutorials/mcs/mc01a.md index 162abc8d..462fdc49 100644 --- a/content/zh-cn/tutorials/mcs/mc01a.md +++ b/content/zh-cn/tutorials/mcs/mc01a.md @@ -23,7 +23,7 @@ This tutorial can be run either on the command line or in Python. We recommend t ### Setting up and running the simulation on the command line -To set up and run the simulation on the command line, we first create a parameter file that specifies the parameters of the simulation(s). The downloadable file will be titled `parm1a`, with the following contents: +To set up and run the simulation on the command line, we first create a parameter file that specifies the parameters of the simulation(s). The downloadable file will be titled `parm1a`, with the following contents: ``` LATTICE="square lattice" @@ -100,7 +100,7 @@ Look at all six tasks and, by studying the binning analysis in the files `parm1a The `pyalps` package is a wrapper for ALPS: All it does is call the commands described in the previous section as if they were run in a terminal. It is superior for plotting because the output of the simulation can be read directly into a Python data structure and accessed by `matplotlib`, and it also comes with a wrapper `pyalps.plot` for certain matplotlib functions to neatly plot data generated by `pyalps`. -To set up and run the simulation in Python, we create a script named `tutorial1a.py`. The first part of this script must import the required modules and prepare the input job and task files. Instead of writing a parameter file and using `convert2xml`, we store a list containing each task's parameters as a dictionary, like so: +To set up and run the simulation in Python, we create a script named `tutorial1a.py`. The first part of this script must import the required modules and prepare the input job and task files. Instead of writing a parameter file and using `convert2xml`, we store a list containing each task's parameters as a dictionary, like so: ```Python import pyalps @@ -197,7 +197,7 @@ We therefore repeat the simulations with cluster updates, using fewer thermaliza ### Command line -The downloadable parameter file `parm1b` has the following contents: +The downloadable parameter file `parm1b` has the following contents: ``` LATTICE="square lattice" @@ -224,7 +224,7 @@ spinmc --Tmin 10 --write-xml parm1b.in.xml ### Python -The script `tutorial1b.py` follows the same structure as `tutorial1a.py`, with the updated parameters and `parm1b` as the file prefix: +The script `tutorial1b.py` follows the same structure as `tutorial1a.py`, with the updated parameters and `parm1b` as the file prefix: ```Python import pyalps diff --git a/content/zh-cn/tutorials/mcs/mc01b.md b/content/zh-cn/tutorials/mcs/mc01b.md index e9583814..e13351ad 100644 --- a/content/zh-cn/tutorials/mcs/mc01b.md +++ b/content/zh-cn/tutorials/mcs/mc01b.md @@ -22,7 +22,7 @@ Both are checked by inspecting the time series of a measured observable — in t ### Preparing and running the simulation on the command line -The parameter file `parm1a` sets up a single simulation of the Ising model on a $48 \times 48$ square lattice at the critical temperature: +The parameter file `parm1a` sets up a single simulation of the Ising model on a $48 \times 48$ square lattice at the critical temperature: ``` LATTICE="square lattice" @@ -44,7 +44,7 @@ spinmc --Tmin 10 --write-xml parm1a.in.xml ### Preparing and running the simulation in Python -The full script is available as `tutorial1a.py`. +The full script is available as `tutorial1a.py`. It begins by importing the required modules and defining the simulation parameters: ```Python diff --git a/content/zh-cn/tutorials/mcs/mc02.md b/content/zh-cn/tutorials/mcs/mc02.md index cad2a240..0bc0fcd0 100644 --- a/content/zh-cn/tutorials/mcs/mc02.md +++ b/content/zh-cn/tutorials/mcs/mc02.md @@ -20,7 +20,7 @@ The comparison highlights two key contrasts: how quantum fluctuations modify the #### Setting up and running on the command line -The parameter file `parm2a` sets up simulations of the classical ferromagnetic Heisenberg model on a chain of 60 sites across a range of temperatures: +The parameter file `parm2a` sets up simulations of the classical ferromagnetic Heisenberg model on a chain of 60 sites across a range of temperatures: ``` LATTICE="chain lattice" @@ -56,7 +56,7 @@ spinmc --Tmin 10 --write-xml parm2a.in.xml #### Setting up and running in Python -The script `tutorial2a.py` sets up and runs the same simulation. Place it in the same folder as `parm2a`: +The script `tutorial2a.py` sets up and runs the same simulation. Place it in the same folder as `parm2a`: ```Python import pyalps @@ -110,7 +110,7 @@ Aside from the lattice change and the two couplings, the simulation setup is ide #### Setting up and running on the command line -Download `parm2b` and place it in the same folder: +Download `parm2b` and place it in the same folder: ``` LATTICE="ladder" @@ -147,7 +147,7 @@ spinmc --Tmin 10 --write-xml parm2b.in.xml #### Setting up and running in Python -The script `tutorial2b.py` is a copy of `tutorial2a.py` with three changes: the prefix renamed to `parm2b`, `LATTICE` set to `"ladder"`, and `J` replaced by `J0` and `J1` (both `-1`). +The script `tutorial2b.py` is a copy of `tutorial2a.py` with three changes: the prefix renamed to `parm2b`, `LATTICE` set to `"ladder"`, and `J` replaced by `J0` and `J1` (both `-1`). ## Quantum Heisenberg models @@ -162,7 +162,7 @@ The key parameter changes from the classical case are: #### Setting up and running on the command line -Download `parm2c`: +Download `parm2c`: ``` LATTICE="chain lattice" @@ -200,7 +200,7 @@ loop parm2c.in.xml #### Setting up and running in Python -The script `tutorial2c.py` adapts `tutorial2a.py` to the quantum parameters and calls `loop` instead of `spinmc`: +The script `tutorial2c.py` adapts `tutorial2a.py` to the quantum parameters and calls `loop` instead of `spinmc`: ```Python input_file = pyalps.writeInputFiles('parm2c', parms) @@ -214,7 +214,7 @@ Unlike the gapless chain, the two-leg antiferromagnetic Heisenberg ladder has a #### Setting up and running on the command line -Download `parm2d`: +Download `parm2d`: ``` LATTICE="ladder" @@ -248,11 +248,11 @@ loop parm2d.in.xml #### Setting up and running in Python -The script `tutorial2d.py` adapts `tutorial2c.py`: rename the prefix to `parm2d`, change `LATTICE` to `"ladder"`, and replace `J` with `J0` and `J1` (both `1`). +The script `tutorial2d.py` adapts `tutorial2c.py`: rename the prefix to `parm2d`, change `LATTICE` to `"ladder"`, and replace `J` with `J0` and `J1` (both `1`). ## Combining all four simulations -After running all four simulations in the same folder, the script `tutorial2full.py` loads all results together and overlays them on a single plot. +After running all four simulations in the same folder, the script `tutorial2full.py` loads all results together and overlays them on a single plot. ```Python import pyalps diff --git a/content/zh-cn/tutorials/mcs/mc03.md b/content/zh-cn/tutorials/mcs/mc03.md index 191169b9..b374abc3 100644 --- a/content/zh-cn/tutorials/mcs/mc03.md +++ b/content/zh-cn/tutorials/mcs/mc03.md @@ -14,7 +14,7 @@ In this tutorial we will look at magnetization curves of quantum spin models usi #### Preparing and running the simulation from the command line -The parameter file `parm3a` sets up Monte Carlo simulations of the quantum mechanical S=1/2 Heisenberg model on a one-dimensional chain with 20 sites at fixed temperature T=0.08 for a couple of magnetic fields (h=0, 0.1, ..., 2.5). +The parameter file `parm3a` sets up Monte Carlo simulations of the quantum mechanical S=1/2 Heisenberg model on a one-dimensional chain with 20 sites at fixed temperature T=0.08 for a couple of magnetic fields (h=0, 0.1, ..., 2.5). ```Python LATTICE="chain lattice" @@ -55,7 +55,7 @@ dirloop_sse --Tmin 10 --write-xml parm3a.in.xml #### Preparing and running the simulation using Python -Setting up and running the simulation in Python is as before, with the script `tutorial3a.py`: +Setting up and running the simulation in Python is as before, with the script `tutorial3a.py`: ```Python import pyalps @@ -107,7 +107,7 @@ plt.show() ### One-dimensional Heisenberg ladder in a magnetic field -The parameter file `parm3b` sets up Monte Carlo simulations of the quantum mechanical S=1/2 Heisenberg model on a one-dimensional ladder with 40 sites at fixed temperature T=0.08 for a couple of magnetic fields (h=0, 0.1, ..., 3.5). +The parameter file `parm3b` sets up Monte Carlo simulations of the quantum mechanical S=1/2 Heisenberg model on a one-dimensional ladder with 40 sites at fixed temperature T=0.08 for a couple of magnetic fields (h=0, 0.1, ..., 3.5). ```Python LATTICE="ladder" @@ -119,11 +119,11 @@ J1=1 T=0.08 ``` -The rest of the input file is as above and simulations are run in the same way. The corresponding script is downloadable here. +The rest of the input file is as above and simulations are run in the same way. The corresponding script is downloadable here. ### Combining all simulations -The procedure to combine all results into one plot after running both simulations is extremely similar to the previous tutorial. The script is downloadable here. Here is the combined plot: +The procedure to combine all results into one plot after running both simulations is extremely similar to the previous tutorial. The script is downloadable here. Here is the combined plot: ![](/figs/mcs03mvsh.png) diff --git a/content/zh-cn/tutorials/mcs/mc04.md b/content/zh-cn/tutorials/mcs/mc04.md index 4d6dbe8a..148b69eb 100644 --- a/content/zh-cn/tutorials/mcs/mc04.md +++ b/content/zh-cn/tutorials/mcs/mc04.md @@ -14,7 +14,7 @@ In this tutorial, we will measure correlation functions with the directed loop a #### Preparing and running the simulation from the command line -The parameter file `parm4` sets up Monte Carlo simulations of the quantum mechanical S=1/2 Heisenberg model on a square lattice, and enables various measurement options: +The parameter file `parm4` sets up Monte Carlo simulations of the quantum mechanical S=1/2 Heisenberg model on a square lattice, and enables various measurement options: ``` MODEL="spin"; @@ -41,7 +41,7 @@ dirloop_sse --Tmin 10 --write-xml parm4.in.xml #### Preparing and running the simulation using Python -To set up and run the simulation in Python we use the script `tutorial4.py`: +To set up and run the simulation in Python we use the script `tutorial4.py`: ``` import pyalps diff --git a/content/zh-cn/tutorials/mcs/mc05.md b/content/zh-cn/tutorials/mcs/mc05.md index 79f4a8a3..6fb34b1e 100644 --- a/content/zh-cn/tutorials/mcs/mc05.md +++ b/content/zh-cn/tutorials/mcs/mc05.md @@ -14,7 +14,7 @@ As an example of the worm QMC code, we will study a quantum phase transition in #### Preparing and running the simulation from the command line -The parameter file `parm5a` with the following contents sets up Monte Carlo simulations of the quantum Bose Hubbard model on a square lattice with 4x4 sites for a couple of hopping parameters (t=0.01, 0.02, ..., 0.1) using the worm code. +The parameter file `parm5a` with the following contents sets up Monte Carlo simulations of the quantum Bose Hubbard model on a square lattice with 4x4 sites for a couple of hopping parameters (t=0.01, 0.02, ..., 0.1) using the worm code. ``` LATTICE="square lattice"; @@ -39,7 +39,7 @@ THERMALIZATION=10000; { t=0.1; } ``` -The corresponding Python script is found at `tutorial5a.py`. +The corresponding Python script is found at `tutorial5a.py`. #### Evaluating the simulation and preparing plots using Python @@ -70,7 +70,7 @@ We next want to pin down the location of the phase transition more accurately. F #### Preparing and running the simulation from the command line -In the parameter file `parm5b` we focus on the region around the critical point for three system sizes L=4, 6, and 8: +In the parameter file `parm5b` we focus on the region around the critical point for three system sizes L=4, 6, and 8: ``` LATTICE="square lattice"; @@ -105,7 +105,7 @@ THERMALIZATION=150000; { L=8; t=0.065; } ``` -The corresponding Python script is found at `tutorial5b.py`. +The corresponding Python script is found at `tutorial5b.py`. #### Evaluating the simulation using Python diff --git a/content/zh-cn/tutorials/mcs/mc06.md b/content/zh-cn/tutorials/mcs/mc06.md index cca44f63..50d7601b 100644 --- a/content/zh-cn/tutorials/mcs/mc06.md +++ b/content/zh-cn/tutorials/mcs/mc06.md @@ -16,7 +16,7 @@ We will start with a quick tutorial on using the ALPS qwl code for a spin chain. #### Using the command line -The parameter file `parm6a` sets up a Monte Carlo simulation of the quantum mechanical Heisenberg ferromagnet on a one-dimensional chain with 40 sites, using the quantum Wang-Landau (QWL) method. +The parameter file `parm6a` sets up a Monte Carlo simulation of the quantum mechanical Heisenberg ferromagnet on a one-dimensional chain with 40 sites, using the quantum Wang-Landau (QWL) method. ``` LATTICE="chain lattice" @@ -70,7 +70,7 @@ Similarly the tool `plot2gp` produces Gnuplot scripts and `plot2text` converts t #### Using Python -To set up and run the simulation in Python we use the script `tutorial6a.py`, which imports modules, prepares the parameters, and runs the simulation as usual. Then, it runs the evaluation program on all output files +To set up and run the simulation in Python we use the script `tutorial6a.py`, which imports modules, prepares the parameters, and runs the simulation as usual. Then, it runs the evaluation program on all output files ``` data = pyalps.evaluateQWL(pyalps.getResultFiles(prefix='parm6a'),DELTA_T=0.1, T_MIN=0.1, T_MAX=10.0) @@ -88,7 +88,7 @@ for s in pyalps.flatten(data): ### The antiferromagnetic Heisenberg chain -To simulate the antiferromagnetic chain, we prepare new simulations setting J=1 instead of J=-1. The parameters should be in `parm6b`, the Python script in `tutorial6b.py`. +To simulate the antiferromagnetic chain, we prepare new simulations setting J=1 instead of J=-1. The parameters should be in `parm6b`, the Python script in `tutorial6b.py`. #### Questions @@ -102,7 +102,7 @@ To simulate the antiferromagnetic chain, we prepare new simulations setting J=1 ### Simulating the 3D quantum Heisenberg antiferromegnet -The parameter file `parm6c` should set up a Monte Carlo simulation of the quantum mechanical Heisenberg antiferromagnet on a three-dimensional simple cubic lattice with $4^3$ sites, using the QWL method. The Python script should be `tutorial6c.py`. +The parameter file `parm6c` should set up a Monte Carlo simulation of the quantum mechanical Heisenberg antiferromagnet on a three-dimensional simple cubic lattice with $4^3$ sites, using the QWL method. The Python script should be `tutorial6c.py`. The simulations are set up and run as above. #### Questions @@ -112,7 +112,7 @@ The simulations are set up and run as above. ### Finite size scaling analysis to determine the critical point -Finite size scaling theory predics the staggered structure factor $S(L)$ for this transition to scale at the critical point as $L^{2-\eta}$, where $\eta\approx 0.034$. A scaling plot of $S(L)/L^{2-\eta}$ vs. temperature is expected to show a crossing of curves for different linear system sizes L at the critical temperature $T_c$. In order to produce such a scaling plot, we set up a further simulation of the cubic antiferromagnet, for a larger system with $L=4$ and a cutoff at 1000, in the parameter file `parm6d` or the Python script `tutorial6d.py`. +Finite size scaling theory predics the staggered structure factor $S(L)$ for this transition to scale at the critical point as $L^{2-\eta}$, where $\eta\approx 0.034$. A scaling plot of $S(L)/L^{2-\eta}$ vs. temperature is expected to show a crossing of curves for different linear system sizes L at the critical temperature $T_c$. In order to produce such a scaling plot, we set up a further simulation of the cubic antiferromagnet, for a larger system with $L=4$ and a cutoff at 1000, in the parameter file `parm6d` or the Python script `tutorial6d.py`. Evaluation now requires multiplication of the results with $L^{2-\eta}$ which is easiest done in Python. After running the simulation we first load the results: ``` diff --git a/content/zh-cn/tutorials/mcs/mc07.md b/content/zh-cn/tutorials/mcs/mc07.md index d6848798..63f895cf 100644 --- a/content/zh-cn/tutorials/mcs/mc07.md +++ b/content/zh-cn/tutorials/mcs/mc07.md @@ -12,14 +12,14 @@ The goal of this tutorial is to learn how to detect a second-order phase transit Almost everything is known about the phase transition in the 2d Ising model since it is exactly solvable. In this tutotial, we will try to recover the location of the critical point, as well as critical exponents as if we would not know them in order to illustrate the methods. To make precise estimations requires quite some time. For this let us start the final simulation parameters in the background while doing the first part of the tutorial. -You can start the second simulation in the background with the parameter file `parm7b` and type: +You can start the second simulation in the background with the parameter file `parm7b` and type: ``` parameter2xml parm7b spinmc --Tmin 10 parm7b.in.xml & ``` -or run the first part of `tutorial7b.py`: +or run the first part of `tutorial7b.py`: ``` import pyalps @@ -59,14 +59,14 @@ pyalps.runApplication('spinmc',input_file,Tmin=5) ## Locate roughly the phase transition -First, we make a rough temperature scan on small systems, in order to locate roughly the critical range. We use the parameter file `parm7a` and the command +First, we make a rough temperature scan on small systems, in order to locate roughly the critical range. We use the parameter file `parm7a` and the command ``` parameter2xml parm7a spinmc --Tmin 5 parm7a.in.xml ``` -Alternatively, we can run the simulations in Python with the file `tutorial7a.py`: +Alternatively, we can run the simulations in Python with the file `tutorial7a.py`: ``` import pyalps diff --git a/content/zh-cn/tutorials/mcs/mc08.md b/content/zh-cn/tutorials/mcs/mc08.md index 9289a8e7..caa8a66a 100644 --- a/content/zh-cn/tutorials/mcs/mc08.md +++ b/content/zh-cn/tutorials/mcs/mc08.md @@ -12,14 +12,14 @@ In this tutorial we will learn how to detect quantum critical points in a quantu First of all, we consider the two simple limits of decoupled ladders ($J_2=0$) and of the isotropic square lattice ($J_2=1$). The decoupled ladders have a ground-state with short-range correlations and exhibit a finite spin gap: this is a spin liquid phase. On the other hand, the square lattice displays long-range order with a finite staggered magnetization: this is an antiferromagnetic Néel phase. -A simple and illustrative way of probing these two different physics is by looking at the magnetic susceptibility $\chi$. Let us simulate an 8x8 system using the following set of temperatures in the two different cases. Plot and compare the magnetic susceptibility in both the decoupled ($J_2=0$) and isotropic ($J_2=1$) situations. For decoupled ladders, the susceptibility exhibits an activated behaviour at low temperature due to the presence of the spin gap, whereas on the square lattice the susceptibility tends to a constant at low T. Please note that on a finite system, $\chi$ will always eventually tend to zero at small enough temperature due to the presence of a finite-size gap - this is however not our topic of interest here. You can run the simulation on the command line using a parameter file `parm8a`: +A simple and illustrative way of probing these two different physics is by looking at the magnetic susceptibility $\chi$. Let us simulate an 8x8 system using the following set of temperatures in the two different cases. Plot and compare the magnetic susceptibility in both the decoupled ($J_2=0$) and isotropic ($J_2=1$) situations. For decoupled ladders, the susceptibility exhibits an activated behaviour at low temperature due to the presence of the spin gap, whereas on the square lattice the susceptibility tends to a constant at low T. Please note that on a finite system, $\chi$ will always eventually tend to zero at small enough temperature due to the presence of a finite-size gap - this is however not our topic of interest here. You can run the simulation on the command line using a parameter file `parm8a`: ``` parameter2xml parm8a loop parm8a.in.xml ``` -or by creating a python script `tutorial8a.py`. +or by creating a python script `tutorial8a.py`. ```Python import pyalps @@ -92,7 +92,7 @@ plt.show() ## Locate the phase transition -Having identified two different phases at $J_2=0$ and $J_2=1$, there must be (at least) one quantum phase transition separating them. We scan the coupling range $J_2 \in [0.2,0.4]$ for system sizes $L=8,10,12,16$ and simulate the model at an inverse temperate $\beta=2L$ using the parameter-file `parm8b` or the python script `tutorial8b.py`: +Having identified two different phases at $J_2=0$ and $J_2=1$, there must be (at least) one quantum phase transition separating them. We scan the coupling range $J_2 \in [0.2,0.4]$ for system sizes $L=8,10,12,16$ and simulate the model at an inverse temperate $\beta=2L$ using the parameter-file `parm8b` or the python script `tutorial8b.py`: ```python import pyalps @@ -170,7 +170,7 @@ Second, why did we choose inverse temperature $\beta$ to be proportionnal to $L$ You have obtained a rough estimate of the quantum critical point $J_2^c$. As in the classical case, extracting the critical exponents require more work and in particular a more precise determination of $J_2^c$. -We will obtain one by considering larger system sizes on a finer grid of $J_2^c$. The parameters for this should be specified in `parm8d` and the script in `tutorial8d.py`. Please note that these simulations will take quite some CPU time and we therefore leave it to you as an exercise. Plot again the Binder cumulant of the staggered magnetization $U_4$ as well as the stiffness multiplied by system size $\rho_s L$ for different system sizes. The crossings of these curves should allow a more precise estimate of $J_2^c$. To obtain the critical exponent $\nu$ related to the divergence of the correlation length, it is useful to consider the scaling with system size of the derivative (with respect to $J_2^c$) of these quantities, when taken precisely at $J_2^c$. These derivatives $\frac{dU_4}{d J_2}$ and $L \frac{d\rho_s}{d J_2}$ can be obtained in principle as a Monte Carlo measurement, however for this tutorial, it is sufficient to perform a numerical differentiation which is possible thanks to the fine grid in $J_2$. +We will obtain one by considering larger system sizes on a finer grid of $J_2^c$. The parameters for this should be specified in `parm8d` and the script in `tutorial8d.py`. Please note that these simulations will take quite some CPU time and we therefore leave it to you as an exercise. Plot again the Binder cumulant of the staggered magnetization $U_4$ as well as the stiffness multiplied by system size $\rho_s L$ for different system sizes. The crossings of these curves should allow a more precise estimate of $J_2^c$. To obtain the critical exponent $\nu$ related to the divergence of the correlation length, it is useful to consider the scaling with system size of the derivative (with respect to $J_2^c$) of these quantities, when taken precisely at $J_2^c$. These derivatives $\frac{dU_4}{d J_2}$ and $L \frac{d\rho_s}{d J_2}$ can be obtained in principle as a Monte Carlo measurement, however for this tutorial, it is sufficient to perform a numerical differentiation which is possible thanks to the fine grid in $J_2$. Perform the numerical differentiations for the different system sizes for both quantities, and plot their values at $J_2^c$ as a function of system size. Data should scale as a power law : $\frac{dU_4}{d J_2}(J_2^c) \propto L \frac{d\rho_s}{d J_2}(J_2^c) \propto L^{1/\nu}$. Which value of $\nu$ do you obtain? From 3ed433ba9da982dd11bf33298f67742f41fc08da Mon Sep 17 00:00:00 2001 From: Marcus Rosales Date: Wed, 12 Aug 2026 13:44:02 -0400 Subject: [PATCH 4/4] MC-01a: put the download link on `parm1a` The link sat on the words "downloadable file" while the filename it saves, `parm1a`, sat unlinked right after it. Move the anchor onto `parm1a` so the clickable text names the file the reader gets. This was the only download link in the MCS series whose text was not the filename; all 46 now match. Co-Authored-By: Claude Opus 5 --- content/en/tutorials/mcs/mc01a.md | 2 +- content/ja/tutorials/mcs/mc01a.md | 2 +- content/zh-cn/tutorials/mcs/mc01a.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/content/en/tutorials/mcs/mc01a.md b/content/en/tutorials/mcs/mc01a.md index edc353ee..8f2079b4 100644 --- a/content/en/tutorials/mcs/mc01a.md +++ b/content/en/tutorials/mcs/mc01a.md @@ -23,7 +23,7 @@ This tutorial can be run either on the command line or in Python. We recommend t ### Setting up and running the simulation on the command line -To set up and run the simulation on the command line, we first create a parameter file that specifies the parameters of the simulation(s). The downloadable file will be titled `parm1a`, with the following contents: +To set up and run the simulation on the command line, we first create a parameter file that specifies the parameters of the simulation(s). The downloadable file will be titled `parm1a`, with the following contents: ``` LATTICE="square lattice" diff --git a/content/ja/tutorials/mcs/mc01a.md b/content/ja/tutorials/mcs/mc01a.md index 462fdc49..9c016b62 100644 --- a/content/ja/tutorials/mcs/mc01a.md +++ b/content/ja/tutorials/mcs/mc01a.md @@ -23,7 +23,7 @@ This tutorial can be run either on the command line or in Python. We recommend t ### Setting up and running the simulation on the command line -To set up and run the simulation on the command line, we first create a parameter file that specifies the parameters of the simulation(s). The downloadable file will be titled `parm1a`, with the following contents: +To set up and run the simulation on the command line, we first create a parameter file that specifies the parameters of the simulation(s). The downloadable file will be titled `parm1a`, with the following contents: ``` LATTICE="square lattice" diff --git a/content/zh-cn/tutorials/mcs/mc01a.md b/content/zh-cn/tutorials/mcs/mc01a.md index 462fdc49..9c016b62 100644 --- a/content/zh-cn/tutorials/mcs/mc01a.md +++ b/content/zh-cn/tutorials/mcs/mc01a.md @@ -23,7 +23,7 @@ This tutorial can be run either on the command line or in Python. We recommend t ### Setting up and running the simulation on the command line -To set up and run the simulation on the command line, we first create a parameter file that specifies the parameters of the simulation(s). The downloadable file will be titled `parm1a`, with the following contents: +To set up and run the simulation on the command line, we first create a parameter file that specifies the parameters of the simulation(s). The downloadable file will be titled `parm1a`, with the following contents: ``` LATTICE="square lattice"