35 multi1d<int> boundary;
36 multi1d<int> rng_seed;
41 int gauge_file_format;
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.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,
447 multi1d<LatticeFermion> eigen_vecs;
453 if(
params.lambda.size() == 0 ) {
456 connect_state_ptr = S.createState(
u,
477 connect_state_ptr = S.createState(
u,
537 LatticeFermion s1, s2, s3,
tmp2;
550 tmp2 *= ( Real(1) +
params.quark_mass )/Real(2);
559 Double gwr_norm = sqrt(norm2(s3));
560 std::cout <<
"GWR Norm: " << gwr_norm << std::endl;
561 write(xml_out,
"gwr_norm", gwr_norm);
567 std::cout <<
"MdagM created" << std::endl;
577 Double internal_norm = sqrt(norm2(s3));
578 std::cout <<
" || MdagM - M^{dag}M || = " << internal_norm << std::endl;
579 write(xml_out,
"internal_norm", internal_norm);
585 LatticeFermion source;
589 for(
int i = 0;
i < Ns;
i++) {
595 std::cout <<
"Ns = " <<
i <<
" : No definite chirality" <<std::endl;
598 std::cout <<
"Ns = " <<
i <<
" : Chirality is positive " << std::endl;
601 std::cout <<
"Ns = " <<
i <<
" : Chirality is negative " << std::endl;
614 Complex cone = cmplx(Real(1), Real(0));
617 pokeColor(
c, cone, 0);
625 pokeSite(source, f,
coord);
627 std::cout <<
"(1,0,1,0) has chirality " <<
isChiralVector(source) << std::endl;
630 std::cout <<
"Gaussian source has chirality: " <<
isChiralVector(source) << std::endl;
632 int G5 = Ns * Ns - 1;
634 s1 = 0.5*(source + Gamma(
G5)*source);
635 s2 = 0.5*(source - Gamma(
G5)*source);
637 std::cout <<
"+ve chirality projection has chirality: " <<
isChiralVector(s1) << std::endl;
638 std::cout <<
"-ve chirality projection has chirality: " <<
isChiralVector(s2) << std::endl;
642 for(
int i = 0;
i < Ns;
i++ ) {
649 (*MdagM)(s1, source,
PLUS);
650 (*MdagM_ch)(s2, source,
PLUS);
653 std::cout <<
"Spin Comp: " <<
i <<
": || M dag M - lovddag || = " << sqrt(norm2(s3)) << std::endl;
657 std::cout <<
"Now non chiral work. Should get back Normal MdagM" << std::endl;
664 (*MdagM)(s1, source,
PLUS);
665 (*MdagM2)(s2, source,
PLUS);
667 std::cout <<
"Non Chiral Source: || M dag M - MdagM(chi=0) || = " << sqrt(norm2(s3)) << std::endl;
670 std::cout <<
"Beginning qprop test" << std::endl;
671 std::cout <<
"Chiral Sources" << std::endl;
782 multi1d<Real> shifts(3);
790 LatticePropagator multi_q_src;
793 multi1d<LatticePropagator> multi_q_sol(3);
795 for(
int spin=0; spin < Ns; spin++) {
796 for(
int col=0; col < Nc; col++) {
814 Zolotarev4DFermAct S_multi(fbc, S_w,
824 int qprop_ncount = 0;
828 multi1d<Real> rsd_cg_array(shifts.size());
829 rsd_cg_array =
params.rsd_cg;
831 multiQuarkProp4(multi_q_sol, xml_out, multi_q_src, S_multi,
832 connect_state, CG_INVERTER,
833 shifts, rsd_cg_array,
params.max_cg, qprop_ncount);
840 for(
int i = 0;
i < shifts.size();
i++) {
841 LatticeComplex corr_fn = trace(adj(multi_q_sol[
i])*multi_q_sol[
i]);
844 multi2d<DComplex> hsum = phases.
sft(corr_fn);
847 push(xml_out,
"pion");
848 write(xml_out,
"shifts_i", shifts[
i]);
849 write(xml_out,
"hsum", hsum[0]);
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.
Fourier transform phase factor support.
multi2d< DComplex > sft(const LatticeComplex &cf) const
Do a sumMulti(cf*phases,getSet())
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 FermToProp(const LatticeFermionF &a, LatticePropagatorF &b, int color_index, int spin_index)
Insert a LatticeFermion into a LatticePropagator.
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.
void srcfil(LatticeFermion &a, const multi1d< int > &coord, int color_index, int spin_index)
Fill a specific color and spin index with 1.0.
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.
multi1d< Real > szin_pion
Handle< LinearOperator< T > > MdagM
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.