mirror of
https://github.com/paboyle/Grid.git
synced 2025-07-21 07:07:07 +01:00
gauge and fermion implementation for sp2n
This commit is contained in:
@@ -115,6 +115,11 @@ typedef WilsonFermion<WilsonImplR> WilsonFermionR;
|
||||
typedef WilsonFermion<WilsonImplF> WilsonFermionF;
|
||||
typedef WilsonFermion<WilsonImplD> WilsonFermionD;
|
||||
|
||||
|
||||
typedef WilsonFermion<SpWilsonImplR> SpWilsonFermionR;
|
||||
typedef WilsonFermion<SpWilsonImplF> SpWilsonFermionF;
|
||||
typedef WilsonFermion<SpWilsonImplD> SpWilsonFermionD;
|
||||
|
||||
//typedef WilsonFermion<WilsonImplRL> WilsonFermionRL;
|
||||
//typedef WilsonFermion<WilsonImplFH> WilsonFermionFH;
|
||||
//typedef WilsonFermion<WilsonImplDF> WilsonFermionDF;
|
||||
|
@@ -208,5 +208,7 @@ public:
|
||||
|
||||
typedef WilsonFermion<WilsonImplF> WilsonFermionF;
|
||||
typedef WilsonFermion<WilsonImplD> WilsonFermionD;
|
||||
//typedef WilsonFermion<SpWilsonImplF> SpWilsonFermionF;
|
||||
//typedef WilsonFermion<SpWilsonImplD> SpWilsonFermionD;
|
||||
|
||||
NAMESPACE_END(Grid);
|
||||
|
@@ -267,6 +267,16 @@ typedef WilsonImpl<vComplex, TwoIndexAntiSymmetricRepresentation, CoeffReal > W
|
||||
typedef WilsonImpl<vComplexF, TwoIndexAntiSymmetricRepresentation, CoeffReal > WilsonTwoIndexAntiSymmetricImplF; // Float
|
||||
typedef WilsonImpl<vComplexD, TwoIndexAntiSymmetricRepresentation, CoeffReal > WilsonTwoIndexAntiSymmetricImplD; // Double
|
||||
|
||||
//sp 2n
|
||||
|
||||
typedef WilsonImpl<vComplex, SpFundamentalRepresentation, CoeffReal > SpWilsonImplR; // Real.. whichever prec
|
||||
typedef WilsonImpl<vComplexF, SpFundamentalRepresentation, CoeffReal > SpWilsonImplF; // Float
|
||||
typedef WilsonImpl<vComplexD, SpFundamentalRepresentation, CoeffReal > SpWilsonImplD; // Double
|
||||
|
||||
//typedef WilsonImpl<vComplex, SpFundamentalRepresentation, CoeffComplex > SpZWilsonImplR; // Real.. whichever prec
|
||||
//typedef WilsonImpl<vComplexF, SpFundamentalRepresentation, CoeffComplex > SpZWilsonImplF; // Float
|
||||
//typedef WilsonImpl<vComplexD, SpFundamentalRepresentation, CoeffComplex > SpZWilsonImplD; // Double
|
||||
|
||||
|
||||
NAMESPACE_END(Grid);
|
||||
|
||||
|
@@ -39,6 +39,9 @@ NAMESPACE_BEGIN(Grid);
|
||||
typedef WilsonGaugeAction<PeriodicGimplR> WilsonGaugeActionR;
|
||||
typedef WilsonGaugeAction<PeriodicGimplF> WilsonGaugeActionF;
|
||||
typedef WilsonGaugeAction<PeriodicGimplD> WilsonGaugeActionD;
|
||||
typedef WilsonGaugeAction<SymplPeriodicGimplR> SymplWilsonGaugeActionR;
|
||||
typedef WilsonGaugeAction<SymplPeriodicGimplF> SymplWilsonGaugeActionF;
|
||||
typedef WilsonGaugeAction<SymplPeriodicGimplD> SymplWilsonGaugeActionD;
|
||||
typedef PlaqPlusRectangleAction<PeriodicGimplR> PlaqPlusRectangleActionR;
|
||||
typedef PlaqPlusRectangleAction<PeriodicGimplF> PlaqPlusRectangleActionF;
|
||||
typedef PlaqPlusRectangleAction<PeriodicGimplD> PlaqPlusRectangleActionD;
|
||||
|
@@ -61,7 +61,8 @@ NAMESPACE_BEGIN(Grid);
|
||||
typedef typename Impl::Field Field;
|
||||
|
||||
// hardcodes the exponential approximation in the template
|
||||
template <class S, int Nrepresentation = Nc, int Nexp = 12 > class GaugeImplTypes {
|
||||
//template <class S, int Nrepresentation = Nc, int Nexp = 12 > class GaugeImplTypes {
|
||||
template <class S, int Nrepresentation = Nc, int Nexp = 12, bool isSp2n = false > class GaugeImplTypes {
|
||||
public:
|
||||
typedef S Simd;
|
||||
typedef typename Simd::scalar_type scalar_type;
|
||||
@@ -70,6 +71,7 @@ public:
|
||||
template <typename vtype> using iImplGaugeLink = iScalar<iScalar<iMatrix<vtype, Nrepresentation> > >;
|
||||
template <typename vtype> using iImplGaugeField = iVector<iScalar<iMatrix<vtype, Nrepresentation> >, Nd>;
|
||||
|
||||
|
||||
typedef iImplScalar<Simd> SiteComplex;
|
||||
typedef iImplGaugeLink<Simd> SiteLink;
|
||||
typedef iImplGaugeField<Simd> SiteField;
|
||||
@@ -117,8 +119,17 @@ public:
|
||||
//
|
||||
LinkField Pmu(P.Grid());
|
||||
Pmu = Zero();
|
||||
for (int mu = 0; mu < Nd; mu++) {
|
||||
SU<Nrepresentation>::GaussianFundamentalLieAlgebraMatrix(pRNG, Pmu);
|
||||
for (int mu = 0; mu < Nd; mu++)
|
||||
{
|
||||
if (isSp2n == true)
|
||||
{
|
||||
const int nSp = Nrepresentation/2;
|
||||
Sp<nSp>::GaussianFundamentalLieAlgebraMatrix(pRNG, Pmu);
|
||||
} else
|
||||
{
|
||||
|
||||
SU<Nrepresentation>::GaussianFundamentalLieAlgebraMatrix(pRNG, Pmu);
|
||||
}
|
||||
RealD scale = ::sqrt(HMC_MOMENTUM_DENOMINATOR) ;
|
||||
Pmu = Pmu*scale;
|
||||
PokeIndex<LorentzIndex>(P, Pmu, mu);
|
||||
@@ -135,14 +146,21 @@ public:
|
||||
autoView(P_v,P,AcceleratorRead);
|
||||
accelerator_for(ss, P.Grid()->oSites(),1,{
|
||||
for (int mu = 0; mu < Nd; mu++) {
|
||||
U_v[ss](mu) = ProjectOnGroup(Exponentiate(P_v[ss](mu), ep, Nexp) * U_v[ss](mu));
|
||||
if (isSp2n == true)
|
||||
{
|
||||
U_v[ss](mu) = ProjectOnSpGroup(Exponentiate(P_v[ss](mu), ep, Nexp) * U_v[ss](mu));
|
||||
} else
|
||||
{
|
||||
U_v[ss](mu) = ProjectOnGroup(Exponentiate(P_v[ss](mu), ep, Nexp) * U_v[ss](mu));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
//auto end = std::chrono::high_resolution_clock::now();
|
||||
// diff += end - start;
|
||||
// std::cout << "Time to exponentiate matrix " << diff.count() << " s\n";
|
||||
}
|
||||
|
||||
|
||||
static inline RealD FieldSquareNorm(Field& U){
|
||||
LatticeComplex Hloc(U.Grid());
|
||||
Hloc = Zero();
|
||||
@@ -154,21 +172,77 @@ public:
|
||||
return Hsum.real();
|
||||
}
|
||||
|
||||
static inline void Project(Field &U) {
|
||||
ProjectSUn(U);
|
||||
static inline void Project(Field &U)
|
||||
{
|
||||
if (isSp2n == true)
|
||||
{
|
||||
ProjectSp2n(U);
|
||||
} else
|
||||
{
|
||||
ProjectSUn(U);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void HotConfiguration(GridParallelRNG &pRNG, Field &U) {
|
||||
SU<Nc>::HotConfiguration(pRNG, U);
|
||||
static inline void HotConfiguration(GridParallelRNG &pRNG, Field &U)
|
||||
{
|
||||
SU<Nc>::HotConfiguration(pRNG, U);
|
||||
}
|
||||
|
||||
static inline void TepidConfiguration(GridParallelRNG &pRNG, Field &U) {
|
||||
SU<Nc>::TepidConfiguration(pRNG, U);
|
||||
}
|
||||
|
||||
static inline void ColdConfiguration(GridParallelRNG &pRNG, Field &U) {
|
||||
SU<Nc>::ColdConfiguration(pRNG, U);
|
||||
static inline void ColdConfiguration(GridParallelRNG &pRNG, Field &U)
|
||||
{
|
||||
if (isSp2n == true)
|
||||
{
|
||||
const int nSp = Nrepresentation/2;
|
||||
Sp<nSp>::ColdConfiguration(pRNG, U);
|
||||
} else
|
||||
{
|
||||
SU<Nc>::ColdConfiguration(pRNG, U);
|
||||
}
|
||||
}
|
||||
|
||||
//sp2n... see sp2n.h
|
||||
/*
|
||||
static inline void generate_sp2n_momenta(Field &P, GridSerialRNG & sRNG, GridParallelRNG &pRNG)
|
||||
{
|
||||
|
||||
const int nSp = Nrepresentation/2;
|
||||
LinkField Pmu(P.Grid());
|
||||
Pmu = Zero();
|
||||
for (int mu = 0; mu < Nd; mu++) {
|
||||
|
||||
Sp<nSp>::GaussianFundamentalLieAlgebraMatrix(pRNG, Pmu);
|
||||
RealD scale = ::sqrt(HMC_MOMENTUM_DENOMINATOR) ;
|
||||
Pmu = Pmu*scale;
|
||||
PokeIndex<LorentzIndex>(P, Pmu, mu);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void update_sp2n_field(Field& P, Field& U, double ep){
|
||||
|
||||
autoView(U_v,U,AcceleratorWrite);
|
||||
autoView(P_v,P,AcceleratorRead);
|
||||
accelerator_for(ss, P.Grid()->oSites(),1,{
|
||||
for (int mu = 0; mu < Nd; mu++) {
|
||||
U_v[ss](mu) = ProjectOnSpGroup(Exponentiate(P_v[ss](mu), ep, Nexp) * U_v[ss](mu));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static inline void SpProject(Field &U) {
|
||||
ProjectSp2n(U);
|
||||
}
|
||||
|
||||
|
||||
static inline void ColdSpConfiguration(GridParallelRNG &pRNG, Field &U) {
|
||||
const int nSp = Nrepresentation/2;
|
||||
Sp<nSp>::ColdConfiguration(pRNG, U);
|
||||
}
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -176,10 +250,16 @@ typedef GaugeImplTypes<vComplex, Nc> GimplTypesR;
|
||||
typedef GaugeImplTypes<vComplexF, Nc> GimplTypesF;
|
||||
typedef GaugeImplTypes<vComplexD, Nc> GimplTypesD;
|
||||
|
||||
typedef GaugeImplTypes<vComplex, Nc, 12, true> SymplGimplTypesR;
|
||||
typedef GaugeImplTypes<vComplexF, Nc, 12, true> SymplGimplTypesF;
|
||||
typedef GaugeImplTypes<vComplexD, Nc, 12, true> SymplGimplTypesD;
|
||||
|
||||
typedef GaugeImplTypes<vComplex, SU<Nc>::AdjointDimension> GimplAdjointTypesR;
|
||||
typedef GaugeImplTypes<vComplexF, SU<Nc>::AdjointDimension> GimplAdjointTypesF;
|
||||
typedef GaugeImplTypes<vComplexD, SU<Nc>::AdjointDimension> GimplAdjointTypesD;
|
||||
|
||||
|
||||
|
||||
NAMESPACE_END(Grid);
|
||||
|
||||
#endif // GRID_GAUGE_IMPL_TYPES_H
|
||||
|
@@ -155,6 +155,11 @@ typedef ConjugateGaugeImpl<GimplTypesR> ConjugateGimplR; // Real.. whichever pre
|
||||
typedef ConjugateGaugeImpl<GimplTypesF> ConjugateGimplF; // Float
|
||||
typedef ConjugateGaugeImpl<GimplTypesD> ConjugateGimplD; // Double
|
||||
|
||||
typedef PeriodicGaugeImpl<SymplGimplTypesR> SymplPeriodicGimplR; // Real.. whichever prec
|
||||
typedef PeriodicGaugeImpl<SymplGimplTypesF> SymplPeriodicGimplF; // Float
|
||||
typedef PeriodicGaugeImpl<SymplGimplTypesD> SymplPeriodicGimplD; // Double
|
||||
|
||||
|
||||
NAMESPACE_END(Grid);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user