mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-04 14:04:32 +00:00 
			
		
		
		
	Moving hmc observables in a different directory
This commit is contained in:
		@@ -513,6 +513,7 @@ namespace QCD {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <Grid/qcd/hmc/integrators/Integrator.h>
 | 
					#include <Grid/qcd/hmc/integrators/Integrator.h>
 | 
				
			||||||
#include <Grid/qcd/hmc/integrators/Integrator_algorithm.h>
 | 
					#include <Grid/qcd/hmc/integrators/Integrator_algorithm.h>
 | 
				
			||||||
 | 
					#include <Grid/qcd/observables/hmc_observable.h>
 | 
				
			||||||
#include <Grid/qcd/hmc/HMC.h>
 | 
					#include <Grid/qcd/hmc/HMC.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,36 +0,0 @@
 | 
				
			|||||||
    /*************************************************************************************
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    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/Grid.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace Grid{
 | 
					 | 
				
			||||||
  namespace QCD{
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -42,6 +42,8 @@ directory
 | 
				
			|||||||
#include <string>
 | 
					#include <string>
 | 
				
			||||||
#include <list>
 | 
					#include <list>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Grid {
 | 
					namespace Grid {
 | 
				
			||||||
namespace QCD {
 | 
					namespace QCD {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -87,7 +89,7 @@ struct HMCparameters: Serializable {
 | 
				
			|||||||
  
 | 
					  
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
// Move this to a different file
 | 
					// Move this to a different file
 | 
				
			||||||
template <class Field>
 | 
					template <class Field>
 | 
				
			||||||
class HmcObservable {
 | 
					class HmcObservable {
 | 
				
			||||||
@@ -144,7 +146,7 @@ class PlaquetteLogger : public HmcObservable<typename Impl::Field> {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
//////////////////////////////////////////////////////////////
 | 
					//////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template <class IntegratorType>
 | 
					template <class IntegratorType>
 | 
				
			||||||
class HybridMonteCarlo {
 | 
					class HybridMonteCarlo {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										48
									
								
								lib/qcd/observables/hmc_observable.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								lib/qcd/observables/hmc_observable.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
				
			|||||||
 | 
					/*************************************************************************************
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Grid physics library, www.github.com/paboyle/Grid
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Source file: ./lib/qcd/observables/hmc_observable.h
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Copyright (C) 2017
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Author: Guido Cossu <guido.cossu@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_OBSERVABLE_H
 | 
				
			||||||
 | 
					#define HMC_OBSERVABLE_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Grid{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					template <class Field>
 | 
				
			||||||
 | 
					class HmcObservable {
 | 
				
			||||||
 | 
					 public:
 | 
				
			||||||
 | 
					  virtual void TrajectoryComplete(int traj,
 | 
				
			||||||
 | 
					                                  Field &U,
 | 
				
			||||||
 | 
					                                  GridSerialRNG &sRNG,
 | 
				
			||||||
 | 
					                                  GridParallelRNG &pRNG) = 0;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}  // namespace Grid
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "plaquette.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif  //  HMC_OBSERVABLE_H
 | 
				
			||||||
							
								
								
									
										88
									
								
								lib/qcd/observables/plaquette.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										88
									
								
								lib/qcd/observables/plaquette.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,88 @@
 | 
				
			|||||||
 | 
					/*************************************************************************************
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Grid physics library, www.github.com/paboyle/Grid
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Source file: ./lib/qcd/modules/Registration.h
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Copyright (C) 2017
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Author: Guido Cossu <guido.cossu@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_PLAQUETTE_H
 | 
				
			||||||
 | 
					#define HMC_PLAQUETTE_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Grid{
 | 
				
			||||||
 | 
					    namespace QCD{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // this is only defined for a gauge theory
 | 
				
			||||||
 | 
					template <class Impl>
 | 
				
			||||||
 | 
					class PlaquetteLogger : public HmcObservable<typename Impl::Field> {
 | 
				
			||||||
 | 
					 private:
 | 
				
			||||||
 | 
					  std::string Stem;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 public:
 | 
				
			||||||
 | 
					  // here forces the Impl to be of gauge fields
 | 
				
			||||||
 | 
					  // if not the compiler will complain
 | 
				
			||||||
 | 
					  INHERIT_GIMPL_TYPES(Impl);
 | 
				
			||||||
 | 
					  typedef typename Impl::Field Field; // necessary for HmcObservable compatibility
 | 
				
			||||||
 | 
					  PlaquetteLogger(std::string cf) { Stem = cf; };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  void TrajectoryComplete(int traj,
 | 
				
			||||||
 | 
					                          Field &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<Impl>::avgPlaquette(U);
 | 
				
			||||||
 | 
					    RealD impl_rect = WilsonLoops<Impl>::avgRectangle(U);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Fixme reorganise this output
 | 
				
			||||||
 | 
					    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;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					//////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}  // namespace QCD
 | 
				
			||||||
 | 
					}  // namespace Grid
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif  //HMC_PLAQUETTE_H
 | 
				
			||||||
		Reference in New Issue
	
	Block a user