2016-02-19 06:30:41 +00:00
|
|
|
/*!
|
|
|
|
@file GaugeConfiguration.h
|
|
|
|
|
|
|
|
@brief Declares the GaugeConfiguration class
|
|
|
|
*/
|
|
|
|
#ifndef GAUGE_CONFIG_
|
|
|
|
#define GAUGE_CONFIG_
|
|
|
|
|
2016-07-01 16:06:20 +01:00
|
|
|
namespace Grid {
|
|
|
|
|
|
|
|
namespace QCD {
|
|
|
|
|
2016-02-19 06:30:41 +00:00
|
|
|
/*!
|
|
|
|
@brief Smeared configuration container
|
|
|
|
|
|
|
|
It will behave like a configuration from the point of view of
|
|
|
|
the HMC update and integrators.
|
|
|
|
An "advanced configuration" object that can provide not only the
|
|
|
|
data to store the gauge configuration but also operations to manipulate
|
2016-07-04 15:35:37 +01:00
|
|
|
it, like smearing.
|
2016-02-19 06:30:41 +00:00
|
|
|
|
|
|
|
It stores a list of smeared configurations.
|
|
|
|
*/
|
|
|
|
template <class Gimpl>
|
2016-04-05 08:19:30 +01:00
|
|
|
class SmearedConfiguration {
|
2016-07-01 16:06:20 +01:00
|
|
|
public:
|
|
|
|
INHERIT_GIMPL_TYPES(Gimpl) ;
|
|
|
|
|
|
|
|
private:
|
|
|
|
const unsigned int smearingLevels;
|
|
|
|
Smear_Stout<Gimpl> StoutSmearing;
|
|
|
|
std::vector<GaugeField> SmearedSet;
|
|
|
|
|
2016-02-19 06:30:41 +00:00
|
|
|
// Member functions
|
2016-02-24 17:43:59 +00:00
|
|
|
//====================================================================
|
2016-07-01 16:06:20 +01:00
|
|
|
void fill_smearedSet(GaugeField& U){
|
2016-04-05 08:19:30 +01:00
|
|
|
ThinLinks = &U; //attach the smearing routine to the field U
|
2016-04-06 09:58:43 +01:00
|
|
|
|
|
|
|
//check the pointer is not null
|
2016-04-05 08:19:30 +01:00
|
|
|
if (ThinLinks==NULL)
|
2016-07-01 16:06:20 +01:00
|
|
|
std::cout << GridLogError << "[SmearedConfiguration] Error in ThinLinks pointer\n";
|
2016-02-24 17:43:59 +00:00
|
|
|
|
2016-04-05 08:19:30 +01:00
|
|
|
if (smearingLevels > 0){
|
2016-07-01 16:06:20 +01:00
|
|
|
std::cout<< GridLogDebug << "[SmearedConfiguration] Filling SmearedSet\n";
|
|
|
|
GaugeField previous_u(ThinLinks->_grid);
|
2016-04-13 09:00:14 +01:00
|
|
|
|
2016-07-01 16:06:20 +01:00
|
|
|
previous_u = *ThinLinks;
|
|
|
|
for(int smearLvl = 0; smearLvl < smearingLevels; ++smearLvl){
|
|
|
|
StoutSmearing.smear(SmearedSet[smearLvl],previous_u);
|
|
|
|
previous_u = SmearedSet[smearLvl];
|
2016-04-13 09:00:14 +01:00
|
|
|
|
2016-07-01 16:06:20 +01:00
|
|
|
// For debug purposes
|
|
|
|
RealD impl_plaq = WilsonLoops<Gimpl>::avgPlaquette(previous_u);
|
|
|
|
std::cout<< GridLogDebug << "[SmearedConfiguration] Plaq: " << impl_plaq<< std::endl;
|
|
|
|
|
|
|
|
}
|
2016-04-05 08:19:30 +01:00
|
|
|
|
2016-02-24 17:43:59 +00:00
|
|
|
}
|
2016-07-01 16:06:20 +01:00
|
|
|
}
|
2016-07-04 15:35:37 +01:00
|
|
|
//====================================================================
|
2016-07-01 16:06:20 +01:00
|
|
|
GaugeField AnalyticSmearedForce(const GaugeField& SigmaKPrime,
|
|
|
|
const GaugeField& GaugeK) const{
|
2016-02-24 17:43:59 +00:00
|
|
|
GridBase *grid = GaugeK._grid;
|
|
|
|
GaugeField C(grid), SigmaK(grid), iLambda(grid);
|
|
|
|
GaugeLinkField iLambda_mu(grid);
|
|
|
|
GaugeLinkField iQ(grid), e_iQ(grid);
|
|
|
|
GaugeLinkField SigmaKPrime_mu(grid);
|
|
|
|
GaugeLinkField GaugeKmu(grid), Cmu(grid);
|
|
|
|
|
|
|
|
StoutSmearing.BaseSmear(C, GaugeK);
|
2016-07-04 15:35:37 +01:00
|
|
|
SigmaK = zero;
|
|
|
|
iLambda = zero;
|
2016-02-24 17:43:59 +00:00
|
|
|
|
|
|
|
for (int mu = 0; mu < Nd; mu++){
|
2016-07-01 16:06:20 +01:00
|
|
|
Cmu = peekLorentz( C,mu);
|
|
|
|
GaugeKmu = peekLorentz(GaugeK,mu);
|
|
|
|
SigmaKPrime_mu = peekLorentz(SigmaKPrime,mu);
|
2016-07-04 15:35:37 +01:00
|
|
|
iQ = Ta(Cmu*adj(GaugeKmu));
|
2016-07-01 16:06:20 +01:00
|
|
|
set_iLambda(iLambda_mu, e_iQ, iQ, SigmaKPrime_mu, GaugeKmu);
|
|
|
|
pokeLorentz(SigmaK, SigmaKPrime_mu*e_iQ + adj(Cmu)*iLambda_mu, mu);
|
|
|
|
pokeLorentz(iLambda, iLambda_mu, mu);
|
2016-02-24 17:43:59 +00:00
|
|
|
}
|
2016-04-13 09:00:14 +01:00
|
|
|
StoutSmearing.derivative(SigmaK, iLambda, GaugeK);// derivative of SmearBase
|
2016-02-24 17:43:59 +00:00
|
|
|
return SigmaK;
|
2016-07-01 16:06:20 +01:00
|
|
|
}
|
2016-07-04 15:35:37 +01:00
|
|
|
|
2016-07-03 10:27:43 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*! @brief Returns smeared configuration at level 'Level' */
|
2016-07-01 16:06:20 +01:00
|
|
|
const GaugeField& get_smeared_conf(int Level) const{
|
2016-02-24 17:43:59 +00:00
|
|
|
return SmearedSet[Level];
|
2016-07-01 16:06:20 +01:00
|
|
|
}
|
2016-07-04 15:35:37 +01:00
|
|
|
|
2016-07-03 10:27:43 +01:00
|
|
|
|
|
|
|
//====================================================================
|
2016-07-01 16:06:20 +01:00
|
|
|
void set_iLambda(GaugeLinkField& iLambda,
|
|
|
|
GaugeLinkField& e_iQ,
|
|
|
|
const GaugeLinkField& iQ,
|
|
|
|
const GaugeLinkField& Sigmap,
|
|
|
|
const GaugeLinkField& GaugeK)const{
|
2016-02-24 17:43:59 +00:00
|
|
|
GridBase *grid = iQ._grid;
|
|
|
|
GaugeLinkField iQ2(grid), iQ3(grid), B1(grid), B2(grid), USigmap(grid);
|
|
|
|
GaugeLinkField unity(grid);
|
|
|
|
unity=1.0;
|
|
|
|
|
2016-07-04 15:35:37 +01:00
|
|
|
LatticeComplex u(grid), w(grid);
|
2016-02-24 17:43:59 +00:00
|
|
|
LatticeComplex f0(grid), f1(grid), f2(grid);
|
2016-07-04 15:35:37 +01:00
|
|
|
LatticeComplex xi0(grid), xi1(grid), tmp(grid);
|
|
|
|
LatticeComplex u2(grid), w2(grid), cosw(grid);
|
2016-04-05 08:19:30 +01:00
|
|
|
LatticeComplex emiu(grid), e2iu(grid), qt(grid), fden(grid);
|
2016-02-24 17:43:59 +00:00
|
|
|
LatticeComplex r01(grid), r11(grid), r21(grid), r02(grid), r12(grid);
|
|
|
|
LatticeComplex r22(grid), tr1(grid), tr2(grid);
|
|
|
|
LatticeComplex b10(grid), b11(grid), b12(grid), b20(grid), b21(grid), b22(grid);
|
2016-07-04 15:35:37 +01:00
|
|
|
LatticeComplex LatticeUnitComplex(grid);
|
2016-02-24 17:43:59 +00:00
|
|
|
|
2016-07-04 15:35:37 +01:00
|
|
|
LatticeUnitComplex = 1.0;
|
2016-02-24 17:43:59 +00:00
|
|
|
|
|
|
|
// Exponential
|
|
|
|
iQ2 = iQ * iQ;
|
|
|
|
iQ3 = iQ * iQ2;
|
|
|
|
StoutSmearing.set_uw(u,w,iQ2,iQ3);
|
|
|
|
StoutSmearing.set_fj(f0,f1,f2,u,w);
|
|
|
|
e_iQ = f0*unity + timesMinusI(f1) * iQ - f2 * iQ2;
|
|
|
|
|
|
|
|
// Getting B1, B2, Gamma and Lambda
|
2016-07-04 15:35:37 +01:00
|
|
|
// simplify this part, reduntant calculations in set_fj
|
2016-02-24 17:43:59 +00:00
|
|
|
xi0 = StoutSmearing.func_xi0(w);
|
|
|
|
xi1 = StoutSmearing.func_xi1(w);
|
|
|
|
u2 = u * u;
|
|
|
|
w2 = w * w;
|
|
|
|
cosw = cos(w);
|
|
|
|
|
2016-07-04 15:35:37 +01:00
|
|
|
emiu = cos(u) - timesI(sin(u));
|
|
|
|
e2iu = cos(2.0*u) + timesI(sin(2.0*u));
|
|
|
|
|
|
|
|
r01 = (2.0*u + timesI(2.0*(u2-w2))) * e2iu
|
|
|
|
+ emiu * ((16.0*u*cosw + 2.0*u*(3.0*u2+w2)*xi0) +
|
|
|
|
timesI(-8.0*u2*cosw + 2.0*(9.0*u2+w2)*xi0));
|
2016-02-24 17:43:59 +00:00
|
|
|
|
2016-07-04 15:35:37 +01:00
|
|
|
r11 = (2.0*LatticeUnitComplex + timesI(4.0*u))* e2iu
|
|
|
|
+ emiu * ((-2.0*cosw + (3.0*u2-w2)*xi0) +
|
|
|
|
timesI((2.0*u*cosw + 6.0*u*xi0)));
|
2016-02-24 17:43:59 +00:00
|
|
|
|
2016-07-01 16:06:20 +01:00
|
|
|
r21 = 2.0*timesI(e2iu)
|
2016-07-04 15:35:37 +01:00
|
|
|
+ emiu * (-3.0*u*xi0 + timesI(cosw - 3.0*xi0));
|
2016-02-24 17:43:59 +00:00
|
|
|
|
|
|
|
|
2016-07-04 15:35:37 +01:00
|
|
|
r02 = -2.0 * e2iu + emiu * (-8.0*u2*xi0 +
|
|
|
|
timesI(2.0*u*(cosw + xi0 + 3.0*u2*xi1)));
|
2016-02-24 17:43:59 +00:00
|
|
|
|
2016-07-04 15:35:37 +01:00
|
|
|
r12 = emiu * (2.0*u*xi0 + timesI(-cosw - xi0 + 3.0*u2*xi1));
|
2016-02-24 17:43:59 +00:00
|
|
|
|
2016-07-04 15:35:37 +01:00
|
|
|
r22 = emiu * (xi0 - timesI(3.0*u*xi1));
|
2016-02-24 17:43:59 +00:00
|
|
|
|
2016-07-04 15:35:37 +01:00
|
|
|
fden = LatticeUnitComplex/(2.0*(9.0*u2-w2)*(9.0*u2-w2));
|
|
|
|
|
|
|
|
b10 = 2.0 * u * r01 + (3.0* u2 - w2)*r02 - (30.0 * u2 + 2.0 * w2)*f0;
|
|
|
|
b11 = 2.0 * u * r11 + (3.0* u2 - w2)*r12 - (30.0 * u2 + 2.0 * w2)*f1;
|
|
|
|
b12 = 2.0 * u * r21 + (3.0* u2 - w2)*r22 - (30.0 * u2 + 2.0 * w2)*f2;
|
2016-02-24 17:43:59 +00:00
|
|
|
|
2016-07-04 15:35:37 +01:00
|
|
|
b20 = r01 - (3.0*u)*r02 - (24.0*u)*f0;
|
|
|
|
b21 = r11 - (3.0*u)*r12 - (24.0*u)*f1;
|
|
|
|
b22 = r21 - (3.0*u)*r22 - (24.0*u)*f2;
|
2016-02-24 17:43:59 +00:00
|
|
|
|
|
|
|
b10 *= fden;
|
|
|
|
b11 *= fden;
|
|
|
|
b12 *= fden;
|
|
|
|
b20 *= fden;
|
|
|
|
b21 *= fden;
|
|
|
|
b22 *= fden;
|
2016-07-04 15:35:37 +01:00
|
|
|
|
|
|
|
|
2016-02-24 17:43:59 +00:00
|
|
|
B1 = b10*unity + timesMinusI(b11) * iQ - b12 * iQ2;
|
|
|
|
B2 = b20*unity + timesMinusI(b21) * iQ - b22 * iQ2;
|
|
|
|
USigmap = GaugeK * Sigmap;
|
|
|
|
|
|
|
|
tr1 = trace(USigmap*B1);
|
|
|
|
tr2 = trace(USigmap*B2);
|
|
|
|
|
|
|
|
GaugeLinkField QUS = timesMinusI(iQ) * USigmap;
|
|
|
|
GaugeLinkField USQ = USigmap * timesMinusI(iQ);
|
|
|
|
|
|
|
|
GaugeLinkField iGamma = tr1 * timesMinusI(iQ) - tr2 * iQ2 +
|
2016-07-01 16:06:20 +01:00
|
|
|
f1 * USigmap + f2 * QUS + f2 * USQ;
|
2016-02-24 17:43:59 +00:00
|
|
|
|
2016-07-04 15:35:37 +01:00
|
|
|
iLambda = Ta(timesI(iGamma));
|
2016-07-01 16:06:20 +01:00
|
|
|
|
|
|
|
}
|
2016-07-04 15:35:37 +01:00
|
|
|
|
2016-07-03 10:27:43 +01:00
|
|
|
//====================================================================
|
2016-07-01 16:06:20 +01:00
|
|
|
public:
|
2016-07-04 15:35:37 +01:00
|
|
|
GaugeField* ThinLinks; /*!< @brief Pointer to the thin
|
2016-07-03 10:27:43 +01:00
|
|
|
links configuration */
|
2016-07-04 15:35:37 +01:00
|
|
|
|
2016-02-19 06:30:41 +00:00
|
|
|
/*! @brief Standard constructor */
|
2016-07-04 15:35:37 +01:00
|
|
|
SmearedConfiguration(GridCartesian * UGrid,
|
|
|
|
unsigned int Nsmear,
|
|
|
|
Smear_Stout<Gimpl>& Stout):
|
|
|
|
smearingLevels(Nsmear),
|
|
|
|
StoutSmearing(Stout),
|
|
|
|
ThinLinks(NULL){
|
|
|
|
for (unsigned int i=0; i< smearingLevels; ++i)
|
|
|
|
SmearedSet.push_back(*(new GaugeField(UGrid)));
|
|
|
|
}
|
|
|
|
|
2016-02-19 06:30:41 +00:00
|
|
|
/*! For just thin links */
|
2016-07-04 15:35:37 +01:00
|
|
|
SmearedConfiguration():
|
|
|
|
smearingLevels(0),
|
|
|
|
StoutSmearing(),
|
|
|
|
SmearedSet(),
|
|
|
|
ThinLinks(NULL){}
|
|
|
|
|
|
|
|
|
2016-04-05 08:19:30 +01:00
|
|
|
// attach the smeared routines to the thin links U and fill the smeared set
|
2016-07-04 15:35:37 +01:00
|
|
|
void set_GaugeField(GaugeField& U){ fill_smearedSet(U);}
|
|
|
|
|
|
|
|
//====================================================================
|
|
|
|
void smeared_force(GaugeField& SigmaTilde) const{
|
|
|
|
|
|
|
|
if (smearingLevels > 0){
|
|
|
|
GaugeField force(SigmaTilde._grid);
|
|
|
|
GaugeLinkField tmp_mu(SigmaTilde._grid);
|
|
|
|
force = SigmaTilde;//actually = U*SigmaTilde
|
|
|
|
|
|
|
|
for (int mu = 0; mu < Nd; mu++){
|
|
|
|
// to get just SigmaTilde
|
|
|
|
tmp_mu = adj(peekLorentz(SmearedSet[smearingLevels-1], mu)) * peekLorentz(force,mu);
|
|
|
|
pokeLorentz(force, tmp_mu, mu);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(int ismr = smearingLevels - 1; ismr > 0; --ismr)
|
|
|
|
force = AnalyticSmearedForce(force,get_smeared_conf(ismr-1));
|
|
|
|
|
|
|
|
force = AnalyticSmearedForce(force,*ThinLinks);
|
|
|
|
|
|
|
|
for (int mu = 0; mu < Nd; mu++){
|
|
|
|
tmp_mu = peekLorentz(*ThinLinks, mu) * peekLorentz(force, mu);
|
|
|
|
pokeLorentz(SigmaTilde, tmp_mu, mu);
|
|
|
|
}
|
2016-04-06 09:58:43 +01:00
|
|
|
}// if smearingLevels = 0 do nothing
|
2016-07-01 16:06:20 +01:00
|
|
|
}
|
2016-04-13 09:00:14 +01:00
|
|
|
//====================================================================
|
|
|
|
|
2016-07-01 16:06:20 +01:00
|
|
|
|
|
|
|
GaugeField& get_SmearedU(){
|
2016-04-05 08:19:30 +01:00
|
|
|
return SmearedSet[smearingLevels-1];
|
2016-07-01 16:06:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
GaugeField& get_U(bool smeared=false) {
|
2016-02-19 08:15:27 +00:00
|
|
|
// get the config, thin links by default
|
2016-02-19 06:30:41 +00:00
|
|
|
if (smeared){
|
2016-07-01 16:06:20 +01:00
|
|
|
if (smearingLevels){
|
|
|
|
RealD impl_plaq = WilsonLoops<Gimpl>::avgPlaquette(SmearedSet[smearingLevels-1]);
|
2016-07-04 15:35:37 +01:00
|
|
|
std::cout<< GridLogDebug << "getting Usmr Plaq: " << impl_plaq<< std::endl;
|
2016-07-01 16:06:20 +01:00
|
|
|
return get_SmearedU();
|
|
|
|
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
RealD impl_plaq = WilsonLoops<Gimpl>::avgPlaquette(*ThinLinks);
|
|
|
|
std::cout<< GridLogDebug << "getting Thin Plaq: " << impl_plaq<< std::endl;
|
|
|
|
return *ThinLinks;
|
|
|
|
}
|
2016-02-19 06:30:41 +00:00
|
|
|
}
|
2016-04-13 09:00:14 +01:00
|
|
|
else{
|
2016-07-01 16:06:20 +01:00
|
|
|
RealD impl_plaq = WilsonLoops<Gimpl>::avgPlaquette(*ThinLinks);
|
|
|
|
std::cout<< GridLogDebug << "getting Thin Plaq: " << impl_plaq<< std::endl;
|
|
|
|
return *ThinLinks;}
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-02-19 06:30:41 +00:00
|
|
|
}
|
|
|
|
|
2016-02-19 08:15:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-05 08:19:30 +01:00
|
|
|
|
2016-02-19 06:30:41 +00:00
|
|
|
#endif
|