1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-17 23:37:06 +01:00

Debugged HMC for Creutz relation

This commit is contained in:
Guido Cossu
2016-07-28 16:44:41 +01:00
parent b93e18ed50
commit 089f0ab582
12 changed files with 100 additions and 35 deletions

View File

@ -150,11 +150,11 @@ struct ActionLevelHirep {
// Loop on tuple for a callable function
template <std::size_t I = 1, typename Callable, typename ...Args>
inline typename std::enable_if<I == std::tuple_size<action_collection>::value, void>::type apply(
Callable, Repr& R,Args...) const {}
Callable, Repr& R,Args&...) const {}
template <std::size_t I = 1, typename Callable, typename ...Args>
inline typename std::enable_if<I < std::tuple_size<action_collection>::value, void>::type apply(
Callable fn, Repr& R, Args... arguments) const {
Callable fn, Repr& R, Args&... arguments) const {
fn(std::get<I>(actions_hirep), std::get<I>(R.rep), arguments...);
apply<I + 1>(fn, R, arguments...);
}

View File

@ -54,7 +54,7 @@ class WilsonKernels : public FermionOperator<Impl>, public WilsonKernelsStatic {
public:
template <bool EnableBool = true>
typename std::enable_if<Impl::Dimension == 3 && EnableBool, void>::type
typename std::enable_if<Impl::Dimension == 3 && Nc == 3 &&EnableBool, void>::type
DiracOptDhopSite(
StencilImpl &st, LebesgueOrder &lo, DoubledGaugeField &U,
std::vector<SiteHalfSpinor, alignedAllocator<SiteHalfSpinor> > &buf,
@ -85,7 +85,7 @@ class WilsonKernels : public FermionOperator<Impl>, public WilsonKernelsStatic {
}
template <bool EnableBool = true>
typename std::enable_if<Impl::Dimension != 3 && EnableBool, void>::type
typename std::enable_if<(Impl::Dimension != 3 || (Impl::Dimension == 3 && Nc != 3)) && EnableBool, void>::type
DiracOptDhopSite(
StencilImpl &st, LebesgueOrder &lo, DoubledGaugeField &U,
std::vector<SiteHalfSpinor, alignedAllocator<SiteHalfSpinor> > &buf,
@ -102,7 +102,7 @@ class WilsonKernels : public FermionOperator<Impl>, public WilsonKernelsStatic {
}
template <bool EnableBool = true>
typename std::enable_if<Impl::Dimension == 3 && EnableBool, void>::type
typename std::enable_if<Impl::Dimension == 3 && Nc== 3 && EnableBool, void>::type
DiracOptDhopSiteDag(
StencilImpl &st, LebesgueOrder &lo, DoubledGaugeField &U,
std::vector<SiteHalfSpinor, alignedAllocator<SiteHalfSpinor> > &buf,
@ -126,11 +126,11 @@ class WilsonKernels : public FermionOperator<Impl>, public WilsonKernelsStatic {
}
template <bool EnableBool = true>
typename std::enable_if<Impl::Dimension != 3 && EnableBool, void>::type
DiracOptDhopSiteDag(
StencilImpl &st, LebesgueOrder &lo, DoubledGaugeField &U,
std::vector<SiteHalfSpinor, alignedAllocator<SiteHalfSpinor> > &buf,
int sF, int sU, int Ls, int Ns, const FermionField &in, FermionField &out) {
typename std::enable_if<(Impl::Dimension != 3 || (Impl::Dimension == 3 && Nc != 3)) && EnableBool, void>::type
DiracOptDhopSiteDag(
StencilImpl &st, LebesgueOrder &lo, DoubledGaugeField &U,
std::vector<SiteHalfSpinor, alignedAllocator<SiteHalfSpinor> > &buf,
int sF, int sU, int Ls, int Ns, const FermionField &in, FermionField &out) {
for (int site = 0; site < Ns; site++) {
for (int s = 0; s < Ls; s++) {
WilsonKernels<Impl>::DiracOptGenericDhopSiteDag(st, lo, U, buf, sF, sU,
@ -140,7 +140,7 @@ class WilsonKernels : public FermionOperator<Impl>, public WilsonKernelsStatic {
sU++;
}
}
void DiracOptDhopDir(
StencilImpl &st, DoubledGaugeField &U,
std::vector<SiteHalfSpinor, alignedAllocator<SiteHalfSpinor> > &buf,

View File

@ -133,6 +133,28 @@ class TwoFlavourPseudoFermionAction : public Action<typename Impl::GaugeField> {
DerivativeSolver(MdagMOp, Phi, X);
MdagMOp.Op(X, Y);
// Check hermiticity
/*
std::vector<int> seeds({1,2,3,4});
GridParallelRNG RNG(U._grid); RNG.SeedFixedIntegers(seeds);
FermionField RNGphi(FermOp.FermionGrid());
FermionField RNGchi(FermOp.FermionGrid());
FermionField Achi(FermOp.FermionGrid());
FermionField Aphi(FermOp.FermionGrid());
random(RNG, RNGphi);
random(RNG, RNGchi);
MdagMOp.Op(RNGchi, Achi);
MdagMOp.Op(RNGphi, Aphi);
ComplexD pAc = innerProduct(RNGphi, Achi);
ComplexD cAp = innerProduct(RNGchi, Aphi);
//these should be real
ComplexD pAp = innerProduct(RNGphi, Aphi);
ComplexD cAc = innerProduct(RNGchi, Achi);
std::cout<<GridLogMessage<< "pAc "<<pAc<<" cAp "<< cAp<< " diff "<<pAc-adj(cAp)<<std::endl;
std::cout << GridLogMessage << "pAp " << pAp << " cAc " << cAc << std::endl;
*/
// Our conventions really make this UdSdU; We do not differentiate wrt Udag
// here.
// So must take dSdU - adj(dSdU) and left multiply by mom to get dS/dt.