# Usage:
# Ls = "40 60 80 100 120 140 160 200 500 1000"
# bc = bcc; nu = 1 ; bnu = 0.125; load "scale_beta.gpl";
# Ls: the values of L used in te collapse
# bc: the critical temperature used in the calculation of t=(beta_c-beta)/beta_c
# nu: the exponent used in the calculation of x=L^{1/nu} t
# bnu: the exponent used in the calculation of F_chi = L^{bnu} chi(beta,L)

## for the plot in the text see: load "scale_gamma_eps.gpl"

bcc   = 0.5*log(1.0+sqrt(2.0)); #the exact critical temperature (use bc=bcc is you wish)
NLs   = words(Ls);  # The number of lattice sizes used in the calculation
LL(i) = word (Ls,i);# Returns the i_th lattice size
cplot(i) = sprintf("<grep 'm %s ' all|sort -k 3,3g|awk -v L=%s -v bc=%f -v nu=%f -v bnu=%f '($6>0 &&(($7/$6)<0.01)){print L^(1.0/nu)*(bc-$3)/bc,L^(bnu)*$4,L^(bnu)*$5}'",LL(i),LL(i),bc,nu,bnu);

set macros
set term qt enhanced
set key top right
set title sprintf("{/Symbol b}_c= %f {/Symbol n}= %f {/Symbol b/n}= %f",bc,nu,bnu)
set xlabel "x=L^{1/{/Symbol n}} t"
set ylabel "F_{{/Symbol c}}(x) = L^{{/Symbol b/n}}{/Symbol c}({/Symbol b},L)"
plot for[i=1:NLs] cplot(i) u 1:2:3 w e t sprintf("L=%s",LL(i))
#replot for[i=1:NLs] cplot(i) u 1:2:3 smooth bezier notitle
#  ---------------------------------------------------------------------
#  Copyright by Konstantinos N. Anagnostopoulos (2004-2014)
#  Physics Dept., National Technical University,
#  konstant@mail.ntua.gr, www.physics.ntua.gr/~konstant
#  
#  This program is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, version 3 of the License.
#  
#  This program is distributed in the hope that it will be useful, but
#  WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#  General Public License for more details.
#  
#  You should have received a copy of the GNU General Public Liense along
#  with this program.  If not, see <http://www.gnu.org/licenses/>.
#  -----------------------------------------------------------------------
