/************************************************************************************* Grid physics library, www.github.com/paboyle/Grid Source file: tests/core/Test_meson_field.cc Copyright (C) 2015-2018 Author: Felix Erben 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 *************************************************************************************/ #include #include using namespace Grid; typedef typename DomainWallFermionR::ComplexField ComplexField; typedef typename DomainWallFermionR::FermionField FermionField; int main(int argc, char *argv[]) { // initialization Grid_init(&argc, &argv); std::cout << GridLogMessage << "Grid initialized" << std::endl; Coordinate latt_size = GridDefaultLatt(); Coordinate simd_layout = GridDefaultSimd(4, vComplex::Nsimd()); Coordinate mpi_layout = GridDefaultMpi(); GridCartesian grid(latt_size,simd_layout,mpi_layout); // MesonField lhs and rhs vectors int mfDim = 3; std::vector phi(mfDim,&grid); std::vector rho(mfDim,&grid); std::vector seeds({1,2,3,4}); GridParallelRNG pRNG(&grid); pRNG.SeedFixedIntegers(seeds); for (unsigned int i = 0; i < mfDim; ++i){ random(pRNG,phi[i]); random(pRNG,rho[i]); //ideally only nonzero on t=0 } // Gamma matrices used in the contraction std::vector Gmu = { Gamma::Algebra::GammaX, Gamma::Algebra::GammaY, Gamma::Algebra::GammaZ, Gamma::Algebra::GammaT }; // momentum phases e^{ipx} std::vector> momenta = { {0.,0.,0.}, {1.,0.,0.}, {1.,1.,0.}, {1.,1.,1.}, {2.,0.,0.} }; std::vector phases(momenta.size(),&grid); ComplexField coor(&grid); Complex Ci(0.0,1.0); for (unsigned int j = 0; j < momenta.size(); ++j) { phases[j] = Zero(); for(unsigned int mu = 0; mu < momenta[j].size(); mu++) { LatticeCoordinate(coor, mu); phases[j] = phases[j] + momenta[j][mu]/GridDefaultLatt()[mu]*coor; } phases[j] = exp((Real)(2*M_PI)*Ci*phases[j]); } Eigen::Tensor mf(momenta.size(),Gmu.size(),GridDefaultLatt()[3],mfDim,mfDim); //execute meson field routine A2Autils::MesonField(mf,&phi[0],&phi[0],Gmu,phases,3); std::cout << mf << std::endl; // epilogue std::cout << GridLogMessage << "Grid is finalizing now" << std::endl; Grid_finalize(); return EXIT_SUCCESS; }