CHROMA
util_compute_singlet_ps.cc
Go to the documentation of this file.
1 //
2 // Wrapper code to compute the connected part of the
3 // pseudocalar singlet meson (4 link operator)
4 //
5 //
6 
7 #include "handle.h"
8 //#include "actions/ferm/fermbcs/fermbcs.h"
10 #include "meas/hadron/hadron_s.h"
11 #include "meas/smear/fuzz_smear.h"
12 #include "meas/sources/srcfil.h"
13 #include "util/ferm/transf.h"
15 
16 
18 
19 namespace Chroma {
20 
21  enum func_flag{
22  QPROP_FUZZ,
24  SINGLETS
25  };
26  typedef func_flag func_flag_type;
27 
28 
30  bool gauge_shift,
31  bool sym_shift, func_flag_type fflag);
32 
33  /***************************************************************************/
34 
35  int compute_singlet_ps(LatticeStaggeredFermion & psi,
36  LatticeStaggeredPropagator quark_propagator,
37  stag_src_type type_of_src,
38  bool gauge_shift,
39  bool sym_shift,
40  const multi1d<LatticeColorMatrix> & u ,
42  XMLWriter & xml_out,
43  Real RsdCG, Real Mass,
44  int j_decay, int t_source, int t_length){
45 
46  LatticeStaggeredFermion q_source ;
47  LatticeStaggeredFermion q_source_fuzz ;
48  int ncg_had = 0 ;
49 
50  LatticeStaggeredPropagator quark_propagator_4link ;
51 
52  q_source = zero ;
53 
54  // safety checks
55  check_qprop_source_compatability(type_of_src, gauge_shift, sym_shift,
56  SINGLETS);
57 
58  if( gauge_shift ){
59 
60  if((type_of_src == LOCAL_SRC) || (type_of_src == FUZZED_SRC)){
61  QDPIO::cerr << "Conflicting source and shift types in " <<
62  "util_compute_quark_prop_s.cc" <<std::endl;
63  exit(0);
64  }
65 
66 
67  }else{
68 
69  if (sym_shift){
70  QDPIO::cerr << "Conflicting source and shift types in " <<
71  "util_compute_singlet_s.cc" <<std::endl;
72  QDPIO::cerr << "symmetric shifts not implemented for LLL " <<
73  "non-gauge-invariant sources" << std::endl;
74 
75  if(type_of_src == LOCAL_SRC){
76  QDPIO::cerr << "You asked for LOCAL_SRC, sym_shift" << std::endl;
77  }
78  if(type_of_src == FUZZED_SRC){
79  QDPIO::cerr << "You asked for FUZZED_SRC, sym_shift" << std::endl;
80  }
81 
82  exit(0);
83  }
84 
85 
86  if(type_of_src == GAUGE_INVAR_LOCAL_SOURCE){
87  QDPIO::cout << "Conflicting source and shift types in " <<
88  "util_compute_quark_prop_s.cc" <<std::endl;
89  exit(0);
90  }
91  }
92 
93 
94  /*** generate the 4-link quark propagator ****/
95  push(xml_out,"Computation_4link_pseudoscalar");
96 
97 
98  for(int color_source = 0; color_source < Nc; ++color_source) {
99 
100  if( type_of_src == LOCAL_SRC ){
101 
102  q_source = zero ;
103  multi1d<int> coord(Nd);
104  coord[0]=1; coord[1] = 1; coord[2] = 1; coord[3] = 1;
105  srcfil(q_source, coord,color_source ) ;
106  } else {
107  if( type_of_src == GAUGE_INVAR_LOCAL_SOURCE ) {
108 
109  q_source = zero ;
110  multi1d<int> coord(Nd);
111 
112  // start with local source
113  coord[0]=0; coord[1] = 0; coord[2] = 0; coord[3] = 0;
114  srcfil(q_source, coord,color_source ) ;
115 
116 
117 
118  // now do the shift
119  coord[0]=1; coord[1] = 1; coord[2] = 1; coord[3] = 1;
120  q_source_fuzz = q_source ;
121  q_source = shiftDeltaPropCov(coord,q_source_fuzz,u,
122  sym_shift);
123 
124  }
125  }
126 
127  // we fuzz the local quark propagator so it does not
128  // make sense to fuzz the shited source quark propagator
129 
130 
131  // Compute the propagator for given source color/spin
132 
133  psi = zero ;
134 
135  StopWatch swatch;
136  swatch.start();
137  SystemSolverResults_t res = (*qprop)(psi, q_source);
138  swatch.stop();
139  double time_in_sec = swatch.getTimeInSeconds();
140  ncg_had += res.n_count;
141 
142  push(xml_out,"Qprop");
143  write(xml_out, "Mass" , Mass);
144  write(xml_out, "RsdCG", RsdCG);
145  write(xml_out, "n_count", res.n_count);
146  write(xml_out, "time_in_sec",time_in_sec );
147  pop(xml_out); //Qprop
148 
149  FermToProp(psi, quark_propagator_4link, color_source);
150 
151  }
152 
153 
154  staggered_pion_singlet pion_singlet(t_length,u);
155  pion_singlet.compute(quark_propagator,quark_propagator_4link,j_decay);
156  pion_singlet.dump(t_source,xml_out ) ;
157 
158  pop(xml_out); //Computation_4link_pseudoscalar
159 
160  return ncg_had ;
161  }
162  /***************************************************************************/
163 
164  int compute_vary_singlet_ps(LatticeStaggeredFermion & psi,
165  LatticeStaggeredPropagator & quark_propagator_Lsink_Lsrc,
166  LatticeStaggeredPropagator & quark_propagator_Fsink_Lsrc,
167  LatticeStaggeredPropagator & quark_propagator_Lsink_Fsrc,
168  LatticeStaggeredPropagator & quark_propagator_Fsink_Fsrc,
169  stag_src_type type_of_src,
170  bool gauge_shift,
171  bool sym_shift,
172  const multi1d<LatticeColorMatrix> & u ,
173  const multi1d<LatticeColorMatrix> & u_smr ,
175  XMLWriter & xml_out,
176  Real RsdCG, Real Mass,
177  int j_decay, int t_source, int t_length,
178  int fuzz_width){
179 
180 
181 
182 
183  LatticeStaggeredFermion q_source_4link ;
184 
185  LatticeStaggeredFermion q_source ;
186  LatticeStaggeredFermion q_source_fuzz ;
187  int ncg_had = 0 ;
188 
189  LatticeStaggeredPropagator quark_propagator_4link ;
190 
191  q_source = zero ;
192 
193  // safety checks
194  check_qprop_source_compatability(type_of_src, gauge_shift, sym_shift,
195  SINGLETS);
196 
197  if( gauge_shift ){
198 
199  if((type_of_src == LOCAL_SRC) || (type_of_src == FUZZED_SRC)){
200  QDPIO::cerr << "Conflicting source and shift types in " <<
201  "util_compute_quark_prop_s.cc" <<std::endl;
202  exit(0);
203  }
204 
205 
206  }else{
207 
208  if (sym_shift){
209  QDPIO::cerr << "Conflicting source and shift types in " <<
210  "util_compute_singlet_s.cc" <<std::endl;
211  QDPIO::cerr << "symmetric shifts not implemented for LLL " <<
212  "non-gauge-invariant sources" << std::endl;
213 
214  if(type_of_src == LOCAL_SRC){
215  QDPIO::cerr << "You asked for LOCAL_SRC, sym_shift" << std::endl;
216  }
217  if(type_of_src == FUZZED_SRC){
218  QDPIO::cerr << "You asked for FUZZED_SRC, sym_shift" << std::endl;
219  }
220 
221  exit(0);
222  }
223 
224 
225  if(type_of_src == GAUGE_INVAR_LOCAL_SOURCE){
226  QDPIO::cout << "Conflicting source and shift types in " <<
227  "util_compute_quark_prop_s.cc" <<std::endl;
228  exit(0);
229  }
230  }
231 
232 
233  /*** generate the 4-link quark propagator ****/
234  push(xml_out,"Computation_4link_pseudoscalar");
235 
236 
237  for(int color_source = 0; color_source < Nc; ++color_source) {
238 
239  if( type_of_src == LOCAL_SRC ){
240 
241  q_source = zero ;
242  multi1d<int> coord(Nd);
243  coord[0]=1; coord[1] = 1; coord[2] = 1; coord[3] = 1;
244  srcfil(q_source, coord,color_source ) ;
245  } else {
246  if( type_of_src == GAUGE_INVAR_LOCAL_SOURCE ) {
247 
248  q_source = zero ;
249  multi1d<int> coord(Nd);
250 
251  // start with local source
252  coord[0]= 0; coord[1] = 0; coord[2] = 0; coord[3] = 0;
253  srcfil(q_source, coord,color_source ) ;
254 
255 
256 
257  // now do the shift
258  coord[0]=1; coord[1] = 1; coord[2] = 1; coord[3] = 1;
259 
260  q_source_fuzz = q_source ;
261  q_source = shiftDeltaPropCov(coord,q_source_fuzz,u,
262  sym_shift);
263 
264  }
265  }
266 
267  // we fuzz the local quark propagator so it does not
268  // make sense to fuzz the shited source quark propagator
269 
270 
271  // Compute the propagator for given source color/spin
272 
273  psi = zero ;
274 
275  StopWatch swatch;
276  swatch.start();
277  SystemSolverResults_t res = (*qprop)(psi, q_source);
278  swatch.stop();
279  double time_in_sec = swatch.getTimeInSeconds();
280  ncg_had += res.n_count;
281 
282  push(xml_out,"Qprop");
283  write(xml_out, "Mass" , Mass);
284  write(xml_out, "RsdCG", RsdCG);
285  write(xml_out, "n_count", res.n_count);
286  write(xml_out, "time_in_sec",time_in_sec );
287  pop(xml_out);
288 
289  FermToProp(psi, quark_propagator_4link, color_source);
290 
291  }
292 
293 
294  staggered_pion_singlet pion_singlet_LsrcLsink(t_length,u);
295  staggered_pion_singlet pion_singlet_FsrcLsink(t_length,u);
296  staggered_pion_singlet pion_singlet_LsrcFsink(t_length,u);
297  staggered_pion_singlet pion_singlet_FsrcFsink(t_length,u);
298 
299  push(xml_out,"LocalSource");
300  push(xml_out,"LocalSink");
301  pion_singlet_LsrcLsink.compute(quark_propagator_Lsink_Lsrc,
302  quark_propagator_4link,j_decay);
303  pion_singlet_LsrcLsink.dump(t_source,xml_out ) ;
304  pop(xml_out); //local sink
305 
306 
307  push(xml_out,"FuzzSink");
308  pion_singlet_LsrcFsink.compute(quark_propagator_Fsink_Lsrc,
309  quark_propagator_4link,j_decay);
310  pion_singlet_LsrcFsink.dump(t_source,xml_out ) ;
311  pop(xml_out); //fuzz sink
312  pop(xml_out); //local source
313 
314  push(xml_out,"FuzzSource");
315  push(xml_out,"LocalSink");
316  pion_singlet_FsrcLsink.compute(quark_propagator_Lsink_Fsrc,
317  quark_propagator_4link,j_decay);
318  pion_singlet_FsrcLsink.dump(t_source,xml_out ) ;
319 
320  pop(xml_out); //local sink
321 
322  push(xml_out,"FuzzSink");
323  pion_singlet_FsrcFsink.compute(quark_propagator_Fsink_Fsrc,
324  quark_propagator_4link,j_decay);
325  pion_singlet_FsrcFsink.dump(t_source,xml_out ) ;
326  pop(xml_out); //fuzz sink
327 
328  pop(xml_out); //fuzz source
329 
330 
331  pop(xml_out); //Computation_4link_pseudoscalar
332 
333  return ncg_had ;
334 
335 
336 
337  }
338 } // end of namespace
Class for counted reference semantics.
Definition: handle.h:33
void dump(int t_source, XMLWriter &xml_out)
Definition: hadron_corr_s.h:33
void compute(LatticeStaggeredPropagator local_quark_prop, LatticeStaggeredPropagator four_shift_quark_prop, int j_decay)
Definition: pion_sing_s.cc:63
Fermion actions.
Fuzzed sources.
void FermToProp(const LatticeFermionF &a, LatticePropagatorF &b, int color_index, int spin_index)
Insert a LatticeFermion into a LatticePropagator.
Definition: transf.cc:98
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
void srcfil(LatticeFermion &a, const multi1d< int > &coord, int color_index, int spin_index)
Fill a specific color and spin index with 1.0.
Definition: srcfil.cc:23
Hadronic observables.
Class for counted reference semantics.
multi1d< int > coord(Nd)
int j_decay
Definition: meslate.cc:22
Nd
Definition: meslate.cc:74
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > const multi1d< Real > enum InvType invType const multi1d< Real > & RsdCG
Definition: pbg5p_w.cc:30
int check_qprop_source_compatability(stag_src_type type_of_src, bool gauge_shift, bool sym_shift, func_flag_type fflag)
static multi1d< LatticeColorMatrix > u
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > const multi1d< Real > & Mass
Definition: pbg5p_w.cc:29
push(xml_out,"Condensates")
LatticeStaggeredPropagator shiftDeltaPropCov(multi1d< int > &delta, const LatticeStaggeredPropagator &src, multi1d< LatticeColorMatrix > u, bool sym_flag)
func_flag func_flag_type
LatticeFermion psi
Definition: mespbg5p_w.cc:35
int compute_vary_singlet_ps(LatticeStaggeredFermion &psi, LatticeStaggeredPropagator &quark_propagator_Lsink_Lsrc, LatticeStaggeredPropagator &quark_propagator_Fsink_Lsrc, LatticeStaggeredPropagator &quark_propagator_Lsink_Fsrc, LatticeStaggeredPropagator &quark_propagator_Fsink_Fsrc, stag_src_type type_of_src, bool gauge_shift, bool sym_shift, const multi1d< LatticeColorMatrix > &u, const multi1d< LatticeColorMatrix > &u_smr, Handle< SystemSolver< LatticeStaggeredFermion > > &qprop, XMLWriter &xml_out, Real RsdCG, Real Mass, int j_decay, int t_source, int t_length, int fuzz_width)
pop(xml_out)
int compute_singlet_ps(LatticeStaggeredFermion &psi, LatticeStaggeredPropagator quark_propagator, stag_src_type type_of_src, bool gauge_shift, bool sym_shift, const multi1d< LatticeColorMatrix > &u, Handle< SystemSolver< LatticeStaggeredFermion > > &qprop, XMLWriter &xml_out, Real RsdCG, Real Mass, int j_decay, int t_source, int t_length)
Double zero
Definition: invbicg.cc:106
Point source construction.
Holds return info from SystemSolver call.
Definition: syssolver.h:17
Compute staggered quark propagator.
@ GAUGE_INVAR_LOCAL_SOURCE