Lab fenòmens: afegir informe i ultims canvis al codi
Change-Id: I7f01665996295625fc390f9382dd0ba1c9882bbc
diff --git a/quad10/fenomens/lab/p4/graphs/dependenciaEnL.gnu b/quad10/fenomens/lab/p4/graphs/dependenciaEnL.gnu
index a1a1ae8..8c04f2c 100755
--- a/quad10/fenomens/lab/p4/graphs/dependenciaEnL.gnu
+++ b/quad10/fenomens/lab/p4/graphs/dependenciaEnL.gnu
@@ -1,104 +1,352 @@
#!/usr/bin/env -S gnuplot -c
-outputfile = 'data_out/dep_en_L_graphs/' # Nom de la imatge resultant (sense extensió)
-datafilepre = 'data_out/dep_en_L/tmpdata/'
+outputfile = ''
+datafilepre = '../dep_en_L/tmpdata/'
datafilepost = '.dat'
LS = ARG1
-svgTerminal = "set terminal svg dashed size 800, 800 font \"Computer Modern,Tinos,Helvetica,15\"; pointSize=0.5"
+SPECIAL_L = 32
+ZOOMEDIN = 1 # Whether we want to include zoomed in graphs (1) or not (0)
+USEHACK = 1 # In theory, due to the defaults of run.bash, SUI = 1900*150. But for L=96, we used other values, so setting USEHACK=1 gives a different value for SUMI(96).
+
+# COMPORTAMENT CRÍTIC (extret de l'anàlisi fet a l'informe):
+TC = 2.268
+BETA = 0.13
+GAMMA = 1.77
+
+# All LS except for 96, since it's low quality data.
+PartialLS = system('LS="'. LS .'"; PartialLS=""; for L in $LS; do if [ $L -ne 96 ]; then PartialLS+="$L "; fi; done; echo $PartialLS')
+
+TERMINALS = "svg png tex"
+
+svgTerminal = "set terminal svg size 800, 800 font \"Computer Modern,Tinos,Helvetica,15\"; pointSize=0.5"
pngTerminal = "set terminal pngcairo size 800, 800 font \"Computer Modern,Tinos,Helvetica,15\"; pointSize=0.7"
+texTerminal = "set terminal cairolatex size 8.5cm, 8.5cm; pointSize=0.7"
graphStyle = "with linespoints pointsize pointSize"
+SUMI(L) = (USEHACK ? (L == 96 ? 1400*16 : 1900*150) : 1900*150)
+suffix(CHOOSEL) = (CHOOSEL == 0 ? '_ALLL' : (CHOOSEL == 1 ? '' : '_L' . SPECIAL_L))
+
set style line 101 lc rgb '#808080' lt 1 lw 1
set border 3 front ls 101
set tics nomirror out scale 0.75
-set style line 102 lc rgb '#d6d7d9' lt 0 lw 1
+set linetype 99963 dashtype (6, 0, 0, 10)
+set style line 102 lc rgb '#d6d7d9' lt 99963 lw 1
set grid back ls 102
-set xlabel "Temperatura (K)"
+set xlabel "T"
set yrange [*<0:0<*]
# ------------------------------------
# Gràfica per la capacitat calorífica:
# ------------------------------------
-set title "Capacitat calorífica per diferents valors d'L"
+set title ""
-@svgTerminal
-set output outputfile.'capacitat_calorifica.svg'
-plot for [L in LS] datafilepre . L . datafilepost using 2:10 @graphStyle title "L = ".L
+# CHOOSEL can be:
+# - 0: all Ls will be drawn
+# - 1: all Ls except for 96 will be drawn
+# - 2: only L=32 will be drawn
+do for [CHOOSEL = 0:2] {
+ do for [TERM in TERMINALS] {
+ if (TERM eq "tex") {
+ @texTerminal
+ set ylabel '$c_V$'
+ title_1 = '$\frac{\text{Var}(e)}{T^2}$'
+ title_1alt = 'L = %d'
+ title_2 = '$\frac{d\langle e \rangle}{dT}$'
+ set key spacing 2
+ } else {
+ set ylabel 'Capacitat calorífica'
+ title_1 = 'Var(e)/T^2'
+ title_1alt = 'L = %d'
+ title_2 = 'd<e>/dT'
+ set key spacing 1.25
+ if (TERM eq "png") {
+ @pngTerminal
+ } else {
+ @svgTerminal
+ }
+ }
-@pngTerminal
-set output outputfile.'capacitat_calorifica.png'
-replot
+ set output outputfile.'capacitat_calorifica'.suffix(CHOOSEL).'.'.TERM
+ set yrange [*<0:0<*]
+
+ if (CHOOSEL == 0) {
+ set yrange [0:2.6]
+ plot for [L in LS] datafilepre . L . datafilepost using 2:10 @graphStyle title sprintf(title_1alt, L+0)
+ } else {
+ if (CHOOSEL == 1) {
+ plot for [L in PartialLS] datafilepre . L . datafilepost using 2:10 @graphStyle title sprintf(title_1alt, L+0)
+ } else {
+ plot datafilepre . SPECIAL_L . datafilepost using 2:10 @graphStyle title sprintf(title_1, SPECIAL_L), \
+ datafilepre . SPECIAL_L . '_derivada_E' .datafilepost using 1:($2/(SPECIAL_L**2)) with points pointsize 1.2*pointSize title sprintf(title_2, SPECIAL_L)
+ }
+ }
+ }
+}
+
+set yrange [*<0:0<*]
+set ylabel ""
# ----------------------------------------
# Gràfica per la susceptibilitat magnètica
# ----------------------------------------
-set title "Susceptibilitat magnètica per diferents valors d'L"
+set title ""
+
+# CHOOSEL can be:
+# - 0: all Ls will be drawn
+# - 1: all Ls except for 96 will be drawn
+# - 2: only L=32 will be drawn
+do for [CHOOSEL = 0:3] {
+ set ylabel 'Susceptibilitat magnètica'
+
+ @svgTerminal
+ set output outputfile.'susceptibilitat_magnetica'. suffix(CHOOSEL) .'.svg'
+ if (CHOOSEL == 0) {
+ set yrange [0:175]
+ plot for [L in LS] datafilepre . L . datafilepost using 2:11 @graphStyle title "L = ".L
+ } else {
+ if (CHOOSEL == 1) {
+ set yrange [0:75]
+ plot for [L in PartialLS] datafilepre . L . datafilepost using 2:11 @graphStyle title "L = ".L
+ } else {
+ set yrange [0:22]
+ plot datafilepre . SPECIAL_L . datafilepost using 2:11 @graphStyle lc 3 title '$\chi$'
+ }
+ }
+
+ @pngTerminal
+ set output outputfile.'susceptibilitat_magnetica'. suffix(CHOOSEL) .'.png'
+ replot
+
+ @texTerminal
+ set ylabel '$\chi$'
+ set output outputfile.'susceptibilitat_magnetica'. suffix(CHOOSEL) .'.tex'
+ replot
+}
+
+set yrange [*<0:0<*]
+
+# --------------------------------------------------------------
+# Gràfica per la susceptibilitat magnètica (finite size scaling)
+# --------------------------------------------------------------
+set title ""
+
+set xlabel 'L^{1/\nu} t'
+set ylabel '\chi/(L^{\gamma/\nu})'
+
+set key spacing 1.25
@svgTerminal
-set output outputfile.'susceptibilitat_magnetica.svg'
-plot for [L in LS] datafilepre . L . datafilepost using 2:11 @graphStyle title "L = ".L
+set output outputfile.'susceptibilitat_magnetica_fss.svg'
+plot for [L in PartialLS] datafilepre . L . datafilepost using (L*($2 - TC)/TC):($11/(L**GAMMA)) @graphStyle title "L = ".L
@pngTerminal
-set output outputfile.'susceptibilitat_magnetica.png'
+set output outputfile.'susceptibilitat_magnetica_fss.png'
replot
+@texTerminal
+set xlabel '$L^{1/\nu} t$'
+set ylabel '$\chi/L^{\gamma/\nu}$'
+set key spacing 1.66
+set output outputfile.'susceptibilitat_magnetica_fss.tex'
+replot
+
+set key spacing 1.25
+set xlabel 'T'
+
# ---------------------
# Gràfica per l'energia
# ---------------------
-do for [IDX = 0:1] {
- if (IDX == 0) {
- @svgTerminal
- set output outputfile.'energia.svg'
- } else {
- @pngTerminal
- set output outputfile.'energia.png'
+
+# CHOOSEL can be:
+# - 0: all Ls will be drawn
+# - 1: all Ls except for 96 will be drawn
+# - 2: only L=32 will be drawn
+do for [CHOOSEL = 0:2] {
+ do for [TERM in TERMINALS] {
+ if (TERM eq "tex") {
+ @texTerminal
+ title_l = 'L = %d'
+ title_e = '$\langle e \rangle$'
+ title_sqrtee = '$-\sqrt{\langle e^2 \rangle}$'
+ set key spacing 1.66
+ } else {
+ title_l = 'L = %d'
+ title_e = '<e>'
+ title_sqrtee = '-sqrt(<e^2>)'
+ set key spacing 1.25
+ if (TERM eq "png") {
+ @pngTerminal
+ } else {
+ @svgTerminal
+ }
+ }
+ set output outputfile.'energia'.suffix(CHOOSEL).'.'.TERM
+
+ set origin 0, 0
+ set size 1, 1
+ set xtics auto
+ set ytics auto
+
+ if (ZOOMEDIN = 1) {
+ set multiplot
+ }
+
+ unset object 1
+
+ set title ""
+ set xlabel "T"
+ if (TERM eq "tex" && CHOOSEL != 2) {
+ set ylabel '$\langle e \rangle$'
+ } else {
+ set ylabel "Energia per partícula"
+ }
+ set key bottom right
+ set key noopaque
+ set autoscale x
+ set yrange [*<0:0<*]
+
+ if (TERM eq "tex") {
+ set ytics 0.5
+ }
+
+ if (CHOOSEL == 0) {
+ plot for [L in LS] datafilepre . L . datafilepost using 2:($3/(L**2)) @graphStyle title sprintf(title_l, L+0)
+ } else {
+ if (CHOOSEL == 1) {
+ plot for [L in PartialLS] datafilepre . L . datafilepost using 2:($3/(L**2)) @graphStyle title sprintf(title_l, L+0)
+ } else {
+ plot datafilepre . SPECIAL_L . datafilepost using 2:($3/(SPECIAL_L**2)) @graphStyle title sprintf(title_e, SPECIAL_L), \
+ datafilepre . SPECIAL_L . datafilepost using 2:(-sqrt($4)/(SPECIAL_L**2)) @graphStyle title sprintf(title_sqrtee, SPECIAL_L)
+ }
+ }
+
+ if (ZOOMEDIN = 1) {
+ if (TERM eq "tex") {
+ set origin 0.175, 0.575
+ } else {
+ set origin 0.1, 0.525
+ }
+ set size 0.6, 0.4
+ set title ""
+ set xlabel ""
+ set ylabel ""
+ set key off
+ if (CHOOSEL != 2) {
+ set xrange [2.3:2.36]
+ set yrange [-1.5:-1.2]
+ if (TERM eq "tex") {
+ set xtics 0.03
+ set ytics 0.15
+ }
+ } else {
+ set xrange [2.35:2.4]
+ set yrange [-1.3:-1.2]
+ set xtics 0.025
+ if (TERM eq "tex") {
+ set ytics 0.05
+ }
+ }
+ set object 1 rectangle from graph 0,0 to graph 1,1 behind fillcolor rgb 'white' fillstyle solid noborder
+ replot
+
+ unset multiplot
+ }
}
-
- set multiplot
-
- set origin 0, 0
- set size 1, 1
- set title "Energia per diferents valors de L"
- set xlabel "Temperatura (K)"
- set key bottom right
- set key noopaque
- set autoscale x
- set yrange [*<0:0<*]
- unset object 1
- plot for [L in LS] datafilepre . L . datafilepost using 2:($3/(L**2)) @graphStyle title "<E>/N, L = ".L, \
- for [L in LS] datafilepre . L . datafilepost using 2:(-sqrt($4)/(L**2)) @graphStyle title "-sqrt(<E^2>)/N, L = ".L
-
- set origin 0.1, 0.525
- set size 0.6, 0.4
- set title ""
- set xlabel ""
- set key off
- set xrange [2.25:2.5]
- set yrange [-1.6:-1.1]
- set object 1 rectangle from graph 0,0 to graph 1,1 behind fillcolor rgb 'white' fillstyle solid noborder
- replot
-
- unset multiplot
}
+set key spacing 1.25
set origin 0, 0
set size 1, 1
set autoscale x
set yrange [*<0:0<*]
-set xlabel "Temperatura (K)"
+set xlabel "T"
+set ylabel ""
+set xtics auto
+set ytics auto
unset object 1
# ----------------------------
# Gràfica per la magnetització
# ----------------------------
-set title "Magnetització per diferents valors d'L"
+set title ""
-@svgTerminal
-set output outputfile.'magnetitzacio.svg'
-set key top right
-plot for [L in LS] datafilepre . L . datafilepost using 2:($7/(L**2)) @graphStyle title "<|M|>/N, L = ".L, \
- for [L in LS] datafilepre . L . datafilepost using 2:(sqrt($8)/(L**2)) @graphStyle title "sqrt(<M^2>)/N, L = ".L
+# CHOOSEL can be:
+# - 0: all Ls will be drawn
+# - 1: all Ls except for 96 will be drawn
+# - 2: only L=32 will be drawn
+do for [CHOOSEL = 0:2] {
+ do for [TERM in TERMINALS] {
+ if (TERM eq "tex") {
+ @texTerminal
+ title_m = '$\langle |m| \rangle$'
+ title_malt = '$L = %d$'
+ title_sqrtmm = '$\sqrt{\langle m^2 \rangle}$'
+ if (CHOOSEL == 2) {
+ set key spacing 2
+ } else {
+ set key spacing 1.66
+ }
+ } else {
+ title_m = '<|m|>'
+ title_malt = 'L = %d'
+ title_sqrtmm = 'sqrt(<m^2>)'
+ set key spacing 1.25
+ if (TERM eq "png") {
+ @pngTerminal
+ } else {
+ @svgTerminal
+ }
+ }
-@pngTerminal
-set output outputfile.'magnetitzacio.png'
-replot
+ if (TERM eq "tex" && CHOOSEL != 2) {
+ set ylabel '$\langle |m| \rangle$'
+ } else {
+ set ylabel "Magnetització per partícula"
+ }
+
+ set output outputfile.'magnetitzacio'.suffix(CHOOSEL).'.'.TERM
+ set key top right
+ if (CHOOSEL == 0) {
+ plot for [L in LS] datafilepre . L . datafilepost using 2:($7/(L**2)) @graphStyle title sprintf(title_malt, L+0)
+ } else {
+ if (CHOOSEL == 1) {
+ plot for [L in PartialLS] datafilepre . L . datafilepost using 2:($7/(L**2)) @graphStyle title sprintf(title_malt, L+0)
+ } else {
+ plot datafilepre . SPECIAL_L . datafilepost using 2:($7/(SPECIAL_L**2)) @graphStyle title sprintf(title_m, SPECIAL_L), \
+ datafilepre . SPECIAL_L . datafilepost using 2:(sqrt($8)/(SPECIAL_L**2)) @graphStyle title sprintf(title_sqrtmm, SPECIAL_L)
+ }
+ }
+ }
+}
+
+# --------------------------------------------------
+# Gràfica per la magnetització (finite size scaling)
+# --------------------------------------------------
+set title ""
+set ylabel "Magnetització per partícula"
+
+# CHOOSEL can be:
+# - 0: all Ls will be drawn
+# - 1: all Ls except for 96 will be drawn
+# - 2: only L=32 will be drawn
+do for [TERM in TERMINALS] {
+ if (TERM eq "tex") {
+ @texTerminal
+ set xlabel '$L^{1/\nu} t$'
+ set ylabel '$\langle |m| \rangle L^{\beta/\nu}$'
+ set key spacing 1.66
+ } else {
+ set xlabel 'L^{1/\nu} t'
+ set ylabel '<|m|> L^{\beta/\nu}'
+ set key spacing 1.25
+ if (TERM eq "png") {
+ @pngTerminal
+ } else {
+ @svgTerminal
+ }
+ }
+
+ set output outputfile.'magnetitzacio_fss.'.TERM
+ set key top right
+ plot for [L in PartialLS] datafilepre . L . datafilepost using (L*($2 - TC)/TC):($7/(L**2)*(L**(BETA))) @graphStyle title sprintf('L = %s', L)
+}
diff --git a/quad10/fenomens/lab/p4/graphs/dependenciaEnSeed.gnu b/quad10/fenomens/lab/p4/graphs/dependenciaEnSeed.gnu
new file mode 100755
index 0000000..be9b69c
--- /dev/null
+++ b/quad10/fenomens/lab/p4/graphs/dependenciaEnSeed.gnu
@@ -0,0 +1,31 @@
+#!/usr/bin/env -S gnuplot -c
+outputfile = 'depEnSeed' # Nom de la imatge resultant (sense extensió)
+datafilepost = '.ev'
+L=32
+SEEDS = ARG1
+L = ARG2
+
+do for [IDX = 0:1] {
+ if (IDX == 0) {
+ set terminal cairolatex size 8.5cm, 11cm
+ set output outputfile.'.tex'
+ } else {
+ set terminal svg dashed size 600, 1200 font "Computer Modern,Tinos,Helvetica,15"
+ set output outputfile.'.svg'
+ }
+
+ set multiplot layout 2,1
+ set key outside top horizontal
+
+ set xlabel "Iteracions MC"
+ set ylabel '$\langle e \rangle$'
+ set yrange [-2:0]
+ plot for [S in SEEDS] S . datafilepost using 1:($2/(L*L)) with lines title sprintf('$S = %s$', S)
+
+ set xlabel "Iteracions MC"
+ set ylabel '$\langle m \rangle$'
+ set yrange [-1:1]
+ plot for [S in SEEDS] S . datafilepost using 1:($3/(L*L)) with lines title sprintf('$S = %s$', S)
+
+ unset multiplot
+}
diff --git a/quad10/fenomens/lab/p4/graphs/finalConfs.gnu b/quad10/fenomens/lab/p4/graphs/finalConfs.gnu
new file mode 100755
index 0000000..c83fa5f
--- /dev/null
+++ b/quad10/fenomens/lab/p4/graphs/finalConfs.gnu
@@ -0,0 +1,31 @@
+#!/usr/bin/env -S gnuplot -c
+outputfile = 'confs' # Nom de la imatge resultant (sense extensió)
+datafilepost = '.conf'
+TS = ARG1
+L = ARG2
+
+do for [IDX = 0:1] {
+ if (IDX == 0) {
+ set terminal cairolatex size 8.5cm, 13cm
+ set output outputfile.'.tex'
+ symbsize=0.18
+ } else {
+ set terminal svg dashed size 600, 1000 font "Computer Modern,Tinos,Helvetica,15"
+ set output outputfile.'.svg'
+ symbsize=0.3
+ }
+
+ set multiplot layout 3,2
+
+ do for [T in TS] {
+ set title "T = " . T
+ set size square
+ set xrange [0:L+1]
+ set yrange [0:L+1]
+ unset xtics
+ unset ytics
+ plot T . datafilepost using 1:2 with points pt 5 ps symbsize notitle
+ }
+
+ unset multiplot
+}