LatticeFermion chi; PropToFerm(quark_prop_source, chi, input.components[comp].color, input.components[comp].spin);    psi = zero;   Real fact = Real(1) / sqrt(norm2(chi)); chi *= fact;  int n_count = 0; S.qprop(psi, state, chi, input.param.invParam.invType, input.param.invParam.RsdCG, input.param.invParam.MaxCG, n_count);
Real fact = Real(1) / sqrt(norm2(chi)); chi *= fact;  int n_count = 0;  if( S_f_ptr != 0x0 ) {  S_f->qprop(psi, state, chi, input.param.invParam.invType, input.param.invParam.RsdCG, input.param.invParam.MaxCG, n_count);
int main(int argc, char **argv){  // Put the machine into a known state  QDP_initialize(&argc, &argv);  // Input parameter structure  PropagatorComponent_input_t  input;  // Instantiate xml reader for DATA  XMLReader xml_in("DATA");  // Read data  read(xml_in, "/propagatorComp", input);  // Specify lattice size, shape, etc.  Layout::setLattSize(input.param.nrow);  Layout::create();  QDPIO::cout << "propagatorComp" << endl;  // Read in the configuration along with relevant information.  multi1d<LatticeColorMatrix> u(Nd);  XMLReader gauge_file_xml, gauge_xml;  gaugeStartup(gauge_file_xml, gauge_xml, u, input.cfg);  // Read in the source along with relevant information.  LatticePropagator quark_prop_source;  XMLReader source_file_xml, source_record_xml;  // ONLY SciDAC mode is supported for propagators!!  readQprop(source_file_xml, 	    source_record_xml, quark_prop_source,	    input.prop.source_file, QDPIO_SERIAL);  // Try to invert this record XML into a source struct  // Also pull out the id of this source  PropSource_t source_header;  try  {    read(source_record_xml, "/MakeSource/PropSource", source_header);  }  catch (const string& e)   {    QDPIO::cerr << "Error extracting source_header: " << e << endl;    throw;  }  // Instantiate XML writer for XMLDAT  XMLFileWriter xml_out("XMLDAT");  push(xml_out, "multiPropagatorComp");  proginfo(xml_out);    // Print out basic program info  // Write out the input  write(xml_out, "Input", xml_in);  // Write out the config header  write(xml_out, "Config_info", gauge_xml);  // Write out the source header  write(xml_out, "Source_file_info", source_file_xml);  write(xml_out, "Source_record_info", source_record_xml);  push(xml_out, "Output_version");  write(xml_out, "out_version", 1);  pop(xml_out);  xml_out.flush();  // Check if the gauge field configuration is unitarized  unitarityCheck(u);  // Calculate some gauge invariant observables just for info.  Double w_plaq, s_plaq, t_plaq, link;  MesPlq(u, w_plaq, s_plaq, t_plaq, link);  push(xml_out, "Observables");  write(xml_out, "w_plaq", w_plaq);  write(xml_out, "s_plaq", s_plaq);  write(xml_out, "t_plaq", t_plaq);  write(xml_out, "link", link);  pop(xml_out);  // Sanity check - write out the norm2 of the source in the Nd-1 direction  // Use this for any possible verification  {    // Initialize the slow Fourier transform phases    SftMom phases(0, true, Nd-1);    multi1d<Double> source_corr = sumMulti(localNorm2(quark_prop_source), 					   phases.getSet());    push(xml_out, "Source_correlator");    write(xml_out, "source_corr", source_corr);    pop(xml_out);  }  xml_out.flush();  /*   * Construct fermionic BC. Need one for LatticeFermion and multi1d<LatticeFermion>   * Note, the handle is on an ABSTRACT type   */  Handle< FermBC<LatticeFermion> >  fbc(new SimpleFermBC<LatticeFermion>(input.param.boundary));  Handle< FermBC<multi1d<LatticeFermion> > >  fbc_a(new SimpleFermBC<multi1d<LatticeFermion> >(input.param.boundary));  //  // Loop over the source color and spin, creating the source  // and calling the relevant propagator routines. The QDP  // terminology is that a propagator is a matrix in color  // and spin space  //    LatticeFermion psi;  int ncg_had = 0;  //  // Initialize fermion action  //  switch (input.param.FermActHandle->getFermActType()) {    /***********************************************************************/    /* 4D ZOlotarev                                                        */    /***********************************************************************/  case FERM_ACT_ZOLOTAREV_4D:    {      QDPIO::cout << "FERM_ACT_ZOLOTAREV_4D" << endl;      const Zolotarev4DFermActParams& zolo4d = dynamic_cast<const Zolotarev4DFermActParams& > (*(input.param.FermActHandle));            // Construct Fermact -- now uses constructor from the zolo4d params      // struct      Zolotarev4DFermAct S(fbc, zolo4d, xml_out);            // Make a state. Now calls create state with the state info       // params struct. Loads Evalues etc if needed, will in the       // future recompute them as needed      Handle<const ConnectState> state(S.createState(u, zolo4d.StateInfo, xml_out, zolo4d.AuxFermActHandle->getMass() ));            for(int comp = 0; comp < input.components.size(); comp++) { 		LatticeFermion chi;	PropToFerm(quark_prop_source, chi, input.components[comp].color,		   input.components[comp].spin);	// Zero out initial guess	psi = zero;	// Normalise source	Real fact = Real(1) / sqrt(norm2(chi));	chi *= fact;	int n_count = 0;	S.qprop(psi, 		state, 		chi, 		input.param.invParam.invType, 		input.param.invParam.RsdCG, 		input.param.invParam.MaxCG, 		n_count);		// Remove source normalisation	fact = Real(1) / fact;	psi *= fact;	  	push(xml_out,"Relaxation_Iterations");	write(xml_out, "ncg_had", n_count);	pop(xml_out);	saveComponent( input.param,			input.prop,			source_header,			input.components[comp],			gauge_xml,			xml_out,			psi );      }    }    break;  case FERM_ACT_ZOLOTAREV_5D:    {      QDPIO::cout << "FERM_ACT_ZOLOTAREV_5D" << endl;      const Zolotarev5DFermActParams& zolo5d = dynamic_cast<const Zolotarev5DFermActParams& > (*(input.param.FermActHandle));            // Construct Fermact -- now uses constructor from the zolo4d params      // struct      Zolotarev5DFermActArray S(fbc_a, fbc, zolo5d, xml_out);            // Make a state. Now calls create state with the state info       // params struct. Loads Evalues etc if needed, will in the       // future recompute them as needed      Handle<const ConnectState> state(S.createState(u, zolo5d.StateInfo, xml_out, zolo5d.AuxFermActHandle->getMass()));            for(int comp = 0; comp < input.components.size(); comp++) { 		LatticeFermion chi;	PropToFerm(quark_prop_source, chi, input.components[comp].color,		   input.components[comp].spin);	// Zero out initial guess	psi = zero;		// Normalise source	Real fact = Real(1) / sqrt(norm2(chi));	chi *= fact;	int n_count = 0;	S.qprop(psi, 		state, 		chi, 		input.param.invParam.invType, 		input.param.invParam.RsdCG, 		input.param.invParam.MaxCG, 		n_count);		// Remove source normalisation	fact = Real(1) / fact;	psi *= fact;	  	push(xml_out,"Relaxation_Iterations");	write(xml_out, "ncg_had", n_count);	pop(xml_out);	saveComponent( input.param,			input.prop,		       source_header,			input.components[comp],			gauge_xml,			xml_out,			psi );      }    }    break;  default:    QDPIO::cerr << "Unsupported fermion action" << endl;    QDP_abort(1);  }  pop(xml_out);  // propagator    xml_out.close();  xml_in.close();    // Time to bolt  QDP_finalize();    exit(0);}