26 multi1d<int> boundary;
55 XMLReader
reader(filename);
67 if (
reader.count(
"/params/SZINEValues") > 0 ) {
72 for(
int i=0;
i <
params.lambda.size();
i++) {
78 else if (
reader.count(
"/params/eValues") > 0 ) {
101 if(
reader.count(
"/params/zolotarev/approxMin") == 1 ) {
108 if(
reader.count(
"/params/zolotarev/approxMax") == 1 ) {
124 read(
reader,
"/params/PsiBarPsi/SrcChirality", s_ch);
137 std::cerr <<
"Unknown value for SrcChirality " << s_ch << std::endl;
150 push(writer,
"params");
151 push(writer,
"lattice");
159 if(
params.lambda.size() > 0 ) {
162 push(writer,
"eValues");
167 push(writer,
"SZINEValues");
168 multi1d<Real> szin_lambda(
params.lambda);
169 Real szin_lambda_max =
params.lambda_max;
171 for(
int i = 0;
i <
params.lambda.size();
i++) {
172 szin_lambda[
i] /= (Real(
Nd) +
params.wilson_mass);
174 szin_lambda_max /= (Real(
Nd) +
params.wilson_mass);
176 write(writer,
"lambda", szin_lambda);
177 write(writer,
"lambdaMax", szin_lambda_max);
181 push(writer,
"eValues");
188 write(writer,
"startType",
params.gauge_start_type);
190 write(writer,
"gaugeFileFormat",
params.gauge_file_format);
191 write(writer,
"gaugeFilename",
params.gauge_filename);
195 push(writer,
"zolotarev");
197 if(
params.approx_min > 0 ) {
201 if(
params.approx_max > 0 ) {
211 push(writer,
"PsiBarPsi");
217 switch(
params.src_chirality ) {
228 std::cerr <<
"I have reached a place where I shouldnt have reached." << std::endl;
231 write(writer,
"SrcChirality", s_ch);
259 const multi1d<Real>& lambda_lo,
260 multi1d<LatticeFermion>& eigen_vec,
261 const Real wilson_mass,
276 eigen_vec.resize(lambda_lo.size());
279 multi1d<Real> e_norms(lambda_lo.size());
280 multi1d<Real> evec_norms(lambda_lo.size());
282 for(
int i = 0;
i < lambda_lo.size();
i++) {
285 std::ostringstream filename;
289 filename << root_prefix <<
"eigenvector_" << std::setw(3) << std::setfill(
'0') <<
i;
292 std::cout <<
"Reading eigenstd::vector: " << filename.str() << std::endl;
296 evec_norms[
i] = (Real)sqrt(norm2(eigen_vec[
i]));
299 LatticeFermion D_ev, tmp_ev, lambda_e;
302 (*D_w)(tmp_ev, eigen_vec[
i],
PLUS);
304 D_ev = Gamma(15)*tmp_ev;
307 lambda_e = lambda_lo[
i]*eigen_vec[
i];
311 e_norms[
i] = (Real)sqrt(norm2(D_ev));
313 push(xml_out,
"Eigenstd::vectorTest");
314 push(xml_out,
"EigenVecNorms");
315 write(xml_out,
"evec_norms", evec_norms);
317 push(xml_out,
"EigenTestNorms");
318 write(xml_out,
"e_norms", e_norms);
322 multi1d<Real> szin_enorms(e_norms);
323 for(
int i=0;
i < lambda_lo.size();
i++) {
324 szin_enorms[
i] /= (Real(
Nd)+wilson_mass);
326 push(xml_out,
"SZINEigenTestNorms");
327 write(xml_out,
"szin_enorms",szin_enorms);
333 int main(
int argc,
char **argv)
341 root_prefix += argv[1];
352 QDPIO::cerr <<
"Caught exception " <<
s << std::endl;
358 Layout::setLattSize(
params.nrow);
362 XMLFileWriter xml_out(root_prefix+
"t_ov_pbp.xml");
363 push(xml_out,
"psiBarPsiTest");
372 multi1d<LatticeColorMatrix>
u(
Nd);
376 for(
int j = 0;
j <
Nd;
j++) {
382 for(
int j=0;
j <
Nd;
j++) {
396 push(xml_out,
"GaugeInfo");
402 std::cerr <<
"Error: " << e << std::endl;
411 readArchiv(nersc_xml,
u,
params.gauge_filename);
414 push(xml_out,
"GaugeInfo");
415 xml_out << nersc_xml;
420 std::cerr <<
"Error: " << e << std::endl;
426 std::ostringstream file_read_error;
427 file_read_error <<
"Unknown gauge file format" <<
params.gauge_file_format ;
428 throw file_read_error.str();
432 std::ostringstream startup_error;
433 startup_error <<
"Unknown start type " <<
params.gauge_start_type <<std::endl;
434 throw startup_error.str();
439 MesPlq(xml_out,
"Observables",
u);
449 XMLBufferWriter my_writer;
453 Zolotarev4DFermAct S(fbc, S_w,
462 multi1d<LatticeFermion> eigen_vecs;
468 if(
params.lambda.size() == 0 ) {
471 connect_state_ptr = S.createState(
u,
492 connect_state_ptr = S.createState(
u,
505 for(
int noise = 0; noise <
params.num_noise; noise++) {
509 LatticeFermion noise_source;
510 multi1d<LatticeFermion> inverse(
params.quark_mass.size());
517 LatticeFermion
tmp = Gamma(15)*noise_source;
530 noise_source *= Real(0.5);
535 Double noise_norm = sqrt(norm2(noise_source));
536 noise_source /= Real(noise_norm);
546 multi1d<Real> rsd_array(
params.quark_mass.size());
547 for(
int m=0;
m <
params.quark_mass.size();
m++) {
553 S.multiQprop(inverse,
565 Real vol = Real(Layout::vol());
567 for(
int m=0;
m <
params.quark_mass.size();
m++) {
579 for(
int m=0;
m <
params.quark_mass.size();
m++) {
580 push(xml_out,
"psiBarPsi");
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.
BinaryReturn< C1, C2, FnInnerProduct >::Type_t innerProduct(const QDPSubType< T1, C1 > &s1, const QDPType< T2, C2 > &s2)
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.
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.
std::string gauge_filename
multi1d< Real > quark_mass
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.