54 namespace Test_Spectrum {
55 const std::string
test_name =
"Spectrum.Hadron2ptFunction_eo_withFileIO";
81 #ifdef USE_TESTMANAGER_AUTOREGISTER
83 #if defined(USE_GROUP_SU2)
87 "Spectrum.Clover.Hadron2ptFunction_eo_withFileIO",
134 const int N_quark = params_test.
get_int(
"number_of_valence_quarks");
136 const string str_gconf_status = params_test.
get_string(
"gauge_config_status");
137 const string str_gconf_read = params_test.
get_string(
"gauge_config_type_input");
138 const string readfile = params_test.
get_string(
"config_filename_input");
139 const string str_rand_type = params_test.
get_string(
"random_number_type");
140 const unsigned long seed = params_test.
get_unsigned_long(
"seed_for_random_number");
141 const string str_vlevel = params_test.
get_string(
"verbose_level");
143 const string str_gfix_type = params_all.
lookup(
"GaugeFixing").
get_string(
"gauge_fixing_type");
144 const string str_proj_type = params_all.
lookup(
"Projection").
get_string(
"projection_type");
145 const string str_smear_type = params_all.
lookup(
"Smear").
get_string(
"smear_type");
146 const string str_solver_type = params_all.
lookup(
"Solver").
get_string(
"solver_type");
152 vout.
general(vl,
" gconf_status = %s\n", str_gconf_status.c_str());
153 vout.
general(vl,
" gconf_read = %s\n", str_gconf_read.c_str());
154 vout.
general(vl,
" readfile = %s\n", readfile.c_str());
155 vout.
general(vl,
" rand_type = %s\n", str_rand_type.c_str());
157 vout.
general(vl,
" vlevel = %s\n", str_vlevel.c_str());
158 vout.
general(vl,
" gfix_type = %s\n", str_gfix_type.c_str());
159 vout.
general(vl,
" proj_type = %s\n", str_proj_type.c_str());
160 vout.
general(vl,
" smear_type = %s\n", str_smear_type.c_str());
161 vout.
general(vl,
" solver_type = %s\n", str_solver_type.c_str());
163 vector<Parameters> params_quark;
165 for (
int iq = 0; iq < N_quark; ++iq) {
167 params_quark.push_back(params_all.
lookup(qlabel));
171 const string str_gmset_type = params_quark[0].lookup(
"Fopr").get_string(
"gamma_matrix_type");
172 vout.
general(vl,
" gmset_type = %s\n", str_gmset_type.c_str());
174 std::vector<std::string> savefile_base(N_quark);
175 for (
int iq = 0; iq < N_quark; ++iq) {
176 savefile_base[iq] = params_quark[iq].get_string(
"temporary_filename_base");
179 for (
int iq = 0; iq < N_quark; ++iq) {
180 string str_source_type = params_quark[iq].lookup(
"Source").get_string(
"source_type");
181 vector<int> source_position = params_quark[iq].lookup(
"Source").get_int_vector(
"source_position");
184 vout.
general(vl,
" savefile_base[iq] = %s[%d]\n", savefile_base[iq].c_str(), iq);
185 vout.
general(vl,
" source_type = %s\n", str_source_type.c_str());
186 for (
int mu = 0; mu < Ndim; ++mu) {
187 vout.
general(vl,
" source_position[%d] = %d\n", mu, source_position[mu]);
202 if (str_solver_type ==
"CG") {
203 vout.
crucial(vl,
"Error at %s: CG can not be adopted. Use CGNE,CGNR, instead.\n",
test_name.c_str());
213 if (str_gconf_status ==
"Continue") {
215 }
else if (str_gconf_status ==
"Cold_start") {
217 }
else if (str_gconf_status ==
"Hot_start") {
220 vout.
crucial(vl,
"Error at %s: unsupported gconf status \"%s\"\n",
test_name.c_str(), str_gconf_status.c_str());
243 gfix->
fix(*Ufix, *Usmear);
252 std::vector<unique_ptr<Fopr> > fopr(N_quark);
253 std::vector<unique_ptr<Fopr> > fopr_eo(N_quark);
254 std::vector<unique_ptr<Solver> > solver(N_quark);
255 std::vector<unique_ptr<Fprop> > fprop_eo(N_quark);
256 std::vector<unique_ptr<Source> > source(N_quark);
260 for (
int iq = 0; iq < N_quark; ++iq) {
261 string str_fopr_type = params_quark[iq].lookup(
"Fopr").get_string(
"fermion_type");
263 fopr[iq].reset(Fopr::New(str_fopr_type, str_gmset_type));
264 fopr[iq]->set_parameters(params_quark[iq].lookup(
"Fopr"));
265 fopr[iq]->set_config(U);
267 fopr_eo[iq].reset(Fopr::New(str_fopr_type +
"_eo", str_gmset_type));
268 fopr_eo[iq]->set_parameters(params_quark[iq].lookup(
"Fopr"));
269 fopr_eo[iq]->set_config(U);
271 solver[iq].reset(Solver::New(str_solver_type, fopr_eo[iq]));
272 solver[iq]->set_parameters(params_all.
lookup(
"Solver"));
276 string str_source_type = params_quark[iq].lookup(
"Source").get_string(
"source_type");
277 source[iq].reset(Source::New(str_source_type));
278 source[iq]->set_parameters(params_quark[iq].lookup(
"Source"));
281 std::vector<Fopr *> fopr(N_quark);
282 std::vector<Fopr *> fopr_eo(N_quark);
283 std::vector<Solver *> solver(N_quark);
284 std::vector<Fprop *> fprop_eo(N_quark);
285 std::vector<Source *> source(N_quark);
289 for (
int iq = 0; iq < N_quark; ++iq) {
290 string str_fopr_type = params_quark[iq].lookup(
"Fopr").get_string(
"fermion_type");
292 fopr[iq] = Fopr::New(str_fopr_type, str_gmset_type);
293 fopr[iq]->set_parameters(params_quark[iq].lookup(
"Fopr"));
294 fopr[iq]->set_config(U);
296 fopr_eo[iq] = Fopr::New(str_fopr_type +
"_eo", str_gmset_type);
297 fopr_eo[iq]->set_parameters(params_quark[iq].lookup(
"Fopr"));
298 fopr_eo[iq]->set_config(U);
300 solver[iq] = Solver::New(str_solver_type, fopr_eo[iq]);
301 solver[iq]->set_parameters(params_all.
lookup(
"Solver"));
305 string str_source_type = params_quark[iq].lookup(
"Source").get_string(
"source_type");
306 source[iq] = Source::New(str_source_type);
307 source[iq]->set_parameters(params_quark[iq].lookup(
"Source"));
322 for (
int iq = 0; iq < N_quark; ++iq) {
323 vout.
general(vl,
"Solving quark propagator, flavor = %d:\n", iq + 1);
324 vout.
general(vl,
" color spin Nconv diff diff2\n");
326 for (
int ispin = 0; ispin < Nd; ++ispin) {
327 for (
int icolor = 0; icolor < Nc; ++icolor) {
328 int idx = icolor + Nc * ispin;
329 source[iq]->set(b, idx);
331 fprop_eo[iq]->invert_D(xq, b, Nconv, diff);
334 fopr[iq]->set_mode(
"D");
335 fopr[iq]->mult(y, xq);
340 icolor, ispin, Nconv, diff, diff2);
354 for (
int iq = 0; iq < N_quark; ++iq) {
380 const int N_quark = params_test.
get_int(
"number_of_valence_quarks");
382 const string str_vlevel = params_test.
get_string(
"verbose_level");
384 const bool do_check = params_test.
is_set(
"expected_result");
385 const double expected_result = do_check ? params_test.
get_double(
"expected_result") : 0.0;
387 std::vector<std::string> savefile_base(N_quark);
389 for (
int iq = 0; iq < N_quark; ++iq) {
396 vout.
general(vl,
" vlevel = %s\n", str_vlevel.c_str());
400 vout.
general(vl,
" gmset_type = %s\n", str_gmset_type.c_str());
402 std::vector<std::string> str_source_type(N_quark);
404 for (
int iq = 0; iq < N_quark; ++iq) {
408 vout.
general(vl,
" source_type = %s\n", str_source_type[iq].c_str());
410 vout.
general(vl,
" savefile_base[iq] = %s[%d]\n", savefile_base[iq].c_str(), iq);
425 typedef std::vector<Field_F> PropagatorSet;
427 std::vector<PropagatorSet> sq(N_quark);
428 for (
int iq = 0; iq < N_quark; ++iq) {
429 sq[iq].resize(Nc * Nd);
431 for (
int i = 0; i < Nc * Nd; ++i) {
437 for (
int iq = 0; iq < N_quark; ++iq) {
438 for (
int ispin = 0; ispin < Nd; ++ispin) {
439 for (
int icolor = 0; icolor < Nc; ++icolor) {
440 int idx = icolor + Nc * ispin;
443 field_io->
read_file(&sq[iq][idx], filename);
450 std::vector<double> result(N_quark);
455 for (
int iq = 0; iq < N_quark; ++iq) {
456 vout.
general(vl,
"Flavor combination = %d, %d\n", iq + 1, iq + 1);
457 result[iq] = corr.
meson_all(sq[iq], sq[iq]);
463 for (
int iq = 0; iq < N_quark; ++iq) {
464 for (
int jq = iq + 1; jq < N_quark; ++jq) {
465 vout.
general(vl,
"Flavor combination = %d, %d\n", iq + 1, jq + 1);
466 double result_2 = corr.
meson_all(sq[iq], sq[jq]);
483 vout.
detailed(vl,
"check skipped: expected_result not set.\n\n");
int hadron_2ptFunction_eo_withFileIO_Clover()
int hadron_2ptFunction_eo_withFileIO_Wilson()
int calculate_hadron_correlator_eo_withFileIO(const std::string &)
int hadron_2ptFunction_eo_withFileIO(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,...)
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
int calculate_quark_propagator_eo_withFileIO(const std::string &)
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
std::string generate_filename(const char *fmt,...)
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)
Manager of smeared configurations.
int verify(const double result, const double expected, double eps)
FieldIO_Binary class for file I/O of Field data in binary format.
const std::string test_name
virtual void read_file(Field *v, std::string)=0
read data from file.
virtual void write_file(Field *v, std::string)=0
write data to file.
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