56 const std::string
test_name =
"Spectrum.Hadron2ptFunction_withFileIO";
100 #ifdef USE_TESTMANAGER_AUTOREGISTER
102 #if defined(USE_GROUP_SU2)
106 "Spectrum.Clover.Hadron2ptFunction_withFileIO",
111 "Spectrum.CloverGeneral.Hadron2ptFunction_withFileIO",
116 "Spectrum.Wilson_TwistedMass.Hadron2ptFunction_withFileIO",
127 "Spectrum.WilsonGeneral.Hadron2ptFunction_withFileIO",
167 const int N_quark = params_test.
get_int(
"number_of_valence_quarks");
169 const std::string str_gconf_status = params_test.
get_string(
"gauge_config_status");
170 const std::string str_gconf_read = params_test.
get_string(
"gauge_config_type_input");
171 const std::string readfile = params_test.
get_string(
"config_filename_input");
172 const vector<int> Nshift_origin = params_test.
get_int_vector(
"shift_origin");
173 const std::string str_vlevel = params_test.
get_string(
"verbose_level");
175 const std::string str_gfix_type = params_all.
lookup(
"GaugeFixing").
get_string(
"gauge_fixing_type");
176 const std::string str_proj_type = params_all.
lookup(
"Projection").
get_string(
"projection_type");
177 const std::string str_smear_type = params_all.
lookup(
"Smear").
get_string(
"smear_type");
178 const int Nsmear = params_all.
lookup(
"Director_Smear").
get_int(
"number_of_smearing");
183 vout.
general(
vl,
" gconf_status = %s\n", str_gconf_status.c_str());
184 vout.
general(
vl,
" gconf_read = %s\n", str_gconf_read.c_str());
186 for (
int mu = 0; mu < Ndim; ++mu) {
187 vout.
general(
vl,
" shift_origin[%d] = %d\n", mu, Nshift_origin[mu]);
190 vout.
general(
vl,
" gfix_type = %s\n", str_gfix_type.c_str());
191 vout.
general(
vl,
" proj_type = %s\n", str_proj_type.c_str());
192 vout.
general(
vl,
" smear_type = %s\n", str_smear_type.c_str());
194 vector<Parameters> params_quark;
195 for (
int iq = 0; iq < N_quark; ++iq) {
197 params_quark.push_back(params_all.
lookup(qlabel));
201 std::string str_gmset_type = params_quark[0].lookup(
"Fopr").get_string(
"gamma_matrix_type");
202 vout.
general(
vl,
" gmset_type = %s\n", str_gmset_type.c_str());
204 std::vector<std::string> savefile_base(N_quark);
205 for (
int iq = 0; iq < N_quark; ++iq) {
206 savefile_base[iq] = params_quark[iq].get_string(
"temporary_filename_base");
209 for (
int iq = 0; iq < N_quark; ++iq) {
210 std::string str_solver_type = params_quark[iq].lookup(
"Solver").get_string(
"solver_type");
211 std::string str_source_type = params_quark[iq].lookup(
"Source").get_string(
"source_type");
212 vector<int> source_position = params_quark[iq].lookup(
"Source").get_int_vector(
"source_position");
215 vout.
general(
vl,
" savefile_base[iq] = %s[%d]\n", savefile_base[iq].c_str(), iq);
216 vout.
general(
vl,
" solver_type = %s\n", str_solver_type.c_str());
217 vout.
general(
vl,
" source_type = %s\n", str_source_type.c_str());
218 for (
int mu = 0; mu < Ndim; ++mu) {
219 vout.
general(
vl,
" source_position[%d] = %d\n", mu, source_position[mu]);
234 for (
int iq = 0; iq < N_quark; ++iq) {
235 std::string str_solver_type = params_quark[iq].lookup(
"Solver").get_string(
"solver_type");
237 if (str_solver_type ==
"CG") {
243 if ((Nsmear > 0) && (str_proj_type ==
"Stout_SU3")) {
252 if ((str_gfix_type ==
"Coulomb") || (str_gfix_type ==
"Landau")) {
266 if (str_gconf_status ==
"Continue") {
268 }
else if (str_gconf_status ==
"Cold_start") {
270 }
else if (str_gconf_status ==
"Hot_start") {
273 vout.
crucial(
vl,
"Error at %s: unsupported gconf status \"%s\"\n",
test_name.c_str(), str_gconf_status.c_str());
279 for (
int i_dir = 0; i_dir < Ndim; ++i_dir) {
280 for (
int i_shift = 0; i_shift < Nshift_origin[i_dir]; ++i_shift) {
282 shift.backward(Ushift, U, i_dir);
289 unique_ptr<Projection> proj(Projection::New(str_proj_type, params_all.
lookup(
"Projection")));
290 unique_ptr<Smear> smear(Smear::New(str_smear_type, proj.get(), params_all.
lookup(
"Smear")));
291 unique_ptr<Director_Smear> dr_smear(
new Director_Smear(smear.get(), params_all.
lookup(
"Director_Smear")));
292 dr_smear->set_config(&U);
294 const Field_G *Usmear = (
Field_G *)dr_smear->getptr_smearedConfig(Nsmear);
301 unique_ptr<GaugeFixing> gfix(GaugeFixing::New(str_gfix_type, params_all.
lookup(
"GaugeFixing")));
311 unique_ptr<Fopr> fopr;
312 unique_ptr<Solver>
solver;
313 unique_ptr<Fprop> fprop;
314 unique_ptr<Source> source;
317 std::vector<QuarkType> quark(N_quark);
319 for (
int iq = 0; iq < N_quark; ++iq) {
324 quark[iq].fopr.reset(Fopr::New(params_fopr.
get_string(
"fermion_type"),
326 quark[iq].fopr->set_config(&U);
328 quark[iq].solver.reset(Solver::New(params_solver.
get_string(
"solver_type"),
329 quark[iq].fopr.get(),
334 quark[iq].source.reset(Source::New(params_source.
get_string(
"source_type"),
343 for (
int iq = 0; iq < N_quark; ++iq) {
344 vout.
general(
vl,
"Solving quark propagator, flavor = %d:\n", iq + 1);
347 for (
int ispin = 0; ispin < Nd; ++ispin) {
348 for (
int icolor = 0; icolor < Nc; ++icolor) {
349 int i_cd = icolor + Nc * ispin;
352 quark[iq].source->
set(b, i_cd);
357 quark[iq].fprop->invert_D(xq, b, Nconv, diff);
360 quark[iq].fopr->set_mode(
"D");
361 quark[iq].fopr->mult(y, xq);
366 icolor, ispin, Nconv, diff, diff2);
369 field_io->write_file(xq, filename);
393 const int N_quark = params_test.
get_int(
"number_of_valence_quarks");
395 const std::string str_vlevel = params_test.
get_string(
"verbose_level");
397 const bool do_check = params_test.
is_set(
"expected_result");
398 const double expected_result = do_check ? params_test.
get_double(
"expected_result") : 0.0;
400 const std::string str_proj_type = params_all.
lookup(
"Projection").
get_string(
"projection_type");
401 const int Nsmear = params_all.
lookup(
"Director_Smear").
get_int(
"number_of_smearing");
403 std::vector<std::string> savefile_base(N_quark);
405 for (
int iq = 0; iq < N_quark; ++iq) {
406 savefile_base[iq] = params_all
417 const std::string str_gmset_type = params_all.
lookup(
"Quark_1").
lookup(
"Fopr").
get_string(
"gamma_matrix_type");
418 vout.
general(
vl,
" gmset_type = %s\n", str_gmset_type.c_str());
420 for (
int iq = 0; iq < N_quark; ++iq) {
421 vout.
general(
vl,
" savefile_base[iq] = %s[%d]\n", savefile_base[iq].c_str(), iq);
424 if ((Nsmear > 0) && (str_proj_type ==
"Stout_SU3")) {
433 unique_ptr<GammaMatrixSet> gmset(GammaMatrixSet::New(str_gmset_type));
441 typedef std::vector<Field_F> PropagatorSet;
442 std::vector<PropagatorSet> sq(N_quark);
443 for (
int iq = 0; iq < N_quark; ++iq) {
444 sq[iq].resize(Nc * Nd);
446 for (
int i_cd = 0; i_cd < Nc * Nd; ++i_cd) {
447 sq[iq][i_cd].set(0.0);
452 for (
int iq = 0; iq < N_quark; ++iq) {
453 for (
int ispin = 0; ispin < Nd; ++ispin) {
454 for (
int icolor = 0; icolor < Nc; ++icolor) {
455 int i_cd = icolor + Nc * ispin;
458 field_io->read_file(sq[iq][i_cd], filename);
465 std::vector<double> result(N_quark);
470 for (
int iq = 0; iq < N_quark; ++iq) {
471 vout.
general(
vl,
"Flavor combination = %d, %d\n", iq + 1, iq + 1);
472 result[iq] = corr.
meson_all(sq[iq], sq[iq]);
478 for (
int iq = 0; iq < N_quark; ++iq) {
479 for (
int jq = iq + 1; jq < N_quark; ++jq) {
480 vout.
general(
vl,
"Flavor combination = %d, %d\n", iq + 1, jq + 1);
481 double result_2 = corr.
meson_all(sq[iq], sq[jq]);