LatticeYangMills
plaquette.cpp
Go to the documentation of this file.
1 /******************************************************************************
2 *
3 * MIT License
4 *
5 * Copyright (c) 2018 Giovanni Pederiva
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24 ******************************************************************************/
25 
34 #include "Observables/plaquette.h"
35 #include "Observables/observable.h"
36 #include "Math/su3.h"
37 #include "ParallelTools/parallel.h"
38 #include "Math/lattice.h"
39 #include <cstdio>
40 #include <cmath>
41 #include <string>
42 #include <iostream>
43 
48  m_name = "Plaquette";
49 }
50 
51 
56  m_lat = lattice;
57  m_size = m_lat->getSize();
58  m_norm = 1.0 / 18.0 / m_size[0] / m_size[1] / m_size[2] / m_size[3] / Parallel::numProcs();
59 }
60 
65  // loop through the sublattice
66  m_value = 0;
67  for(int mu = 0; mu < 4; mu++){
68  for(int nu = mu + 1; nu < 4; nu++){
69  for(int x = 0; x < m_size[0]; x++){
70  for(int y = 0; y < m_size[1]; y++){
71  for(int z = 0; z < m_size[2]; z++){
72  for(int t = 0; t < m_size[3]; t++){
73  m_value += ( (*m_lat)(x,y,z,t)[mu]
74  * m_lat->shift(x,y,z,t,nu, mu, 1)
75  * ~(m_lat->shift(x,y,z,t,mu, nu, 1))
76  * ~(*m_lat)(x,y,z,t)[nu]
77  ).realTrace();
78  }}}}
79  }
80  }
81  m_value *= m_norm;
82  gatherResults();
83 }
Contains the definition of the Lattice class.
Contains the definition of the Observable prototype.
Contains the definition of the Plaquette observable.
Plaquette()
constructor of the Plaquette class
Definition: plaquette.cpp:47
void compute()
Compute the value of the plaquette over the whole lattice.
Definition: plaquette.cpp:64
void initObservable(Lattice *lattice)
constructor of the Plaquette class
Definition: plaquette.cpp:55
Utilities for parallelization.
Basic library to implement SU3 matrix arithmetics and functions.
void gatherResults()
MPI reduction of the observable value.
Definition: observable.cpp:47
Template class to store an array with 4 dimensional indices of a given datatype. Includes functionali...
Definition: action.h:38
Prototype for the Observable class group.
Definition: observable.h:52