//----------------------------------------------------------------------- // Rotate gauge of the lattice (from Min) //----------------------------------------------------------------------- void rotate_gauge_explicit(Lattice &lat,int dir) { const char *cname="none"; const char *fname="rotate_gauge_explicit"; VRB.Func(cname,fname); if ((dir<0)||(dir>3)){ VRB.Result(cname,fname,"Error:: direction should be 0,1,2,3\n"); return; } int NX(GJP.XnodeSites()); int NY(GJP.YnodeSites()); int NZ(GJP.ZnodeSites()); int NT(GJP.TnodeSites()); //--------------------------------------------------------------- // Set up the gauge fixing and other required conditions //--------------------------------------------------------------- int num_nodes[4] = { GJP.Xnodes(), GJP.Ynodes(), GJP.Znodes(), GJP.Tnodes() } ; int node_sites[4] = { GJP.XnodeSites(), GJP.YnodeSites(), GJP.ZnodeSites(), GJP.TnodeSites() } ; int Size[4]; for (int i=0; i<4; i++){ Size[i] = num_nodes[i]*node_sites[i]; } int *plns; plns = (int*) smalloc(Size[dir]*sizeof(int)); for (int i=0; i<Size[dir]; i++){ plns[i] = i; } int npln = Size[dir]; FixGaugeType normdir; if (dir==3) normdir = FIX_GAUGE_COULOMB_T; else if (dir==0) normdir = FIX_GAUGE_COULOMB_X; else if (dir==1) normdir = FIX_GAUGE_COULOMB_Y; else normdir = FIX_GAUGE_COULOMB_Z; //---------------------------------------------------------------------- //initialize the parameters need to gauge fixing --------------------- //---------------------------------------------------------------------- Matrix *L; Matrix **Gp; int ii; int volume = NX*NY*NZ*NT; L = (Matrix*) smalloc(4*volume*sizeof(Matrix)); Gp = (Matrix**) smalloc(npln*sizeof(Matrix*)); for(ii=0; ii<npln; ii++) Gp[ii] = (Matrix*) smalloc(volume/node_sites[dir] * sizeof(Matrix)); //----------------------------------------------------------------------------- //GAUGE FIXING MATRICES //----------------------------------------------------------------------------- for (int slice=0; slice<node_sites[dir]; slice++) for(int cnt=0; cnt<volume/node_sites[dir]; cnt++) Gp[slice][cnt]=lat.FixGaugePtr()[slice][cnt]; //------------------------------------------------------------------------------- //------------------------------------------------------------------------------- // TRY TO Transform the Lattice to the Coulomb Gauge and store it --------------- //------------------------------------------------------------------------------- int tt,xx,yy,zz,temp_ind; int slice_ind[3]; //slice_ind[3] stores the 3 directions on the 'dir' slice with indices increasing temp_ind = 0; for (int i=0; i<4; i++){ if (i!=dir) { slice_ind[temp_ind] = i; temp_ind++; } } VRB.Result(cname,fname,"dir == %d \n",dir); VRB.Result(cname,fname,"slice index == %d %d %d\n",slice_ind[0],slice_ind[1],slice_ind[2]); // the dummy node_sites for each dummy dirction int NN[4]; NN[0] = node_sites[slice_ind[0]]; NN[1] = node_sites[slice_ind[1]]; NN[2] = node_sites[slice_ind[2]]; NN[3] = node_sites[dir]; int s[4]; for (int i=0; i<3; i++) s[i] = slice_ind[i]; s[3] = dir; //--------------------------------------------------------------------------------- //copy the old lattice config to matrix array L, transform L and then copy back //--------------------------------------------------------------------------------- lat.CopyGaugeField(L); int x[4]; // xx yy zz tt are dummy position vector, as tt represents the gfixing direction for (x[3]=0; x[3]<node_sites[3]; x[3]++) for (x[2]=0; x[2]<node_sites[2]; x[2]++) for (x[1]=0; x[1]<node_sites[1]; x[1]++) for (x[0]=0; x[0]<node_sites[0]; x[0]++) { xx = x[slice_ind[0]]; yy = x[slice_ind[1]]; zz = x[slice_ind[2]]; tt = x[dir]; Matrix g = Gp[tt][(zz*NN[1]+yy)*NN[0]+xx]; Matrix D; Matrix gg ; Matrix transmit; //----------------- T Direction ---------------------------- if (tt+1<NN[3]) gg = Gp[tt+1][(zz*NN[1]+yy)*NN[0]+xx]; else { transmit = Gp[0][(zz*NN[1]+yy)*NN[0]+xx]; getPlusData((IFloat *)&gg, (IFloat *)&transmit, sizeof(Matrix)/sizeof(IFloat), dir) ; } D.Dagger(gg); L[IND(x[0],x[1],x[2],x[3],dir)] = g*L[IND(x[0],x[1],x[2],x[3],dir)]*D; //----------------- Z Direction ---------------------------- if (zz+1<NN[2]) gg = Gp[tt][((zz+1)*NN[1]+yy)*NN[0]+xx]; else { transmit = Gp[tt][((zz+1)%NN[2]*NN[1]+yy)*NN[0]+xx]; getPlusData((IFloat *)&gg, (IFloat *)&transmit, sizeof(Matrix)/sizeof(IFloat), slice_ind[2]) ; } D.Dagger(gg); L[IND(x[0],x[1],x[2],x[3],slice_ind[2])] = g*L[IND(x[0],x[1],x[2],x[3],slice_ind[2])]*D; //----------------- Y Direction ---------------------------- if (yy+1<NN[1]) gg = Gp[tt][(zz*NN[1]+(yy+1))*NN[0]+xx]; else { transmit = Gp[tt][(zz*NN[1]+(yy+1)%NN[1])*NN[0]+xx]; getPlusData((IFloat *)&gg, (IFloat *)&transmit, sizeof(Matrix)/sizeof(IFloat), slice_ind[1]) ; } D.Dagger(gg); L[IND(x[0],x[1],x[2],x[3],slice_ind[1])] = g*L[IND(x[0],x[1],x[2],x[3],slice_ind[1])]*D; //----------------- X Direction ---------------------------- if (xx+1<NN[0]) gg = Gp[tt][(zz*NN[1]+yy)*NN[0]+(xx+1)]; else { transmit = Gp[tt][(zz*NN[1]+yy)*NN[0]+(xx+1)%NN[0]]; getPlusData((IFloat *)&gg, (IFloat *)&transmit, sizeof(Matrix)/sizeof(IFloat), slice_ind[0]) ; } D.Dagger(gg); L[IND(x[0],x[1],x[2],x[3],slice_ind[0])] = g*L[IND(x[0],x[1],x[2],x[3],slice_ind[0])]*D; } lat.GaugeField(L); //--------------------------------Free L and Gp ------------------------------------- sfree(L); for (ii=0; ii<npln; ii++) sfree(Gp[ii]); sfree(Gp); sfree(plns); }
//---------------------------------------------------------------------------- // Coulomb gauge fix fermion solution vector in hyperplanes of direction dir. // Gauge fixing matrices must exist before this routine is used. // --- Meifeng Lin 01/31/06 //---------------------------------------------------------------------------- void FermionVector::gaugeFixSink(Lattice &lat, int dir) const { char *fname = "gaugeFixSink()"; VRB.Func(d_class_name, fname); Matrix **gm = lat.FixGaugePtr(); //------------------------------------------------------- //If gauge fixing matrices do not exist, //nothing has to be done. //------------------------------------------------------- if(gm==0){ ERR.General(d_class_name,fname,"No gauge fixing matrices were found\n"); return; } else{ printf("Gauge Fixing Sink...\n"); } IFloat *fv = d_fermion_p; int error = 0; switch(dir){ case 0: if ( lat.FixGaugeKind() != FIX_GAUGE_COULOMB_X ) error = 1;break; case 1: if ( lat.FixGaugeKind() != FIX_GAUGE_COULOMB_Y ) error = 1;break; case 2: if ( lat.FixGaugeKind() != FIX_GAUGE_COULOMB_Z ) error = 1;break; case 3: if ( lat.FixGaugeKind() != FIX_GAUGE_COULOMB_T ) error = 1;break; } if (error) ERR.General(d_class_name,fname,"Mismatch gauge fixing kind\n"); int lcl[LORENTZs]; //------------------------------------------------------------------------- // Indices for all the directions // Here use "t" to indicate the propagation direction, but not necessarily // the generic t direction. Other 3 directions are arbitrarily labelled x,y,z //------------------------------------------------------------------------- int t = dir; int z = (dir + 1) % LORENTZs; int y = (dir + 2) % LORENTZs; int x = (dir + 3) % LORENTZs; Vector tmp_vec; for (lcl[t]=0; lcl[t] < lcl_sites[t]; lcl[t]++) { Matrix *pM = gm[lcl[t]]; if(pM != NULL ){ for (lcl[z] = 0; lcl[z] < lcl_sites[z]; lcl[z]++) for (lcl[y] = 0; lcl[y] < lcl_sites[y]; lcl[y]++) for (lcl[x] = 0; lcl[x] < lcl_sites[x]; lcl[x]++) { // the matrix offset int j = siteOffset(lcl,dir); for (int spin = 0; spin < DIRACs; spin++) { // the vector offset int i= 2 * COLORs * ( spin + 4 * siteOffset(lcl)); tmp_vec.CopyVec((Vector*)&fv[i], 6); uDotXEqual((IFloat*)&fv[i],(const IFloat*)&pM[j], (const IFloat*)&tmp_vec); } } } else{ ERR.General(d_class_name,fname,"Not gauge fixing matrices were found at slice = %d\n",lcl[t]); Float *null_p = 0; *null_p = 1.; } } }