|
| 1 | + /************************************************************************************* |
| 2 | +
|
| 3 | + Grid physics library, www.github.com/paboyle/Grid |
| 4 | +
|
| 5 | + Source file: ./tests/Test_quenched_update.cc |
| 6 | +
|
| 7 | + Copyright (C) 2015 |
| 8 | +
|
| 9 | +Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk> |
| 10 | +Author: Peter Boyle <paboyle@ph.ed.ac.uk> |
| 11 | +
|
| 12 | + This program is free software; you can redistribute it and/or modify |
| 13 | + it under the terms of the GNU General Public License as published by |
| 14 | + the Free Software Foundation; either version 2 of the License, or |
| 15 | + (at your option) any later version. |
| 16 | +
|
| 17 | + This program is distributed in the hope that it will be useful, |
| 18 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | + GNU General Public License for more details. |
| 21 | +
|
| 22 | + You should have received a copy of the GNU General Public License along |
| 23 | + with this program; if not, write to the Free Software Foundation, Inc., |
| 24 | + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 25 | +
|
| 26 | + See the full license in the file "LICENSE" in the top level distribution directory |
| 27 | + *************************************************************************************/ |
| 28 | + /* END LEGAL */ |
| 29 | +#include <Grid/Grid.h> |
| 30 | + |
| 31 | +using namespace std; |
| 32 | +using namespace Grid; |
| 33 | + ; |
| 34 | + |
| 35 | +int main (int argc, char ** argv) |
| 36 | +{ |
| 37 | + Grid_init(&argc,&argv); |
| 38 | + |
| 39 | + std::vector<int> latt({8,8,8,8}); |
| 40 | + GridCartesian * grid = SpaceTimeGrid::makeFourDimGrid(latt, |
| 41 | + GridDefaultSimd(Nd,vComplexD::Nsimd()), |
| 42 | + GridDefaultMpi()); |
| 43 | + |
| 44 | + GridCartesian * gridF = SpaceTimeGrid::makeFourDimGrid(latt, |
| 45 | + GridDefaultSimd(Nd,vComplexF::Nsimd()), |
| 46 | + GridDefaultMpi()); |
| 47 | + |
| 48 | + |
| 49 | + /////////////////////////////// |
| 50 | + // Configuration of known size |
| 51 | + /////////////////////////////// |
| 52 | + LatticeColourMatrixD ident(grid); |
| 53 | + LatticeColourMatrixD U(grid); |
| 54 | + LatticeColourMatrixD tmp(grid); |
| 55 | + LatticeColourMatrixD org(grid); |
| 56 | + LatticeColourMatrixF UF(gridF); |
| 57 | + |
| 58 | + LatticeGaugeField Umu(grid); |
| 59 | + |
| 60 | + ident =1.0; |
| 61 | + |
| 62 | + // RNG set up for test |
| 63 | + std::vector<int> pseeds({1,2,3,4,5}); // once I caught a fish alive |
| 64 | + std::vector<int> sseeds({6,7,8,9,10});// then i let it go again |
| 65 | + GridParallelRNG pRNG(grid); pRNG.SeedFixedIntegers(pseeds); |
| 66 | + GridSerialRNG sRNG; sRNG.SeedFixedIntegers(sseeds); |
| 67 | + |
| 68 | + SU<Nc>::HotConfiguration(pRNG,Umu); |
| 69 | + |
| 70 | + U = PeekIndex<LorentzIndex>(Umu,0); |
| 71 | + org=U; |
| 72 | + |
| 73 | + |
| 74 | + tmp= U*adj(U) - ident ; |
| 75 | + RealD Def1 = norm2( tmp ); |
| 76 | + std::cout << " Defect1 "<<Def1<<std::endl; |
| 77 | + |
| 78 | + tmp = U - org; |
| 79 | + std::cout << "Diff1 "<<norm2(tmp)<<std::endl; |
| 80 | + precisionChange(UF,U); |
| 81 | + precisionChange(U,UF); |
| 82 | + |
| 83 | + tmp= U*adj(U) - ident ; |
| 84 | + RealD Def2 = norm2( tmp ); |
| 85 | + std::cout << " Defect2 "<<Def2<<std::endl; |
| 86 | + |
| 87 | + tmp = U - org; |
| 88 | + std::cout << "Diff2 "<<norm2(tmp)<<std::endl; |
| 89 | + |
| 90 | + U = ProjectOnGroup(U); |
| 91 | + |
| 92 | + tmp= U*adj(U) - ident ; |
| 93 | + RealD Def3 = norm2( tmp); |
| 94 | + std::cout << " Defect3 "<<Def3<<std::endl; |
| 95 | + |
| 96 | + |
| 97 | + tmp = U - org; |
| 98 | + std::cout << "Diff3 "<<norm2(tmp)<<std::endl; |
| 99 | + |
| 100 | + |
| 101 | + Grid_finalize(); |
| 102 | +} |
| 103 | + |
| 104 | + |
| 105 | + |
| 106 | + |
0 commit comments