72 const std::string
test_name =
"Spectrum.Hadron2ptFunction";
123 #ifdef USE_TESTMANAGER_AUTOREGISTER
125 #if defined(USE_GROUP_SU2)
129 "Spectrum.Clover.Hadron2ptFunction",
134 "Spectrum.CloverGeneral.Hadron2ptFunction",
139 "Spectrum.Wilson_TwistedMass.Hadron2ptFunction",
150 "Spectrum.Wilson.Hadron2ptFunction_ShiftOrigin",
155 "Spectrum.Wilson.Hadron2ptFunction_WallSource",
160 "Spectrum.WilsonGeneral.Hadron2ptFunction",
179 const int N_quark = params_test.
get_int(
"number_of_valence_quarks");
181 const std::string str_gconf_status = params_test.
get_string(
"gauge_config_status");
182 const std::string str_gconf_read = params_test.
get_string(
"gauge_config_type_input");
183 const std::string readfile = params_test.
get_string(
"config_filename_input");
184 const vector<int> Nshift_origin = params_test.
get_int_vector(
"shift_origin");
185 const std::string str_rand_type = params_test.
get_string(
"random_number_type");
186 const unsigned long seed = params_test.
get_unsigned_long(
"seed_for_random_number");
187 const std::string str_vlevel = params_test.
get_string(
"verbose_level");
189 const bool do_check = params_test.
is_set(
"expected_result");
190 const double expected_result = do_check ? params_test.
get_double(
"expected_result") : 0.0;
192 const std::string str_gfix_type = params_all.
lookup(
"GaugeFixing").
get_string(
"gauge_fixing_type");
193 const std::string str_proj_type = params_all.
lookup(
"Projection").
get_string(
"projection_type");
194 const std::string str_smear_type = params_all.
lookup(
"Smear").
get_string(
"smear_type");
195 const int Nsmear = params_all.
lookup(
"Director_Smear").
get_int(
"number_of_smearing");
200 vout.
general(
vl,
" gconf_status = %s\n", str_gconf_status.c_str());
201 vout.
general(
vl,
" gconf_read = %s\n", str_gconf_read.c_str());
203 for (
int mu = 0; mu < Ndim; ++mu) {
204 vout.
general(
vl,
" shift_origin[%d] = %d\n", mu, Nshift_origin[mu]);
206 vout.
general(
vl,
" rand_type = %s\n", str_rand_type.c_str());
209 vout.
general(
vl,
" gfix_type = %s\n", str_gfix_type.c_str());
210 vout.
general(
vl,
" proj_type = %s\n", str_proj_type.c_str());
211 vout.
general(
vl,
" smear_type = %s\n", str_smear_type.c_str());
213 vector<Parameters> params_quark;
214 for (
int iq = 0; iq < N_quark; ++iq) {
216 params_quark.push_back(params_all.
lookup(qlabel));
220 const std::string str_gmset_type = params_quark[0].lookup(
"Fopr").get_string(
"gamma_matrix_type");
221 vout.
general(
vl,
" gmset_type = %s\n", str_gmset_type.c_str());
224 for (
int iq = 0; iq < N_quark; ++iq) {
227 params_quark[iq].lookup(
"Solver").get_string(
"solver_type").c_str());
229 params_quark[iq].lookup(
"Source").get_string(
"source_type").c_str());
231 vector<int> source_position = params_quark[iq].lookup(
"Source").get_int_vector(
"source_position");
232 for (
int mu = 0; mu < Ndim; ++mu) {
233 vout.
general(
vl,
" source_position[%d] = %d\n", mu, source_position[mu]);
248 for (
int iq = 0; iq < N_quark; ++iq) {
249 std::string str_solver_type = params_quark[iq].lookup(
"Solver").get_string(
"solver_type");
251 if (str_solver_type ==
"CG") {
257 if ((Nsmear > 0) && (str_proj_type ==
"Stout_SU3")) {
264 if ((str_gfix_type ==
"Coulomb") || (str_gfix_type ==
"Landau")) {
278 if (str_gconf_status ==
"Continue") {
280 }
else if (str_gconf_status ==
"Cold_start") {
282 }
else if (str_gconf_status ==
"Hot_start") {
285 vout.
crucial(
vl,
"Error at %s: unsupported gconf status \"%s\"\n",
test_name.c_str(), str_gconf_status.c_str());
291 for (
int i_dir = 0; i_dir < Ndim; ++i_dir) {
292 for (
int i_shift = 0; i_shift < Nshift_origin[i_dir]; ++i_shift) {
294 shift.backward(Ushift, U, i_dir);
301 unique_ptr<Projection> proj(Projection::New(str_proj_type, params_all.
lookup(
"Projection")));
302 unique_ptr<Smear> smear(Smear::New(str_smear_type, proj.get(), params_all.
lookup(
"Smear")));
303 unique_ptr<Director_Smear> dr_smear(
new Director_Smear(smear.get(), params_all.
lookup(
"Director_Smear")));
304 dr_smear->set_config(&U);
306 const Field_G *Usmear = (
Field_G *)dr_smear->getptr_smearedConfig(Nsmear);
315 unique_ptr<GaugeFixing> gfix(GaugeFixing::New(str_gfix_type, params_all.
lookup(
"GaugeFixing")));
323 unique_ptr<GammaMatrixSet> gmset(GammaMatrixSet::New(str_gmset_type));
327 unique_ptr<Fopr> fopr;
328 unique_ptr<Solver>
solver;
329 unique_ptr<Fprop> fprop;
330 unique_ptr<Source> source;
333 std::vector<QuarkType> quark(N_quark);
335 for (
int iq = 0; iq < N_quark; ++iq) {
340 quark[iq].fopr.reset(Fopr::New(params_fopr.
get_string(
"fermion_type"),
342 quark[iq].fopr->set_config(&U);
344 quark[iq].solver.reset(Solver::New(params_solver.
get_string(
"solver_type"),
345 quark[iq].fopr.get(),
350 quark[iq].source.reset(Source::New(params_source.
get_string(
"source_type"),
362 typedef std::vector<Field_F> PropagatorSet;
363 std::vector<PropagatorSet> sq(N_quark);
364 for (
int iq = 0; iq < N_quark; ++iq) {
365 sq[iq].resize(Nc * Nd);
367 for (
int i_cd = 0; i_cd < Nc * Nd; ++i_cd) {
368 sq[iq][i_cd].set(0.0);
372 for (
int iq = 0; iq < N_quark; ++iq) {
373 vout.
general(
vl,
"Solving quark propagator, flavor = %d:\n", iq + 1);
376 for (
int ispin = 0; ispin < Nd; ++ispin) {
377 for (
int icolor = 0; icolor < Nc; ++icolor) {
378 int i_cd = icolor + Nc * ispin;
381 quark[iq].source->
set(b, i_cd);
385 quark[iq].fprop->invert_D(sq[iq][i_cd], b, Nconv, diff);
388 quark[iq].fopr->set_mode(
"D");
389 quark[iq].fopr->mult(y, sq[iq][i_cd]);
394 icolor, ispin, Nconv, diff, diff2);
403 std::vector<double> result(N_quark);
408 for (
int iq = 0; iq < N_quark; ++iq) {
409 vout.
general(
vl,
"Flavor combination = %d, %d\n", iq + 1, iq + 1);
410 result[iq] = corr.
meson_all(sq[iq], sq[iq]);
415 for (
int iq = 0; iq < N_quark; ++iq) {
416 for (
int jq = iq + 1; jq < N_quark; ++jq) {
417 vout.
general(
vl,
"Flavor combination = %d, %d\n", iq + 1, jq + 1);
418 double result_2 = corr.
meson_all(sq[iq], sq[jq]);