35 write(xml,
"version", version);
49 return (
m <= 0) ? 1 :
m*factorial(
m-1);
53 Real normConst(
int l,
int m)
55 Real cnst = sqrt((2*
l+1)*factorial(
l-
m)/(2*
twopi*factorial(
l+
m)));
62 return ((-
m) & 1 == 1) ? -1 : 1;
66 LatticeReal plgndr(
int l,
int m,
const LatticeReal&
x)
74 return LatticeReal(
zero);
80 LatticeReal somx2 = sqrt((1.0-
x)*(1.0+
x));
81 LatticeReal fact = 1.0;
82 for (
int i=1;
i <=
m;
i++)
92 LatticeReal pmmp1 =
x*(2*
m+1)*pmm;
98 for (
int ll=
m+2; ll <=
l; ll++)
100 pll = (
x*(2*ll-1)*pmmp1-(ll+
m-1)*pmm)/(ll-
m);
111 LatticeComplex rYLM(
const multi1d<LatticeReal>&
x,
int l,
int m)
116 if (
x.size() !=
Nd-1)
130 ylm = sign_m(
m) * conj(rYLM(
x,
l,-
m));
135 LatticeReal r_sq =
zero;
136 for(
int j=0;
j <
x.size(); ++
j)
139 LatticeReal
r = where(r_sq > fuzz, sqrt(r_sq), LatticeReal(1));
142 LatticeReal cos_theta =
x[2] /
r;
145 LatticeReal
phi = atan2(
x[1],
x[0]);
148 ylm = normConst(
l,
m) * plgndr(
l,
m,cos_theta) * cmplx(cos(
m*
phi),sin(
m*
phi));
156 multi1d<LatticeComplex> deriv_rYLM(
const multi1d<LatticeReal>&
x,
int l,
int m)
161 if (
x.size() !=
Nd-1)
167 multi1d<LatticeComplex> ylm(
Nd-1);
170 if (m < -l || m >
l ||
l == 0)
181 multi1d<LatticeComplex> foo = deriv_rYLM(
x,
l,-
m);
182 for(
int k=0;
k <
Nd-1; ++
k)
183 ylm[
k] = ss*conj(foo[
k]);
206 LatticeReal r_sq =
zero;
207 for(
int j=0;
j <
x.size(); ++
j)
210 LatticeReal
r = where(r_sq > fuzz, sqrt(r_sq), LatticeReal(1));
213 LatticeReal cos_theta =
x[2] /
r;
214 LatticeReal sin_theta = sin(acos(cos_theta));
217 LatticeReal
phi = atan2(
x[1],
x[0]);
220 LatticeReal P_lm = plgndr(
l,
m,cos_theta);
224 LatticeComplex phase = cmplx(cos(
m*
phi),sin(
m*
phi));
236 LatticeReal P_div_sintheta = where(sin_theta > fuzz,
241 LatticeReal deriv_P =
m*cos_theta*P_div_sintheta + plgndr(
l,
m+1,cos_theta);
245 LatticeComplex d_r =
l*rlm1* P_lm * phase;
246 LatticeComplex d_theta = rlm1 * deriv_P * phase;
247 LatticeComplex d_phi = rlm1 * P_div_sintheta * timesI(Real(
m)) * phase;
250 ylm[0] = sin_theta*cos(
phi)*d_r + cos_theta*cos(
phi)*d_theta - sin(
phi)*d_phi;
251 ylm[1] = sin_theta*sin(
phi)*d_r + cos_theta*sin(
phi)*d_theta + cos(
phi)*d_phi;
252 ylm[2] = cos_theta*d_r - sin_theta*d_theta;
255 Real cnst = normConst(
l,
m) * sign_m(
m);
256 for(
int k=0;
k < ylm.size(); ++
k)
264 LatticeSpinMatrix elec_dens(
int L,
int M,
int j_decay)
266 SpinMatrix g_one = 1.0;
268 multi1d<LatticeReal>
x(
Nd-1);
273 x[
j++] = Layout::latticeCoordinate(
mu);
277 return LatticeSpinMatrix((Gamma(1 <<
j_decay) * g_one) * rYLM(
x,L,M));
282 LatticeSpinMatrix mag_dens(
int L,
int M,
int j_decay)
284 LatticeSpinMatrix dens;
285 SpinMatrix g_one = 1.0;
287 multi1d<LatticeReal>
x(
Nd-1);
288 multi1d<int> g(
Nd-1);
293 x[
j] = Layout::latticeCoordinate(
mu);
300 multi1d<LatticeComplex>
deriv = deriv_rYLM(
x,L,M);
302 dens = (
x[1]*(Gamma(g[2])*g_one) -
x[2]*(Gamma(g[1])*g_one)) *
deriv[0];
303 dens += (
x[2]*(Gamma(g[0])*g_one) -
x[0]*(Gamma(g[2])*g_one)) *
deriv[1];
304 dens += (
x[0]*(Gamma(g[1])*g_one) -
x[1]*(Gamma(g[0])*g_one)) *
deriv[2];
325 void multipole(
const LatticePropagator& quark_propagator,
326 const LatticePropagator& seq_quark_prop,
337 QDP_error_exit(
"%s only designed and meaningful for Nd=4",__func__);
339 if (j_decay < 0 || j_decay >=
Nd)
355 LatticePropagator anti_quark_prop = Gamma(
G5) * seq_quark_prop * Gamma(
G5);
357 pole.
corr.resize(max_power+1);
360 for(
int L = 0; L < pole.
corr.size(); ++L)
362 pole.
corr[L].resize(2*L+1);
365 for(
int M = -L, MM = 0; MM < pole.
corr[L].size(); ++M, ++MM)
370 multi1d<DComplex> hsum_elec;
372 LatticeComplex corr_fn =
373 trace(adj(anti_quark_prop) * elec_dens(L,M,
j_decay) *
374 quark_propagator * Gamma(GammaInsertion));
376 hsum_elec = sumMulti(corr_fn, phases.
getSet());
382 multi1d<DComplex> hsum_mag;
384 LatticeComplex corr_fn =
385 trace(adj(anti_quark_prop) * mag_dens(L,M,
j_decay) *
386 quark_propagator * Gamma(GammaInsertion));
388 hsum_mag = sumMulti(corr_fn, phases.
getSet());
391 multi1d<Complex> elec_corr(length);
392 multi1d<Complex> mag_corr(length);
394 for (
int t=0;
t < length; ++
t)
396 int t_eff = (
t -
t0 + length) % length;
397 elec_corr[t_eff] = Complex(hsum_elec[
t]);
398 mag_corr[t_eff] = Complex(hsum_mag[
t]);
401 pole.
corr[L][MM].L = L;
402 pole.
corr[L][MM].M = M;
403 pole.
corr[L][MM].electric = elec_corr;
404 pole.
corr[L][MM].magnetic = mag_corr;
410 write(xml, xml_group, pole);
Primary include file for CHROMA library code.
Fourier transform phase factor support.
int numSubsets() const
Number of subsets - length in decay direction.
const Set & getSet() const
The set to be used in sumMulti.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams ¶m)
Writer parameters.
void multipole(const LatticePropagator &quark_propagator, const LatticePropagator &seq_quark_prop, int GammaInsertion, int max_power, int j_decay, int t0, XMLWriter &xml, const std::string &xml_group)
Compute contractions for multipole moments.
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)
push(xml_out,"Condensates")
Fourier transform phase factor support.
multi1d< Complex > electric
multi1d< Complex > magnetic
Storage structure to hold electric and magnetic multipole moments.
multi1d< multi1d< ElecMag_t > > corr
multi1d< LatticeColorMatrix > deriv(const EvenOddPrecLinearOperator< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > &AP, const LatticeFermion &chi, const LatticeFermion &psi, enum PlusMinus isign)
Apply the operator onto a source std::vector.