mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-13 04:37:05 +01:00
Added unit tests on the representation transformations
Status: Passing all tests
This commit is contained in:
@ -45,7 +45,7 @@ namespace QCD {
|
||||
static const int Zm = 6;
|
||||
static const int Tm = 7;
|
||||
|
||||
static const int Nc=3;
|
||||
static const int Nc=2;
|
||||
static const int Ns=4;
|
||||
static const int Nd=4;
|
||||
static const int Nhs=2; // half spinor
|
||||
|
@ -130,8 +130,8 @@ class TwoFlavourPseudoFermionAction : public Action<typename Impl::GaugeField> {
|
||||
MdagMLinearOperator<FermionOperator<Impl>, FermionField> MdagMOp(FermOp);
|
||||
|
||||
X = zero;
|
||||
DerivativeSolver(MdagMOp, Phi, X);
|
||||
MdagMOp.Op(X, Y);
|
||||
DerivativeSolver(MdagMOp, Phi, X); // X = (MdagM)^-1 phi
|
||||
MdagMOp.Op(X, Y); // Y = M X = (Mdag)^-1 phi
|
||||
|
||||
// Check hermiticity
|
||||
|
||||
|
@ -103,7 +103,7 @@ class NerscHmcRunnerTemplate {
|
||||
|
||||
// Create integrator, including the smearing policy
|
||||
// Smearing policy, only defined for Nc=3
|
||||
|
||||
/*
|
||||
std::cout << GridLogDebug << " Creating the Stout class\n";
|
||||
double rho = 0.1; // smearing parameter, now hardcoded
|
||||
int Nsmear = 1; // number of smearing levels
|
||||
@ -111,7 +111,7 @@ class NerscHmcRunnerTemplate {
|
||||
std::cout << GridLogDebug << " Creating the SmearedConfiguration class\n";
|
||||
//SmearedConfiguration<Gimpl> SmearingPolicy(UGrid, Nsmear, Stout);
|
||||
std::cout << GridLogDebug << " done\n";
|
||||
|
||||
*/
|
||||
//////////////
|
||||
NoSmearing<Gimpl> SmearingPolicy;
|
||||
typedef MinimumNorm2<GaugeField, NoSmearing<Gimpl>, RepresentationsPolicy >
|
||||
|
@ -120,6 +120,7 @@ class Integrator {
|
||||
FieldType forceR(U._grid);
|
||||
// Implement smearing only for the fundamental representation now
|
||||
repr_set.at(a)->deriv(Rep.U, forceR);
|
||||
forceR -= adj(forceR);
|
||||
GF force =
|
||||
Rep.RtoFundamentalProject(forceR); // Ta for the fundamental rep
|
||||
std::cout << GridLogIntegrator << "Hirep Force average: "
|
||||
@ -200,10 +201,12 @@ class Integrator {
|
||||
template <class FieldType, class Repr>
|
||||
void operator()(std::vector<Action<FieldType>*> repr_set, Repr& Rep,
|
||||
GridParallelRNG& pRNG) {
|
||||
for (int a = 0; a < repr_set.size(); ++a)
|
||||
for (int a = 0; a < repr_set.size(); ++a){
|
||||
repr_set.at(a)->refresh(Rep.U, pRNG);
|
||||
|
||||
std::cout << GridLogDebug << "Hirep refreshing pseudofermions" << std::endl;
|
||||
}
|
||||
}
|
||||
} refresh_hireps{};
|
||||
|
||||
// Initialization of momenta and actions
|
||||
|
@ -672,6 +672,20 @@ class SU {
|
||||
}
|
||||
}
|
||||
|
||||
// Projects the algebra components a lattice matrix (of dimension ncol*ncol -1 )
|
||||
// inverse operation: FundamentalLieAlgebraMatrix
|
||||
static void projectOnAlgebra(LatticeAlgebraVector &h_out, const LatticeMatrix &in, Real scale = 1.0) {
|
||||
conformable(h_out, in);
|
||||
h_out = zero;
|
||||
Matrix Ta;
|
||||
|
||||
for (int a = 0; a < AdjointDimension; a++) {
|
||||
generator(a, Ta);
|
||||
auto tmp = - 2.0 * (trace(timesI(Ta) * in)) * scale;// 2.0 for the normalization of the trace in the fundamental rep
|
||||
pokeColour(h_out, tmp, a);
|
||||
}
|
||||
std::cout << "h_out " << h_out << std::endl;
|
||||
}
|
||||
|
||||
|
||||
template <typename GaugeField>
|
||||
|
@ -110,6 +110,22 @@ class SU_Adjoint : public SU<ncolour> {
|
||||
std::cout << GridLogMessage << std::endl;
|
||||
}
|
||||
|
||||
static void AdjointLieAlgebraMatrix(
|
||||
const typename SU<ncolour>::LatticeAlgebraVector &h,
|
||||
LatticeAdjMatrix &out, Real scale = 1.0) {
|
||||
conformable(h, out);
|
||||
GridBase *grid = out._grid;
|
||||
LatticeAdjMatrix la(grid);
|
||||
AMatrix iTa;
|
||||
|
||||
out = zero;
|
||||
for (int a = 0; a < Dimension; a++) {
|
||||
generator(a, iTa);
|
||||
la = peekColour(h, a) * iTa * scale;
|
||||
out += la;
|
||||
}
|
||||
}
|
||||
|
||||
// Projects the algebra components a lattice matrix (of dimension ncol*ncol -1 )
|
||||
static void projectOnAlgebra(typename SU<ncolour>::LatticeAlgebraVector &h_out, const LatticeAdjMatrix &in, Real scale = 1.0) {
|
||||
conformable(h_out, in);
|
||||
@ -118,9 +134,10 @@ class SU_Adjoint : public SU<ncolour> {
|
||||
|
||||
for (int a = 0; a < Dimension; a++) {
|
||||
generator(a, iTa);
|
||||
auto tmp = - 2.0 * real(trace(iTa * in)) * scale;
|
||||
auto tmp = - 1.0/(ncolour) * (trace(iTa * in)) * scale;// 1/Nc for the normalization of the trace in the adj rep
|
||||
pokeColour(h_out, tmp, a);
|
||||
}
|
||||
//std::cout << "h_out " << h_out << std::endl;
|
||||
}
|
||||
|
||||
// a projector that keeps the generators stored to avoid the overhead of recomputing.
|
||||
@ -130,12 +147,12 @@ class SU_Adjoint : public SU<ncolour> {
|
||||
h_out = zero;
|
||||
static bool precalculated = false;
|
||||
if (!precalculated){
|
||||
precalculated = true;
|
||||
precalculated = true;
|
||||
for (int a = 0; a < Dimension; a++) generator(a, iTa[a]);
|
||||
}
|
||||
|
||||
for (int a = 0; a < Dimension; a++) {
|
||||
auto tmp = - 2.0*real(trace(iTa[a] * in)) * scale;
|
||||
auto tmp = - 1.0/(ncolour) * (trace(iTa[a] * in)) * scale;
|
||||
pokeColour(h_out, tmp, a);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user