mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-25 13:15:55 +01:00
Hadrons: modules for scalar propagators
This commit is contained in:
parent
bbc0eff078
commit
673994b281
@ -51,23 +51,38 @@ using Grid::operator<<;
|
|||||||
* error with GCC 5 (clang & GCC 6 compile fine without it).
|
* error with GCC 5 (clang & GCC 6 compile fine without it).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// FIXME: find a way to do that in a more general fashion
|
|
||||||
#ifndef FIMPL
|
#ifndef FIMPL
|
||||||
#define FIMPL WilsonImplR
|
#define FIMPL WilsonImplR
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef SIMPL
|
||||||
|
#define SIMPL ScalarImplR
|
||||||
|
#endif
|
||||||
|
|
||||||
BEGIN_HADRONS_NAMESPACE
|
BEGIN_HADRONS_NAMESPACE
|
||||||
|
|
||||||
// type aliases
|
// type aliases
|
||||||
#define TYPE_ALIASES(FImpl, suffix)\
|
#define FERM_TYPE_ALIASES(FImpl, suffix)\
|
||||||
typedef FermionOperator<FImpl> FMat##suffix; \
|
typedef FermionOperator<FImpl> FMat##suffix; \
|
||||||
typedef typename FImpl::FermionField FermionField##suffix; \
|
typedef typename FImpl::FermionField FermionField##suffix; \
|
||||||
typedef typename FImpl::PropagatorField PropagatorField##suffix; \
|
typedef typename FImpl::PropagatorField PropagatorField##suffix; \
|
||||||
typedef typename FImpl::SitePropagator SitePropagator##suffix; \
|
typedef typename FImpl::SitePropagator SitePropagator##suffix;
|
||||||
typedef typename FImpl::DoubledGaugeField DoubledGaugeField##suffix;\
|
|
||||||
typedef std::function<void(FermionField##suffix &, \
|
#define GAUGE_TYPE_ALIASES(FImpl, suffix)\
|
||||||
|
typedef typename FImpl::DoubledGaugeField DoubledGaugeField##suffix;
|
||||||
|
|
||||||
|
#define SCALAR_TYPE_ALIASES(SImpl, suffix)\
|
||||||
|
typedef typename SImpl::ScalarField ScalarField##suffix;\
|
||||||
|
typedef typename SImpl::PropagatorField PropagatorField##suffix;
|
||||||
|
|
||||||
|
#define SOLVER_TYPE_ALIASES(FImpl, suffix)\
|
||||||
|
typedef std::function<void(FermionField##suffix &,\
|
||||||
const FermionField##suffix &)> SolverFn##suffix;
|
const FermionField##suffix &)> SolverFn##suffix;
|
||||||
|
|
||||||
|
#define TYPE_ALIASES(FImpl, suffix)\
|
||||||
|
FERM_TYPE_ALIASES(FImpl, suffix)\
|
||||||
|
GAUGE_TYPE_ALIASES(FImpl, suffix)\
|
||||||
|
SOLVER_TYPE_ALIASES(FImpl, suffix)
|
||||||
|
|
||||||
// logger
|
// logger
|
||||||
class HadronsLogger: public Logger
|
class HadronsLogger: public Logger
|
||||||
{
|
{
|
||||||
|
@ -1,31 +1,3 @@
|
|||||||
/*************************************************************************************
|
|
||||||
|
|
||||||
Grid physics library, www.github.com/paboyle/Grid
|
|
||||||
|
|
||||||
Source file: extras/Hadrons/Modules.hpp
|
|
||||||
|
|
||||||
Copyright (C) 2015
|
|
||||||
Copyright (C) 2016
|
|
||||||
|
|
||||||
Author: Antonin Portelli <antonin.portelli@me.com>
|
|
||||||
|
|
||||||
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 */
|
|
||||||
#include <Grid/Hadrons/Modules/MAction/DWF.hpp>
|
#include <Grid/Hadrons/Modules/MAction/DWF.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MAction/Wilson.hpp>
|
#include <Grid/Hadrons/Modules/MAction/Wilson.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MContraction/Baryon.hpp>
|
#include <Grid/Hadrons/Modules/MContraction/Baryon.hpp>
|
||||||
@ -34,6 +6,8 @@ See the full license in the file "LICENSE" in the top level distribution directo
|
|||||||
#include <Grid/Hadrons/Modules/MGauge/Random.hpp>
|
#include <Grid/Hadrons/Modules/MGauge/Random.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MGauge/StochEm.hpp>
|
#include <Grid/Hadrons/Modules/MGauge/StochEm.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MGauge/Unit.hpp>
|
#include <Grid/Hadrons/Modules/MGauge/Unit.hpp>
|
||||||
|
#include <Grid/Hadrons/Modules/MScalar/ChargedProp.hpp>
|
||||||
|
#include <Grid/Hadrons/Modules/MScalar/FreeProp.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MSolver/RBPrecCG.hpp>
|
#include <Grid/Hadrons/Modules/MSolver/RBPrecCG.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MSource/Point.hpp>
|
#include <Grid/Hadrons/Modules/MSource/Point.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MSource/SeqGamma.hpp>
|
#include <Grid/Hadrons/Modules/MSource/SeqGamma.hpp>
|
||||||
|
40
extras/Hadrons/Modules/MScalar/ChargedProp.cc
Normal file
40
extras/Hadrons/Modules/MScalar/ChargedProp.cc
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#include <Grid/Hadrons/Modules/MScalar/ChargedProp.hpp>
|
||||||
|
|
||||||
|
using namespace Grid;
|
||||||
|
using namespace Hadrons;
|
||||||
|
using namespace MScalar;
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* TChargedProp implementation *
|
||||||
|
******************************************************************************/
|
||||||
|
// constructor /////////////////////////////////////////////////////////////////
|
||||||
|
TChargedProp::TChargedProp(const std::string name)
|
||||||
|
: Module<ChargedPropPar>(name)
|
||||||
|
{}
|
||||||
|
|
||||||
|
// dependencies/products ///////////////////////////////////////////////////////
|
||||||
|
std::vector<std::string> TChargedProp::getInput(void)
|
||||||
|
{
|
||||||
|
std::vector<std::string> in;
|
||||||
|
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> TChargedProp::getOutput(void)
|
||||||
|
{
|
||||||
|
std::vector<std::string> out = {getName()};
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
// setup ///////////////////////////////////////////////////////////////////////
|
||||||
|
void TChargedProp::setup(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// execution ///////////////////////////////////////////////////////////////////
|
||||||
|
void TChargedProp::execute(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
44
extras/Hadrons/Modules/MScalar/ChargedProp.hpp
Normal file
44
extras/Hadrons/Modules/MScalar/ChargedProp.hpp
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#ifndef Hadrons_ChargedProp_hpp_
|
||||||
|
#define Hadrons_ChargedProp_hpp_
|
||||||
|
|
||||||
|
#include <Grid/Hadrons/Global.hpp>
|
||||||
|
#include <Grid/Hadrons/Module.hpp>
|
||||||
|
#include <Grid/Hadrons/ModuleFactory.hpp>
|
||||||
|
|
||||||
|
BEGIN_HADRONS_NAMESPACE
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* ChargedProp *
|
||||||
|
******************************************************************************/
|
||||||
|
BEGIN_MODULE_NAMESPACE(MScalar)
|
||||||
|
|
||||||
|
class ChargedPropPar: Serializable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GRID_SERIALIZABLE_CLASS_MEMBERS(ChargedPropPar,
|
||||||
|
unsigned int, i);
|
||||||
|
};
|
||||||
|
|
||||||
|
class TChargedProp: public Module<ChargedPropPar>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// constructor
|
||||||
|
TChargedProp(const std::string name);
|
||||||
|
// destructor
|
||||||
|
virtual ~TChargedProp(void) = default;
|
||||||
|
// dependency relation
|
||||||
|
virtual std::vector<std::string> getInput(void);
|
||||||
|
virtual std::vector<std::string> getOutput(void);
|
||||||
|
// setup
|
||||||
|
virtual void setup(void);
|
||||||
|
// execution
|
||||||
|
virtual void execute(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
MODULE_REGISTER_NS(ChargedProp, TChargedProp, MScalar);
|
||||||
|
|
||||||
|
END_MODULE_NAMESPACE
|
||||||
|
|
||||||
|
END_HADRONS_NAMESPACE
|
||||||
|
|
||||||
|
#endif // Hadrons_ChargedProp_hpp_
|
57
extras/Hadrons/Modules/MScalar/FreeProp.cc
Normal file
57
extras/Hadrons/Modules/MScalar/FreeProp.cc
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#include <Grid/Hadrons/Modules/MScalar/FreeProp.hpp>
|
||||||
|
|
||||||
|
using namespace Grid;
|
||||||
|
using namespace Hadrons;
|
||||||
|
using namespace MScalar;
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* TFreeProp implementation *
|
||||||
|
******************************************************************************/
|
||||||
|
// constructor /////////////////////////////////////////////////////////////////
|
||||||
|
TFreeProp::TFreeProp(const std::string name)
|
||||||
|
: Module<FreePropPar>(name)
|
||||||
|
{}
|
||||||
|
|
||||||
|
// dependencies/products ///////////////////////////////////////////////////////
|
||||||
|
std::vector<std::string> TFreeProp::getInput(void)
|
||||||
|
{
|
||||||
|
std::vector<std::string> in = {par().source};
|
||||||
|
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> TFreeProp::getOutput(void)
|
||||||
|
{
|
||||||
|
std::vector<std::string> out = {getName()};
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
// setup ///////////////////////////////////////////////////////////////////////
|
||||||
|
void TFreeProp::setup(void)
|
||||||
|
{
|
||||||
|
env().registerLattice<ScalarField>(getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
// execution ///////////////////////////////////////////////////////////////////
|
||||||
|
void TFreeProp::execute(void)
|
||||||
|
{
|
||||||
|
ScalarField &prop = *env().createLattice<ScalarField>(getName());
|
||||||
|
ScalarField &source = *env().getObject<ScalarField>(par().source);
|
||||||
|
ScalarField *momKernel;
|
||||||
|
std::string kerName = "_" + getName() + "_momKernel";
|
||||||
|
|
||||||
|
if (!env().hasCreatedObject(kerName))
|
||||||
|
{
|
||||||
|
LOG(Message) << "Caching momentum space free scalar propagator"
|
||||||
|
<< "(mass= " << par().mass << ")..." << std::endl;
|
||||||
|
momKernel = env().template createLattice<ScalarField>(kerName);
|
||||||
|
Scalar<SIMPL>::MomentumSpacePropagator(*momKernel, par().mass);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
momKernel = env().getObject<ScalarField>(kerName);
|
||||||
|
}
|
||||||
|
LOG(Message) << "Computing free scalar propagator..." << std::endl;
|
||||||
|
Scalar<SIMPL>::FreePropagator(source, prop, *momKernel);
|
||||||
|
}
|
47
extras/Hadrons/Modules/MScalar/FreeProp.hpp
Normal file
47
extras/Hadrons/Modules/MScalar/FreeProp.hpp
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#ifndef Hadrons_FreeProp_hpp_
|
||||||
|
#define Hadrons_FreeProp_hpp_
|
||||||
|
|
||||||
|
#include <Grid/Hadrons/Global.hpp>
|
||||||
|
#include <Grid/Hadrons/Module.hpp>
|
||||||
|
#include <Grid/Hadrons/ModuleFactory.hpp>
|
||||||
|
|
||||||
|
BEGIN_HADRONS_NAMESPACE
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* FreeProp *
|
||||||
|
******************************************************************************/
|
||||||
|
BEGIN_MODULE_NAMESPACE(MScalar)
|
||||||
|
|
||||||
|
class FreePropPar: Serializable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GRID_SERIALIZABLE_CLASS_MEMBERS(FreePropPar,
|
||||||
|
std::string, source,
|
||||||
|
double, mass);
|
||||||
|
};
|
||||||
|
|
||||||
|
class TFreeProp: public Module<FreePropPar>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SCALAR_TYPE_ALIASES(SIMPL,);
|
||||||
|
public:
|
||||||
|
// constructor
|
||||||
|
TFreeProp(const std::string name);
|
||||||
|
// destructor
|
||||||
|
virtual ~TFreeProp(void) = default;
|
||||||
|
// dependency relation
|
||||||
|
virtual std::vector<std::string> getInput(void);
|
||||||
|
virtual std::vector<std::string> getOutput(void);
|
||||||
|
// setup
|
||||||
|
virtual void setup(void);
|
||||||
|
// execution
|
||||||
|
virtual void execute(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
MODULE_REGISTER_NS(FreeProp, TFreeProp, MScalar);
|
||||||
|
|
||||||
|
END_MODULE_NAMESPACE
|
||||||
|
|
||||||
|
END_HADRONS_NAMESPACE
|
||||||
|
|
||||||
|
#endif // Hadrons_FreeProp_hpp_
|
@ -2,7 +2,9 @@ modules_cc =\
|
|||||||
Modules/MGauge/Load.cc \
|
Modules/MGauge/Load.cc \
|
||||||
Modules/MGauge/Random.cc \
|
Modules/MGauge/Random.cc \
|
||||||
Modules/MGauge/StochEm.cc \
|
Modules/MGauge/StochEm.cc \
|
||||||
Modules/MGauge/Unit.cc
|
Modules/MGauge/Unit.cc \
|
||||||
|
Modules/MScalar/ChargedProp.cc \
|
||||||
|
Modules/MScalar/FreeProp.cc
|
||||||
|
|
||||||
modules_hpp =\
|
modules_hpp =\
|
||||||
Modules/MAction/DWF.hpp \
|
Modules/MAction/DWF.hpp \
|
||||||
@ -13,6 +15,8 @@ modules_hpp =\
|
|||||||
Modules/MGauge/Random.hpp \
|
Modules/MGauge/Random.hpp \
|
||||||
Modules/MGauge/StochEm.hpp \
|
Modules/MGauge/StochEm.hpp \
|
||||||
Modules/MGauge/Unit.hpp \
|
Modules/MGauge/Unit.hpp \
|
||||||
|
Modules/MScalar/ChargedProp.hpp \
|
||||||
|
Modules/MScalar/FreeProp.hpp \
|
||||||
Modules/MSolver/RBPrecCG.hpp \
|
Modules/MSolver/RBPrecCG.hpp \
|
||||||
Modules/MSource/Point.hpp \
|
Modules/MSource/Point.hpp \
|
||||||
Modules/MSource/SeqGamma.hpp \
|
Modules/MSource/SeqGamma.hpp \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user