diff --git a/extras/Hadrons/Modules/MSolver/RBPrecCG.hpp b/extras/Hadrons/Modules/MSolver/RBPrecCG.hpp index 206d44d1..8983e30b 100644 --- a/extras/Hadrons/Modules/MSolver/RBPrecCG.hpp +++ b/extras/Hadrons/Modules/MSolver/RBPrecCG.hpp @@ -116,7 +116,7 @@ std::vector TRBPrecCG::getReference(void) template std::vector TRBPrecCG::getOutput(void) { - std::vector out = {getName()}; + std::vector out = {getName(), getName() + "_subtract"}; return out; } @@ -166,16 +166,21 @@ void TRBPrecCG::setup(void) guesser.reset(new FineGuesser(epack.evec, epack.eval)); } } - auto solver = [&mat, guesser, this](FermionField &sol, - const FermionField &source) - { - ConjugateGradient cg(par().residual, - par().maxIteration); - HADRONS_DEFAULT_SCHUR_SOLVE schurSolver(cg); - - schurSolver(mat, source, sol, *guesser); + auto makeSolver = [&mat, guesser, this](bool subGuess) { + return [&mat, guesser, subGuess, this](FermionField &sol, + const FermionField &source) { + ConjugateGradient cg(par().residual, + par().maxIteration); + HADRONS_DEFAULT_SCHUR_SOLVE schurSolver(cg); + schurSolver.subtractGuess(subGuess); + schurSolver(mat, source, sol, *guesser); + }; }; + + auto solver = makeSolver(false); envCreate(SolverFn, getName(), Ls, solver); + auto solver_subtract = makeSolver(true); + envCreate(SolverFn, getName() + "_subtract", Ls, solver_subtract); }