68 const std::string
test_name =
"Spectrum.Hadron4ptFunction";
85 #ifdef USE_TESTMANAGER_AUTOREGISTER
87 #if defined(USE_GROUP_SU2)
91 "Spectrum.Clover.Hadron4ptFunction",
110 const int N_quark = params_test.
get_int(
"number_of_valence_quarks");
112 const std::string str_gconf_status = params_test.
get_string(
"gauge_config_status");
113 const std::string str_gconf_read = params_test.
get_string(
"gauge_config_type_input");
114 const std::string readfile = params_test.
get_string(
"config_filename_input");
115 const vector<int> Nshift_origin = params_test.
get_int_vector(
"shift_origin");
116 const std::string str_rand_type = params_test.
get_string(
"random_number_type");
117 const unsigned long seed = params_test.
get_unsigned_long(
"seed_for_random_number");
118 const std::string str_vlevel = params_test.
get_string(
"verbose_level");
120 const bool do_check = params_test.
is_set(
"expected_result");
121 const double expected_result = do_check ? params_test.
get_double(
"expected_result") : 0.0;
123 const std::string str_gfix_type = params_all.
lookup(
"GaugeFixing").
get_string(
"gauge_fixing_type");
124 const std::string str_proj_type = params_all.
lookup(
"Projection").
get_string(
"projection_type");
125 const std::string str_smear_type = params_all.
lookup(
"Smear").
get_string(
"smear_type");
126 const int Nsmear = params_all.
lookup(
"Director_Smear").
get_int(
"number_of_smearing");
131 vout.
general(
vl,
" gconf_status = %s\n", str_gconf_status.c_str());
132 vout.
general(
vl,
" gconf_read = %s\n", str_gconf_read.c_str());
134 for (
int mu = 0; mu < Ndim; ++mu) {
135 vout.
general(
vl,
" shift_origin[%d] = %d\n", mu, Nshift_origin[mu]);
137 vout.
general(
vl,
" rand_type = %s\n", str_rand_type.c_str());
140 vout.
general(
vl,
" gfix_type = %s\n", str_gfix_type.c_str());
141 vout.
general(
vl,
" proj_type = %s\n", str_proj_type.c_str());
142 vout.
general(
vl,
" smear_type = %s\n", str_smear_type.c_str());
144 vector<Parameters> params_quark;
146 for (
int iq = 0; iq < N_quark; ++iq) {
148 params_quark.push_back(params_all.
lookup(qlabel));
152 std::string str_gmset_type = params_quark[0].lookup(
"Fopr").get_string(
"gamma_matrix_type");
153 vout.
general(
vl,
" gmset_type = %s\n", str_gmset_type.c_str());
156 for (
int iq = 0; iq < N_quark; ++iq) {
159 params_quark[iq].lookup(
"Solver").get_string(
"solver_type").c_str());
161 params_quark[iq].lookup(
"Source").get_string(
"source_type").c_str());
163 vector<int> source_position = params_quark[iq].lookup(
"Source").get_int_vector(
"source_position");
164 for (
int mu = 0; mu < Ndim; ++mu) {
165 vout.
general(
vl,
" source_position[%d] = %d\n", mu, source_position[mu]);
180 for (
int iq = 0; iq < N_quark; ++iq) {
181 std::string str_solver_type = params_quark[iq].lookup(
"Solver").get_string(
"solver_type");
183 if (str_solver_type ==
"CG") {
194 if ((Nsmear > 0) && (str_proj_type ==
"Stout_SU3")) {
201 if ((str_gfix_type ==
"Coulomb") || (str_gfix_type ==
"Landau")) {
215 if (str_gconf_status ==
"Continue") {
217 }
else if (str_gconf_status ==
"Cold_start") {
219 }
else if (str_gconf_status ==
"Hot_start") {
222 vout.
crucial(
vl,
"Error at %s: unsupported gconf status \"%s\"\n",
test_name.c_str(), str_gconf_status.c_str());
229 for (
int i_dir = 0; i_dir < Ndim; ++i_dir) {
230 for (
int i_shift = 0; i_shift < Nshift_origin[i_dir]; ++i_shift) {
232 shift.backward(Ushift, U, i_dir);
240 unique_ptr<Projection> proj(Projection::New(str_proj_type, params_all.
lookup(
"Projection")));
241 unique_ptr<Smear> smear(Smear::New(str_smear_type, proj.get(), params_all.
lookup(
"Smear")));
242 unique_ptr<Director_Smear> dr_smear(
new Director_Smear(smear.get(), params_all.
lookup(
"Director_Smear")));
243 dr_smear->set_config(&U);
245 const Field_G *Usmear = (
Field_G *)dr_smear->getptr_smearedConfig(Nsmear);
253 unique_ptr<GaugeFixing> gfix(GaugeFixing::New(str_gfix_type, params_all.
lookup(
"GaugeFixing")));
260 unique_ptr<GammaMatrixSet> gmset(GammaMatrixSet::New(str_gmset_type));
264 unique_ptr<Fopr> fopr;
265 unique_ptr<Solver>
solver;
266 unique_ptr<Fprop> fprop;
267 unique_ptr<Source> source;
270 std::vector<QuarkType> quark(N_quark);
272 for (
int iq = 0; iq < N_quark; ++iq) {
277 quark[iq].fopr.reset(Fopr::New(params_fopr.
get_string(
"fermion_type"),
279 quark[iq].fopr->set_config(&U);
281 quark[iq].solver.reset(Solver::New(params_solver.
get_string(
"solver_type"),
282 quark[iq].fopr.get(),
287 quark[iq].source.reset(Source::New(params_source.
get_string(
"source_type"),
301 typedef std::vector<Field_F> PropagatorSet;
302 std::vector<PropagatorSet> sq(N_quark);
303 for (
int iq = 0; iq < N_quark; ++iq) {
304 sq[iq].resize(Nc * Nd);
306 for (
int i = 0; i < Nc * Nd; ++i) {
312 for (
int iq = 0; iq < N_quark; ++iq) {
313 vout.
general(
vl,
"Solving quark propagator, flavor = %d:\n", iq + 1);
316 for (
int ispin = 0; ispin < Nd; ++ispin) {
317 for (
int icolor = 0; icolor < Nc; ++icolor) {
318 int idx = icolor + Nc * ispin;
321 quark[iq].source->
set(b,
idx);
325 quark[iq].fprop->invert_D(sq[iq][
idx], b, Nconv, diff);
328 quark[iq].fopr->set_mode(
"D");
329 quark[iq].fopr->mult(y, sq[iq][
idx]);
334 icolor, ispin, Nconv, diff, diff2);
343 std::vector<double> result(N_quark / 2);
348 for (
int iq = 0; iq < N_quark; ++iq) {
349 for (
int jq = iq + 1; jq < N_quark; ++jq) {
350 vout.
general(
vl,
"Flavor combination = %d, %d\n", iq + 1, jq + 1);
351 result[iq] = corr_4pt.
meson_all(sq[iq], sq[iq], sq[jq], sq[jq]);
360 for (
int iq = 0; iq < N_quark; ++iq) {
361 vout.
general(
vl,
"Flavor combination = %d, %d\n", iq + 1, iq + 1);
362 double result_1 = corr_2pt.
meson_all(sq[iq], sq[iq]);
367 for (
int iq = 0; iq < N_quark; ++iq) {
368 for (
int jq = iq + 1; jq < N_quark; ++jq) {
369 vout.
general(
vl,
"Flavor combination = %d, %d\n", iq + 1, jq + 1);
370 double result_2 = corr_2pt.
meson_all(sq[iq], sq[jq]);