blob: 8c04f2c0626ea736886da8079dcb01821acfb4bf [file] [log] [blame]
#!/usr/bin/env -S gnuplot -c
outputfile = ''
datafilepre = '../dep_en_L/tmpdata/'
datafilepost = '.dat'
LS = ARG1
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 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 "T"
set yrange [*<0:0<*]
# ------------------------------------
# Gràfica per la capacitat calorífica:
# ------------------------------------
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: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
}
}
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 ""
# 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_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_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
# ---------------------
# 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 key spacing 1.25
set origin 0, 0
set size 1, 1
set autoscale x
set yrange [*<0:0<*]
set xlabel "T"
set ylabel ""
set xtics auto
set ytics auto
unset object 1
# ----------------------------
# Gràfica per la magnetització
# ----------------------------
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: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
}
}
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)
}