LatticeYangMills
topologicalcharge.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 
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 leviCivita(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 
49 
54  m_name = "Top. Charge";
55 }
56 
57 
58 
63  m_lat = lattice;
64  m_size = m_lat->getSize();
65  m_norm = 1.0 / 32.0 / M_PI / M_PI;
66 }
71  // loop through the sublattice
72  m_value = 0;
73  SU3 A;
74  for(int x = 0; x < m_size[0]; x++){
75  for(int y = 0; y < m_size[1]; y++){
76  for(int z = 0; z < m_size[2]; z++){
77  for(int t = 0; t < m_size[3]; t++){
78  for(int mu = 0; mu < 4; mu++){
79  for(int nu = 0; nu < 4; nu++){
80  if(nu!=mu){
81  // compute G_mu_nu
82  Gmn = (*m_lat)(x,y,z,t)[mu]
83  * m_lat->shift(x,y,z,t,nu, mu, 1)
84  * ~(m_lat->shift(x,y,z,t,mu, nu, 1))
85  * ~(*m_lat)(x,y,z,t)[nu];
86 
87  Gmn += (*m_lat)(x,y,z,t)[nu]
88  * ~(m_lat->shift2 (x,y,z,t,mu,nu,1,mu,-1))
89  * ~(m_lat->shift(x,y,z,t,nu, mu, -1))
90  * (m_lat->shift(x,y,z,t,mu, mu, -1));
91 
92  Gmn += ~(m_lat->shift(x,y,z,t,mu, mu, -1))
93  * ~(m_lat->shift2 (x,y,z,t,nu,nu,-1,mu,-1))
94  * (m_lat->shift2 (x,y,z,t,mu,nu,-1,mu,-1))
95  * (m_lat->shift(x,y,z,t,nu, nu, -1));
96 
97  Gmn += ~(m_lat->shift(x,y,z,t,nu, nu, -1))
98  * (m_lat->shift(x,y,z,t,mu, nu, -1))
99  * (m_lat->shift2 (x,y,z,t,nu,nu,-1,mu,1))
100  * ~(*m_lat)(x,y,z,t)[mu];
101 
102  Gmn*=0.25;
103  for(int i = 0; i < 18; i+=2)
104  Gmn.mat[i] = 0;
105 
106  for(int rho = 0; rho < 4; rho++){
107  if(rho!=mu && rho != nu){
108  for(int sig = 0; sig < 4; sig++){
109  if(sig!=mu && sig!=nu && sig!=rho){
110  // compute G_rho_sig
111  Grs = (*m_lat)(x,y,z,t)[rho]
112  * m_lat->shift(x,y,z,t,sig, rho, 1)
113  * ~(m_lat->shift(x,y,z,t,rho, sig, 1))
114  * ~(*m_lat)(x,y,z,t)[sig];
115 
116  Grs += (*m_lat)(x,y,z,t)[sig]
117  * ~(m_lat->shift2 (x,y,z,t,rho,sig,1,rho,-1))
118  * ~(m_lat->shift(x,y,z,t,sig, rho, -1))
119  * (m_lat->shift(x,y,z,t,rho, rho, -1));
120 
121  Grs += ~(m_lat->shift(x,y,z,t,rho, rho, -1))
122  * ~(m_lat->shift2 (x,y,z,t,sig,sig,-1,rho,-1))
123  * (m_lat->shift2 (x,y,z,t,rho,sig,-1,rho,-1))
124  * (m_lat->shift(x,y,z,t,sig, sig, -1));
125 
126  Grs += ~(m_lat->shift(x,y,z,t,sig, sig, -1))
127  * (m_lat->shift(x,y,z,t,rho, sig, -1))
128  * (m_lat->shift2 (x,y,z,t,sig,sig,-1,rho,1))
129  * ~(*m_lat)(x,y,z,t)[rho];
130 
131  Grs*=0.25;
132  for(int i = 0; i < 18; i+=2)
133  Grs.mat[i] = 0;
134  // multiply and sum
135  m_value += (Gmn*Grs).realTrace()*leviCivita(mu, nu, rho, sig);
136 
137 
138  }}}}
139  }}}
140  }}}}
141 
142  gatherResults();
143 
144  //m_value = m_value / (32 * M_PI * M_PI);
145  //m_value = 0.1973 / 0.0931 / 8 * pow(m_value*m_value, 0.25);
146 }
147 
148 
Contains the definition of the Lattice class.
Implementation of a class to perform arithmetics between links.
Definition: su3.h:53
Contains the definition of the Observable prototype.
Contains the definition of the TopologicalCharge observable.
void initObservable(Lattice *lattice)
initializer of the TopologicalCharge class
Utilities for parallelization.
Basic library to implement SU3 matrix arithmetics and functions.
void gatherResults()
MPI reduction of the observable value.
Definition: observable.cpp:47
void compute()
computes the TopologicalCharge value using the clover definition of the field strength tensor ...
Template class to store an array with 4 dimensional indices of a given datatype. Includes functionali...
Definition: action.h:38
TopologicalCharge()
constructor of the TopologicalCharge class
Prototype for the Observable class group.
Definition: observable.h:52
int leviCivita(int i, int j, int k, int l)
levi-civita symbol evaluator