forked from portelli/HadronsPresets
Add Jlqcd presets
This commit is contained in:
@@ -0,0 +1,206 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2026
|
||||||
|
*
|
||||||
|
* Hadrons presets for the JLQCD scaled-domain-wall ensembles used by iblep.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Hadrons/Application.hpp>
|
||||||
|
#include <Hadrons/Modules.hpp>
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
|
namespace hadpresets
|
||||||
|
{
|
||||||
|
using namespace Grid::Hadrons;
|
||||||
|
|
||||||
|
struct Jlqcd
|
||||||
|
{
|
||||||
|
struct EnsembleParameters
|
||||||
|
{
|
||||||
|
double ml, ms, M5, scale;
|
||||||
|
unsigned int L, T, Ls;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline static constexpr EnsembleParameters fUd3SaPar{0.003, 0.015, 1., 2., 64, 128, 8};
|
||||||
|
inline static constexpr EnsembleParameters mUd3SaPar{0.0042, 0.025, 1., 2., 48, 96, 8};
|
||||||
|
inline static constexpr EnsembleParameters mUd3SbPar{0.0042, 0.018, 1., 2., 48, 96, 8};
|
||||||
|
inline static constexpr EnsembleParameters cUd2SaPar{0.0035, 0.040, 1., 2., 32, 64, 12};
|
||||||
|
inline static constexpr EnsembleParameters cUd2SaLPar{0.0035, 0.040, 1., 2., 48, 96, 12};
|
||||||
|
inline static constexpr EnsembleParameters cUd3SaPar{0.007, 0.040, 1., 2., 32, 64, 12};
|
||||||
|
inline static constexpr EnsembleParameters cUd3SbPar{0.007, 0.030, 1., 2., 32, 64, 12};
|
||||||
|
inline static constexpr EnsembleParameters testPar{0.010, 0.030, 1., 2., 8, 16, 8};
|
||||||
|
|
||||||
|
static inline const EnsembleParameters &ensemble(const std::string &name);
|
||||||
|
|
||||||
|
static inline void addMixedPrecisionSolver(Application &app, const EnsembleParameters &par,
|
||||||
|
const std::string &solverName,
|
||||||
|
const std::string &gaugeName, const double mass,
|
||||||
|
const std::string &twist,
|
||||||
|
const std::string &boundary = "1 1 1 -1",
|
||||||
|
const double residual = 1.0e-8);
|
||||||
|
|
||||||
|
static inline void addNoFailSolver(Application &app, const EnsembleParameters &par,
|
||||||
|
const std::string &solverName, const std::string &gaugeName,
|
||||||
|
const double mass, const std::string &twist,
|
||||||
|
const std::string &boundary = "1 1 1 -1",
|
||||||
|
const double residual = 1.0e-20);
|
||||||
|
|
||||||
|
static inline void addLightSolver(Application &app, const EnsembleParameters &par,
|
||||||
|
const std::string &solverName, const std::string &gaugeName,
|
||||||
|
const double mass, const std::string &twist,
|
||||||
|
const std::string &boundary = "1 1 1 -1",
|
||||||
|
const double residual = 1.0e-8);
|
||||||
|
|
||||||
|
static inline void addLightSolver(Application &app, const EnsembleParameters &par,
|
||||||
|
const std::string &solverName, const std::string &gaugeName,
|
||||||
|
const std::string &twist = "0. 0. 0. 0.",
|
||||||
|
const std::string &boundary = "1 1 1 -1",
|
||||||
|
const double residual = 1.0e-8);
|
||||||
|
|
||||||
|
static inline void addStrangeSolver(Application &app, const EnsembleParameters &par,
|
||||||
|
const std::string &solverName, const std::string &gaugeName,
|
||||||
|
const double mass, const std::string &twist,
|
||||||
|
const std::string &boundary = "1 1 1 -1",
|
||||||
|
const double residual = 1.0e-8);
|
||||||
|
|
||||||
|
static inline void addStrangeSolver(Application &app, const EnsembleParameters &par,
|
||||||
|
const std::string &solverName, const std::string &gaugeName,
|
||||||
|
const std::string &twist = "0. 0. 0. 0.",
|
||||||
|
const std::string &boundary = "1 1 1 -1",
|
||||||
|
const double residual = 1.0e-8);
|
||||||
|
|
||||||
|
static inline void addHeavySolver(Application &app, const EnsembleParameters &par,
|
||||||
|
const std::string &solverName, const std::string &gaugeName,
|
||||||
|
const double mass, const std::string &twist,
|
||||||
|
const std::string &boundary = "1 1 1 -1",
|
||||||
|
const double residual = 1.0e-20);
|
||||||
|
};
|
||||||
|
|
||||||
|
inline const Jlqcd::EnsembleParameters &Jlqcd::ensemble(const std::string &name)
|
||||||
|
{
|
||||||
|
if (name == "fUd3Sa")
|
||||||
|
return fUd3SaPar;
|
||||||
|
if (name == "mUd3Sa")
|
||||||
|
return mUd3SaPar;
|
||||||
|
if (name == "mUd3Sb")
|
||||||
|
return mUd3SbPar;
|
||||||
|
if (name == "cUd2Sa")
|
||||||
|
return cUd2SaPar;
|
||||||
|
if (name == "cUd2SaL")
|
||||||
|
return cUd2SaLPar;
|
||||||
|
if (name == "cUd3Sa")
|
||||||
|
return cUd3SaPar;
|
||||||
|
if (name == "cUd3Sb")
|
||||||
|
return cUd3SbPar;
|
||||||
|
if (name == "test")
|
||||||
|
return testPar;
|
||||||
|
|
||||||
|
throw std::invalid_argument("unknown JLQCD ensemble preset '" + std::string(name) + "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Jlqcd::addMixedPrecisionSolver(Application &app, const EnsembleParameters &par,
|
||||||
|
const std::string &solverName,
|
||||||
|
const std::string &gaugeName, const double mass,
|
||||||
|
const std::string &twist, const std::string &boundary,
|
||||||
|
const double residual)
|
||||||
|
{
|
||||||
|
const std::string prefix = solverName;
|
||||||
|
|
||||||
|
MUtilities::GaugeSinglePrecisionCast::Par gaugeCastPar;
|
||||||
|
gaugeCastPar.field = gaugeName;
|
||||||
|
app.createModule<MUtilities::GaugeSinglePrecisionCast>(prefix + "_gauge_fp32", gaugeCastPar);
|
||||||
|
|
||||||
|
MAction::ScaledDWF::Par actionPar;
|
||||||
|
actionPar.gauge = gaugeName;
|
||||||
|
actionPar.Ls = par.Ls;
|
||||||
|
actionPar.M5 = par.M5;
|
||||||
|
actionPar.mass = mass;
|
||||||
|
actionPar.scale = par.scale;
|
||||||
|
actionPar.boundary = boundary;
|
||||||
|
actionPar.twist = twist;
|
||||||
|
app.createModule<MAction::ScaledDWF>(prefix + "_dwf", actionPar);
|
||||||
|
|
||||||
|
actionPar.gauge = prefix + "_gauge_fp32";
|
||||||
|
app.createModule<MAction::ScaledDWFF>(prefix + "_dwf_fp32", actionPar);
|
||||||
|
|
||||||
|
MSolver::MixedPrecisionRBPrecCG::Par solverPar;
|
||||||
|
solverPar.innerAction = prefix + "_dwf_fp32";
|
||||||
|
solverPar.outerAction = prefix + "_dwf";
|
||||||
|
solverPar.maxInnerIteration = 10000;
|
||||||
|
solverPar.maxOuterIteration = 100;
|
||||||
|
solverPar.residual = residual;
|
||||||
|
solverPar.innerGuesser = "";
|
||||||
|
solverPar.outerGuesser = "";
|
||||||
|
app.createModule<MSolver::MixedPrecisionRBPrecCG>(solverName, solverPar);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Jlqcd::addNoFailSolver(Application &app, const EnsembleParameters &par,
|
||||||
|
const std::string &solverName, const std::string &gaugeName,
|
||||||
|
const double mass, const std::string &twist,
|
||||||
|
const std::string &boundary, const double residual)
|
||||||
|
{
|
||||||
|
const std::string prefix = solverName;
|
||||||
|
|
||||||
|
MAction::ScaledDWF::Par actionPar;
|
||||||
|
actionPar.gauge = gaugeName;
|
||||||
|
actionPar.Ls = par.Ls;
|
||||||
|
actionPar.M5 = par.M5;
|
||||||
|
actionPar.mass = mass;
|
||||||
|
actionPar.scale = par.scale;
|
||||||
|
actionPar.boundary = boundary;
|
||||||
|
actionPar.twist = twist;
|
||||||
|
app.createModule<MAction::ScaledDWF>(prefix + "_dwf", actionPar);
|
||||||
|
|
||||||
|
MSolver::RBPrecCGNoFail::Par solverPar;
|
||||||
|
solverPar.action = prefix + "_dwf";
|
||||||
|
solverPar.maxIteration = 30000;
|
||||||
|
solverPar.residual = residual;
|
||||||
|
solverPar.guesser = "";
|
||||||
|
app.createModule<MSolver::RBPrecCGNoFail>(solverName, solverPar);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Jlqcd::addLightSolver(Application &app, const EnsembleParameters &par,
|
||||||
|
const std::string &solverName, const std::string &gaugeName,
|
||||||
|
const double mass, const std::string &twist,
|
||||||
|
const std::string &boundary, const double residual)
|
||||||
|
{
|
||||||
|
addMixedPrecisionSolver(app, par, solverName, gaugeName, mass, twist, boundary, residual);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Jlqcd::addLightSolver(Application &app, const EnsembleParameters &par,
|
||||||
|
const std::string &solverName, const std::string &gaugeName,
|
||||||
|
const std::string &twist, const std::string &boundary,
|
||||||
|
const double residual)
|
||||||
|
{
|
||||||
|
addLightSolver(app, par, solverName, gaugeName, par.ml, twist, boundary, residual);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Jlqcd::addStrangeSolver(Application &app, const EnsembleParameters &par,
|
||||||
|
const std::string &solverName, const std::string &gaugeName,
|
||||||
|
const double mass, const std::string &twist,
|
||||||
|
const std::string &boundary, const double residual)
|
||||||
|
{
|
||||||
|
addMixedPrecisionSolver(app, par, solverName, gaugeName, mass, twist, boundary, residual);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Jlqcd::addStrangeSolver(Application &app, const EnsembleParameters &par,
|
||||||
|
const std::string &solverName, const std::string &gaugeName,
|
||||||
|
const std::string &twist, const std::string &boundary,
|
||||||
|
const double residual)
|
||||||
|
{
|
||||||
|
addStrangeSolver(app, par, solverName, gaugeName, par.ms, twist, boundary, residual);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Jlqcd::addHeavySolver(Application &app, const EnsembleParameters &par,
|
||||||
|
const std::string &solverName, const std::string &gaugeName,
|
||||||
|
const double mass, const std::string &twist,
|
||||||
|
const std::string &boundary, const double residual)
|
||||||
|
{
|
||||||
|
addNoFailSolver(app, par, solverName, gaugeName, mass, twist, boundary, residual);
|
||||||
|
}
|
||||||
|
} // namespace hadpresets
|
||||||
Reference in New Issue
Block a user