HadronsPresets/Test.hpp

66 lines
2.0 KiB
C++
Raw Permalink Normal View History

2023-05-12 13:48:26 +01:00
/*
* Copyright (C) 2023
*
* Author: Antonin Portelli <antonin.portelli@me.com>
* Elements based on production templates from Raoul Hodgson
*
* Hadrons is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Hadrons is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Hadrons. If not, see <http://www.gnu.org/licenses/>.
*
* See the full license in the file "LICENSE" in the top level distribution
* directory.
*/
#pragma once
#include <Hadrons/Application.hpp>
#include <Hadrons/Modules.hpp>
namespace hadpresets
{
using namespace Grid::Hadrons;
struct Test
{
static inline void addTestDwfSolver(Application &app, const std::string solverName,
const std::string gaugeName, const double mass = 0.1,
const double residual = 1.0e-8);
};
void Test::addTestDwfSolver(Application &app, const std::string solverName,
const std::string gaugeName, const double mass, const double residual)
{
const std::string prefix = solverName;
// DWF action
MAction::DWF::Par actionPar;
actionPar.gauge = gaugeName;
actionPar.Ls = 8;
actionPar.M5 = 1.8;
actionPar.mass = mass;
actionPar.boundary = "1 1 1 -1";
actionPar.twist = "0. 0. 0. 0.";
app.createModule<MAction::DWF>(prefix + "_dwf", actionPar);
// solver
MSolver::RBPrecCG::Par solverPar;
solverPar.action = prefix + "_dwf";
solverPar.guesser = "";
solverPar.maxIteration = 10000;
solverPar.residual = residual;
app.createModule<MSolver::RBPrecCG>(solverName, solverPar);
}
} // namespace hadpresets