54 namespace Test_Spectrum {
55 const std::string
test_name =
"Spectrum.Hadron2ptFunction_eo_withFileIO";
81 #ifdef USE_TESTMANAGER_AUTOREGISTER
83 #if defined(USE_GROUP_SU2)
87 "Spectrum.Clover.Hadron2ptFunction_eo_withFileIO",
134 const int N_quark = params_test.
get_int(
"number_of_valence_quarks");
136 const std::string str_gconf_status = params_test.
get_string(
"gauge_config_status");
137 const std::string str_gconf_read = params_test.
get_string(
"gauge_config_type_input");
138 const std::string readfile = params_test.
get_string(
"config_filename_input");
139 const vector<int> Nshift_origin = params_test.
get_int_vector(
"shift_origin");
140 const std::string str_rand_type = params_test.
get_string(
"random_number_type");
141 const unsigned long seed = params_test.
get_unsigned_long(
"seed_for_random_number");
142 const std::string str_vlevel = params_test.
get_string(
"verbose_level");
144 const std::string str_gfix_type = params_all.
lookup(
"GaugeFixing").
get_string(
"gauge_fixing_type");
145 const std::string str_proj_type = params_all.
lookup(
"Projection").
get_string(
"projection_type");
146 const std::string str_smear_type = params_all.
lookup(
"Smear").
get_string(
"smear_type");
152 vout.
general(vl,
" gconf_status = %s\n", str_gconf_status.c_str());
153 vout.
general(vl,
" gconf_read = %s\n", str_gconf_read.c_str());
154 vout.
general(vl,
" readfile = %s\n", readfile.c_str());
155 for (
int mu = 0; mu < Ndim; ++mu) {
156 vout.
general(vl,
" shift_origin[%d] = %d\n", mu, Nshift_origin[mu]);
158 vout.
general(vl,
" rand_type = %s\n", str_rand_type.c_str());
160 vout.
general(vl,
" vlevel = %s\n", str_vlevel.c_str());
161 vout.
general(vl,
" gfix_type = %s\n", str_gfix_type.c_str());
162 vout.
general(vl,
" proj_type = %s\n", str_proj_type.c_str());
163 vout.
general(vl,
" smear_type = %s\n", str_smear_type.c_str());
165 vector<Parameters> params_quark;
166 for (
int iq = 0; iq < N_quark; ++iq) {
168 params_quark.push_back(params_all.
lookup(qlabel));
172 const string str_gmset_type = params_quark[0].lookup(
"Fopr").get_string(
"gamma_matrix_type");
173 vout.
general(vl,
" gmset_type = %s\n", str_gmset_type.c_str());
175 std::vector<std::string> savefile_base(N_quark);
176 for (
int iq = 0; iq < N_quark; ++iq) {
177 savefile_base[iq] = params_quark[iq].get_string(
"temporary_filename_base");
180 for (
int iq = 0; iq < N_quark; ++iq) {
181 std::string str_solver_type = params_quark[iq].lookup(
"Solver").get_string(
"solver_type");
182 std::string str_source_type = params_quark[iq].lookup(
"Source").get_string(
"source_type");
183 vector<int> source_position = params_quark[iq].lookup(
"Source").get_int_vector(
"source_position");
186 vout.
general(vl,
" savefile_base[iq] = %s[%d]\n", savefile_base[iq].c_str(), iq);
187 vout.
general(vl,
" solver_type = %s\n", str_solver_type.c_str());
188 vout.
general(vl,
" source_type = %s\n", str_source_type.c_str());
189 for (
int mu = 0; mu < Ndim; ++mu) {
190 vout.
general(vl,
" source_position[%d] = %d\n", mu, source_position[mu]);
205 for (
int iq = 0; iq < N_quark; ++iq) {
206 std::string str_solver_type = params_quark[iq].lookup(
"Solver").get_string(
"solver_type");
208 if (str_solver_type ==
"CG") {
209 vout.
crucial(vl,
"Error at %s: CG can not be adopted. Use CGNE,CGNR, instead.\n",
test_name.c_str());
220 if (str_gconf_status ==
"Continue") {
222 }
else if (str_gconf_status ==
"Cold_start") {
224 }
else if (str_gconf_status ==
"Hot_start") {
227 vout.
crucial(vl,
"Error at %s: unsupported gconf status \"%s\"\n",
test_name.c_str(), str_gconf_status.c_str());
233 for (
int i_dir = 0; i_dir < Ndim; ++i_dir) {
234 for (
int i_shift = 0; i_shift < Nshift_origin[i_dir]; ++i_shift) {
266 gfix->
fix(*Ufix, *U);
276 std::vector<unique_ptr<Fopr> > fopr(N_quark);
277 std::vector<unique_ptr<Fopr> > fopr_eo(N_quark);
278 std::vector<unique_ptr<Solver> >
solver(N_quark);
279 std::vector<unique_ptr<Fprop> > fprop_eo(N_quark);
280 std::vector<unique_ptr<Source> > source(N_quark);
284 for (
int iq = 0; iq < N_quark; ++iq) {
285 std::string str_fopr_type = params_quark[iq].lookup(
"Fopr").get_string(
"fermion_type");
286 fopr[iq].reset(Fopr::New(str_fopr_type, str_gmset_type));
287 fopr[iq]->set_parameters(params_quark[iq].lookup(
"Fopr"));
288 fopr[iq]->set_config(U);
290 fopr_eo[iq].reset(Fopr::New(str_fopr_type +
"_eo", str_gmset_type));
291 fopr_eo[iq]->set_parameters(params_quark[iq].lookup(
"Fopr"));
292 fopr_eo[iq]->set_config(U);
294 std::string str_solver_type = params_quark[iq].lookup(
"Solver").get_string(
"solver_type");
295 solver[iq].reset(Solver::New(str_solver_type, fopr_eo[iq]));
296 solver[iq]->set_parameters(params_quark[iq].lookup(
"Solver"));
300 std::string str_source_type = params_quark[iq].lookup(
"Source").get_string(
"source_type");
301 source[iq].reset(Source::New(str_source_type));
302 source[iq]->set_parameters(params_quark[iq].lookup(
"Source"));
305 std::vector<Fopr *> fopr(N_quark);
306 std::vector<Fopr *> fopr_eo(N_quark);
307 std::vector<Solver *>
solver(N_quark);
308 std::vector<Fprop *> fprop_eo(N_quark);
309 std::vector<Source *> source(N_quark);
313 for (
int iq = 0; iq < N_quark; ++iq) {
314 std::string str_fopr_type = params_quark[iq].lookup(
"Fopr").get_string(
"fermion_type");
315 fopr[iq] = Fopr::New(str_fopr_type, str_gmset_type);
316 fopr[iq]->set_parameters(params_quark[iq].lookup(
"Fopr"));
317 fopr[iq]->set_config(U);
319 fopr_eo[iq] = Fopr::New(str_fopr_type +
"_eo", str_gmset_type);
320 fopr_eo[iq]->set_parameters(params_quark[iq].lookup(
"Fopr"));
321 fopr_eo[iq]->set_config(U);
323 std::string str_solver_type = params_quark[iq].lookup(
"Solver").get_string(
"solver_type");
324 solver[iq] = Solver::New(str_solver_type, fopr_eo[iq]);
325 solver[iq]->set_parameters(params_quark[iq].lookup(
"Solver"));
329 std::string str_source_type = params_quark[iq].lookup(
"Source").get_string(
"source_type");
330 source[iq] = Source::New(str_source_type);
331 source[iq]->set_parameters(params_quark[iq].lookup(
"Source"));
340 for (
int iq = 0; iq < N_quark; ++iq) {
341 vout.
general(vl,
"Solving quark propagator, flavor = %d:\n", iq + 1);
342 vout.
general(vl,
" color spin Nconv diff diff2\n");
344 for (
int ispin = 0; ispin < Nd; ++ispin) {
345 for (
int icolor = 0; icolor < Nc; ++icolor) {
346 int i_cd = icolor + Nc * ispin;
349 source[iq]->
set(b, i_cd);
354 fprop_eo[iq]->invert_D(xq, b, Nconv, diff);
357 fopr[iq]->set_mode(
"D");
358 fopr[iq]->mult(y, xq);
363 icolor, ispin, Nconv, diff, diff2);
377 for (
int iq = 0; iq < N_quark; ++iq) {
403 const int N_quark = params_test.
get_int(
"number_of_valence_quarks");
405 const std::string str_vlevel = params_test.
get_string(
"verbose_level");
407 const bool do_check = params_test.
is_set(
"expected_result");
408 const double expected_result = do_check ? params_test.
get_double(
"expected_result") : 0.0;
410 std::vector<std::string> savefile_base(N_quark);
412 for (
int iq = 0; iq < N_quark; ++iq) {
419 vout.
general(vl,
" vlevel = %s\n", str_vlevel.c_str());
422 const std::string str_gmset_type = params_all.
lookup(
"Quark_1").
lookup(
"Fopr").
get_string(
"gamma_matrix_type");
423 vout.
general(vl,
" gmset_type = %s\n", str_gmset_type.c_str());
425 std::vector<std::string> str_source_type(N_quark);
427 for (
int iq = 0; iq < N_quark; ++iq) {
429 vout.
general(vl,
" savefile_base[iq] = %s[%d]\n", savefile_base[iq].c_str(), iq);
444 typedef std::vector<Field_F> PropagatorSet;
445 std::vector<PropagatorSet> sq(N_quark);
446 for (
int iq = 0; iq < N_quark; ++iq) {
447 sq[iq].resize(Nc * Nd);
449 for (
int i_cd = 0; i_cd < Nc * Nd; ++i_cd) {
450 sq[iq][i_cd].set(0.0);
454 for (
int iq = 0; iq < N_quark; ++iq) {
455 for (
int ispin = 0; ispin < Nd; ++ispin) {
456 for (
int icolor = 0; icolor < Nc; ++icolor) {
457 int i_cd = icolor + Nc * ispin;
460 field_io->
read_file(&sq[iq][i_cd], filename);
467 std::vector<double> result(N_quark);
472 for (
int iq = 0; iq < N_quark; ++iq) {
473 vout.
general(vl,
"Flavor combination = %d, %d\n", iq + 1, iq + 1);
474 result[iq] = corr.
meson_all(sq[iq], sq[iq]);
480 for (
int iq = 0; iq < N_quark; ++iq) {
481 for (
int jq = iq + 1; jq < N_quark; ++jq) {
482 vout.
general(vl,
"Flavor combination = %d, %d\n", iq + 1, jq + 1);
483 double result_2 = corr.
meson_all(sq[iq], sq[jq]);
500 vout.
detailed(vl,
"check skipped: expected_result not set.\n\n");
int hadron_2ptFunction_eo_withFileIO_Clover()
int hadron_2ptFunction_eo_withFileIO_Wilson()
int calculate_hadron_correlator_eo_withFileIO(const std::string &)
int hadron_2ptFunction_eo_withFileIO(const std::string &)
void detailed(const char *format,...)
double meson_all(const std::vector< Field_F > &sq1, const std::vector< Field_F > &sq2)
void set(const int jin, const int site, const int jex, double v)
virtual void set_parameters(const Parameters ¶m)=0
void general(const char *format,...)
int solver(const std::string &)
Two-point correlator for Wilson-type fermions.
virtual void set_parameters(const Parameters &)=0
int get_int(const string &key) const
void copy(Field &y, const Field &x)
copy(y, x): y = x
int calculate_quark_propagator_eo_withFileIO(const std::string &)
Wilson-type fermion field.
Parameters lookup(const string &key) const
static bool RegisterTest(const std::string &key, const Test_function func)
static bool initialize(const std::string &rng_type, unsigned long seed)
void read(Field_G *U, const string &filename=string())
unsigned long get_unsigned_long(const string &key) const
double get_double(const string &key) const
std::string generate_filename(const char *fmt,...)
Get quark propagator for Fopr with even-odd site index.
void backward(Field &, const Field &, const int mu)
int non_NULL(const std::string v)
bool is_set(const string &key) const
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
void set_config(Field *U)
set pointer to original thin link variable
int get_Nsmear()
get number of applied smearing operation
void crucial(const char *format,...)
static void read(const std::string ¶ms_file, Parameters ¶ms)
Manager of smeared configurations.
int verify(const double result, const double expected, double eps)
FieldIO_Binary class for file I/O of Field data in binary format.
const std::string test_name
Field * getptr_smearedConfig(const int i_smear)
get pointer to i-th smeared config (0th is original thin link)
virtual void read_file(Field *v, std::string)=0
read data from file.
virtual void write_file(Field *v, std::string)=0
write data to file.
void set_parameters(const Parameters ¶ms)
set parameters, must be called before set_config
Methods to shift a field in the lexical site index.
GaugeConfig class for file I/O of gauge configuration.
virtual void fix(Field_G &Ufix, const Field_G &Uorg)=0
virtual void set_parameters(const Parameters ¶ms)
string get_string(const string &key) const
vector< int > get_int_vector(const string &key) const
void report(const Bridge::VerboseLevel vl=Bridge::GENERAL)
static VerboseLevel set_verbose_level(const std::string &str)
virtual void set_parameters(const Parameters ¶ms)=0