5#include "datatypes/sun.h"
6#include "datatypes/representations.h"
18 static constexpr int N = sun::size;
101 for (
int t = 0; t < vol[dir]; t++) {
103 if (X.coordinate(dir) == (t + 1) % vol[dir]) {
104 polyakov[X] = polyakov[X] * gauge[dir][X - dir];
111 if (X.coordinates()[dir] == 0) {
112 poly += polyakov[X].trace().re;
116 double v3 = lattice.volume() / vol[dir];
117 return poly / (N * v3);
125template <
typename SUN>
132 down_staple[
ALL] = U2[dir2][X + dir1].
dagger() *
U1[dir1][X].dagger() * U2[dir2][X];
134 staple_sum[
ALL] = staple_sum[X] +
135 U2[dir2][X + dir1] *
U1[dir1][X + dir2].dagger() * U2[dir2][X].
dagger();
137 staple_sum[
ALL] = staple_sum[X] + down_staple[X - dir2];
149 down_staple[
ALL] = U[dir2][X + dir].
dagger() * U[dir][X].
dagger() * U[dir2][X];
151 staple_sum[
ALL] = staple_sum[X] +
152 U[dir2][X + dir] * U[dir][X + dir2].
dagger() * U[dir2][X].
dagger();
154 staple_sum[
ALL] = staple_sum[X] + down_staple[X - dir2];
165 element<SU<N, radix>> temp;
166 temp = U[dir1][X] * U[dir2][X + dir1] * U[dir1][X + dir2].
dagger() *
168 Plaq += 1 - temp.trace().re / N;
180 element<SU<N, radix>> temp;
181 temp = U[dir1][X] * U[dir2][X + dir1] * U[dir1][X + dir2].
dagger() *
183 Plaq += 1 - temp.trace() / N;
203 static constexpr int N = matrix::size;
210 onsites(
ALL) { this->
gauge[dir][X] = 1; }
218 this->
gauge[dir][X].random();
227 this->
momentum[dir][X].gaussian_algebra();
241 element<matrix> momexp = (eps * this->
momentum[dir][X]).
exp();
242 this->
gauge[dir][X] = momexp * this->
gauge[dir][X];
252 force[dir][X] = this->
gauge[dir][X] * force[dir][X];
253 project_antihermitean(force[dir][X]);
267 std::ifstream inputfile;
268 inputfile.open(filename, std::ios::in | std::ios::binary);
275 std::ofstream outputfile;
276 outputfile.open(filename, std::ios::out | std::ios::trunc | std::ios::binary);
283 return plaquette_sum(this->
gauge) / (lattice.volume() * NDIM * (NDIM - 1) / 2);
306 static constexpr int Nf = fund_type::size;
308 static constexpr int N = repr::size;
350 element<fund_type> fforce;
351 fforce = repr::project_force(this->
gauge[dir][X] * force[dir][X]);
378template <
int N,
typename radix>
381template <
int N,
typename radix>
384template <
int N,
typename radix>
396template <
typename gauge_field>
404 static constexpr int N = gauge_mat::size;
455 static constexpr int N = gauge_mat::size;
481 onsites(
ALL) { force[dir][X] = (-
beta * eps /
N) * staple[X]; }
Array< n, m, T > exp(Array< n, m, T > a)
Exponential.
The field class implements the standard methods for accessing Fields. Hilapp replaces the parity acce...
Field< A > dagger() const
Returns dagger or Hermitian conjugate of Field depending on how it is defined for Field type T.
void check_alloc()
Allocate Field if it is not already allocated.
Matrix class which defines matrix operations.
Special reduction class: enables delayed and non-blocking reductions, which are not possible with the...
Reduction & delayed(bool b=true)
deferred(bool) turns deferred on or off. By default turns on.
void reduce()
Complete the reduction - start if not done, and wait if ongoing.
typename gauge_field::gauge_type gauge_mat
The gauge matrix type.
static constexpr int N
The size of the gauge matrix.
gauge_action(gauge_action &ga)
Construct a copy.
void force_step(double eps)
Update the momentum with the gauge field force.
gauge_action(gauge_field &g, double b)
Construct out of a gauge field.
double action()
The gauge action.
gauge_field & gauge
A reference to the gauge field.
gauge_field_base< M< N, float > > get_single_precision()
Return a single precision copy of the gauge field.
virtual void restore_backup()
M< N, float > gauge_type_flt
This is the single precision type.
virtual void add_momentum(Field< SquareMatrix< N, Complex< basetype > > > *force)
Update the momentum by given force.
double basetype
The basetype is double.
virtual void draw_momentum()
Draw gaussian random momentum.
virtual void zero_momentum()
Set the momentum to zero.
virtual void refresh()
Recalculate represented or smeared field.
virtual void random()
Draw a random gauge field.
virtual void backup()
Make a copy of the gauge field for HMC.
virtual void set_unity()
Set the field to unity.
M< N, double > gauge_type
The matrix type.
virtual void restore_backup()
virtual void refresh()
Recalculate represented or smeared field.
virtual void draw_momentum()
Draw gaussian random momentum.
virtual void random()
Draw a random gauge field.
hila::arithmetic_type< sun > basetype
The base type of the matrix (double, int,...)
Field< sun > gauge[4]
A matrix field for each Direction.
sun gauge_type
The matrix type.
static constexpr int N
The size of the matrix.
virtual void set_unity()
Set the field to unity.
virtual void backup()
Make a copy of the gauge field for HMC.
virtual void add_momentum(Field< SquareMatrix< N, Complex< basetype > > > *force)
Update the momentum by given force.
virtual void zero_momentum()
Set the momentum to zero.
hila::arithmetic_type< matrix > basetype
The base type (double, float, int...)
void restore_backup()
Restore the previous backup.
void zero_momentum()
Set the momentum to zero.
void gauge_update(double eps)
Update the gauge field with time step eps.
void set_unity()
Set the gauge field to unity.
matrix gauge_type
The matrix type.
void random()
Draw a random gauge field.
void backup()
Make a copy of fields updated in a trajectory.
Field< gauge_type > & get_gauge(int dir)
Return a reference to the gauge field.
double polyakov(int dir)
Calculate the polyakov loop.
void read_file(std::string filename)
Read the gauge field from a file.
void draw_momentum()
Gaussian random momentum for each element.
Field< matrix > gauge_backup[4]
Storage for a backup of the gauge field.
static constexpr int N
The size of the matrix.
double plaquette()
Calculate the plaquette.
void add_momentum(Field< SquareMatrix< N, Complex< basetype > > > *force)
void write_file(std::string filename)
Write the gauge field to a file.
Field< gauge_type > & get_momentum(int dir)
Return a reference to the momentum field.
gauge_momentum_action(gauge_momentum_action &ga)
construct a copy
void restore_backup()
Restore the previous backup.
gauge_momentum_action(gauge_field &g)
construct from a gauge field
static constexpr int N
The size of the gauge matrix.
gauge_field & gauge
A reference to the gauge field.
double action()
The gauge action.
void draw_gaussian_fields()
Gaussian random momentum for each element.
void backup_fields()
Make a copy of fields updated in a trajectory.
void step(double eps)
Update the gauge field with momentum.
typename gauge_field::gauge_type gauge_mat
The gauge matrix type.
void add_momentum(Field< SquareMatrix< N, Complex< basetype > > >(&force)[4])
Field< fund_type > & get_gauge(int dir)
Return a reference to the gauge Field.
typename repr::sun fund_type
The type of a fundamental representation matrix.
gauge_field< fund_type > & fundamental
Reference to the fundamental gauge field.
void restore_backup()
Restore the previous backup.
static constexpr int Nf
The size of the matrix.
hila::arithmetic_type< repr > basetype
The base type (double, float, int...)
void refresh()
Represent the fields.
repr gauge_type
The matrix type.
void zero_momentum()
Set the momentum to zero.
represented_gauge_field(represented_gauge_field &r)
Copy constructor.
Field< fund_type > & get_momentum(int dir)
Return a reference to the momentum field.
represented_gauge_field(gauge_field< fund_type > &f)
Construct from a fundamental field.
static constexpr int N
The size of the representation.
#define foralldir(d)
Macro to loop over (all) Direction(s)
Direction
Enumerator for direction that assigns integer to direction to be interpreted as unit vector.
constexpr Parity ALL
bit pattern: 011