00001
00002
00003
00004
00005
00006
00007
00008 #include "chromabase.h"
00009 #include "util/ft/sftmom.h"
00010 #include "meas/hadron/formfac_w.h"
00011
00012 namespace Chroma
00013 {
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 void read(BinaryReader& bin, FormFac_momenta_t& mom)
00025 {
00026 read(bin, mom.magic);
00027 if (mom.magic != 20301)
00028 {
00029 QDPIO::cerr << "read(FormFac_momenta_t): magic number invalid" << endl;
00030 QDP_abort(1);
00031 }
00032 read(bin, mom.inser_mom);
00033 read(bin, mom.local_current);
00034 read(bin, mom.nonlocal_current);
00035 }
00036
00037
00038 void read(BinaryReader& bin, FormFac_insertion_t& mes)
00039 {
00040 read(bin, mes.gamma_value);
00041 read(bin, mes.momenta);
00042 }
00043
00044
00045 void read(BinaryReader& bin, FormFac_insertions_t& form)
00046 {
00047 read(bin, form.output_version);
00048 read(bin, form.formFac);
00049 }
00050
00051
00052 void write(BinaryWriter& bin, const FormFac_momenta_t& mom)
00053 {
00054 int magic = 20301;
00055 write(bin, magic);
00056 write(bin, mom.inser_mom);
00057 write(bin, mom.local_current);
00058 write(bin, mom.nonlocal_current);
00059 }
00060
00061
00062 void write(BinaryWriter& bin, const FormFac_insertion_t& mes)
00063 {
00064 write(bin, mes.gamma_value);
00065 write(bin, mes.momenta);
00066 }
00067
00068
00069 void write(BinaryWriter& bin, const FormFac_insertions_t& form)
00070 {
00071 write(bin, form.output_version);
00072 write(bin, form.formFac);
00073 }
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093 void FormFac(FormFac_insertions_t& form,
00094 const multi1d<LatticeColorMatrix>& u,
00095 const LatticePropagator& quark_propagator,
00096 const LatticePropagator& seq_quark_prop,
00097 int gamma_insertion,
00098 const SftMom& phases,
00099 int t0)
00100 {
00101 START_CODE();
00102
00103
00104 int length = phases.numSubsets();
00105
00106 int G5 = Ns*Ns-1;
00107
00108
00109 LatticePropagator anti_quark_prop = Gamma(G5) * seq_quark_prop * Gamma(G5);
00110
00111
00112
00113
00114
00115
00116 form.formFac.resize(Nd*Nd);
00117
00118
00119 for(int gamma_value = 0; gamma_value < Nd*Nd; ++gamma_value)
00120 {
00121
00122
00123
00124
00125
00126
00127
00128 bool compute_nonlocal;
00129 int mu;
00130
00131 switch(gamma_value){
00132 case 1:
00133 case 14:
00134 mu = 0;
00135 compute_nonlocal = true;
00136 break;
00137 case 2:
00138 case 13:
00139 mu = 1;
00140 compute_nonlocal = true;
00141 break;
00142 case 4:
00143 case 11:
00144 mu = 2;
00145 compute_nonlocal = true;
00146 break;
00147 case 8:
00148 case 7:
00149 mu = 3;
00150 compute_nonlocal = true;
00151 break;
00152 default:
00153 mu = -1;
00154 compute_nonlocal = false;
00155 }
00156
00157
00158 LatticeComplex corr_local_fn =
00159 trace(adj(anti_quark_prop) * Gamma(gamma_value) * quark_propagator * Gamma(gamma_insertion));
00160
00161 multi2d<DComplex> hsum, hsum_nonlocal;
00162 hsum = phases.sft(corr_local_fn);
00163
00164
00165
00166
00167
00168
00169 LatticeComplex corr_nonlocal_fn;
00170 if(compute_nonlocal){
00171 corr_nonlocal_fn =
00172 trace(adj(u[mu] * shift(anti_quark_prop, FORWARD, mu)) *
00173 (quark_propagator + Gamma(gamma_value) * quark_propagator) * Gamma(gamma_insertion));
00174 LatticePropagator tmp_prop1 = u[mu] *
00175 shift(quark_propagator, FORWARD, mu);
00176 corr_nonlocal_fn -= trace(adj(anti_quark_prop) *
00177 (tmp_prop1 - Gamma(gamma_value) * tmp_prop1) * Gamma(gamma_insertion));
00178
00179 hsum_nonlocal = phases.sft(corr_nonlocal_fn);
00180 }
00181
00182
00183 form.formFac[gamma_value].gamma_value = gamma_value;
00184 form.formFac[gamma_value].momenta.resize(phases.numMom());
00185
00186
00187 for(int inser_mom_num=0; inser_mom_num<phases.numMom(); ++inser_mom_num)
00188 {
00189 form.formFac[gamma_value].momenta[inser_mom_num].inser_mom = phases.numToMom(inser_mom_num);
00190
00191 multi1d<Complex> local_cur3ptfn(length);
00192 multi1d<Complex> nonlocal_cur3ptfn;
00193 if (compute_nonlocal)
00194 nonlocal_cur3ptfn.resize(length);
00195
00196 for (int t=0; t < length; ++t)
00197 {
00198 int t_eff = (t - t0 + length) % length;
00199
00200 local_cur3ptfn[t_eff] = Complex(hsum[inser_mom_num][t]);
00201 if (compute_nonlocal)
00202 nonlocal_cur3ptfn[t_eff] = 0.5 * Complex(hsum_nonlocal[inser_mom_num][t]);
00203
00204 }
00205
00206 form.formFac[gamma_value].momenta[inser_mom_num].local_current = local_cur3ptfn;
00207 form.formFac[gamma_value].momenta[inser_mom_num].nonlocal_current = nonlocal_cur3ptfn;
00208
00209 }
00210 }
00211
00212 END_CODE();
00213 }
00214
00215 }