From 97afe4125f6152622ffd045add3b100a9439694b Mon Sep 17 00:00:00 2001 From: neo Date: Tue, 7 Jul 2015 14:59:37 +0900 Subject: [PATCH] Cleaning up files for HMC --- lib/qcd/hmc/HMC.h | 19 +++++++++---------- lib/qcd/hmc/integrators/Integrator.h | 27 ++++++++++++++------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lib/qcd/hmc/HMC.h b/lib/qcd/hmc/HMC.h index c0f06b64..2da8dd0f 100644 --- a/lib/qcd/hmc/HMC.h +++ b/lib/qcd/hmc/HMC.h @@ -1,15 +1,16 @@ //-------------------------------------------------------------------- /*! @file HMC.h - * @brief Declaration of classes for Hybrid Monte Carlo update + * @brief Classes for Hybrid Monte Carlo update * * @author Guido Cossu + * Time-stamp: <2015-07-07 14:58:13 neo> */ //-------------------------------------------------------------------- #ifndef HMC_INCLUDED #define HMC_INCLUDED #include -#include + namespace Grid{ namespace QCD{ @@ -20,7 +21,7 @@ namespace Grid{ Integer ThermalizationSteps; Integer StartingConfig; Integer SaveInterval; //Setting to 0 does not save configurations - std::string Filename_prefix; // To save configurations + std::string Filename_prefix; // To save configurations and rng seed HMCparameters(); }; @@ -49,8 +50,7 @@ namespace Grid{ } } - RealD evolve_step(LatticeLorentzColourMatrix& U){ - + RealD evolve_step(LatticeGaugeField& U){ MD.init(U); // set U and initialize P and phi's RealD H0 = MD.S(U); // initial state action std::cout<<"Total H before = "<< H0 << "\n"; @@ -74,9 +74,7 @@ namespace Grid{ } ~HybridMonteCarlo(){}; - - - void evolve(LatticeLorentzColourMatrix& Uin){ + void evolve(LatticeGaugeField& Uin){ Real DeltaH; // Thermalizations @@ -88,7 +86,7 @@ namespace Grid{ } // Actual updates (evolve a copy Ucopy then copy back eventually) - LatticeLorentzColourMatrix Ucopy(Uin._grid); + LatticeGaugeField Ucopy(Uin._grid); for(int iter=Params.StartingConfig; iter < Params.Nsweeps+Params.StartingConfig; ++iter){ std::cout << "-- # Sweep = "<< iter << "\n"; @@ -97,7 +95,8 @@ namespace Grid{ DeltaH = evolve_step(Ucopy); if(metropolis_test(DeltaH)) Uin = Ucopy; - //need sync? + + // here save config and RNG seed } } }; diff --git a/lib/qcd/hmc/integrators/Integrator.h b/lib/qcd/hmc/integrators/Integrator.h index 522991ac..f752baab 100644 --- a/lib/qcd/hmc/integrators/Integrator.h +++ b/lib/qcd/hmc/integrators/Integrator.h @@ -1,8 +1,9 @@ //-------------------------------------------------------------------- /*! @file Integrator.h - * @brief Declaration of classes for the Molecular Dynamics integrator + * @brief Classes for the Molecular Dynamics integrator * * @author Guido Cossu + * Time-stamp: <2015-07-07 14:58:40 neo> */ //-------------------------------------------------------------------- @@ -16,7 +17,7 @@ class Observer; namespace Grid{ namespace QCD{ - typedef Action* ActPtr; // now force the same colours as the rest of the code + typedef Action* ActPtr; // now force the same colours as the rest of the code struct ActionLevel{ int multiplier; public: @@ -43,8 +44,8 @@ namespace Grid{ namespace MDutils{ - void generate_momenta(LatticeLorentzColourMatrix&,GridParallelRNG&); - void generate_momenta_su3(LatticeLorentzColourMatrix&,GridParallelRNG&); + void generate_momenta(LatticeGaugeField&,GridParallelRNG&); + void generate_momenta_su3(LatticeGaugeField&,GridParallelRNG&); } /*! @brief Class for Molecular Dynamics management */ @@ -53,7 +54,7 @@ namespace Grid{ private: IntegratorParameters Params; const ActionSet as; - std::unique_ptr P; + std::unique_ptr P; GridParallelRNG pRNG; //ObserverList observers; // not yet @@ -62,16 +63,16 @@ namespace Grid{ void register_observers(); void notify_observers(); - void update_P(LatticeLorentzColourMatrix&U, int level,double ep){ + void update_P(LatticeGaugeField&U, int level,double ep){ for(int a=0; aderiv(U,force); *P -= force*ep; } } - void update_U(LatticeLorentzColourMatrix&U, double ep){ + void update_U(LatticeGaugeField&U, double ep){ //rewrite exponential to deal automatically with the lorentz index? LatticeColourMatrix Umu(U._grid); LatticeColourMatrix Pmu(U._grid); @@ -86,13 +87,13 @@ namespace Grid{ - friend void IntegratorAlgorithm::step (LatticeLorentzColourMatrix& U, + friend void IntegratorAlgorithm::step (LatticeGaugeField& U, int level, std::vector& clock, Integrator* Integ); public: Integrator(GridBase* grid, IntegratorParameters Par, ActionSet& Aset): - Params(Par),as(Aset),P(new LatticeLorentzColourMatrix(grid)),pRNG(grid){ + Params(Par),as(Aset),P(new LatticeGaugeField(grid)),pRNG(grid){ pRNG.SeedRandomDevice(); }; @@ -100,7 +101,7 @@ namespace Grid{ //Initialization of momenta and actions - void init(LatticeLorentzColourMatrix& U){ + void init(LatticeGaugeField& U){ std::cout<< "Integrator init\n"; MDutils::generate_momenta(*P,pRNG); @@ -113,7 +114,7 @@ namespace Grid{ // Calculate action - RealD S(LatticeLorentzColourMatrix& U){ + RealD S(LatticeGaugeField& U){ LatticeComplex Hloc(U._grid); Hloc = zero; // Momenta @@ -135,7 +136,7 @@ namespace Grid{ return H; } - void integrate(LatticeLorentzColourMatrix& U){ + void integrate(LatticeGaugeField& U){ std::vector clock; clock.resize(as.size(),0); for(int step=0; step< Params.MDsteps; ++step) // MD step