diff --git a/tests/debug/Test_padded_cell.cc b/tests/debug/Test_padded_cell.cc new file mode 100644 index 00000000..c6c77bc8 --- /dev/null +++ b/tests/debug/Test_padded_cell.cc @@ -0,0 +1,186 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_padded_cell.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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; + +template void gpermute(vobj & inout,int perm){ + vobj tmp=inout; + if (perm & 0x1 ) { permute(inout,tmp,0); tmp=inout;} + if (perm & 0x2 ) { permute(inout,tmp,1); tmp=inout;} + if (perm & 0x4 ) { permute(inout,tmp,2); tmp=inout;} + if (perm & 0x8 ) { permute(inout,tmp,3); tmp=inout;} +} + +int main (int argc, char ** argv) +{ + Grid_init(&argc,&argv); + + Coordinate latt_size = GridDefaultLatt(); + Coordinate simd_layout= GridDefaultSimd(Nd,vComplexD::Nsimd()); + Coordinate mpi_layout = GridDefaultMpi(); + std::cout << " mpi "<({45,12,81,9})); + LatticeGaugeField Umu(&GRID); + + SU::HotConfiguration(pRNG,Umu); + + Real plaq=WilsonLoops::avgPlaquette(Umu); + LatticeComplex trplaq(&GRID); + + std::vector U(Nd, Umu.Grid()); + for (int mu = 0; mu < Nd; mu++) { + U[mu] = PeekIndex(Umu, mu); + } + WilsonLoops::traceDirPlaquette(trplaq,U,0,1); + + std::cout << GridLogMessage << " Average plaquette "< shifts; + // Umu(x) Unu(x+mu) Umu^dag(x+nu) Unu^dag(x) + Coordinate shift_0(Nd,0); + Coordinate shift_mu(Nd,0); shift_mu[mu]=1; + Coordinate shift_nu(Nd,0); shift_nu[nu]=1; + shifts.push_back(shift_0); + shifts.push_back(shift_mu); + shifts.push_back(shift_nu); + shifts.push_back(shift_0); + GeneralLocalStencil gStencil(GhostGrid,shifts); + + gplaq=Zero(); + WilsonLoops::traceDirPlaquette(trplaq,U,mu,nu); + + { + autoView( gp_v , gplaq, CpuWrite); + autoView( t_v , trplaq, CpuRead); + autoView( U_v , Ughost, CpuRead); + for(int ss=0;ss_offset; + int o1 = SE1->_offset; + int o2 = SE2->_offset; + int o3 = SE3->_offset; + + auto U0 = U_v[o0](mu); + auto U1 = U_v[o1](nu); + auto U2 = adj(U_v[o2](mu)); + auto U3 = adj(U_v[o3](nu)); + + gpermute(U0,SE0->_permute); + gpermute(U1,SE1->_permute); + gpermute(U2,SE2->_permute); + gpermute(U3,SE3->_permute); + + gp_v[ss]() = trace( U0*U1*U2*U3 ); + + } + } + cplaq = Ghost.Extract(gplaq); + std::cout << "["<