1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

Adding action names

This commit is contained in:
Guido Cossu 2016-11-16 16:46:49 +00:00
parent 454302414d
commit 3834feb4b7
14 changed files with 43 additions and 14 deletions

View File

@ -42,6 +42,7 @@ class Action {
virtual RealD S(const GaugeField& U) = 0; // evaluate the action
virtual void deriv(const GaugeField& U,
GaugeField& dSdU) = 0; // evaluate the action derivative
virtual std::string action_name() = 0; // return the action name
virtual ~Action(){};
};

View File

@ -48,6 +48,8 @@ namespace Grid{
public:
PlaqPlusRectangleAction(RealD b,RealD c): c_plaq(b),c_rect(c){};
virtual std::string action_name(){return "PlaqPlusRectangleAction";}
virtual void refresh(const GaugeField &U, GridParallelRNG& pRNG) {}; // noop as no pseudoferms
virtual RealD S(const GaugeField &U) {
@ -108,32 +110,32 @@ namespace Grid{
class RBCGaugeAction : public PlaqPlusRectangleAction<Gimpl> {
public:
INHERIT_GIMPL_TYPES(Gimpl);
RBCGaugeAction(RealD beta,RealD c1) : PlaqPlusRectangleAction<Gimpl>(beta*(1.0-8.0*c1), beta*c1) {
};
RBCGaugeAction(RealD beta,RealD c1) : PlaqPlusRectangleAction<Gimpl>(beta*(1.0-8.0*c1), beta*c1) {};
virtual std::string action_name(){return "RBCGaugeAction";}
};
template<class Gimpl>
class IwasakiGaugeAction : public RBCGaugeAction<Gimpl> {
public:
INHERIT_GIMPL_TYPES(Gimpl);
IwasakiGaugeAction(RealD beta) : RBCGaugeAction<Gimpl>(beta,-0.331) {
};
IwasakiGaugeAction(RealD beta) : RBCGaugeAction<Gimpl>(beta,-0.331) {};
virtual std::string action_name(){return "IwasakiGaugeAction";}
};
template<class Gimpl>
class SymanzikGaugeAction : public RBCGaugeAction<Gimpl> {
public:
INHERIT_GIMPL_TYPES(Gimpl);
SymanzikGaugeAction(RealD beta) : RBCGaugeAction<Gimpl>(beta,-1.0/12.0) {
};
SymanzikGaugeAction(RealD beta) : RBCGaugeAction<Gimpl>(beta,-1.0/12.0) {};
virtual std::string action_name(){return "SymanzikGaugeAction";}
};
template<class Gimpl>
class DBW2GaugeAction : public RBCGaugeAction<Gimpl> {
public:
INHERIT_GIMPL_TYPES(Gimpl);
DBW2GaugeAction(RealD beta) : RBCGaugeAction<Gimpl>(beta,-1.4067) {
};
DBW2GaugeAction(RealD beta) : RBCGaugeAction<Gimpl>(beta,-1.4067) {};
virtual std::string action_name(){return "DBW2GaugeAction";}
};
}

View File

@ -51,6 +51,8 @@ class WilsonGaugeAction : public Action<typename Gimpl::GaugeField> {
public:
WilsonGaugeAction(RealD b) : beta(b){};
virtual std::string action_name(){return "WilsonGaugeAction";}
virtual void refresh(const GaugeField &U,
GridParallelRNG &pRNG){}; // noop as no pseudoferms
@ -65,7 +67,6 @@ class WilsonGaugeAction : public Action<typename Gimpl::GaugeField> {
// not optimal implementation FIXME
// extend Ta to include Lorentz indexes
// RealD factor = 0.5*beta/RealD(Nc);
RealD factor = 0.5 * beta / RealD(Nc);
GaugeLinkField Umu(U._grid);
@ -79,6 +80,7 @@ class WilsonGaugeAction : public Action<typename Gimpl::GaugeField> {
PokeIndex<LorentzIndex>(dSdU, dSdU_mu, mu);
}
};
};

View File

@ -90,6 +90,8 @@ class OneFlavourEvenOddRationalPseudoFermionAction
PowerNegQuarter.Init(remez, param.tolerance, true);
};
virtual std::string action_name(){return "OneFlavourEvenOddRationalPseudoFermionAction";}
virtual void refresh(const GaugeField &U, GridParallelRNG &pRNG) {
// P(phi) = e^{- phi^dag (MpcdagMpc)^-1/2 phi}
// = e^{- phi^dag (MpcdagMpc)^-1/4 (MpcdagMpc)^-1/4 phi}

View File

@ -88,6 +88,8 @@ namespace Grid{
PowerNegQuarter.Init(remez,param.tolerance,true);
};
virtual std::string action_name(){return "OneFlavourEvenOddRatioRationalPseudoFermionAction";}
virtual void refresh(const GaugeField &U, GridParallelRNG& pRNG) {
// S_f = chi^dag* P(V^dag*V)/Q(V^dag*V)* N(M^dag*M)/D(M^dag*M)* P(V^dag*V)/Q(V^dag*V)* chi

View File

@ -84,6 +84,8 @@ namespace Grid{
PowerNegQuarter.Init(remez,param.tolerance,true);
};
virtual std::string action_name(){return "OneFlavourRationalPseudoFermionAction";}
virtual void refresh(const GaugeField &U, GridParallelRNG& pRNG) {
// P(phi) = e^{- phi^dag (MdagM)^-1/2 phi}

View File

@ -82,6 +82,8 @@ namespace Grid{
PowerNegQuarter.Init(remez,param.tolerance,true);
};
virtual std::string action_name(){return "OneFlavourRatioRationalPseudoFermionAction";}
virtual void refresh(const GaugeField &U, GridParallelRNG& pRNG) {
// S_f = chi^dag* P(V^dag*V)/Q(V^dag*V)* N(M^dag*M)/D(M^dag*M)* P(V^dag*V)/Q(V^dag*V)* chi

View File

@ -62,6 +62,9 @@ class TwoFlavourPseudoFermionAction : public Action<typename Impl::GaugeField> {
ActionSolver(AS),
Phi(Op.FermionGrid()){};
virtual std::string action_name(){return "TwoFlavourPseudoFermionAction";}
//////////////////////////////////////////////////////////////////////////////////////
// Push the gauge field in to the dops. Assume any BC's and smearing already
// applied
@ -81,7 +84,9 @@ class TwoFlavourPseudoFermionAction : public Action<typename Impl::GaugeField> {
// in the Phi integral, and thus is only an irrelevant prefactor for
// the partition function.
//
RealD scale = std::sqrt(0.5);
FermionField eta(FermOp.FermionGrid());
gaussian(pRNG, eta);

View File

@ -65,6 +65,8 @@ class TwoFlavourEvenOddPseudoFermionAction
PhiOdd(Op.FermionRedBlackGrid())
{};
virtual std::string action_name(){return "TwoFlavourEvenOddPseudoFermionAction";}
//////////////////////////////////////////////////////////////////////////////////////
// Push the gauge field in to the dops. Assume any BC's and smearing already applied
//////////////////////////////////////////////////////////////////////////////////////

View File

@ -68,6 +68,8 @@ namespace Grid{
conformable(_NumOp.GaugeRedBlackGrid(), _DenOp.GaugeRedBlackGrid());
};
virtual std::string action_name(){return "TwoFlavourEvenOddRatioPseudoFermionAction";}
virtual void refresh(const GaugeField &U, GridParallelRNG& pRNG) {
// P(phi) = e^{- phi^dag Vpc (MpcdagMpc)^-1 Vpcdag phi}

View File

@ -57,6 +57,8 @@ namespace Grid{
OperatorFunction<FermionField> & AS
) : NumOp(_NumOp), DenOp(_DenOp), DerivativeSolver(DS), ActionSolver(AS), Phi(_NumOp.FermionGrid()) {};
virtual std::string action_name(){return "TwoFlavourRatioPseudoFermionAction";}
virtual void refresh(const GaugeField &U, GridParallelRNG& pRNG) {
// P(phi) = e^{- phi^dag V (MdagM)^-1 Vdag phi}

View File

@ -101,8 +101,9 @@ class Integrator {
repr_set.at(a)->deriv(Rep.U, forceR);
GF force =
Rep.RtoFundamentalProject(forceR); // Ta for the fundamental rep
Real force_abs = std::sqrt(norm2(force));
std::cout << GridLogIntegrator << "Hirep Force average: "
<< norm2(force) / (U._grid->gSites()) << std::endl;
<< force_abs / (U._grid->gSites()) << std::endl;
Mom -= force * ep ;
}
}
@ -121,8 +122,9 @@ class Integrator {
<< std::endl;
if (as[level].actions.at(a)->is_smeared) Smearer.smeared_force(force);
force = FieldImplementation::projectForce(force); // Ta for gauge fields
Real force_abs = std::sqrt(norm2(force));
std::cout << GridLogIntegrator
<< "Force average: " << norm2(force) / (U._grid->gSites())
<< "Force average: " << force_abs / (U._grid->gSites())
<< std::endl;
Mom -= force * ep;
}

View File

@ -123,11 +123,13 @@ class HmcRunner : public BinaryHmcRunner {
ObservablesList.push_back(&Checkpoint);
// Smearing section, omit if not needed
/*
double rho = 0.1; // smearing parameter
int Nsmear = 2; // number of smearing levels
Smear_Stout<BinaryHmcRunner::ImplPolicy> Stout(rho);
SmearedConfiguration<BinaryHmcRunner::ImplPolicy> SmearingPolicy(
UGrid, Nsmear, Stout);
*/
///////////////////
// Run(argc, argv, Checkpoint, SmearingPolicy);
@ -151,7 +153,7 @@ int main(int argc, char **argv) {
std::vector<int> ParSeed({6, 7, 8, 9, 10});
TheHMC.RNGSeeds(SerSeed, ParSeed);
TheHMC.MDparameters.set(5, 1.0);// MDsteps, traj length
TheHMC.MDparameters.set(10, 1.0);// MDsteps, traj length
TheHMC.BuildTheAction(argc, argv);
}

View File

@ -80,6 +80,7 @@ class HmcRunner : public BinaryHmcRunner {
// Gauge action
std::cout << GridLogMessage << "Beta: " << HMCPar.beta << std::endl;
GaugeAction Waction(HMCPar.beta);
// Collect actions