35 multi1d<int> boundary;
36 multi1d<int> rng_seed;
41 int gauge_file_format;
54 multi1d<Real> szin_pion;
62 XMLReader
reader(filename);
74 if (
reader.count(
"/params/SZINEValues") > 0 ) {
79 for(
int i=0;
i <
params.lambda.size();
i++) {
85 else if (
reader.count(
"/params/eValues") > 0 ) {
108 if(
reader.count(
"/params/zolotarev/approxMin") == 1 ) {
115 if(
reader.count(
"/params/zolotarev/approxMax") == 1 ) {
130 if(
reader.count(
"/params/checking/szinPion") == 1 ) {
133 QDP_error_exit(
"Comparison pion has wrong no of timeslices. Nrow[3] = %d szin_pion.size() = %d",
params.nrow[3],
params.szin_pion.size());
138 params.szin_pion.resize(0);
149 push(writer,
"params");
150 push(writer,
"lattice");
158 if(
params.lambda.size() > 0 ) {
161 push(writer,
"eValues");
166 push(writer,
"SZINEValues");
167 multi1d<Real> szin_lambda(
params.lambda);
168 Real szin_lambda_max =
params.lambda_max;
170 for(
int i = 0;
i <
params.lambda.size();
i++) {
171 szin_lambda[
i] /= (Real(
Nd) +
params.wilson_mass);
173 szin_lambda_max /= (Real(
Nd) +
params.wilson_mass);
175 write(writer,
"lambda", szin_lambda);
176 write(writer,
"lambdaMax", szin_lambda_max);
180 push(writer,
"eValues");
187 write(writer,
"startType",
params.gauge_start_type);
189 write(writer,
"gaugeFileFormat",
params.gauge_file_format);
190 write(writer,
"gaugeFilename",
params.gauge_filename);
194 push(writer,
"zolotarev");
196 if(
params.approx_min > 0 ) {
200 if(
params.approx_max > 0 ) {
210 push(writer,
"qprop");
215 if(
params.szin_pion.size() > 0 ) {
216 push(writer,
"checking");
245 const multi1d<Real>& lambda_lo,
246 multi1d<LatticeFermion>& eigen_vec,
247 const Real wilson_mass,
262 eigen_vec.resize(lambda_lo.size());
265 multi1d<Real> e_norms(lambda_lo.size());
266 multi1d<Real> evec_norms(lambda_lo.size());
268 for(
int i = 0;
i < lambda_lo.size();
i++) {
271 std::ostringstream filename;
275 filename << root_prefix <<
"eigenvector_" << std::setw(3) << std::setfill(
'0') <<
i;
278 std::cout <<
"Reading eigenstd::vector: " << filename.str() << std::endl;
282 evec_norms[
i] = (Real)sqrt(norm2(eigen_vec[
i]));
285 LatticeFermion D_ev, tmp_ev, lambda_e;
288 (*D_w)(tmp_ev, eigen_vec[
i],
PLUS);
290 D_ev = Gamma(15)*tmp_ev;
293 lambda_e = lambda_lo[
i]*eigen_vec[
i];
297 e_norms[
i] = (Real)sqrt(norm2(D_ev));
299 push(xml_out,
"Eigenstd::vectorTest");
300 push(xml_out,
"EigenVecNorms");
301 write(xml_out,
"evec_norms", evec_norms);
303 push(xml_out,
"EigenTestNorms");
304 write(xml_out,
"e_norms", e_norms);
308 multi1d<Real> szin_enorms(e_norms);
309 for(
int i=0;
i < lambda_lo.size();
i++) {
310 szin_enorms[
i] /= (Real(
Nd)+wilson_mass);
312 push(xml_out,
"SZINEigenTestNorms");
313 write(xml_out,
"szin_enorms",szin_enorms);
319 int main(
int argc,
char **argv)
327 root_prefix += argv[1];
338 QDPIO::cerr <<
"Caught exception " <<
s << std::endl;
344 Layout::setLattSize(
params.nrow);
348 XMLFileWriter xml_out(root_prefix+
"t_ovlap_double_pass.xml");
349 push(xml_out,
"overlapTest");
358 multi1d<LatticeColorMatrix>
u(
Nd);
362 for(
int j = 0;
j <
Nd;
j++) {
368 for(
int j=0;
j <
Nd;
j++) {
382 push(xml_out,
"GaugeInfo");
388 std::cerr <<
"Error: " << e << std::endl;
397 readArchiv(nersc_xml,
u,
params.gauge_filename);
400 push(xml_out,
"GaugeInfo");
401 xml_out << nersc_xml;
406 std::cerr <<
"Error: " << e << std::endl;
412 std::ostringstream file_read_error;
413 file_read_error <<
"Unknown gauge file format" <<
params.gauge_file_format ;
414 throw file_read_error.str();
418 std::ostringstream startup_error;
419 startup_error <<
"Unknown start type " <<
params.gauge_start_type <<std::endl;
420 throw startup_error.str();
425 MesPlq(xml_out,
"Observables",
u);
435 XMLBufferWriter my_writer;
438 Zolotarev4DFermAct S(fbc, S_w,
449 multi1d<LatticeFermion> eigen_vecs;
455 if(
params.lambda.size() == 0 ) {
458 connect_state_ptr = S.createState(
u,
479 connect_state_ptr = S.createState(
u,
539 LatticeFermion s1, s2, s3,
tmp2;
553 tmp2 *= ( Real(1) +
params.quark_mass )/Real(2);
562 Double gwr_norm = sqrt(norm2(s3));
563 std::cout <<
"GWR Norm: " << gwr_norm << std::endl;
564 write(xml_out,
"gwr_norm", gwr_norm);
569 Zolotarev4DFermAct S_dp(fbc, S_w,
581 LatticeFermion psi_dp;
583 QDP::StopWatch swatch;
590 Double t1 = swatch.getTimeInSeconds();
591 QDPIO::cout <<
"Single Pass algorithm took " << t1 <<
" seconds" << std::endl;
598 t1 = swatch.getTimeInSeconds();
599 QDPIO::cout <<
"Double Pass algorithm took " << t1 <<
" seconds" << std::endl;
605 QDPIO::cout <<
"Diff between single and double passes = " << sqrt(diff) << std::endl;
614 psi_dp = Gamma(
G5)*
psi;
620 psi /= Real(norm_psi);
633 t1 = swatch.getTimeInSeconds();
634 QDPIO::cout <<
"Single Pass algorithm took " << t1 <<
" seconds" << std::endl;
641 t1 = swatch.getTimeInSeconds();
642 QDPIO::cout <<
"Double Pass algorithm took " << t1 <<
" seconds" << std::endl;
648 QDPIO::cout <<
"Diff between single and double passes = " << sqrt(diff) << std::endl;
655 psi_dp = Gamma(
G5)*
psi;
660 norm_psi=sqrt(norm2(
psi));
661 psi /= Real(norm_psi);
673 t1 = swatch.getTimeInSeconds();
674 QDPIO::cout <<
"Single Pass algorithm took " << t1 <<
" seconds" << std::endl;
679 (*MdagM_ch2_dp)(s2,
psi,
PLUS);
681 t1 = swatch.getTimeInSeconds();
682 QDPIO::cout <<
"Double Pass algorithm took " << t1 <<
" seconds" << std::endl;
688 QDPIO::cout <<
"Diff between single and double passes = " << sqrt(diff) << std::endl;
Primary include file for CHROMA in application codes.
Support class for fermion actions and linear operators.
virtual FermState< T, P, Q > * createState(const Q &q) const
Given links (coordinates Q) create the state needed for the linear operators.
Class for counted reference semantics.
Concrete class for all gauge actions with simple boundary conditions.
Unpreconditioned Wilson fermion action.
UnprecLinearOperator< T, P, Q > * linOp(Handle< FermState< T, P, Q > > state) const
Produce a linear operator for this action.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams ¶m)
Read parameters.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams ¶m)
Writer parameters.
void readSzinFerm(LatticeFermion &q, const std::string &file)
Read a SZIN fermion. This is a simple memory dump reader.
void readSzin(SzinGauge_t &header, multi1d< LatticeColorMatrix > &u, const std::string &cfg_file)
Read a SZIN configuration file.
@ OVERLAP_INNER_CG_DOUBLE_PASS
@ OVERLAP_INNER_CG_SINGLE_PASS
Handle< FermBC< LatticeStaggeredFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > > reader(XMLReader &xml_in, const std::string &path)
Helper function for the FermionAction readers.
Asqtad Staggered-Dirac operator.
QDP_error_exit("too many BiCG iterations", n_count, rsd_sq, cp, c, re_rvr, im_rvr, re_a, im_a, re_b, im_b)
static multi1d< LatticeColorMatrix > u
push(xml_out,"Condensates")
void initialize(int *argc, char ***argv)
Chroma initialisation routine.
void finalize(void)
Chroma finalization routine.
Chirality isChiralVector(const LatticeFermion &chi)
void reunit(LatticeColorMatrixF3 &xa)
void MesPlq(const multi1d< LatticeColorMatrixF3 > &u, multi2d< Double > &plane_plaq, Double &link)
multi1d< LatticeFermion > s(Ncb)
FloatingPoint< double > Double
Parameters for running program.
void readParams(const std::string &filename, Param_t ¶ms)
int main(int argc, char **argv)
void dumpParams(XMLWriter &writer, Param_t ¶ms)
void readEigenVecs(const multi1d< LatticeColorMatrix > &u, const UnprecWilsonFermAct &S_aux, const multi1d< Real > &lambda_lo, multi1d< LatticeFermion > &eigen_vec, const Real wilson_mass, const bool szin_eig, XMLWriter &xml_out, const std::string &root_prefix)
Read in the old SZIN eigenvectors.