blob: 8c04f2c0626ea736886da8079dcb01821acfb4bf [file] [log] [blame]
avm9996345a8a462022-06-04 12:41:03 +02001#!/usr/bin/env -S gnuplot -c
Adrià Vilanova Martínez24d87012022-06-16 00:29:59 +02002outputfile = ''
3datafilepre = '../dep_en_L/tmpdata/'
avm9996345a8a462022-06-04 12:41:03 +02004datafilepost = '.dat'
Adrià Vilanova Martínezc102e962022-06-04 23:53:44 +02005LS = ARG1
avm9996345a8a462022-06-04 12:41:03 +02006
Adrià Vilanova Martínez24d87012022-06-16 00:29:59 +02007SPECIAL_L = 32
8ZOOMEDIN = 1 # Whether we want to include zoomed in graphs (1) or not (0)
9USEHACK = 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).
10
11# COMPORTAMENT CRÍTIC (extret de l'anàlisi fet a l'informe):
12TC = 2.268
13BETA = 0.13
14GAMMA = 1.77
15
16# All LS except for 96, since it's low quality data.
17PartialLS = system('LS="'. LS .'"; PartialLS=""; for L in $LS; do if [ $L -ne 96 ]; then PartialLS+="$L "; fi; done; echo $PartialLS')
18
19TERMINALS = "svg png tex"
20
21svgTerminal = "set terminal svg size 800, 800 font \"Computer Modern,Tinos,Helvetica,15\"; pointSize=0.5"
Adrià Vilanova Martínez5c444792022-06-07 18:17:00 +020022pngTerminal = "set terminal pngcairo size 800, 800 font \"Computer Modern,Tinos,Helvetica,15\"; pointSize=0.7"
Adrià Vilanova Martínez24d87012022-06-16 00:29:59 +020023texTerminal = "set terminal cairolatex size 8.5cm, 8.5cm; pointSize=0.7"
Adrià Vilanova Martínez5c444792022-06-07 18:17:00 +020024graphStyle = "with linespoints pointsize pointSize"
25
Adrià Vilanova Martínez24d87012022-06-16 00:29:59 +020026SUMI(L) = (USEHACK ? (L == 96 ? 1400*16 : 1900*150) : 1900*150)
27suffix(CHOOSEL) = (CHOOSEL == 0 ? '_ALLL' : (CHOOSEL == 1 ? '' : '_L' . SPECIAL_L))
28
Adrià Vilanova Martínez5c444792022-06-07 18:17:00 +020029set style line 101 lc rgb '#808080' lt 1 lw 1
30set border 3 front ls 101
31set tics nomirror out scale 0.75
Adrià Vilanova Martínez24d87012022-06-16 00:29:59 +020032set linetype 99963 dashtype (6, 0, 0, 10)
33set style line 102 lc rgb '#d6d7d9' lt 99963 lw 1
Adrià Vilanova Martínez5c444792022-06-07 18:17:00 +020034set grid back ls 102
avm9996345a8a462022-06-04 12:41:03 +020035
Adrià Vilanova Martínez24d87012022-06-16 00:29:59 +020036set xlabel "T"
Adrià Vilanova Martínezd2f8c712022-06-05 22:41:03 +020037set yrange [*<0:0<*]
38# ------------------------------------
39# Gràfica per la capacitat calorífica:
40# ------------------------------------
Adrià Vilanova Martínez24d87012022-06-16 00:29:59 +020041set title ""
Adrià Vilanova Martínezc102e962022-06-04 23:53:44 +020042
Adrià Vilanova Martínez24d87012022-06-16 00:29:59 +020043# CHOOSEL can be:
44# - 0: all Ls will be drawn
45# - 1: all Ls except for 96 will be drawn
46# - 2: only L=32 will be drawn
47do for [CHOOSEL = 0:2] {
48 do for [TERM in TERMINALS] {
49 if (TERM eq "tex") {
50 @texTerminal
51 set ylabel '$c_V$'
52 title_1 = '$\frac{\text{Var}(e)}{T^2}$'
53 title_1alt = 'L = %d'
54 title_2 = '$\frac{d\langle e \rangle}{dT}$'
55 set key spacing 2
56 } else {
57 set ylabel 'Capacitat calorífica'
58 title_1 = 'Var(e)/T^2'
59 title_1alt = 'L = %d'
60 title_2 = 'd<e>/dT'
61 set key spacing 1.25
62 if (TERM eq "png") {
63 @pngTerminal
64 } else {
65 @svgTerminal
66 }
67 }
Adrià Vilanova Martínezc102e962022-06-04 23:53:44 +020068
Adrià Vilanova Martínez24d87012022-06-16 00:29:59 +020069 set output outputfile.'capacitat_calorifica'.suffix(CHOOSEL).'.'.TERM
70 set yrange [*<0:0<*]
71
72 if (CHOOSEL == 0) {
73 set yrange [0:2.6]
74 plot for [L in LS] datafilepre . L . datafilepost using 2:10 @graphStyle title sprintf(title_1alt, L+0)
75 } else {
76 if (CHOOSEL == 1) {
77 plot for [L in PartialLS] datafilepre . L . datafilepost using 2:10 @graphStyle title sprintf(title_1alt, L+0)
78 } else {
79 plot datafilepre . SPECIAL_L . datafilepost using 2:10 @graphStyle title sprintf(title_1, SPECIAL_L), \
80 datafilepre . SPECIAL_L . '_derivada_E' .datafilepost using 1:($2/(SPECIAL_L**2)) with points pointsize 1.2*pointSize title sprintf(title_2, SPECIAL_L)
81 }
82 }
83 }
84}
85
86set yrange [*<0:0<*]
87set ylabel ""
Adrià Vilanova Martínezd2f8c712022-06-05 22:41:03 +020088
89# ----------------------------------------
90# Gràfica per la susceptibilitat magnètica
91# ----------------------------------------
Adrià Vilanova Martínez24d87012022-06-16 00:29:59 +020092set title ""
93
94# CHOOSEL can be:
95# - 0: all Ls will be drawn
96# - 1: all Ls except for 96 will be drawn
97# - 2: only L=32 will be drawn
98do for [CHOOSEL = 0:3] {
99 set ylabel 'Susceptibilitat magnètica'
100
101 @svgTerminal
102 set output outputfile.'susceptibilitat_magnetica'. suffix(CHOOSEL) .'.svg'
103 if (CHOOSEL == 0) {
104 set yrange [0:175]
105 plot for [L in LS] datafilepre . L . datafilepost using 2:11 @graphStyle title "L = ".L
106 } else {
107 if (CHOOSEL == 1) {
108 set yrange [0:75]
109 plot for [L in PartialLS] datafilepre . L . datafilepost using 2:11 @graphStyle title "L = ".L
110 } else {
111 set yrange [0:22]
112 plot datafilepre . SPECIAL_L . datafilepost using 2:11 @graphStyle lc 3 title '$\chi$'
113 }
114 }
115
116 @pngTerminal
117 set output outputfile.'susceptibilitat_magnetica'. suffix(CHOOSEL) .'.png'
118 replot
119
120 @texTerminal
121 set ylabel '$\chi$'
122 set output outputfile.'susceptibilitat_magnetica'. suffix(CHOOSEL) .'.tex'
123 replot
124}
125
126set yrange [*<0:0<*]
127
128# --------------------------------------------------------------
129# Gràfica per la susceptibilitat magnètica (finite size scaling)
130# --------------------------------------------------------------
131set title ""
132
133set xlabel 'L^{1/\nu} t'
134set ylabel '\chi/(L^{\gamma/\nu})'
135
136set key spacing 1.25
Adrià Vilanova Martínezd2f8c712022-06-05 22:41:03 +0200137
138@svgTerminal
Adrià Vilanova Martínez24d87012022-06-16 00:29:59 +0200139set output outputfile.'susceptibilitat_magnetica_fss.svg'
140plot for [L in PartialLS] datafilepre . L . datafilepost using (L*($2 - TC)/TC):($11/(L**GAMMA)) @graphStyle title "L = ".L
Adrià Vilanova Martínezd2f8c712022-06-05 22:41:03 +0200141
142@pngTerminal
Adrià Vilanova Martínez24d87012022-06-16 00:29:59 +0200143set output outputfile.'susceptibilitat_magnetica_fss.png'
Adrià Vilanova Martínezd2f8c712022-06-05 22:41:03 +0200144replot
145
Adrià Vilanova Martínez24d87012022-06-16 00:29:59 +0200146@texTerminal
147set xlabel '$L^{1/\nu} t$'
148set ylabel '$\chi/L^{\gamma/\nu}$'
149set key spacing 1.66
150set output outputfile.'susceptibilitat_magnetica_fss.tex'
151replot
152
153set key spacing 1.25
154set xlabel 'T'
155
Adrià Vilanova Martínezd2f8c712022-06-05 22:41:03 +0200156# ---------------------
157# Gràfica per l'energia
158# ---------------------
Adrià Vilanova Martínez24d87012022-06-16 00:29:59 +0200159
160# CHOOSEL can be:
161# - 0: all Ls will be drawn
162# - 1: all Ls except for 96 will be drawn
163# - 2: only L=32 will be drawn
164do for [CHOOSEL = 0:2] {
165 do for [TERM in TERMINALS] {
166 if (TERM eq "tex") {
167 @texTerminal
168 title_l = 'L = %d'
169 title_e = '$\langle e \rangle$'
170 title_sqrtee = '$-\sqrt{\langle e^2 \rangle}$'
171 set key spacing 1.66
172 } else {
173 title_l = 'L = %d'
174 title_e = '<e>'
175 title_sqrtee = '-sqrt(<e^2>)'
176 set key spacing 1.25
177 if (TERM eq "png") {
178 @pngTerminal
179 } else {
180 @svgTerminal
181 }
182 }
183 set output outputfile.'energia'.suffix(CHOOSEL).'.'.TERM
184
185 set origin 0, 0
186 set size 1, 1
187 set xtics auto
188 set ytics auto
189
190 if (ZOOMEDIN = 1) {
191 set multiplot
192 }
193
194 unset object 1
195
196 set title ""
197 set xlabel "T"
198 if (TERM eq "tex" && CHOOSEL != 2) {
199 set ylabel '$\langle e \rangle$'
200 } else {
201 set ylabel "Energia per partícula"
202 }
203 set key bottom right
204 set key noopaque
205 set autoscale x
206 set yrange [*<0:0<*]
207
208 if (TERM eq "tex") {
209 set ytics 0.5
210 }
211
212 if (CHOOSEL == 0) {
213 plot for [L in LS] datafilepre . L . datafilepost using 2:($3/(L**2)) @graphStyle title sprintf(title_l, L+0)
214 } else {
215 if (CHOOSEL == 1) {
216 plot for [L in PartialLS] datafilepre . L . datafilepost using 2:($3/(L**2)) @graphStyle title sprintf(title_l, L+0)
217 } else {
218 plot datafilepre . SPECIAL_L . datafilepost using 2:($3/(SPECIAL_L**2)) @graphStyle title sprintf(title_e, SPECIAL_L), \
219 datafilepre . SPECIAL_L . datafilepost using 2:(-sqrt($4)/(SPECIAL_L**2)) @graphStyle title sprintf(title_sqrtee, SPECIAL_L)
220 }
221 }
222
223 if (ZOOMEDIN = 1) {
224 if (TERM eq "tex") {
225 set origin 0.175, 0.575
226 } else {
227 set origin 0.1, 0.525
228 }
229 set size 0.6, 0.4
230 set title ""
231 set xlabel ""
232 set ylabel ""
233 set key off
234 if (CHOOSEL != 2) {
235 set xrange [2.3:2.36]
236 set yrange [-1.5:-1.2]
237 if (TERM eq "tex") {
238 set xtics 0.03
239 set ytics 0.15
240 }
241 } else {
242 set xrange [2.35:2.4]
243 set yrange [-1.3:-1.2]
244 set xtics 0.025
245 if (TERM eq "tex") {
246 set ytics 0.05
247 }
248 }
249 set object 1 rectangle from graph 0,0 to graph 1,1 behind fillcolor rgb 'white' fillstyle solid noborder
250 replot
251
252 unset multiplot
253 }
Adrià Vilanova Martínez5c444792022-06-07 18:17:00 +0200254 }
Adrià Vilanova Martínez5c444792022-06-07 18:17:00 +0200255}
256
Adrià Vilanova Martínez24d87012022-06-16 00:29:59 +0200257set key spacing 1.25
Adrià Vilanova Martínez5c444792022-06-07 18:17:00 +0200258set origin 0, 0
259set size 1, 1
260set autoscale x
261set yrange [*<0:0<*]
Adrià Vilanova Martínez24d87012022-06-16 00:29:59 +0200262set xlabel "T"
263set ylabel ""
264set xtics auto
265set ytics auto
Adrià Vilanova Martínez5c444792022-06-07 18:17:00 +0200266unset object 1
Adrià Vilanova Martínezd2f8c712022-06-05 22:41:03 +0200267
268# ----------------------------
269# Gràfica per la magnetització
270# ----------------------------
Adrià Vilanova Martínez24d87012022-06-16 00:29:59 +0200271set title ""
Adrià Vilanova Martínezd2f8c712022-06-05 22:41:03 +0200272
Adrià Vilanova Martínez24d87012022-06-16 00:29:59 +0200273# CHOOSEL can be:
274# - 0: all Ls will be drawn
275# - 1: all Ls except for 96 will be drawn
276# - 2: only L=32 will be drawn
277do for [CHOOSEL = 0:2] {
278 do for [TERM in TERMINALS] {
279 if (TERM eq "tex") {
280 @texTerminal
281 title_m = '$\langle |m| \rangle$'
282 title_malt = '$L = %d$'
283 title_sqrtmm = '$\sqrt{\langle m^2 \rangle}$'
284 if (CHOOSEL == 2) {
285 set key spacing 2
286 } else {
287 set key spacing 1.66
288 }
289 } else {
290 title_m = '<|m|>'
291 title_malt = 'L = %d'
292 title_sqrtmm = 'sqrt(<m^2>)'
293 set key spacing 1.25
294 if (TERM eq "png") {
295 @pngTerminal
296 } else {
297 @svgTerminal
298 }
299 }
Adrià Vilanova Martínezd2f8c712022-06-05 22:41:03 +0200300
Adrià Vilanova Martínez24d87012022-06-16 00:29:59 +0200301 if (TERM eq "tex" && CHOOSEL != 2) {
302 set ylabel '$\langle |m| \rangle$'
303 } else {
304 set ylabel "Magnetització per partícula"
305 }
306
307 set output outputfile.'magnetitzacio'.suffix(CHOOSEL).'.'.TERM
308 set key top right
309 if (CHOOSEL == 0) {
310 plot for [L in LS] datafilepre . L . datafilepost using 2:($7/(L**2)) @graphStyle title sprintf(title_malt, L+0)
311 } else {
312 if (CHOOSEL == 1) {
313 plot for [L in PartialLS] datafilepre . L . datafilepost using 2:($7/(L**2)) @graphStyle title sprintf(title_malt, L+0)
314 } else {
315 plot datafilepre . SPECIAL_L . datafilepost using 2:($7/(SPECIAL_L**2)) @graphStyle title sprintf(title_m, SPECIAL_L), \
316 datafilepre . SPECIAL_L . datafilepost using 2:(sqrt($8)/(SPECIAL_L**2)) @graphStyle title sprintf(title_sqrtmm, SPECIAL_L)
317 }
318 }
319 }
320}
321
322# --------------------------------------------------
323# Gràfica per la magnetització (finite size scaling)
324# --------------------------------------------------
325set title ""
326set ylabel "Magnetització per partícula"
327
328# CHOOSEL can be:
329# - 0: all Ls will be drawn
330# - 1: all Ls except for 96 will be drawn
331# - 2: only L=32 will be drawn
332do for [TERM in TERMINALS] {
333 if (TERM eq "tex") {
334 @texTerminal
335 set xlabel '$L^{1/\nu} t$'
336 set ylabel '$\langle |m| \rangle L^{\beta/\nu}$'
337 set key spacing 1.66
338 } else {
339 set xlabel 'L^{1/\nu} t'
340 set ylabel '<|m|> L^{\beta/\nu}'
341 set key spacing 1.25
342 if (TERM eq "png") {
343 @pngTerminal
344 } else {
345 @svgTerminal
346 }
347 }
348
349 set output outputfile.'magnetitzacio_fss.'.TERM
350 set key top right
351 plot for [L in PartialLS] datafilepre . L . datafilepost using (L*($2 - TC)/TC):($7/(L**2)*(L**(BETA))) @graphStyle title sprintf('L = %s', L)
352}