mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-14 09:45:36 +00:00
Added representations definitions for the HMC
This commit is contained in:
parent
daea5297ee
commit
a9ae30f868
File diff suppressed because one or more lines are too long
@ -484,17 +484,23 @@ namespace QCD {
|
|||||||
} //namespace QCD
|
} //namespace QCD
|
||||||
} // Grid
|
} // Grid
|
||||||
|
|
||||||
#include <qcd/utils/SpaceTimeGrid.h>
|
|
||||||
#include <qcd/spin/Dirac.h>
|
#include <qcd/spin/Dirac.h>
|
||||||
|
|
||||||
#include <qcd/spin/TwoSpinor.h>
|
#include <qcd/spin/TwoSpinor.h>
|
||||||
|
|
||||||
|
#include <qcd/utils/SpaceTimeGrid.h>
|
||||||
#include <qcd/utils/LinalgUtils.h>
|
#include <qcd/utils/LinalgUtils.h>
|
||||||
#include <qcd/utils/CovariantCshift.h>
|
#include <qcd/utils/CovariantCshift.h>
|
||||||
#include <qcd/utils/SUn.h>
|
#include <qcd/utils/SUn.h>
|
||||||
|
#include <qcd/utils/SUnAdjoint.h>
|
||||||
|
|
||||||
#include <qcd/action/Actions.h>
|
#include <qcd/action/Actions.h>
|
||||||
|
|
||||||
#include <qcd/hmc/integrators/Integrator.h>
|
#include <qcd/hmc/integrators/Integrator.h>
|
||||||
#include <qcd/hmc/integrators/Integrator_algorithm.h>
|
#include <qcd/hmc/integrators/Integrator_algorithm.h>
|
||||||
#include <qcd/hmc/HMC.h>
|
#include <qcd/hmc/HMC.h>
|
||||||
|
|
||||||
#include <qcd/smearing/Smearing.h>
|
#include <qcd/smearing/Smearing.h>
|
||||||
|
|
||||||
|
#include <qcd/representations/hmc_types.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -116,6 +116,7 @@ class WilsonImpl
|
|||||||
: public PeriodicGaugeImpl<GaugeImplTypes<S, Nrepresentation> > {
|
: public PeriodicGaugeImpl<GaugeImplTypes<S, Nrepresentation> > {
|
||||||
public:
|
public:
|
||||||
typedef PeriodicGaugeImpl<GaugeImplTypes<S, Nrepresentation> > Gimpl;
|
typedef PeriodicGaugeImpl<GaugeImplTypes<S, Nrepresentation> > Gimpl;
|
||||||
|
constexpr bool is_fundamental() const{return Nrepresentation == Nc ? 1 : 0;}
|
||||||
|
|
||||||
INHERIT_GIMPL_TYPES(Gimpl);
|
INHERIT_GIMPL_TYPES(Gimpl);
|
||||||
|
|
||||||
@ -504,6 +505,10 @@ typedef WilsonImpl<vComplex, Nc> WilsonImplR; // Real.. whichever prec
|
|||||||
typedef WilsonImpl<vComplexF, Nc> WilsonImplF; // Float
|
typedef WilsonImpl<vComplexF, Nc> WilsonImplF; // Float
|
||||||
typedef WilsonImpl<vComplexD, Nc> WilsonImplD; // Double
|
typedef WilsonImpl<vComplexD, Nc> WilsonImplD; // Double
|
||||||
|
|
||||||
|
typedef WilsonImpl<vComplex, SU_Adjoint<Nc>::Dimension > WilsonAdjImplR; // Real.. whichever prec
|
||||||
|
typedef WilsonImpl<vComplexF, SU_Adjoint<Nc>::Dimension > WilsonAdjImplF; // Float
|
||||||
|
typedef WilsonImpl<vComplexD, SU_Adjoint<Nc>::Dimension > WilsonAdjImplD; // Double
|
||||||
|
|
||||||
typedef DomainWallRedBlack5dImpl<vComplex, Nc>
|
typedef DomainWallRedBlack5dImpl<vComplex, Nc>
|
||||||
DomainWallRedBlack5dImplR; // Real.. whichever prec
|
DomainWallRedBlack5dImplR; // Real.. whichever prec
|
||||||
typedef DomainWallRedBlack5dImpl<vComplexF, Nc>
|
typedef DomainWallRedBlack5dImpl<vComplexF, Nc>
|
||||||
|
@ -30,7 +30,6 @@ directory
|
|||||||
#define GRID_QCD_GAUGE_IMPL_H
|
#define GRID_QCD_GAUGE_IMPL_H
|
||||||
|
|
||||||
namespace Grid {
|
namespace Grid {
|
||||||
|
|
||||||
namespace QCD {
|
namespace QCD {
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
@ -64,7 +63,7 @@ public:
|
|||||||
// ugly
|
// ugly
|
||||||
typedef Lattice<SiteGaugeField> GaugeField;
|
typedef Lattice<SiteGaugeField> GaugeField;
|
||||||
|
|
||||||
// Move this elsewhere?
|
// Move this elsewhere? FIXME
|
||||||
static inline void AddGaugeLink(GaugeField &U, GaugeLinkField &W,
|
static inline void AddGaugeLink(GaugeField &U, GaugeLinkField &W,
|
||||||
int mu) { // U[mu] += W
|
int mu) { // U[mu] += W
|
||||||
PARALLEL_FOR_LOOP
|
PARALLEL_FOR_LOOP
|
||||||
@ -174,12 +173,19 @@ typedef GaugeImplTypes<vComplex, Nc> GimplTypesR;
|
|||||||
typedef GaugeImplTypes<vComplexF, Nc> GimplTypesF;
|
typedef GaugeImplTypes<vComplexF, Nc> GimplTypesF;
|
||||||
typedef GaugeImplTypes<vComplexD, Nc> GimplTypesD;
|
typedef GaugeImplTypes<vComplexD, Nc> GimplTypesD;
|
||||||
|
|
||||||
|
typedef GaugeImplTypes<vComplex, SU<Nc>::AdjointDimension> GimplAdjointTypesR;
|
||||||
|
typedef GaugeImplTypes<vComplexF, SU<Nc>::AdjointDimension> GimplAdjointTypesF;
|
||||||
|
typedef GaugeImplTypes<vComplexD, SU<Nc>::AdjointDimension> GimplAdjointTypesD;
|
||||||
|
|
||||||
typedef PeriodicGaugeImpl<GimplTypesR> PeriodicGimplR; // Real.. whichever prec
|
typedef PeriodicGaugeImpl<GimplTypesR> PeriodicGimplR; // Real.. whichever prec
|
||||||
typedef PeriodicGaugeImpl<GimplTypesF> PeriodicGimplF; // Float
|
typedef PeriodicGaugeImpl<GimplTypesF> PeriodicGimplF; // Float
|
||||||
typedef PeriodicGaugeImpl<GimplTypesD> PeriodicGimplD; // Double
|
typedef PeriodicGaugeImpl<GimplTypesD> PeriodicGimplD; // Double
|
||||||
|
|
||||||
typedef ConjugateGaugeImpl<GimplTypesR>
|
typedef PeriodicGaugeImpl<GimplAdjointTypesR> PeriodicGimplAdjR; // Real.. whichever prec
|
||||||
ConjugateGimplR; // Real.. whichever prec
|
typedef PeriodicGaugeImpl<GimplAdjointTypesF> PeriodicGimplAdjF; // Float
|
||||||
|
typedef PeriodicGaugeImpl<GimplAdjointTypesD> PeriodicGimplAdjD; // Double
|
||||||
|
|
||||||
|
typedef ConjugateGaugeImpl<GimplTypesR> ConjugateGimplR; // Real.. whichever prec
|
||||||
typedef ConjugateGaugeImpl<GimplTypesF> ConjugateGimplF; // Float
|
typedef ConjugateGaugeImpl<GimplTypesF> ConjugateGimplF; // Float
|
||||||
typedef ConjugateGaugeImpl<GimplTypesD> ConjugateGimplD; // Double
|
typedef ConjugateGaugeImpl<GimplTypesD> ConjugateGimplD; // Double
|
||||||
}
|
}
|
||||||
|
@ -1,48 +1,48 @@
|
|||||||
/*************************************************************************************
|
/*************************************************************************************
|
||||||
|
|
||||||
Grid physics library, www.github.com/paboyle/Grid
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
Source file: ./lib/qcd/action/pseudofermion/TwoFlavour.h
|
Source file: ./lib/qcd/action/pseudofermion/TwoFlavour.h
|
||||||
|
|
||||||
Copyright (C) 2015
|
Copyright (C) 2015
|
||||||
|
|
||||||
Author: Peter Boyle <pabobyle@ph.ed.ac.uk>
|
Author: Peter Boyle <pabobyle@ph.ed.ac.uk>
|
||||||
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along
|
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.,
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
See the full license in the file "LICENSE" in the top level distribution directory
|
See the full license in the file "LICENSE" in the top level distribution
|
||||||
*************************************************************************************/
|
directory
|
||||||
/* END LEGAL */
|
*************************************************************************************/
|
||||||
|
/* END LEGAL */
|
||||||
#ifndef QCD_PSEUDOFERMION_TWO_FLAVOUR_H
|
#ifndef QCD_PSEUDOFERMION_TWO_FLAVOUR_H
|
||||||
#define QCD_PSEUDOFERMION_TWO_FLAVOUR_H
|
#define QCD_PSEUDOFERMION_TWO_FLAVOUR_H
|
||||||
|
|
||||||
namespace Grid{
|
namespace Grid {
|
||||||
namespace QCD{
|
namespace QCD {
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// Two flavour pseudofermion action for any dop
|
// Two flavour pseudofermion action for any dop
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
template<class Impl>
|
template <class Impl>
|
||||||
class TwoFlavourPseudoFermionAction : public Action<typename Impl::GaugeField> {
|
class TwoFlavourPseudoFermionAction : public Action<typename Impl::GaugeField> {
|
||||||
public:
|
public:
|
||||||
INHERIT_IMPL_TYPES(Impl);
|
INHERIT_IMPL_TYPES(Impl);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
FermionOperator<Impl> &FermOp; // the basic operator
|
||||||
FermionOperator<Impl> & FermOp;// the basic operator
|
|
||||||
|
|
||||||
OperatorFunction<FermionField> &DerivativeSolver;
|
OperatorFunction<FermionField> &DerivativeSolver;
|
||||||
|
|
||||||
@ -55,16 +55,18 @@ namespace Grid{
|
|||||||
// Pass in required objects.
|
// Pass in required objects.
|
||||||
/////////////////////////////////////////////////
|
/////////////////////////////////////////////////
|
||||||
TwoFlavourPseudoFermionAction(FermionOperator<Impl> &Op,
|
TwoFlavourPseudoFermionAction(FermionOperator<Impl> &Op,
|
||||||
OperatorFunction<FermionField> & DS,
|
OperatorFunction<FermionField> &DS,
|
||||||
OperatorFunction<FermionField> & AS
|
OperatorFunction<FermionField> &AS)
|
||||||
) : FermOp(Op), DerivativeSolver(DS), ActionSolver(AS), Phi(Op.FermionGrid()) {
|
: FermOp(Op),
|
||||||
};
|
DerivativeSolver(DS),
|
||||||
|
ActionSolver(AS),
|
||||||
|
Phi(Op.FermionGrid()){};
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Push the gauge field in to the dops. Assume any BC's and smearing already applied
|
// Push the gauge field in to the dops. Assume any BC's and smearing already
|
||||||
|
// applied
|
||||||
//////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////
|
||||||
virtual void refresh(const GaugeField &U, GridParallelRNG& pRNG) {
|
virtual void refresh(const GaugeField &U, GridParallelRNG &pRNG) {
|
||||||
|
|
||||||
// P(phi) = e^{- phi^dag (MdagM)^-1 phi}
|
// P(phi) = e^{- phi^dag (MdagM)^-1 phi}
|
||||||
// Phi = Mdag eta
|
// Phi = Mdag eta
|
||||||
// P(eta) = e^{- eta^dag eta}
|
// P(eta) = e^{- eta^dag eta}
|
||||||
@ -76,74 +78,74 @@ namespace Grid{
|
|||||||
//
|
//
|
||||||
// Chroma has this scale factor: two_flavor_monomial_w.h
|
// Chroma has this scale factor: two_flavor_monomial_w.h
|
||||||
// IroIro: does not use this scale. It is absorbed by a change of vars
|
// IroIro: does not use this scale. It is absorbed by a change of vars
|
||||||
// in the Phi integral, and thus is only an irrelevant prefactor for the partition function.
|
// in the Phi integral, and thus is only an irrelevant prefactor for
|
||||||
|
// the partition function.
|
||||||
//
|
//
|
||||||
RealD scale = std::sqrt(0.5);
|
RealD scale = std::sqrt(0.5);
|
||||||
FermionField eta(FermOp.FermionGrid());
|
FermionField eta(FermOp.FermionGrid());
|
||||||
|
|
||||||
gaussian(pRNG,eta);
|
gaussian(pRNG, eta);
|
||||||
|
|
||||||
FermOp.ImportGauge(U);
|
FermOp.ImportGauge(U);
|
||||||
FermOp.Mdag(eta,Phi);
|
FermOp.Mdag(eta, Phi);
|
||||||
|
|
||||||
Phi=Phi*scale;
|
|
||||||
|
|
||||||
|
Phi = Phi * scale;
|
||||||
};
|
};
|
||||||
|
|
||||||
//////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////
|
||||||
// S = phi^dag (Mdag M)^-1 phi
|
// S = phi^dag (Mdag M)^-1 phi
|
||||||
//////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////
|
||||||
virtual RealD S(const GaugeField &U) {
|
virtual RealD S(const GaugeField &U) {
|
||||||
|
|
||||||
FermOp.ImportGauge(U);
|
FermOp.ImportGauge(U);
|
||||||
|
|
||||||
FermionField X(FermOp.FermionGrid());
|
FermionField X(FermOp.FermionGrid());
|
||||||
FermionField Y(FermOp.FermionGrid());
|
FermionField Y(FermOp.FermionGrid());
|
||||||
|
|
||||||
MdagMLinearOperator<FermionOperator<Impl> ,FermionField> MdagMOp(FermOp);
|
MdagMLinearOperator<FermionOperator<Impl>, FermionField> MdagMOp(FermOp);
|
||||||
X=zero;
|
X = zero;
|
||||||
ActionSolver(MdagMOp,Phi,X);
|
ActionSolver(MdagMOp, Phi, X);
|
||||||
MdagMOp.Op(X,Y);
|
MdagMOp.Op(X, Y);
|
||||||
|
|
||||||
RealD action = norm2(Y);
|
RealD action = norm2(Y);
|
||||||
std::cout << GridLogMessage << "Pseudofermion action "<<action<<std::endl;
|
std::cout << GridLogMessage << "Pseudofermion action " << action
|
||||||
|
<< std::endl;
|
||||||
return action;
|
return action;
|
||||||
};
|
};
|
||||||
|
|
||||||
//////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////
|
||||||
// dS/du = - phi^dag (Mdag M)^-1 [ Mdag dM + dMdag M ] (Mdag M)^-1 phi
|
// dS/du = - phi^dag (Mdag M)^-1 [ Mdag dM + dMdag M ] (Mdag M)^-1 phi
|
||||||
// = - phi^dag M^-1 dM (MdagM)^-1 phi - phi^dag (MdagM)^-1 dMdag dM (Mdag)^-1 phi
|
// = - phi^dag M^-1 dM (MdagM)^-1 phi - phi^dag (MdagM)^-1 dMdag dM
|
||||||
|
// (Mdag)^-1 phi
|
||||||
//
|
//
|
||||||
// = - Ydag dM X - Xdag dMdag Y
|
// = - Ydag dM X - Xdag dMdag Y
|
||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////
|
||||||
virtual void deriv(const GaugeField &U,GaugeField & dSdU) {
|
virtual void deriv(const GaugeField &U, GaugeField &dSdU) {
|
||||||
|
|
||||||
FermOp.ImportGauge(U);
|
FermOp.ImportGauge(U);
|
||||||
|
|
||||||
FermionField X(FermOp.FermionGrid());
|
FermionField X(FermOp.FermionGrid());
|
||||||
FermionField Y(FermOp.FermionGrid());
|
FermionField Y(FermOp.FermionGrid());
|
||||||
GaugeField tmp(FermOp.GaugeGrid());
|
GaugeField tmp(FermOp.GaugeGrid());
|
||||||
|
|
||||||
MdagMLinearOperator<FermionOperator<Impl> ,FermionField> MdagMOp(FermOp);
|
MdagMLinearOperator<FermionOperator<Impl>, FermionField> MdagMOp(FermOp);
|
||||||
|
|
||||||
X=zero;
|
X = zero;
|
||||||
DerivativeSolver(MdagMOp,Phi,X);
|
DerivativeSolver(MdagMOp, Phi, X);
|
||||||
MdagMOp.Op(X,Y);
|
MdagMOp.Op(X, Y);
|
||||||
|
|
||||||
// Our conventions really make this UdSdU; We do not differentiate wrt Udag here.
|
// 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.
|
// So must take dSdU - adj(dSdU) and left multiply by mom to get dS/dt.
|
||||||
|
|
||||||
FermOp.MDeriv(tmp , Y, X,DaggerNo ); dSdU=tmp;
|
FermOp.MDeriv(tmp, Y, X, DaggerNo);
|
||||||
FermOp.MDeriv(tmp , X, Y,DaggerYes); dSdU=dSdU+tmp;
|
dSdU = tmp;
|
||||||
|
FermOp.MDeriv(tmp, X, Y, DaggerYes);
|
||||||
//dSdU = Ta(dSdU);
|
dSdU = dSdU + tmp;
|
||||||
|
|
||||||
|
// not taking here the traceless antihermitian component
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,102 +1,105 @@
|
|||||||
/*************************************************************************************
|
/*************************************************************************************
|
||||||
|
|
||||||
Grid physics library, www.github.com/paboyle/Grid
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
Source file: ./lib/qcd/hmc/HmcRunner.h
|
Source file: ./lib/qcd/hmc/HmcRunner.h
|
||||||
|
|
||||||
Copyright (C) 2015
|
Copyright (C) 2015
|
||||||
|
|
||||||
Author: paboyle <paboyle@ph.ed.ac.uk>
|
Author: paboyle <paboyle@ph.ed.ac.uk>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along
|
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.,
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
See the full license in the file "LICENSE" in the top level distribution directory
|
See the full license in the file "LICENSE" in the top level distribution
|
||||||
*************************************************************************************/
|
directory
|
||||||
/* END LEGAL */
|
*************************************************************************************/
|
||||||
|
/* END LEGAL */
|
||||||
#ifndef HMC_RUNNER
|
#ifndef HMC_RUNNER
|
||||||
#define HMC_RUNNER
|
#define HMC_RUNNER
|
||||||
|
|
||||||
namespace Grid{
|
namespace Grid {
|
||||||
namespace QCD{
|
namespace QCD {
|
||||||
|
|
||||||
|
template <class Gimpl>
|
||||||
template<class Gimpl>
|
|
||||||
class NerscHmcRunnerTemplate {
|
class NerscHmcRunnerTemplate {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
INHERIT_GIMPL_TYPES(Gimpl);
|
INHERIT_GIMPL_TYPES(Gimpl);
|
||||||
|
|
||||||
enum StartType_t { ColdStart, HotStart, TepidStart, CheckpointStart };
|
enum StartType_t { ColdStart, HotStart, TepidStart, CheckpointStart };
|
||||||
|
|
||||||
ActionSet<GaugeField> TheAction;
|
ActionSet<GaugeField> TheAction;
|
||||||
|
|
||||||
GridCartesian * UGrid ;
|
GridCartesian *UGrid;
|
||||||
GridCartesian * FGrid ;
|
GridCartesian *FGrid;
|
||||||
GridRedBlackCartesian * UrbGrid ;
|
GridRedBlackCartesian *UrbGrid;
|
||||||
GridRedBlackCartesian * FrbGrid ;
|
GridRedBlackCartesian *FrbGrid;
|
||||||
|
|
||||||
virtual void BuildTheAction (int argc, char **argv) = 0; // necessary?
|
virtual void BuildTheAction(int argc, char **argv) = 0; // necessary?
|
||||||
|
|
||||||
|
|
||||||
void Run (int argc, char **argv){
|
|
||||||
|
|
||||||
|
void Run(int argc, char **argv) {
|
||||||
StartType_t StartType = HotStart;
|
StartType_t StartType = HotStart;
|
||||||
|
|
||||||
std::string arg;
|
std::string arg;
|
||||||
|
|
||||||
if( GridCmdOptionExists(argv,argv+argc,"--StartType") ){
|
if (GridCmdOptionExists(argv, argv + argc, "--StartType")) {
|
||||||
arg = GridCmdOptionPayload(argv,argv+argc,"--StartType");
|
arg = GridCmdOptionPayload(argv, argv + argc, "--StartType");
|
||||||
if ( arg == "HotStart" ) { StartType = HotStart; }
|
if (arg == "HotStart") {
|
||||||
else if ( arg == "ColdStart" ) { StartType = ColdStart; }
|
StartType = HotStart;
|
||||||
else if ( arg == "TepidStart" ) { StartType = TepidStart; }
|
} else if (arg == "ColdStart") {
|
||||||
else if ( arg == "CheckpointStart" ) { StartType = CheckpointStart; }
|
StartType = ColdStart;
|
||||||
else assert(0);
|
} else if (arg == "TepidStart") {
|
||||||
|
StartType = TepidStart;
|
||||||
|
} else if (arg == "CheckpointStart") {
|
||||||
|
StartType = CheckpointStart;
|
||||||
|
} else {
|
||||||
|
std::cout << GridLogError << "Unrecognized option in --StartType\n";
|
||||||
|
std::cout << GridLogError << "Valid [HotStart, ColdStart, TepidStart, CheckpointStart]\n";
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int StartTraj = 0;
|
int StartTraj = 0;
|
||||||
if( GridCmdOptionExists(argv,argv+argc,"--StartTrajectory") ){
|
if (GridCmdOptionExists(argv, argv + argc, "--StartTrajectory")) {
|
||||||
arg= GridCmdOptionPayload(argv,argv+argc,"--StartTrajectory");
|
arg = GridCmdOptionPayload(argv, argv + argc, "--StartTrajectory");
|
||||||
std::vector<int> ivec(0);
|
std::vector<int> ivec(0);
|
||||||
GridCmdOptionIntVector(arg,ivec);
|
GridCmdOptionIntVector(arg, ivec);
|
||||||
StartTraj = ivec[0];
|
StartTraj = ivec[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
int NumTraj = 1;
|
int NumTraj = 1;
|
||||||
if( GridCmdOptionExists(argv,argv+argc,"--Trajectories") ){
|
if (GridCmdOptionExists(argv, argv + argc, "--Trajectories")) {
|
||||||
arg= GridCmdOptionPayload(argv,argv+argc,"--Trajectories");
|
arg = GridCmdOptionPayload(argv, argv + argc, "--Trajectories");
|
||||||
std::vector<int> ivec(0);
|
std::vector<int> ivec(0);
|
||||||
GridCmdOptionIntVector(arg,ivec);
|
GridCmdOptionIntVector(arg, ivec);
|
||||||
NumTraj = ivec[0];
|
NumTraj = ivec[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
int NumThermalizations = 10;
|
int NumThermalizations = 10;
|
||||||
if( GridCmdOptionExists(argv,argv+argc,"--Thermalizations") ){
|
if (GridCmdOptionExists(argv, argv + argc, "--Thermalizations")) {
|
||||||
arg= GridCmdOptionPayload(argv,argv+argc,"--Thermalizations");
|
arg = GridCmdOptionPayload(argv, argv + argc, "--Thermalizations");
|
||||||
std::vector<int> ivec(0);
|
std::vector<int> ivec(0);
|
||||||
GridCmdOptionIntVector(arg,ivec);
|
GridCmdOptionIntVector(arg, ivec);
|
||||||
NumThermalizations = ivec[0];
|
NumThermalizations = ivec[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GridSerialRNG sRNG;
|
GridSerialRNG sRNG;
|
||||||
GridParallelRNG pRNG(UGrid);
|
GridParallelRNG pRNG(UGrid);
|
||||||
LatticeGaugeField U(UGrid); // change this to an extended field (smearing class)
|
LatticeGaugeField U(UGrid); // change this to an extended field (smearing class)
|
||||||
|
|
||||||
std::vector<int> SerSeed({1,2,3,4,5});
|
std::vector<int> SerSeed({1, 2, 3, 4, 5});
|
||||||
std::vector<int> ParSeed({6,7,8,9,10});
|
std::vector<int> ParSeed({6, 7, 8, 9, 10});
|
||||||
|
|
||||||
|
|
||||||
// Create integrator, including the smearing policy
|
// Create integrator, including the smearing policy
|
||||||
// Smearing policy
|
// Smearing policy
|
||||||
@ -108,13 +111,14 @@ public:
|
|||||||
SmearedConfiguration<Gimpl> SmearingPolicy(UGrid, Nsmear, Stout);
|
SmearedConfiguration<Gimpl> SmearingPolicy(UGrid, Nsmear, Stout);
|
||||||
std::cout << GridLogDebug << " done\n";
|
std::cout << GridLogDebug << " done\n";
|
||||||
//////////////
|
//////////////
|
||||||
typedef MinimumNorm2<GaugeField, SmearedConfiguration<Gimpl> > IntegratorType;// change here to change the algorithm
|
typedef MinimumNorm2<GaugeField, SmearedConfiguration<Gimpl> >
|
||||||
|
IntegratorType; // change here to change the algorithm
|
||||||
IntegratorParameters MDpar(20);
|
IntegratorParameters MDpar(20);
|
||||||
IntegratorType MDynamics(UGrid, MDpar, TheAction, SmearingPolicy);
|
IntegratorType MDynamics(UGrid, MDpar, TheAction, SmearingPolicy);
|
||||||
|
|
||||||
|
|
||||||
// Checkpoint strategy
|
// Checkpoint strategy
|
||||||
NerscHmcCheckpointer<Gimpl> Checkpoint(std::string("ckpoint_lat"),std::string("ckpoint_rng"),1);
|
NerscHmcCheckpointer<Gimpl> Checkpoint(std::string("ckpoint_lat"),
|
||||||
|
std::string("ckpoint_rng"), 1);
|
||||||
PlaquetteLogger<Gimpl> PlaqLog(std::string("plaq"));
|
PlaquetteLogger<Gimpl> PlaqLog(std::string("plaq"));
|
||||||
|
|
||||||
HMCparameters HMCpar;
|
HMCparameters HMCpar;
|
||||||
@ -122,58 +126,57 @@ public:
|
|||||||
HMCpar.Trajectories = NumTraj;
|
HMCpar.Trajectories = NumTraj;
|
||||||
HMCpar.NoMetropolisUntil = NumThermalizations;
|
HMCpar.NoMetropolisUntil = NumThermalizations;
|
||||||
|
|
||||||
|
if (StartType == HotStart) {
|
||||||
if ( StartType == HotStart ) {
|
|
||||||
// Hot start
|
// Hot start
|
||||||
HMCpar.MetropolisTest = true;
|
HMCpar.MetropolisTest = true;
|
||||||
sRNG.SeedFixedIntegers(SerSeed);
|
sRNG.SeedFixedIntegers(SerSeed);
|
||||||
pRNG.SeedFixedIntegers(ParSeed);
|
pRNG.SeedFixedIntegers(ParSeed);
|
||||||
SU3::HotConfiguration(pRNG, U);
|
SU3::HotConfiguration(pRNG, U);
|
||||||
} else if ( StartType == ColdStart ) {
|
} else if (StartType == ColdStart) {
|
||||||
// Cold start
|
// Cold start
|
||||||
HMCpar.MetropolisTest = true;
|
HMCpar.MetropolisTest = true;
|
||||||
sRNG.SeedFixedIntegers(SerSeed);
|
sRNG.SeedFixedIntegers(SerSeed);
|
||||||
pRNG.SeedFixedIntegers(ParSeed);
|
pRNG.SeedFixedIntegers(ParSeed);
|
||||||
SU3::ColdConfiguration(pRNG, U);
|
SU3::ColdConfiguration(pRNG, U);
|
||||||
} else if ( StartType == TepidStart ) {
|
} else if (StartType == TepidStart) {
|
||||||
// Tepid start
|
// Tepid start
|
||||||
HMCpar.MetropolisTest = true;
|
HMCpar.MetropolisTest = true;
|
||||||
sRNG.SeedFixedIntegers(SerSeed);
|
sRNG.SeedFixedIntegers(SerSeed);
|
||||||
pRNG.SeedFixedIntegers(ParSeed);
|
pRNG.SeedFixedIntegers(ParSeed);
|
||||||
SU3::TepidConfiguration(pRNG, U);
|
SU3::TepidConfiguration(pRNG, U);
|
||||||
} else if ( StartType == CheckpointStart ) {
|
} else if (StartType == CheckpointStart) {
|
||||||
HMCpar.MetropolisTest = true;
|
HMCpar.MetropolisTest = true;
|
||||||
// CheckpointRestart
|
// CheckpointRestart
|
||||||
Checkpoint.CheckpointRestore(StartTraj, U, sRNG, pRNG);
|
Checkpoint.CheckpointRestore(StartTraj, U, sRNG, pRNG);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attach the gauge field to the smearing Policy and create the fill the smeared set
|
// Attach the gauge field to the smearing Policy and create the fill the
|
||||||
|
// smeared set
|
||||||
// notice that the unit configuration is singular in this procedure
|
// notice that the unit configuration is singular in this procedure
|
||||||
std::cout << GridLogMessage << "Filling the smeared set\n";
|
std::cout << GridLogMessage << "Filling the smeared set\n";
|
||||||
SmearingPolicy.set_GaugeField(U);
|
SmearingPolicy.set_GaugeField(U);
|
||||||
|
|
||||||
HybridMonteCarlo<GaugeField,IntegratorType> HMC(HMCpar, MDynamics,sRNG,pRNG,U);
|
HybridMonteCarlo<GaugeField, IntegratorType> HMC(HMCpar, MDynamics, sRNG,
|
||||||
|
pRNG, U);
|
||||||
HMC.AddObservable(&Checkpoint);
|
HMC.AddObservable(&Checkpoint);
|
||||||
HMC.AddObservable(&PlaqLog);
|
HMC.AddObservable(&PlaqLog);
|
||||||
|
|
||||||
// Run it
|
// Run it
|
||||||
HMC.evolve();
|
HMC.evolve();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef NerscHmcRunnerTemplate<PeriodicGimplR> NerscHmcRunner;
|
typedef NerscHmcRunnerTemplate<PeriodicGimplR> NerscHmcRunner;
|
||||||
typedef NerscHmcRunnerTemplate<PeriodicGimplF> NerscHmcRunnerF;
|
typedef NerscHmcRunnerTemplate<PeriodicGimplF> NerscHmcRunnerF;
|
||||||
typedef NerscHmcRunnerTemplate<PeriodicGimplD> NerscHmcRunnerD;
|
typedef NerscHmcRunnerTemplate<PeriodicGimplD> NerscHmcRunnerD;
|
||||||
|
|
||||||
typedef NerscHmcRunnerTemplate<PeriodicGimplR> PeriodicNerscHmcRunner;
|
typedef NerscHmcRunnerTemplate<PeriodicGimplR> PeriodicNerscHmcRunner;
|
||||||
typedef NerscHmcRunnerTemplate<PeriodicGimplF> PeriodicNerscHmcRunnerF;
|
typedef NerscHmcRunnerTemplate<PeriodicGimplF> PeriodicNerscHmcRunnerF;
|
||||||
typedef NerscHmcRunnerTemplate<PeriodicGimplD> PeriodicNerscHmcRunnerD;
|
typedef NerscHmcRunnerTemplate<PeriodicGimplD> PeriodicNerscHmcRunnerD;
|
||||||
|
|
||||||
typedef NerscHmcRunnerTemplate<ConjugateGimplR> ConjugateNerscHmcRunner;
|
typedef NerscHmcRunnerTemplate<ConjugateGimplR> ConjugateNerscHmcRunner;
|
||||||
typedef NerscHmcRunnerTemplate<ConjugateGimplF> ConjugateNerscHmcRunnerF;
|
typedef NerscHmcRunnerTemplate<ConjugateGimplF> ConjugateNerscHmcRunnerF;
|
||||||
typedef NerscHmcRunnerTemplate<ConjugateGimplD> ConjugateNerscHmcRunnerD;
|
typedef NerscHmcRunnerTemplate<ConjugateGimplD> ConjugateNerscHmcRunnerD;
|
||||||
|
}
|
||||||
}}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -138,8 +138,6 @@ class Integrator {
|
|||||||
}
|
}
|
||||||
void update_U(GaugeField& Mom, GaugeField& U, double ep) {
|
void update_U(GaugeField& Mom, GaugeField& U, double ep) {
|
||||||
// rewrite exponential to deal automatically with the lorentz index?
|
// rewrite exponential to deal automatically with the lorentz index?
|
||||||
// GaugeLinkField Umu(U._grid);
|
|
||||||
// GaugeLinkField Pmu(U._grid);
|
|
||||||
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);
|
||||||
auto Pmu = PeekIndex<LorentzIndex>(Mom, mu);
|
auto Pmu = PeekIndex<LorentzIndex>(Mom, mu);
|
||||||
@ -168,6 +166,9 @@ class Integrator {
|
|||||||
void refresh(GaugeField& U, GridParallelRNG& pRNG) {
|
void refresh(GaugeField& U, GridParallelRNG& pRNG) {
|
||||||
std::cout << GridLogIntegrator << "Integrator refresh\n";
|
std::cout << GridLogIntegrator << "Integrator refresh\n";
|
||||||
generate_momenta(P, pRNG);
|
generate_momenta(P, pRNG);
|
||||||
|
// The Smearer is attached to a pointer of the gauge field
|
||||||
|
// automatically gets the updated field
|
||||||
|
// whether or not has been accepted in the previous sweep
|
||||||
for (int level = 0; level < as.size(); ++level) {
|
for (int level = 0; level < as.size(); ++level) {
|
||||||
for (int actionID = 0; actionID < as[level].actions.size(); ++actionID) {
|
for (int actionID = 0; actionID < as[level].actions.size(); ++actionID) {
|
||||||
// get gauge field from the SmearingPolicy and
|
// get gauge field from the SmearingPolicy and
|
||||||
|
61
lib/qcd/representations/adjoint.h
Normal file
61
lib/qcd/representations/adjoint.h
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Policy classes for the HMC
|
||||||
|
* Author: Guido Cossu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ADJOINT_H
|
||||||
|
#define ADJOINT_H
|
||||||
|
|
||||||
|
|
||||||
|
namespace Grid {
|
||||||
|
namespace QCD {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is an helper class for the HMC
|
||||||
|
* Should contain only the data for the adjoint representation
|
||||||
|
* and the facility to convert from the fundamental -> adjoint
|
||||||
|
*/
|
||||||
|
|
||||||
|
template <int ncolour>
|
||||||
|
class AdjointRep {
|
||||||
|
public:
|
||||||
|
typename SU_Adjoint<ncolour>::LatticeAdjMatrix U;
|
||||||
|
const int Dimension = ncolour * ncolour - 1;
|
||||||
|
|
||||||
|
explicit AdjointRep(GridBase* grid):U(grid) {}
|
||||||
|
void update_representation(const LatticeGaugeField& Uin) {
|
||||||
|
// Uin is in the fundamental representation
|
||||||
|
// get the U in AdjointRep
|
||||||
|
// (U_adj)_B = tr[e^a U e^b U^dag]
|
||||||
|
// e^a = t^a/sqrt(T_F)
|
||||||
|
// where t^a is the generator in the fundamental
|
||||||
|
// T_F is 1/2 for the fundamental representation
|
||||||
|
conformable(U, Uin);
|
||||||
|
U = zero;
|
||||||
|
LatticeGaugeField tmp(Uin._grid);
|
||||||
|
|
||||||
|
Vector<typename SU<ncolour>::Matrix > ta(ncolour * ncolour - 1);
|
||||||
|
|
||||||
|
// FIXME probably not very efficient to get all the generators everytime
|
||||||
|
for (int a = 0; a < Dimension; a++) SU<ncolour>::generator(a, ta[a]);
|
||||||
|
|
||||||
|
for (int a = 0; a < Dimension; a++) {
|
||||||
|
tmp = 2.0 * adj(Uin) * ta[a] * Uin;
|
||||||
|
for (int b = 0; b < (ncolour * ncolour - 1); b++) {
|
||||||
|
auto Tr = TensorRemove(trace(tmp * ta[b]));
|
||||||
|
pokeColour(U, Tr, a,b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef AdjointRep<Nc> AdjointRepresentation;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
46
lib/qcd/representations/hmc_types.h
Normal file
46
lib/qcd/representations/hmc_types.h
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#ifndef HMC_TYPES_H
|
||||||
|
#define HMC_TYPES_H
|
||||||
|
|
||||||
|
#include <tuple>
|
||||||
|
#include <utility>
|
||||||
|
#include <qcd/representations/adjoint.h>
|
||||||
|
|
||||||
|
namespace Grid {
|
||||||
|
namespace QCD {
|
||||||
|
|
||||||
|
// Utility to add support for representations other than the fundamental
|
||||||
|
|
||||||
|
template<class... Reptypes>
|
||||||
|
class Representations{
|
||||||
|
public:
|
||||||
|
typedef std::tuple<Reptypes...> Representation_type;
|
||||||
|
Representation_type rep;
|
||||||
|
|
||||||
|
// Multiple types constructor
|
||||||
|
explicit Representations(GridBase *grid):rep(Reptypes(grid)...){};
|
||||||
|
|
||||||
|
int size(){
|
||||||
|
return std::tuple_size< Representation_type >::value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// update the fields
|
||||||
|
template <std::size_t I = 0>
|
||||||
|
inline typename std::enable_if< I == sizeof...(Reptypes), void >::type update(LatticeGaugeField& U) {}
|
||||||
|
|
||||||
|
template <std::size_t I = 0>
|
||||||
|
inline typename std::enable_if <
|
||||||
|
I<sizeof...(Reptypes), void >::type update(LatticeGaugeField& U) {
|
||||||
|
std::get<I>(rep).update_representation(U);
|
||||||
|
update<I + 1>(U);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -38,7 +38,8 @@ namespace QCD {
|
|||||||
template <int ncolour>
|
template <int ncolour>
|
||||||
class SU {
|
class SU {
|
||||||
public:
|
public:
|
||||||
static int generators(void) { return ncolour * ncolour - 1; }
|
static const int Dimension = ncolour;
|
||||||
|
static const int AdjointDimension = ncolour * ncolour - 1;
|
||||||
static int su2subgroups(void) { return (ncolour * (ncolour - 1)) / 2; }
|
static int su2subgroups(void) { return (ncolour * (ncolour - 1)) / 2; }
|
||||||
|
|
||||||
template <typename vtype>
|
template <typename vtype>
|
||||||
@ -46,11 +47,8 @@ class SU {
|
|||||||
template <typename vtype>
|
template <typename vtype>
|
||||||
using iSU2Matrix = iScalar<iScalar<iMatrix<vtype, 2> > >;
|
using iSU2Matrix = iScalar<iScalar<iMatrix<vtype, 2> > >;
|
||||||
template <typename vtype>
|
template <typename vtype>
|
||||||
using iSUnAdjointMatrix = iScalar<iScalar<iMatrix<vtype, (ncolour*ncolour - 1)> > >;
|
using iSUnAlgebraVector =
|
||||||
template <typename vtype>
|
iScalar<iScalar<iVector<vtype, (ncolour * ncolour - 1)> > >;
|
||||||
using iSUnAlgebraVector = iScalar<iScalar<iVector<vtype , (ncolour*ncolour -1)> > >;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Types can be accessed as SU<2>::Matrix , SU<2>::vSUnMatrix,
|
// Types can be accessed as SU<2>::Matrix , SU<2>::vSUnMatrix,
|
||||||
@ -64,16 +62,6 @@ class SU {
|
|||||||
typedef iSUnMatrix<vComplexF> vMatrixF;
|
typedef iSUnMatrix<vComplexF> vMatrixF;
|
||||||
typedef iSUnMatrix<vComplexD> vMatrixD;
|
typedef iSUnMatrix<vComplexD> vMatrixD;
|
||||||
|
|
||||||
// Actually the adjoint matrices are real...
|
|
||||||
// Consider this overhead... FIXME
|
|
||||||
typedef iSUnAdjointMatrix<Complex> AMatrix;
|
|
||||||
typedef iSUnAdjointMatrix<ComplexF> AMatrixF;
|
|
||||||
typedef iSUnAdjointMatrix<ComplexD> AMatrixD;
|
|
||||||
|
|
||||||
typedef iSUnAdjointMatrix<vComplex> vAMatrix;
|
|
||||||
typedef iSUnAdjointMatrix<vComplexF> vAMatrixF;
|
|
||||||
typedef iSUnAdjointMatrix<vComplexD> vAMatrixD;
|
|
||||||
|
|
||||||
// For the projectors to the algebra
|
// For the projectors to the algebra
|
||||||
// these should be real...
|
// these should be real...
|
||||||
// keeping complex for consistency with the SIMD vector types
|
// keeping complex for consistency with the SIMD vector types
|
||||||
@ -152,19 +140,6 @@ class SU {
|
|||||||
// ( 1 ) / sqrt(3) /2 = 1/2 lambda_8
|
// ( 1 ) / sqrt(3) /2 = 1/2 lambda_8
|
||||||
// ( -2)
|
// ( -2)
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// * Adjoint representation generators
|
|
||||||
//
|
|
||||||
// base for NxN hermitian traceless matrices
|
|
||||||
// normalized to 1:
|
|
||||||
//
|
|
||||||
// (e_Adj)^a = t^a / sqrt(T_F)
|
|
||||||
//
|
|
||||||
// then the real, antisymmetric generators for the adjoint representations
|
|
||||||
// are computed ( shortcut: e^a == (e_Adj)^a )
|
|
||||||
//
|
|
||||||
// (iT_adj)^d_ab = i tr[e^a t^d e^b - t^d e^a e^b]
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
template <class cplx>
|
template <class cplx>
|
||||||
static void generator(int lieIndex, iSUnMatrix<cplx> &ta) {
|
static void generator(int lieIndex, iSUnMatrix<cplx> &ta) {
|
||||||
@ -178,7 +153,7 @@ class SU {
|
|||||||
generatorDiagonal(diagIndex, ta);
|
generatorDiagonal(diagIndex, ta);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sigxy = lieIndex & 0x1;//even or odd
|
sigxy = lieIndex & 0x1; // even or odd
|
||||||
su2Index = lieIndex >> 1;
|
su2Index = lieIndex >> 1;
|
||||||
if (sigxy)
|
if (sigxy)
|
||||||
generatorSigmaY(su2Index, ta);
|
generatorSigmaY(su2Index, ta);
|
||||||
@ -208,39 +183,15 @@ class SU {
|
|||||||
static void generatorDiagonal(int diagIndex, iSUnMatrix<cplx> &ta) {
|
static void generatorDiagonal(int diagIndex, iSUnMatrix<cplx> &ta) {
|
||||||
// diag ({1, 1, ..., 1}(k-times), -k, 0, 0, ...)
|
// diag ({1, 1, ..., 1}(k-times), -k, 0, 0, ...)
|
||||||
ta = zero;
|
ta = zero;
|
||||||
int k = diagIndex + 1;// diagIndex starts from 0
|
int k = diagIndex + 1; // diagIndex starts from 0
|
||||||
for (int i = 0; i <= diagIndex; i++) {// k iterations
|
for (int i = 0; i <= diagIndex; i++) { // k iterations
|
||||||
ta()()(i, i) = 1.0;
|
ta()()(i, i) = 1.0;
|
||||||
}
|
}
|
||||||
ta()()(k,k) = -k;//indexing starts from 0
|
ta()()(k, k) = -k; // indexing starts from 0
|
||||||
RealD nrm = 1.0 / std::sqrt(2.0 * k*(k+1));
|
RealD nrm = 1.0 / std::sqrt(2.0 * k * (k + 1));
|
||||||
ta = ta * nrm;
|
ta = ta * nrm;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class cplx>
|
|
||||||
static void generatorAdjoint(int Index, iSUnAdjointMatrix<cplx> &iAdjTa){
|
|
||||||
// returns i(T_Adj)^index necessary for the projectors
|
|
||||||
// see definitions above
|
|
||||||
iAdjTa = zero;
|
|
||||||
Vector< iSUnMatrix<cplx> > ta(ncolour*ncolour -1);
|
|
||||||
iSUnMatrix<cplx> tmp;
|
|
||||||
|
|
||||||
// FIXME not very efficient to get all the generators everytime
|
|
||||||
for (int a = 0; a < (ncolour * ncolour - 1); a++)
|
|
||||||
generator(a, ta[a]);
|
|
||||||
|
|
||||||
|
|
||||||
for (int a = 0; a < (ncolour*ncolour - 1); a++){
|
|
||||||
tmp = ta[a] * ta[Index] - ta[Index] * ta[a];
|
|
||||||
for (int b = 0; b < (ncolour*ncolour - 1); b++){
|
|
||||||
iSUnMatrix<cplx> tmp1 = 2.0 * tmp * ta[b]; // 2.0 from the normalization
|
|
||||||
Complex iTr = TensorRemove(timesI(trace(tmp1)));
|
|
||||||
iAdjTa()()(b,a) = iTr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// Map a su2 subgroup number to the pair of rows that are non zero
|
// Map a su2 subgroup number to the pair of rows that are non zero
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
@ -600,7 +551,7 @@ class SU {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void printGenerators(void) {
|
static void printGenerators(void) {
|
||||||
for (int gen = 0; gen < generators(); gen++) {
|
for (int gen = 0; gen < AdjointDimension; 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
|
||||||
@ -609,71 +560,44 @@ class SU {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void printAdjointGenerators(void) {
|
|
||||||
for (int gen = 0; gen < generators(); gen++) {
|
|
||||||
AMatrix ta;
|
|
||||||
generatorAdjoint(gen, ta);
|
|
||||||
std::cout << GridLogMessage << "Nc = " << ncolour << " t_" << gen
|
|
||||||
<< std::endl;
|
|
||||||
std::cout << GridLogMessage << ta << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void testGenerators(void) {
|
static void testGenerators(void) {
|
||||||
Matrix ta;
|
Matrix ta;
|
||||||
Matrix tb;
|
Matrix tb;
|
||||||
std::cout << GridLogMessage << "Fundamental - Checking trace ta tb is 0.5 delta_ab"
|
std::cout << GridLogMessage
|
||||||
|
<< "Fundamental - Checking trace ta tb is 0.5 delta_ab"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
for (int a = 0; a < generators(); a++) {
|
for (int a = 0; a < AdjointDimension; a++) {
|
||||||
for (int b = 0; b < generators(); b++) {
|
for (int b = 0; b < AdjointDimension; b++) {
|
||||||
generator(a, ta);
|
generator(a, ta);
|
||||||
generator(b, tb);
|
generator(b, tb);
|
||||||
Complex tr = TensorRemove(trace(ta * tb));
|
Complex tr = TensorRemove(trace(ta * tb));
|
||||||
std::cout << GridLogMessage << "("<< a << "," << b << ") = "<< tr << std::endl;
|
std::cout << GridLogMessage << "(" << a << "," << b << ") = " << tr
|
||||||
|
<< std::endl;
|
||||||
if (a == b) assert(abs(tr - Complex(0.5)) < 1.0e-6);
|
if (a == b) assert(abs(tr - Complex(0.5)) < 1.0e-6);
|
||||||
if (a != b) assert(abs(tr) < 1.0e-6);
|
if (a != b) assert(abs(tr) < 1.0e-6);
|
||||||
}
|
}
|
||||||
std::cout << GridLogMessage << std::endl;
|
std::cout << GridLogMessage << std::endl;
|
||||||
}
|
}
|
||||||
std::cout << GridLogMessage << "Fundamental - Checking if hermitian" << std::endl;
|
std::cout << GridLogMessage << "Fundamental - Checking if hermitian"
|
||||||
for (int a = 0; a < generators(); a++) {
|
<< std::endl;
|
||||||
|
for (int a = 0; a < AdjointDimension; a++) {
|
||||||
generator(a, ta);
|
generator(a, ta);
|
||||||
std::cout << GridLogMessage << a << std::endl;
|
std::cout << GridLogMessage << a << std::endl;
|
||||||
assert(norm2(ta - adj(ta)) < 1.0e-6) ;
|
assert(norm2(ta - adj(ta)) < 1.0e-6);
|
||||||
}
|
}
|
||||||
std::cout << GridLogMessage << std::endl;
|
std::cout << GridLogMessage << std::endl;
|
||||||
|
|
||||||
std::cout << GridLogMessage << "Fundamental - Checking if traceless" << std::endl;
|
std::cout << GridLogMessage << "Fundamental - Checking if traceless"
|
||||||
for (int a = 0; a < generators(); a++) {
|
<< std::endl;
|
||||||
|
for (int a = 0; a < AdjointDimension; a++) {
|
||||||
generator(a, ta);
|
generator(a, ta);
|
||||||
Complex tr = TensorRemove(trace(ta));
|
Complex tr = TensorRemove(trace(ta));
|
||||||
std::cout << GridLogMessage << a << " " << std::endl;
|
std::cout << GridLogMessage << a << " " << std::endl;
|
||||||
assert(abs(tr) < 1.0e-6);
|
assert(abs(tr) < 1.0e-6);
|
||||||
}
|
}
|
||||||
std::cout << GridLogMessage << std::endl;
|
std::cout << GridLogMessage << std::endl;
|
||||||
|
|
||||||
AMatrix adjTa;
|
|
||||||
std::cout << GridLogMessage << "Adjoint - Checking if real" << std::endl;
|
|
||||||
for (int a = 0; a < generators(); a++) {
|
|
||||||
generatorAdjoint(a, adjTa);
|
|
||||||
std::cout << GridLogMessage << a << std::endl;
|
|
||||||
assert(norm2(adjTa - conjugate(adjTa)) < 1.0e-6);
|
|
||||||
}
|
|
||||||
std::cout << GridLogMessage << std::endl;
|
|
||||||
|
|
||||||
std::cout << GridLogMessage << "Adjoint - Checking if antisymmetric" << std::endl;
|
|
||||||
for (int a = 0; a < generators(); a++) {
|
|
||||||
generatorAdjoint(a, adjTa);
|
|
||||||
std::cout << GridLogMessage << a << std::endl;
|
|
||||||
assert(norm2(adjTa + transpose(adjTa)) < 1.0e-6);
|
|
||||||
}
|
|
||||||
std::cout << GridLogMessage << std::endl;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// reunitarise??
|
// reunitarise??
|
||||||
@ -699,7 +623,7 @@ class SU {
|
|||||||
MatrixType ta;
|
MatrixType ta;
|
||||||
|
|
||||||
lie = zero;
|
lie = zero;
|
||||||
for (int a = 0; a < generators(); a++) {
|
for (int a = 0; a < AdjointDimension; a++) {
|
||||||
random(pRNG, ca);
|
random(pRNG, ca);
|
||||||
|
|
||||||
ca = (ca + conjugate(ca)) * 0.5;
|
ca = (ca + conjugate(ca)) * 0.5;
|
||||||
@ -724,7 +648,7 @@ class SU {
|
|||||||
Matrix ta;
|
Matrix ta;
|
||||||
|
|
||||||
out = zero;
|
out = zero;
|
||||||
for (int a = 0; a < generators(); a++) {
|
for (int a = 0; a < AdjointDimension; a++) {
|
||||||
gaussian(pRNG, ca);
|
gaussian(pRNG, ca);
|
||||||
generator(a, ta);
|
generator(a, ta);
|
||||||
la = toComplex(ca) * ci * ta;
|
la = toComplex(ca) * ci * ta;
|
||||||
@ -732,30 +656,23 @@ class SU {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FundamentalLieAlgebraMatrix(LatticeAlgebraVector &h, LatticeMatrix &out,
|
static void FundamentalLieAlgebraMatrix(LatticeAlgebraVector &h,
|
||||||
|
LatticeMatrix &out,
|
||||||
Real scale = 1.0) {
|
Real scale = 1.0) {
|
||||||
|
conformable(h, out);
|
||||||
GridBase *grid = out._grid;
|
GridBase *grid = out._grid;
|
||||||
LatticeMatrix la(grid);
|
LatticeMatrix la(grid);
|
||||||
Matrix ta;
|
Matrix ta;
|
||||||
|
|
||||||
out = zero;
|
out = zero;
|
||||||
for (int a = 0; a < generators(); a++) {
|
for (int a = 0; a < AdjointDimension; a++) {
|
||||||
generator(a, ta);
|
generator(a, ta);
|
||||||
la = peekColour(h,a) * scale * ta;
|
la = peekColour(h, a) * scale * ta;
|
||||||
out += la;
|
out += la;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void projectAdjointAlgebra(LatticeAlgebraVector &h_out, LatticeMatrix &in){
|
|
||||||
GridBase *grid = in._grid;
|
|
||||||
AMatrix iTa;
|
|
||||||
|
|
||||||
for (int a = 0; a< generators(); a++){
|
|
||||||
generatorAdjoint(a, iTa);
|
|
||||||
AlgebraVector tmp = real(trace(iTa * in));//*factor
|
|
||||||
pokeColour(h_out, tmp, a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename GaugeField>
|
template <typename GaugeField>
|
||||||
static void HotConfiguration(GridParallelRNG &pRNG, GaugeField &out) {
|
static void HotConfiguration(GridParallelRNG &pRNG, GaugeField &out) {
|
||||||
|
149
lib/qcd/utils/SUnAdjoint.h
Normal file
149
lib/qcd/utils/SUnAdjoint.h
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
#ifndef QCD_UTIL_SUNADJOINT_H
|
||||||
|
#define QCD_UTIL_SUNADJOINT_H
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// * Adjoint representation generators
|
||||||
|
//
|
||||||
|
// * Normalisation for the fundamental generators:
|
||||||
|
// trace ta tb = 1/2 delta_ab = T_F delta_ab
|
||||||
|
// T_F = 1/2 for SU(N) groups
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// base for NxN hermitian traceless matrices
|
||||||
|
// normalized to 1:
|
||||||
|
//
|
||||||
|
// (e_Adj)^a = t^a / sqrt(T_F)
|
||||||
|
//
|
||||||
|
// then the real, antisymmetric generators for the adjoint representations
|
||||||
|
// are computed ( shortcut: e^a == (e_Adj)^a )
|
||||||
|
//
|
||||||
|
// (iT_adj)^d_ba = i tr[e^a t^d e^b - t^d e^a e^b]
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
namespace Grid {
|
||||||
|
namespace QCD {
|
||||||
|
|
||||||
|
template <int ncolour>
|
||||||
|
class SU_Adjoint : public SU<ncolour> {
|
||||||
|
public:
|
||||||
|
static const int Dimension = ncolour * ncolour - 1;
|
||||||
|
|
||||||
|
template <typename vtype>
|
||||||
|
using iSUnAdjointMatrix =
|
||||||
|
iScalar<iScalar<iMatrix<vtype, Dimension > > >;
|
||||||
|
|
||||||
|
// Actually the adjoint matrices are real...
|
||||||
|
// Consider this overhead... FIXME
|
||||||
|
typedef iSUnAdjointMatrix<Complex> AMatrix;
|
||||||
|
typedef iSUnAdjointMatrix<ComplexF> AMatrixF;
|
||||||
|
typedef iSUnAdjointMatrix<ComplexD> AMatrixD;
|
||||||
|
|
||||||
|
typedef iSUnAdjointMatrix<vComplex> vAMatrix;
|
||||||
|
typedef iSUnAdjointMatrix<vComplexF> vAMatrixF;
|
||||||
|
typedef iSUnAdjointMatrix<vComplexD> vAMatrixD;
|
||||||
|
|
||||||
|
typedef Lattice<vAMatrix> LatticeAdjMatrix;
|
||||||
|
typedef Lattice<vAMatrixF> LatticeAdjMatrixF;
|
||||||
|
typedef Lattice<vAMatrixD> LatticeAdjMatrixD;
|
||||||
|
|
||||||
|
|
||||||
|
template <class cplx>
|
||||||
|
static void generator(int Index, iSUnAdjointMatrix<cplx> &iAdjTa) {
|
||||||
|
// returns i(T_Adj)^index necessary for the projectors
|
||||||
|
// see definitions above
|
||||||
|
iAdjTa = zero;
|
||||||
|
Vector<typename SU<ncolour>::template iSUnMatrix<cplx> > ta(ncolour * ncolour - 1);
|
||||||
|
typename SU<ncolour>::template iSUnMatrix<cplx> tmp;
|
||||||
|
|
||||||
|
// FIXME not very efficient to get all the generators everytime
|
||||||
|
for (int a = 0; a < Dimension; a++) SU<ncolour>::generator(a, ta[a]);
|
||||||
|
|
||||||
|
for (int a = 0; a < Dimension; a++) {
|
||||||
|
tmp = ta[a] * ta[Index] - ta[Index] * ta[a];
|
||||||
|
for (int b = 0; b < (ncolour * ncolour - 1); b++) {
|
||||||
|
typename SU<ncolour>::template iSUnMatrix<cplx> tmp1 =
|
||||||
|
2.0 * tmp * ta[b]; // 2.0 from the normalization
|
||||||
|
Complex iTr = TensorRemove(timesI(trace(tmp1)));
|
||||||
|
iAdjTa()()(b, a) = iTr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void printGenerators(void) {
|
||||||
|
for (int gen = 0; gen < Dimension; gen++) {
|
||||||
|
AMatrix ta;
|
||||||
|
generator(gen, ta);
|
||||||
|
std::cout << GridLogMessage << "Nc = " << ncolour << " t_" << gen
|
||||||
|
<< std::endl;
|
||||||
|
std::cout << GridLogMessage << ta << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void testGenerators(void) {
|
||||||
|
AMatrix adjTa;
|
||||||
|
std::cout << GridLogMessage << "Adjoint - Checking if real" << std::endl;
|
||||||
|
for (int a = 0; a < Dimension; a++) {
|
||||||
|
generator(a, adjTa);
|
||||||
|
std::cout << GridLogMessage << a << std::endl;
|
||||||
|
assert(norm2(adjTa - conjugate(adjTa)) < 1.0e-6);
|
||||||
|
}
|
||||||
|
std::cout << GridLogMessage << std::endl;
|
||||||
|
|
||||||
|
std::cout << GridLogMessage << "Adjoint - Checking if antisymmetric"
|
||||||
|
<< std::endl;
|
||||||
|
for (int a = 0; a < Dimension; a++) {
|
||||||
|
generator(a, adjTa);
|
||||||
|
std::cout << GridLogMessage << a << std::endl;
|
||||||
|
assert(norm2(adjTa + transpose(adjTa)) < 1.0e-6);
|
||||||
|
}
|
||||||
|
std::cout << GridLogMessage << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Projects the algebra components a lattice matrix (of dimension ncol*ncol -1 )
|
||||||
|
static void projectOnAlgebra(typename SU<ncolour>::LatticeAlgebraVector &h_out, LatticeAdjMatrix &in, Real scale = 1.0) {
|
||||||
|
conformable(h_out, in);
|
||||||
|
h_out = zero;
|
||||||
|
AMatrix iTa;
|
||||||
|
|
||||||
|
for (int a = 0; a < Dimension; a++) {
|
||||||
|
generator(a, iTa);
|
||||||
|
auto tmp = real(trace(iTa * in)) * scale;
|
||||||
|
pokeColour(h_out, tmp, a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// a projector that keeps the generators stored to avoid the overhead of recomputing.
|
||||||
|
static void projector(typename SU<ncolour>::LatticeAlgebraVector &h_out, LatticeAdjMatrix &in, Real scale = 1.0) {
|
||||||
|
conformable(h_out, in);
|
||||||
|
static std::vector<AMatrix> iTa(Dimension); // to store the generators
|
||||||
|
h_out = zero;
|
||||||
|
static bool precalculated = false;
|
||||||
|
if (!precalculated){
|
||||||
|
precalculated = true;
|
||||||
|
for (int a = 0; a < Dimension; a++) generator(a, iTa[a]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int a = 0; a < Dimension; a++) {
|
||||||
|
auto tmp = real(trace(iTa[a] * in)) * scale;
|
||||||
|
pokeColour(h_out, tmp, a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef SU_Adjoint<2> SU2Adjoint;
|
||||||
|
typedef SU_Adjoint<3> SU3Adjoint;
|
||||||
|
typedef SU_Adjoint<4> SU4Adjoint;
|
||||||
|
typedef SU_Adjoint<5> SU5Adjoint;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
bin_PROGRAMS += Test_cayley_cg Test_cayley_coarsen_support Test_cayley_even_odd Test_cayley_ldop_cr Test_cf_coarsen_support Test_cf_cr_unprec Test_cheby Test_contfrac_cg Test_contfrac_even_odd Test_contfrac_force Test_cshift Test_cshift_red_black Test_cshift_red_black_rotate Test_cshift_rotate Test_dwf_cg_prec Test_dwf_cg_schur Test_dwf_cg_unprec Test_dwf_cr_unprec Test_dwf_even_odd Test_dwf_force Test_dwf_fpgcr Test_dwf_gpforce Test_dwf_hdcr Test_dwf_lanczos Test_dwf_mixedcg_prec Test_dwf_rb5d Test_gamma Test_GaugeAction Test_gparity Test_gpdwf_force Test_gp_rect_force Test_gpwilson_even_odd Test_hmc_EODWFRatio Test_hmc_EODWFRatio_Gparity Test_hmc_EOWilsonFermionGauge Test_hmc_EOWilsonRatio Test_hmc_GparityIwasakiGauge Test_hmc_GparityWilsonGauge Test_hmc_IwasakiGauge Test_hmc_RectGauge Test_hmc_WilsonFermionGauge Test_hmc_WilsonGauge Test_hmc_WilsonRatio Test_lie_generators Test_main Test_multishift_sqrt Test_nersc_io Test_partfrac_force Test_quenched_update Test_rect_force Test_RectPlaq Test_remez Test_rhmc_EOWilson1p1 Test_rhmc_EOWilsonRatio Test_rhmc_Wilson1p1 Test_rhmc_WilsonRatio Test_rng Test_rng_fixed Test_serialisation Test_simd Test_stencil Test_synthetic_lanczos Test_wilson_cg_prec Test_wilson_cg_schur Test_wilson_cg_unprec Test_wilson_cr_unprec Test_wilson_even_odd Test_wilson_force Test_wilson_force_phiMdagMphi Test_wilson_force_phiMphi Test_wilson_tm_even_odd
|
bin_PROGRAMS += Test_cayley_cg Test_cayley_coarsen_support Test_cayley_even_odd Test_cayley_ldop_cr Test_cf_coarsen_support Test_cf_cr_unprec Test_cheby Test_contfrac_cg Test_contfrac_even_odd Test_contfrac_force Test_cshift Test_cshift_red_black Test_cshift_red_black_rotate Test_cshift_rotate Test_dwf_cg_prec Test_dwf_cg_schur Test_dwf_cg_unprec Test_dwf_cr_unprec Test_dwf_even_odd Test_dwf_force Test_dwf_fpgcr Test_dwf_gpforce Test_dwf_hdcr Test_dwf_lanczos Test_dwf_mixedcg_prec Test_dwf_rb5d Test_gamma Test_GaugeAction Test_gparity Test_gpdwf_force Test_gp_rect_force Test_gpwilson_even_odd Test_hmc_EODWFRatio Test_hmc_EODWFRatio_Gparity Test_hmc_EOWilsonFermionGauge Test_hmc_EOWilsonRatio Test_hmc_GparityIwasakiGauge Test_hmc_GparityWilsonGauge Test_hmc_IwasakiGauge Test_hmc_RectGauge Test_hmc_WilsonAdjointFermionGauge Test_hmc_WilsonFermionGauge Test_hmc_WilsonGauge Test_hmc_WilsonRatio Test_lie_generators Test_main Test_multishift_sqrt Test_nersc_io Test_partfrac_force Test_quenched_update Test_rect_force Test_RectPlaq Test_remez Test_rhmc_EOWilson1p1 Test_rhmc_EOWilsonRatio Test_rhmc_Wilson1p1 Test_rhmc_WilsonRatio Test_rng Test_rng_fixed Test_serialisation Test_simd Test_stencil Test_synthetic_lanczos Test_wilson_cg_prec Test_wilson_cg_schur Test_wilson_cg_unprec Test_wilson_cr_unprec Test_wilson_even_odd Test_wilson_force Test_wilson_force_phiMdagMphi Test_wilson_force_phiMphi Test_wilson_tm_even_odd
|
||||||
|
|
||||||
|
|
||||||
Test_cayley_cg_SOURCES=Test_cayley_cg.cc
|
Test_cayley_cg_SOURCES=Test_cayley_cg.cc
|
||||||
@ -162,6 +162,10 @@ Test_hmc_RectGauge_SOURCES=Test_hmc_RectGauge.cc
|
|||||||
Test_hmc_RectGauge_LDADD=-lGrid
|
Test_hmc_RectGauge_LDADD=-lGrid
|
||||||
|
|
||||||
|
|
||||||
|
Test_hmc_WilsonAdjointFermionGauge_SOURCES=Test_hmc_WilsonAdjointFermionGauge.cc
|
||||||
|
Test_hmc_WilsonAdjointFermionGauge_LDADD=-lGrid
|
||||||
|
|
||||||
|
|
||||||
Test_hmc_WilsonFermionGauge_SOURCES=Test_hmc_WilsonFermionGauge.cc
|
Test_hmc_WilsonFermionGauge_SOURCES=Test_hmc_WilsonFermionGauge.cc
|
||||||
Test_hmc_WilsonFermionGauge_LDADD=-lGrid
|
Test_hmc_WilsonFermionGauge_LDADD=-lGrid
|
||||||
|
|
||||||
|
100
tests/Test_hmc_WilsonAdjointFermionGauge.cc
Normal file
100
tests/Test_hmc_WilsonAdjointFermionGauge.cc
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
/*************************************************************************************
|
||||||
|
|
||||||
|
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.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace Grid;
|
||||||
|
using namespace Grid::QCD;
|
||||||
|
|
||||||
|
namespace Grid {
|
||||||
|
namespace QCD {
|
||||||
|
|
||||||
|
class HmcRunner : public NerscHmcRunner {
|
||||||
|
public:
|
||||||
|
void BuildTheAction(int argc, char **argv)
|
||||||
|
|
||||||
|
{
|
||||||
|
typedef WilsonImplR ImplPolicy; // gauge field implemetation
|
||||||
|
typedef WilsonFermionR FermionAction; // type of lattice fermions
|
||||||
|
typedef typename FermionAction::FermionField FermionField;
|
||||||
|
|
||||||
|
UGrid = SpaceTimeGrid::makeFourDimGrid(
|
||||||
|
GridDefaultLatt(), GridDefaultSimd(Nd, vComplex::Nsimd()),
|
||||||
|
GridDefaultMpi());
|
||||||
|
UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid);
|
||||||
|
|
||||||
|
FGrid = UGrid;
|
||||||
|
FrbGrid = UrbGrid;
|
||||||
|
|
||||||
|
// temporarily need a gauge field
|
||||||
|
LatticeGaugeField U(UGrid);
|
||||||
|
|
||||||
|
// Gauge action
|
||||||
|
WilsonGaugeActionR Waction(5.6);
|
||||||
|
|
||||||
|
Real mass = -0.77;
|
||||||
|
FermionAction FermOp(U, *FGrid, *FrbGrid, mass);
|
||||||
|
|
||||||
|
ConjugateGradient<FermionField> CG(1.0e-8, 10000);
|
||||||
|
|
||||||
|
TwoFlavourPseudoFermionAction<ImplPolicy> Nf2(FermOp, CG, CG);
|
||||||
|
|
||||||
|
// Set smearing (true/false), default: false
|
||||||
|
Nf2.is_smeared = true;
|
||||||
|
|
||||||
|
// Collect actions
|
||||||
|
ActionLevel<LatticeGaugeField> Level1(1);
|
||||||
|
Level1.push_back(&Nf2);
|
||||||
|
|
||||||
|
ActionLevel<LatticeGaugeField> Level2(4);
|
||||||
|
Level2.push_back(&Waction);
|
||||||
|
|
||||||
|
TheAction.push_back(Level1);
|
||||||
|
TheAction.push_back(Level2);
|
||||||
|
|
||||||
|
Run(argc, argv);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
Grid_init(&argc, &argv);
|
||||||
|
|
||||||
|
int threads = GridThread::GetThreads();
|
||||||
|
std::cout << GridLogMessage << "Grid is setup to use " << threads
|
||||||
|
<< " threads" << std::endl;
|
||||||
|
|
||||||
|
HmcRunner TheHMC;
|
||||||
|
|
||||||
|
TheHMC.BuildTheAction(argc, argv);
|
||||||
|
}
|
@ -1,33 +1,34 @@
|
|||||||
/*************************************************************************************
|
/*************************************************************************************
|
||||||
|
|
||||||
Grid physics library, www.github.com/paboyle/Grid
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
Source file: ./tests/Test_hmc_WilsonFermionGauge.cc
|
Source file: ./tests/Test_hmc_WilsonFermionGauge.cc
|
||||||
|
|
||||||
Copyright (C) 2015
|
Copyright (C) 2015
|
||||||
|
|
||||||
Author: Peter Boyle <pabobyle@ph.ed.ac.uk>
|
Author: Peter Boyle <pabobyle@ph.ed.ac.uk>
|
||||||
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||||
Author: neo <cossu@post.kek.jp>
|
Author: neo <cossu@post.kek.jp>
|
||||||
Author: paboyle <paboyle@ph.ed.ac.uk>
|
Author: paboyle <paboyle@ph.ed.ac.uk>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along
|
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.,
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
See the full license in the file "LICENSE" in the top level distribution directory
|
See the full license in the file "LICENSE" in the top level distribution
|
||||||
*************************************************************************************/
|
directory
|
||||||
/* END LEGAL */
|
*************************************************************************************/
|
||||||
|
/* END LEGAL */
|
||||||
#include "Grid.h"
|
#include "Grid.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -35,20 +36,20 @@ using namespace Grid;
|
|||||||
using namespace Grid::QCD;
|
using namespace Grid::QCD;
|
||||||
|
|
||||||
namespace Grid {
|
namespace Grid {
|
||||||
namespace QCD {
|
namespace QCD {
|
||||||
|
|
||||||
|
|
||||||
class HmcRunner : public NerscHmcRunner {
|
class HmcRunner : public NerscHmcRunner {
|
||||||
public:
|
public:
|
||||||
|
void BuildTheAction(int argc, char **argv)
|
||||||
void BuildTheAction (int argc, char **argv)
|
|
||||||
|
|
||||||
{
|
{
|
||||||
typedef WilsonImplR ImplPolicy;
|
typedef WilsonImplR ImplPolicy;
|
||||||
typedef WilsonFermionR FermionAction;
|
typedef WilsonFermionR FermionAction;
|
||||||
typedef typename FermionAction::FermionField FermionField;
|
typedef typename FermionAction::FermionField FermionField;
|
||||||
|
|
||||||
UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi());
|
UGrid = SpaceTimeGrid::makeFourDimGrid(
|
||||||
|
GridDefaultLatt(), GridDefaultSimd(Nd, vComplex::Nsimd()),
|
||||||
|
GridDefaultMpi());
|
||||||
UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid);
|
UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid);
|
||||||
|
|
||||||
FGrid = UGrid;
|
FGrid = UGrid;
|
||||||
@ -60,18 +61,17 @@ public:
|
|||||||
// Gauge action
|
// Gauge action
|
||||||
WilsonGaugeActionR Waction(5.6);
|
WilsonGaugeActionR Waction(5.6);
|
||||||
|
|
||||||
Real mass=-0.77;
|
Real mass = -0.77;
|
||||||
FermionAction FermOp(U,*FGrid,*FrbGrid,mass);
|
FermionAction FermOp(U, *FGrid, *FrbGrid, mass);
|
||||||
|
|
||||||
ConjugateGradient<FermionField> CG(1.0e-8,10000);
|
ConjugateGradient<FermionField> CG(1.0e-8, 10000);
|
||||||
|
|
||||||
TwoFlavourPseudoFermionAction<ImplPolicy> Nf2(FermOp,CG,CG);
|
TwoFlavourPseudoFermionAction<ImplPolicy> Nf2(FermOp, CG, CG);
|
||||||
|
|
||||||
//Set smearing (true/false), default: false
|
// Set smearing (true/false), default: false
|
||||||
Nf2.is_smeared = true;
|
Nf2.is_smeared = true;
|
||||||
|
|
||||||
|
// Collect actions
|
||||||
//Collect actions
|
|
||||||
ActionLevel<LatticeGaugeField> Level1(1);
|
ActionLevel<LatticeGaugeField> Level1(1);
|
||||||
Level1.push_back(&Nf2);
|
Level1.push_back(&Nf2);
|
||||||
|
|
||||||
@ -81,24 +81,20 @@ public:
|
|||||||
TheAction.push_back(Level1);
|
TheAction.push_back(Level1);
|
||||||
TheAction.push_back(Level2);
|
TheAction.push_back(Level2);
|
||||||
|
|
||||||
Run(argc,argv);
|
Run(argc, argv);
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}}
|
int main(int argc, char **argv) {
|
||||||
|
Grid_init(&argc, &argv);
|
||||||
int main (int argc, char ** argv)
|
|
||||||
{
|
|
||||||
Grid_init(&argc,&argv);
|
|
||||||
|
|
||||||
int threads = GridThread::GetThreads();
|
int threads = GridThread::GetThreads();
|
||||||
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
std::cout << GridLogMessage << "Grid is setup to use " << threads
|
||||||
|
<< " threads" << std::endl;
|
||||||
|
|
||||||
HmcRunner TheHMC;
|
HmcRunner TheHMC;
|
||||||
|
|
||||||
TheHMC.BuildTheAction(argc,argv);
|
TheHMC.BuildTheAction(argc, argv);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,6 +31,8 @@ directory
|
|||||||
|
|
||||||
#include <qcd/utils/CovariantCshift.h>
|
#include <qcd/utils/CovariantCshift.h>
|
||||||
#include <qcd/utils/SUn.h>
|
#include <qcd/utils/SUn.h>
|
||||||
|
#include <qcd/utils/SUnAdjoint.h>
|
||||||
|
#include <qcd/representations/adjoint.h>
|
||||||
#include <qcd/utils/WilsonLoops.h>
|
#include <qcd/utils/WilsonLoops.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -52,8 +54,10 @@ int main(int argc, char** argv) {
|
|||||||
std::cout << GridLogMessage << "*********************************************"
|
std::cout << GridLogMessage << "*********************************************"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
SU2::printGenerators();
|
SU2::printGenerators();
|
||||||
SU2::printAdjointGenerators();
|
std::cout << "Dimension of adjoint representation: "<< SU2Adjoint::Dimension << std::endl;
|
||||||
|
SU2Adjoint::printGenerators();
|
||||||
SU2::testGenerators();
|
SU2::testGenerators();
|
||||||
|
SU2Adjoint::testGenerators();
|
||||||
|
|
||||||
std::cout << GridLogMessage << "*********************************************"
|
std::cout << GridLogMessage << "*********************************************"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -61,14 +65,19 @@ int main(int argc, char** argv) {
|
|||||||
std::cout << GridLogMessage << "*********************************************"
|
std::cout << GridLogMessage << "*********************************************"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
SU3::printGenerators();
|
SU3::printGenerators();
|
||||||
SU3::printAdjointGenerators();
|
std::cout << "Dimension of adjoint representation: "<< SU3Adjoint::Dimension << std::endl;
|
||||||
|
SU3Adjoint::printGenerators();
|
||||||
SU3::testGenerators();
|
SU3::testGenerators();
|
||||||
|
SU3Adjoint::testGenerators();
|
||||||
|
|
||||||
std::cout<<GridLogMessage<<"*********************************************"<<std::endl;
|
std::cout<<GridLogMessage<<"*********************************************"<<std::endl;
|
||||||
std::cout<<GridLogMessage<<"* Generators for SU(4)"<<std::endl;
|
std::cout<<GridLogMessage<<"* Generators for SU(4)"<<std::endl;
|
||||||
std::cout<<GridLogMessage<<"*********************************************"<<std::endl;
|
std::cout<<GridLogMessage<<"*********************************************"<<std::endl;
|
||||||
SU4::printGenerators();
|
SU4::printGenerators();
|
||||||
|
std::cout << "Dimension of adjoint representation: "<< SU4Adjoint::Dimension << std::endl;
|
||||||
|
SU4Adjoint::printGenerators();
|
||||||
SU4::testGenerators();
|
SU4::testGenerators();
|
||||||
|
SU4Adjoint::testGenerators();
|
||||||
|
|
||||||
// std::cout<<GridLogMessage<<"*********************************************"<<std::endl;
|
// std::cout<<GridLogMessage<<"*********************************************"<<std::endl;
|
||||||
// std::cout<<GridLogMessage<<"* Generators for SU(5)"<<std::endl;
|
// std::cout<<GridLogMessage<<"* Generators for SU(5)"<<std::endl;
|
||||||
@ -76,5 +85,34 @@ int main(int argc, char** argv) {
|
|||||||
// SU5::printGenerators();
|
// SU5::printGenerators();
|
||||||
// SU5::testGenerators();
|
// SU5::testGenerators();
|
||||||
|
|
||||||
|
|
||||||
|
// Projectors
|
||||||
|
GridParallelRNG gridRNG(grid);
|
||||||
|
gridRNG.SeedRandomDevice();
|
||||||
|
SU3Adjoint::LatticeAdjMatrix Gauss(grid);
|
||||||
|
SU3::LatticeAlgebraVector ha(grid);
|
||||||
|
SU3::LatticeAlgebraVector hb(grid);
|
||||||
|
random(gridRNG,Gauss);
|
||||||
|
|
||||||
|
std::cout << GridLogMessage << "Start projectOnAlgebra" << std::endl;
|
||||||
|
SU3Adjoint::projectOnAlgebra(ha, Gauss);
|
||||||
|
std::cout << GridLogMessage << "end projectOnAlgebra" << std::endl;
|
||||||
|
std::cout << GridLogMessage << "Start projector" << std::endl;
|
||||||
|
SU3Adjoint::projector(hb, Gauss);
|
||||||
|
std::cout << GridLogMessage << "end projector" << std::endl;
|
||||||
|
|
||||||
|
std::cout << GridLogMessage << "ReStart projector" << std::endl;
|
||||||
|
SU3Adjoint::projector(hb, Gauss);
|
||||||
|
std::cout << GridLogMessage << "end projector" << std::endl;
|
||||||
|
SU3::LatticeAlgebraVector diff = ha -hb;
|
||||||
|
std::cout << GridLogMessage << "Difference: " << norm2(diff) << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
// Testing HMC representation classes
|
||||||
|
AdjointRep<3> AdjRep(grid);
|
||||||
|
|
||||||
|
// AdjointRepresentation has the predefined number of colours Nc
|
||||||
|
Representations<AdjointRepresentation> RepresentationTypes(grid);
|
||||||
|
|
||||||
Grid_finalize();
|
Grid_finalize();
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,8 @@ int main (int argc, char ** argv)
|
|||||||
|
|
||||||
Dw.MDeriv(tmp , Mphi, phi,DaggerNo ); UdSdU=tmp;
|
Dw.MDeriv(tmp , Mphi, phi,DaggerNo ); UdSdU=tmp;
|
||||||
Dw.MDeriv(tmp , phi, Mphi,DaggerYes ); UdSdU=(UdSdU+tmp);
|
Dw.MDeriv(tmp , phi, Mphi,DaggerYes ); UdSdU=(UdSdU+tmp);
|
||||||
|
// Take the trace
|
||||||
|
UdSdU = Ta(UdSdU);
|
||||||
|
|
||||||
LatticeFermion Ftmp (&Grid);
|
LatticeFermion Ftmp (&Grid);
|
||||||
|
|
||||||
|
@ -1,37 +1,35 @@
|
|||||||
/*************************************************************************************
|
/*************************************************************************************
|
||||||
|
|
||||||
Grid physics library, www.github.com/paboyle/Grid
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
Source file: ./tests/Test_zmm.cc
|
Source file: ./tests/Test_zmm.cc
|
||||||
|
|
||||||
Copyright (C) 2015
|
Copyright (C) 2015
|
||||||
|
|
||||||
Author: paboyle <paboyle@ph.ed.ac.uk>
|
Author: paboyle <paboyle@ph.ed.ac.uk>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along
|
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.,
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
See the full license in the file "LICENSE" in the top level distribution directory
|
See the full license in the file "LICENSE" in the top level distribution
|
||||||
*************************************************************************************/
|
directory
|
||||||
/* END LEGAL */
|
*************************************************************************************/
|
||||||
|
/* END LEGAL */
|
||||||
#include <Grid.h>
|
#include <Grid.h>
|
||||||
#include <PerfCount.h>
|
#include <PerfCount.h>
|
||||||
|
|
||||||
int main(int argc,char **argv)
|
int main(int argc, char **argv) { return 0; }
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#if 0
|
#if 0
|
||||||
#include <simd/Intel512wilson.h>
|
#include <simd/Intel512wilson.h>
|
||||||
using namespace Grid;
|
using namespace Grid;
|
||||||
|
Loading…
Reference in New Issue
Block a user