11 #include "qdp_map_obj.h"
12 #include "qdp_map_obj_disk.h"
13 #include "qdp_map_obj_disk_multiple.h"
14 #include "qdp_disk_map_slice.h"
32 namespace InlinePropDistillationEnv
37 XMLReader inputtop(xml, path);
60 XMLReader inputtop(xml, path);
89 XMLReader inputtop(xml, path);
91 read(inputtop,
"Propagator", input.
prop);
129 namespace InlinePropDistillationEnv
138 typedef QDP::MapObjectDiskMultiple<KeyTimeSliceColorVec_t, TimeSliceIO<LatticeColorVectorF> >
MODS_t;
155 LatticeColorVector getSrc(
MODS_t& source_obj,
int t_source,
int colorvec_src)
157 QDPIO::cout << __func__ <<
": on t_source= " <<
t_source <<
" colorvec_src= " << colorvec_src << std::endl;
161 LatticeColorVectorF vec_srce =
zero;
163 TimeSliceIO<LatticeColorVectorF> time_slice_io(vec_srce,
t_source);
164 source_obj.get(src_key, time_slice_io);
172 std::vector<bool> getActiveTSlices(
int t_source,
int Nt_forward,
int Nt_backward)
175 const int decay_dir =
Nd-1;
176 const int Lt = Layout::lattSize()[decay_dir];
178 std::vector<bool> active_t_slices(Lt);
179 for(
int t=0;
t < Lt; ++
t)
181 active_t_slices[
t] =
false;
185 for(
int dt=0;
dt < Nt_forward; ++
dt)
188 active_t_slices[
t % Lt] =
true;
192 for(
int dt=0;
dt < Nt_backward; ++
dt)
195 while (
t < 0) {
t += Lt;}
197 active_t_slices[
t % Lt] =
true;
200 return active_t_slices;
206 std::list<KeyTimeSliceColorVec_t> getSrcKeys(
int t_source,
int colorvec_src)
208 std::list<KeyTimeSliceColorVec_t> keys;
210 keys.push_back(getSrcKey(
t_source,colorvec_src));
218 std::list<KeyPropDistillation_t> getSnkKeys(
int t_source,
int colorvec_src,
int Nt_forward,
int Nt_backward,
const std::string mass)
220 std::list<KeyPropDistillation_t> keys;
222 std::vector<bool> active_t_slices = getActiveTSlices(
t_source, Nt_forward, Nt_backward);
224 const int decay_dir =
Nd-1;
225 const int Lt = Layout::lattSize()[decay_dir];
227 for(
int spin_source=0; spin_source < Ns; ++spin_source)
229 for(
int spin_sink=0; spin_sink < Ns; ++spin_sink)
231 for(
int t=0;
t < Lt; ++
t)
233 if (! active_t_slices[
t]) {
continue;}
260 typedef QDP::MapObjectDisk<KeyPropDistillation_t, TimeSliceIO<LatticeColorVectorF> >
MOD_t;
281 LatticeColorVector getSrc(
MOD_t& source_obj,
int t_source,
int colorvec_src)
283 QDPIO::cout << __func__ <<
": on t_source= " <<
t_source <<
" colorvec_src= " << colorvec_src << std::endl;
287 LatticeColorVectorF vec_srce =
zero;
289 TimeSliceIO<LatticeColorVectorF> time_slice_io(vec_srce,
t_source);
290 source_obj.get(src_key, time_slice_io);
298 std::vector<bool> getActiveTSlices(
int t_source,
int Nt_forward,
int Nt_backward)
301 const int decay_dir =
Nd-1;
302 const int Lt = Layout::lattSize()[decay_dir];
304 std::vector<bool> active_t_slices(Lt);
305 for(
int t=0;
t < Lt; ++
t)
307 active_t_slices[
t] =
false;
311 for(
int dt=0;
dt < Nt_forward; ++
dt)
314 active_t_slices[
t % Lt] =
true;
318 for(
int dt=0;
dt < Nt_backward; ++
dt)
321 while (
t < 0) {
t += Lt;}
323 active_t_slices[
t % Lt] =
true;
326 return active_t_slices;
332 std::list<KeyPropDistillation_t> getSrcKeys(
int t_source,
int colorvec_src)
334 std::list<KeyPropDistillation_t> keys;
336 keys.push_back(getSrcKey(
t_source,colorvec_src));
344 std::list<KeyPropDistillation_t> getSnkKeys(
int t_source,
int colorvec_src,
int Nt_forward,
int Nt_backward,
const std::string mass)
346 std::list<KeyPropDistillation_t> keys;
348 std::vector<bool> active_t_slices = getActiveTSlices(
t_source, Nt_forward, Nt_backward);
350 const int decay_dir =
Nd-1;
351 const int Lt = Layout::lattSize()[decay_dir];
353 for(
int spin_source=0; spin_source < Ns; ++spin_source)
355 for(
int spin_sink=0; spin_sink < Ns; ++spin_sink)
357 for(
int t=0;
t < Lt; ++
t)
359 if (! active_t_slices[
t]) {
continue;}
387 namespace InlinePropDistillationEnv
394 return new InlineMeas(Params(xml_in, path));
425 XMLReader paramtop(xml_in, path);
427 if (paramtop.count(
"Frequency") == 1)
439 if (paramtop.count(
"xml_file") != 0)
446 QDPIO::cerr << __func__ <<
": Caught Exception reading XML: " << e << std::endl;
464 push(xml_out,
"PropDistillation");
465 write(xml_out,
"update_no", update_no);
466 write(xml_out,
"xml_file", xml_file);
469 XMLFileWriter xml(xml_file);
470 func(update_no, xml);
474 func(update_no, xml_out);
491 multi1d<LatticeColorMatrix>
u;
492 XMLBufferWriter gauge_xml;
498 catch( std::bad_cast )
500 QDPIO::cerr <<
name <<
": caught dynamic cast error" << std::endl;
505 QDPIO::cerr <<
name <<
": std::map call failed: " << e << std::endl;
509 push(xml_out,
"PropDistillation");
510 write(xml_out,
"update_no", update_no);
512 QDPIO::cout <<
name <<
": propagator calculation" << std::endl;
520 write(xml_out,
"Config_info", gauge_xml);
522 push(xml_out,
"Output_version");
523 write(xml_out,
"out_version", 1);
527 MesPlq(xml_out,
"Observables",
u);
531 const int Lt = Layout::lattSize()[decay_dir];
534 if (decay_dir !=
Nd-1)
536 QDPIO::cerr << __func__ <<
": TimeSliceIO only supports decay_dir= " <<
Nd-1 <<
"\n";
549 source_obj.setDebug(0);
553 QDPIO::cout <<
"Open source file" << std::endl;
556 QDPIO::cout <<
"Finished opening solution file" << std::endl;
559 QDPIO::cout <<
"Get user data" << std::endl;
560 source_obj.getUserdata(eigen_meta_data);
562 catch (std::bad_cast) {
563 QDPIO::cerr <<
name <<
": caught dynamic cast error" << std::endl;
567 QDPIO::cerr <<
name <<
": error extracting source_header: " << e << std::endl;
570 catch(
const char* e) {
571 QDPIO::cerr <<
name <<
": Caught some char* exception:" << std::endl;
572 QDPIO::cerr << e << std::endl;
573 QDPIO::cerr <<
"Rethrowing" << std::endl;
577 QDPIO::cout <<
"Source successfully read and parsed" << std::endl;
583 QDP::MapObjectDisk<KeyPropDistillation_t, TimeSliceIO<LatticeColorVectorF> > prop_obj;
584 prop_obj.setDebug(0);
586 QDPIO::cout <<
"Open solution file" << std::endl;
590 XMLBufferWriter file_xml;
592 push(file_xml,
"MODMetaData");
594 write(file_xml,
"lattSize", QDP::Layout::lattSize());
595 write(file_xml,
"decay_dir", decay_dir);
602 write(file_xml,
"Config_info", gauge_xml);
607 prop_obj.insertUserdata(file_xml.str());
615 QDPIO::cout <<
"Finished opening solution file" << std::endl;
638 QDPIO::cout <<
"Try the various factories" << std::endl;
641 typedef LatticeFermion
T;
642 typedef multi1d<LatticeColorMatrix>
P;
643 typedef multi1d<LatticeColorMatrix>
Q;
649 XMLReader fermacttop(xml_s);
663 QDPIO::cout <<
"Suitable factory found: compute all the quark props" << std::endl;
675 for(
int tt=0; tt < t_sources.size(); ++tt)
678 QDPIO::cout <<
"t_source = " <<
t_source << std::endl;
681 for(
int colorvec_src=0; colorvec_src < num_vecs; ++colorvec_src)
686 QDPIO::cout <<
"colorvec_src = " << colorvec_src << std::endl;
689 LatticeColorVector vec_srce = getSrc(source_obj,
t_source, colorvec_src);
695 multi2d<LatticeColorVector> ferm_out(Ns,Ns);
697 for(
int spin_source=0; spin_source < Ns; ++spin_source)
699 QDPIO::cout <<
"spin_source = " << spin_source << std::endl;
706 LatticeFermion quark_soln =
zero;
713 for(
int spin_sink=0; spin_sink < Ns; ++spin_sink)
715 ferm_out(spin_sink,spin_source) = peekSpin(quark_soln, spin_sink);
727 multi2d<LatticeColorVector> ferm_tmp;
729 multiplyRep(ferm_tmp, diracToDrMatMinus, ferm_out);
735 QDPIO::cout <<
"Time to assemble and transmogrify propagators for colorvec_src= " << colorvec_src <<
" time = "
736 << sniss1.getTimeInSeconds()
737 <<
" secs" << std::endl;
741 QDPIO::cout <<
"Write propagator solutions to disk" << std::endl;
747 QDPIO::cout <<
"Write propagator solution to disk" << std::endl;
748 std::list<KeyPropDistillation_t> snk_keys(getSnkKeys(
t_source, colorvec_src,
753 for(std::list<KeyPropDistillation_t>::const_iterator key= snk_keys.begin();
754 key != snk_keys.end();
757 LatticeColorVectorF tmptmp = ferm_out(key->spin_snk,key->spin_src);
759 prop_obj.insert(*key, TimeSliceIO<LatticeColorVectorF>(tmptmp, key->t_slice));
763 QDPIO::cout <<
"Time to write propagators for colorvec_src= " << colorvec_src <<
" time = "
764 << sniss2.getTimeInSeconds()
765 <<
" secs" << std::endl;
771 QDPIO::cout <<
"Propagators computed: time= "
772 << swatch.getTimeInSeconds()
773 <<
" secs" << std::endl;
777 QDPIO::cout <<
name <<
": caught exception around qprop: " << e << std::endl;
781 push(xml_out,
"Relaxation_Iterations");
782 write(xml_out,
"ncg_had", ncg_had);
788 QDPIO::cout <<
name <<
": total time = "
789 << snoop.getTimeInSeconds()
790 <<
" secs" << std::endl;
792 QDPIO::cout <<
name <<
": ran successfully" << std::endl;
Inline measurement factory.
Class for counted reference semantics.
void operator()(const unsigned long update_no, XMLWriter &xml_out)
Do the measurement.
void func(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)
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.
TimeSliceSet time_slice_set
Compute the propagator from distillation.
Key for vanilla distillation propagator sources and solutions.
Key for time-sliced color eigenvectors.
Named object function std::map.
static bool registered
Local registration flag.
multi1d< LatticeColorMatrix > P
QDP::MapObjectDiskMultiple< KeyTimeSliceColorVec_t, TimeSliceIO< LatticeColorVectorF > > MODS_t
bool registerAll()
Register all the factories.
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.
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)
QDP::MapObjectDisk< KeyPropDistillution_t, TimeSliceIO< LatticeColorVectorF > > MOD_t
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::vector< std::string > colorvec_files
Distillation propagators.
Holds return info from SystemSolver call.
Convenience for building time-slice subsets.
Contraction operators for two quarks.