Phase Boundary Code

D. Stanford

/* phase_diagram.cc Description: This code evaluates the gap equation integral and outputs a text file that gives the coordinates in the U/t' plane (t=1) of the antiferromagnetic/nonmagnetic phase boundary. Compilation instructions: Strip off the html commands and store the source in the file grid.cpp. Under gcc then execute g++ phase_diagram.cc -o phase_diagram ./phase_diagram Copyright 2008 Douglas Stanford. The author grants permission to copy, distribute and display this work in unaltered form, with attribution to the author, for noncommercial purposes only. All other rights, including commercial rights, are reserved to the author. */ #include <iostream> #include <math.h> #include <fstream> #include <unistd.h> //VARIABLES float pi=3.14159265; //FUNCTIONS float GapEqn(float A,float B,float C); void PlotUofd(); using namespace std; int main(){ PlotUofd(); return 0; } float GapEqn(float A, float B, float C){ float dq1=0.01; float counter=0; for(float qx=-pi; qx<pi; qx+=dq1){ for(float qy=-pi; qy<pi; qy+=dq1){ counter+=(dq1*dq1)*((A+4*B*sin(qx)*sin(qy))/sqrt(4*C*C*(pow(cos(qx),2)+pow(cos(qy),2))+pow(A+4*B*sin(qx)*sin(qy),2))); } } counter/=(pow(2*pi,2)); return(2*A/counter); } void PlotUofd(){ ofstream outfileU; outfileU.open("U.txt"); for(float tprime=-1; tprime<=1; tprime+=.1){ outfileU<<tprime<<'\t'<<GapEqn(.0001,tprime,1)<<endl; } }