mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-14 13:57:07 +01:00
Merge branch 'master' of https://github.com/paboyle/Grid into scidac1_2
Conflicts: lib/qcd/action/fermion/WilsonKernels.h
This commit is contained in:
@ -1,21 +1,36 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./lib/qcd/hmc/HMC.cc
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||
Author: neo <cossu@post.kek.jp>
|
||||
Author: paboyle <paboyle@ph.ed.ac.uk>
|
||||
|
||||
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.h>
|
||||
|
||||
namespace Grid{
|
||||
namespace QCD{
|
||||
|
||||
HMCparameters::HMCparameters(){
|
||||
// FIXME fill this constructor now just default values
|
||||
|
||||
////////////////////////////// Default values
|
||||
Nsweeps = 200;
|
||||
TotalSweeps = 240;
|
||||
ThermalizationSteps = 40;
|
||||
StartingConfig = 0;
|
||||
SaveInterval = 1;
|
||||
Filename_prefix = "Conf_";
|
||||
/////////////////////////////////
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,33 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./lib/qcd/hmc/HMC.h
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk>
|
||||
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||
Author: neo <cossu@post.kek.jp>
|
||||
Author: paboyle <paboyle@ph.ed.ac.uk>
|
||||
|
||||
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 */
|
||||
//--------------------------------------------------------------------
|
||||
/*! @file HMC.h
|
||||
* @brief Classes for Hybrid Monte Carlo update
|
||||
@ -17,16 +47,55 @@ namespace Grid{
|
||||
|
||||
|
||||
struct HMCparameters{
|
||||
Integer Nsweeps; /* @brief Number of sweeps in this run */
|
||||
Integer TotalSweeps; /* @brief If provided, the total number of sweeps */
|
||||
Integer ThermalizationSteps;
|
||||
Integer StartingConfig;
|
||||
Integer SaveInterval; //Setting to 0 does not save configurations
|
||||
std::string Filename_prefix; // To save configurations and rng seed
|
||||
|
||||
HMCparameters();
|
||||
|
||||
Integer StartTrajectory;
|
||||
Integer Trajectories; /* @brief Number of sweeps in this run */
|
||||
bool MetropolisTest;
|
||||
Integer NoMetropolisUntil;
|
||||
|
||||
HMCparameters(){
|
||||
////////////////////////////// Default values
|
||||
MetropolisTest = true;
|
||||
NoMetropolisUntil = 10;
|
||||
StartTrajectory = 0;
|
||||
Trajectories = 200;
|
||||
/////////////////////////////////
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<class GaugeField>
|
||||
class HmcObservable {
|
||||
public:
|
||||
virtual void TrajectoryComplete (int traj, GaugeField &U, GridSerialRNG &sRNG, GridParallelRNG & pRNG )=0;
|
||||
};
|
||||
|
||||
template<class Gimpl>
|
||||
class PlaquetteLogger : public HmcObservable<typename Gimpl::GaugeField> {
|
||||
private:
|
||||
std::string Stem;
|
||||
public:
|
||||
INHERIT_GIMPL_TYPES(Gimpl);
|
||||
PlaquetteLogger(std::string cf) {
|
||||
Stem = cf;
|
||||
};
|
||||
|
||||
void TrajectoryComplete(int traj, GaugeField &U, GridSerialRNG &sRNG, GridParallelRNG & pRNG )
|
||||
{
|
||||
std::string file; { std::ostringstream os; os << Stem <<"."<< traj; file = os.str(); }
|
||||
std::ofstream of(file);
|
||||
|
||||
RealD peri_plaq = WilsonLoops<PeriodicGimplR>::avgPlaquette(U);
|
||||
RealD peri_rect = WilsonLoops<PeriodicGimplR>::avgRectangle(U);
|
||||
|
||||
RealD impl_plaq = WilsonLoops<Gimpl>::avgPlaquette(U);
|
||||
RealD impl_rect = WilsonLoops<Gimpl>::avgRectangle(U);
|
||||
|
||||
of << traj<<" "<< impl_plaq << " " << impl_rect << " "<< peri_plaq<<" "<<peri_rect<<std::endl;
|
||||
std::cout<< GridLogMessage<< "traj"<<" "<< "plaq " << " " << " rect " << " "<< "peri_plaq" <<" "<<"peri_rect"<<std::endl;
|
||||
std::cout<< GridLogMessage<< traj<<" "<< impl_plaq << " " << impl_rect << " "<< peri_plaq<<" "<<peri_rect<<std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
// template <class GaugeField, class Integrator, class Smearer, class Boundary>
|
||||
template <class GaugeField, class IntegratorType>
|
||||
class HybridMonteCarlo {
|
||||
@ -34,10 +103,12 @@ namespace Grid{
|
||||
|
||||
const HMCparameters Params;
|
||||
|
||||
GridSerialRNG &sRNG; // Fixme: need a RNG management strategy.
|
||||
GridSerialRNG &sRNG; // Fixme: need a RNG management strategy.
|
||||
GridParallelRNG &pRNG; // Fixme: need a RNG management strategy.
|
||||
GaugeField & Ucur;
|
||||
|
||||
IntegratorType &TheIntegrator;
|
||||
std::vector<HmcObservable<GaugeField> *> Observables;
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// Metropolis step
|
||||
@ -89,38 +160,46 @@ namespace Grid{
|
||||
/////////////////////////////////////////
|
||||
// Constructor
|
||||
/////////////////////////////////////////
|
||||
HybridMonteCarlo(HMCparameters Pms, IntegratorType &_Int, GridSerialRNG &_sRNG, GridParallelRNG &_pRNG ) :
|
||||
HybridMonteCarlo(HMCparameters Pms, IntegratorType &_Int, GridSerialRNG &_sRNG, GridParallelRNG &_pRNG, GaugeField &_U ) :
|
||||
Params(Pms),
|
||||
TheIntegrator(_Int),
|
||||
sRNG(_sRNG),
|
||||
pRNG(_pRNG)
|
||||
pRNG(_pRNG),
|
||||
Ucur(_U)
|
||||
{
|
||||
}
|
||||
~HybridMonteCarlo(){};
|
||||
|
||||
void AddObservable(HmcObservable<GaugeField> *obs) {
|
||||
Observables.push_back(obs);
|
||||
}
|
||||
|
||||
void evolve(GaugeField& Uin){
|
||||
void evolve(void){
|
||||
|
||||
Real DeltaH;
|
||||
|
||||
// Thermalizations
|
||||
for(int iter=1; iter <= Params.ThermalizationSteps; ++iter){
|
||||
std::cout<<GridLogMessage << "-- # Thermalization step = "<< iter << "\n";
|
||||
|
||||
DeltaH = evolve_step(Uin);
|
||||
std::cout<<GridLogMessage<< "dH = "<< DeltaH << "\n";
|
||||
}
|
||||
|
||||
GaugeField Ucopy(Ucur._grid);
|
||||
|
||||
// Actual updates (evolve a copy Ucopy then copy back eventually)
|
||||
GaugeField Ucopy(Uin._grid);
|
||||
for(int iter=Params.StartingConfig; iter < Params.Nsweeps+Params.StartingConfig; ++iter){
|
||||
std::cout<<GridLogMessage << "-- # Sweep = "<< iter << "\n";
|
||||
|
||||
Ucopy = Uin;
|
||||
for(int traj=Params.StartTrajectory; traj < Params.Trajectories+Params.StartTrajectory; ++traj){
|
||||
|
||||
std::cout<<GridLogMessage << "-- # Trajectory = "<< traj << "\n";
|
||||
Ucopy = Ucur;
|
||||
|
||||
DeltaH = evolve_step(Ucopy);
|
||||
|
||||
if(metropolis_test(DeltaH)) Uin = Ucopy;
|
||||
|
||||
bool accept = true;
|
||||
if ( traj > Params.NoMetropolisUntil) {
|
||||
accept = metropolis_test(DeltaH);
|
||||
}
|
||||
|
||||
if ( accept ) {
|
||||
Ucur = Ucopy;
|
||||
}
|
||||
|
||||
for(int obs = 0;obs<Observables.size();obs++){
|
||||
Observables[obs]->TrajectoryComplete (traj+1,Ucur,sRNG,pRNG);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
156
lib/qcd/hmc/HmcRunner.h
Normal file
156
lib/qcd/hmc/HmcRunner.h
Normal file
@ -0,0 +1,156 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./lib/qcd/hmc/HmcRunner.h
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: paboyle <paboyle@ph.ed.ac.uk>
|
||||
|
||||
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 HMC_RUNNER
|
||||
#define HMC_RUNNER
|
||||
|
||||
namespace Grid{
|
||||
namespace QCD{
|
||||
|
||||
|
||||
template<class Gimpl>
|
||||
class NerscHmcRunnerTemplate {
|
||||
public:
|
||||
|
||||
INHERIT_GIMPL_TYPES(Gimpl);
|
||||
|
||||
enum StartType_t { ColdStart, HotStart, TepidStart, CheckpointStart };
|
||||
|
||||
ActionSet<GaugeField> TheAction;
|
||||
|
||||
GridCartesian * UGrid ;
|
||||
GridCartesian * FGrid ;
|
||||
GridRedBlackCartesian * UrbGrid ;
|
||||
GridRedBlackCartesian * FrbGrid ;
|
||||
|
||||
virtual void BuildTheAction (int argc, char **argv) = 0;
|
||||
|
||||
|
||||
void Run (int argc, char **argv){
|
||||
|
||||
StartType_t StartType = HotStart;
|
||||
|
||||
std::string arg;
|
||||
|
||||
if( GridCmdOptionExists(argv,argv+argc,"--StartType") ){
|
||||
arg = GridCmdOptionPayload(argv,argv+argc,"--StartType");
|
||||
if ( arg == "HotStart" ) { StartType = HotStart; }
|
||||
else if ( arg == "ColdStart" ) { StartType = ColdStart; }
|
||||
else if ( arg == "TepidStart" ) { StartType = TepidStart; }
|
||||
else if ( arg == "CheckpointStart" ) { StartType = CheckpointStart; }
|
||||
else assert(0);
|
||||
}
|
||||
|
||||
int StartTraj = 0;
|
||||
if( GridCmdOptionExists(argv,argv+argc,"--StartTrajectory") ){
|
||||
arg= GridCmdOptionPayload(argv,argv+argc,"--StartTrajectory");
|
||||
std::vector<int> ivec(0);
|
||||
GridCmdOptionIntVector(arg,ivec);
|
||||
StartTraj = ivec[0];
|
||||
}
|
||||
|
||||
int NumTraj = 1;
|
||||
if( GridCmdOptionExists(argv,argv+argc,"--Trajectories") ){
|
||||
arg= GridCmdOptionPayload(argv,argv+argc,"--Trajectories");
|
||||
std::vector<int> ivec(0);
|
||||
GridCmdOptionIntVector(arg,ivec);
|
||||
NumTraj = ivec[0];
|
||||
}
|
||||
|
||||
// Create integrator
|
||||
typedef MinimumNorm2<GaugeField> IntegratorType;// change here to change the algorithm
|
||||
IntegratorParameters MDpar(20);
|
||||
IntegratorType MDynamics(UGrid,MDpar, TheAction);
|
||||
|
||||
// Checkpoint strategy
|
||||
NerscHmcCheckpointer<Gimpl> Checkpoint(std::string("ckpoint_lat"),std::string("ckpoint_rng"),1);
|
||||
PlaquetteLogger<Gimpl> PlaqLog(std::string("plaq"));
|
||||
|
||||
HMCparameters HMCpar;
|
||||
HMCpar.StartTrajectory = StartTraj;
|
||||
HMCpar.Trajectories = NumTraj;
|
||||
|
||||
GridSerialRNG sRNG;
|
||||
GridParallelRNG pRNG(UGrid);
|
||||
LatticeGaugeField U(UGrid);
|
||||
|
||||
std::vector<int> SerSeed({1,2,3,4,5});
|
||||
std::vector<int> ParSeed({6,7,8,9,10});
|
||||
|
||||
if ( StartType == HotStart ) {
|
||||
// Hot start
|
||||
HMCpar.NoMetropolisUntil =0;
|
||||
HMCpar.MetropolisTest = true;
|
||||
sRNG.SeedFixedIntegers(SerSeed);
|
||||
pRNG.SeedFixedIntegers(ParSeed);
|
||||
SU3::HotConfiguration(pRNG, U);
|
||||
} else if ( StartType == ColdStart ) {
|
||||
// Cold start
|
||||
HMCpar.NoMetropolisUntil =0;
|
||||
HMCpar.MetropolisTest = true;
|
||||
sRNG.SeedFixedIntegers(SerSeed);
|
||||
pRNG.SeedFixedIntegers(ParSeed);
|
||||
SU3::ColdConfiguration(pRNG, U);
|
||||
} else if ( StartType == TepidStart ) {
|
||||
// Tepid start
|
||||
HMCpar.NoMetropolisUntil =0;
|
||||
HMCpar.MetropolisTest = true;
|
||||
sRNG.SeedFixedIntegers(SerSeed);
|
||||
pRNG.SeedFixedIntegers(ParSeed);
|
||||
SU3::TepidConfiguration(pRNG, U);
|
||||
} else if ( StartType == CheckpointStart ) {
|
||||
HMCpar.NoMetropolisUntil =0;
|
||||
HMCpar.MetropolisTest = true;
|
||||
// CheckpointRestart
|
||||
Checkpoint.CheckpointRestore(StartTraj, U, sRNG, pRNG);
|
||||
}
|
||||
|
||||
HybridMonteCarlo<GaugeField,IntegratorType> HMC(HMCpar, MDynamics,sRNG,pRNG,U);
|
||||
HMC.AddObservable(&Checkpoint);
|
||||
HMC.AddObservable(&PlaqLog);
|
||||
|
||||
// Run it
|
||||
HMC.evolve();
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
typedef NerscHmcRunnerTemplate<PeriodicGimplR> NerscHmcRunner;
|
||||
typedef NerscHmcRunnerTemplate<PeriodicGimplF> NerscHmcRunnerF;
|
||||
typedef NerscHmcRunnerTemplate<PeriodicGimplD> NerscHmcRunnerD;
|
||||
|
||||
typedef NerscHmcRunnerTemplate<PeriodicGimplR> PeriodicNerscHmcRunner;
|
||||
typedef NerscHmcRunnerTemplate<PeriodicGimplF> PeriodicNerscHmcRunnerF;
|
||||
typedef NerscHmcRunnerTemplate<PeriodicGimplD> PeriodicNerscHmcRunnerD;
|
||||
|
||||
typedef NerscHmcRunnerTemplate<ConjugateGimplR> ConjugateNerscHmcRunner;
|
||||
typedef NerscHmcRunnerTemplate<ConjugateGimplF> ConjugateNerscHmcRunnerF;
|
||||
typedef NerscHmcRunnerTemplate<ConjugateGimplD> ConjugateNerscHmcRunnerD;
|
||||
|
||||
}}
|
||||
#endif
|
80
lib/qcd/hmc/NerscCheckpointer.h
Normal file
80
lib/qcd/hmc/NerscCheckpointer.h
Normal file
@ -0,0 +1,80 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./lib/qcd/hmc/NerscCheckpointer.h
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: paboyle <paboyle@ph.ed.ac.uk>
|
||||
|
||||
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 NERSC_CHECKPOINTER
|
||||
#define NERSC_CHECKPOINTER
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
namespace Grid{
|
||||
namespace QCD{
|
||||
|
||||
|
||||
template<class Gimpl>
|
||||
class NerscHmcCheckpointer : public HmcObservable<typename Gimpl::GaugeField> {
|
||||
private:
|
||||
std::string configStem;
|
||||
std::string rngStem;
|
||||
int SaveInterval;
|
||||
public:
|
||||
INHERIT_GIMPL_TYPES(Gimpl);
|
||||
|
||||
NerscHmcCheckpointer(std::string cf, std::string rn,int savemodulo) {
|
||||
configStem = cf;
|
||||
rngStem = rn;
|
||||
SaveInterval= savemodulo;
|
||||
};
|
||||
|
||||
void TrajectoryComplete(int traj, GaugeField &U, GridSerialRNG &sRNG, GridParallelRNG & pRNG )
|
||||
{
|
||||
if ( (traj % SaveInterval)== 0 ) {
|
||||
std::string rng; { std::ostringstream os; os << rngStem <<"."<< traj; rng = os.str(); }
|
||||
std::string config;{ std::ostringstream os; os << configStem <<"."<< traj; config = os.str();}
|
||||
|
||||
int precision32=1;
|
||||
int tworow =0;
|
||||
NerscIO::writeRNGState(sRNG,pRNG,rng);
|
||||
NerscIO::writeConfiguration(U,config,tworow,precision32);
|
||||
}
|
||||
};
|
||||
|
||||
void CheckpointRestore(int traj, GaugeField &U, GridSerialRNG &sRNG, GridParallelRNG & pRNG ){
|
||||
|
||||
std::string rng; { std::ostringstream os; os << rngStem <<"."<< traj; rng = os.str(); }
|
||||
std::string config;{ std::ostringstream os; os << configStem <<"."<< traj; config = os.str();}
|
||||
|
||||
NerscField header;
|
||||
NerscIO::readRNGState(sRNG,pRNG,header,rng);
|
||||
NerscIO::readConfiguration(U,header,config);
|
||||
};
|
||||
|
||||
};
|
||||
}}
|
||||
#endif
|
@ -1,3 +1,33 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./lib/qcd/hmc/integrators/Integrator.h
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk>
|
||||
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||
Author: neo <cossu@post.kek.jp>
|
||||
Author: paboyle <paboyle@ph.ed.ac.uk>
|
||||
|
||||
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 */
|
||||
//--------------------------------------------------------------------
|
||||
/*! @file Integrator.h
|
||||
* @brief Classes for the Molecular Dynamics integrator
|
||||
@ -77,9 +107,7 @@ namespace Grid{
|
||||
t_P[level]+=ep;
|
||||
update_P(P,U,level,ep);
|
||||
|
||||
std::cout<<GridLogMessage;
|
||||
for(int l=0; l<level;++l) std::cout<<" ";
|
||||
std::cout<<"["<<level<<"] P " << " dt "<< ep <<" : t_P "<< t_P[level] <<std::endl;
|
||||
std::cout<<GridLogIntegrator<<"["<<level<<"] P " << " dt "<< ep <<" : t_P "<< t_P[level] <<std::endl;
|
||||
}
|
||||
|
||||
void update_P(GaugeField &Mom,GaugeField&U, int level,double ep){
|
||||
@ -95,9 +123,7 @@ namespace Grid{
|
||||
|
||||
t_U+=ep;
|
||||
int fl = levels-1;
|
||||
std::cout<<GridLogMessage<<" ";
|
||||
for(int l=0; l<fl;++l) std::cout<<" ";
|
||||
std::cout<<"["<<fl<<"] U " << " dt "<< ep <<" : t_U "<< t_U <<std::endl;
|
||||
std::cout<<GridLogIntegrator<<" "<<"["<<fl<<"] U " << " dt "<< ep <<" : t_U "<< t_U <<std::endl;
|
||||
|
||||
}
|
||||
void update_U(GaugeField &Mom, GaugeField&U, double ep){
|
||||
@ -133,7 +159,7 @@ namespace Grid{
|
||||
|
||||
//Initialization of momenta and actions
|
||||
void refresh(GaugeField& U,GridParallelRNG &pRNG){
|
||||
std::cout<<GridLogMessage<< "Integrator refresh\n";
|
||||
std::cout<<GridLogIntegrator<< "Integrator refresh\n";
|
||||
generate_momenta(P,pRNG);
|
||||
for(int level=0; level< as.size(); ++level){
|
||||
for(int actionID=0; actionID<as[level].actions.size(); ++actionID){
|
||||
@ -165,7 +191,6 @@ namespace Grid{
|
||||
H += Hterm;
|
||||
}
|
||||
}
|
||||
std::cout<<GridLogMessage << "Total action H = "<< H << "\n";
|
||||
|
||||
return H;
|
||||
}
|
||||
@ -187,7 +212,7 @@ namespace Grid{
|
||||
// Check the clocks all match on all levels
|
||||
for(int level=0; level<as.size(); ++level){
|
||||
assert(fabs(t_U - t_P[level])<1.0e-6); // must be the same
|
||||
std::cout<<GridLogMessage<<" times["<<level<<"]= "<<t_P[level]<< " " << t_U <<std::endl;
|
||||
std::cout<<GridLogIntegrator<<" times["<<level<<"]= "<<t_P[level]<< " " << t_U <<std::endl;
|
||||
}
|
||||
|
||||
// and that we indeed got to the end of the trajectory
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./lib/qcd/hmc/integrators/Integrator_algorithm.h
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||
Author: neo <cossu@post.kek.jp>
|
||||
|
||||
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 */
|
||||
//--------------------------------------------------------------------
|
||||
/*! @file Integrator_algorithm.h
|
||||
* @brief Declaration of classes for the Molecular Dynamics algorithms
|
||||
|
Reference in New Issue
Block a user