avm99963 | 45a8a46 | 2022-06-04 12:41:03 +0200 | [diff] [blame] | 1 | #!/usr/bin/env -S gnuplot -c |
Adrià Vilanova Martínez | 24d8701 | 2022-06-16 00:29:59 +0200 | [diff] [blame^] | 2 | outputfile = '' |
| 3 | datafilepre = '../dep_en_L/tmpdata/' |
avm99963 | 45a8a46 | 2022-06-04 12:41:03 +0200 | [diff] [blame] | 4 | datafilepost = '.dat' |
Adrià Vilanova Martínez | c102e96 | 2022-06-04 23:53:44 +0200 | [diff] [blame] | 5 | LS = ARG1 |
avm99963 | 45a8a46 | 2022-06-04 12:41:03 +0200 | [diff] [blame] | 6 | |
Adrià Vilanova Martínez | 24d8701 | 2022-06-16 00:29:59 +0200 | [diff] [blame^] | 7 | SPECIAL_L = 32 |
| 8 | ZOOMEDIN = 1 # Whether we want to include zoomed in graphs (1) or not (0) |
| 9 | 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). |
| 10 | |
| 11 | # COMPORTAMENT CRÍTIC (extret de l'anàlisi fet a l'informe): |
| 12 | TC = 2.268 |
| 13 | BETA = 0.13 |
| 14 | GAMMA = 1.77 |
| 15 | |
| 16 | # All LS except for 96, since it's low quality data. |
| 17 | PartialLS = system('LS="'. LS .'"; PartialLS=""; for L in $LS; do if [ $L -ne 96 ]; then PartialLS+="$L "; fi; done; echo $PartialLS') |
| 18 | |
| 19 | TERMINALS = "svg png tex" |
| 20 | |
| 21 | svgTerminal = "set terminal svg size 800, 800 font \"Computer Modern,Tinos,Helvetica,15\"; pointSize=0.5" |
Adrià Vilanova Martínez | 5c44479 | 2022-06-07 18:17:00 +0200 | [diff] [blame] | 22 | pngTerminal = "set terminal pngcairo size 800, 800 font \"Computer Modern,Tinos,Helvetica,15\"; pointSize=0.7" |
Adrià Vilanova Martínez | 24d8701 | 2022-06-16 00:29:59 +0200 | [diff] [blame^] | 23 | texTerminal = "set terminal cairolatex size 8.5cm, 8.5cm; pointSize=0.7" |
Adrià Vilanova Martínez | 5c44479 | 2022-06-07 18:17:00 +0200 | [diff] [blame] | 24 | graphStyle = "with linespoints pointsize pointSize" |
| 25 | |
Adrià Vilanova Martínez | 24d8701 | 2022-06-16 00:29:59 +0200 | [diff] [blame^] | 26 | SUMI(L) = (USEHACK ? (L == 96 ? 1400*16 : 1900*150) : 1900*150) |
| 27 | suffix(CHOOSEL) = (CHOOSEL == 0 ? '_ALLL' : (CHOOSEL == 1 ? '' : '_L' . SPECIAL_L)) |
| 28 | |
Adrià Vilanova Martínez | 5c44479 | 2022-06-07 18:17:00 +0200 | [diff] [blame] | 29 | set style line 101 lc rgb '#808080' lt 1 lw 1 |
| 30 | set border 3 front ls 101 |
| 31 | set tics nomirror out scale 0.75 |
Adrià Vilanova Martínez | 24d8701 | 2022-06-16 00:29:59 +0200 | [diff] [blame^] | 32 | set linetype 99963 dashtype (6, 0, 0, 10) |
| 33 | set style line 102 lc rgb '#d6d7d9' lt 99963 lw 1 |
Adrià Vilanova Martínez | 5c44479 | 2022-06-07 18:17:00 +0200 | [diff] [blame] | 34 | set grid back ls 102 |
avm99963 | 45a8a46 | 2022-06-04 12:41:03 +0200 | [diff] [blame] | 35 | |
Adrià Vilanova Martínez | 24d8701 | 2022-06-16 00:29:59 +0200 | [diff] [blame^] | 36 | set xlabel "T" |
Adrià Vilanova Martínez | d2f8c71 | 2022-06-05 22:41:03 +0200 | [diff] [blame] | 37 | set yrange [*<0:0<*] |
| 38 | # ------------------------------------ |
| 39 | # Gràfica per la capacitat calorífica: |
| 40 | # ------------------------------------ |
Adrià Vilanova Martínez | 24d8701 | 2022-06-16 00:29:59 +0200 | [diff] [blame^] | 41 | set title "" |
Adrià Vilanova Martínez | c102e96 | 2022-06-04 23:53:44 +0200 | [diff] [blame] | 42 | |
Adrià Vilanova Martínez | 24d8701 | 2022-06-16 00:29:59 +0200 | [diff] [blame^] | 43 | # 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 |
| 47 | do 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ínez | c102e96 | 2022-06-04 23:53:44 +0200 | [diff] [blame] | 68 | |
Adrià Vilanova Martínez | 24d8701 | 2022-06-16 00:29:59 +0200 | [diff] [blame^] | 69 | 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 | |
| 86 | set yrange [*<0:0<*] |
| 87 | set ylabel "" |
Adrià Vilanova Martínez | d2f8c71 | 2022-06-05 22:41:03 +0200 | [diff] [blame] | 88 | |
| 89 | # ---------------------------------------- |
| 90 | # Gràfica per la susceptibilitat magnètica |
| 91 | # ---------------------------------------- |
Adrià Vilanova Martínez | 24d8701 | 2022-06-16 00:29:59 +0200 | [diff] [blame^] | 92 | set 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 |
| 98 | do 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 | |
| 126 | set yrange [*<0:0<*] |
| 127 | |
| 128 | # -------------------------------------------------------------- |
| 129 | # Gràfica per la susceptibilitat magnètica (finite size scaling) |
| 130 | # -------------------------------------------------------------- |
| 131 | set title "" |
| 132 | |
| 133 | set xlabel 'L^{1/\nu} t' |
| 134 | set ylabel '\chi/(L^{\gamma/\nu})' |
| 135 | |
| 136 | set key spacing 1.25 |
Adrià Vilanova Martínez | d2f8c71 | 2022-06-05 22:41:03 +0200 | [diff] [blame] | 137 | |
| 138 | @svgTerminal |
Adrià Vilanova Martínez | 24d8701 | 2022-06-16 00:29:59 +0200 | [diff] [blame^] | 139 | set output outputfile.'susceptibilitat_magnetica_fss.svg' |
| 140 | plot for [L in PartialLS] datafilepre . L . datafilepost using (L*($2 - TC)/TC):($11/(L**GAMMA)) @graphStyle title "L = ".L |
Adrià Vilanova Martínez | d2f8c71 | 2022-06-05 22:41:03 +0200 | [diff] [blame] | 141 | |
| 142 | @pngTerminal |
Adrià Vilanova Martínez | 24d8701 | 2022-06-16 00:29:59 +0200 | [diff] [blame^] | 143 | set output outputfile.'susceptibilitat_magnetica_fss.png' |
Adrià Vilanova Martínez | d2f8c71 | 2022-06-05 22:41:03 +0200 | [diff] [blame] | 144 | replot |
| 145 | |
Adrià Vilanova Martínez | 24d8701 | 2022-06-16 00:29:59 +0200 | [diff] [blame^] | 146 | @texTerminal |
| 147 | set xlabel '$L^{1/\nu} t$' |
| 148 | set ylabel '$\chi/L^{\gamma/\nu}$' |
| 149 | set key spacing 1.66 |
| 150 | set output outputfile.'susceptibilitat_magnetica_fss.tex' |
| 151 | replot |
| 152 | |
| 153 | set key spacing 1.25 |
| 154 | set xlabel 'T' |
| 155 | |
Adrià Vilanova Martínez | d2f8c71 | 2022-06-05 22:41:03 +0200 | [diff] [blame] | 156 | # --------------------- |
| 157 | # Gràfica per l'energia |
| 158 | # --------------------- |
Adrià Vilanova Martínez | 24d8701 | 2022-06-16 00:29:59 +0200 | [diff] [blame^] | 159 | |
| 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 |
| 164 | do 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ínez | 5c44479 | 2022-06-07 18:17:00 +0200 | [diff] [blame] | 254 | } |
Adrià Vilanova Martínez | 5c44479 | 2022-06-07 18:17:00 +0200 | [diff] [blame] | 255 | } |
| 256 | |
Adrià Vilanova Martínez | 24d8701 | 2022-06-16 00:29:59 +0200 | [diff] [blame^] | 257 | set key spacing 1.25 |
Adrià Vilanova Martínez | 5c44479 | 2022-06-07 18:17:00 +0200 | [diff] [blame] | 258 | set origin 0, 0 |
| 259 | set size 1, 1 |
| 260 | set autoscale x |
| 261 | set yrange [*<0:0<*] |
Adrià Vilanova Martínez | 24d8701 | 2022-06-16 00:29:59 +0200 | [diff] [blame^] | 262 | set xlabel "T" |
| 263 | set ylabel "" |
| 264 | set xtics auto |
| 265 | set ytics auto |
Adrià Vilanova Martínez | 5c44479 | 2022-06-07 18:17:00 +0200 | [diff] [blame] | 266 | unset object 1 |
Adrià Vilanova Martínez | d2f8c71 | 2022-06-05 22:41:03 +0200 | [diff] [blame] | 267 | |
| 268 | # ---------------------------- |
| 269 | # Gràfica per la magnetització |
| 270 | # ---------------------------- |
Adrià Vilanova Martínez | 24d8701 | 2022-06-16 00:29:59 +0200 | [diff] [blame^] | 271 | set title "" |
Adrià Vilanova Martínez | d2f8c71 | 2022-06-05 22:41:03 +0200 | [diff] [blame] | 272 | |
Adrià Vilanova Martínez | 24d8701 | 2022-06-16 00:29:59 +0200 | [diff] [blame^] | 273 | # 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 |
| 277 | do 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ínez | d2f8c71 | 2022-06-05 22:41:03 +0200 | [diff] [blame] | 300 | |
Adrià Vilanova Martínez | 24d8701 | 2022-06-16 00:29:59 +0200 | [diff] [blame^] | 301 | 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 | # -------------------------------------------------- |
| 325 | set title "" |
| 326 | set 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 |
| 332 | do 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 | } |