15 #define QLA_Precision 'D'
16 #define QOP_Precision 2
19 #define QLA_Precision 'F'
20 #define QOP_Precision 1
27 #include <qdp_types.h>
28 #include <qdp_common.h>
31 #include <qdp_d3_generic.h>
34 #include <qdp_f3_generic.h>
42 #include <qla_complex.h>
67 QDP_ColorMatrix *temp1, *temp2, *temp3, *temp4;
70 QDP_Real *treal1, *treal2;
71 treal1 = QDP_create_R();
72 treal2 = QDP_create_R();
73 QDP_R_eq_zero(treal2, QDP_all);
79 temp1 = QDP_create_M();
80 temp2 = QDP_create_M();
81 temp3 = QDP_create_M();
82 temp4 = QDP_create_M();
86 for(
mu=0;
mu<QDP_ndim()-1; ++
mu) {
89 QDP_M_eq_sM(temp1,
link[
nu], QDP_neighbor[
mu], QDP_forward, QDP_all);
90 QDP_M_eq_sM(temp2,
link[
mu], QDP_neighbor[
nu], QDP_forward, QDP_all);
94 QDP_M_eq_M_times_M(temp4, temp3, temp1, QDP_all);
98 QDP_R_eq_re_M_dot_M(treal1, temp2, temp4, QDP_all);
100 QDP_R_peq_R(treal2, treal1, QDP_all);
102 QDP_r_eq_re_M_dot_M(&tplaq, temp2, temp4, QDP_all);
103 QDP_discard_M(temp2);
111 QDP_r_eq_sum_R(&
plaq, treal2, QDP_all);
112 QDP_destroy_R(treal1);
113 QDP_destroy_R(treal2);
116 QDP_destroy_M(temp1);
117 QDP_destroy_M(temp2);
118 QDP_destroy_M(temp3);
119 QDP_destroy_M(temp4);
122 return plaq/(3.0*0.5*QDP_ndim()*(QDP_ndim()-1)*QDP_volume());
132 multi1d<LatticeColorMatrix> & u_chroma)
137 u = (QDP_ColorMatrix **) malloc(ndim*
sizeof(QDP_ColorMatrix *));
138 for(
int i=0;
i<ndim;
i++)
u[
i] = QDP_create_M();
141 QLA_ColorMatrix *
tmp;
143 (QLA_ColorMatrix *) malloc(QDP_sites_on_node*
sizeof(QLA_ColorMatrix));
145 for(
int i=0;
i<ndim;
i++)
147 for(
int site=0 ; site < QDP_sites_on_node ; ++site)
149 for(
int ic = 0 ; ic < 3 ; ++ic)
150 for(
int jc = 0 ; jc < 3 ; ++jc)
153 Real rrr = u_chroma[
i].elem(site).elem().elem(ic,jc).real() ;
154 Real iii = u_chroma[
i].elem(site).elem().elem(ic,jc).imag() ;
156 QLA_Real zre = toFloat(rrr) ;
157 QLA_Real zim = toFloat(iii) ;
159 QLA_C_eq_R_plus_i_R(&
z,&zre,&zim) ;
162 QLA_M_eq_elem_C(&
tmp[site],&
z,ic,jc) ;
168 QDP_insert_M(
u[
i],
tmp,QDP_all) ;
177 QDPIO::cout <<
"QDP_create_gauge_from_chroma:: plaquette = " <<
plaq <<
"\n";
187 const LatticeStaggeredFermion &
in )
189 QLA_ColorVector *
tmp;
191 (QLA_ColorVector *) malloc(QDP_sites_on_node*
sizeof(QLA_ColorVector));
193 for(
int site=0 ; site < QDP_sites_on_node ; ++site)
196 for(
int ic = 0 ; ic < 3 ; ++ic)
200 Real rrr =
in.elem(site).elem(0).elem(ic).real() ;
201 Real iii =
in.elem(site).elem(0).elem(ic).imag() ;
204 QLA_Real zim = toFloat(iii) ;
206 QLA_C_eq_R_plus_i_R(&
z,&zre,&zim) ;
208 QLA_V_eq_elem_C(&
tmp[site],&
z,ic) ;
216 QDP_insert_V(
out,
tmp,QDP_all) ;
235 QLA_ColorVector *
tmp;
236 tmp = QDP_expose_V(
in) ;
239 for(
int site=0 ; site < QDP_sites_on_node ; ++site)
241 for(
int ic = 0 ; ic < 3 ; ++ic)
243 QLA_C_eq_elem_V(&
z,&
tmp[site],ic) ;
251 Real zre_chroma , zim_chroma ;
252 zre_chroma = (Real) zre ;
253 zim_chroma = (Real) zim ;
261 out.elem(site).elem(0).elem(ic).real() = toFloat(zre_chroma) ;
262 out.elem(site).elem(0).elem(ic).imag() = toFloat(zim_chroma) ;
283 QLA_Real ferm_epsilon;
284 #define MAX_BASIC_PATHS 6
286 ( 1.0/8.0)+(6.0/16.0)+(1.0/8.0),
291 (-1.0/8.0)*0.125*(1.0/6.0),
299 ferm_epsilon = weight;
303 c->one_link = act_path_coeff[0]*ferm_epsilon ;
304 c->naik = act_path_coeff[1]*ferm_epsilon ;
305 c->three_staple = act_path_coeff[2]*ferm_epsilon ;
306 c->five_staple = act_path_coeff[3]*ferm_epsilon ;
307 c->seven_staple = act_path_coeff[4]*ferm_epsilon ;
308 c->lepage = act_path_coeff[5]*ferm_epsilon ;
331 static QDP_ColorVector *
out ;
332 static QDP_ColorVector *
in ;
336 static QOP_FermionLinksAsqtad *
fla ;
342 multi1d<LatticeColorMatrix>,
343 multi1d<LatticeColorMatrix> >& S_,
347 invParam(invParam_),
Mass(S_.getQuarkMass()),
352 const multi1d<LatticeColorMatrix>&
u =
state->getLinks();
354 const multi1d<LatticeColorMatrix>& u_fat =
state->getFatLinks();
355 const multi1d<LatticeColorMatrix>& u_triple =
state->getTripleLinks();
357 multi1d<LatticeColorMatrix> u_chroma(
Nd);
359 QDP_ColorMatrix **u_fat_qdp;
364 QDP_ColorMatrix **u_triple_qdp;
365 u_chroma = u_triple ;
369 fla = QOP_asqtad_convert_L_from_qdp(u_fat_qdp,u_triple_qdp) ;
372 for(
int i=0;
i<
Nd ;
i++) QDP_destroy_M(u_fat_qdp[
i]);
376 for(
int i=0;
i<
Nd;
i++) QDP_destroy_M(u_triple_qdp[
i]);
383 multi1d<LatticeColorMatrix> u_with_phases(
Nd);
384 state.getFermBC().modify(u_with_phases);
389 multi1d<LatticeColorMatrix> u_chroma(
Nd);
391 for(
int i = 0;
i <
Nd;
i++) {
398 QOP_asqtad_coeffs_t coeffs;
403 QDP_ColorMatrix **uqdp ;
407 gf = QOP_convert_G_from_qdp(uqdp);
410 fla = QOP_asqtad_create_L_from_G(&
info, &coeffs, gf);
426 QOP_asqtad_destroy_L(
fla) ;
432 const LatticeStaggeredFermion& q_source)
const
437 out = QDP_create_V();
445 QOP_ColorVector *qopout, *qopin;
446 qopout = QOP_create_V_from_qdp(
out);
447 qopin = QOP_create_V_from_qdp(
in);
449 QOP_invert_arg_t inv_arg;
450 QOP_resid_arg_t res_arg;
459 inv_arg.max_restarts = 1;
463 inv_arg.evenodd = QOP_EVENODD ;
467 QDPIO::cout <<
"level3 asqtad inverter mass = " <<
Mass ;
468 QDPIO::cout <<
" iters = " <<
invParam.
MaxCG <<
" restarts= " ;
469 QDPIO::cout << inv_arg.max_restarts <<
"\n" ;
472 QOP_verbose(QOP_VERB_HI);
473 QOP_asqtad_invert(&
info,
fla, &inv_arg, &res_arg,
mass, qopout, qopin);
475 QDPIO::cout <<
"QOP Inversion results\n" ;
476 QDPIO::cout <<
"QOP iters = " << res_arg.final_iter <<
"\n" ;
477 QDPIO::cout <<
"QOP final restart = " << res_arg.final_restart <<
"\n" ;
478 QDPIO::cout <<
"QOP ||r||^2 = " << res_arg.final_rsq <<
"\n" ;
479 QDPIO::cout <<
"QOP ||r|| = " << sqrt(res_arg.final_rsq) <<
"\n" ;
480 res.
n_count = res_arg.final_iter ;
481 res.
resid = res_arg.final_rsq;
484 QOP_extract_V_to_qdp(
out,qopout) ;
491 Real mass_scale = 4.0 *
Mass ;
495 psi = tt / mass_scale ;
503 res.
resid = sqrt(norm2(
r));
504 QDPIO::cout <<
"AsqtadCPSWrapperQprop: true residual: " << res.
resid << std::endl;
505 QDPIO::cout <<
"AsqtadCPSWrapperQprop: || q_source ||: " << sqrt(norm2(q_source)) << std::endl;
507 QDPIO::cout <<
"AsqtadCPSWrapperQprop: true residual/source: " << res.
resid/ sqrt(norm2(q_source)) << std::endl;
511 QOP_destroy_V(qopout);
512 QOP_destroy_V(qopin);
526 int tmp = ::QDP_initialize(argc,argv ) ;
528 QDPIO::cout <<
"Setting up the level 3 code\n" ;
529 QDPIO::cout <<
"----------------------------\n";
533 lattice_size = (
int *) malloc(ndim*
sizeof(
int));
534 for(
int i=0 ;
i < ndim ; ++
i)
535 lattice_size[
i] = nrow[
i] ;
537 QDPIO::cout <<
"QDP/QOP lattice volume = " ;
538 QDPIO::cout << lattice_size[0] <<
" " << lattice_size[1] <<
" " ;
539 QDPIO::cout << lattice_size[2] <<
" " << lattice_size[3] <<
"\n" ;
542 QDPIO::cout <<
"DOUBLE PRECISION level3\n" ;
544 QDPIO::cout <<
"SINGLE PRECISION level3\n" ;
549 QDP_set_latsize(ndim, lattice_size);
553 QOP_layout_t qoplayout;
554 qoplayout.latdim = ndim;
555 qoplayout.latsize = (
int *) malloc(ndim*
sizeof(
int));
556 for(
int i=0;
i<ndim;
i++) {
557 qoplayout.latsize[
i] = lattice_size[
i];
559 qoplayout.machdim = -1;
560 QOP_init(&qoplayout);
void load_qop_asqtad_coeffs(QOP_asqtad_coeffs_t *c, QLA_Real weight)
void convert_chroma_to_qdp(QDP_ColorVector *out, const LatticeStaggeredFermion &in)
void setup_levelthree(multi1d< int > nrow, int *argc, char ***argv)
QLA_Real get_plaq(QDP_ColorMatrix *link[])
QDP_ColorMatrix ** QDP_create_gauge_from_chroma(multi1d< LatticeColorMatrix > &u_chroma)
void convert_qdp_to_chroma(LatticeStaggeredFermion &out, QDP_ColorVector *in)
Propagator solver for an even-odd non-preconditioned fermion operator.
Primary include file for CHROMA library code.
LatticeStaggeredFermion T
SysSolverCGParams invParam
Handle< AsqtadConnectStateBase > state
SystemSolverResults_t operator()(LatticeStaggeredFermion &psi, const LatticeStaggeredFermion &chi) const
Solver the linear system.
~AsqtadCPSWrapperQprop()
Destructor is automatic.
Basic "Connect State" for ASQTAD.
Even-odd preconditioned Staggered-like fermion actions.
Support class for fermion actions and linear operators.
Class for counted reference semantics.
static const LatticeInteger & alpha(const int dim)
Asqtad Staggered-Dirac operator.
static multi1d< LatticeColorMatrix > u
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > const multi1d< Real > & Mass
static QOP_FermionLinksAsqtad * fla
static QDP_ColorVector * out
Constructor.
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
static QDP_ColorVector * in
Holds return info from SystemSolver call.