GLAC  1.0
system.h
Go to the documentation of this file.
1 
13 #ifndef SYSTEM_H
14 #define SYSTEM_H
15 
16 #include <random>
17 #include <chrono>
18 #include "actions/actions.h"
21 #include "math/lattice.h"
22 #include "flow/flow.h"
23 
24 using std::chrono::steady_clock;
25 using std::chrono::duration;
26 
27 class Action;
28 
29 class System
30 {
31 private:
35  // Lattice sizes
36  std::vector<unsigned int> m_N;
37  unsigned int m_latticeSize;
38  // Updating constants
39  unsigned int m_NCf;
40  unsigned int m_NCor;
41  unsigned int m_NTherm;
42  unsigned int m_NUpdates; // N updates before calculating the action, as that is costly
43  unsigned int m_NFlows;
44  // Variable for storing the thermalization observables
45  bool m_storeThermalizationObservables = false;
46  bool m_systemIsThermalized = false;
47  bool m_writeConfigsToFile = false;
48  // Paralellization setup
49  int m_processRank; // Move to communicator/printer...?
50  unsigned int m_subLatticeSize;
51 
55  // Variable for storing how many steps we are shifting in the observables storage array if we choose to store the thermalization variables
56  unsigned int m_NThermSteps = 0;
57 
58  // For handling the acceptance rate
59  unsigned long long int m_acceptanceCounter = 0;
60  double m_acceptanceScore = 0;
61  double getAcceptanceRate();
62 
63  // Function for initializing the sub lattice.
64  void subLatticeSetup();
65 
66  // Lattice variables
67  Lattice<SU3> * m_lattice;
68  SU3 m_updatedMatrix;
69 
70  // Time counting
71  steady_clock::time_point m_preUpdate;
72  duration<double> m_updateTime;
73  double m_updateStorer = 0;
74  double m_updateStorerTherm = 0;
75 
76  // Function for choosing and setting the correlators/observables
77  void setObservable(std::vector<std::string> obsList, bool flow);
78 
79  // Storing the action as a pointer
80  void setAction();
81  Action * m_S = nullptr;
82 
83  // Config correlator
84  Correlator * m_correlator = nullptr;
85 
86  // Flow correlator
87  Correlator * m_flowCorrelator = nullptr;
88 
89  // Flow
90  Flow * m_flow = nullptr;
91  void flowConfiguration(unsigned int iConfig);
92  void copyToFlowLattice();
93  Lattice<SU3> * m_flowLattice;
94 
95  // Function for updating our system using the Metropolis algorithm
96  void update();
97  inline void updateLink(unsigned int iSite, int mu);
98 
99  // Thermalization function
100  void thermalize();
101 
102  // SU3 generator
103  SU3MatrixGenerator * m_SU3Generator = nullptr;
104 
105  // RNGs
106  std::mt19937_64 m_generator;
107  std::uniform_real_distribution<double> m_uniform_distribution;
108 
109  // Functions loading fields configurations from file
110  void loadChroma(std::string configurationName);
111  void load(std::string configurationName);
112  void flowConfigurations();
113  void loadConfigurationAndRunMetropolis();
114 
115  // Function for running metropolis algorithm
116  void runMetropolis();
117 public:
118  System();
119  ~System();
120  void run();
121  void latticeSetup();
122 
123 };
124 
125 #endif // METROPOLIS_H
Class for applying gradient flow on lattice.
Definition: flow.h:20
void run()
System::run based on passed parameters, does one of three things:
Definition: system.cpp:239
void latticeSetup()
System::latticeSetup sets up the lattice geometry and allocates memory.
Definition: system.cpp:193
class for holding matrices.
Definition: su3.h:18
Class for generating random SU3 matrices.
Definition: su3matrixgenerator.h:20
The Action class.
Definition: action.h:22
System()
Definition: system.cpp:16
System is the class that ties the program together. It initiates and sets up the sub-lattices,...
Definition: system.h:29
base class for observables.
Definition: correlator.h:20
~System()
System::~System de-allocates action, lattice, correlator RNGs, flow lattice, flow correlator and flow...
Definition: system.cpp:130