From b8a700436513001de3c49dca9dd21042b4337109 Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Mon, 14 Aug 2023 15:17:03 -0400 Subject: [PATCH] Partial fraction test --- tests/core/Test_fft_pf.cc | 307 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 307 insertions(+) create mode 100644 tests/core/Test_fft_pf.cc diff --git a/tests/core/Test_fft_pf.cc b/tests/core/Test_fft_pf.cc new file mode 100644 index 00000000..84e70a83 --- /dev/null +++ b/tests/core/Test_fft_pf.cc @@ -0,0 +1,307 @@ + /************************************************************************************* + + grid` physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_cshift.cc + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +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 + +using namespace Grid; + +int main (int argc, char ** argv) +{ + Grid_init(&argc,&argv); + + int threads = GridThread::GetThreads(); + std::cout< seeds({1,2,3,4}); + GridSerialRNG sRNG; sRNG.SeedFixedIntegers(seeds); // naughty seeding + GridParallelRNG pRNG(&GRID); + pRNG.SeedFixedIntegers(seeds); + + LatticeGaugeFieldD Umu(&GRID); + + SU::ColdConfiguration(pRNG,Umu); // Unit gauge + + //////////////////////////////////////////////////// + // PF prop + //////////////////////////////////////////////////// + LatticeFermionD src(&GRID); + + gaussian(pRNG,src); +#if 1 + Coordinate point(4,0); + src=Zero(); + SpinColourVectorD ferm; gaussian(sRNG,ferm); + pokeSite(ferm,src,point); +#endif + + { + std::cout<<"****************************************"< HermOp(Dov); + ConjugateGradient CG(1.0e-8,10000); + CG(HermOp,src5,result5); + //////////////////////////////////////////////////////////////////////// + // Domain wall physical field propagator + //////////////////////////////////////////////////////////////////////// + Dov.ExportPhysicalFermionSolution(result5,result4); + + // From DWF4d.pdf : + // + // Dov_pf = 2/(1-m) D_cayley_ovlap [ Page 43 ] + // Dinv_cayley_ovlap = 2/(1-m) Dinv_pf + // Dinv_cayley_surface =1/(1-m) ( Dinv_cayley_ovlap - 1 ) => 2/(1-m)^2 Dinv_pf - 1/(1-m) * src [ Eq.2.67 ] + + RealD scale = 2.0/(1.0-mass)/(1.0-mass); + result4 = result4 * scale; + result4 = result4 - src*(1.0/(1.0-mass)); // Subtract contact term + DumpSliceNorm("Src",src); + DumpSliceNorm("Grid",result4); + DumpSliceNorm("Fourier",ref); + + std::cout << "Dov result4 "< HermOp(Dov); + ConjugateGradient CG(1.0e-16,10000); + CG(HermOp,src5,result5); + + //////////////////////////////////////////////////////////////////////// + // Domain wall physical field propagator + //////////////////////////////////////////////////////////////////////// + /* + psi = chiralProjectMinus(psi_5[0]); + psi += chiralProjectPlus(psi_5[Ls-1]); + */ + ExtractSlice(tmp,result5,0 ,sdir); result4 = (tmp-G5*tmp)*0.5; + ExtractSlice(tmp,result5,Ls-1,sdir); result4 = result4+(tmp+G5*tmp)*0.5; + + std::cout << " Taking difference" < HermOp(Dov); + ConjugateGradient CG(1.0e-8,10000); + CG(HermOp,src5,result5); + //////////////////////////////////////////////////////////////////////// + // Domain wall physical field propagator + //////////////////////////////////////////////////////////////////////// + Dov.ExportPhysicalFermionSolution(result5,result4); + + // From DWF4d.pdf : + // + // Dov_pf = 2/(1-m) D_cayley_ovlap [ Page 43 ] + // Dinv_cayley_ovlap = 2/(1-m) Dinv_pf + // Dinv_cayley_surface =1/(1-m) ( Dinv_cayley_ovlap - 1 ) => 2/(1-m)^2 Dinv_pf - 1/(1-m) * src [ Eq.2.67 ] + + RealD scale = 2.0/(1.0-mass)/(1.0-mass); + result4 = result4 * scale; + result4 = result4 - src*(1.0/(1.0-mass)); // Subtract contact term + DumpSliceNorm("Src",src); + DumpSliceNorm("Grid",result4); + DumpSliceNorm("Fourier",ref); + + std::cout << "Dov result4 "<