LatticeYangMills
superobs.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/superobs.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 
45 int leviCivit(int i, int j, int k, int l){
46  return ( (i-j)*(i-k)*(i-l)*(j-k)*(j-l)*(k-l)/12 );
47 }
48 
53  m_name = "SuperObs";
54 }
55 
60  m_field = field;
61  trace.allocate(m_field->m_size);
62 }
63 
68  MPI_Allreduce(&plaq, &plaq, 1, MPI_DOUBLE, MPI_SUM, Parallel::cartCoordComm());
69  MPI_Allreduce(&energy, &energy, 1, MPI_DOUBLE, MPI_SUM, Parallel::cartCoordComm());
70  MPI_Allreduce(&topc, &topc, 1, MPI_DOUBLE, MPI_SUM, Parallel::cartCoordComm());
71 }
72 
77  m_value = 0;
78  plaqSum.setSU3Zero();
79  topc = 0;
80  energy = 0;
81  // loop through the sublattice
82 
83  Lattice<SU3> shiftmu, shiftnu, tempmm, tempmp, temppm;
84 
85  for(int mu = 0; mu < 4; mu++){
86  for(int nu = mu+1; nu < 4; nu++){
87 
88  shiftmu = shift((*m_field)[nu], mu, 1);
89  shiftnu = shift((*m_field)[mu], nu, 1);
90 
91 
92  clovers[mu][nu] = (*m_field)[mu];
93  clovers[mu][nu] *= shiftmu;
94  clovers[mu][nu] *= adj(shiftnu);
95  clovers[mu][nu] *= adj((*m_field)[nu]);
96 
97 
98  tempmm = adj(shiftnu);
99  tempmm *= adj((*m_field)[nu]);
100  tempmm *= (*m_field)[mu];
101  tempmm *= shiftmu;;
102 
103 
104  tempmp = shiftnu;
105  tempmp *= adj(shiftmu);
106  tempmp *= adj((*m_field)[mu]);
107  tempmp *= (*m_field)[nu];
108 
109 
110  temppm = adj((*m_field)[mu]);
111  temppm *= (*m_field)[nu];
112  temppm *= shiftnu;
113  temppm *= adj(shiftmu);
114 
115 
116  plaqSum += sum(clovers[mu][nu]);
117  clovers[mu][nu] += shift(shift(tempmm, mu, -1), nu, -1);
118  clovers[mu][nu] -= shift(tempmp, nu, -1);
119  clovers[mu][nu] -= shift(temppm, mu, -1);
120 
121 
122 /*
123  // compute G_mu_nu
124  clovers[mu][nu] = (*m_field)[mu]
125  * shift((*m_field)[nu], mu, 1)
126  * adj(shift((*m_field)[mu], nu, 1))
127  * adj((*m_field)[nu]);
128 
129  plaqSum += sum(clovers[mu][nu]);
130  clovers[mu][nu] -= adj(shift((*m_field)[mu], mu, -1))
131  * shift((*m_field)[nu], mu, -1)
132  * shift(shift((*m_field)[mu],nu,1),mu,-1)
133  * adj((*m_field)[nu]);
134 
135  clovers[mu][nu] += adj(shift((*m_field)[mu], mu, -1))
136  * adj(shift(shift((*m_field)[nu],nu,-1),mu,-1))
137  * shift(shift((*m_field)[mu],nu,-1),mu,-1)
138  * shift((*m_field)[nu], nu, -1);
139 
140  clovers[mu][nu] -= (*m_field)[mu]
141  * adj(shift(shift((*m_field)[nu],nu,-1),mu,1))
142  * adj(shift((*m_field)[mu], nu, -1))
143  * shift((*m_field)[nu], nu, -1);
144 */
145 
146  clovers[mu][nu] -= adj(clovers[mu][nu]);
147  for(int site = 0; site < clovers[mu][nu].sites; site++){
148  double tr = clovers[mu][nu].at(site).imagTrace()/3.0;
149  for(int i = 1; i < 18; i+=8)
150  clovers[mu][nu].at(site).mat[i] -= tr;
151  }
152 
153 
154  energy += sum(realTrace((clovers[mu][nu]*clovers[mu][nu])));// + sum(realTrace((adj(clovers[nu][mu])*adj(clovers[nu][mu]))));
155 
156  }}
157 
158 
159  int mu = 0;
160  for(int nu = 1; nu < 4; nu++){
161  int rho = nu%3;
162  rho++;
163  int sig = rho%3;
164  sig++;
165  if(rho < sig)
166  topc -= sum(realTrace((clovers[mu][nu]*clovers[rho][sig])));
167  else
168  topc -= sum(realTrace((clovers[mu][nu]*adj(clovers[sig][rho]))));
169  }
170  plaq = plaqSum.realTrace() / 18.0 / m_field->m_size[0] / m_field->m_size[1] / m_field->m_size[2] / m_field->m_size[3] / Parallel::activeProcs();
171  topc /= ( 16*16*M_PI*M_PI );
173 }
174 
175 
Contains the definition of the Lattice class.
int leviCivit(int i, int j, int k, int l)
levi-civita symbol evaluator
Definition: superobs.cpp:45
Contains the definition of the Observable prototype.
Class that represents the QCD field as an array of 4 SU3 lattices.
Definition: field.h:53
Contains the definition of the SuperObs class.
void superGatherResults()
MPI reduces the results of the sublattices for alll observables.
Definition: superobs.cpp:67
void compute()
computes the plaquette, the energy density and the topological charge on the lattice ...
Definition: superobs.cpp:76
void initObservable(GluonField *field)
initializer of the SuperObs class
Definition: superobs.cpp:59
Utilities for parallelization.
Basic library to implement SU3 matrix arithmetics and functions.
SuperObs()
constructor of the SuperObs class
Definition: superobs.cpp:52
Prototype for the Observable class group.
Definition: observable.h:52