mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-13 20:57:06 +01:00
Merge remote-tracking branch 'upstream/develop' into feature/ddalphaamg
This commit is contained in:
357
tests/core/Test_wilson_clover.cc
Normal file
357
tests/core/Test_wilson_clover.cc
Normal file
@ -0,0 +1,357 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./benchmarks/Benchmark_wilson.cc
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: Guido Cossu <guido.cossu@ed.ac.uk>
|
||||
|
||||
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 <Grid/Grid.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Grid;
|
||||
using namespace Grid::QCD;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Grid_init(&argc, &argv);
|
||||
|
||||
std::vector<int> latt_size = GridDefaultLatt();
|
||||
std::vector<int> simd_layout = GridDefaultSimd(Nd, vComplex::Nsimd());
|
||||
std::vector<int> mpi_layout = GridDefaultMpi();
|
||||
GridCartesian Grid(latt_size, simd_layout, mpi_layout);
|
||||
GridRedBlackCartesian RBGrid(&Grid);
|
||||
|
||||
int threads = GridThread::GetThreads();
|
||||
std::cout << GridLogMessage << "Grid is setup to use " << threads << " threads" << std::endl;
|
||||
std::cout << GridLogMessage << "Grid floating point word size is REALF" << sizeof(RealF) << std::endl;
|
||||
std::cout << GridLogMessage << "Grid floating point word size is REALD" << sizeof(RealD) << std::endl;
|
||||
std::cout << GridLogMessage << "Grid floating point word size is REAL" << sizeof(Real) << std::endl;
|
||||
|
||||
std::vector<int> seeds({1, 2, 3, 4});
|
||||
GridParallelRNG pRNG(&Grid);
|
||||
pRNG.SeedFixedIntegers(seeds);
|
||||
// pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9});
|
||||
|
||||
typedef typename WilsonCloverFermionR::FermionField FermionField;
|
||||
typename WilsonCloverFermionR::ImplParams params;
|
||||
WilsonAnisotropyCoefficients anis;
|
||||
|
||||
FermionField src(&Grid);
|
||||
random(pRNG, src);
|
||||
FermionField result(&Grid);
|
||||
result = zero;
|
||||
FermionField result2(&Grid);
|
||||
result2 = zero;
|
||||
FermionField ref(&Grid);
|
||||
ref = zero;
|
||||
FermionField tmp(&Grid);
|
||||
tmp = zero;
|
||||
FermionField err(&Grid);
|
||||
err = zero;
|
||||
FermionField err2(&Grid);
|
||||
err2 = zero;
|
||||
FermionField phi(&Grid);
|
||||
random(pRNG, phi);
|
||||
FermionField chi(&Grid);
|
||||
random(pRNG, chi);
|
||||
LatticeGaugeField Umu(&Grid);
|
||||
SU3::HotConfiguration(pRNG, Umu);
|
||||
std::vector<LatticeColourMatrix> U(4, &Grid);
|
||||
|
||||
double volume = 1;
|
||||
for (int mu = 0; mu < Nd; mu++)
|
||||
{
|
||||
volume = volume * latt_size[mu];
|
||||
}
|
||||
|
||||
RealD mass = 0.1;
|
||||
RealD csw_r = 1.0;
|
||||
RealD csw_t = 1.0;
|
||||
|
||||
WilsonCloverFermionR Dwc(Umu, Grid, RBGrid, mass, csw_r, csw_t, anis, params);
|
||||
//Dwc.ImportGauge(Umu); // not necessary, included in the constructor
|
||||
|
||||
std::cout << GridLogMessage << "==========================================================" << std::endl;
|
||||
std::cout << GridLogMessage << "= Testing that Deo + Doe = Dunprec " << std::endl;
|
||||
std::cout << GridLogMessage << "==========================================================" << std::endl;
|
||||
|
||||
FermionField src_e(&RBGrid);
|
||||
FermionField src_o(&RBGrid);
|
||||
FermionField r_e(&RBGrid);
|
||||
FermionField r_o(&RBGrid);
|
||||
FermionField r_eo(&Grid);
|
||||
pickCheckerboard(Even, src_e, src);
|
||||
pickCheckerboard(Odd, src_o, src);
|
||||
|
||||
Dwc.Meooe(src_e, r_o);
|
||||
std::cout << GridLogMessage << "Applied Meo" << std::endl;
|
||||
Dwc.Meooe(src_o, r_e);
|
||||
std::cout << GridLogMessage << "Applied Moe" << std::endl;
|
||||
Dwc.Dhop(src, ref, DaggerNo);
|
||||
|
||||
setCheckerboard(r_eo, r_o);
|
||||
setCheckerboard(r_eo, r_e);
|
||||
|
||||
err = ref - r_eo;
|
||||
std::cout << GridLogMessage << "EO norm diff " << norm2(err) << " " << norm2(ref) << " " << norm2(r_eo) << std::endl;
|
||||
|
||||
std::cout << GridLogMessage << "==============================================================" << std::endl;
|
||||
std::cout << GridLogMessage << "= Test Ddagger is the dagger of D by requiring " << std::endl;
|
||||
std::cout << GridLogMessage << "= < phi | Deo | chi > * = < chi | Deo^dag| phi> " << std::endl;
|
||||
std::cout << GridLogMessage << "==============================================================" << std::endl;
|
||||
|
||||
FermionField chi_e(&RBGrid);
|
||||
FermionField chi_o(&RBGrid);
|
||||
|
||||
FermionField dchi_e(&RBGrid);
|
||||
FermionField dchi_o(&RBGrid);
|
||||
|
||||
FermionField phi_e(&RBGrid);
|
||||
FermionField phi_o(&RBGrid);
|
||||
|
||||
FermionField dphi_e(&RBGrid);
|
||||
FermionField dphi_o(&RBGrid);
|
||||
|
||||
pickCheckerboard(Even, chi_e, chi);
|
||||
pickCheckerboard(Odd, chi_o, chi);
|
||||
pickCheckerboard(Even, phi_e, phi);
|
||||
pickCheckerboard(Odd, phi_o, phi);
|
||||
|
||||
Dwc.Meooe(chi_e, dchi_o);
|
||||
Dwc.Meooe(chi_o, dchi_e);
|
||||
Dwc.MeooeDag(phi_e, dphi_o);
|
||||
Dwc.MeooeDag(phi_o, dphi_e);
|
||||
|
||||
ComplexD pDce = innerProduct(phi_e, dchi_e);
|
||||
ComplexD pDco = innerProduct(phi_o, dchi_o);
|
||||
ComplexD cDpe = innerProduct(chi_e, dphi_e);
|
||||
ComplexD cDpo = innerProduct(chi_o, dphi_o);
|
||||
|
||||
std::cout << GridLogMessage << "e " << pDce << " " << cDpe << std::endl;
|
||||
std::cout << GridLogMessage << "o " << pDco << " " << cDpo << std::endl;
|
||||
|
||||
std::cout << GridLogMessage << "pDce - conj(cDpo) " << pDce - conj(cDpo) << std::endl;
|
||||
std::cout << GridLogMessage << "pDco - conj(cDpe) " << pDco - conj(cDpe) << std::endl;
|
||||
|
||||
std::cout << GridLogMessage << "==============================================================" << std::endl;
|
||||
std::cout << GridLogMessage << "= Test MeeInv Mee = 1 (if csw!=0) " << std::endl;
|
||||
std::cout << GridLogMessage << "==============================================================" << std::endl;
|
||||
|
||||
pickCheckerboard(Even, chi_e, chi);
|
||||
pickCheckerboard(Odd, chi_o, chi);
|
||||
|
||||
Dwc.Mooee(chi_e, src_e);
|
||||
Dwc.MooeeInv(src_e, phi_e);
|
||||
|
||||
Dwc.Mooee(chi_o, src_o);
|
||||
Dwc.MooeeInv(src_o, phi_o);
|
||||
|
||||
setCheckerboard(phi, phi_e);
|
||||
setCheckerboard(phi, phi_o);
|
||||
|
||||
err = phi - chi;
|
||||
std::cout << GridLogMessage << "norm diff " << norm2(err) << std::endl;
|
||||
|
||||
std::cout << GridLogMessage << "==============================================================" << std::endl;
|
||||
std::cout << GridLogMessage << "= Test MeeDag MeeInvDag = 1 (if csw!=0) " << std::endl;
|
||||
std::cout << GridLogMessage << "==============================================================" << std::endl;
|
||||
|
||||
pickCheckerboard(Even, chi_e, chi);
|
||||
pickCheckerboard(Odd, chi_o, chi);
|
||||
|
||||
Dwc.MooeeDag(chi_e, src_e);
|
||||
Dwc.MooeeInvDag(src_e, phi_e);
|
||||
|
||||
Dwc.MooeeDag(chi_o, src_o);
|
||||
Dwc.MooeeInvDag(src_o, phi_o);
|
||||
|
||||
setCheckerboard(phi, phi_e);
|
||||
setCheckerboard(phi, phi_o);
|
||||
|
||||
err = phi - chi;
|
||||
std::cout << GridLogMessage << "norm diff " << norm2(err) << std::endl;
|
||||
|
||||
std::cout << GridLogMessage << "==============================================================" << std::endl;
|
||||
std::cout << GridLogMessage << "= Test MeeInv MeeDag = 1 (if csw!=0) " << std::endl;
|
||||
std::cout << GridLogMessage << "==============================================================" << std::endl;
|
||||
|
||||
pickCheckerboard(Even, chi_e, chi);
|
||||
pickCheckerboard(Odd, chi_o, chi);
|
||||
|
||||
Dwc.MooeeDag(chi_e, src_e);
|
||||
Dwc.MooeeInv(src_e, phi_e);
|
||||
|
||||
Dwc.MooeeDag(chi_o, src_o);
|
||||
Dwc.MooeeInv(src_o, phi_o);
|
||||
|
||||
setCheckerboard(phi, phi_e);
|
||||
setCheckerboard(phi, phi_o);
|
||||
|
||||
err = phi - chi;
|
||||
std::cout << GridLogMessage << "norm diff " << norm2(err) << std::endl;
|
||||
|
||||
std::cout << GridLogMessage << "================================================================" << std::endl;
|
||||
std::cout << GridLogMessage << "= Testing gauge covariance Clover term with EO preconditioning " << std::endl;
|
||||
std::cout << GridLogMessage << "================================================================" << std::endl;
|
||||
|
||||
chi = zero;
|
||||
phi = zero;
|
||||
tmp = zero;
|
||||
pickCheckerboard(Even, chi_e, chi);
|
||||
pickCheckerboard(Odd, chi_o, chi);
|
||||
pickCheckerboard(Even, phi_e, phi);
|
||||
pickCheckerboard(Odd, phi_o, phi);
|
||||
|
||||
Dwc.Mooee(src_e, chi_e);
|
||||
Dwc.Mooee(src_o, chi_o);
|
||||
setCheckerboard(chi, chi_e);
|
||||
setCheckerboard(chi, chi_o);
|
||||
setCheckerboard(src, src_e);
|
||||
setCheckerboard(src, src_o);
|
||||
|
||||
////////////////////// Gauge Transformation
|
||||
std::vector<int> seeds2({5, 6, 7, 8});
|
||||
GridParallelRNG pRNG2(&Grid);
|
||||
pRNG2.SeedFixedIntegers(seeds2);
|
||||
LatticeColourMatrix Omega(&Grid);
|
||||
LatticeColourMatrix ShiftedOmega(&Grid);
|
||||
LatticeGaugeField U_prime(&Grid);
|
||||
U_prime = zero;
|
||||
LatticeColourMatrix U_prime_mu(&Grid);
|
||||
U_prime_mu = zero;
|
||||
SU<Nc>::LieRandomize(pRNG2, Omega, 1.0);
|
||||
for (int mu = 0; mu < Nd; mu++)
|
||||
{
|
||||
U[mu] = peekLorentz(Umu, mu);
|
||||
ShiftedOmega = Cshift(Omega, mu, 1);
|
||||
U_prime_mu = Omega * U[mu] * adj(ShiftedOmega);
|
||||
pokeLorentz(U_prime, U_prime_mu, mu);
|
||||
}
|
||||
/////////////////
|
||||
|
||||
WilsonCloverFermionR Dwc_prime(U_prime, Grid, RBGrid, mass, csw_r, csw_t, anis, params);
|
||||
Dwc_prime.ImportGauge(U_prime);
|
||||
|
||||
tmp = Omega * src;
|
||||
pickCheckerboard(Even, src_e, tmp);
|
||||
pickCheckerboard(Odd, src_o, tmp);
|
||||
|
||||
Dwc_prime.Mooee(src_e, phi_e);
|
||||
Dwc_prime.Mooee(src_o, phi_o);
|
||||
|
||||
setCheckerboard(phi, phi_e);
|
||||
setCheckerboard(phi, phi_o);
|
||||
|
||||
err = chi - adj(Omega) * phi;
|
||||
std::cout << GridLogMessage << "norm diff " << norm2(err) << std::endl;
|
||||
|
||||
std::cout << GridLogMessage << "=================================================================" << std::endl;
|
||||
std::cout << GridLogMessage << "= Testing gauge covariance Clover term w/o EO preconditioning " << std::endl;
|
||||
std::cout << GridLogMessage << "================================================================" << std::endl;
|
||||
|
||||
chi = zero;
|
||||
phi = zero;
|
||||
|
||||
WilsonFermionR Dw(Umu, Grid, RBGrid, mass, params);
|
||||
Dw.ImportGauge(Umu);
|
||||
|
||||
Dw.M(src, result);
|
||||
Dwc.M(src, chi);
|
||||
|
||||
Dwc_prime.M(Omega * src, phi);
|
||||
|
||||
WilsonFermionR Dw_prime(U_prime, Grid, RBGrid, mass, params);
|
||||
Dw_prime.ImportGauge(U_prime);
|
||||
Dw_prime.M(Omega * src, result2);
|
||||
|
||||
err = chi - adj(Omega) * phi;
|
||||
err2 = result - adj(Omega) * result2;
|
||||
std::cout << GridLogMessage << "norm diff Wilson " << norm2(err) << std::endl;
|
||||
std::cout << GridLogMessage << "norm diff WilsonClover " << norm2(err2) << std::endl;
|
||||
|
||||
std::cout << GridLogMessage << "==========================================================" << std::endl;
|
||||
std::cout << GridLogMessage << "= Testing Mooee(csw=0) Clover to reproduce Mooee Wilson " << std::endl;
|
||||
std::cout << GridLogMessage << "==========================================================" << std::endl;
|
||||
|
||||
chi = zero;
|
||||
phi = zero;
|
||||
err = zero;
|
||||
WilsonCloverFermionR Dwc_csw0(Umu, Grid, RBGrid, mass, 0.0, 0.0, anis, params); // <-- Notice: csw=0
|
||||
Dwc_csw0.ImportGauge(Umu);
|
||||
|
||||
pickCheckerboard(Even, phi_e, phi);
|
||||
pickCheckerboard(Odd, phi_o, phi);
|
||||
pickCheckerboard(Even, chi_e, chi);
|
||||
pickCheckerboard(Odd, chi_o, chi);
|
||||
|
||||
Dw.Mooee(src_e, chi_e);
|
||||
Dw.Mooee(src_o, chi_o);
|
||||
Dwc_csw0.Mooee(src_e, phi_e);
|
||||
Dwc_csw0.Mooee(src_o, phi_o);
|
||||
|
||||
setCheckerboard(chi, chi_e);
|
||||
setCheckerboard(chi, chi_o);
|
||||
setCheckerboard(phi, phi_e);
|
||||
setCheckerboard(phi, phi_o);
|
||||
setCheckerboard(src, src_e);
|
||||
setCheckerboard(src, src_o);
|
||||
|
||||
err = chi - phi;
|
||||
std::cout << GridLogMessage << "norm diff " << norm2(err) << std::endl;
|
||||
|
||||
std::cout << GridLogMessage << "==========================================================" << std::endl;
|
||||
std::cout << GridLogMessage << "= Testing EO operator is equal to the unprec " << std::endl;
|
||||
std::cout << GridLogMessage << "==========================================================" << std::endl;
|
||||
|
||||
chi = zero;
|
||||
phi = zero;
|
||||
err = zero;
|
||||
|
||||
pickCheckerboard(Even, phi_e, phi);
|
||||
pickCheckerboard(Odd, phi_o, phi);
|
||||
pickCheckerboard(Even, chi_e, chi);
|
||||
pickCheckerboard(Odd, chi_o, chi);
|
||||
|
||||
// M phi = (Mooee src_e + Meooe src_o , Meooe src_e + Mooee src_o)
|
||||
|
||||
Dwc.M(src, ref); // Reference result from the unpreconditioned operator
|
||||
|
||||
// EO matrix
|
||||
Dwc.Mooee(src_e, chi_e);
|
||||
Dwc.Mooee(src_o, chi_o);
|
||||
Dwc.Meooe(src_o, phi_e);
|
||||
Dwc.Meooe(src_e, phi_o);
|
||||
|
||||
phi_o += chi_o;
|
||||
phi_e += chi_e;
|
||||
|
||||
setCheckerboard(phi, phi_e);
|
||||
setCheckerboard(phi, phi_o);
|
||||
|
||||
err = ref - phi;
|
||||
std::cout << GridLogMessage << "ref (unpreconditioned operator) diff :" << norm2(ref) << std::endl;
|
||||
std::cout << GridLogMessage << "phi (EO decomposition) diff :" << norm2(phi) << std::endl;
|
||||
std::cout << GridLogMessage << "norm diff :" << norm2(err) << std::endl;
|
||||
|
||||
Grid_finalize();
|
||||
}
|
@ -50,7 +50,12 @@ int main (int argc, char ** argv)
|
||||
std::vector<int> seeds({1,2,3,4});
|
||||
|
||||
GridParallelRNG pRNG(&Grid);
|
||||
pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||
std::vector<int> vrand(4);
|
||||
std::srand(std::time(0));
|
||||
std::generate(vrand.begin(), vrand.end(), std::rand);
|
||||
std::cout << GridLogMessage << vrand << std::endl;
|
||||
pRNG.SeedFixedIntegers(vrand);
|
||||
//pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||
|
||||
LatticeFermion phi (&Grid); gaussian(pRNG,phi);
|
||||
LatticeFermion Mphi (&Grid);
|
||||
|
194
tests/forces/Test_wilsonclover_force.cc
Normal file
194
tests/forces/Test_wilsonclover_force.cc
Normal file
@ -0,0 +1,194 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./tests/Test_wilson_force.cc
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||
|
||||
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 <Grid/Grid.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Grid;
|
||||
using namespace Grid::QCD;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Grid_init(&argc, &argv);
|
||||
|
||||
std::vector<int> latt_size = GridDefaultLatt();
|
||||
std::vector<int> simd_layout = GridDefaultSimd(Nd, vComplex::Nsimd());
|
||||
std::vector<int> mpi_layout = GridDefaultMpi();
|
||||
|
||||
GridCartesian Grid(latt_size, simd_layout, mpi_layout);
|
||||
GridRedBlackCartesian RBGrid(&Grid);
|
||||
|
||||
int threads = GridThread::GetThreads();
|
||||
std::cout << GridLogMessage << "Grid is setup to use " << threads << " threads" << std::endl;
|
||||
|
||||
std::vector<int> seeds({1, 2, 30, 50});
|
||||
|
||||
GridParallelRNG pRNG(&Grid);
|
||||
|
||||
std::vector<int> vrand(4);
|
||||
std::srand(std::time(0));
|
||||
std::generate(vrand.begin(), vrand.end(), std::rand);
|
||||
std::cout << GridLogMessage << vrand << std::endl;
|
||||
pRNG.SeedFixedIntegers(vrand);
|
||||
//pRNG.SeedFixedIntegers(seeds);
|
||||
|
||||
LatticeFermion phi(&Grid);
|
||||
gaussian(pRNG, phi);
|
||||
LatticeFermion Mphi(&Grid);
|
||||
LatticeFermion MphiPrime(&Grid);
|
||||
|
||||
LatticeGaugeField U(&Grid);
|
||||
|
||||
std::vector<int> site = {0, 0, 0, 0};
|
||||
SU3::HotConfiguration(pRNG, U);
|
||||
//SU3::ColdConfiguration(pRNG, U);// Clover term zero
|
||||
|
||||
////////////////////////////////////
|
||||
// Unmodified matrix element
|
||||
////////////////////////////////////
|
||||
RealD mass = 0.1;
|
||||
Real csw = 1.0;
|
||||
WilsonCloverFermionR Dw(U, Grid, RBGrid, mass, csw, csw);
|
||||
Dw.ImportGauge(U);
|
||||
Dw.M(phi, Mphi);
|
||||
ComplexD S = innerProduct(Mphi, Mphi); // Action : pdag MdagM p
|
||||
|
||||
// get the deriv of phidag MdagM phi with respect to "U"
|
||||
LatticeGaugeField UdSdU(&Grid);
|
||||
LatticeGaugeField tmp(&Grid);
|
||||
|
||||
////////////////////////////////////////////
|
||||
Dw.MDeriv(tmp, Mphi, phi, DaggerNo);
|
||||
UdSdU = tmp;
|
||||
Dw.MDeriv(tmp, phi, Mphi, DaggerYes);
|
||||
UdSdU += tmp;
|
||||
/////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////
|
||||
// Modify the gauge field a little
|
||||
////////////////////////////////////
|
||||
RealD dt = 0.00005;
|
||||
RealD Hmom = 0.0;
|
||||
RealD Hmomprime = 0.0;
|
||||
RealD Hmompp = 0.0;
|
||||
LatticeColourMatrix mommu(&Grid);
|
||||
LatticeColourMatrix forcemu(&Grid);
|
||||
LatticeGaugeField mom(&Grid);
|
||||
LatticeGaugeField Uprime(&Grid);
|
||||
|
||||
for (int mu = 0; mu < Nd; mu++)
|
||||
{
|
||||
// Traceless antihermitian momentum; gaussian in lie alg
|
||||
SU3::GaussianFundamentalLieAlgebraMatrix(pRNG, mommu);
|
||||
Hmom -= real(sum(trace(mommu * mommu)));
|
||||
PokeIndex<LorentzIndex>(mom, mommu, mu);
|
||||
|
||||
parallel_for(int ss = 0; ss < mom._grid->oSites(); ss++)
|
||||
{
|
||||
Uprime[ss]._internal[mu] = ProjectOnGroup(Exponentiate(mom[ss]._internal[mu], dt, 12) * U[ss]._internal[mu]);
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << GridLogMessage << "Initial mom hamiltonian is " << Hmom << std::endl;
|
||||
|
||||
// New action
|
||||
Dw.ImportGauge(Uprime);
|
||||
Dw.M(phi, MphiPrime);
|
||||
ComplexD Sprime = innerProduct(MphiPrime, MphiPrime);
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// Use derivative to estimate dS
|
||||
//////////////////////////////////////////////
|
||||
|
||||
LatticeComplex dS(&Grid);
|
||||
dS = zero;
|
||||
LatticeComplex dSmom(&Grid);
|
||||
dSmom = zero;
|
||||
LatticeComplex dSmom2(&Grid);
|
||||
dSmom2 = zero;
|
||||
|
||||
for (int mu = 0; mu < Nd; mu++)
|
||||
{
|
||||
mommu = PeekIndex<LorentzIndex>(UdSdU, mu); // P_mu =
|
||||
mommu = Ta(mommu) * 2.0; // Mom = (P_mu - P_mu^dag) - trace(P_mu - P_mu^dag)
|
||||
PokeIndex<LorentzIndex>(UdSdU, mommu, mu); // UdSdU_mu = Mom
|
||||
}
|
||||
|
||||
std::cout << GridLogMessage << "Antihermiticity tests" << std::endl;
|
||||
for (int mu = 0; mu < Nd; mu++)
|
||||
{
|
||||
mommu = PeekIndex<LorentzIndex>(mom, mu);
|
||||
std::cout << GridLogMessage << " Mommu " << norm2(mommu) << std::endl;
|
||||
mommu = mommu + adj(mommu);
|
||||
std::cout << GridLogMessage << " Mommu + Mommudag " << norm2(mommu) << std::endl;
|
||||
mommu = PeekIndex<LorentzIndex>(UdSdU, mu);
|
||||
std::cout << GridLogMessage << " dsdumu " << norm2(mommu) << std::endl;
|
||||
mommu = mommu + adj(mommu);
|
||||
std::cout << GridLogMessage << " dsdumu + dag " << norm2(mommu) << std::endl;
|
||||
std::cout << "" << std::endl;
|
||||
}
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
for (int mu = 0; mu < Nd; mu++)
|
||||
{
|
||||
forcemu = PeekIndex<LorentzIndex>(UdSdU, mu);
|
||||
mommu = PeekIndex<LorentzIndex>(mom, mu);
|
||||
|
||||
// Update PF action density
|
||||
dS = dS + trace(mommu * forcemu) * dt;
|
||||
|
||||
dSmom = dSmom - trace(mommu * forcemu) * dt;
|
||||
dSmom2 = dSmom2 - trace(forcemu * forcemu) * (0.25 * dt * dt);
|
||||
|
||||
// Update mom action density
|
||||
mommu = mommu + forcemu * (dt * 0.5);
|
||||
|
||||
Hmomprime -= real(sum(trace(mommu * mommu)));
|
||||
}
|
||||
|
||||
ComplexD dSpred = sum(dS);
|
||||
ComplexD dSm = sum(dSmom);
|
||||
ComplexD dSm2 = sum(dSmom2);
|
||||
|
||||
std::cout << GridLogMessage << "Initial mom hamiltonian is " << Hmom << std::endl;
|
||||
std::cout << GridLogMessage << "Final mom hamiltonian is " << Hmomprime << std::endl;
|
||||
std::cout << GridLogMessage << "Delta mom hamiltonian is " << Hmomprime - Hmom << std::endl;
|
||||
|
||||
std::cout << GridLogMessage << " S " << S << std::endl;
|
||||
std::cout << GridLogMessage << " Sprime " << Sprime << std::endl;
|
||||
std::cout << GridLogMessage << "dS (S' - S) :" << Sprime - S << std::endl;
|
||||
std::cout << GridLogMessage << "predict dS (force) :" << dSpred << std::endl;
|
||||
std::cout << GridLogMessage << "dSm " << dSm << std::endl;
|
||||
std::cout << GridLogMessage << "dSm2" << dSm2 << std::endl;
|
||||
|
||||
std::cout << GridLogMessage << "Total dS " << Hmomprime - Hmom + Sprime - S << std::endl;
|
||||
|
||||
assert(fabs(real(Sprime - S - dSpred)) < 1.0);
|
||||
|
||||
std::cout << GridLogMessage << "Done" << std::endl;
|
||||
Grid_finalize();
|
||||
}
|
168
tests/hadrons/Test_hadrons_2AS_spectrum.cc
Normal file
168
tests/hadrons/Test_hadrons_2AS_spectrum.cc
Normal file
@ -0,0 +1,168 @@
|
||||
/*******************************************************************************
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: tests/hadrons/Test_hadrons_spectrum.cc
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: Antonin Portelli <antonin.portelli@me.com>
|
||||
|
||||
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 <Grid/Hadrons/Application.hpp>
|
||||
|
||||
using namespace Grid;
|
||||
using namespace Hadrons;
|
||||
|
||||
|
||||
BEGIN_HADRONS_NAMESPACE
|
||||
BEGIN_MODULE_NAMESPACE(MFermion)
|
||||
MODULE_REGISTER_NS(GaugeProp2AS, TGaugeProp<WilsonTwoIndexAntiSymmetricImplR>, MFermion);
|
||||
END_MODULE_NAMESPACE
|
||||
BEGIN_MODULE_NAMESPACE(MSource)
|
||||
MODULE_REGISTER_NS(Point2AS, TPoint<WilsonTwoIndexAntiSymmetricImplR>, MSource);
|
||||
END_MODULE_NAMESPACE
|
||||
BEGIN_MODULE_NAMESPACE(MContraction)
|
||||
MODULE_REGISTER_NS(Meson2AS, ARG(TMeson<WilsonTwoIndexAntiSymmetricImplR, WilsonTwoIndexAntiSymmetricImplR>), MContraction);
|
||||
// MODULE_REGISTER_NS(BaryonMultirep, ARG(TBaryon<FIMPL, FIMPL, FIMPL>), MContraction);
|
||||
END_MODULE_NAMESPACE
|
||||
BEGIN_MODULE_NAMESPACE(MSink)
|
||||
MODULE_REGISTER_NS(ScalarPoint2AS, TPoint<WilsonTwoIndexAntiSymmetricImplR>, MSink);
|
||||
END_MODULE_NAMESPACE
|
||||
BEGIN_MODULE_NAMESPACE(MSolver)
|
||||
MODULE_REGISTER_NS(RBPrecCG2AS, TRBPrecCG<WilsonTwoIndexAntiSymmetricImplR>, MSolver);
|
||||
END_MODULE_NAMESPACE
|
||||
BEGIN_MODULE_NAMESPACE(MAction)
|
||||
MODULE_REGISTER_NS(WilsonClover2AS, TWilsonClover<WilsonTwoIndexAntiSymmetricImplR>, MAction);
|
||||
END_MODULE_NAMESPACE
|
||||
END_HADRONS_NAMESPACE
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// initialization //////////////////////////////////////////////////////////
|
||||
Grid_init(&argc, &argv);
|
||||
HadronsLogError.Active(GridLogError.isActive());
|
||||
HadronsLogWarning.Active(GridLogWarning.isActive());
|
||||
HadronsLogMessage.Active(GridLogMessage.isActive());
|
||||
HadronsLogIterative.Active(GridLogIterative.isActive());
|
||||
HadronsLogDebug.Active(GridLogDebug.isActive());
|
||||
LOG(Message) << "Grid initialized" << std::endl;
|
||||
// run setup ///////////////////////////////////////////////////////////////
|
||||
Application application;
|
||||
std::vector<std::string> flavour = {"l", "s"};
|
||||
std::vector<double> mass = {-0.01, -0.04};
|
||||
double csw = 1.0;
|
||||
// global parameters
|
||||
Application::GlobalPar globalPar;
|
||||
globalPar.trajCounter.start = 1500;
|
||||
globalPar.trajCounter.end = 1520;
|
||||
globalPar.trajCounter.step = 20;
|
||||
globalPar.seed = "1 2 3 4";
|
||||
application.setPar(globalPar);
|
||||
// gauge field
|
||||
application.createModule<MGauge::Unit>("gauge");
|
||||
MSource::Point2AS::Par ptPar;
|
||||
ptPar.position = "0 0 0 0";
|
||||
application.createModule<MSource::Point2AS>("pt", ptPar);
|
||||
// sink
|
||||
MSink::ScalarPoint2AS::Par sinkPar;
|
||||
sinkPar.mom = "0 0 0";
|
||||
application.createModule<MSink::ScalarPoint2AS>("sink", sinkPar);
|
||||
|
||||
// set fermion boundary conditions to be periodic space, antiperiodic time.
|
||||
std::string boundary = "1 1 1 -1";
|
||||
|
||||
for (unsigned int i = 0; i < flavour.size(); ++i)
|
||||
{
|
||||
// actions
|
||||
MAction::WilsonClover2AS::Par actionPar;
|
||||
actionPar.gauge = "gauge";
|
||||
actionPar.mass = mass[i];
|
||||
actionPar.csw_r = csw;
|
||||
actionPar.csw_t = csw;
|
||||
actionPar.clover_anisotropy.isAnisotropic= false;
|
||||
actionPar.clover_anisotropy.t_direction = Nd-1 ;
|
||||
actionPar.clover_anisotropy.xi_0 = 1.0 ;
|
||||
actionPar.clover_anisotropy.nu = 1.0 ;
|
||||
actionPar.boundary = boundary;
|
||||
application.createModule<MAction::WilsonClover2AS>("WilsonClover2AS_" + flavour[i], actionPar);
|
||||
|
||||
// solvers
|
||||
MSolver::RBPrecCG2AS::Par solverPar;
|
||||
solverPar.action = "WilsonClover2AS_" + flavour[i];
|
||||
solverPar.residual = 1.0e-8;
|
||||
application.createModule<MSolver::RBPrecCG2AS>("CG_" + flavour[i],
|
||||
solverPar);
|
||||
|
||||
// propagators
|
||||
MFermion::GaugeProp2AS::Par quarkPar;
|
||||
quarkPar.solver = "CG_" + flavour[i];
|
||||
quarkPar.source = "pt";
|
||||
application.createModule<MFermion::GaugeProp2AS>("Qpt_" + flavour[i], quarkPar);
|
||||
quarkPar.source = "z2";
|
||||
application.createModule<MFermion::GaugeProp2AS>("QZ2_" + flavour[i], quarkPar);
|
||||
}
|
||||
for (unsigned int i = 0; i < flavour.size(); ++i)
|
||||
for (unsigned int j = i; j < flavour.size(); ++j)
|
||||
{
|
||||
MContraction::Meson2AS::Par mesPar;
|
||||
|
||||
mesPar.output = "mesons2AS/pt_" + flavour[i] + flavour[j];
|
||||
mesPar.q1 = "Qpt_" + flavour[i];
|
||||
mesPar.q2 = "Qpt_" + flavour[j];
|
||||
mesPar.gammas = "all";
|
||||
mesPar.sink = "sink";
|
||||
application.createModule<MContraction::Meson2AS>("meson_pt_"
|
||||
+ flavour[i] + flavour[j],
|
||||
mesPar);
|
||||
|
||||
// mesPar.output = "mesons2AS/Z2_" + flavour[i] + flavour[j];
|
||||
// mesPar.q1 = "QZ2_" + flavour[i];
|
||||
// mesPar.q2 = "QZ2_" + flavour[j];
|
||||
// mesPar.gammas = "all";
|
||||
// mesPar.sink = "sink";
|
||||
// application.createModule<MContraction::Meson2AS>("meson_Z2_"
|
||||
// + flavour[i] + flavour[j],
|
||||
// mesPar);
|
||||
}
|
||||
for (unsigned int i = 0; i < flavour.size(); ++i)
|
||||
for (unsigned int j = i; j < flavour.size(); ++j)
|
||||
for (unsigned int k = j; k < flavour.size(); ++k)
|
||||
{
|
||||
MContraction::Baryon::Par barPar;
|
||||
|
||||
barPar.output = "baryons/pt_" + flavour[i] + flavour[j] + flavour[k];
|
||||
barPar.q1 = "Qpt_" + flavour[i];
|
||||
barPar.q2 = "Qpt_" + flavour[j];
|
||||
barPar.q3 = "Qpt_" + flavour[k];
|
||||
application.createModule<MContraction::Baryon>(
|
||||
"baryon_pt_" + flavour[i] + flavour[j] + flavour[k], barPar);
|
||||
}
|
||||
|
||||
// execution
|
||||
application.saveParameterFile("spectrum.xml");
|
||||
application.run();
|
||||
|
||||
// epilogue
|
||||
LOG(Message) << "Grid is finalizing now" << std::endl;
|
||||
Grid_finalize();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@ -130,8 +130,8 @@ int main(int argc, char **argv)
|
||||
for (int c = 0; c < Nc; ++c)
|
||||
{
|
||||
ref = prop;
|
||||
PropToFerm(ferm, prop, s, c);
|
||||
FermToProp(prop, ferm, s, c);
|
||||
PropToFerm<WilsonImplR>(ferm, prop, s, c);
|
||||
FermToProp<WilsonImplR>(prop, ferm, s, c);
|
||||
|
||||
std::cout << "Spin = " << s << ", Colour = " << c << std::endl;
|
||||
ref -= prop;
|
||||
|
157
tests/hadrons/Test_hadrons_wilsonFund.cc
Normal file
157
tests/hadrons/Test_hadrons_wilsonFund.cc
Normal file
@ -0,0 +1,157 @@
|
||||
/*******************************************************************************
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: tests/hadrons/Test_hadrons_spectrum.cc
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: Antonin Portelli <antonin.portelli@me.com>
|
||||
|
||||
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 <Grid/Hadrons/Application.hpp>
|
||||
|
||||
using namespace Grid;
|
||||
using namespace Hadrons;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// initialization //////////////////////////////////////////////////////////
|
||||
Grid_init(&argc, &argv);
|
||||
HadronsLogError.Active(GridLogError.isActive());
|
||||
HadronsLogWarning.Active(GridLogWarning.isActive());
|
||||
HadronsLogMessage.Active(GridLogMessage.isActive());
|
||||
HadronsLogIterative.Active(GridLogIterative.isActive());
|
||||
HadronsLogDebug.Active(GridLogDebug.isActive());
|
||||
LOG(Message) << "Grid initialized" << std::endl;
|
||||
|
||||
// run setup ///////////////////////////////////////////////////////////////
|
||||
Application application;
|
||||
std::vector<std::string> flavour = {"l"};
|
||||
std::vector<double> mass = {-0.1};
|
||||
double csw = 0.0;
|
||||
|
||||
// global parameters
|
||||
Application::GlobalPar globalPar;
|
||||
|
||||
globalPar.trajCounter.start = 309;
|
||||
globalPar.trajCounter.end = 310;
|
||||
globalPar.trajCounter.step = 1;
|
||||
|
||||
globalPar.seed = "1 2 3 4";
|
||||
|
||||
application.setPar(globalPar);
|
||||
// gauge field
|
||||
application.createModule<MIO::LoadNersc>("gauge");
|
||||
|
||||
// sources
|
||||
//MSource::Z2::Par z2Par;
|
||||
//z2Par.tA = 0;
|
||||
//z2Par.tB = 0;
|
||||
//application.createModule<MSource::Z2>("z2", z2Par);
|
||||
MSource::Point::Par ptPar;
|
||||
ptPar.position = "0 0 0 0";
|
||||
application.createModule<MSource::Point>("pt", ptPar);
|
||||
// sink
|
||||
MSink::Point::Par sinkPar;
|
||||
sinkPar.mom = "0 0 0";
|
||||
application.createModule<MSink::ScalarPoint>("sink", sinkPar);
|
||||
|
||||
// set fermion boundary conditions to be periodic space, antiperiodic time.
|
||||
std::string boundary = "1 1 1 -1";
|
||||
|
||||
for (unsigned int i = 0; i < flavour.size(); ++i)
|
||||
{
|
||||
// actions
|
||||
MAction::WilsonClover::Par actionPar;
|
||||
actionPar.gauge = "gauge";
|
||||
actionPar.mass = mass[i];
|
||||
actionPar.boundary = boundary;
|
||||
actionPar.csw_r = csw;
|
||||
actionPar.csw_t = csw;
|
||||
|
||||
// !!!!! Check if Anisotropy works !!!!!
|
||||
actionPar.clover_anisotropy.isAnisotropic= false;
|
||||
actionPar.clover_anisotropy.t_direction = 3 ; // Explicit for D=4
|
||||
actionPar.clover_anisotropy.xi_0 = 1.0 ;
|
||||
actionPar.clover_anisotropy.nu = 1.0 ;
|
||||
|
||||
application.createModule<MAction::WilsonClover>("WilsonClover_" + flavour[i], actionPar);
|
||||
|
||||
// solvers
|
||||
MSolver::RBPrecCG::Par solverPar;
|
||||
solverPar.action = "WilsonClover_" + flavour[i];
|
||||
solverPar.residual = 1.0e-8;
|
||||
application.createModule<MSolver::RBPrecCG>("CG_" + flavour[i],
|
||||
solverPar);
|
||||
|
||||
// propagators
|
||||
MFermion::GaugeProp::Par quarkPar;
|
||||
quarkPar.solver = "CG_" + flavour[i];
|
||||
quarkPar.source = "pt";
|
||||
application.createModule<MFermion::GaugeProp>("Qpt_" + flavour[i], quarkPar);
|
||||
// quarkPar.source = "z2";
|
||||
// application.createModule<MFermion::GaugeProp>("QZ2_" + flavour[i], quarkPar);
|
||||
}
|
||||
for (unsigned int i = 0; i < flavour.size(); ++i)
|
||||
for (unsigned int j = i; j < flavour.size(); ++j)
|
||||
{
|
||||
MContraction::Meson::Par mesPar;
|
||||
|
||||
mesPar.output = "Fund_mesons/pt_" + flavour[i] + flavour[j];
|
||||
mesPar.q1 = "Qpt_" + flavour[i];
|
||||
mesPar.q2 = "Qpt_" + flavour[j];
|
||||
mesPar.gammas = "all";
|
||||
mesPar.sink = "sink";
|
||||
application.createModule<MContraction::Meson>("meson_pt_"
|
||||
+ flavour[i] + flavour[j],
|
||||
mesPar);
|
||||
// mesPar.output = "mesons/Z2_" + flavour[i] + flavour[j];
|
||||
// mesPar.q1 = "QZ2_" + flavour[i];
|
||||
// mesPar.q2 = "QZ2_" + flavour[j];
|
||||
// mesPar.gammas = "all";
|
||||
// mesPar.sink = "sink";
|
||||
// application.createModule<MContraction::Meson>("meson_Z2_"
|
||||
// + flavour[i] + flavour[j],
|
||||
// mesPar);
|
||||
}
|
||||
for (unsigned int i = 0; i < flavour.size(); ++i)
|
||||
for (unsigned int j = i; j < flavour.size(); ++j)
|
||||
for (unsigned int k = j; k < flavour.size(); ++k)
|
||||
{
|
||||
MContraction::Baryon::Par barPar;
|
||||
|
||||
barPar.output = "Fund_baryons/pt_" + flavour[i] + flavour[j] + flavour[k];
|
||||
barPar.q1 = "Qpt_" + flavour[i];
|
||||
barPar.q2 = "Qpt_" + flavour[j];
|
||||
barPar.q3 = "Qpt_" + flavour[k];
|
||||
application.createModule<MContraction::Baryon>(
|
||||
"baryon_pt_" + flavour[i] + flavour[j] + flavour[k], barPar);
|
||||
}
|
||||
|
||||
// execution
|
||||
application.saveParameterFile("WilsonClover_spectrum.xml");
|
||||
application.run();
|
||||
|
||||
// epilogue
|
||||
LOG(Message) << "Grid is finalizing now" << std::endl;
|
||||
Grid_finalize();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
139
tests/hmc/Test_hmc_EOWilsonCloverFermionGauge.cc
Normal file
139
tests/hmc/Test_hmc_EOWilsonCloverFermionGauge.cc
Normal file
@ -0,0 +1,139 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./tests/Test_hmc_WilsonFermionGauge.cc
|
||||
|
||||
Copyright (C) 2016
|
||||
|
||||
Author: Guido Cossu <guido.cossu@ed.ac.uk>
|
||||
|
||||
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 <Grid/Grid.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
using namespace Grid;
|
||||
using namespace Grid::QCD;
|
||||
|
||||
Grid_init(&argc, &argv);
|
||||
int threads = GridThread::GetThreads();
|
||||
// here make a routine to print all the relevant information on the run
|
||||
std::cout << GridLogMessage << "Grid is setup to use " << threads << " threads" << std::endl;
|
||||
|
||||
// Typedefs to simplify notation
|
||||
typedef GenericHMCRunner<MinimumNorm2> HMCWrapper; // Uses the default minimum norm
|
||||
typedef WilsonImplR FermionImplPolicy;
|
||||
typedef WilsonCloverFermionR FermionAction;
|
||||
typedef typename FermionAction::FermionField FermionField;
|
||||
|
||||
|
||||
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
HMCWrapper TheHMC;
|
||||
|
||||
// Grid from the command line
|
||||
TheHMC.Resources.AddFourDimGrid("gauge");
|
||||
// Possibile to create the module by hand
|
||||
// hardcoding parameters or using a Reader
|
||||
|
||||
|
||||
// Checkpointer definition
|
||||
CheckpointerParameters CPparams;
|
||||
CPparams.config_prefix = "ckpoint_lat";
|
||||
CPparams.rng_prefix = "ckpoint_rng";
|
||||
CPparams.saveInterval = 5;
|
||||
CPparams.format = "IEEE64BIG";
|
||||
|
||||
TheHMC.Resources.LoadNerscCheckpointer(CPparams);
|
||||
|
||||
RNGModuleParameters RNGpar;
|
||||
RNGpar.serial_seeds = "1 2 3 4 5";
|
||||
RNGpar.parallel_seeds = "6 7 8 9 10";
|
||||
TheHMC.Resources.SetRNGSeeds(RNGpar);
|
||||
|
||||
// Construct observables
|
||||
// here there is too much indirection
|
||||
typedef PlaquetteMod<HMCWrapper::ImplPolicy> PlaqObs;
|
||||
TheHMC.Resources.AddObservable<PlaqObs>();
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Collect actions, here use more encapsulation
|
||||
// need wrappers of the fermionic classes
|
||||
// that have a complex construction
|
||||
// standard
|
||||
RealD beta = 5.6 ;
|
||||
WilsonGaugeActionR Waction(beta);
|
||||
|
||||
// temporarily need a gauge field
|
||||
auto GridPtr = TheHMC.Resources.GetCartesian();
|
||||
auto GridRBPtr = TheHMC.Resources.GetRBCartesian();
|
||||
|
||||
LatticeGaugeField U(GridPtr);
|
||||
|
||||
Real mass = 0.01;
|
||||
Real csw = 1.0;
|
||||
|
||||
FermionAction FermOp(U, *GridPtr, *GridRBPtr, mass, csw);
|
||||
|
||||
ConjugateGradient<FermionField> CG(1.0e-8, 2000);
|
||||
|
||||
TwoFlavourEvenOddPseudoFermionAction<FermionImplPolicy> Nf2(FermOp, CG, CG);
|
||||
|
||||
// Set smearing (true/false), default: false
|
||||
Nf2.is_smeared = false;
|
||||
|
||||
|
||||
// Collect actions
|
||||
ActionLevel<HMCWrapper::Field> Level1(1);
|
||||
Level1.push_back(&Nf2);
|
||||
|
||||
ActionLevel<HMCWrapper::Field> Level2(4);
|
||||
Level2.push_back(&Waction);
|
||||
|
||||
TheHMC.TheAction.push_back(Level1);
|
||||
TheHMC.TheAction.push_back(Level2);
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
double rho = 0.1; // smearing parameter
|
||||
int Nsmear = 2; // number of smearing levels
|
||||
Smear_Stout<HMCWrapper::ImplPolicy> Stout(rho);
|
||||
SmearedConfiguration<HMCWrapper::ImplPolicy> SmearingPolicy(
|
||||
UGrid, Nsmear, Stout);
|
||||
*/
|
||||
|
||||
// HMC parameters are serialisable
|
||||
TheHMC.Parameters.MD.MDsteps = 20;
|
||||
TheHMC.Parameters.MD.trajL = 1.0;
|
||||
|
||||
TheHMC.ReadCommandLine(argc, argv); // these can be parameters from file
|
||||
TheHMC.Run(); // no smearing
|
||||
// TheHMC.Run(SmearingPolicy); // for smearing
|
||||
|
||||
Grid_finalize();
|
||||
|
||||
} // main
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -31,7 +31,8 @@ class ScalarActionParameters : Serializable {
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(ScalarActionParameters,
|
||||
double, mass_squared,
|
||||
double, lambda);
|
||||
double, lambda,
|
||||
double, g);
|
||||
|
||||
template <class ReaderClass >
|
||||
ScalarActionParameters(Reader<ReaderClass>& Reader){
|
||||
@ -140,7 +141,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
// Scalar action in adjoint representation
|
||||
ScalarActionParameters SPar(Reader);
|
||||
ScalarAction Saction(SPar.mass_squared, SPar.lambda);
|
||||
ScalarAction Saction(SPar.mass_squared, SPar.lambda, SPar.g);
|
||||
|
||||
// Collect actions
|
||||
ActionLevel<ScalarAction::Field, ScalarNxNMatrixFields<Ncolours>> Level1(1);
|
||||
|
213
tests/hmc/Test_hmc_WC2ASFG_Production.cc
Normal file
213
tests/hmc/Test_hmc_WC2ASFG_Production.cc
Normal file
@ -0,0 +1,213 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./tests/Test_hmc_WilsonFermionGauge.cc
|
||||
|
||||
Copyright (C) 2017
|
||||
|
||||
Author: Guido Cossu <guido.cossu@ed.ac.uk>
|
||||
|
||||
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 <Grid/Grid.h>
|
||||
|
||||
|
||||
namespace Grid{
|
||||
struct FermionParameters: Serializable {
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(FermionParameters,
|
||||
double, mass,
|
||||
double, csw,
|
||||
double, StoppingCondition,
|
||||
int, MaxCGIterations,
|
||||
bool, ApplySmearing);
|
||||
};
|
||||
|
||||
|
||||
struct WilsonCloverHMCParameters: Serializable {
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(WilsonCloverHMCParameters,
|
||||
double, gauge_beta,
|
||||
FermionParameters, WilsonClover)
|
||||
|
||||
template <class ReaderClass >
|
||||
WilsonCloverHMCParameters(Reader<ReaderClass>& Reader){
|
||||
read(Reader, "Action", *this);
|
||||
}
|
||||
};
|
||||
|
||||
struct SmearingParameters: Serializable {
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(SmearingParameters,
|
||||
double, rho,
|
||||
Integer, Nsmear)
|
||||
|
||||
template <class ReaderClass >
|
||||
SmearingParameters(Reader<ReaderClass>& Reader){
|
||||
read(Reader, "StoutSmearing", *this);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
using namespace Grid;
|
||||
using namespace Grid::QCD;
|
||||
|
||||
typedef Representations< FundamentalRepresentation, TwoIndexAntiSymmetricRepresentation > TheRepresentations;
|
||||
|
||||
Grid_init(&argc, &argv);
|
||||
int threads = GridThread::GetThreads();
|
||||
// here make a routine to print all the relevant information on the run
|
||||
std::cout << GridLogMessage << "Grid is setup to use " << threads << " threads" << std::endl;
|
||||
|
||||
// Typedefs to simplify notation
|
||||
typedef GenericHMCRunnerHirep<TheRepresentations, MinimumNorm2> HMCWrapper; // Uses the default minimum norm
|
||||
typedef WilsonTwoIndexAntiSymmetricImplR FermionImplPolicy; // gauge field implemetation for the pseudofermions
|
||||
typedef WilsonCloverTwoIndexAntiSymmetricFermionR FermionAction; // type of lattice fermions (Wilson, DW, ...)
|
||||
typedef typename FermionAction::FermionField FermionField;
|
||||
typedef Grid::JSONReader Serialiser;
|
||||
|
||||
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
HMCWrapper TheHMC;
|
||||
|
||||
// Grid from the command line
|
||||
TheHMC.ReadCommandLine(argc, argv);
|
||||
if (TheHMC.ParameterFile.empty()){
|
||||
std::cout << "Input file not specified."
|
||||
<< "Use --ParameterFile option in the command line.\nAborting"
|
||||
<< std::endl;
|
||||
exit(1);
|
||||
}
|
||||
Serialiser Reader(TheHMC.ParameterFile);
|
||||
WilsonCloverHMCParameters MyParams(Reader);
|
||||
|
||||
// Apply smearing to the fermionic action
|
||||
bool ApplySmearing = MyParams.WilsonClover.ApplySmearing;
|
||||
|
||||
TheHMC.Resources.AddFourDimGrid("gauge");
|
||||
|
||||
// Checkpointer definition
|
||||
CheckpointerParameters CPparams(Reader);
|
||||
|
||||
/*
|
||||
CPparams.config_prefix = "ckpoint_lat";
|
||||
CPparams.rng_prefix = "ckpoint_rng";
|
||||
CPparams.saveInterval = 5;
|
||||
CPparams.format = "IEEE64BIG";
|
||||
*/
|
||||
|
||||
TheHMC.Resources.LoadNerscCheckpointer(CPparams);
|
||||
|
||||
RNGModuleParameters RNGpar(Reader);
|
||||
/*
|
||||
RNGpar.serial_seeds = "1 2 3 4 5";
|
||||
RNGpar.parallel_seeds = "6 7 8 9 10";
|
||||
TheHMC.Resources.SetRNGSeeds(RNGpar);
|
||||
*/
|
||||
TheHMC.Resources.SetRNGSeeds(RNGpar);
|
||||
|
||||
// Construct observables
|
||||
typedef PlaquetteMod<HMCWrapper::ImplPolicy> PlaqObs;
|
||||
TheHMC.Resources.AddObservable<PlaqObs>();
|
||||
|
||||
typedef PolyakovMod<HMCWrapper::ImplPolicy> PolyakovObs;
|
||||
TheHMC.Resources.AddObservable<PolyakovObs>();
|
||||
|
||||
//typedef TopologicalChargeMod<HMCWrapper::ImplPolicy> QObs;
|
||||
//TopologyObsParameters TopParams(Reader);
|
||||
//TheHMC.Resources.AddObservable<QObs>(TopParams);
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Collect actions, here use more encapsulation
|
||||
// need wrappers of the fermionic classes
|
||||
// that have a complex construction
|
||||
// standard
|
||||
|
||||
//RealD beta = 5.6;
|
||||
WilsonGaugeActionR Waction(MyParams.gauge_beta);
|
||||
|
||||
auto GridPtr = TheHMC.Resources.GetCartesian();
|
||||
auto GridRBPtr = TheHMC.Resources.GetRBCartesian();
|
||||
|
||||
// temporarily need a gauge field
|
||||
TwoIndexAntiSymmetricRepresentation::LatticeField U(GridPtr);
|
||||
|
||||
//Real mass = 0.01;
|
||||
//Real csw = 1.0;
|
||||
|
||||
Real mass = MyParams.WilsonClover.mass;
|
||||
Real csw = MyParams.WilsonClover.csw;
|
||||
|
||||
std::cout << "mass and csw" << mass << " and " << csw << std::endl;
|
||||
|
||||
FermionAction FermOp(U, *GridPtr, *GridRBPtr, mass, csw, csw);
|
||||
ConjugateGradient<FermionField> CG(MyParams.WilsonClover.StoppingCondition, MyParams.WilsonClover.MaxCGIterations);
|
||||
TwoFlavourPseudoFermionAction<FermionImplPolicy> Nf2(FermOp, CG, CG);
|
||||
|
||||
// Set smearing (true/false), default: false
|
||||
Nf2.is_smeared = ApplySmearing;
|
||||
|
||||
// Collect actions
|
||||
ActionLevel<HMCWrapper::Field, TheRepresentations> Level1(1);
|
||||
Level1.push_back(&Nf2);
|
||||
|
||||
ActionLevel<HMCWrapper::Field, TheRepresentations> Level2(4);
|
||||
Level2.push_back(&Waction);
|
||||
|
||||
TheHMC.TheAction.push_back(Level1);
|
||||
TheHMC.TheAction.push_back(Level2);
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/*
|
||||
double rho = 0.1; // smearing parameter
|
||||
int Nsmear = 2; // number of smearing levels
|
||||
Smear_Stout<HMCWrapper::ImplPolicy> Stout(rho);
|
||||
SmearedConfiguration<HMCWrapper::ImplPolicy> SmearingPolicy(
|
||||
UGrid, Nsmear, Stout);
|
||||
*/
|
||||
|
||||
// HMC parameters are serialisable
|
||||
|
||||
TheHMC.Parameters.initialize(Reader);
|
||||
//TheHMC.Parameters.MD.MDsteps = 20;
|
||||
//TheHMC.Parameters.MD.trajL = 1.0;
|
||||
|
||||
if (ApplySmearing){
|
||||
SmearingParameters SmPar(Reader);
|
||||
//double rho = 0.1; // smearing parameter
|
||||
//int Nsmear = 3; // number of smearing levels
|
||||
Smear_Stout<HMCWrapper::ImplPolicy> Stout(SmPar.rho);
|
||||
SmearedConfiguration<HMCWrapper::ImplPolicy> SmearingPolicy(GridPtr, SmPar.Nsmear, Stout);
|
||||
TheHMC.Run(SmearingPolicy); // for smearing
|
||||
} else {
|
||||
TheHMC.Run(); // no smearing
|
||||
}
|
||||
|
||||
//TheHMC.ReadCommandLine(argc, argv); // these can be parameters from file
|
||||
//TheHMC.Run(); // no smearing
|
||||
// TheHMC.Run(SmearingPolicy); // for smearing
|
||||
|
||||
Grid_finalize();
|
||||
|
||||
} // main
|
||||
|
212
tests/hmc/Test_hmc_WC2SFG_Production.cc
Normal file
212
tests/hmc/Test_hmc_WC2SFG_Production.cc
Normal file
@ -0,0 +1,212 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./tests/Test_hmc_WilsonFermionGauge.cc
|
||||
|
||||
Copyright (C) 2017
|
||||
|
||||
Author: Guido Cossu <guido.cossu@ed.ac.uk>
|
||||
|
||||
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 <Grid/Grid.h>
|
||||
|
||||
|
||||
namespace Grid{
|
||||
struct FermionParameters: Serializable {
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(FermionParameters,
|
||||
double, mass,
|
||||
double, csw,
|
||||
double, StoppingCondition,
|
||||
int, MaxCGIterations,
|
||||
bool, ApplySmearing);
|
||||
};
|
||||
|
||||
|
||||
struct WilsonCloverHMCParameters: Serializable {
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(WilsonCloverHMCParameters,
|
||||
double, gauge_beta,
|
||||
FermionParameters, WilsonClover)
|
||||
|
||||
template <class ReaderClass >
|
||||
WilsonCloverHMCParameters(Reader<ReaderClass>& Reader){
|
||||
read(Reader, "Action", *this);
|
||||
}
|
||||
};
|
||||
|
||||
struct SmearingParameters: Serializable {
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(SmearingParameters,
|
||||
double, rho,
|
||||
Integer, Nsmear)
|
||||
|
||||
template <class ReaderClass >
|
||||
SmearingParameters(Reader<ReaderClass>& Reader){
|
||||
read(Reader, "StoutSmearing", *this);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
using namespace Grid;
|
||||
using namespace Grid::QCD;
|
||||
|
||||
typedef Representations< FundamentalRepresentation, TwoIndexSymmetricRepresentation > TheRepresentations;
|
||||
|
||||
Grid_init(&argc, &argv);
|
||||
int threads = GridThread::GetThreads();
|
||||
// here make a routine to print all the relevant information on the run
|
||||
std::cout << GridLogMessage << "Grid is setup to use " << threads << " threads" << std::endl;
|
||||
|
||||
// Typedefs to simplify notation
|
||||
typedef GenericHMCRunnerHirep<TheRepresentations, MinimumNorm2> HMCWrapper; // Uses the default minimum norm
|
||||
typedef WilsonTwoIndexSymmetricImplR FermionImplPolicy; // gauge field implemetation for the pseudofermions
|
||||
typedef WilsonCloverTwoIndexSymmetricFermionR FermionAction; // type of lattice fermions (Wilson, DW, ...)
|
||||
typedef typename FermionAction::FermionField FermionField;
|
||||
typedef Grid::JSONReader Serialiser;
|
||||
|
||||
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
HMCWrapper TheHMC;
|
||||
|
||||
// Grid from the command line
|
||||
TheHMC.ReadCommandLine(argc, argv);
|
||||
if (TheHMC.ParameterFile.empty()){
|
||||
std::cout << "Input file not specified."
|
||||
<< "Use --ParameterFile option in the command line.\nAborting"
|
||||
<< std::endl;
|
||||
exit(1);
|
||||
}
|
||||
Serialiser Reader(TheHMC.ParameterFile);
|
||||
WilsonCloverHMCParameters MyParams(Reader);
|
||||
|
||||
// Apply smearing to the fermionic action
|
||||
bool ApplySmearing = MyParams.WilsonClover.ApplySmearing;
|
||||
|
||||
TheHMC.Resources.AddFourDimGrid("gauge");
|
||||
|
||||
// Checkpointer definition
|
||||
CheckpointerParameters CPparams(Reader);
|
||||
|
||||
/*
|
||||
CPparams.config_prefix = "ckpoint_lat";
|
||||
CPparams.rng_prefix = "ckpoint_rng";
|
||||
CPparams.saveInterval = 5;
|
||||
CPparams.format = "IEEE64BIG";
|
||||
*/
|
||||
|
||||
TheHMC.Resources.LoadNerscCheckpointer(CPparams);
|
||||
|
||||
RNGModuleParameters RNGpar(Reader);
|
||||
/*
|
||||
RNGpar.serial_seeds = "1 2 3 4 5";
|
||||
RNGpar.parallel_seeds = "6 7 8 9 10";
|
||||
TheHMC.Resources.SetRNGSeeds(RNGpar);
|
||||
*/
|
||||
TheHMC.Resources.SetRNGSeeds(RNGpar);
|
||||
|
||||
// Construct observables
|
||||
typedef PlaquetteMod<HMCWrapper::ImplPolicy> PlaqObs;
|
||||
TheHMC.Resources.AddObservable<PlaqObs>();
|
||||
|
||||
typedef PolyakovMod<HMCWrapper::ImplPolicy> PolyakovObs;
|
||||
TheHMC.Resources.AddObservable<PolyakovObs>();
|
||||
|
||||
//typedef TopologicalChargeMod<HMCWrapper::ImplPolicy> QObs;
|
||||
//TopologyObsParameters TopParams(Reader);
|
||||
//TheHMC.Resources.AddObservable<QObs>(TopParams);
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Collect actions, here use more encapsulation
|
||||
// need wrappers of the fermionic classes
|
||||
// that have a complex construction
|
||||
// standard
|
||||
|
||||
//RealD beta = 5.6;
|
||||
WilsonGaugeActionR Waction(MyParams.gauge_beta);
|
||||
|
||||
auto GridPtr = TheHMC.Resources.GetCartesian();
|
||||
auto GridRBPtr = TheHMC.Resources.GetRBCartesian();
|
||||
|
||||
// temporarily need a gauge field
|
||||
TwoIndexSymmetricRepresentation::LatticeField U(GridPtr);
|
||||
|
||||
//Real mass = 0.01;
|
||||
//Real csw = 1.0;
|
||||
|
||||
Real mass = MyParams.WilsonClover.mass;
|
||||
Real csw = MyParams.WilsonClover.csw;
|
||||
|
||||
std::cout << "mass and csw" << mass << " and " << csw << std::endl;
|
||||
|
||||
FermionAction FermOp(U, *GridPtr, *GridRBPtr, mass, csw, csw);
|
||||
ConjugateGradient<FermionField> CG(MyParams.WilsonClover.StoppingCondition, MyParams.WilsonClover.MaxCGIterations);
|
||||
TwoFlavourPseudoFermionAction<FermionImplPolicy> Nf2(FermOp, CG, CG);
|
||||
|
||||
// Set smearing (true/false), default: false
|
||||
Nf2.is_smeared = ApplySmearing;
|
||||
|
||||
// Collect actions
|
||||
ActionLevel<HMCWrapper::Field, TheRepresentations> Level1(1);
|
||||
Level1.push_back(&Nf2);
|
||||
|
||||
ActionLevel<HMCWrapper::Field, TheRepresentations> Level2(4);
|
||||
Level2.push_back(&Waction);
|
||||
|
||||
TheHMC.TheAction.push_back(Level1);
|
||||
TheHMC.TheAction.push_back(Level2);
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/*
|
||||
double rho = 0.1; // smearing parameter
|
||||
int Nsmear = 2; // number of smearing levels
|
||||
Smear_Stout<HMCWrapper::ImplPolicy> Stout(rho);
|
||||
SmearedConfiguration<HMCWrapper::ImplPolicy> SmearingPolicy(
|
||||
UGrid, Nsmear, Stout);
|
||||
*/
|
||||
|
||||
// HMC parameters are serialisable
|
||||
|
||||
TheHMC.Parameters.initialize(Reader);
|
||||
//TheHMC.Parameters.MD.MDsteps = 20;
|
||||
//TheHMC.Parameters.MD.trajL = 1.0;
|
||||
|
||||
if (ApplySmearing){
|
||||
SmearingParameters SmPar(Reader);
|
||||
//double rho = 0.1; // smearing parameter
|
||||
//int Nsmear = 3; // number of smearing levels
|
||||
Smear_Stout<HMCWrapper::ImplPolicy> Stout(SmPar.rho);
|
||||
SmearedConfiguration<HMCWrapper::ImplPolicy> SmearingPolicy(GridPtr, SmPar.Nsmear, Stout);
|
||||
TheHMC.Run(SmearingPolicy); // for smearing
|
||||
} else {
|
||||
TheHMC.Run(); // no smearing
|
||||
}
|
||||
|
||||
//TheHMC.ReadCommandLine(argc, argv); // these can be parameters from file
|
||||
//TheHMC.Run(); // no smearing
|
||||
// TheHMC.Run(SmearingPolicy); // for smearing
|
||||
|
||||
Grid_finalize();
|
||||
|
||||
} // main
|
210
tests/hmc/Test_hmc_WCFG_Production.cc
Normal file
210
tests/hmc/Test_hmc_WCFG_Production.cc
Normal file
@ -0,0 +1,210 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./tests/Test_hmc_WilsonFermionGauge.cc
|
||||
|
||||
Copyright (C) 2017
|
||||
|
||||
Author: Guido Cossu <guido.cossu@ed.ac.uk>
|
||||
|
||||
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 <Grid/Grid.h>
|
||||
|
||||
|
||||
namespace Grid{
|
||||
struct FermionParameters: Serializable {
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(FermionParameters,
|
||||
double, mass,
|
||||
double, csw,
|
||||
double, StoppingCondition,
|
||||
int, MaxCGIterations,
|
||||
bool, ApplySmearing);
|
||||
};
|
||||
|
||||
|
||||
struct WilsonCloverHMCParameters: Serializable {
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(WilsonCloverHMCParameters,
|
||||
double, gauge_beta,
|
||||
FermionParameters, WilsonClover)
|
||||
|
||||
template <class ReaderClass >
|
||||
WilsonCloverHMCParameters(Reader<ReaderClass>& Reader){
|
||||
read(Reader, "Action", *this);
|
||||
}
|
||||
};
|
||||
|
||||
struct SmearingParameters: Serializable {
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(SmearingParameters,
|
||||
double, rho,
|
||||
Integer, Nsmear)
|
||||
|
||||
template <class ReaderClass >
|
||||
SmearingParameters(Reader<ReaderClass>& Reader){
|
||||
read(Reader, "StoutSmearing", *this);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
using namespace Grid;
|
||||
using namespace Grid::QCD;
|
||||
|
||||
Grid_init(&argc, &argv);
|
||||
int threads = GridThread::GetThreads();
|
||||
// here make a routine to print all the relevant information on the run
|
||||
std::cout << GridLogMessage << "Grid is setup to use " << threads << " threads" << std::endl;
|
||||
|
||||
// Typedefs to simplify notation
|
||||
typedef GenericHMCRunner<MinimumNorm2> HMCWrapper; // Uses the default minimum norm
|
||||
typedef WilsonImplR FermionImplPolicy;
|
||||
typedef WilsonCloverFermionR FermionAction;
|
||||
typedef typename FermionAction::FermionField FermionField;
|
||||
typedef Grid::JSONReader Serialiser;
|
||||
|
||||
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
HMCWrapper TheHMC;
|
||||
|
||||
// Grid from the command line
|
||||
TheHMC.ReadCommandLine(argc, argv);
|
||||
if (TheHMC.ParameterFile.empty()){
|
||||
std::cout << "Input file not specified."
|
||||
<< "Use --ParameterFile option in the command line.\nAborting"
|
||||
<< std::endl;
|
||||
exit(1);
|
||||
}
|
||||
Serialiser Reader(TheHMC.ParameterFile);
|
||||
WilsonCloverHMCParameters MyParams(Reader);
|
||||
|
||||
// Apply smearing to the fermionic action
|
||||
bool ApplySmearing = MyParams.WilsonClover.ApplySmearing;
|
||||
|
||||
TheHMC.Resources.AddFourDimGrid("gauge");
|
||||
|
||||
// Checkpointer definition
|
||||
CheckpointerParameters CPparams(Reader);
|
||||
|
||||
/*
|
||||
CPparams.config_prefix = "ckpoint_lat";
|
||||
CPparams.rng_prefix = "ckpoint_rng";
|
||||
CPparams.saveInterval = 5;
|
||||
CPparams.format = "IEEE64BIG";
|
||||
*/
|
||||
|
||||
TheHMC.Resources.LoadNerscCheckpointer(CPparams);
|
||||
|
||||
RNGModuleParameters RNGpar(Reader);
|
||||
/*
|
||||
RNGpar.serial_seeds = "1 2 3 4 5";
|
||||
RNGpar.parallel_seeds = "6 7 8 9 10";
|
||||
TheHMC.Resources.SetRNGSeeds(RNGpar);
|
||||
*/
|
||||
TheHMC.Resources.SetRNGSeeds(RNGpar);
|
||||
|
||||
// Construct observables
|
||||
typedef PlaquetteMod<HMCWrapper::ImplPolicy> PlaqObs;
|
||||
TheHMC.Resources.AddObservable<PlaqObs>();
|
||||
|
||||
typedef PolyakovMod<HMCWrapper::ImplPolicy> PolyakovObs;
|
||||
TheHMC.Resources.AddObservable<PolyakovObs>();
|
||||
|
||||
//typedef TopologicalChargeMod<HMCWrapper::ImplPolicy> QObs;
|
||||
//TopologyObsParameters TopParams(Reader);
|
||||
//TheHMC.Resources.AddObservable<QObs>(TopParams);
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Collect actions, here use more encapsulation
|
||||
// need wrappers of the fermionic classes
|
||||
// that have a complex construction
|
||||
// standard
|
||||
|
||||
//RealD beta = 5.6;
|
||||
WilsonGaugeActionR Waction(MyParams.gauge_beta);
|
||||
|
||||
auto GridPtr = TheHMC.Resources.GetCartesian();
|
||||
auto GridRBPtr = TheHMC.Resources.GetRBCartesian();
|
||||
|
||||
// temporarily need a gauge field
|
||||
LatticeGaugeField U(GridPtr);
|
||||
|
||||
//Real mass = 0.01;
|
||||
//Real csw = 1.0;
|
||||
|
||||
Real mass = MyParams.WilsonClover.mass;
|
||||
Real csw = MyParams.WilsonClover.csw;
|
||||
|
||||
std::cout << "mass and csw" << mass << " and " << csw << std::endl;
|
||||
|
||||
FermionAction FermOp(U, *GridPtr, *GridRBPtr, mass, csw, csw);
|
||||
ConjugateGradient<FermionField> CG(MyParams.WilsonClover.StoppingCondition, MyParams.WilsonClover.MaxCGIterations);
|
||||
TwoFlavourPseudoFermionAction<FermionImplPolicy> Nf2(FermOp, CG, CG);
|
||||
|
||||
// Set smearing (true/false), default: false
|
||||
Nf2.is_smeared = ApplySmearing;
|
||||
|
||||
// Collect actions
|
||||
ActionLevel<HMCWrapper::Field> Level1(1);
|
||||
Level1.push_back(&Nf2);
|
||||
|
||||
ActionLevel<HMCWrapper::Field> Level2(4);
|
||||
Level2.push_back(&Waction);
|
||||
|
||||
TheHMC.TheAction.push_back(Level1);
|
||||
TheHMC.TheAction.push_back(Level2);
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/*
|
||||
double rho = 0.1; // smearing parameter
|
||||
int Nsmear = 2; // number of smearing levels
|
||||
Smear_Stout<HMCWrapper::ImplPolicy> Stout(rho);
|
||||
SmearedConfiguration<HMCWrapper::ImplPolicy> SmearingPolicy(
|
||||
UGrid, Nsmear, Stout);
|
||||
*/
|
||||
|
||||
// HMC parameters are serialisable
|
||||
|
||||
TheHMC.Parameters.initialize(Reader);
|
||||
//TheHMC.Parameters.MD.MDsteps = 20;
|
||||
//TheHMC.Parameters.MD.trajL = 1.0;
|
||||
|
||||
if (ApplySmearing){
|
||||
SmearingParameters SmPar(Reader);
|
||||
//double rho = 0.1; // smearing parameter
|
||||
//int Nsmear = 3; // number of smearing levels
|
||||
Smear_Stout<HMCWrapper::ImplPolicy> Stout(SmPar.rho);
|
||||
SmearedConfiguration<HMCWrapper::ImplPolicy> SmearingPolicy(GridPtr, SmPar.Nsmear, Stout);
|
||||
TheHMC.Run(SmearingPolicy); // for smearing
|
||||
} else {
|
||||
TheHMC.Run(); // no smearing
|
||||
}
|
||||
|
||||
//TheHMC.ReadCommandLine(argc, argv); // these can be parameters from file
|
||||
//TheHMC.Run(); // no smearing
|
||||
// TheHMC.Run(SmearingPolicy); // for smearing
|
||||
|
||||
Grid_finalize();
|
||||
|
||||
} // main
|
224
tests/hmc/Test_hmc_WCMixedRepFG_Production.cc
Normal file
224
tests/hmc/Test_hmc_WCMixedRepFG_Production.cc
Normal file
@ -0,0 +1,224 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./tests/Test_hmc_WilsonAdjointFermionGauge.cc
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: Peter Boyle <pabobyle@ph.ed.ac.uk>
|
||||
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||
Author: neo <cossu@post.kek.jp>
|
||||
Author: paboyle <paboyle@ph.ed.ac.uk>
|
||||
|
||||
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 "Grid/Grid.h"
|
||||
|
||||
|
||||
namespace Grid{
|
||||
struct FermionParameters: Serializable {
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(FermionParameters,
|
||||
double, mass,
|
||||
double, csw,
|
||||
double, StoppingCondition,
|
||||
int, MaxCGIterations,
|
||||
bool, ApplySmearing);
|
||||
};
|
||||
|
||||
struct WilsonCloverHMCParameters: Serializable {
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(WilsonCloverHMCParameters,
|
||||
double, gauge_beta,
|
||||
FermionParameters, WilsonCloverFund,
|
||||
FermionParameters, WilsonCloverAS)
|
||||
|
||||
template <class ReaderClass >
|
||||
WilsonCloverHMCParameters(Reader<ReaderClass>& Reader){
|
||||
read(Reader, "Action", *this);
|
||||
}
|
||||
};
|
||||
|
||||
struct SmearingParameters: Serializable {
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(SmearingParameters,
|
||||
double, rho,
|
||||
Integer, Nsmear)
|
||||
|
||||
template <class ReaderClass >
|
||||
SmearingParameters(Reader<ReaderClass>& Reader){
|
||||
read(Reader, "StoutSmearing", *this);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
using namespace Grid;
|
||||
using namespace Grid::QCD;
|
||||
|
||||
// Here change the allowed (higher) representations
|
||||
typedef Representations< FundamentalRepresentation, TwoIndexAntiSymmetricRepresentation> TheRepresentations;
|
||||
|
||||
Grid_init(&argc, &argv);
|
||||
int threads = GridThread::GetThreads();
|
||||
// here make a routine to print all the relevant information on the run
|
||||
std::cout << GridLogMessage << "Grid is setup to use " << threads << " threads" << std::endl;
|
||||
|
||||
// Typedefs to simplify notation
|
||||
typedef GenericHMCRunnerHirep<TheRepresentations, MinimumNorm2> HMCWrapper;
|
||||
|
||||
typedef WilsonImplR FundImplPolicy;
|
||||
typedef WilsonCloverFermionR FundFermionAction;
|
||||
typedef typename FundFermionAction::FermionField FundFermionField;
|
||||
|
||||
typedef WilsonTwoIndexAntiSymmetricImplR ASymmImplPolicy;
|
||||
typedef WilsonCloverTwoIndexAntiSymmetricFermionR ASymmFermionAction;
|
||||
typedef typename ASymmFermionAction::FermionField ASymmFermionField;
|
||||
|
||||
typedef Grid::JSONReader Serialiser;
|
||||
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
HMCWrapper TheHMC;
|
||||
|
||||
// Grid from the command line
|
||||
TheHMC.ReadCommandLine(argc, argv);
|
||||
if (TheHMC.ParameterFile.empty()){
|
||||
std::cout << "Input file not specified."
|
||||
<< "Use --ParameterFile option in the command line.\nAborting"
|
||||
<< std::endl;
|
||||
exit(1);
|
||||
}
|
||||
Serialiser Reader(TheHMC.ParameterFile);
|
||||
WilsonCloverHMCParameters MyParams(Reader);
|
||||
|
||||
// Apply smearing to the fermionic action
|
||||
bool ApplySmearingFund = MyParams.WilsonCloverFund.ApplySmearing;
|
||||
bool ApplySmearingAS = MyParams.WilsonCloverAS.ApplySmearing;
|
||||
|
||||
|
||||
TheHMC.Resources.AddFourDimGrid("gauge");
|
||||
|
||||
// Checkpointer definition
|
||||
CheckpointerParameters CPparams(Reader);
|
||||
|
||||
/*
|
||||
CPparams.config_prefix = "ckpoint_lat";
|
||||
CPparams.rng_prefix = "ckpoint_rng";
|
||||
CPparams.saveInterval = 5;
|
||||
CPparams.format = "IEEE64BIG";
|
||||
*/
|
||||
|
||||
TheHMC.Resources.LoadNerscCheckpointer(CPparams);
|
||||
|
||||
RNGModuleParameters RNGpar(Reader);
|
||||
/*
|
||||
RNGpar.serial_seeds = "1 2 3 4 5";
|
||||
RNGpar.parallel_seeds = "6 7 8 9 10";
|
||||
TheHMC.Resources.SetRNGSeeds(RNGpar);
|
||||
*/
|
||||
TheHMC.Resources.SetRNGSeeds(RNGpar);
|
||||
|
||||
// Construct observables
|
||||
typedef PlaquetteMod<HMCWrapper::ImplPolicy> PlaqObs;
|
||||
TheHMC.Resources.AddObservable<PlaqObs>();
|
||||
|
||||
typedef PolyakovMod<HMCWrapper::ImplPolicy> PolyakovObs;
|
||||
TheHMC.Resources.AddObservable<PolyakovObs>();
|
||||
|
||||
typedef TopologicalChargeMod<HMCWrapper::ImplPolicy> QObs;
|
||||
TopologyObsParameters TopParams(Reader);
|
||||
TheHMC.Resources.AddObservable<QObs>(TopParams);
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Collect actions, here use more encapsulation
|
||||
// need wrappers of the fermionic classes
|
||||
// that have a complex construction
|
||||
// standard
|
||||
|
||||
//RealD beta = 5.6;
|
||||
WilsonGaugeActionR Waction(MyParams.gauge_beta);
|
||||
|
||||
auto GridPtr = TheHMC.Resources.GetCartesian();
|
||||
auto GridRBPtr = TheHMC.Resources.GetRBCartesian();
|
||||
|
||||
// temporarily need a gauge field
|
||||
FundamentalRepresentation::LatticeField UF(GridPtr);
|
||||
TwoIndexAntiSymmetricRepresentation::LatticeField UAS(GridPtr);
|
||||
|
||||
|
||||
Real Fundmass = MyParams.WilsonCloverFund.mass;
|
||||
Real Fundcsw = MyParams.WilsonCloverFund.csw;
|
||||
Real ASmass = MyParams.WilsonCloverAS.mass;
|
||||
Real AScsw = MyParams.WilsonCloverAS.csw;
|
||||
|
||||
|
||||
|
||||
std::cout << "Fund: mass and csw" << Fundmass << " and " << Fundcsw << std::endl;
|
||||
std::cout << "AS : mass and csw" << ASmass << " and " << AScsw << std::endl;
|
||||
|
||||
|
||||
FundFermionAction FundFermOp(UF, *GridPtr, *GridRBPtr, Fundmass, Fundcsw, Fundcsw);
|
||||
ConjugateGradient<FundFermionField> CG_Fund(MyParams.WilsonCloverFund.StoppingCondition, MyParams.WilsonCloverFund.MaxCGIterations);
|
||||
TwoFlavourPseudoFermionAction<FundImplPolicy> Nf2_Fund(FundFermOp, CG_Fund, CG_Fund);
|
||||
|
||||
ASymmFermionAction ASFermOp(UAS, *GridPtr, *GridRBPtr, ASmass, AScsw, AScsw);
|
||||
ConjugateGradient<ASymmFermionField> CG_AS(MyParams.WilsonCloverAS.StoppingCondition, MyParams.WilsonCloverAS.MaxCGIterations);
|
||||
TwoFlavourPseudoFermionAction<ASymmImplPolicy> Nf2_AS(ASFermOp, CG_AS, CG_AS);
|
||||
|
||||
Nf2_Fund.is_smeared = ApplySmearingFund;
|
||||
Nf2_AS.is_smeared = ApplySmearingAS;
|
||||
|
||||
|
||||
// Collect actions
|
||||
ActionLevel<HMCWrapper::Field, TheRepresentations > Level1(1);
|
||||
Level1.push_back(&Nf2_Fund);
|
||||
Level1.push_back(&Nf2_AS);
|
||||
|
||||
|
||||
ActionLevel<HMCWrapper::Field, TheRepresentations > Level2(4);
|
||||
Level2.push_back(&Waction);
|
||||
|
||||
TheHMC.TheAction.push_back(Level1);
|
||||
TheHMC.TheAction.push_back(Level2);
|
||||
|
||||
TheHMC.Parameters.initialize(Reader);
|
||||
//TheHMC.Parameters.MD.MDsteps = 20;
|
||||
//TheHMC.Parameters.MD.trajL = 1.0;
|
||||
/*
|
||||
if (ApplySmearingFund || ApplySmearingAS){
|
||||
SmearingParameters SmPar(Reader);
|
||||
//double rho = 0.1; // smearing parameter
|
||||
//int Nsmear = 3; // number of smearing levels
|
||||
Smear_Stout<HMCWrapper::ImplPolicy> Stout(SmPar.rho);
|
||||
SmearedConfiguration<HMCWrapper::ImplPolicy> SmearingPolicy(GridPtr, SmPar.Nsmear, Stout);
|
||||
TheHMC.Run(SmearingPolicy); // for smearing
|
||||
} else {
|
||||
TheHMC.Run(); // no smearing
|
||||
}
|
||||
*/
|
||||
TheHMC.Run();
|
||||
|
||||
|
||||
//TheHMC.ReadCommandLine(argc, argv); // these can be parameters from file
|
||||
//TheHMC.Run(); // no smearing
|
||||
// TheHMC.Run(SmearingPolicy); // for smearing
|
||||
|
||||
Grid_finalize();
|
||||
|
||||
} // main
|
213
tests/hmc/Test_hmc_WCadjFG_Production.cc
Normal file
213
tests/hmc/Test_hmc_WCadjFG_Production.cc
Normal file
@ -0,0 +1,213 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./tests/Test_hmc_WilsonFermionGauge.cc
|
||||
|
||||
Copyright (C) 2017
|
||||
|
||||
Author: Guido Cossu <guido.cossu@ed.ac.uk>
|
||||
|
||||
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 <Grid/Grid.h>
|
||||
|
||||
|
||||
namespace Grid{
|
||||
struct FermionParameters: Serializable {
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(FermionParameters,
|
||||
double, mass,
|
||||
double, csw,
|
||||
double, StoppingCondition,
|
||||
int, MaxCGIterations,
|
||||
bool, ApplySmearing);
|
||||
};
|
||||
|
||||
|
||||
struct WilsonCloverHMCParameters: Serializable {
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(WilsonCloverHMCParameters,
|
||||
double, gauge_beta,
|
||||
FermionParameters, WilsonClover)
|
||||
|
||||
template <class ReaderClass >
|
||||
WilsonCloverHMCParameters(Reader<ReaderClass>& Reader){
|
||||
read(Reader, "Action", *this);
|
||||
}
|
||||
};
|
||||
|
||||
struct SmearingParameters: Serializable {
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(SmearingParameters,
|
||||
double, rho,
|
||||
Integer, Nsmear)
|
||||
|
||||
template <class ReaderClass >
|
||||
SmearingParameters(Reader<ReaderClass>& Reader){
|
||||
read(Reader, "StoutSmearing", *this);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
using namespace Grid;
|
||||
using namespace Grid::QCD;
|
||||
|
||||
typedef Representations< FundamentalRepresentation, AdjointRepresentation > TheRepresentations;
|
||||
|
||||
Grid_init(&argc, &argv);
|
||||
int threads = GridThread::GetThreads();
|
||||
// here make a routine to print all the relevant information on the run
|
||||
std::cout << GridLogMessage << "Grid is setup to use " << threads << " threads" << std::endl;
|
||||
|
||||
// Typedefs to simplify notation
|
||||
typedef GenericHMCRunnerHirep<TheRepresentations, MinimumNorm2> HMCWrapper; // Uses the default minimum norm
|
||||
typedef WilsonAdjImplR FermionImplPolicy; // gauge field implemetation for the pseudofermions
|
||||
typedef WilsonCloverAdjFermionR FermionAction; // type of lattice fermions (Wilson, DW, ...)
|
||||
typedef typename FermionAction::FermionField FermionField;
|
||||
typedef Grid::JSONReader Serialiser;
|
||||
|
||||
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
HMCWrapper TheHMC;
|
||||
|
||||
// Grid from the command line
|
||||
TheHMC.ReadCommandLine(argc, argv);
|
||||
if (TheHMC.ParameterFile.empty()){
|
||||
std::cout << "Input file not specified."
|
||||
<< "Use --ParameterFile option in the command line.\nAborting"
|
||||
<< std::endl;
|
||||
exit(1);
|
||||
}
|
||||
Serialiser Reader(TheHMC.ParameterFile);
|
||||
WilsonCloverHMCParameters MyParams(Reader);
|
||||
|
||||
// Apply smearing to the fermionic action
|
||||
bool ApplySmearing = MyParams.WilsonClover.ApplySmearing;
|
||||
|
||||
TheHMC.Resources.AddFourDimGrid("gauge");
|
||||
|
||||
// Checkpointer definition
|
||||
CheckpointerParameters CPparams(Reader);
|
||||
|
||||
/*
|
||||
CPparams.config_prefix = "ckpoint_lat";
|
||||
CPparams.rng_prefix = "ckpoint_rng";
|
||||
CPparams.saveInterval = 5;
|
||||
CPparams.format = "IEEE64BIG";
|
||||
*/
|
||||
|
||||
TheHMC.Resources.LoadNerscCheckpointer(CPparams);
|
||||
|
||||
RNGModuleParameters RNGpar(Reader);
|
||||
/*
|
||||
RNGpar.serial_seeds = "1 2 3 4 5";
|
||||
RNGpar.parallel_seeds = "6 7 8 9 10";
|
||||
TheHMC.Resources.SetRNGSeeds(RNGpar);
|
||||
*/
|
||||
TheHMC.Resources.SetRNGSeeds(RNGpar);
|
||||
|
||||
// Construct observables
|
||||
typedef PlaquetteMod<HMCWrapper::ImplPolicy> PlaqObs;
|
||||
TheHMC.Resources.AddObservable<PlaqObs>();
|
||||
|
||||
typedef PolyakovMod<HMCWrapper::ImplPolicy> PolyakovObs;
|
||||
TheHMC.Resources.AddObservable<PolyakovObs>();
|
||||
|
||||
typedef TopologicalChargeMod<HMCWrapper::ImplPolicy> QObs;
|
||||
TopologyObsParameters TopParams(Reader);
|
||||
TheHMC.Resources.AddObservable<QObs>(TopParams);
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Collect actions, here use more encapsulation
|
||||
// need wrappers of the fermionic classes
|
||||
// that have a complex construction
|
||||
// standard
|
||||
|
||||
//RealD beta = 5.6;
|
||||
WilsonGaugeActionR Waction(MyParams.gauge_beta);
|
||||
|
||||
auto GridPtr = TheHMC.Resources.GetCartesian();
|
||||
auto GridRBPtr = TheHMC.Resources.GetRBCartesian();
|
||||
|
||||
// temporarily need a gauge field
|
||||
AdjointRepresentation::LatticeField U(GridPtr);
|
||||
|
||||
//Real mass = 0.01;
|
||||
//Real csw = 1.0;
|
||||
|
||||
Real mass = MyParams.WilsonClover.mass;
|
||||
Real csw = MyParams.WilsonClover.csw;
|
||||
|
||||
std::cout << "mass and csw" << mass << " and " << csw << std::endl;
|
||||
|
||||
FermionAction FermOp(U, *GridPtr, *GridRBPtr, mass, csw, csw);
|
||||
ConjugateGradient<FermionField> CG(MyParams.WilsonClover.StoppingCondition, MyParams.WilsonClover.MaxCGIterations);
|
||||
TwoFlavourPseudoFermionAction<FermionImplPolicy> Nf2(FermOp, CG, CG);
|
||||
|
||||
// Set smearing (true/false), default: false
|
||||
Nf2.is_smeared = ApplySmearing;
|
||||
|
||||
// Collect actions
|
||||
ActionLevel<HMCWrapper::Field, TheRepresentations> Level1(1);
|
||||
Level1.push_back(&Nf2);
|
||||
|
||||
ActionLevel<HMCWrapper::Field, TheRepresentations> Level2(4);
|
||||
Level2.push_back(&Waction);
|
||||
|
||||
TheHMC.TheAction.push_back(Level1);
|
||||
TheHMC.TheAction.push_back(Level2);
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/*
|
||||
double rho = 0.1; // smearing parameter
|
||||
int Nsmear = 2; // number of smearing levels
|
||||
Smear_Stout<HMCWrapper::ImplPolicy> Stout(rho);
|
||||
SmearedConfiguration<HMCWrapper::ImplPolicy> SmearingPolicy(
|
||||
UGrid, Nsmear, Stout);
|
||||
*/
|
||||
|
||||
// HMC parameters are serialisable
|
||||
|
||||
TheHMC.Parameters.initialize(Reader);
|
||||
//TheHMC.Parameters.MD.MDsteps = 20;
|
||||
//TheHMC.Parameters.MD.trajL = 1.0;
|
||||
|
||||
if (ApplySmearing){
|
||||
SmearingParameters SmPar(Reader);
|
||||
//double rho = 0.1; // smearing parameter
|
||||
//int Nsmear = 3; // number of smearing levels
|
||||
Smear_Stout<HMCWrapper::ImplPolicy> Stout(SmPar.rho);
|
||||
SmearedConfiguration<HMCWrapper::ImplPolicy> SmearingPolicy(GridPtr, SmPar.Nsmear, Stout);
|
||||
TheHMC.Run(SmearingPolicy); // for smearing
|
||||
} else {
|
||||
TheHMC.Run(); // no smearing
|
||||
}
|
||||
|
||||
//TheHMC.ReadCommandLine(argc, argv); // these can be parameters from file
|
||||
//TheHMC.Run(); // no smearing
|
||||
// TheHMC.Run(SmearingPolicy); // for smearing
|
||||
|
||||
Grid_finalize();
|
||||
|
||||
} // main
|
||||
|
114
tests/hmc/Test_hmc_WG_Production.cc
Normal file
114
tests/hmc/Test_hmc_WG_Production.cc
Normal file
@ -0,0 +1,114 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./tests/Test_hmc_WilsonFermionGauge.cc
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: Guido Cossu <guido.cossu@ed.ac.uk>
|
||||
|
||||
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 <Grid/Grid.h>
|
||||
|
||||
namespace Grid{
|
||||
struct ActionParameters: Serializable {
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(ActionParameters,
|
||||
double, beta)
|
||||
|
||||
|
||||
template <class ReaderClass >
|
||||
ActionParameters(Reader<ReaderClass>& Reader){
|
||||
read(Reader, "Action", *this);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
using namespace Grid;
|
||||
using namespace Grid::QCD;
|
||||
|
||||
Grid_init(&argc, &argv);
|
||||
GridLogLayout();
|
||||
|
||||
// Typedefs to simplify notation
|
||||
typedef GenericHMCRunner<MinimumNorm2> HMCWrapper; // Uses the default minimum norm
|
||||
HMCWrapper TheHMC;
|
||||
typedef Grid::JSONReader Serialiser;
|
||||
|
||||
// Grid from the command line
|
||||
TheHMC.Resources.AddFourDimGrid("gauge");
|
||||
TheHMC.ReadCommandLine(argc, argv); // these can be parameters from file
|
||||
// Reader, file should come from command line
|
||||
if (TheHMC.ParameterFile.empty()){
|
||||
std::cout << "Input file not specified."
|
||||
<< "Use --ParameterFile option in the command line.\nAborting"
|
||||
<< std::endl;
|
||||
exit(1);
|
||||
}
|
||||
Serialiser Reader(TheHMC.ParameterFile);
|
||||
|
||||
|
||||
|
||||
// Checkpointer definition
|
||||
CheckpointerParameters CPparams(Reader);
|
||||
TheHMC.Resources.LoadNerscCheckpointer(CPparams);
|
||||
|
||||
RNGModuleParameters RNGpar(Reader);
|
||||
TheHMC.Resources.SetRNGSeeds(RNGpar);
|
||||
|
||||
// Construct observables
|
||||
// here there is too much indirection
|
||||
typedef PlaquetteMod<HMCWrapper::ImplPolicy> PlaqObs;
|
||||
typedef TopologicalChargeMod<HMCWrapper::ImplPolicy> QObs;
|
||||
TheHMC.Resources.AddObservable<PlaqObs>();
|
||||
TopologyObsParameters TopParams(Reader);
|
||||
TheHMC.Resources.AddObservable<QObs>(TopParams);
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Collect actions, here use more encapsulation
|
||||
// need wrappers of the fermionic classes
|
||||
// that have a complex construction
|
||||
// standard
|
||||
ActionParameters WilsonPar(Reader);
|
||||
//RealD beta = 6.4 ;
|
||||
WilsonGaugeActionR Waction(WilsonPar.beta);
|
||||
|
||||
ActionLevel<HMCWrapper::Field> Level1(1);
|
||||
Level1.push_back(&Waction);
|
||||
//Level1.push_back(WGMod.getPtr());
|
||||
TheHMC.TheAction.push_back(Level1);
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
// HMC parameters are serialisable
|
||||
TheHMC.Parameters.initialize(Reader);
|
||||
|
||||
//TheHMC.Parameters.MD.MDsteps = 17;
|
||||
//TheHMC.Parameters.MD.trajL = 1.0;
|
||||
|
||||
TheHMC.Run(); // no smearing
|
||||
|
||||
Grid_finalize();
|
||||
|
||||
} // main
|
129
tests/hmc/Test_hmc_WilsonCloverFermionGauge.cc
Normal file
129
tests/hmc/Test_hmc_WilsonCloverFermionGauge.cc
Normal file
@ -0,0 +1,129 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./tests/Test_hmc_WilsonFermionGauge.cc
|
||||
|
||||
Copyright (C) 2017
|
||||
|
||||
Author: Guido Cossu <guido.cossu@ed.ac.uk>
|
||||
|
||||
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 <Grid/Grid.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
using namespace Grid;
|
||||
using namespace Grid::QCD;
|
||||
|
||||
Grid_init(&argc, &argv);
|
||||
int threads = GridThread::GetThreads();
|
||||
// here make a routine to print all the relevant information on the run
|
||||
std::cout << GridLogMessage << "Grid is setup to use " << threads << " threads" << std::endl;
|
||||
|
||||
// Typedefs to simplify notation
|
||||
typedef GenericHMCRunner<MinimumNorm2> HMCWrapper; // Uses the default minimum norm
|
||||
typedef WilsonImplR FermionImplPolicy;
|
||||
typedef WilsonCloverFermionR FermionAction;
|
||||
typedef typename FermionAction::FermionField FermionField;
|
||||
|
||||
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
HMCWrapper TheHMC;
|
||||
|
||||
// Grid from the command line
|
||||
TheHMC.Resources.AddFourDimGrid("gauge");
|
||||
|
||||
// Checkpointer definition
|
||||
CheckpointerParameters CPparams;
|
||||
CPparams.config_prefix = "ckpoint_lat";
|
||||
CPparams.rng_prefix = "ckpoint_rng";
|
||||
CPparams.saveInterval = 5;
|
||||
CPparams.format = "IEEE64BIG";
|
||||
|
||||
TheHMC.Resources.LoadNerscCheckpointer(CPparams);
|
||||
|
||||
RNGModuleParameters RNGpar;
|
||||
RNGpar.serial_seeds = "1 2 3 4 5";
|
||||
RNGpar.parallel_seeds = "6 7 8 9 10";
|
||||
TheHMC.Resources.SetRNGSeeds(RNGpar);
|
||||
|
||||
// Construct observables
|
||||
typedef PlaquetteMod<HMCWrapper::ImplPolicy> PlaqObs;
|
||||
TheHMC.Resources.AddObservable<PlaqObs>();
|
||||
|
||||
typedef PolyakovMod<HMCWrapper::ImplPolicy> PolyakovObs;
|
||||
TheHMC.Resources.AddObservable<PolyakovObs>();
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Collect actions, here use more encapsulation
|
||||
// need wrappers of the fermionic classes
|
||||
// that have a complex construction
|
||||
// standard
|
||||
RealD beta = 5.6;
|
||||
WilsonGaugeActionR Waction(beta);
|
||||
|
||||
auto GridPtr = TheHMC.Resources.GetCartesian();
|
||||
auto GridRBPtr = TheHMC.Resources.GetRBCartesian();
|
||||
|
||||
// temporarily need a gauge field
|
||||
LatticeGaugeField U(GridPtr);
|
||||
|
||||
Real mass = 0.01;
|
||||
Real csw = 1.0;
|
||||
|
||||
FermionAction FermOp(U, *GridPtr, *GridRBPtr, mass, csw);
|
||||
ConjugateGradient<FermionField> CG(1.0e-8, 5000);
|
||||
|
||||
TwoFlavourPseudoFermionAction<FermionImplPolicy> Nf2(FermOp, CG, CG);
|
||||
|
||||
// Set smearing (true/false), default: false
|
||||
Nf2.is_smeared = false;
|
||||
|
||||
// Collect actions
|
||||
ActionLevel<HMCWrapper::Field> Level1(1);
|
||||
Level1.push_back(&Nf2);
|
||||
|
||||
ActionLevel<HMCWrapper::Field> Level2(4);
|
||||
Level2.push_back(&Waction);
|
||||
|
||||
TheHMC.TheAction.push_back(Level1);
|
||||
TheHMC.TheAction.push_back(Level2);
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
double rho = 0.1; // smearing parameter
|
||||
int Nsmear = 2; // number of smearing levels
|
||||
Smear_Stout<HMCWrapper::ImplPolicy> Stout(rho);
|
||||
SmearedConfiguration<HMCWrapper::ImplPolicy> SmearingPolicy(
|
||||
UGrid, Nsmear, Stout);
|
||||
*/
|
||||
|
||||
// HMC parameters are serialisable
|
||||
TheHMC.Parameters.MD.MDsteps = 20;
|
||||
TheHMC.Parameters.MD.trajL = 1.0;
|
||||
|
||||
TheHMC.ReadCommandLine(argc, argv); // these can be parameters from file
|
||||
TheHMC.Run(); // no smearing
|
||||
// TheHMC.Run(SmearingPolicy); // for smearing
|
||||
|
||||
Grid_finalize();
|
||||
|
||||
} // main
|
178
tests/lanczos/Test_WCMultiRep_lanczos.cc
Normal file
178
tests/lanczos/Test_WCMultiRep_lanczos.cc
Normal file
@ -0,0 +1,178 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./tests/Test_dwf_lanczos.cc
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||
|
||||
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 <Grid/Grid.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Grid;
|
||||
using namespace Grid::QCD;
|
||||
|
||||
|
||||
//typedef WilsonCloverFermionR FermionOp;
|
||||
//typedef typename WilsonFermionR::FermionField FermionField;
|
||||
|
||||
typedef WilsonImplR FundImplPolicy;
|
||||
typedef WilsonCloverFermionR FundFermionAction;
|
||||
typedef typename FundFermionAction::FermionField FundFermionField;
|
||||
|
||||
typedef WilsonTwoIndexAntiSymmetricImplR ASymmImplPolicy;
|
||||
typedef WilsonCloverTwoIndexAntiSymmetricFermionR ASymmFermionAction;
|
||||
typedef typename ASymmFermionAction::FermionField ASymmFermionField;
|
||||
|
||||
|
||||
RealD AllZero(RealD x) { return 0.; }
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
Grid_init(&argc, &argv);
|
||||
|
||||
GridCartesian* UGrid = SpaceTimeGrid::makeFourDimGrid(
|
||||
GridDefaultLatt(), GridDefaultSimd(Nd, vComplex::Nsimd()),
|
||||
GridDefaultMpi());
|
||||
GridRedBlackCartesian* UrbGrid =
|
||||
SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid);
|
||||
GridCartesian* FGrid = UGrid;
|
||||
GridRedBlackCartesian* FrbGrid = UrbGrid;
|
||||
printf("UGrid=%p UrbGrid=%p FGrid=%p FrbGrid=%p\n", UGrid, UrbGrid, FGrid,
|
||||
FrbGrid);
|
||||
|
||||
std::vector<int> seeds4({1, 2, 3, 4});
|
||||
std::vector<int> seeds5({5, 6, 7, 8});
|
||||
GridParallelRNG RNG5(FGrid);
|
||||
RNG5.SeedFixedIntegers(seeds5);
|
||||
GridParallelRNG RNG4(UGrid);
|
||||
RNG4.SeedFixedIntegers(seeds4);
|
||||
GridParallelRNG RNG5rb(FrbGrid);
|
||||
RNG5.SeedFixedIntegers(seeds5);
|
||||
|
||||
GridParallelRNG pRNG(UGrid);
|
||||
GridSerialRNG sRNG;
|
||||
|
||||
FundamentalRepresentation::LatticeField Umu(UGrid);
|
||||
|
||||
TwoIndexAntiSymmetricRepresentation HiRep(UGrid);
|
||||
TwoIndexAntiSymmetricRepresentation::LatticeField UmuAS(UGrid);
|
||||
|
||||
|
||||
CheckpointerParameters CPparams;
|
||||
|
||||
CPparams.config_prefix = "ckpoint_lat";
|
||||
CPparams.rng_prefix = "ckpoint_rng";
|
||||
CPparams.format = "IEEE64BIG";
|
||||
|
||||
//NerscHmcCheckpointer<PeriodicGimplR> Checkpoint(std::string("ckpoint_lat"),
|
||||
// std::string("ckpoint_rng"), 1);
|
||||
|
||||
NerscHmcCheckpointer<PeriodicGimplR> Checkpoint(CPparams);
|
||||
|
||||
int CNFGSTART=1;
|
||||
int CNFGEND=2;
|
||||
int CNFGSTEP=1;
|
||||
|
||||
Real Fundmass = -0.1;
|
||||
Real Fundcsw = 1.0;
|
||||
Real ASmass = -0.1;
|
||||
Real AScsw = 1.0;
|
||||
|
||||
std::cout << "Fund: mass and csw" << Fundmass << " and " << Fundcsw << std::endl;
|
||||
std::cout << "AS : mass and csw" << ASmass << " and " << AScsw << std::endl;
|
||||
|
||||
const int Nstop = 30;
|
||||
const int Nk = 40;
|
||||
const int Np = 40;
|
||||
const int Nm = Nk + Np;
|
||||
const int MaxIt = 10000;
|
||||
RealD resid = 1.0e-8;
|
||||
|
||||
for (int cnfg=CNFGSTART;cnfg<=CNFGEND;cnfg+=CNFGSTEP){
|
||||
Checkpoint.CheckpointRestore(cnfg,Umu, sRNG, pRNG);
|
||||
|
||||
//SU4::HotConfiguration(RNG4, Umu); // temporary, then read.
|
||||
|
||||
HiRep.update_representation(Umu);
|
||||
UmuAS = HiRep.U;
|
||||
|
||||
FundFermionAction FundFermOp(Umu,*FGrid,*FrbGrid, Fundmass, Fundcsw, Fundcsw);
|
||||
MdagMLinearOperator<FundFermionAction,FundFermionField> HermOpFund(FundFermOp); /// <-----
|
||||
|
||||
ASymmFermionAction ASFermOp(UmuAS,*FGrid,*FrbGrid, ASmass, AScsw, AScsw);
|
||||
MdagMLinearOperator<ASymmFermionAction,ASymmFermionField> HermOpAS(ASFermOp); /// <-----
|
||||
|
||||
std::vector<double> Coeffs{0, -1.};
|
||||
Polynomial<FundFermionField> FundPolyX(Coeffs);
|
||||
//Chebyshev<FundFermionField> FundCheb(0.0, 10., 12);
|
||||
|
||||
FunctionHermOp<FundFermionField> FundPolyXOp(FundPolyX,HermOpFund);
|
||||
PlainHermOp<FundFermionField> FundOp (HermOpFund);
|
||||
|
||||
ImplicitlyRestartedLanczos<FundFermionField> IRL_Fund(FundOp, FundPolyXOp, Nstop, Nk, Nm,
|
||||
resid, MaxIt);
|
||||
|
||||
Polynomial<ASymmFermionField> ASPolyX(Coeffs);
|
||||
//Chebyshev<ASymmFermionField> ASCheb(0.0, 10., 12);
|
||||
|
||||
FunctionHermOp<ASymmFermionField> ASPolyXOp(ASPolyX,HermOpAS);
|
||||
PlainHermOp<ASymmFermionField> ASOp (HermOpAS);
|
||||
|
||||
ImplicitlyRestartedLanczos<ASymmFermionField> IRL_AS(ASOp, ASPolyXOp, Nstop, Nk, Nm,
|
||||
resid, MaxIt);
|
||||
|
||||
std::vector<RealD> Fundeval(Nm);
|
||||
std::vector<RealD> ASeval(Nm);
|
||||
|
||||
FundFermionField Fundsrc(FGrid);
|
||||
ASymmFermionField ASsrc(FGrid);
|
||||
|
||||
gaussian(RNG5, Fundsrc);
|
||||
gaussian(RNG5, ASsrc);
|
||||
|
||||
std::vector<FundFermionField> Fundevec(Nm, FGrid);
|
||||
std::vector<ASymmFermionField> ASevec(Nm, FGrid);
|
||||
|
||||
for (int i = 0; i < 1; i++) {
|
||||
std::cout << i << " / " << Nm << "Fund: grid pointer " << Fundevec[i]._grid
|
||||
<< std::endl;
|
||||
};
|
||||
for (int i = 0; i < 1; i++) {
|
||||
std::cout << i << " / " << Nm << "AS: grid pointer " << ASevec[i]._grid
|
||||
<< std::endl;
|
||||
};
|
||||
|
||||
int FundNconv, ASNconv;
|
||||
IRL_Fund.calc(Fundeval, Fundevec, Fundsrc, FundNconv);
|
||||
IRL_AS.calc(ASeval, ASevec, ASsrc, ASNconv);
|
||||
|
||||
for (int i=0;i<FundNconv;i++){
|
||||
std::cout << "Fund: eval[" << i << "] = " << Fundeval[i] << std::endl;
|
||||
}
|
||||
for (int i=0;i<ASNconv;i++){
|
||||
std::cout << "2Index: eval[" << i << "] = " << ASeval[i] << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
Grid_finalize();
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
AM_CXXFLAGS += `chroma-config --cxxflags`
|
||||
AM_LDFLAGS += `chroma-config --ldflags` `chroma-config --libs`
|
||||
AM_LDFLAGS += `chroma-config --ldflags`
|
||||
LIBS += `chroma-config --libs`
|
||||
|
||||
include Make.inc
|
||||
|
@ -1,6 +1,7 @@
|
||||
# additional include paths necessary to compile the C++ library
|
||||
|
||||
AM_CXXFLAGS = -I$(top_srcdir)/include `chroma-config --cxxflags`
|
||||
AM_LDFLAGS = -L$(top_builddir)/lib `chroma-config --ldflags` `chroma-config --libs`
|
||||
AM_LDFLAGS = -L$(top_builddir)/lib `chroma-config --ldflags`
|
||||
AM_LIBS = `chroma-config --libs`
|
||||
|
||||
include Make.inc
|
||||
|
519
tests/qdpxx/Test_qdpxx_wilson.cc
Normal file
519
tests/qdpxx/Test_qdpxx_wilson.cc
Normal file
@ -0,0 +1,519 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./tests/qdpxx/Test_qdpxx_wilson.cc
|
||||
|
||||
Copyright (C) 2017
|
||||
|
||||
Author: Guido Cossu <guido.cossu@ed.ac.uk>
|
||||
|
||||
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 <Grid/Grid.h>
|
||||
#include <chroma.h>
|
||||
#include <actions/ferm/invert/syssolver_linop_cg_array.h>
|
||||
#include <actions/ferm/invert/syssolver_linop_aggregate.h>
|
||||
|
||||
// Mass
|
||||
double mq = 0.1;
|
||||
|
||||
// Define Wilson Types
|
||||
typedef Grid::QCD::WilsonImplR::FermionField FermionField;
|
||||
typedef Grid::QCD::LatticeGaugeField GaugeField;
|
||||
|
||||
enum ChromaAction
|
||||
{
|
||||
Wilson, // Wilson
|
||||
WilsonClover // CloverFermions
|
||||
};
|
||||
|
||||
namespace Chroma
|
||||
{
|
||||
|
||||
class ChromaWrapper
|
||||
{
|
||||
public:
|
||||
typedef multi1d<LatticeColorMatrix> U;
|
||||
typedef LatticeFermion T4;
|
||||
|
||||
static void ImportGauge(GaugeField &gr,
|
||||
QDP::multi1d<QDP::LatticeColorMatrix> &ch)
|
||||
{
|
||||
Grid::QCD::LorentzColourMatrix LCM;
|
||||
Grid::Complex cc;
|
||||
QDP::ColorMatrix cm;
|
||||
QDP::Complex c;
|
||||
|
||||
std::vector<int> x(4);
|
||||
QDP::multi1d<int> cx(4);
|
||||
std::vector<int> gd = gr._grid->GlobalDimensions();
|
||||
|
||||
for (x[0] = 0; x[0] < gd[0]; x[0]++)
|
||||
{
|
||||
for (x[1] = 0; x[1] < gd[1]; x[1]++)
|
||||
{
|
||||
for (x[2] = 0; x[2] < gd[2]; x[2]++)
|
||||
{
|
||||
for (x[3] = 0; x[3] < gd[3]; x[3]++)
|
||||
{
|
||||
cx[0] = x[0];
|
||||
cx[1] = x[1];
|
||||
cx[2] = x[2];
|
||||
cx[3] = x[3];
|
||||
Grid::peekSite(LCM, gr, x);
|
||||
|
||||
for (int mu = 0; mu < 4; mu++)
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
cc = LCM(mu)()(i, j);
|
||||
c = QDP::cmplx(QDP::Real(real(cc)), QDP::Real(imag(cc)));
|
||||
QDP::pokeColor(cm, c, i, j);
|
||||
}
|
||||
}
|
||||
QDP::pokeSite(ch[mu], cm, cx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ExportGauge(GaugeField &gr,
|
||||
QDP::multi1d<QDP::LatticeColorMatrix> &ch)
|
||||
{
|
||||
Grid::QCD::LorentzColourMatrix LCM;
|
||||
Grid::Complex cc;
|
||||
QDP::ColorMatrix cm;
|
||||
QDP::Complex c;
|
||||
|
||||
std::vector<int> x(4);
|
||||
QDP::multi1d<int> cx(4);
|
||||
std::vector<int> gd = gr._grid->GlobalDimensions();
|
||||
|
||||
for (x[0] = 0; x[0] < gd[0]; x[0]++)
|
||||
{
|
||||
for (x[1] = 0; x[1] < gd[1]; x[1]++)
|
||||
{
|
||||
for (x[2] = 0; x[2] < gd[2]; x[2]++)
|
||||
{
|
||||
for (x[3] = 0; x[3] < gd[3]; x[3]++)
|
||||
{
|
||||
cx[0] = x[0];
|
||||
cx[1] = x[1];
|
||||
cx[2] = x[2];
|
||||
cx[3] = x[3];
|
||||
|
||||
for (int mu = 0; mu < 4; mu++)
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
cm = QDP::peekSite(ch[mu], cx);
|
||||
c = QDP::peekColor(cm, i, j);
|
||||
cc = Grid::Complex(toDouble(real(c)), toDouble(imag(c)));
|
||||
LCM(mu)
|
||||
()(i, j) = cc;
|
||||
}
|
||||
}
|
||||
}
|
||||
Grid::pokeSite(LCM, gr, x);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Specific for Wilson Fermions
|
||||
static void ImportFermion(Grid::QCD::LatticeFermion &gr,
|
||||
QDP::LatticeFermion &ch)
|
||||
{
|
||||
Grid::QCD::SpinColourVector F;
|
||||
Grid::Complex c;
|
||||
|
||||
QDP::Fermion cF;
|
||||
QDP::SpinVector cS;
|
||||
QDP::Complex cc;
|
||||
|
||||
std::vector<int> x(4); // explicit 4d fermions in Grid
|
||||
QDP::multi1d<int> cx(4);
|
||||
std::vector<int> gd = gr._grid->GlobalDimensions();
|
||||
|
||||
for (x[0] = 0; x[0] < gd[0]; x[0]++)
|
||||
{
|
||||
for (x[1] = 0; x[1] < gd[1]; x[1]++)
|
||||
{
|
||||
for (x[2] = 0; x[2] < gd[2]; x[2]++)
|
||||
{
|
||||
for (x[3] = 0; x[3] < gd[3]; x[3]++)
|
||||
{
|
||||
cx[0] = x[0];
|
||||
cx[1] = x[1];
|
||||
cx[2] = x[2];
|
||||
cx[3] = x[3];
|
||||
|
||||
Grid::peekSite(F, gr, x);
|
||||
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
for (int sp = 0; sp < 4; sp++)
|
||||
{
|
||||
|
||||
c = F()(sp)(j);
|
||||
|
||||
cc = QDP::cmplx(QDP::Real(real(c)), QDP::Real(imag(c)));
|
||||
|
||||
QDP::pokeSpin(cS, cc, sp);
|
||||
}
|
||||
QDP::pokeColor(cF, cS, j);
|
||||
}
|
||||
QDP::pokeSite(ch, cF, cx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Specific for 4d Wilson fermions
|
||||
static void ExportFermion(Grid::QCD::LatticeFermion &gr,
|
||||
QDP::LatticeFermion &ch)
|
||||
{
|
||||
Grid::QCD::SpinColourVector F;
|
||||
Grid::Complex c;
|
||||
|
||||
QDP::Fermion cF;
|
||||
QDP::SpinVector cS;
|
||||
QDP::Complex cc;
|
||||
|
||||
std::vector<int> x(4); // 4d fermions
|
||||
QDP::multi1d<int> cx(4);
|
||||
std::vector<int> gd = gr._grid->GlobalDimensions();
|
||||
|
||||
for (x[0] = 0; x[0] < gd[0]; x[0]++)
|
||||
{
|
||||
for (x[1] = 0; x[1] < gd[1]; x[1]++)
|
||||
{
|
||||
for (x[2] = 0; x[2] < gd[2]; x[2]++)
|
||||
{
|
||||
for (x[3] = 0; x[3] < gd[3]; x[3]++)
|
||||
{
|
||||
cx[0] = x[0];
|
||||
cx[1] = x[1];
|
||||
cx[2] = x[2];
|
||||
cx[3] = x[3];
|
||||
|
||||
cF = QDP::peekSite(ch, cx);
|
||||
for (int sp = 0; sp < 4; sp++)
|
||||
{
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
cS = QDP::peekColor(cF, j);
|
||||
cc = QDP::peekSpin(cS, sp);
|
||||
c = Grid::Complex(QDP::toDouble(QDP::real(cc)),
|
||||
QDP::toDouble(QDP::imag(cc)));
|
||||
F()
|
||||
(sp)(j) = c;
|
||||
}
|
||||
}
|
||||
Grid::pokeSite(F, gr, x);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Handle<Chroma::UnprecLinearOperator<T4, U, U>> GetLinOp(U &u, ChromaAction params)
|
||||
{
|
||||
QDP::Real _mq(mq);
|
||||
QDP::multi1d<int> bcs(QDP::Nd);
|
||||
|
||||
// Boundary conditions
|
||||
bcs[0] = bcs[1] = bcs[2] = bcs[3] = 1;
|
||||
|
||||
if (params == Wilson)
|
||||
{
|
||||
|
||||
Chroma::WilsonFermActParams p;
|
||||
p.Mass = _mq;
|
||||
AnisoParam_t _apar;
|
||||
_apar.anisoP = true;
|
||||
_apar.t_dir = 3; // in 4d
|
||||
_apar.xi_0 = 2.0;
|
||||
_apar.nu = 1.0;
|
||||
p.anisoParam = _apar;
|
||||
|
||||
Chroma::Handle<Chroma::FermBC<T4, U, U>> fbc(new Chroma::SimpleFermBC<T4, U, U>(bcs));
|
||||
Chroma::Handle<Chroma::CreateFermState<T4, U, U>> cfs(new Chroma::CreateSimpleFermState<T4, U, U>(fbc));
|
||||
Chroma::UnprecWilsonFermAct S_f(cfs, p);
|
||||
Chroma::Handle<Chroma::FermState<T4, U, U>> ffs(S_f.createState(u));
|
||||
return S_f.linOp(ffs);
|
||||
}
|
||||
|
||||
if (params == WilsonClover)
|
||||
{
|
||||
Chroma::CloverFermActParams p;
|
||||
p.Mass = _mq;
|
||||
p.clovCoeffR = QDP::Real(1.0);
|
||||
p.clovCoeffT = QDP::Real(2.0);
|
||||
p.u0 = QDP::Real(1.0);
|
||||
AnisoParam_t _apar;
|
||||
_apar.anisoP = true;
|
||||
_apar.t_dir = 3; // in 4d
|
||||
_apar.xi_0 = 2.0;
|
||||
_apar.nu = 1.0;
|
||||
p.anisoParam = _apar;
|
||||
|
||||
Chroma::Handle<Chroma::FermBC<T4, U, U>> fbc(new Chroma::SimpleFermBC<T4, U, U>(bcs));
|
||||
Chroma::Handle<Chroma::CreateFermState<T4, U, U>> cfs(new Chroma::CreateSimpleFermState<T4, U, U>(fbc));
|
||||
Chroma::UnprecCloverFermAct S_f(cfs, p);
|
||||
Chroma::Handle<Chroma::FermState<T4, U, U>> ffs(S_f.createState(u));
|
||||
return S_f.linOp(ffs);
|
||||
}
|
||||
}
|
||||
};
|
||||
} // namespace Chroma
|
||||
|
||||
void calc_chroma(ChromaAction action, GaugeField &lat, FermionField &src, FermionField &res, int dag)
|
||||
{
|
||||
QDP::multi1d<QDP::LatticeColorMatrix> u(4);
|
||||
Chroma::ChromaWrapper::ImportGauge(lat, u);
|
||||
|
||||
QDP::LatticeFermion check;
|
||||
QDP::LatticeFermion result;
|
||||
QDP::LatticeFermion psi;
|
||||
|
||||
Chroma::ChromaWrapper::ImportFermion(src, psi);
|
||||
|
||||
for (int mu = 0; mu < 4; mu++)
|
||||
{
|
||||
std::cout << "Imported Gauge norm [" << mu << "] " << QDP::norm2(u[mu]) << std::endl;
|
||||
}
|
||||
std::cout << "Imported Fermion norm " << QDP::norm2(psi) << std::endl;
|
||||
|
||||
typedef QDP::LatticeFermion T;
|
||||
typedef QDP::multi1d<QDP::LatticeColorMatrix> U;
|
||||
|
||||
auto linop = Chroma::ChromaWrapper::GetLinOp(u, action);
|
||||
|
||||
printf("Calling Chroma Linop\n");
|
||||
fflush(stdout);
|
||||
|
||||
if (dag)
|
||||
(*linop)(check, psi, Chroma::MINUS);
|
||||
else
|
||||
(*linop)(check, psi, Chroma::PLUS);
|
||||
|
||||
printf("Called Chroma Linop\n");
|
||||
fflush(stdout);
|
||||
|
||||
// std::cout << "Calling Chroma Linop " << std::endl;
|
||||
// linop->evenEvenLinOp(tmp, psi, isign);
|
||||
// check[rb[0]] = tmp;
|
||||
// linop->oddOddLinOp(tmp, psi, isign);
|
||||
// check[rb[1]] = tmp;
|
||||
// linop->evenOddLinOp(tmp, psi, isign);
|
||||
// check[rb[0]] += tmp;
|
||||
// linop->oddEvenLinOp(tmp, psi, isign);
|
||||
// check[rb[1]] += tmp;
|
||||
|
||||
Chroma::ChromaWrapper::ExportFermion(res, check);
|
||||
}
|
||||
|
||||
void make_gauge(GaugeField &Umu, FermionField &src)
|
||||
{
|
||||
using namespace Grid;
|
||||
using namespace Grid::QCD;
|
||||
|
||||
std::vector<int> seeds4({1, 2, 3, 4});
|
||||
|
||||
Grid::GridCartesian *UGrid = (Grid::GridCartesian *)Umu._grid;
|
||||
Grid::GridParallelRNG RNG4(UGrid);
|
||||
RNG4.SeedFixedIntegers(seeds4);
|
||||
Grid::QCD::SU3::HotConfiguration(RNG4, Umu);
|
||||
|
||||
// Fermion field
|
||||
Grid::gaussian(RNG4, src);
|
||||
/*
|
||||
Grid::QCD::SpinColourVector F;
|
||||
Grid::Complex c;
|
||||
|
||||
|
||||
|
||||
std::vector<int> x(4); // 4d fermions
|
||||
std::vector<int> gd = src._grid->GlobalDimensions();
|
||||
|
||||
for (x[0] = 0; x[0] < gd[0]; x[0]++)
|
||||
{
|
||||
for (x[1] = 0; x[1] < gd[1]; x[1]++)
|
||||
{
|
||||
for (x[2] = 0; x[2] < gd[2]; x[2]++)
|
||||
{
|
||||
for (x[3] = 0; x[3] < gd[3]; x[3]++)
|
||||
{
|
||||
for (int sp = 0; sp < 4; sp++)
|
||||
{
|
||||
for (int j = 0; j < 3; j++) // colours
|
||||
{
|
||||
F()(sp)(j) = Grid::Complex(0.0,0.0);
|
||||
if (((sp == 0)|| (sp==3)) && (j==2))
|
||||
{
|
||||
c = Grid::Complex(1.0, 0.0);
|
||||
F()(sp)(j) = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
Grid::pokeSite(F, src, x);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void calc_grid(ChromaAction action, Grid::QCD::LatticeGaugeField &Umu, Grid::QCD::LatticeFermion &src, Grid::QCD::LatticeFermion &res, int dag)
|
||||
{
|
||||
using namespace Grid;
|
||||
using namespace Grid::QCD;
|
||||
|
||||
Grid::GridCartesian *UGrid = (Grid::GridCartesian *)Umu._grid;
|
||||
Grid::GridRedBlackCartesian *UrbGrid = Grid::QCD::SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid);
|
||||
|
||||
Grid::RealD _mass = mq;
|
||||
|
||||
if (action == Wilson)
|
||||
{
|
||||
WilsonAnisotropyCoefficients anis;
|
||||
anis.isAnisotropic = true;
|
||||
anis.t_direction = 3;
|
||||
anis.xi_0 = 2.0;
|
||||
anis.nu = 1.0;
|
||||
WilsonImplParams iParam;
|
||||
Grid::QCD::WilsonFermionR Wf(Umu, *UGrid, *UrbGrid, _mass, iParam, anis);
|
||||
|
||||
std::cout << Grid::GridLogMessage << " Calling Grid Wilson Fermion multiply " << std::endl;
|
||||
|
||||
if (dag)
|
||||
Wf.Mdag(src, res);
|
||||
else
|
||||
Wf.M(src, res);
|
||||
return;
|
||||
}
|
||||
|
||||
if (action == WilsonClover)
|
||||
{
|
||||
Grid::RealD _csw_r = 1.0;
|
||||
Grid::RealD _csw_t = 2.0;
|
||||
WilsonAnisotropyCoefficients anis;
|
||||
anis.isAnisotropic = true;
|
||||
anis.t_direction = 3;
|
||||
anis.xi_0 = 2.0;
|
||||
anis.nu = 1.0;
|
||||
WilsonImplParams CloverImplParam;
|
||||
Grid::QCD::WilsonCloverFermionR Wf(Umu, *UGrid, *UrbGrid, _mass, _csw_r, _csw_t, anis, CloverImplParam);
|
||||
Wf.ImportGauge(Umu);
|
||||
|
||||
std::cout << Grid::GridLogMessage << " Calling Grid Wilson Clover Fermion multiply " << std::endl;
|
||||
|
||||
if (dag)
|
||||
Wf.Mdag(src, res);
|
||||
else
|
||||
Wf.M(src, res);
|
||||
return;
|
||||
}
|
||||
|
||||
assert(0);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
/********************************************************
|
||||
* Setup QDP
|
||||
*********************************************************/
|
||||
Chroma::initialize(&argc, &argv);
|
||||
Chroma::WilsonTypeFermActs4DEnv::registerAll();
|
||||
|
||||
/********************************************************
|
||||
* Setup Grid
|
||||
*********************************************************/
|
||||
Grid::Grid_init(&argc, &argv);
|
||||
Grid::GridCartesian *UGrid = Grid::QCD::SpaceTimeGrid::makeFourDimGrid(Grid::GridDefaultLatt(),
|
||||
Grid::GridDefaultSimd(Grid::QCD::Nd, Grid::vComplex::Nsimd()),
|
||||
Grid::GridDefaultMpi());
|
||||
|
||||
std::vector<int> gd = UGrid->GlobalDimensions();
|
||||
QDP::multi1d<int> nrow(QDP::Nd);
|
||||
for (int mu = 0; mu < 4; mu++)
|
||||
nrow[mu] = gd[mu];
|
||||
|
||||
QDP::Layout::setLattSize(nrow);
|
||||
QDP::Layout::create();
|
||||
|
||||
GaugeField Ug(UGrid);
|
||||
FermionField src(UGrid);
|
||||
FermionField res_chroma(UGrid);
|
||||
FermionField res_grid(UGrid);
|
||||
FermionField only_wilson(UGrid);
|
||||
FermionField difference(UGrid);
|
||||
|
||||
std::vector<ChromaAction> ActionList({Wilson, WilsonClover});
|
||||
std::vector<std::string> ActionName({"Wilson", "WilsonClover"});
|
||||
|
||||
{
|
||||
|
||||
for (int i = 0; i < ActionList.size(); i++)
|
||||
{
|
||||
std::cout << "*****************************" << std::endl;
|
||||
std::cout << "Action " << ActionName[i] << std::endl;
|
||||
std::cout << "*****************************" << std::endl;
|
||||
make_gauge(Ug, src); // fills the gauge field and the fermion field with random numbers
|
||||
|
||||
for (int dag = 0; dag < 2; dag++)
|
||||
{
|
||||
|
||||
{
|
||||
|
||||
std::cout << "Dag = " << dag << std::endl;
|
||||
|
||||
calc_chroma(ActionList[i], Ug, src, res_chroma, dag);
|
||||
|
||||
// Remove the normalisation of Chroma Gauge links ????????
|
||||
std::cout << "Norm of Chroma " << ActionName[i] << " multiply " << Grid::norm2(res_chroma) << std::endl;
|
||||
calc_grid(ActionList[i], Ug, src, res_grid, dag);
|
||||
|
||||
std::cout << "Norm of gauge " << Grid::norm2(Ug) << std::endl;
|
||||
|
||||
std::cout << "Norm of Grid " << ActionName[i] << " multiply " << Grid::norm2(res_grid) << std::endl;
|
||||
|
||||
difference = res_chroma - res_grid;
|
||||
std::cout << "Norm of difference " << Grid::norm2(difference) << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "Finished test " << std::endl;
|
||||
|
||||
Chroma::finalize();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user