//-------------------------------------------------------------------- /*! @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<