13 #include "qdp_map_obj.h"
14 #include "qdp_map_obj_disk.h"
15 #include "qdp_disk_map_slice.h"
32 namespace InlinePropDistillutionEnv
37 XMLReader inputtop(xml, path);
64 XMLReader inputtop(xml, path);
89 XMLReader inputtop(xml, path);
91 read(inputtop,
"Propagator", input.
prop);
128 namespace InlinePropDistillutionEnv
135 return new InlineMeas(Params(xml_in, path));
167 XMLReader paramtop(xml_in, path);
169 if (paramtop.count(
"Frequency") == 1)
181 if (paramtop.count(
"xml_file") != 0)
188 QDPIO::cerr << __func__ <<
": Caught Exception reading XML: " << e << std::endl;
205 push(xml_out,
"PropDistillution");
206 write(xml_out,
"update_no", update_no);
207 write(xml_out,
"xml_file", xml_file);
210 XMLFileWriter xml(xml_file);
211 func(update_no, xml);
215 func(update_no, xml_out);
232 multi1d<LatticeColorMatrix>
u;
233 XMLBufferWriter gauge_xml;
239 catch( std::bad_cast )
241 QDPIO::cerr <<
name <<
": caught dynamic cast error" << std::endl;
246 QDPIO::cerr <<
name <<
": std::map call failed: " << e << std::endl;
250 push(xml_out,
"PropDistillution");
251 write(xml_out,
"update_no", update_no);
253 QDPIO::cout <<
name <<
": propagator calculation" << std::endl;
261 write(xml_out,
"Config_info", gauge_xml);
263 push(xml_out,
"Output_version");
264 write(xml_out,
"out_version", 1);
268 MesPlq(xml_out,
"Observables",
u);
273 QDPIO::cout <<
"Snarf the distillution factory from a named buffer" << std::endl;
278 catch (std::bad_cast) {
279 QDPIO::cerr <<
name <<
": caught dynamic cast error" << std::endl;
283 QDPIO::cerr <<
name <<
": error extracting source_header: " << e << std::endl;
286 catch(
const char* e) {
287 QDPIO::cerr <<
name <<
": Caught some char* exception:" << std::endl;
288 QDPIO::cerr << e << std::endl;
289 QDPIO::cerr <<
"Rethrowing" << std::endl;
298 QDPIO::cout <<
"Distillution factory: ensemble= XX" << dist_noise_obj.
getEnsemble() <<
"XX "
299 <<
"sequence= XX" << dist_noise_obj.
getSequence() <<
"XX\n"
300 <<
"t_origin= " << dist_noise_obj.
getOrigin() << std::endl;
303 const int decay_dir = dist_noise_obj.
getDecayDir();
304 const int Lt = Layout::lattSize()[decay_dir];
307 if (decay_dir !=
Nd-1)
309 QDPIO::cerr << __func__ <<
": TimeSliceIO only supports decay_dir= " <<
Nd-1 <<
"\n";
320 QDP::MapObjectDisk<KeyPropDistillution_t, TimeSliceIO<LatticeColorVectorF> > source_obj;
321 source_obj.setDebug(0);
323 QDPIO::cout <<
"Open source file" << std::endl;
335 QDPIO::cout <<
"Finished opening solution file" << std::endl;
341 QDP::MapObjectDisk<KeyPropDistillution_t, TimeSliceIO<LatticeColorVectorF> > prop_obj;
342 prop_obj.setDebug(0);
346 QDPIO::cout <<
"Open solution file" << std::endl;
350 XMLBufferWriter file_xml;
352 push(file_xml,
"MODMetaData");
354 write(file_xml,
"lattSize", QDP::Layout::lattSize());
355 write(file_xml,
"decay_dir", decay_dir);
363 write(file_xml,
"Config_info", gauge_xml);
368 prop_obj.insertUserdata(file_xml.str());
376 QDPIO::cout <<
"Finished opening solution file" << std::endl;
397 QDPIO::cout <<
"Try the various factories" << std::endl;
400 typedef LatticeFermion
T;
401 typedef multi1d<LatticeColorMatrix>
P;
402 typedef multi1d<LatticeColorMatrix>
Q;
408 XMLReader fermacttop(xml_s);
422 QDPIO::cout <<
"Suitable factory found: compute all the quark props" << std::endl;
445 XMLReader linktop(xml_l);
449 QDPIO::cout <<
"Create quark-line factory" << std::endl;
461 QDPIO::cout <<
"Factory created" << std::endl;
476 std::vector<int> t_sources(quark_line_fact->getTimeSources());
478 for(
int tt=0; tt < t_sources.size(); ++tt)
481 QDPIO::cout <<
"t_source = " <<
t_source << std::endl;
484 for(
int dist_src=0; dist_src < quark_line_fact->getNumSpaceDils(); ++dist_src)
489 QDPIO::cout <<
"dist_src = " << dist_src << std::endl;
492 LatticeColorVector vec_srce = quark_line_fact->getSrc(
t_source, dist_src);
498 multi2d<LatticeColorVector> ferm_out(Ns,Ns);
500 for(
int spin_source=0; spin_source < Ns; ++spin_source)
502 QDPIO::cout <<
"spin_source = " << spin_source << std::endl;
509 LatticeFermion quark_soln =
zero;
516 for(
int spin_sink=0; spin_sink < Ns; ++spin_sink)
518 ferm_out(spin_sink,spin_source) = peekSpin(quark_soln, spin_sink);
525 multi2d<LatticeColorVector> ferm_tmp;
527 multiplyRep(ferm_tmp, diracToDrMatMinus, ferm_out);
532 QDPIO::cout <<
"Time to assemble and transmogrify propagators for dist_src= " << dist_src <<
" time = "
533 << sniss1.getTimeInSeconds()
534 <<
" secs" << std::endl;
538 QDPIO::cout <<
"Potentially write propagator solutions to disk" << std::endl;
546 QDPIO::cout <<
"Write propagator solution to disk" << std::endl;
547 std::list<KeyPropDistillution_t> snk_keys(quark_line_fact->getSnkKeys(
t_source, dist_src));
549 for(std::list<KeyPropDistillution_t>::const_iterator key= snk_keys.begin();
550 key != snk_keys.end();
553 LatticeColorVectorF tmptmp = ferm_out(key->spin_snk,key->spin_src);
555 prop_obj.insert(*key, TimeSliceIO<LatticeColorVectorF>(tmptmp, dist_noise_obj.
getTime(key->t_slice)));
560 QDPIO::cout <<
"Time to write propagators for dist_src= " << dist_src <<
" time = "
561 << sniss2.getTimeInSeconds()
562 <<
" secs" << std::endl;
569 QDPIO::cout <<
"Propagators computed: time= "
570 << swatch.getTimeInSeconds()
571 <<
" secs" << std::endl;
575 QDPIO::cout <<
name <<
": caught exception around qprop: " << e << std::endl;
579 push(xml_out,
"Relaxation_Iterations");
580 write(xml_out,
"ncg_had", ncg_had);
586 QDPIO::cout <<
name <<
": total time = "
587 << snoop.getTimeInSeconds()
588 <<
" secs" << std::endl;
590 QDPIO::cout <<
name <<
": ran successfully" << std::endl;
Inline measurement factory.
virtual std::string getSequence() const
Return the sequence.
virtual int getTime(int t_slice) const
Convenience - get shifted time.
virtual int getDecayDir() const
Return the decay direction.
virtual std::string getEnsemble() const
Return the ensemble.
virtual int getOrigin() const
Return the actual time origin.
Class for counted reference semantics.
void func(const unsigned long update_no, XMLWriter &xml_out)
Do the measurement.
void operator()(const unsigned long update_no, XMLWriter &xml_out)
Do the measurement.
Builds time slice subsets.
Basis rotation matrix from Dirac to Degrand-Rossi (and reverse)
Distillution factory for producing keys * sources.
Support for distillution - random time-slices and quark line noises.
Class structure for fermion actions.
Fermion action factories.
All Wilson-type fermion actions.
SpinMatrixD DiracToDRMat()
The Dirac to Degrand-Rossi spin transformation matrix (and reverse)
void CvToFerm(const LatticeColorVectorF &a, LatticeFermionF &b, int spin_index)
Convert (insert) a LatticeColorVector into a LatticeFermion.
void proginfo(XMLWriter &xml)
Print out basic information about this program.
std::string makeXMLFileName(std::string xml_file, unsigned long update_no)
Return a xml file name for inline measurements.
GroupXML_t readXMLGroup(XMLReader &xml_in, const std::string &path, const std::string &type_name)
Read group and return as a std::string.
TimeSliceSet time_slice_set
Compute the propagator from distillution.
Key for distillution propagator sources and solutions.
Named object function std::map.
static bool registered
Local registration flag.
bool registerAll()
Register all the factories.
multi1d< LatticeColorMatrix > P
void write(XMLWriter &xml, const std::string &path, const Params::NamedObject_t &input)
Propagator output.
void read(XMLReader &xml, const std::string &path, Params::NamedObject_t &input)
Propagator input.
bool registerAll()
Register all the factories.
bool registerAll()
Register all the factories.
Asqtad Staggered-Dirac operator.
static multi1d< LatticeColorMatrix > u
LinOpSysSolverMGProtoClover::Q Q
push(xml_out,"Condensates")
LinOpSysSolverMGProtoClover::T T
std::vector< MatrixSpinRep_t > convertTwoQuarkSpin(const SpinMatrix &in)
Convert a generic spin matrix into a sparse spin representation.
multi1d< LatticeFermion > chi(Ncb)
void MesPlq(const multi1d< LatticeColorMatrixF3 > &u, multi2d< Double > &plane_plaq, Double &link)
static QDP_ColorVector * out
Constructor.
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
const WilsonTypeFermAct< multi1d< LatticeFermion > > & S_f
void multiplyRep(multi2d< LatticeColorVector > &dist_rep, const std::vector< MatrixSpinRep_t > &spin, const multi2d< LatticeColorVector > &prop_rep)
Dist(t2) = SpinMatrix*Prop(t2)
static QDP_ColorVector * in
Print out basic info about this program.
Sparse matrix representation of spin matrices.
std::string distillution_id
std::vector< int > quark_lines
GroupXML_t quark_line_xml
Holds return info from SystemSolver call.
Convenience for building time-slice subsets.
Contraction operators for two quarks.