1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 15:55:37 +00:00
Grid/tests/hadrons/Test_hadrons_spectrum.cc

149 lines
5.6 KiB
C++
Raw Normal View History

2018-09-07 20:10:07 +01:00
/*************************************************************************************
Grid physics library, www.github.com/paboyle/Grid
Source file: Tests/Hadrons/Test_hadrons_spectrum.cc
Copyright (C) 2015-2018
2016-12-05 02:44:58 +00:00
Author: Antonin Portelli <antonin.portelli@me.com>
2018-09-07 20:10:07 +01:00
This program 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.
This program 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 this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
See the full license in the file "LICENSE" in the top level distribution directory
*************************************************************************************/
/* END LEGAL */
2016-12-05 02:44:58 +00:00
#include <Hadrons/Application.hpp>
#include <Hadrons/Modules.hpp>
2016-12-05 02:44:58 +00:00
using namespace Grid;
using namespace Hadrons;
int main(int argc, char *argv[])
{
// initialization //////////////////////////////////////////////////////////
Grid_init(&argc, &argv);
HadronsLogError.Active(GridLogError.isActive());
HadronsLogWarning.Active(GridLogWarning.isActive());
HadronsLogMessage.Active(GridLogMessage.isActive());
HadronsLogIterative.Active(GridLogIterative.isActive());
HadronsLogDebug.Active(GridLogDebug.isActive());
LOG(Message) << "Grid initialized" << std::endl;
// run setup ///////////////////////////////////////////////////////////////
2016-12-14 18:04:21 +00:00
Application application;
2016-12-05 02:44:58 +00:00
std::vector<std::string> flavour = {"l", "s", "c1", "c2", "c3"};
std::vector<double> mass = {.01, .04, .2 , .25 , .3 };
// global parameters
Application::GlobalPar globalPar;
globalPar.trajCounter.start = 1500;
globalPar.trajCounter.end = 1520;
globalPar.trajCounter.step = 20;
2018-09-10 15:32:13 +01:00
globalPar.runId = "test";
2016-12-05 02:44:58 +00:00
application.setPar(globalPar);
// gauge field
2016-12-05 04:53:31 +00:00
application.createModule<MGauge::Unit>("gauge");
2016-12-05 02:44:58 +00:00
// sources
2016-12-05 04:53:31 +00:00
MSource::Z2::Par z2Par;
2016-12-05 02:44:58 +00:00
z2Par.tA = 0;
z2Par.tB = 0;
2016-12-05 04:53:31 +00:00
application.createModule<MSource::Z2>("z2", z2Par);
MSource::Point::Par ptPar;
2016-12-05 02:44:58 +00:00
ptPar.position = "0 0 0 0";
2016-12-05 04:53:31 +00:00
application.createModule<MSource::Point>("pt", ptPar);
// sink
MSink::Point::Par sinkPar;
sinkPar.mom = "0 0 0";
application.createModule<MSink::ScalarPoint>("sink", sinkPar);
// set fermion boundary conditions to be periodic space, antiperiodic time.
std::string boundary = "1 1 1 -1";
2016-12-05 02:44:58 +00:00
for (unsigned int i = 0; i < flavour.size(); ++i)
{
// actions
2016-12-05 04:53:31 +00:00
MAction::DWF::Par actionPar;
2016-12-05 02:44:58 +00:00
actionPar.gauge = "gauge";
actionPar.Ls = 12;
actionPar.M5 = 1.8;
actionPar.mass = mass[i];
actionPar.boundary = boundary;
2016-12-05 04:53:31 +00:00
application.createModule<MAction::DWF>("DWF_" + flavour[i], actionPar);
2016-12-05 02:44:58 +00:00
// solvers
2016-12-05 04:53:31 +00:00
MSolver::RBPrecCG::Par solverPar;
solverPar.action = "DWF_" + flavour[i];
solverPar.residual = 1.0e-8;
solverPar.maxIteration = 10000;
2016-12-05 04:53:31 +00:00
application.createModule<MSolver::RBPrecCG>("CG_" + flavour[i],
solverPar);
2016-12-05 02:44:58 +00:00
// propagators
MFermion::GaugeProp::Par quarkPar;
2016-12-05 02:44:58 +00:00
quarkPar.solver = "CG_" + flavour[i];
quarkPar.source = "pt";
application.createModule<MFermion::GaugeProp>("Qpt_" + flavour[i], quarkPar);
quarkPar.source = "z2";
application.createModule<MFermion::GaugeProp>("QZ2_" + flavour[i], quarkPar);
2016-12-05 02:44:58 +00:00
}
2016-12-05 08:26:57 +00:00
for (unsigned int i = 0; i < flavour.size(); ++i)
for (unsigned int j = i; j < flavour.size(); ++j)
2016-12-05 02:44:58 +00:00
{
2016-12-05 04:53:31 +00:00
MContraction::Meson::Par mesPar;
2016-12-05 02:44:58 +00:00
mesPar.output = "mesons/pt_" + flavour[i] + flavour[j];
mesPar.q1 = "Qpt_" + flavour[i];
mesPar.q2 = "Qpt_" + flavour[j];
mesPar.gammas = "all";
mesPar.sink = "sink";
application.createModule<MContraction::Meson>("meson_pt_"
+ flavour[i] + flavour[j],
mesPar);
mesPar.output = "mesons/Z2_" + flavour[i] + flavour[j];
mesPar.q1 = "QZ2_" + flavour[i];
mesPar.q2 = "QZ2_" + flavour[j];
mesPar.gammas = "all";
mesPar.sink = "sink";
application.createModule<MContraction::Meson>("meson_Z2_"
2016-12-05 04:53:31 +00:00
+ flavour[i] + flavour[j],
mesPar);
2016-12-05 02:44:58 +00:00
}
2016-12-05 08:26:57 +00:00
for (unsigned int i = 0; i < flavour.size(); ++i)
for (unsigned int j = i; j < flavour.size(); ++j)
for (unsigned int k = j; k < flavour.size(); ++k)
{
MContraction::Baryon::Par barPar;
barPar.output = "baryons/pt_" + flavour[i] + flavour[j] + flavour[k];
barPar.q1 = "Qpt_" + flavour[i];
barPar.q2 = "Qpt_" + flavour[j];
barPar.q3 = "Qpt_" + flavour[k];
2016-12-05 08:26:57 +00:00
application.createModule<MContraction::Baryon>(
"baryon_pt_" + flavour[i] + flavour[j] + flavour[k], barPar);
2016-12-05 08:26:57 +00:00
}
2016-12-05 02:44:58 +00:00
// execution
2016-12-14 19:41:51 +00:00
application.saveParameterFile("spectrum.xml");
2016-12-05 02:44:58 +00:00
application.run();
// epilogue
LOG(Message) << "Grid is finalizing now" << std::endl;
Grid_finalize();
return EXIT_SUCCESS;
}