/************************************************************************************* Grid physics library, www.github.com/paboyle/Grid Source file: Hadrons/Modules/MIO/LoadCosmHol.hpp Copyright (C) 2015-2019 Author: Antonin Portelli 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 */ #ifndef Hadrons_MIO_LoadCosmHol_hpp_ #define Hadrons_MIO_LoadCosmHol_hpp_ #include #include #include BEGIN_HADRONS_NAMESPACE /****************************************************************************** * Load scalar SU(N) configurations * ******************************************************************************/ BEGIN_MODULE_NAMESPACE(MIO) class LoadCosmHolPar: Serializable { public: GRID_SERIALIZABLE_CLASS_MEMBERS(LoadCosmHolPar, std::string, file); }; class ScalarActionParameters: Serializable { public: GRID_SERIALIZABLE_CLASS_MEMBERS(ScalarActionParameters, double, mass_squared, double, lambda, double, g); }; template class TLoadCosmHol: public Module { public: typedef typename SImpl::Field Field; public: // constructor TLoadCosmHol(const std::string name); // destructor virtual ~TLoadCosmHol(void) {}; // dependency relation virtual std::vector getInput(void); virtual std::vector getOutput(void); // setup virtual void setup(void); // execution virtual void execute(void); }; MODULE_REGISTER_TMP(LoadCosmHolSU2, TLoadCosmHol>, MIO); MODULE_REGISTER_TMP(LoadCosmHolSU3, TLoadCosmHol>, MIO); MODULE_REGISTER_TMP(LoadCosmHolSU4, TLoadCosmHol>, MIO); MODULE_REGISTER_TMP(LoadCosmHolSU5, TLoadCosmHol>, MIO); MODULE_REGISTER_TMP(LoadCosmHolSU6, TLoadCosmHol>, MIO); /****************************************************************************** * TLoadCosmHol implementation * ******************************************************************************/ // constructor ///////////////////////////////////////////////////////////////// template TLoadCosmHol::TLoadCosmHol(const std::string name) : Module(name) {} // dependencies/products /////////////////////////////////////////////////////// template std::vector TLoadCosmHol::getInput(void) { std::vector in; return in; } template std::vector TLoadCosmHol::getOutput(void) { std::vector out = {getName()}; return out; } // setup /////////////////////////////////////////////////////////////////////// template void TLoadCosmHol::setup(void) { envCreateLat(Field, getName()); } // execution /////////////////////////////////////////////////////////////////// template void TLoadCosmHol::execute(void) { ScalarActionParameters md; std::string filename = par().file + "." + std::to_string(vm().getTrajectory()); ScidacReader reader; const unsigned int N = SImpl::Group::Dimension; auto &phi = envGet(Field, getName()); LOG(Message) << "Loading CosmHol configuration from file '" << filename << "'" << std::endl; reader.open(filename); reader.readScidacFieldRecord(phi, md); reader.close(); LOG(Message) << "tr(phi^2) = " << -TensorRemove(sum(trace(phi*phi))).real()/env().getVolume() << std::endl; LOG(Message) << "Configuration parameters:" << std::endl; LOG(Message) << " N = " << N << std::endl; LOG(Message) << " m^2 = " << md.mass_squared << std::endl; LOG(Message) << "lambda = " << md.lambda << std::endl; LOG(Message) << " g = " << md.g << std::endl; } END_MODULE_NAMESPACE END_HADRONS_NAMESPACE #endif // Hadrons_MIO_LoadCosmHol_hpp_