/************************************************************************************* Grid physics library, www.github.com/paboyle/Grid Source file: ./lib/qcd/hmc/integrators/Integrator.h Copyright (C) 2015 Author: Azusa Yamaguchi Author: Peter Boyle Author: neo Author: paboyle 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 * * @author Guido Cossu * Time-stamp: <2015-07-30 16:21:29 neo> */ //-------------------------------------------------------------------- #ifndef INTEGRATOR_INCLUDED #define INTEGRATOR_INCLUDED //class Observer; #include namespace Grid{ namespace QCD{ struct IntegratorParameters{ int Nexp; int MDsteps; // number of outer steps RealD trajL; // trajectory length RealD stepsize; IntegratorParameters(int MDsteps_, RealD trajL_=1.0, int Nexp_=12): Nexp(Nexp_), MDsteps(MDsteps_), trajL(trajL_), stepsize(trajL/MDsteps) { // empty body constructor }; }; /*! @brief Class for Molecular Dynamics management */ template class Integrator { protected: typedef IntegratorParameters ParameterType; IntegratorParameters Params; const ActionSet as; int levels; // double t_U; // Track time passing on each level and for U and for P std::vector t_P; // GaugeField P; // Should match any legal (SU(n)) gauge field // Need to use this template to match Ncol to pass to SU class template void generate_momenta(Lattice< iVector< iScalar< iMatrix >, Nd> > & P,GridParallelRNG& pRNG){ typedef Lattice< iScalar< iScalar< iMatrix > > > GaugeLinkField; GaugeLinkField Pmu(P._grid); Pmu = zero; for(int mu=0;mu::GaussianLieAlgebraMatrix(pRNG, Pmu); PokeIndex(P, Pmu, mu); } } //ObserverList observers; // not yet // typedef std::vector ObserverList; // void register_observers(); // void notify_observers(); void update_P(GaugeField&U, int level,double ep){ t_P[level]+=ep; update_P(P,U,level,ep); std::cout<deriv(U,force); Mom = Mom - force*ep; } } void update_U(GaugeField&U, double ep){ update_U(P,U,ep); t_U+=ep; int fl = levels-1; std::cout<(U, mu); auto Pmu=PeekIndex(Mom, mu); Umu = expMat(Pmu, ep, Params.Nexp)*Umu; ProjectOnGroup(Umu); PokeIndex(U, Umu, mu); } } virtual void step (GaugeField& U,int level, int first,int last)=0; public: Integrator(GridBase* grid, IntegratorParameters Par, ActionSet & Aset): Params(Par), as(Aset), P(grid), levels(Aset.size()) { t_P.resize(levels,0.0); t_U=0.0; }; virtual ~Integrator(){} //Initialization of momenta and actions void refresh(GaugeField& U,GridParallelRNG &pRNG){ std::cout<refresh(U, pRNG); } } } // Calculate action RealD S(GaugeField& U){ LatticeComplex Hloc(U._grid); Hloc = zero; // Momenta for (int mu=0; mu (P, mu); Hloc -= trace(Pmu*Pmu); } Complex Hsum = sum(Hloc); RealD H = Hsum.real(); RealD Hterm; std::cout<S(U); std::cout<