HILA
Loading...
Searching...
No Matches
simple_hopping.cpp
1#include "hila.h"
2
3static_assert(NDIM == 3, "NDIM must be 3 here");
4
6
7int main(int argc, char *argv[]) {
8
9 // initialize system
10 hila::initialize(argc, argv);
11
12 // set up the lattice
13 lattice.setup({128, 128, 128});
14
15 // Random numbers are used here - use time to seed
17
18 // lattice field
20 // make f Gaussian random distributed
21 onsites(ALL) f[X].gaussian_random();
22
23 // Measure hopping term and f^2
24 MyType hopping = 0;
25 double fsqr = 0;
26
27 onsites(ALL) {
28 foralldir(d) {
29 hopping += f[X] * f[X + d].dagger();
30 }
31 fsqr += f[X].squarenorm();
32 }
33 hila::out0 << "Average f^2 : " << fsqr / lattice.volume() << '\n';
34 hila::out0 << "Average hopping term " << hopping / (NDIM*lattice.volume()) << '\n';
35
37 return 0;
38}
Complex definition.
Definition cmplx.h:56
The field class implements the standard methods for accessing Fields. Hilapp replaces the parity acce...
Definition field.h:61
Field< A > dagger() const
Returns dagger or Hermitian conjugate of Field depending on how it is defined for Field type T.
Definition field.h:1123
double squarenorm() const
Squarenorm.
Definition field.h:1083
void setup(const CoordinateVector &siz)
General lattice setup.
Definition lattice.cpp:33
#define foralldir(d)
Macro to loop over (all) Direction(s)
Definition coordinates.h:78
constexpr Parity ALL
bit pattern: 011
std::ostream out0
This writes output only from main process (node 0)
void initialize(int argc, char **argv)
Read in command line arguments. Initialise default stream and MPI communication.
void seed_random(uint64_t seed, bool device_rng=true)
Seed random generators with 64-bit unsigned value. On MPI shuffles the seed so that different MPI ran...
Definition random.cpp:86
void finishrun()
Normal, controlled exit - all nodes must call this. Prints timing information and information about c...