mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-25 13:15:55 +01:00
Merge pull request #473 from UCL-ARC/gauge_action_deriv
WilsonGagueAction deriv
This commit is contained in:
commit
ab3de50d5e
@ -76,27 +76,27 @@ public:
|
|||||||
return action;
|
return action;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void deriv(const GaugeField &Umu,GaugeField & dSdU) {
|
virtual void deriv(const GaugeField &U, GaugeField &dSdU) {
|
||||||
//extend Ta to include Lorentz indexes
|
//extend Ta to include Lorentz indexes
|
||||||
RealD factor_p = c_plaq/RealD(Nc)*0.5;
|
RealD factor_p = c_plaq/RealD(Nc)*0.5;
|
||||||
RealD factor_r = c_rect/RealD(Nc)*0.5;
|
RealD factor_r = c_rect/RealD(Nc)*0.5;
|
||||||
|
|
||||||
GridBase *grid = Umu.Grid();
|
GridBase *grid = U.Grid();
|
||||||
|
|
||||||
std::vector<GaugeLinkField> U (Nd,grid);
|
std::vector<GaugeLinkField> Umu (Nd,grid);
|
||||||
for(int mu=0;mu<Nd;mu++){
|
for(int mu=0;mu<Nd;mu++){
|
||||||
U[mu] = PeekIndex<LorentzIndex>(Umu,mu);
|
Umu[mu] = PeekIndex<LorentzIndex>(U,mu);
|
||||||
}
|
}
|
||||||
std::vector<GaugeLinkField> RectStaple(Nd,grid), Staple(Nd,grid);
|
std::vector<GaugeLinkField> RectStaple(Nd,grid), Staple(Nd,grid);
|
||||||
WilsonLoops<Gimpl>::StapleAndRectStapleAll(Staple, RectStaple, U, workspace);
|
WilsonLoops<Gimpl>::StapleAndRectStapleAll(Staple, RectStaple, Umu, workspace);
|
||||||
|
|
||||||
GaugeLinkField dSdU_mu(grid);
|
GaugeLinkField dSdU_mu(grid);
|
||||||
GaugeLinkField staple(grid);
|
GaugeLinkField staple(grid);
|
||||||
|
|
||||||
for (int mu=0; mu < Nd; mu++){
|
for (int mu=0; mu < Nd; mu++){
|
||||||
dSdU_mu = Ta(U[mu]*Staple[mu])*factor_p;
|
dSdU_mu = Ta(Umu[mu]*Staple[mu])*factor_p;
|
||||||
dSdU_mu = dSdU_mu + Ta(U[mu]*RectStaple[mu])*factor_r;
|
dSdU_mu = dSdU_mu + Ta(Umu[mu]*RectStaple[mu])*factor_r;
|
||||||
|
|
||||||
PokeIndex<LorentzIndex>(dSdU, dSdU_mu, mu);
|
PokeIndex<LorentzIndex>(dSdU, dSdU_mu, mu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,20 +73,23 @@ public:
|
|||||||
// extend Ta to include Lorentz indexes
|
// extend Ta to include Lorentz indexes
|
||||||
|
|
||||||
RealD factor = 0.5 * beta / RealD(Nc);
|
RealD factor = 0.5 * beta / RealD(Nc);
|
||||||
|
GridBase *grid = U.Grid();
|
||||||
|
|
||||||
GaugeLinkField Umu(U.Grid());
|
GaugeLinkField dSdU_mu(grid);
|
||||||
GaugeLinkField dSdU_mu(U.Grid());
|
std::vector<GaugeLinkField> Umu(Nd, grid);
|
||||||
for (int mu = 0; mu < Nd; mu++) {
|
for (int mu = 0; mu < Nd; mu++) {
|
||||||
|
Umu[mu] = PeekIndex<LorentzIndex>(U, mu);
|
||||||
|
}
|
||||||
|
|
||||||
Umu = PeekIndex<LorentzIndex>(U, mu);
|
for (int mu = 0; mu < Nd; mu++) {
|
||||||
|
|
||||||
// Staple in direction mu
|
// Staple in direction mu
|
||||||
WilsonLoops<Gimpl>::Staple(dSdU_mu, U, mu);
|
WilsonLoops<Gimpl>::Staple(dSdU_mu, Umu, mu);
|
||||||
dSdU_mu = Ta(Umu * dSdU_mu) * factor;
|
dSdU_mu = Ta(Umu[mu] * dSdU_mu) * factor;
|
||||||
|
|
||||||
PokeIndex<LorentzIndex>(dSdU, dSdU_mu, mu);
|
PokeIndex<LorentzIndex>(dSdU, dSdU_mu, mu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RealD beta;
|
RealD beta;
|
||||||
};
|
};
|
||||||
|
@ -207,11 +207,14 @@ std::vector<RealD> WilsonFlowBase<Gimpl>::flowMeasureEnergyDensityCloverleaf(con
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class Gimpl>
|
template <class Gimpl>
|
||||||
void WilsonFlowBase<Gimpl>::setDefaultMeasurements(int topq_meas_interval){
|
void WilsonFlowBase<Gimpl>::setDefaultMeasurements(int meas_interval){
|
||||||
addMeasurement(1, [](int step, RealD t, const typename Gimpl::GaugeField &U){
|
addMeasurement(meas_interval, [](int step, RealD t, const typename Gimpl::GaugeField &U){
|
||||||
std::cout << GridLogMessage << "[WilsonFlow] Energy density (plaq) : " << step << " " << t << " " << energyDensityPlaquette(t,U) << std::endl;
|
std::cout << GridLogMessage << "[WilsonFlow] Energy density (plaq) : " << step << " " << t << " " << energyDensityPlaquette(t,U) << std::endl;
|
||||||
});
|
});
|
||||||
addMeasurement(topq_meas_interval, [](int step, RealD t, const typename Gimpl::GaugeField &U){
|
addMeasurement(meas_interval, [](int step, RealD t, const typename Gimpl::GaugeField &U){
|
||||||
|
std::cout << GridLogMessage << "[WilsonFlow] Energy density (cloverleaf) : " << step << " " << t << " " << energyDensityCloverleaf(t,U) << std::endl;
|
||||||
|
});
|
||||||
|
addMeasurement(meas_interval, [](int step, RealD t, const typename Gimpl::GaugeField &U){
|
||||||
std::cout << GridLogMessage << "[WilsonFlow] Top. charge : " << step << " " << WilsonLoops<Gimpl>::TopologicalCharge(U) << std::endl;
|
std::cout << GridLogMessage << "[WilsonFlow] Top. charge : " << step << " " << WilsonLoops<Gimpl>::TopologicalCharge(U) << std::endl;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -292,19 +292,21 @@ public:
|
|||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
// the sum over all nu-oriented staples for nu != mu on each site
|
// the sum over all nu-oriented staples for nu != mu on each site
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
static void Staple(GaugeMat &staple, const GaugeLorentz &Umu, int mu) {
|
static void Staple(GaugeMat &staple, const GaugeLorentz &U, int mu) {
|
||||||
|
|
||||||
GridBase *grid = Umu.Grid();
|
std::vector<GaugeMat> Umu(Nd, U.grid());
|
||||||
|
|
||||||
std::vector<GaugeMat> U(Nd, grid);
|
|
||||||
for (int d = 0; d < Nd; d++) {
|
for (int d = 0; d < Nd; d++) {
|
||||||
U[d] = PeekIndex<LorentzIndex>(Umu, d);
|
Umu[d] = PeekIndex<LorentzIndex>(U, d);
|
||||||
}
|
}
|
||||||
Staple(staple, U, mu);
|
Staple(staple, Umu, mu);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Staple(GaugeMat &staple, const std::vector<GaugeMat> &U, int mu) {
|
static void Staple(GaugeMat &staple, const std::vector<GaugeMat> &Umu, int mu) {
|
||||||
staple = Zero();
|
|
||||||
|
autoView(staple_v, staple, AcceleratorWrite);
|
||||||
|
accelerator_for(i, staple.Grid()->oSites(), Simd::Nsimd(), {
|
||||||
|
staple_v[i] = Zero();
|
||||||
|
});
|
||||||
|
|
||||||
for (int nu = 0; nu < Nd; nu++) {
|
for (int nu = 0; nu < Nd; nu++) {
|
||||||
|
|
||||||
@ -318,12 +320,12 @@ public:
|
|||||||
// |
|
// |
|
||||||
// __|
|
// __|
|
||||||
//
|
//
|
||||||
|
|
||||||
staple += Gimpl::ShiftStaple(
|
staple += Gimpl::ShiftStaple(
|
||||||
Gimpl::CovShiftForward(
|
Gimpl::CovShiftForward(
|
||||||
U[nu], nu,
|
Umu[nu], nu,
|
||||||
Gimpl::CovShiftBackward(
|
Gimpl::CovShiftBackward(
|
||||||
U[mu], mu, Gimpl::CovShiftIdentityBackward(U[nu], nu))),
|
Umu[mu], mu, Gimpl::CovShiftIdentityBackward(Umu[nu], nu))),
|
||||||
mu);
|
mu);
|
||||||
|
|
||||||
// __
|
// __
|
||||||
@ -333,8 +335,8 @@ public:
|
|||||||
//
|
//
|
||||||
|
|
||||||
staple += Gimpl::ShiftStaple(
|
staple += Gimpl::ShiftStaple(
|
||||||
Gimpl::CovShiftBackward(U[nu], nu,
|
Gimpl::CovShiftBackward(Umu[nu], nu,
|
||||||
Gimpl::CovShiftBackward(U[mu], mu, U[nu])), mu);
|
Gimpl::CovShiftBackward(Umu[mu], mu, Umu[nu])), mu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ AC_ARG_ENABLE([tracing],
|
|||||||
case ${ac_TRACING} in
|
case ${ac_TRACING} in
|
||||||
nvtx)
|
nvtx)
|
||||||
AC_DEFINE([GRID_TRACING_NVTX],[1],[use NVTX])
|
AC_DEFINE([GRID_TRACING_NVTX],[1],[use NVTX])
|
||||||
LIBS="${LIBS} -lnvToolsExt64_1"
|
LIBS="${LIBS} -lnvToolsExt"
|
||||||
;;
|
;;
|
||||||
roctx)
|
roctx)
|
||||||
AC_DEFINE([GRID_TRACING_ROCTX],[1],[use ROCTX])
|
AC_DEFINE([GRID_TRACING_ROCTX],[1],[use ROCTX])
|
||||||
|
@ -33,8 +33,7 @@ namespace Grid{
|
|||||||
GRID_SERIALIZABLE_CLASS_MEMBERS(WFParameters,
|
GRID_SERIALIZABLE_CLASS_MEMBERS(WFParameters,
|
||||||
int, steps,
|
int, steps,
|
||||||
double, step_size,
|
double, step_size,
|
||||||
int, meas_interval,
|
int, meas_interval);
|
||||||
double, maxTau); // for the adaptive algorithm
|
|
||||||
|
|
||||||
|
|
||||||
template <class ReaderClass >
|
template <class ReaderClass >
|
||||||
@ -86,7 +85,7 @@ int main(int argc, char **argv) {
|
|||||||
WFParameters WFPar(Reader);
|
WFParameters WFPar(Reader);
|
||||||
ConfParameters CPar(Reader);
|
ConfParameters CPar(Reader);
|
||||||
CheckpointerParameters CPPar(CPar.conf_prefix, CPar.rng_prefix);
|
CheckpointerParameters CPPar(CPar.conf_prefix, CPar.rng_prefix);
|
||||||
BinaryHmcCheckpointer<PeriodicGimplR> CPBin(CPPar);
|
NerscHmcCheckpointer<PeriodicGimplR> CPBin(CPPar);
|
||||||
|
|
||||||
for (int conf = CPar.StartConfiguration; conf <= CPar.EndConfiguration; conf+= CPar.Skip){
|
for (int conf = CPar.StartConfiguration; conf <= CPar.EndConfiguration; conf+= CPar.Skip){
|
||||||
|
|
||||||
@ -96,19 +95,13 @@ int main(int argc, char **argv) {
|
|||||||
std::cout << GridLogMessage << "Initial plaquette: "
|
std::cout << GridLogMessage << "Initial plaquette: "
|
||||||
<< WilsonLoops<PeriodicGimplR>::avgPlaquette(Umu) << std::endl;
|
<< WilsonLoops<PeriodicGimplR>::avgPlaquette(Umu) << std::endl;
|
||||||
|
|
||||||
int t=WFPar.maxTau;
|
WilsonFlow<PeriodicGimplR> WF(WFPar.step_size, WFPar.steps,
|
||||||
WilsonFlowAdaptive<PeriodicGimplR> WF(WFPar.step_size, WFPar.maxTau,
|
|
||||||
1.0e-4,
|
|
||||||
WFPar.meas_interval);
|
WFPar.meas_interval);
|
||||||
|
|
||||||
WF.smear(Uflow, Umu);
|
WF.smear(Uflow, Umu);
|
||||||
|
|
||||||
RealD WFlow_plaq = WilsonLoops<PeriodicGimplR>::avgPlaquette(Uflow);
|
RealD WFlow_plaq = WilsonLoops<PeriodicGimplR>::avgPlaquette(Uflow);
|
||||||
RealD WFlow_TC = WilsonLoops<PeriodicGimplR>::TopologicalCharge(Uflow);
|
|
||||||
RealD WFlow_T0 = WF.energyDensityPlaquette(t,Uflow);
|
|
||||||
std::cout << GridLogMessage << "Plaquette "<< conf << " " << WFlow_plaq << std::endl;
|
std::cout << GridLogMessage << "Plaquette "<< conf << " " << WFlow_plaq << std::endl;
|
||||||
std::cout << GridLogMessage << "T0 "<< conf << " " << WFlow_T0 << std::endl;
|
|
||||||
std::cout << GridLogMessage << "TopologicalCharge "<< conf << " " << WFlow_TC << std::endl;
|
|
||||||
|
|
||||||
std::cout<< GridLogMessage << " Admissibility check:\n";
|
std::cout<< GridLogMessage << " Admissibility check:\n";
|
||||||
const double sp_adm = 0.067; // admissible threshold
|
const double sp_adm = 0.067; // admissible threshold
|
||||||
|
Loading…
x
Reference in New Issue
Block a user