mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-09 21:50:45 +01:00
Hadrons: random and NERSC gauge configurations
This commit is contained in:
parent
02ec23cdad
commit
8b313a35ac
@ -171,6 +171,7 @@ void Application::configLoop(void)
|
|||||||
{
|
{
|
||||||
LOG(Message) << "Starting measurement for trajectory " << t
|
LOG(Message) << "Starting measurement for trajectory " << t
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
env_.setTrajectory(t);
|
||||||
execute(program_);
|
execute(program_);
|
||||||
env_.freeAll();
|
env_.freeAll();
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,17 @@ bool Environment::isDryRun(void) const
|
|||||||
return dryRun_;
|
return dryRun_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// trajectory number ///////////////////////////////////////////////////////////
|
||||||
|
void Environment::setTrajectory(const unsigned int traj)
|
||||||
|
{
|
||||||
|
traj_ = traj;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int Environment::getTrajectory(void) const
|
||||||
|
{
|
||||||
|
return traj_;
|
||||||
|
}
|
||||||
|
|
||||||
// grids ///////////////////////////////////////////////////////////////////////
|
// grids ///////////////////////////////////////////////////////////////////////
|
||||||
GridCartesian * Environment::getGrid(const unsigned int Ls) const
|
GridCartesian * Environment::getGrid(const unsigned int Ls) const
|
||||||
{
|
{
|
||||||
|
@ -52,6 +52,9 @@ public:
|
|||||||
// dry run
|
// dry run
|
||||||
void dryRun(const bool isDry);
|
void dryRun(const bool isDry);
|
||||||
bool isDryRun(void) const;
|
bool isDryRun(void) const;
|
||||||
|
// trajectory number
|
||||||
|
void setTrajectory(const unsigned int traj);
|
||||||
|
unsigned int getTrajectory(void) const;
|
||||||
// grids
|
// grids
|
||||||
GridCartesian * getGrid(const unsigned int Ls = 1) const;
|
GridCartesian * getGrid(const unsigned int Ls = 1) const;
|
||||||
GridRedBlackCartesian * getRbGrid(const unsigned int Ls = 1) const;
|
GridRedBlackCartesian * getRbGrid(const unsigned int Ls = 1) const;
|
||||||
@ -86,6 +89,7 @@ public:
|
|||||||
void freeAll(void);
|
void freeAll(void);
|
||||||
private:
|
private:
|
||||||
bool dryRun_{false};
|
bool dryRun_{false};
|
||||||
|
unsigned int traj_;
|
||||||
GridPt grid4d_;
|
GridPt grid4d_;
|
||||||
std::map<unsigned int, GridPt> grid5d_;
|
std::map<unsigned int, GridPt> grid5d_;
|
||||||
GridRbPt gridRb4d_;
|
GridRbPt gridRb4d_;
|
||||||
|
77
programs/Hadrons/GLoad.cc
Normal file
77
programs/Hadrons/GLoad.cc
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
|
Source file: programs/Hadrons/GLoad.cc
|
||||||
|
|
||||||
|
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.
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <Hadrons/GLoad.hpp>
|
||||||
|
|
||||||
|
using namespace Grid;
|
||||||
|
using namespace Hadrons;
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* GLoad implementation *
|
||||||
|
******************************************************************************/
|
||||||
|
// constructor /////////////////////////////////////////////////////////////////
|
||||||
|
GLoad::GLoad(const std::string name)
|
||||||
|
: Module(name)
|
||||||
|
{}
|
||||||
|
|
||||||
|
// parse parameters ////////////////////////////////////////////////////////////
|
||||||
|
void GLoad::parseParameters(XmlReader &reader, const std::string name)
|
||||||
|
{
|
||||||
|
read(reader, name, par_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// dependencies/products ///////////////////////////////////////////////////////
|
||||||
|
std::vector<std::string> GLoad::getInput(void)
|
||||||
|
{
|
||||||
|
std::vector<std::string> in;
|
||||||
|
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> GLoad::getOutput(void)
|
||||||
|
{
|
||||||
|
std::vector<std::string> out = {getName()};
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
// allocation //////////////////////////////////////////////////////////////////
|
||||||
|
void GLoad::allocate(Environment &env)
|
||||||
|
{
|
||||||
|
env.createGauge(getName());
|
||||||
|
gauge_ = env.getGauge(getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
// execution ///////////////////////////////////////////////////////////////////
|
||||||
|
void GLoad::execute(Environment &env)
|
||||||
|
{
|
||||||
|
NerscField header;
|
||||||
|
std::string fileName = par_.file + "."
|
||||||
|
+ std::to_string(env.getTrajectory());
|
||||||
|
|
||||||
|
NerscIO::readConfiguration(*gauge_, header, fileName);
|
||||||
|
}
|
71
programs/Hadrons/GLoad.hpp
Normal file
71
programs/Hadrons/GLoad.hpp
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
|
Source file: programs/Hadrons/GLoad.hpp
|
||||||
|
|
||||||
|
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.
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef Hadrons_GLoad_hpp_
|
||||||
|
#define Hadrons_GLoad_hpp_
|
||||||
|
|
||||||
|
#include <Hadrons/Global.hpp>
|
||||||
|
#include <Hadrons/Module.hpp>
|
||||||
|
#include <Hadrons/ModuleFactory.hpp>
|
||||||
|
|
||||||
|
BEGIN_HADRONS_NAMESPACE
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* Load a NERSC configuration *
|
||||||
|
******************************************************************************/
|
||||||
|
class GLoad: public Module
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
class Par: Serializable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GRID_SERIALIZABLE_CLASS_MEMBERS(Par, std::string, file);
|
||||||
|
};
|
||||||
|
public:
|
||||||
|
// constructor
|
||||||
|
GLoad(const std::string name);
|
||||||
|
// destructor
|
||||||
|
virtual ~GLoad(void) = default;
|
||||||
|
// parse parameters
|
||||||
|
virtual void parseParameters(XmlReader &reader, const std::string name);
|
||||||
|
// dependency relation
|
||||||
|
virtual std::vector<std::string> getInput(void);
|
||||||
|
virtual std::vector<std::string> getOutput(void);
|
||||||
|
// allocation
|
||||||
|
virtual void allocate(Environment &env);
|
||||||
|
// execution
|
||||||
|
virtual void execute(Environment &env);
|
||||||
|
private:
|
||||||
|
Par par_;
|
||||||
|
LatticeGaugeField *gauge_ = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
MODULE_REGISTER(GLoad);
|
||||||
|
|
||||||
|
END_HADRONS_NAMESPACE
|
||||||
|
|
||||||
|
#endif // Hadrons_GLoad_hpp_
|
65
programs/Hadrons/GRandom.cc
Normal file
65
programs/Hadrons/GRandom.cc
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
|
Source file: programs/Hadrons/GRandom.cc
|
||||||
|
|
||||||
|
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.
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <Hadrons/GRandom.hpp>
|
||||||
|
|
||||||
|
using namespace Grid;
|
||||||
|
using namespace Hadrons;
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* GRandom implementation *
|
||||||
|
******************************************************************************/
|
||||||
|
// constructor /////////////////////////////////////////////////////////////////
|
||||||
|
GRandom::GRandom(const std::string name)
|
||||||
|
: Module(name)
|
||||||
|
{}
|
||||||
|
|
||||||
|
// dependencies/products ///////////////////////////////////////////////////////
|
||||||
|
std::vector<std::string> GRandom::getInput(void)
|
||||||
|
{
|
||||||
|
return std::vector<std::string>();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> GRandom::getOutput(void)
|
||||||
|
{
|
||||||
|
std::vector<std::string> out = {getName()};
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
// allocation //////////////////////////////////////////////////////////////////
|
||||||
|
void GRandom::allocate(Environment &env)
|
||||||
|
{
|
||||||
|
env.createGauge(getName());
|
||||||
|
gauge_ = env.getGauge(getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
// execution ///////////////////////////////////////////////////////////////////
|
||||||
|
void GRandom::execute(Environment &env)
|
||||||
|
{
|
||||||
|
SU3::HotConfiguration(*env.get4dRng(), *gauge_);
|
||||||
|
}
|
62
programs/Hadrons/GRandom.hpp
Normal file
62
programs/Hadrons/GRandom.hpp
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
|
Source file: programs/Hadrons/GRandom.hpp
|
||||||
|
|
||||||
|
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.
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef Hadrons_GRandom_hpp_
|
||||||
|
#define Hadrons_GRandom_hpp_
|
||||||
|
|
||||||
|
#include <Hadrons/Global.hpp>
|
||||||
|
#include <Hadrons/Module.hpp>
|
||||||
|
#include <Hadrons/ModuleFactory.hpp>
|
||||||
|
|
||||||
|
BEGIN_HADRONS_NAMESPACE
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* Random gauge *
|
||||||
|
******************************************************************************/
|
||||||
|
class GRandom: public Module
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// constructor
|
||||||
|
GRandom(const std::string name);
|
||||||
|
// destructor
|
||||||
|
virtual ~GRandom(void) = default;
|
||||||
|
// dependency relation
|
||||||
|
virtual std::vector<std::string> getInput(void);
|
||||||
|
virtual std::vector<std::string> getOutput(void);
|
||||||
|
// allocation
|
||||||
|
virtual void allocate(Environment &env);
|
||||||
|
// execution
|
||||||
|
virtual void execute(Environment &env);
|
||||||
|
private:
|
||||||
|
LatticeGaugeField *gauge_ = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
MODULE_REGISTER(GRandom);
|
||||||
|
|
||||||
|
END_HADRONS_NAMESPACE
|
||||||
|
|
||||||
|
#endif // Hadrons_GRandom_hpp_
|
@ -26,6 +26,8 @@ Hadrons_SOURCES += \
|
|||||||
|
|
||||||
# gauge modules
|
# gauge modules
|
||||||
Hadrons_SOURCES += \
|
Hadrons_SOURCES += \
|
||||||
|
GLoad.cc \
|
||||||
|
GRandom.cc \
|
||||||
GUnit.cc
|
GUnit.cc
|
||||||
|
|
||||||
# solver modules
|
# solver modules
|
||||||
|
Loading…
x
Reference in New Issue
Block a user