29#ifndef GRID_QCD_GAUGE_FIX_H
30#define GRID_QCD_GAUGE_FIX_H
40 typedef typename Gimpl::GaugeLinkField
GaugeMat;
57 for(
int mu=0;mu<
Nd;mu++){
64 Utmp = Gimpl::CshiftLink(
U[mu], mu, -1);
68 dmuAmu = dmuAmu + Ax - Axm1;
87 Real old_trace = org_link_trace;
92 std::vector<GaugeMat>
U(
Nd,grid);
98 if( (orthog>=0) && (orthog<
Nd) ){
99 std::cout <<
GridLogMessage <<
" Gauge fixing to Coulomb gauge time="<<orthog<<
" plaq= "<<plaq<<
" link trace = "<<link_trace<< std::endl;
101 std::cout <<
GridLogMessage <<
" Gauge fixing to Landau gauge plaq= "<<plaq<<
" link trace = "<<link_trace<< std::endl;
104 for(
int i=0;i<maxiter;i++){
106 for(
int mu=0;mu<Nd;mu++) U[mu]= PeekIndex<LorentzIndex>(Umu,mu);
108 if ( Fourier==
false ) {
118 for(
int mu=0;mu<Nd;mu++) PokeIndex<LorentzIndex>(Umu,
U[mu],mu);
126 std::cout <<
GridLogMessage <<
"Fourier Iteration "<<i<<
" plaq= "<<plaq<<
" dmuAmu " <<
norm2(dmuAmu)<< std::endl;
128 std::cout <<
GridLogMessage <<
" Iteration "<<i<<
" plaq= "<<plaq<<
" dmuAmu " <<
norm2(dmuAmu)<< std::endl;
130 Real Phi = 1.0 - old_trace / link_trace ;
133 std::cout <<
GridLogMessage <<
" Iteration "<<i<<
" Phi= "<<Phi<<
" Omega= " <<
Omega<<
" trG " << trG <<std::endl;
134 if ( (
Omega < Omega_tol) && ( ::fabs(Phi) < Phi_tol) ) {
139 old_trace = link_trace;
143 std::cout <<
GridLogError <<
"Gauge fixing did not converge in " << maxiter <<
" iterations." << std::endl;
144 if (err_on_no_converge)
145 assert(0 &&
"Gauge fixing did not converge within the specified number of iterations");
179 std::vector<int> mask(
Nd,1);
180 for(
int mu=0;mu<
Nd;mu++)
if (mu==orthog) mask[mu]=0;
189 for(
int mu=0;mu<
Nd;mu++) {
190 if ( mu != orthog ) {
191 Real TwoPiL =
M_PI * 2.0/ latt_size[mu];
194 psq = psq + 4.0*
sin(pmu*0.5)*
sin(pmu*0.5);
202 if( (orthog>=0) && (orthog<
Nd) ){
209 dmuAmu_p = dmuAmu_p * Fp;
215 ciadmam = dmuAmu*cialpha;
231 ciadmam = dmuAmu*cialpha;
AcceleratorVector< int, MaxDims > Coordinate
accelerator_inline Grid_simd2< S, V > trace(const Grid_simd2< S, V > &arg)
accelerator_inline Grid_simd< S, V > sin(const Grid_simd< S, V > &r)
void LatticeCoordinate(Lattice< iobj > &l, int mu)
void pokeSite(const sobj &s, Lattice< vobj > &l, const Coordinate &site)
vobj::scalar_object sum(const vobj *arg, Integer osites)
RealD norm2(const Lattice< vobj > &arg)
GridLogger GridLogError(1, "Error", GridLogColours, "RED")
GridLogger GridLogMessage(1, "Message", GridLogColours, "NORMAL")
#define NAMESPACE_BEGIN(A)
Lattice< vTComplex > LatticeComplex
iSinglet< Complex > TComplex
std::complex< Real > Complex
static void Omega(LatticeColourMatrixD &in)
accelerator_inline iScalar< vtype > Ta(const iScalar< vtype > &r)
accelerator_inline std::enable_if<!isGridTensor< T >::value, T >::type TensorRemove(T arg)
static INTERNAL_PRECISION U
unsigned long _ndimension
static const int backward
void FFT_dim_mask(Lattice< vobj > &result, const Lattice< vobj > &source, Coordinate mask, int sign)
Gimpl::GaugeLinkField GaugeMat
static Real FourierAccelSteepestDescentStep(std::vector< GaugeMat > &U, GaugeMat &xform, Real alpha, GaugeMat &dmuAmu, int orthog)
static void GaugeLinkToLieAlgebraField(const GaugeMat &U, GaugeMat &A)
static void DmuAmu(const std::vector< GaugeMat > &U, GaugeMat &dmuAmu, int orthog)
INHERIT_GIMPL_TYPES(Gimpl)
static Real SteepestDescentStep(std::vector< GaugeMat > &U, GaugeMat &xform, Real alpha, GaugeMat &dmuAmu, int orthog)
static void ExpiAlphaDmuAmu(const std::vector< GaugeMat > &U, GaugeMat &g, Real alpha, GaugeMat &dmuAmu, int orthog)
static void SteepestDescentGaugeFix(GaugeLorentz &Umu, Real alpha, int maxiter, Real Omega_tol, Real Phi_tol, bool Fourier=false, int orthog=-1, bool err_on_no_converge=true)
static void SteepestDescentGaugeFix(GaugeLorentz &Umu, GaugeMat &xform, Real alpha, int maxiter, Real Omega_tol, Real Phi_tol, bool Fourier=false, int orthog=-1, bool err_on_no_converge=true)
Gimpl::GaugeField GaugeLorentz
static void taExp(const LatticeMatrixType &x, LatticeMatrixType &ex)
static void GaugeTransform(typename Gimpl::GaugeField &Umu, typename Gimpl::GaugeLinkField &g)
const Coordinate & GlobalDimensions(void)
int64_t gSites(void) const
static RealD avgPlaquette(const GaugeLorentz &Umu)
static RealD linkTrace(const GaugeLorentz &Umu)