42 namespace Test_Spectrum_Wilson {
43 const std::string
test_name =
"Spectrum.Wilson.Hadron2ptFunction";
47 const std::string filename_input =
"test_Spectrum_Wilson_Hadron2ptFunction.yaml";
48 const std::string filename_output =
"stdout";
50 class Parameters_Test_Spectrum_Wilson :
public Parameters {
52 Parameters_Test_Spectrum_Wilson()
54 Register_string(
"gauge_config_status",
"NULL");
55 Register_string(
"gauge_config_type_input",
"NULL");
56 Register_string(
"config_filename_input",
"NULL");
58 Register_string(
"verbose_level",
"NULL");
60 Register_double(
"expected_result", 0.0);
68 #ifdef USE_TESTMANAGER_AUTOREGISTER
70 #if defined(USE_GROUP_SU2)
90 Parameters *params_test =
new Parameters_Test_Spectrum_Wilson;
104 params_manager.
read_params(filename_input, params_all);
106 const string str_gconf_status = params_test->
get_string(
"gauge_config_status");
107 const string str_gconf_read = params_test->
get_string(
"gauge_config_type_input");
108 const string readfile = params_test->
get_string(
"config_filename_input");
109 const string str_vlevel = params_test->
get_string(
"verbose_level");
111 const bool do_check = params_test->
is_set(
"expected_result");
112 const double expected_result = do_check ? params_test->
get_double(
"expected_result") : 0.0;
114 const string str_gfix_type = params_gfix->
get_string(
"gauge_fixing_type");
115 const string str_gmset_type = params_wilson->
get_string(
"gamma_matrix_type");
116 const string str_solver_type = params_solver->
get_string(
"solver_type");
117 const string str_source_type = params_source->
get_string(
"source_type");
122 vout.
general(vl,
" gconf_status = %s\n", str_gconf_status.c_str());
123 vout.
general(vl,
" gconf_read = %s\n", str_gconf_read.c_str());
124 vout.
general(vl,
" readfile = %s\n", readfile.c_str());
125 vout.
general(vl,
" vlevel = %s\n", str_vlevel.c_str());
126 vout.
general(vl,
" gfix_type = %s\n", str_gfix_type.c_str());
127 vout.
general(vl,
" gmset_type = %s\n", str_gmset_type.c_str());
128 vout.
general(vl,
" solver_type = %s\n", str_solver_type.c_str());
129 vout.
general(vl,
" source_type = %s\n", str_source_type.c_str());
145 if (str_gconf_status ==
"Continue") {
147 }
else if (str_gconf_status ==
"Cold_start") {
149 }
else if (str_gconf_status ==
"Hot_start") {
153 vout.
crucial(vl,
"%s: unsupported gconf status \"%s\".\n",
test_name.c_str(), str_gconf_status.c_str());
165 GaugeFixing *gfix = GaugeFixing::New(str_gfix_type, rand);
169 vout.
general(vl,
"plaq(original) = %18.14f\n", plaq);
171 gfix->
fix(*Ufix, *U);
174 vout.
general(vl,
"plaq(fixed) = %18.14f\n", plaq2);
175 vout.
general(vl,
"plaq(diff) = %18.10e\n", plaq - plaq2);
185 Solver *solver = Solver::New(str_solver_type, fopr_w);
190 Source *source = Source::New(str_source_type);
199 std::valarray<Field_F> sq(Nc * Nd);
200 for (
int i = 0; i < Nc * Nd; ++i) {
212 vout.
general(vl,
" color spin Nconv diff diff2\n");
214 for (
int ispin = 0; ispin < Nd; ++ispin) {
215 for (
int icolor = 0; icolor < Nc; ++icolor) {
216 int idx = icolor + Nc * ispin;
219 fprop_lex->
invert_D(sq[idx], b, Nconv, diff);
223 fopr_w->
mult(y, sq[idx]);
225 double diff2 = y.
norm();
228 icolor, ispin, Nconv, diff, diff2);
245 delete params_wilson;
246 delete params_solver;
247 delete params_source;
271 vout.
detailed(vl,
"check skipped: expected_result not set.\n\n");
Random number generator base on M-series.
void read_params(const std::string ¶ms_file, Parameters *params)
read parameters from file.
void detailed(const char *format,...)
const std::string test_name
void general(const char *format,...)
const Field mult(const Field &f)
multiplies fermion operator to a given field and returns the resultant field.
Container of Field-type object.
Two-point correlator for Wilson-type fermions.
double plaquette(const Field_G &)
calculates plaquette value.
int hadron_2ptFunction(void)
static Parameters * New(const std::string &realm)
void set_random(RandomNumbers *rand)
Wilson-type fermion field.
virtual void set_parameters(const Parameters ¶ms)=0
static bool RegisterTest(const std::string &key, const Test_function func)
virtual void invert_D(Field &, const Field &, int &, double &)=0
void set_config(Field *U)
setting pointer to the gauge configuration.
bool is_set(const string &) const
double get_double(const string &key) const
void set_parameters(const Parameters ¶ms)
Set of Gamma Matrices: basis class.
int non_NULL(const std::string v)
virtual void set(Field &, int)=0
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Get quark propagator for Fopr with lexical site index.
void crucial(const char *format,...)
double meson_all(const std::valarray< Field_F > &sq1, const std::valarray< Field_F > &sq2)
void Register_Parameters(const string &, Parameters *const)
void set_mode(std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
Base class for linear solver class family.
Base class of random number generators.
Parameter manager with YAML parser.
GaugeConfig class for file I/O of gauge configuration.
virtual void fix(Field_G &Ufix, const Field_G &Uorg)=0
int verify(const double expected, const double result)
void read_file(Field *u, const string &filename)
Base class of sources for a linear solver.
string get_string(const string &key) const
void report(const Bridge::VerboseLevel vl=Bridge::GENERAL)
virtual void set_parameters(const Parameters &)=0
static VerboseLevel set_verbose_level(const std::string &str)
virtual void set_parameters(const Parameters ¶ms)=0