/************************************************************************************* Grid physics library, www.github.com/paboyle/Grid Source file: ./tests/Test_RectPlaq.cc Copyright (C) 2015 Author: Azusa Yamaguchi Author: paboyle 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; either version 2 of the License, or (at your option) any later version. 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 License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. See the full license in the file "LICENSE" in the top level distribution directory *************************************************************************************/ /* END LEGAL */ #include #include #include using namespace std; using namespace Grid; using namespace Grid::QCD; /* For Metropolis */ class Metropolis { public: GridSerialRNG & sRNG; Metropolis(GridSerialRNG & _sRNG) : sRNG(_sRNG) {}; bool AcceptReject(const RealD Delta) { RealD rand; if(Delta <=0.0) return true; random(sRNG,rand); if(rand <= exp(-Delta)) return true; else return false; } }; void RectPlaq(const std::vector &U, LatticeComplex &RectPlaqValue ) { RectPlaqValue=zero; // 12 * vol loops for(int mu=1;mu->| adj(PeriodicBC::CovShiftForward(U[nu],nu,PeriodicBC::CovShiftForward(U[mu],mu,U[mu]))) ); RectPlaqValue = RectPlaqValue + trace( PeriodicBC::CovShiftForward(U[mu],mu,PeriodicBC::CovShiftForward(U[nu],nu,U[nu]))* // ->|| adj(PeriodicBC::CovShiftForward(U[nu],nu,PeriodicBC::CovShiftForward(U[nu],nu,U[mu]))) ); } } } void RectPlaqDeriv(const std::vector &U, LatticeComplex &RectPlaqValue ) { } int main (int argc, char ** argv) { Grid_init(&argc,&argv); std::vector simd_layout = GridDefaultSimd(4,vComplex::Nsimd()); std::vector mpi_layout = GridDefaultMpi(); std::vector latt_size ({16,16,16,32}); std::vector clatt_size ({4,4,4,8}); int orthodir=3; int orthosz =latt_size[orthodir]; GridCartesian Fine(latt_size,simd_layout,mpi_layout); GridCartesian Coarse(clatt_size,simd_layout,mpi_layout); LatticeGaugeField Umu(&Fine); std::vector U(4,&Fine); NerscField header; std::string file("./ckpoint_lat.4000"); NerscIO::readConfiguration(Umu,header,file); for(int mu=0;mu(Umu,mu); } // Painful ; fix syntactical niceness : to check reader LatticeComplex LinkTrace(&Fine); LinkTrace=zero; for(int mu=0;munu) // // // // Expect scale factor to be // // for(int mu=0;mu ---> : U(x,mu)*U(x+mu, mu) */ left_2= PeriodicBC::CovShiftForward(U[mu],mu,U[mu]); /* upper_l = <---- <--- ^ | =>tmp (x+2mu) Unu(x+2mu) Umudag(x+mu+nu) Umudag(x+nu) */ tmp=Cshift(U[nu],mu,2); upper_l= PeriodicBC::CovShiftForward(tmp,nu,adj(left_2)); // i.e. upper_l /* upper_staple= <---- <--- ^ | | V (x) (x + 2mu) */ // Unu(x+2mu) Umudag(x+mu+nu) Umudag(x+nu) Unudag(x) upper_staple= upper_l*adj(U[nu]); /* down_staple= ^ | | (x) <----- <---- V x + 2mu */ down_staple= adj(left_2*tmp)*U[nu]; /* ds_U+= <---- <--- ^ | | (x-mu) V-----> (x + mu) */ tmp=upper_staple*U[mu]; ds_U+= Cshift(tmp,mu,-1); /* ds_U+= (x-mu) ^----> (x + mu) | | <-----<--- V */ tmp=PeriodicBC::CovShiftBackward(U[mu],nu,down_staple); ds_U+=Cshift(tmp,mu,-1); /* ds_U+= <----<---- ^ | | (x) V -----> (x + 2mu) */ tmp=Cshift(U[mu],mu,1); /* ds_U+= (x) ^ ----> (x + 2mu) | | <---- <----V */ ds_U+=tmp*(upper_staple+down_staple); /*****Part 2********/ /* ^ | upper= ^ | (x) */ LatticeColourMatrix up2= PeriodicBC::CovShiftForward(U[nu],nu,U[nu]); /* <----^ | upper_l= ^ | (x) */ // Unu(x+mu)Unu(x+mu+nu) UmuDag(x+nu+nu) lives at X upper_l= PeriodicBC::CovShiftForward(Cshift(up2,mu,1),nu,Cshift(adj(U[mu]),nu,1)); /* |<----^ upper_staple = V | | ^ (x) V | */ ds_U+= upper_l*adj(up2); /* | V downer_l= | (x)<----V */ upper_l= adj(PeriodicBC::CovShiftForward(U[mu],mu,up2)); //downer_l /* ^ | down_staple = | V ^ | | V (x)<---- down_staple= upper*upper_l; */ tmp= upper_l*up2; ds_U+= Cshift(tmp,nu,-2); //TRp = sum(RectPlaq_d); //rp = TensorRemove(TRp); //std::cout << GridLogMessage<< " Rect[" << " " << "] = "<< TensorRemove(TRp) < Plaq_T(orthosz); sliceSum(Plaq,Plaq_T,Nd-1); int Nt = Plaq_T.size(); TComplex Plaq_T_sum; Plaq_T_sum=zero; for(int t=0;t