#include CPS_START_NAMESPACE //-------------------------------------------------------------------- // // //-------------------------------------------------------------------- // last modification: manke, Feb 1, 2001 // 1. changes Vst --> Vts (for consistency) // 2. explicitly transfer max_XYZT in pot_arg // 3. print out potentials V(x,y,z,t) separately for x,y,z // 4. changed V?? (potential) --> W?? (wilson loop) //------------------------------------------------------------------ // // alg_pot.C // // AlgPot is derived from Alg and it measures the potential // into different propagation directions // //------------------------------------------------------------------ CPS_END_NAMESPACE #include #include #include #include #include #include // Tr() and ReTr() #include #include #include CPS_START_NAMESPACE // #define max(A, B) ((A) > (B) ? (A) : (B)) // #define min(A, B) ((A) < (B) ? (A) : (B)) //------------------------------------------------------------------ // Constructor //------------------------------------------------------------------ AlgPot::AlgPot(Lattice& latt, CommonArg *c_arg, PotArg *arg) : Alg(latt, c_arg) { cname = "AlgPot"; char *fname = "AlgPot(L&,CommonArg*,PotArg*)"; VRB.Func(cname,fname); // Initialize the argument pointer //---------------------------------------------------------------- if(arg == 0) ERR.Pointer(cname,fname, "arg"); alg_pot_arg = arg; // Calculate normalization factor for each processor //---------------------------------------------------------------- int total_sites = GJP.VolNodeSites() * GJP.Xnodes() * GJP.Ynodes() * GJP.Znodes() * GJP.Tnodes(); int int_norm = GJP.Colors()*total_sites; norm_fac = 1.0 / ( Float(int_norm) ); xiB2 = GJP.XiBare()*GJP.XiBare(); } //------------------------------------------------------------------ // Destructor //------------------------------------------------------------------ AlgPot::~AlgPot() { char *fname = "~AlgPot()"; VRB.Func(cname,fname); } //------------------------------------------------------------------ // run() // // this calculates // 1. the regular potential from the Wilson Loop in temporal direction // and with all squared spatial distances r2=x*x + y*y + z*z // --> Wts // 2. the sideways potential from wilson Loop in z-direction (=2) // and with QQ separaton on-axis along // a) x --> Wzx // b) t --> Wzt //------------------------------------------------------------------ void AlgPot::run() { char *fname = "run()"; VRB.Func(cname,fname); int sweep = alg_pot_arg->sweep; int prop_dir = alg_pot_arg->prop_dir; // int check = alg_pot_arg->check; // maximal loop extent in (X,Y,Z,T) direction // running over all the biggest loops would often be very expensive int max_X = alg_pot_arg->max_X; int max_Y = alg_pot_arg->max_Y; int max_Z = alg_pot_arg->max_Z; int max_T = alg_pot_arg->max_T; // maximal squared distance from origin (0,0,0) int max_r2 = (max_X*max_X + max_Y*max_Y + max_Z*max_Z); // printf(" max_XYZT = %d %d %d %d max_r2 = %d \n",max_X,max_Y,max_Z,max_T,max_r2); Float aniso_factor; Float pot_real; Float pot_imag; // Set the Lattice pointer //---------------------------------------------------------------- Lattice& lat = AlgLattice(); printf("prop_dir = %d sweep = %d \n",prop_dir,sweep); // printf("norm_fac = %e \n", norm_fac); // printf("XI0 = %e XI02 = %e \n", GJP.XiBare(),xiB2); // if propagation direction is NOT t=3 or z=2 --> exit if ((prop_dir != 3) && (prop_dir !=2) ){ printf("Lattice: prop_dir= %d -- not yet implemented\n",prop_dir); // exit(1); } if (prop_dir == 3) { // static QQ-pair propagates in temporal direction // calculate potential for all possible distances // on-axis and off-axis // printf(" calculate regular potential in temporal direction\n"); // allocate space for potential and multiplicity // actually the following is bigger than necessary // as the loops below are only UP TO < MAX_R2 // its safe for now though Complex *Wts = new Complex[max_r2]; int *number = new int[max_r2]; for (int ext_prop=1; ext_prop < max_T ; ext_prop++){ //printf("ext_prop = %d max_T = %d \n",ext_prop,max_T); // aniso_factor = xi0^{-2* (number of temporal links) } aniso_factor = power(xiB2,-1.*ext_prop); // printf("XiBare = %e -> temporal links needs factor %e \n",GJP.XiBare(),aniso_factor); // initialisation of potential and the number of points // with distance r2 (new for every different ext_prop) int r2; for (r2=0; r2 < max_r2; r2++){ Wts[r2] = 0.; number[r2] = 0; } // vary the extent of static Q\bar Q source along the three // different spatial directions // there is a certain restrcition here in that we only // consider spatial paths like (x,x,x,x,y,y,z,z,z,z,z) // but not the Oh-related ones // e.g. not: (x,y,z,z,x,x,y,z,z,x,z) for (int ext1 = 0; ext1 < max_X; ext1++){ for (int ext2 = 0; ext2 < max_Y; ext2++){ for (int ext3 = 0; ext3 < max_Z; ext3++){ // printf("ext1-3 = %d %d %d ",ext1,ext2,ext3); int offset=0; // squared distance between poitn and origin r2 = ext1*ext1 + ext2*ext2 + ext3*ext3; // number of links in Wilson Loop int nlinks = 2*(ext1+ext2+ext3+ext_prop); // printf("r2 = %d nlinks = %d ",r2,nlinks); // allocate space for path int *path = new int[nlinks]; int i; // set up path for (i=0; i < ext1; i++) path[i] = 0; // x = 0 offset = ext1; for (i=offset; i < offset+ext2; i++) path[i] = 1; // y = 1 offset = offset + ext2; for (i=offset; i < offset+ext3; i++) path[i] = 2; // z = 2 offset = offset + ext3; for (i=offset; i < offset+ext_prop; i++) path[i] = 3; // t = 3 offset = offset + ext_prop; // now the whole way back for (i=offset; i < offset+ext3; i++) path[i] = 6; // -z = 6 offset = offset + ext3; for (i=offset; i < offset+ext2; i++) path[i] = 5; // -y = 5 offset = offset + ext2; for (i=offset; i < offset+ext1; i++) path[i] = 4; // -x = 4 offset = offset + ext1; for (i=offset; i < offset+ext_prop; i++) path[i] = 7; // -t=7 /* printf("path = "); for (i=0;i %s \n",sep_dir,filename); // this is now simpler than above as we have only // on-axis separation and there is a unique squared distance // for each extent "ext" in this particular direction (x or t) for (int ext=1; ext < max_ext ; ext++){ int i; int offset; // squared distance (on-axis) // int r2 = ext*ext; // number of links in loop based on this separation int nlinks = 2*(ext+ext_prop); // allocate space for path int *path = new int[nlinks]; // set up path // QQ-separation ( for (i=0; i < ext; i++) path[i] = sep_dir; offset = ext; // QQ-propagation for (i=offset; i < offset+ext_prop; i++) path[i] = prop_dir; offset = offset + ext_prop; // now the whole way back // -sep_dir (-x=4, -t=7 ) --> sep_dir + 4 for (i=offset; i < offset+ext; i++) path[i] = sep_dir+4; offset = offset + ext; // now go backward in "time"=-z=6 for (i=offset; i < offset+ext_prop; i++) path[i] = prop_dir+4; /* printf("path = "); for (int j=0; j loop is completely spatial pot_real *= norm_fac; pot_imag *= norm_fac; // if (ext_prop==1) Wzx[ext] = pot_real; // for external use /* // write W(z,x) to file char *fn = "Wz99x99"; sprintf(fn,"Wz%dx%d",ext_prop,ext); FILE *fp= Fopen(fn, "a"); Fprintf(fp,"%d %e %e \n",sweep, pot_real,pot_imag); Fclose(fp); */ } // printf("after global sum %d %d %d %e %e \n", // sweep, ext_prop, r2, pot_real,pot_imag); FILE *fp= Fopen(filename, "a"); Fprintf(fp,"%d %d %d %e %e \n", sweep, ext_prop, ext, pot_real,pot_imag); Fclose(fp); // deallocate space for path delete [] path; } // end for ext=0; ext< max_ext; } // end for choice=0; choice < 2 ; } // end for ext_prop =0; ext_prop < max_Z ; } // endif (prop_dir == 2 := Z-direction) } CPS_END_NAMESPACE