56 const std::string
test_name =
"Spectrum.Hadron2ptFunction_eo_withFileIO";
82 #ifdef USE_TESTMANAGER_AUTOREGISTER
84 #if defined(USE_GROUP_SU2)
88 "Spectrum.Clover.Hadron2ptFunction_eo_withFileIO",
135 const int N_quark = params_test.
get_int(
"number_of_valence_quarks");
137 const std::string str_gconf_status = params_test.
get_string(
"gauge_config_status");
138 const std::string str_gconf_read = params_test.
get_string(
"gauge_config_type_input");
139 const std::string readfile = params_test.
get_string(
"config_filename_input");
140 const vector<int> Nshift_origin = params_test.
get_int_vector(
"shift_origin");
141 const std::string str_rand_type = params_test.
get_string(
"random_number_type");
142 const unsigned long seed = params_test.
get_unsigned_long(
"seed_for_random_number");
143 const std::string str_vlevel = params_test.
get_string(
"verbose_level");
145 const std::string str_gfix_type = params_all.
lookup(
"GaugeFixing").
get_string(
"gauge_fixing_type");
146 const std::string str_proj_type = params_all.
lookup(
"Projection").
get_string(
"projection_type");
147 const std::string str_smear_type = params_all.
lookup(
"Smear").
get_string(
"smear_type");
148 const int Nsmear = params_all.
lookup(
"Director_Smear").
get_int(
"number_of_smearing");
154 vout.
general(
vl,
" gconf_status = %s\n", str_gconf_status.c_str());
155 vout.
general(
vl,
" gconf_read = %s\n", str_gconf_read.c_str());
157 for (
int mu = 0; mu < Ndim; ++mu) {
158 vout.
general(
vl,
" shift_origin[%d] = %d\n", mu, Nshift_origin[mu]);
160 vout.
general(
vl,
" rand_type = %s\n", str_rand_type.c_str());
163 vout.
general(
vl,
" gfix_type = %s\n", str_gfix_type.c_str());
164 vout.
general(
vl,
" proj_type = %s\n", str_proj_type.c_str());
165 vout.
general(
vl,
" smear_type = %s\n", str_smear_type.c_str());
167 vector<Parameters> params_quark;
168 for (
int iq = 0; iq < N_quark; ++iq) {
170 params_quark.push_back(params_all.
lookup(qlabel));
174 const string str_gmset_type = params_quark[0].lookup(
"Fopr").get_string(
"gamma_matrix_type");
175 vout.
general(
vl,
" gmset_type = %s\n", str_gmset_type.c_str());
177 std::vector<std::string> savefile_base(N_quark);
178 for (
int iq = 0; iq < N_quark; ++iq) {
179 savefile_base[iq] = params_quark[iq].get_string(
"temporary_filename_base");
182 for (
int iq = 0; iq < N_quark; ++iq) {
183 std::string str_solver_type = params_quark[iq].lookup(
"Solver").get_string(
"solver_type");
184 std::string str_source_type = params_quark[iq].lookup(
"Source").get_string(
"source_type");
185 vector<int> source_position = params_quark[iq].lookup(
"Source").get_int_vector(
"source_position");
188 vout.
general(
vl,
" savefile_base[iq] = %s[%d]\n", savefile_base[iq].c_str(), iq);
189 vout.
general(
vl,
" solver_type = %s\n", str_solver_type.c_str());
190 vout.
general(
vl,
" source_type = %s\n", str_source_type.c_str());
191 for (
int mu = 0; mu < Ndim; ++mu) {
192 vout.
general(
vl,
" source_position[%d] = %d\n", mu, source_position[mu]);
207 for (
int iq = 0; iq < N_quark; ++iq) {
208 std::string str_solver_type = params_quark[iq].lookup(
"Solver").get_string(
"solver_type");
210 if (str_solver_type ==
"CG") {
216 if ((Nsmear > 0) && (str_proj_type ==
"Stout_SU3")) {
225 if ((str_gfix_type ==
"Coulomb") || (str_gfix_type ==
"Landau")) {
239 if (str_gconf_status ==
"Continue") {
241 }
else if (str_gconf_status ==
"Cold_start") {
243 }
else if (str_gconf_status ==
"Hot_start") {
246 vout.
crucial(
vl,
"Error at %s: unsupported gconf status \"%s\"\n",
test_name.c_str(), str_gconf_status.c_str());
252 for (
int i_dir = 0; i_dir < Ndim; ++i_dir) {
253 for (
int i_shift = 0; i_shift < Nshift_origin[i_dir]; ++i_shift) {
255 shift.backward(Ushift, U, i_dir);
262 unique_ptr<Projection> proj(Projection::New(str_proj_type, params_all.
lookup(
"Projection")));
263 unique_ptr<Smear> smear(Smear::New(str_smear_type, proj.get(), params_all.
lookup(
"Smear")));
264 unique_ptr<Director_Smear> dr_smear(
new Director_Smear(smear.get(), params_all.
lookup(
"Director_Smear")));
265 dr_smear->set_config(&U);
267 const Field_G *Usmear = (
Field_G *)dr_smear->getptr_smearedConfig(Nsmear);
275 unique_ptr<GaugeFixing> gfix(GaugeFixing::New(str_gfix_type, params_all.
lookup(
"GaugeFixing")));
285 unique_ptr<Fopr> fopr;
286 unique_ptr<Fopr> fopr_eo;
287 unique_ptr<Solver>
solver;
288 unique_ptr<Fprop> fprop_eo;
289 unique_ptr<Source> source;
293 std::vector<QuarkType> quark(N_quark);
295 for (
int iq = 0; iq < N_quark; ++iq) {
300 quark[iq].fopr.reset(Fopr::New(params_fopr.
get_string(
"fermion_type"),
302 quark[iq].fopr->set_config(&U);
304 quark[iq].fopr_eo.reset(Fopr::New(params_fopr.
get_string(
"fermion_type") +
"_eo",
306 quark[iq].fopr_eo->set_config(&U);
308 quark[iq].solver.reset(Solver::New(params_solver.
get_string(
"solver_type"),
309 quark[iq].fopr_eo.get(),
314 quark[iq].source.reset(Source::New(params_source.
get_string(
"source_type"),
324 for (
int iq = 0; iq < N_quark; ++iq) {
325 vout.
general(
vl,
"Solving quark propagator, flavor = %d:\n", iq + 1);
328 for (
int ispin = 0; ispin < Nd; ++ispin) {
329 for (
int icolor = 0; icolor < Nc; ++icolor) {
330 int i_cd = icolor + Nc * ispin;
333 quark[iq].source->
set(b, i_cd);
338 quark[iq].fprop_eo->invert_D(xq, b, Nconv, diff);
341 quark[iq].fopr->set_mode(
"D");
342 quark[iq].fopr->mult(y, xq);
347 icolor, ispin, Nconv, diff, diff2);
350 field_io->write_file(xq, filename);
374 const int N_quark = params_test.
get_int(
"number_of_valence_quarks");
376 const std::string str_vlevel = params_test.
get_string(
"verbose_level");
378 const bool do_check = params_test.
is_set(
"expected_result");
379 const double expected_result = do_check ? params_test.
get_double(
"expected_result") : 0.0;
381 const std::string str_proj_type = params_all.
lookup(
"Projection").
get_string(
"projection_type");
382 const int Nsmear = params_all.
lookup(
"Director_Smear").
get_int(
"number_of_smearing");
384 std::vector<std::string> savefile_base(N_quark);
386 for (
int iq = 0; iq < N_quark; ++iq) {
396 const std::string str_gmset_type = params_all.
lookup(
"Quark_1").
lookup(
"Fopr").
get_string(
"gamma_matrix_type");
397 vout.
general(
vl,
" gmset_type = %s\n", str_gmset_type.c_str());
399 std::vector<std::string> str_source_type(N_quark);
401 for (
int iq = 0; iq < N_quark; ++iq) {
403 vout.
general(
vl,
" savefile_base[iq] = %s[%d]\n", savefile_base[iq].c_str(), iq);
407 if ((Nsmear > 0) && (str_proj_type ==
"Stout_SU3")) {
416 unique_ptr<GammaMatrixSet> gmset(GammaMatrixSet::New(str_gmset_type));
424 typedef std::vector<Field_F> PropagatorSet;
425 std::vector<PropagatorSet> sq(N_quark);
426 for (
int iq = 0; iq < N_quark; ++iq) {
427 sq[iq].resize(Nc * Nd);
429 for (
int i_cd = 0; i_cd < Nc * Nd; ++i_cd) {
430 sq[iq][i_cd].set(0.0);
434 for (
int iq = 0; iq < N_quark; ++iq) {
435 for (
int ispin = 0; ispin < Nd; ++ispin) {
436 for (
int icolor = 0; icolor < Nc; ++icolor) {
437 int i_cd = icolor + Nc * ispin;
440 field_io->read_file(sq[iq][i_cd], filename);
447 std::vector<double> result(N_quark);
452 for (
int iq = 0; iq < N_quark; ++iq) {
453 vout.
general(
vl,
"Flavor combination = %d, %d\n", iq + 1, iq + 1);
454 result[iq] = corr.
meson_all(sq[iq], sq[iq]);
460 for (
int iq = 0; iq < N_quark; ++iq) {
461 for (
int jq = iq + 1; jq < N_quark; ++jq) {
462 vout.
general(
vl,
"Flavor combination = %d, %d\n", iq + 1, jq + 1);
463 double result_2 = corr.
meson_all(sq[iq], sq[jq]);