From e61fed87db2b8d7dd465e05c1a2526eca79408fb Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Wed, 20 Apr 2022 15:41:55 +0100 Subject: [PATCH] SteepestDescentGaugeFix now exits when the algorithm does not converge. This behaviour can be altered by setting err_on_no_converge to false. --- Grid/qcd/utils/GaugeFix.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Grid/qcd/utils/GaugeFix.h b/Grid/qcd/utils/GaugeFix.h index 2b3384da..29184a88 100644 --- a/Grid/qcd/utils/GaugeFix.h +++ b/Grid/qcd/utils/GaugeFix.h @@ -55,12 +55,12 @@ public: } } - static void SteepestDescentGaugeFix(GaugeLorentz &Umu,Real & alpha,int maxiter,Real Omega_tol, Real Phi_tol,bool Fourier=false,int orthog=-1) { + 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) { GridBase *grid = Umu.Grid(); GaugeMat xform(grid); - SteepestDescentGaugeFix(Umu,xform,alpha,maxiter,Omega_tol,Phi_tol,Fourier,orthog); + SteepestDescentGaugeFix(Umu,xform,alpha,maxiter,Omega_tol,Phi_tol,Fourier,orthog,err_on_no_converge); } - static void SteepestDescentGaugeFix(GaugeLorentz &Umu,GaugeMat &xform,Real & alpha,int maxiter,Real Omega_tol, Real Phi_tol,bool Fourier=false,int orthog=-1) { + 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) { GridBase *grid = Umu.Grid(); @@ -122,6 +122,8 @@ public: } } + std::cout << GridLogError << "Gauge fixing did not converge in " << maxiter << " iterations." << std::endl; + if (err_on_no_converge) assert(0); }; static Real SteepestDescentStep(std::vector &U,GaugeMat &xform,Real & alpha, GaugeMat & dmuAmu,int orthog) { GridBase *grid = U[0].Grid();