mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-04 19:25:56 +01:00
minor improvements
This commit is contained in:
parent
2372275b2c
commit
de30c4e22a
@ -194,7 +194,5 @@ public:
|
|||||||
|
|
||||||
typedef WilsonFermion<WilsonImplF> WilsonFermionF;
|
typedef WilsonFermion<WilsonImplF> WilsonFermionF;
|
||||||
typedef WilsonFermion<WilsonImplD> WilsonFermionD;
|
typedef WilsonFermion<WilsonImplD> WilsonFermionD;
|
||||||
//typedef WilsonFermion<SpWilsonImplF> SpWilsonFermionF;
|
|
||||||
//typedef WilsonFermion<SpWilsonImplD> SpWilsonFermionD;
|
|
||||||
|
|
||||||
NAMESPACE_END(Grid);
|
NAMESPACE_END(Grid);
|
||||||
|
@ -61,7 +61,6 @@ NAMESPACE_BEGIN(Grid);
|
|||||||
typedef typename Impl::Field Field;
|
typedef typename Impl::Field Field;
|
||||||
|
|
||||||
// hardcodes the exponential approximation in the template
|
// 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 Group = SU<Nc> > class GaugeImplTypes {
|
template <class S, int Nrepresentation = Nc, int Nexp = 12, class Group = SU<Nc> > class GaugeImplTypes {
|
||||||
public:
|
public:
|
||||||
typedef S Simd;
|
typedef S Simd;
|
||||||
@ -71,7 +70,6 @@ public:
|
|||||||
template <typename vtype> using iImplGaugeLink = iScalar<iScalar<iMatrix<vtype, Nrepresentation> > >;
|
template <typename vtype> using iImplGaugeLink = iScalar<iScalar<iMatrix<vtype, Nrepresentation> > >;
|
||||||
template <typename vtype> using iImplGaugeField = iVector<iScalar<iMatrix<vtype, Nrepresentation> >, Nd>;
|
template <typename vtype> using iImplGaugeField = iVector<iScalar<iMatrix<vtype, Nrepresentation> >, Nd>;
|
||||||
|
|
||||||
|
|
||||||
typedef iImplScalar<Simd> SiteComplex;
|
typedef iImplScalar<Simd> SiteComplex;
|
||||||
typedef iImplGaugeLink<Simd> SiteLink;
|
typedef iImplGaugeLink<Simd> SiteLink;
|
||||||
typedef iImplGaugeField<Simd> SiteField;
|
typedef iImplGaugeField<Simd> SiteField;
|
||||||
@ -120,8 +118,7 @@ public:
|
|||||||
LinkField Pmu(P.Grid());
|
LinkField Pmu(P.Grid());
|
||||||
Pmu = Zero();
|
Pmu = Zero();
|
||||||
|
|
||||||
for (int mu = 0; mu < Nd; mu++)
|
for (int mu = 0; mu < Nd; mu++) {
|
||||||
{
|
|
||||||
Group::GaussianFundamentalLieAlgebraMatrix(pRNG, Pmu);
|
Group::GaussianFundamentalLieAlgebraMatrix(pRNG, Pmu);
|
||||||
RealD scale = ::sqrt(HMC_MOMENTUM_DENOMINATOR) ;
|
RealD scale = ::sqrt(HMC_MOMENTUM_DENOMINATOR) ;
|
||||||
Pmu = Pmu*scale;
|
Pmu = Pmu*scale;
|
||||||
@ -129,11 +126,10 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline Field projectForce(Field &P)
|
static inline Field projectForce(Field &P) {
|
||||||
{
|
Field ret(P.Grid());
|
||||||
Field ret(P.Grid());
|
Group::taProj(P, ret);
|
||||||
Group::taProj(P, ret);
|
return ret;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void update_field(Field& P, Field& U, double ep){
|
static inline void update_field(Field& P, Field& U, double ep){
|
||||||
@ -164,23 +160,19 @@ public:
|
|||||||
return Hsum.real();
|
return Hsum.real();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void Project(Field &U)
|
static inline void Project(Field &U) {
|
||||||
{
|
Group::ProjectOnSpecialGroup(U);
|
||||||
Group::ProjectOnSpecialGroup(U);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void HotConfiguration(GridParallelRNG &pRNG, Field &U)
|
static inline void HotConfiguration(GridParallelRNG &pRNG, Field &U) {
|
||||||
{
|
Group::HotConfiguration(pRNG, U);
|
||||||
Group::HotConfiguration(pRNG, U);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void TepidConfiguration(GridParallelRNG &pRNG, Field &U)
|
static inline void TepidConfiguration(GridParallelRNG &pRNG, Field &U) {
|
||||||
{
|
|
||||||
Group::TepidConfiguration(pRNG, U);
|
Group::TepidConfiguration(pRNG, U);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void ColdConfiguration(GridParallelRNG &pRNG, Field &U)
|
static inline void ColdConfiguration(GridParallelRNG &pRNG, Field &U) {
|
||||||
{
|
|
||||||
Group::ColdConfiguration(pRNG, U);
|
Group::ColdConfiguration(pRNG, U);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,11 +228,11 @@ using GenericHMCRunnerHirep =
|
|||||||
// sp2n
|
// sp2n
|
||||||
|
|
||||||
template <template <typename, typename, typename> class Integrator>
|
template <template <typename, typename, typename> class Integrator>
|
||||||
using GenericSp2nHMCRunner = HMCWrapperTemplate<SpPeriodicGimplR, Integrator>;
|
using GenericSpHMCRunner = HMCWrapperTemplate<SpPeriodicGimplR, Integrator>;
|
||||||
|
|
||||||
template <class RepresentationsPolicy,
|
template <class RepresentationsPolicy,
|
||||||
template <typename, typename, typename> class Integrator>
|
template <typename, typename, typename> class Integrator>
|
||||||
using GenericSp2nHMCRunnerHirep =
|
using GenericSpHMCRunnerHirep =
|
||||||
HMCWrapperTemplate<SpPeriodicGimplR, Integrator, RepresentationsPolicy>;
|
HMCWrapperTemplate<SpPeriodicGimplR, Integrator, RepresentationsPolicy>;
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,8 +29,8 @@ See the full license in the file "LICENSE" in the top level distribution
|
|||||||
directory
|
directory
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
#ifndef QCD_UTIL_SUN_H
|
#ifndef QCD_UTIL_GAUGEGROUP_H
|
||||||
#define QCD_UTIL_SUN_H
|
#define QCD_UTIL_GAUGEGROUP_H
|
||||||
|
|
||||||
// Important detail: nvcc requires all template parameters to have names.
|
// Important detail: nvcc requires all template parameters to have names.
|
||||||
// This is the only reason why the second template parameter has a name.
|
// This is the only reason why the second template parameter has a name.
|
||||||
@ -145,6 +145,12 @@ class GaugeGroup {
|
|||||||
typedef Lattice<vSU2MatrixF> LatticeSU2MatrixF;
|
typedef Lattice<vSU2MatrixF> LatticeSU2MatrixF;
|
||||||
typedef Lattice<vSU2MatrixD> LatticeSU2MatrixD;
|
typedef Lattice<vSU2MatrixD> LatticeSU2MatrixD;
|
||||||
|
|
||||||
|
// Private implementation details are specified in the following files:
|
||||||
|
// Grid/qcd/utils/SUn.impl
|
||||||
|
// Grid/qcd/utils/SUn.impl
|
||||||
|
// The public part of the interface follows below and refers to these
|
||||||
|
// private member functions.
|
||||||
|
|
||||||
#include "Grid/qcd/utils/SUn.impl"
|
#include "Grid/qcd/utils/SUn.impl"
|
||||||
#include "Grid/qcd/utils/Sp2n.impl"
|
#include "Grid/qcd/utils/Sp2n.impl"
|
||||||
|
|
||||||
@ -161,7 +167,7 @@ class GaugeGroup {
|
|||||||
static void testGenerators(void) { testGenerators(group_name()); }
|
static void testGenerators(void) { testGenerators(group_name()); }
|
||||||
|
|
||||||
static void printGenerators(void) {
|
static void printGenerators(void) {
|
||||||
for (int gen = 0; gen < AdjointDimension; gen++) {
|
for (int gen = 0; gen < AlgebraDimension; gen++) {
|
||||||
Matrix ta;
|
Matrix ta;
|
||||||
generator(gen, ta);
|
generator(gen, ta);
|
||||||
std::cout << GridLogMessage << "Nc = " << ncolour << " t_" << gen
|
std::cout << GridLogMessage << "Nc = " << ncolour << " t_" << gen
|
||||||
@ -187,12 +193,11 @@ class GaugeGroup {
|
|||||||
LatticeMatrixType lie(grid);
|
LatticeMatrixType lie(grid);
|
||||||
LatticeMatrixType la(grid);
|
LatticeMatrixType la(grid);
|
||||||
ComplexD ci(0.0, scale);
|
ComplexD ci(0.0, scale);
|
||||||
// ComplexD cone(1.0, 0.0);
|
|
||||||
MatrixType ta;
|
MatrixType ta;
|
||||||
|
|
||||||
lie = Zero();
|
lie = Zero();
|
||||||
|
|
||||||
for (int a = 0; a < AdjointDimension; a++) {
|
for (int a = 0; a < AlgebraDimension; a++) {
|
||||||
random(pRNG, ca);
|
random(pRNG, ca);
|
||||||
|
|
||||||
ca = (ca + conjugate(ca)) * 0.5;
|
ca = (ca + conjugate(ca)) * 0.5;
|
||||||
@ -217,7 +222,7 @@ class GaugeGroup {
|
|||||||
Matrix ta;
|
Matrix ta;
|
||||||
|
|
||||||
out = Zero();
|
out = Zero();
|
||||||
for (int a = 0; a < AdjointDimension; a++) {
|
for (int a = 0; a < AlgebraDimension; a++) {
|
||||||
gaussian(pRNG, ca);
|
gaussian(pRNG, ca);
|
||||||
generator(a, ta);
|
generator(a, ta);
|
||||||
la = toComplex(ca) * ta;
|
la = toComplex(ca) * ta;
|
||||||
@ -235,7 +240,7 @@ class GaugeGroup {
|
|||||||
Matrix ta;
|
Matrix ta;
|
||||||
|
|
||||||
out = Zero();
|
out = Zero();
|
||||||
for (int a = 0; a < AdjointDimension; a++) {
|
for (int a = 0; a < AlgebraDimension; a++) {
|
||||||
generator(a, ta);
|
generator(a, ta);
|
||||||
la = peekColour(h, a) * timesI(ta) * scale;
|
la = peekColour(h, a) * timesI(ta) * scale;
|
||||||
out += la;
|
out += la;
|
||||||
@ -250,7 +255,7 @@ class GaugeGroup {
|
|||||||
h_out = Zero();
|
h_out = Zero();
|
||||||
Matrix Ta;
|
Matrix Ta;
|
||||||
|
|
||||||
for (int a = 0; a < AdjointDimension; a++) {
|
for (int a = 0; a < AlgebraDimension; a++) {
|
||||||
generator(a, Ta);
|
generator(a, Ta);
|
||||||
pokeColour(h_out, -2.0 * (trace(timesI(Ta) * in)) * scale, a);
|
pokeColour(h_out, -2.0 * (trace(timesI(Ta) * in)) * scale, a);
|
||||||
}
|
}
|
||||||
@ -322,7 +327,7 @@ class GaugeGroup {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <int N> // Projects on the general groups U(N), Sp(2N)xZ2 i.e. determinant il allowed a complex phase.
|
template <int N> // Projects on the general groups U(N), Sp(2N)xZ2 i.e. determinant is allowed a complex phase.
|
||||||
static void ProjectOnGeneralGroup(Lattice<iVector<iScalar<iMatrix<vComplexD, N> >, Nd> > &U) {
|
static void ProjectOnGeneralGroup(Lattice<iVector<iScalar<iMatrix<vComplexD, N> >, Nd> > &U) {
|
||||||
for (int mu = 0; mu < Nd; mu++) {
|
for (int mu = 0; mu < Nd; mu++) {
|
||||||
auto Umu = PeekIndex<LorentzIndex>(U, mu);
|
auto Umu = PeekIndex<LorentzIndex>(U, mu);
|
||||||
@ -350,7 +355,7 @@ class GaugeGroup {
|
|||||||
return ProjectOnGeneralGroup(arg, group_name());
|
return ProjectOnGeneralGroup(arg, group_name());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <int N> // Projects on SU(N), Sp(2N)
|
template <int N> // Projects on SU(N), Sp(2N), with unit determinant, by first projecting on general group and then enforcing unit determinant
|
||||||
static void ProjectOnSpecialGroup(Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu) {
|
static void ProjectOnSpecialGroup(Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu) {
|
||||||
Umu = ProjectOnGeneralGroup(Umu);
|
Umu = ProjectOnGeneralGroup(Umu);
|
||||||
auto det = Determinant(Umu);
|
auto det = Determinant(Umu);
|
||||||
@ -375,6 +380,24 @@ class GaugeGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <int ncolour>
|
||||||
|
using SU = GaugeGroup<ncolour, GroupName::SU>;
|
||||||
|
|
||||||
|
template <int ncolour>
|
||||||
|
using Sp = GaugeGroup<ncolour, GroupName::Sp>;
|
||||||
|
|
||||||
|
typedef SU<2> SU2;
|
||||||
|
typedef SU<3> SU3;
|
||||||
|
typedef SU<4> SU4;
|
||||||
|
typedef SU<5> SU5;
|
||||||
|
|
||||||
|
typedef SU<Nc> FundamentalMatrices;
|
||||||
|
|
||||||
|
typedef Sp<2> Sp2;
|
||||||
|
typedef Sp<4> Sp4;
|
||||||
|
typedef Sp<6> Sp6;
|
||||||
|
typedef Sp<8> Sp8;
|
||||||
|
|
||||||
template <int N>
|
template <int N>
|
||||||
LatticeComplexD Determinant(
|
LatticeComplexD Determinant(
|
||||||
@ -403,32 +426,10 @@ LatticeComplexD Determinant(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <int N>
|
template <int N>
|
||||||
static void ProjectSUn(
|
using ProjectSUn = typename GaugeGroup<N,GroupName::SU>::ProjectOnSpecialGroup;
|
||||||
Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu) {
|
|
||||||
Umu = ProjectOnGroup(Umu);
|
|
||||||
auto det = Determinant(Umu);
|
|
||||||
|
|
||||||
det = conjugate(det);
|
|
||||||
|
|
||||||
for (int i = 0; i < N; i++) {
|
|
||||||
auto element = PeekIndex<ColourIndex>(Umu, N - 1, i);
|
|
||||||
element = element * det;
|
|
||||||
PokeIndex<ColourIndex>(Umu, element, Nc - 1, i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <int N>
|
template <int N>
|
||||||
static void ProjectSUn(
|
using ProjectSpn = typename GaugeGroup<N,GroupName::Sp>::ProjectOnSpecialGroup;
|
||||||
Lattice<iVector<iScalar<iMatrix<vComplexD, N> >, Nd> > &U) {
|
|
||||||
GridBase *grid = U.Grid();
|
|
||||||
// Reunitarise
|
|
||||||
for (int mu = 0; mu < Nd; mu++) {
|
|
||||||
auto Umu = PeekIndex<LorentzIndex>(U, mu);
|
|
||||||
Umu = ProjectOnGroup(Umu);
|
|
||||||
ProjectSUn(Umu);
|
|
||||||
PokeIndex<LorentzIndex>(U, Umu, mu);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Explicit specialisation for SU(3).
|
// Explicit specialisation for SU(3).
|
||||||
static void ProjectSU3(
|
static void ProjectSU3(
|
||||||
@ -463,50 +464,5 @@ static void ProjectSU3(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <int ncolour>
|
|
||||||
using SU = GaugeGroup<ncolour, GroupName::SU>;
|
|
||||||
|
|
||||||
template <int ncolour>
|
|
||||||
using Sp = GaugeGroup<ncolour, GroupName::Sp>;
|
|
||||||
|
|
||||||
typedef SU<2> SU2;
|
|
||||||
typedef SU<3> SU3;
|
|
||||||
typedef SU<4> SU4;
|
|
||||||
typedef SU<5> SU5;
|
|
||||||
|
|
||||||
typedef SU<Nc> FundamentalMatrices;
|
|
||||||
|
|
||||||
template <int N>
|
|
||||||
static void ProjectSp2n(
|
|
||||||
Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu) {
|
|
||||||
Umu = ProjectOnSpGroup(Umu);
|
|
||||||
auto det = Determinant(Umu); // ok ?
|
|
||||||
|
|
||||||
det = conjugate(det);
|
|
||||||
|
|
||||||
for (int i = 0; i < N; i++) {
|
|
||||||
auto element = PeekIndex<ColourIndex>(Umu, N - 1, i);
|
|
||||||
element = element * det;
|
|
||||||
PokeIndex<ColourIndex>(Umu, element, Nc - 1, i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
template <int N>
|
|
||||||
static void ProjectSp2n(
|
|
||||||
Lattice<iVector<iScalar<iMatrix<vComplexD, N> >, Nd> > &U) {
|
|
||||||
GridBase *grid = U.Grid();
|
|
||||||
for (int mu = 0; mu < Nd; mu++) {
|
|
||||||
auto Umu = PeekIndex<LorentzIndex>(U, mu);
|
|
||||||
Umu = ProjectOnSpGroup(Umu);
|
|
||||||
ProjectSp2n(Umu);
|
|
||||||
PokeIndex<LorentzIndex>(U, Umu, mu);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef Sp<2> Sp2;
|
|
||||||
typedef Sp<4> Sp4;
|
|
||||||
typedef Sp<6> Sp6;
|
|
||||||
typedef Sp<8> Sp8;
|
|
||||||
|
|
||||||
|
|
||||||
NAMESPACE_END(Grid);
|
NAMESPACE_END(Grid);
|
||||||
#endif
|
#endif
|
||||||
|
@ -7,7 +7,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
Grid_init(&argc, &argv);
|
Grid_init(&argc, &argv);
|
||||||
|
|
||||||
typedef GenericSp2nHMCRunnerHirep<TheRepresentations, MinimumNorm2> HMCWrapper;
|
typedef GenericSpHMCRunnerHirep<TheRepresentations, MinimumNorm2> HMCWrapper;
|
||||||
|
|
||||||
typedef SpWilsonTwoIndexAntiSymmetricImplR TwoIndexFermionImplPolicy;
|
typedef SpWilsonTwoIndexAntiSymmetricImplR TwoIndexFermionImplPolicy;
|
||||||
typedef SpWilsonTwoIndexAntiSymmetricFermionD TwoIndexFermionAction;
|
typedef SpWilsonTwoIndexAntiSymmetricFermionD TwoIndexFermionAction;
|
||||||
|
@ -9,7 +9,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
Grid_init(&argc, &argv);
|
Grid_init(&argc, &argv);
|
||||||
|
|
||||||
typedef GenericSp2nHMCRunnerHirep<TheRepresentations, MinimumNorm2>
|
typedef GenericSpHMCRunnerHirep<TheRepresentations, MinimumNorm2>
|
||||||
HMCWrapper;
|
HMCWrapper;
|
||||||
typedef SpWilsonTwoIndexAntiSymmetricImplR FermionImplPolicy;
|
typedef SpWilsonTwoIndexAntiSymmetricImplR FermionImplPolicy;
|
||||||
typedef SpWilsonTwoIndexAntiSymmetricFermionD FermionAction;
|
typedef SpWilsonTwoIndexAntiSymmetricFermionD FermionAction;
|
||||||
|
@ -7,7 +7,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
Grid_init(&argc, &argv);
|
Grid_init(&argc, &argv);
|
||||||
|
|
||||||
typedef GenericSp2nHMCRunnerHirep<TheRepresentations, MinimumNorm2> HMCWrapper; // ok
|
typedef GenericSpHMCRunnerHirep<TheRepresentations, MinimumNorm2> HMCWrapper; // ok
|
||||||
typedef SpWilsonImplR FermionImplPolicy; // ok
|
typedef SpWilsonImplR FermionImplPolicy; // ok
|
||||||
typedef SpWilsonFermionD FermionAction; // ok
|
typedef SpWilsonFermionD FermionAction; // ok
|
||||||
typedef typename FermionAction::FermionField FermionField; // ok?
|
typedef typename FermionAction::FermionField FermionField; // ok?
|
||||||
|
@ -37,7 +37,7 @@ int main(int argc, char **argv)
|
|||||||
Grid_init(&argc, &argv);
|
Grid_init(&argc, &argv);
|
||||||
GridLogLayout();
|
GridLogLayout();
|
||||||
|
|
||||||
typedef GenericSp2nHMCRunner<MinimumNorm2> HMCWrapper;
|
typedef GenericSpHMCRunner<MinimumNorm2> HMCWrapper;
|
||||||
HMCWrapper TheHMC;
|
HMCWrapper TheHMC;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user