24 std::array<Field<T>, NDIM> fdir;
27 static constexpr int64_t config_flag = 394824242;
37 template <typename A, std::enable_if_t<std::is_convertible<A, T>::value,
int> = 0>
43 template <typename A, std::enable_if_t<hila::is_assignable<T &, A>::value,
int> = 0>
96 onsites(
ALL)(*this)[d][X].reunitarize();
116 real(trace((*
this)[dir1][X] * (*
this)[dir2][X + dir1] *
117 (*
this)[dir1][X + dir2].
dagger() * (*
this)[dir2][X].
dagger())) /
127 void write(std::ofstream &outputfile)
const {
129 fdir[d].write(outputfile);
133 void write(
const std::string &filename)
const {
134 std::ofstream outputfile;
135 hila::open_output_file(filename, outputfile);
137 hila::close_file(filename, outputfile);
140 void read(std::ifstream &inputfile) {
142 fdir[d].read(inputfile);
146 void read(
const std::string &filename) {
147 std::ifstream inputfile;
148 hila::open_input_file(filename, inputfile);
150 hila::close_file(filename, inputfile);
156 std::ofstream outputfile;
157 hila::open_output_file(filename, outputfile);
161 int64_t f = config_flag;
162 outputfile.write(
reinterpret_cast<char *
>(&f),
sizeof(int64_t));
164 outputfile.write(
reinterpret_cast<char *
>(&f),
sizeof(int64_t));
166 outputfile.write(
reinterpret_cast<char *
>(&f),
sizeof(int64_t));
170 outputfile.write(
reinterpret_cast<char *
>(&f),
sizeof(int64_t));
175 hila::close_file(filename, outputfile);
178 void config_read(
const std::string &filename) {
179 std::ifstream inputfile;
180 hila::open_input_file(filename, inputfile);
181 std::string conferr(
"CONFIG ERROR in file " + filename +
": ");
187 inputfile.read(
reinterpret_cast<char *
>(&f),
sizeof(int64_t));
188 ok = (f == config_flag);
190 hila::out0 << conferr <<
"wrong id, should be " << config_flag <<
" is " << f
195 inputfile.read(
reinterpret_cast<char *
>(&f),
sizeof(int64_t));
198 hila::out0 << conferr <<
"wrong dimensionality, should be " << NDIM <<
" is " << f
203 inputfile.read(
reinterpret_cast<char *
>(&f),
sizeof(int64_t));
204 ok = (f ==
sizeof(T));
206 hila::out0 << conferr <<
"wrong size of field element, should be " <<
sizeof(T)
207 <<
" is " << f <<
'\n';
213 inputfile.read(
reinterpret_cast<char *
>(&f),
sizeof(int64_t));
214 ok = ok && (f == lattice.size(d));
216 hila::out0 << conferr <<
"incorrect lattice dimension " << hila::prettyprint(d)
217 <<
" is " << f <<
" should be " << lattice.size(d) <<
'\n';
226 hila::close_file(filename, inputfile);
Array< n, m, hila::arithmetic_type< T > > real(const Array< n, m, T > &arg)
Return real part of Array.
The field class implements the standard methods for accessing Fields. Hilapp replaces the parity acce...
~GaugeField()=default
Destructor.
GaugeField & operator=(std::nullptr_t np)
Separate 0 assignment.
Field< T > & operator[](Direction d)
Access components with [].
GaugeField & operator=(const A &val)
Assign from anything the field allows.
void reunitarize_gauge()
Reunitarize Gauge Field consisting of matrices.
double measure_plaq() const
Computes Wilson action.
void config_write(const std::string &filename) const
config_write writes the gauge field to file, with additional "verifying" header
Special reduction class: enables delayed and non-blocking reductions, which are not possible with the...
const T value()
Return value of the reduction variable. Wait for the comms if needed.
Reduction & allreduce(bool b=true)
allreduce(bool) turns allreduce on or off. By default on.
Complex< T > dagger(const Complex< T > &val)
Return dagger of Complex number.
#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
Implement hila::swap for gauge fields.
int myrank()
rank of this node
std::ostream out0
This writes output only from main process (node 0)
T broadcast(T &var, int rank=0)
Broadcast the value of var to all MPI ranks from rank (default=0).
void terminate(int status)