67 namespace Test_Spectrum {
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());
133 vout.
general(vl,
" readfile = %s\n", readfile.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());
139 vout.
general(vl,
" vlevel = %s\n", str_vlevel.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") {
184 vout.
crucial(vl,
"Error at %s: CG can not be adopted. Use CGNE,CGNR, instead.\n",
test_name.c_str());
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) {
261 gfix->
fix(*Ufix, *U);
270 std::vector<unique_ptr<Fopr> > fopr(N_quark);
271 std::vector<unique_ptr<Solver> >
solver(N_quark);
272 std::vector<unique_ptr<Fprop> > fprop_lex(N_quark);
273 std::vector<unique_ptr<Source> > source(N_quark);
275 for (
int iq = 0; iq < N_quark; ++iq) {
276 std::string str_fopr_type = params_quark[iq].lookup(
"Fopr").get_string(
"fermion_type");
277 fopr[iq].reset(Fopr::New(str_fopr_type, str_gmset_type));
278 fopr[iq]->set_parameters(params_quark[iq].lookup(
"Fopr"));
279 fopr[iq]->set_config(U);
281 std::string str_solver_type = params_quark[iq].lookup(
"Solver").get_string(
"solver_type");
282 solver[iq].reset(Solver::New(str_solver_type, fopr[iq]));
283 solver[iq]->set_parameters(params_quark[iq].lookup(
"Solver"));
287 std::string str_source_type = params_quark[iq].lookup(
"Source").get_string(
"source_type");
288 source[iq].reset(Source::New(str_source_type));
289 source[iq]->set_parameters(params_quark[iq].lookup(
"Source"));
292 std::vector<Fopr *> fopr(N_quark);
293 std::vector<Solver *>
solver(N_quark);
294 std::vector<Fprop *> fprop_lex(N_quark);
295 std::vector<Source *> source(N_quark);
297 for (
int iq = 0; iq < N_quark; ++iq) {
298 std::string str_fopr_type = params_quark[iq].lookup(
"Fopr").get_string(
"fermion_type");
299 fopr[iq] = Fopr::New(str_fopr_type, str_gmset_type);
300 fopr[iq]->set_parameters(params_quark[iq].lookup(
"Fopr"));
301 fopr[iq]->set_config(U);
303 std::string str_solver_type = params_quark[iq].lookup(
"Solver").get_string(
"solver_type");
304 solver[iq] = Solver::New(str_solver_type, fopr[iq]);
305 solver[iq]->set_parameters(params_quark[iq].lookup(
"Solver"));
309 std::string str_source_type = params_quark[iq].lookup(
"Source").get_string(
"source_type");
310 source[iq] = Source::New(str_source_type);
311 source[iq]->set_parameters(params_quark[iq].lookup(
"Source"));
327 typedef std::vector<Field_F> PropagatorSet;
328 std::vector<PropagatorSet> sq(N_quark);
329 for (
int iq = 0; iq < N_quark; ++iq) {
330 sq[iq].resize(Nc * Nd);
332 for (
int i = 0; i < Nc * Nd; ++i) {
338 for (
int iq = 0; iq < N_quark; ++iq) {
339 vout.
general(vl,
"Solving quark propagator, flavor = %d:\n", iq + 1);
340 vout.
general(vl,
" color spin Nconv diff diff2\n");
342 for (
int ispin = 0; ispin < Nd; ++ispin) {
343 for (
int icolor = 0; icolor < Nc; ++icolor) {
344 int idx = icolor + Nc * ispin;
347 source[iq]->
set(b, idx);
351 fprop_lex[iq]->invert_D(sq[iq][idx], b, Nconv, diff);
354 fopr[iq]->set_mode(
"D");
355 fopr[iq]->mult(y, sq[iq][idx]);
360 icolor, ispin, Nconv, diff, diff2);
369 std::vector<double> result(N_quark / 2);
374 for (
int iq = 0; iq < N_quark; ++iq) {
375 for (
int jq = iq + 1; jq < N_quark; ++jq) {
376 vout.
general(vl,
"Flavor combination = %d, %d\n", iq + 1, jq + 1);
377 result[iq] = corr_4pt.
meson_all(sq[iq], sq[iq], sq[jq], sq[jq]);
386 for (
int iq = 0; iq < N_quark; ++iq) {
387 vout.
general(vl,
"Flavor combination = %d, %d\n", iq + 1, iq + 1);
388 double result_1 = corr_2pt.
meson_all(sq[iq], sq[iq]);
393 for (
int iq = 0; iq < N_quark; ++iq) {
394 for (
int jq = iq + 1; jq < N_quark; ++jq) {
395 vout.
general(vl,
"Flavor combination = %d, %d\n", iq + 1, jq + 1);
396 double result_2 = corr_2pt.
meson_all(sq[iq], sq[jq]);
410 for (
int iq = 0; iq < N_quark; ++iq) {
413 delete fprop_lex[iq];
421 vout.
detailed(vl,
"check skipped: expected_result not set.\n\n");
int hadron_4ptFunction(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.
int hadron_4ptFunction_Clover()
virtual void set_parameters(const Parameters &)=0
virtual void set_parameters(const Parameters ¶ms)
int get_int(const string &key) const
Four-point correlator for Wilson-type fermions.
void copy(Field &y, const Field &x)
copy(y, x): y = x
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
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
Get quark propagator for Fopr with lexical site index.
void set_config(Field *U)
set pointer to original thin link variable
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)
const std::string test_name
Field * getptr_smearedConfig(const int i_smear)
get pointer to i-th smeared config (0th is original thin link)
double meson_all(const std::vector< Field_F > &sq1, const std::vector< Field_F > &sq2, const std::vector< Field_F > &sq3, const std::vector< Field_F > &sq4)
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