Grid 0.7.0
polyakov_loop.h
Go to the documentation of this file.
1/*************************************************************************************
2
3Grid physics library, www.github.com/paboyle/Grid
4
5Source file: ./Grid/qcd/observables/polyakov_loop.h
6
7Copyright (C) 2025
8
9Author: David Preti <david.preti@csic.es>
10Author: Alexis Verney-Provatas <2414441@swansea.ac.uk>
11
12This program is free software; you can redistribute it and/or modify
13it under the terms of the GNU General Public License as published by
14the Free Software Foundation; either version 2 of the License, or
15(at your option) any later version.
16
17This program is distributed in the hope that it will be useful,
18but WITHOUT ANY WARRANTY; without even the implied warranty of
19MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20GNU General Public License for more details.
21
22You should have received a copy of the GNU General Public License along
23with this program; if not, write to the Free Software Foundation, Inc.,
2451 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25
26See the full license in the file "LICENSE" in the top level distribution
27directory
28*************************************************************************************/
29/* END LEGAL */
30
31#pragma once
32
34
35// this is only defined for a gauge theory
36template <class Impl>
37class PolyakovLogger : public HmcObservable<typename Impl::Field> {
38 public:
39 // here forces the Impl to be of gauge fields
40 // if not the compiler will complain
42
43 // necessary for HmcObservable compatibility
44 typedef typename Impl::Field Field;
45
46 void TrajectoryComplete(int traj,
47 Field &U,
48 GridSerialRNG &sRNG,
49 GridParallelRNG &pRNG) {
50
52
53 int def_prec = std::cout.precision();
54
55 std::cout << GridLogMessage
56 << std::setprecision(std::numeric_limits<Real>::digits10 + 1)
57 << "Polyakov Loop: [ " << traj << " ] "<< polyakov << std::endl;
58
59 std::cout.precision(def_prec);
60
61 }
62};
63
64template <class Impl>
65class SpatialPolyakovLogger : public HmcObservable<typename Impl::Field> {
66 public:
67 // here forces the Impl to be of gauge fields
68 // if not the compiler will complain
70
71 // necessary for HmcObservable compatibility
72 typedef typename Impl::Field Field;
73
74 void TrajectoryComplete(int traj,
75 Field &U,
76 GridSerialRNG &sRNG,
77 GridParallelRNG &pRNG) {
78
79 // Save current numerical output precision
80 int def_prec = std::cout.precision();
81
82 // Assume that the dimensions are D=3+1
83 int Ndim = 3;
84 ComplexD polyakov;
85
86 // Iterate over the spatial directions and print the average spatial polyakov loop
87 // over them
88 for (int idx=0; idx<Ndim; idx++) {
90
91 std::cout << GridLogMessage
92 << std::setprecision(std::numeric_limits<Real>::digits10 + 1)
93 << "Polyakov Loop in the " << idx << " spatial direction : [ " << traj << " ] "<< polyakov << std::endl;
94
95 }
96
97 // Return to original output precision
98 std::cout.precision(def_prec);
99
100 }
101};
102
GridLogger GridLogMessage(1, "Message", GridLogColours, "NORMAL")
#define NAMESPACE_BEGIN(A)
Definition Namespace.h:35
#define NAMESPACE_END(A)
Definition Namespace.h:36
std::complex< RealD > ComplexD
Definition Simd.h:79
static INTERNAL_PRECISION U
Definition Zolotarev.cc:230
void TrajectoryComplete(int traj, Field &U, GridSerialRNG &sRNG, GridParallelRNG &pRNG)
INHERIT_GIMPL_TYPES(Impl)
Impl::Field Field
void TrajectoryComplete(int traj, Field &U, GridSerialRNG &sRNG, GridParallelRNG &pRNG)
static ComplexD avgPolyakovLoop(const GaugeField &Umu, const int mu)