#============================================ # writting tex to make nice plots from data # G. Roux (03/16/2007) #============================================ BEGIN{ CONVFMT="%.10g"; OFMT="%.10g"; begin(); setlength(1); # in mm picture(240,240); Lx = 0; Ly = 0; a = 8; factor = 90; curfac = 400; shift = a*2; Pi = 2*atan2(1,0); }{ if($1" "$2 == "# tx_arg") {phi = $4;} if($1" "$2 == "# system") { Lx = $5; Ly=$3;} if($2 == "hole") {type = 0;} if($2" "$3 == "Current along") {type = 1;} if($2" "$3 == "Current between") {type = 2;} if($3" "$4 == "bonds along") {type = 3;} if($3" "$4 == "bonds between") {type = 4;} if($1" "$2" "$3 == "# j =") {leg = $4;} if($1 != "#" && $1 != "") { if(type == 0) hole[$1,leg] = $2; if(type == 1) cur_along[$1,leg] = $2; if(type == 2) cur_between[$1,leg] = $2; if(type == 3) kin_along[$1,leg] = $2; if(type == 4) kin_between[$1,leg] = $2; } } END{ # print "% Lx = " Lx; # print "% Ly = " Ly; # print phi; # DrawSquareLattice(Lx,Ly,a,shift); # PutHole(i,j+shift/a,sqrt(factor*hole[i,j]),a); #checking Kirchoff's law # j_leg = -cos(Pi*phi)*cur_along[1,2] - sin(Pi*phi)*kin_along[1,2]; # j_rung = cur_between[1,1]; # print j_leg,j_rung; # j_leg = -cos(Pi*phi)*cur_along[1,2] - sin(Pi*phi)*kin_along[1,2]; # j_leg -= -cos(Pi*phi)*cur_along[2,2] - sin(Pi*phi)*kin_along[2,2]; # j_rung = cur_between[2,1]; # print j_leg,j_rung; if(0) for(i = 1; i <= Lx; i++) { v = 8*kin_between[i,1]; linethickness(abs(v)); vline(i,1,a); for(j = 1; j <= Ly; j++) { if(iLx/2) ii++; c = 8*kin_along[ii,j]; linethickness(abs(c)); hline(i,j,a); } } } if(1) for(i = 1; i <= Lx; i++) { v = curfac*cur_between[i,1]; s = sign(v)*sign(Lx/2-i); if(s == -1) Color("red"); if(s == 1) Color("blue"); linethickness(abs(v)); vline(i,1,a); thicklines(); varrow(i,1,a,s); if(1) for(j = 1; j <= Ly; j++) { if(iLx/2) ii++; c = cos(Pi*phi)*cur_along[ii,j] + (2*j-3)*sin(Pi*phi)*kin_along[ii,j]; c *= curfac/6; s = sign(c); if(s == -1) Color("red"); if(s == 1) Color("blue"); linethickness(abs(c)); hline(i,j,a); thicklines(); harrow(i,j,a,s); } } } Color("black"); if(1) for(j = 1; j <= Ly; j++) for(i = 1; i <= Lx; i++) PutHole(i,j,sqrt(factor*hole[i,j]),a); up = 2.6; Text(1,up,a,"Plot of local currents $j_{\\perp}(x)$ ($\\times$6), $j_{\\parallel}(x)$, and hole density $h(x)$ in a $2\\times 32$ ladder with 4 holes, $J/t = 0.5$ and $\\phi = \\pi/8$. \\hspace{1cm} $\\otimes$ H "); PutHole(28.5,up+0.15,sqrt(factor*0.1),a); Text(28.9,up,a,"0.1"); linethickness(curfac*0.01/6); hline(29.7,up+0.15,a); Text(30.9,up,a,"0.01"); end(); } function setlength(l){print "\\setlength{\\unitlength}{"l"mm}";} function thicklines(){print "\\thicklines";} function thinlines(){print "\\thinlines";} function linethickness(t){print "\\linethickness{"t"mm}";} function picture(w,h){print "\\begin{picture}("w","h")";} function vline(i,j,a){print "\\put("a*(i-1)","a*(j-1)"){\\line(0,1){"a"}}";} function hline(i,j,a){print "\\put("a*(i-1)","a*(j-1)"){\\line(1,0){"a"}}";} function varrow(i,j,a,s){print "\\put("a*(i-1)","a*(j-0.5)+s"){\\vector(0,"s"){"0"}}";} function harrow(i,j,a,s){print "\\put("a*(i-0.5)+s","a*(j-1)"){\\vector("s",0){"0"}}";} function Text(i,j,a,str){print "\\put("a*(i-1)","a*(j-1)"){"str"}";} function Color(c){print "\\color{"c"}";} # a is the lattice spacing and L is the number of rungs function DrawSquareLattice(Lx,Ly,a,Vshift){ if(a == "") a = 10; if(Vshift == "") Vshift = 0; print "\\matrixput(0,"Vshift")("a",0){"Lx-1"}(0,"a"){"Ly"}{\\line(1,0){"a"}}"; print "\\matrixput(0,"Vshift")("a",0){"Lx"}(0,"a"){"Ly-1"}{\\line(0,1){"a"}}"; } function PutSpin(i,j,phi,value,a){ if(phi == "") phi = 0; if(value == "") value = 10; if(a == "") a = 10; up = int(4*cos(phi)); right = int(4*sin(phi)); print "\\put("a*(i-1)","a*(j-1)"){\\vector("up","right"){"a*abs(value)"}}"; } function PutHole(i,j,value,a){ if(a == "") a = 10; print "\\put("a*(i-1)","a*(j-1)"){\\circle*{"value"}}"; } function begin(){ print "\\documentclass{minimal}"; print "\\usepackage{epic}"; print "\\usepackage[dvips]{color}"; print "\\begin{document}"; } function end(){ print "\\end{picture}"; print "\\end{document}"; } function abs(a){if(a>=0){return a;}else{return -a;}} function sign(a){if(a>=0){return 1;}else{return -1;}}