Class hila::input can be used to read parameters and other data for simulations. It matches key-value pairs from input files.
The available methods in the input class are:
As an example, if the file parameters.dat
contains
# this is a comment
# Run parameters for run XYZ
lattice size 64, 64, 64, 128
beta 5.4
clover perturbative
loops 25000
seed 3474212
coefficients 0.5, 0.7, 0.85, 1.3, 1.6, 2
labels setA, setB, setC
then the values can be read as follows:
#include "hila.h"
int main(int argc, char * argv[]) {
double beta = p.get("beta");
int i = p.get_item("clover",{"tree","perturbative","%f"});
double clover;
if (i == 0)
clover = 1;
else if (i == 1)
clover = <perturbative expression>;
else
clover = p.get();
int loops = p.get("loops");
long rng_seed = p.get("seed");
std::vector<double> run_coefficients = p.get("coefficients");
std::vector<std::string> labels = p.get("labels");
p.close();
.
.
.
}
void setup(const CoordinateVector &siz)
General lattice setup.
void initialize(int argc, char **argv)
Read in command line arguments. Initialise default stream and MPI communication.
For more detailed description on the methods see hila::input class