41 namespace Test_Spectrum {
42 const std::string
test_name =
"Spectrum.Hadron2ptFunction_eo";
65 #ifdef USE_TESTMANAGER_AUTOREGISTER
67 #if defined(USE_GROUP_SU2)
71 "Spectrum.Clover.Hadron2ptFunction_eo",
97 const int N_quark = params_test.
get_int(
"number_of_valence_quarks");
99 const string str_gconf_status = params_test.
get_string(
"gauge_config_status");
100 const string str_gconf_read = params_test.
get_string(
"gauge_config_type_input");
101 const string readfile = params_test.
get_string(
"config_filename_input");
102 const string str_rand_type = params_test.
get_string(
"random_number_type");
103 const unsigned long seed = params_test.
get_unsigned_long(
"seed_for_random_number");
104 const string str_vlevel = params_test.
get_string(
"verbose_level");
106 const bool do_check = params_test.
is_set(
"expected_result");
107 const double expected_result = do_check ? params_test.
get_double(
"expected_result") : 0.0;
109 const string str_gfix_type = params_all.
lookup(
"GaugeFixing").
get_string(
"gauge_fixing_type");
110 const string str_proj_type = params_all.
lookup(
"Projection").
get_string(
"projection_type");
111 const string str_smear_type = params_all.
lookup(
"Smear").
get_string(
"smear_type");
112 const string str_solver_type = params_all.
lookup(
"Solver").
get_string(
"solver_type");
117 vout.
general(vl,
" gconf_status = %s\n", str_gconf_status.c_str());
118 vout.
general(vl,
" gconf_read = %s\n", str_gconf_read.c_str());
119 vout.
general(vl,
" readfile = %s\n", readfile.c_str());
120 vout.
general(vl,
" rand_type = %s\n", str_rand_type.c_str());
122 vout.
general(vl,
" vlevel = %s\n", str_vlevel.c_str());
123 vout.
general(vl,
" gfix_type = %s\n", str_gfix_type.c_str());
124 vout.
general(vl,
" proj_type = %s\n", str_proj_type.c_str());
125 vout.
general(vl,
" smear_type = %s\n", str_smear_type.c_str());
126 vout.
general(vl,
" solver_type = %s\n", str_solver_type.c_str());
128 vector<Parameters> params_quark;
130 for (
int iq = 0; iq < N_quark; ++iq) {
132 params_quark.push_back(params_all.
lookup(qlabel));
136 string str_gmset_type = params_quark[0].lookup(
"Fopr").get_string(
"gamma_matrix_type");
137 vout.
general(vl,
" gmset_type = %s\n", str_gmset_type.c_str());
139 for (
int iq = 0; iq < N_quark; ++iq) {
142 params_quark[iq].lookup(
"Source").get_string(
"source_type").c_str());
144 vector<int> pos = params_quark[iq].lookup(
"Source").get_int_vector(
"source_position");
146 for (
int mu = 0; mu < Ndim; ++mu) {
147 vout.
general(vl,
" source_position[%d] = %d\n", mu, pos[mu]);
161 if (str_solver_type ==
"CG") {
162 vout.
crucial(vl,
"Error at %s: CG can not be adopted. Use CGNE,CGNR, instead.\n",
test_name.c_str());
172 if (str_gconf_status ==
"Continue") {
174 }
else if (str_gconf_status ==
"Cold_start") {
176 }
else if (str_gconf_status ==
"Hot_start") {
179 vout.
crucial(vl,
"Error at %s: unsupported gconf status \"%s\"\n",
test_name.c_str(), str_gconf_status.c_str());
202 gfix->
fix(*Ufix, *Usmear);
211 std::vector<unique_ptr<Fopr> > fopr(N_quark);
212 std::vector<unique_ptr<Fopr> > fopr_eo(N_quark);
213 std::vector<unique_ptr<Solver> > solver(N_quark);
214 std::vector<unique_ptr<Fprop> > fprop_eo(N_quark);
215 std::vector<unique_ptr<Source> > source(N_quark);
219 for (
int iq = 0; iq < N_quark; ++iq) {
220 string str_fopr_type = params_quark[iq].lookup(
"Fopr").get_string(
"fermion_type");
222 fopr[iq].reset(Fopr::New(str_fopr_type, str_gmset_type));
223 fopr[iq]->set_parameters(params_quark[iq].lookup(
"Fopr"));
224 fopr[iq]->set_config(U);
226 fopr_eo[iq].reset(Fopr::New(str_fopr_type +
"_eo", str_gmset_type));
227 fopr_eo[iq]->set_parameters(params_quark[iq].lookup(
"Fopr"));
228 fopr_eo[iq]->set_config(U);
230 solver[iq].reset(Solver::New(str_solver_type, fopr_eo[iq]));
231 solver[iq]->set_parameters(params_all.
lookup(
"Solver"));
235 string str_source_type = params_quark[iq].lookup(
"Source").get_string(
"source_type");
236 source[iq].reset(Source::New(str_source_type));
237 source[iq]->set_parameters(params_quark[iq].lookup(
"Source"));
240 std::vector<Fopr *> fopr(N_quark);
241 std::vector<Fopr *> fopr_eo(N_quark);
242 std::vector<Solver *> solver(N_quark);
243 std::vector<Fprop *> fprop_eo(N_quark);
244 std::vector<Source *> source(N_quark);
248 for (
int iq = 0; iq < N_quark; ++iq) {
249 string str_fopr_type = params_quark[iq].lookup(
"Fopr").get_string(
"fermion_type");
251 fopr[iq] = Fopr::New(str_fopr_type, str_gmset_type);
252 fopr[iq]->set_parameters(params_quark[iq].lookup(
"Fopr"));
253 fopr[iq]->set_config(U);
255 fopr_eo[iq] = Fopr::New(str_fopr_type +
"_eo", str_gmset_type);
256 fopr_eo[iq]->set_parameters(params_quark[iq].lookup(
"Fopr"));
257 fopr_eo[iq]->set_config(U);
259 solver[iq] = Solver::New(str_solver_type, fopr_eo[iq]);
260 solver[iq]->set_parameters(params_all.
lookup(
"Solver"));
264 string str_source_type = params_quark[iq].lookup(
"Source").get_string(
"source_type");
265 source[iq] = Source::New(str_source_type);
266 source[iq]->set_parameters(params_quark[iq].lookup(
"Source"));
279 typedef std::vector<Field_F> PropagatorSet;
281 std::vector<PropagatorSet> sq(N_quark);
282 for (
int iq = 0; iq < N_quark; ++iq) {
283 sq[iq].resize(Nc * Nd);
285 for (
int i = 0; i < Nc * Nd; ++i) {
296 for (
int iq = 0; iq < N_quark; ++iq) {
297 vout.
general(vl,
"Solving quark propagator, flavor = %d:\n", iq + 1);
298 vout.
general(vl,
" color spin Nconv diff diff2\n");
300 for (
int ispin = 0; ispin < Nd; ++ispin) {
301 for (
int icolor = 0; icolor < Nc; ++icolor) {
302 int idx = icolor + Nc * ispin;
303 source[iq]->set(b, idx);
305 fprop_eo[iq]->invert_D(sq[iq][idx], b, Nconv, diff);
308 fopr[iq]->set_mode(
"D");
309 fopr[iq]->mult(y, sq[iq][idx]);
314 icolor, ispin, Nconv, diff, diff2);
323 std::vector<double> result(N_quark);
328 for (
int iq = 0; iq < N_quark; ++iq) {
329 vout.
general(vl,
"Flavor combination = %d, %d\n", iq + 1, iq + 1);
330 result[iq] = corr.
meson_all(sq[iq], sq[iq]);
336 for (
int iq = 0; iq < N_quark; ++iq) {
337 for (
int jq = iq + 1; jq < N_quark; ++jq) {
338 vout.
general(vl,
"Flavor combination = %d, %d\n", iq + 1, jq + 1);
339 double result_2 = corr.
meson_all(sq[iq], sq[jq]);
351 for (
int iq = 0; iq < N_quark; ++iq) {
366 vout.
detailed(vl,
"check skipped: expected_result not set.\n\n");
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
int hadron_2ptFunction_eo(const std::string &)
void general(const char *format,...)
Two-point correlator for Wilson-type fermions.
virtual void set_parameters(const Parameters &)=0
int get_int(const string &key) const
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)
Field * getptr_smearedConfig(int i_smear)
get pointer to i-th smeared config (0th is original thin link)
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
Get quark propagator for Fopr with even-odd site index.
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
void set_config(Field *U)
set pointer to original thin link variable
int get_Nsmear()
get number of applied smearing operation
void crucial(const char *format,...)
static void read(const std::string ¶ms_file, Parameters ¶ms)
int hadron_2ptFunction_eo_Clover()
Manager of smeared configurations.
int verify(const double result, const double expected, double eps)
const std::string test_name
int hadron_2ptFunction_eo_Wilson()
void set_parameters(const Parameters ¶ms)
set parameters, must be called before set_config
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
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