void path(int *dir,int *sign,int length) { register int i; register site *s; msg_tag *mtag0, *mtag1; int j; /* j=0 */ if(sign[0]>0) { mtag0 = start_gather_site( F_OFFSET(link[dir[0]]), sizeof(su3_matrix), OPP_DIR(dir[0]), EVENANDODD, gen_pt[0] ); wait_gather(mtag0); FORALLSITES(i,s){ su3mat_copy((su3_matrix *)(gen_pt[0][i]),&(s->tempmat1) ); }
void static_prop() { register int i; register site *st; msg_tag *tag; int tloop ; int nthalf = nt/2 ; /*************---------**********-------------************/ /* Initialise the gauge part of the propagator ***/ setup_static_prop() ; /* * Calculate the static propagator for positive time * * W(t+1) = W(t) U_4(t) */ for(tloop=1 ; tloop <= nthalf ; ++tloop) { /* The smear_w_line[0] object is used as work space ***/ FORALLSITES(i,st) { mult_su3_nn(&(st->w_line), &(st->link[TUP]), &(st->smear_w_line[0])); } /* Pull the w(t)*u(t) from the previous time slice ***/ tag=start_gather_site( F_OFFSET(smear_w_line[0]), sizeof(su3_matrix), TDOWN, EVENANDODD, gen_pt[0] ); wait_gather(tag); FORALLSITES(i,st) { if( st-> t == tloop ) su3mat_copy((su3_matrix *) gen_pt[0][i], &(st->w_line)); } cleanup_gather(tag); } /* end the loop over time slice ***/
// ----------------------------------------------------------------- // Modified to return total number of iterations int f_meas_imp(field_offset chi_off, field_offset psi_off, Real mass) { register int i; register site *s; int jpbp_reps, tot_iters = 0, miters, npbp_reps = 1; Real r_pbp_even, i_pbp_even, r_pbp_odd, i_pbp_odd, r_ferm_action; double rfaction; complex tc; double_complex pbp_e, pbp_o; #ifdef NPBP_REPS double pbp_pbp; npbp_reps = NPBP_REPS; // Number of stochastic estimations #endif for (jpbp_reps = 0; jpbp_reps < npbp_reps; jpbp_reps++) { rfaction = 0; pbp_e = dcmplx(0, 0); pbp_o = dcmplx(0, 0); // Make random source and do inversion // Generate (one-mass) g_rand; chi_off = M g_rand grsource_imp(chi_off, mass, EVENANDODD); // chi_off = M g_rand (still) // psi_off = M^{-1} g_rand clear_latvec(psi_off, EVENANDODD); miters = mat_invert_uml(F_OFFSET(g_rand), psi_off, chi_off, mass); tot_iters += miters; // Fermion action = chi.psi // pbp on even sites = g_rand.psi FOREVENSITES(i, s) { tc = su3_dot((vector *)F_PT(s, chi_off), (vector *)F_PT(s, psi_off)); rfaction += tc.real; tc = su3_dot(&(s->g_rand), (vector *)F_PT(s, psi_off)); CSUM(pbp_e, tc); } // pbp on odd sites FORODDSITES(i, s) { tc = su3_dot(&(s->g_rand), (vector *)F_PT(s, psi_off)); CSUM(pbp_o, tc); }
static QOP_FermionLinksWilson * create_qop_wilson_fermion_links( Real clov ){ clover *milc_clov = gen_clov; MYSU3_MATRIX **raw_links; MYREAL *raw_clov; QOP_FermionLinksWilson *qop_links; /* Construct raw QOP clover term from MILC clover term */ if(clov == 0){ raw_clov = NULL; } else{ raw_clov = (MYREAL *)malloc(72*sites_on_node*sizeof(MYREAL)); if(raw_clov == NULL){ printf("create_qop_wilson_fermion_links(%d): no room for raw_clov\n", this_node); terminate(1); } // milc_clov = create_clov(); /* Note Real clov has no kappa factor! */ if(milc_clov == NULL) terminate(1); compute_clov(milc_clov,clov); map_milc_clov_to_qop_raw(raw_clov, milc_clov); //free_this_clov(milc_clov); } raw_links = CREATE_RAW4_G_FROM_SITE(F_OFFSET(link), EVENANDODD); if(raw_links == NULL)terminate(1); /* Map QOP/QDP raw to QOP/QDP structure */ qop_links = QOP_wilson_create_L_from_raw((MYREAL **)raw_links, raw_clov, QOP_EVENODD); DESTROY_RAW4_G(raw_links); raw_links = NULL; free(raw_clov); return qop_links; }
static QOP_FermionLinksWilson * create_qop_wilson_fermion_links( Real clov ){ clover *milc_clov = gen_clov; dsu3_matrix **raw_links; double *raw_clov; QOP_FermionLinksWilson *qop_links; /* Construct raw QOP clover term from MILC clover term */ if(clov == 0){ raw_clov = NULL; } else{ raw_clov = (double *)malloc(72*sites_on_node*sizeof(double)); if(raw_clov == NULL){ printf("create_qop_wilson_fermion_links(%d): no room for raw_clov\n", this_node); terminate(1); } // milc_clov = create_clov(); /* Note Real clov has no kappa factor! */ if(milc_clov == NULL) terminate(1); compute_clov(milc_clov,clov); map_milc_clov_to_qop_raw(raw_clov, milc_clov); //free_this_clov(milc_clov); } raw_links = create_raw4_D_G_from_site(F_OFFSET(link), EVENANDODD); if(raw_links == NULL)terminate(1); /* Map QOP/QDP raw to QOP/QDP structure */ qop_links = QOP_wilson_create_L_from_raw((double **)raw_links, raw_clov, QOP_EVENODD); destroy_raw4_D_G(raw_links); raw_links = NULL; free(raw_clov); return qop_links; }
/* "parity" is EVEN, ODD, or EVENANDODD. The parity is the parity at which phi is computed. g_rand must always be computed at all sites. */ void grsource(int parity) { register int i,j; register site *s; FORALLSITES(i,s){ #ifdef SCHROED_FUN if(s->t > 0){ #endif for(j=0;j<3;j++){ #ifdef SITERAND s->g_rand.c[j].real = gaussian_rand_no(&(s->site_prn)); s->g_rand.c[j].imag = gaussian_rand_no(&(s->site_prn)); #else s->g_rand.c[j].real = gaussian_rand_no(&node_prn); s->g_rand.c[j].imag = gaussian_rand_no(&node_prn); #endif } #ifdef SCHROED_FUN } else{ /* Set all fermion vectors to zero at t=0 */ for(j=0;j<3;j++){ s->phi.c[j].real = s->phi.c[j].imag = 0.0; s->resid.c[j].real = s->resid.c[j].imag = 0.0; s->cg_p.c[j].real = s->cg_p.c[j].imag = 0.0; s->xxx.c[j].real = s->xxx.c[j].imag = 0.0; s->ttt.c[j].real = s->ttt.c[j].imag = 0.0; s->g_rand.c[j].real = s->g_rand.c[j].imag = 0.0; } } #endif } clear_latvec( F_OFFSET(xxx), EVENANDODD ); dslash( F_OFFSET(g_rand), F_OFFSET(phi), parity); scalar_mult_latvec( F_OFFSET(phi), -1.0, F_OFFSET(phi), parity ); scalar_mult_add_latvec( F_OFFSET(phi), F_OFFSET(g_rand), 2.0*mass, F_OFFSET(phi), parity ); }/* grsource */
void gluon_prop( void ) { register int i,dir; register int pmu; register site *s; anti_hermitmat ahtmp; Real pix, piy, piz, pit; Real sin_pmu, sin_pmu2, prop_s, prop_l, ftmp1, ftmp2; complex ctmp; su3_matrix mat; struct { Real f1, f2; } msg; double trace, dmuAmu; int px, py, pz, pt; int currentnode,newnode; pix = PI / (Real)nx; piy = PI / (Real)ny; piz = PI / (Real)nz; pit = PI / (Real)nt; trace = 0.0; /* Make A_mu as anti-hermition traceless part of U_mu */ /* But store as SU(3) matrix for call to FFT */ for(dir=XUP; dir<=TUP; dir++) { FORALLSITES(i,s){ trace += (double)(trace_su3( &(s->link[dir]))).real; make_anti_hermitian( &(s->link[dir]), &ahtmp); uncompress_anti_hermitian( &ahtmp, &(s->a_mu[dir])); } g_sync(); /* Now Fourier transform */ restrict_fourier_site(F_OFFSET(a_mu[dir]), sizeof(su3_matrix), FORWARDS); }
int main(int argc,char *argv[]) { int meascount; int prompt; Real avm_iters,avs_iters; double starttime,endtime,dclock(); double dtime; int MinCG,MaxCG; Real RsdCG; register int i; register site *s; int spinindex,spin,color,j,k,t,t_off; int kh,kl; int nr_fb; char nr_fb_label[3][2] = { "0", "F", "B" }; int flag; int kprop; int num_prop; Real space_vol; int status; propagator hdibar_prop[MAX_KAP][MAX_KAP][HDIPROPS]; propagator nrbar_prop[MAX_KAP][MAX_KAP][NRPROPS]; char scratch_file[MAX_KAP][MAXFILENAME]; Real norm_fac[10]; static char *mes_kind[10] = {"PION","PS505","PS055","PS0505", "RHO33","RHO0303","SCALAR","SCALA0","PV35","B12"}; complex *pmes_prop[MAX_KAP][MAX_KAP][10]; int pmes_prop_done[MAX_KAP][MAX_KAP]; w_prop_file *fp_in_w[MAX_KAP]; /* For reading binary propagator files */ w_prop_file *fp_out_w[MAX_KAP]; /* For writing binary propagator files */ w_prop_file *fp_scr[MAX_KAP]; initialize_machine(&argc,&argv); #ifdef HAVE_QDP QDP_initialize(&argc, &argv); #endif /* Remap standard I/O */ if(remap_stdio_from_args(argc, argv) == 1)terminate(1); g_sync(); /* set up */ prompt = setup_H_cl(); /* loop over input sets */ while( readin(prompt) == 0) { MaxCG = niter; starttime=dclock(); avm_iters=0.0; meascount=0; /* Allocate space for relativistic meson propagator */ for(num_prop=0;num_prop<10;num_prop++) for(i=0;i<num_kap;i++)for(j=0;j<=i;j++){ pmes_prop[i][j][num_prop] = (complex *)malloc(nt*sizeof(complex)); for(t=0;t<nt;t++){ pmes_prop[i][j][num_prop][t] = cmplx(0.0,0.0); } pmes_prop_done[i][j] = 0; } /* Allocate space for non relativistic baryon propagators */ for(kprop=0;kprop<NRPROPS;kprop++) for(i=0;i<num_kap;i++)for(j=0;j<num_kap;j++){ nrbar_prop[i][j][kprop].c = (complex *)malloc(nt*sizeof(complex)); if(nrbar_prop[i][j][kprop].c == NULL) { printf("control_H_cl: Can't malloc nrbar prop %d %d %d\n", i,j,kprop); terminate(1); } for(t=0;t<nt;t++)nrbar_prop[i][j][kprop].c[t] = cmplx(0.0,0.0); nrbar_prop[i][j][kprop].label = (char *)malloc(10*sizeof(char)); if(nrbar_prop[i][j][kprop].c == NULL) { printf("control_H_cl: Can't malloc nrbar prop label %d %d %d\n", i,j,kprop); terminate(1); } } /* Allocate space for H-dibaryon channel propagators */ for(kprop=0;kprop<HDIPROPS;kprop++) for(kh=0;kh<num_kap_heavy;kh++)for(kl=0;kl<num_kap_light;kl++){ /* kappa indexing scheme is consistent with baryon propagator even though we compute only the propagators with one heavy (s) quark and two light (u,d) quarks */ i = kh; j = kl + num_kap_heavy; hdibar_prop[i][j][kprop].c = (complex *)malloc(nt*sizeof(complex)); if(hdibar_prop[i][j][kprop].c == NULL) { printf("control_H_cl: Can't malloc baryon prop %d %d %d\n", i,j,kprop); terminate(1); } for(t=0;t<nt;t++)hdibar_prop[i][j][kprop].c[t] = cmplx(0.0,0.0); hdibar_prop[i][j][kprop].label = (char *)malloc(10*sizeof(char)); if(hdibar_prop[i][j][kprop].label == NULL) { printf("control_H_cl: Can't malloc baryon prop label %d %d %d\n", i,j,kprop); terminate(1); } } if( fixflag == COULOMB_GAUGE_FIX) { if(this_node == 0) printf("Fixing to Coulomb gauge\n"); STARTIOTIME; gaugefix(TUP,(Real)1.5,500,GAUGE_FIX_TOL); STOPIOTIME("gauge fix"); invalidate_this_clov(gen_clov); } else if(this_node == 0)printf("COULOMB GAUGE FIXING SKIPPED.\n"); /* save lattice if requested */ if( saveflag != FORGET ){ /* Note: beta, kappa are kept only for save_old_binary */ STARTIOTIME; savelat_p = save_lattice( saveflag, savefile, stringLFN ); STOPIOTIME("save lattice"); } if(this_node==0)printf("END OF HEADER\n"); /* Loop over all kappas to compute and store quark propagator */ for(k=0;k<num_kap;k++){ kappa = kap[k]; source_r0=wqs[k].r0; RsdCG=resid[k]; if(this_node==0)printf("Kappa=%e r0=%e residue=%e\n", (double)kappa,(double)source_r0,(double)RsdCG); /* open file for kth wilson propagator */ fp_in_w[k] = r_open_wprop(startflag_w[k], startfile_w[k]); fp_out_w[k] = w_open_wprop(saveflag_w[k], savefile_w[k], wqs[k].type); /* Open scratch file and write header */ sprintf(scratch_file[k],"%s_%02d",scratchstem_w,k); if(scratchflag == SAVE_CHECKPOINT) { fp_scr[k] = w_checkpoint_w_i(scratch_file[k]); /* Close, temporarily */ w_checkpoint_w_c(fp_scr[k]); } else /* If serial, write header and leave it open */ fp_scr[k] = w_serial_w_i(scratch_file[k]); /* Loop over source colors */ for(color=0;color<3;color++){ for(spinindex=0;spinindex<n_spins;spinindex++){ spin = spins[spinindex]; meascount ++; if(this_node==0)printf("color=%d spin=%d\n",color,spin); if(startflag_w[k] == CONTINUE) { if(k == 0) { node0_printf("Can not continue propagator here! Zeroing it instead\n"); startflag_w[k] = FRESH; } else { FORALLSITES(i,s) copy_wvec(&(s->quark_propagator.c[color].d[spin]), &(s->psi)); } } /* Saves one multiplication by zero in cgilu */ if(startflag_w[k] == FRESH)flag = 0; else flag = 1; /* load psi if requested */ #ifdef IOTIME status = reload_wprop_sc_to_site( startflag_w[k], fp_in_w[k], spin, color, F_OFFSET(psi),1); #else status = reload_wprop_sc_to_site( startflag_w[k], fp_in_w[k], spin, color, F_OFFSET(psi),0); #endif if(status != 0) { node0_printf("control_H_cl: Recovering from error by resetting initial guess to zero\n"); reload_wprop_sc_to_site( FRESH, fp_in_w[k], spin, color, F_OFFSET(psi),0); flag = 0; } /* Invert to find propagator */ /* Complete the source structure */ wqs[k].color = color; wqs[k].spin = spin; /* For clover_info */ wqstmp = wqs[k]; /* If we are starting afresh, we set a minimum number of iterations */ if(startflag_w[k] == FRESH || status != 0)MinCG = nt; else MinCG = 0; /* Load inversion control structure */ qic.prec = PRECISION; qic.min = MinCG; qic.max = MaxCG; qic.nrestart = nrestart; qic.resid = RsdCG; qic.start_flag = flag; /* Load Dirac matrix parameters */ dcp.Kappa = kappa; dcp.Clov_c = clov_c; dcp.U0 = u0; #ifdef BI /* compute the propagator. Result in psi. */ avs_iters = (Real)wilson_invert_site_wqs(F_OFFSET(chi),F_OFFSET(psi), w_source,&wqs[k], bicgilu_cl_site,&qic,(void *)&dcp); #else /* compute the propagator. Result in psi. */ avs_iters = (Real)wilson_invert_site_wqs(F_OFFSET(chi),F_OFFSET(psi), w_source,&wqs[k], cgilu_cl_site,&qic,(void *)&dcp); #endif avm_iters += avs_iters; FORALLSITES(i,s) copy_wvec(&(s->psi), &(s->quark_propagator.c[color].d[spin])); STARTIOTIME; /* Write psi to scratch disk */ if(scratchflag == SAVE_CHECKPOINT) { w_checkpoint_w_o(fp_scr[k]); w_checkpoint_w(fp_scr[k],spin,color,F_OFFSET(psi)); w_checkpoint_w_c(fp_scr[k]); } else w_serial_w(fp_scr[k],spin,color,F_OFFSET(psi)); STOPIOTIME("do fast quark dump"); /* save psi if requested */ #ifdef IOTIME save_wprop_sc_from_site( saveflag_w[k],fp_out_w[k], spin,color,F_OFFSET(psi),1); #else save_wprop_sc_from_site( saveflag_w[k],fp_out_w[k], spin,color,F_OFFSET(psi),0); #endif } /* source spins */ } /* source colors */ /* Close and release scratch file */ if(scratchflag == SAVE_CHECKPOINT) w_checkpoint_w_f(fp_scr[k]); else w_serial_w_f(fp_scr[k]); if(this_node==0)printf("Saved binary wilson_vector in file %s\n", scratch_file[k]); /* close files for wilson propagators */ r_close_wprop(startflag_w[k],fp_in_w[k]); w_close_wprop(saveflag_w[k],fp_out_w[k]); } /* kappas */ /* Loop over choice forward - backward for NR source and sink */ for(nr_fb = 1; nr_fb <= 2; nr_fb++)if(nr_fb & nr_forw_back) { /* Reset completion flags */ for(i=0;i<num_kap;i++)for(j=0;j<num_kap;j++){ for(kprop=0;kprop<NRPROPS;kprop++) nrbar_prop[i][j][kprop].done = 0; for(kprop=0;kprop<HDIPROPS;kprop++) hdibar_prop[i][j][kprop].done = 0; } /* Loop over heavy kappas for the point sink spectrum */ for(k=0;k<num_kap_heavy;k++){ /* Read the kth heavy kappa propagator from the scratch file */ kappa = kappa_heavy = kap[k]; if(scratchflag == SAVE_CHECKPOINT) fp_scr[k] = r_parallel_w_i(scratch_file[k]); else fp_scr[k] = r_serial_w_i(scratch_file[k]); STARTIOTIME; for(color=0;color<3;color++) for(spin=0;spin<4;spin++){ if(scratchflag == SAVE_CHECKPOINT) r_parallel_w(fp_scr[k], spin, color, F_OFFSET(quark_propagator.c[color].d[spin])); else r_serial_w(fp_scr[k], spin, color, F_OFFSET(quark_propagator.c[color].d[spin])); } STOPIOTIME("to read 12 spin-color combinations"); if(scratchflag == SAVE_CHECKPOINT) r_parallel_w_f(fp_scr[k]); else r_serial_w_f(fp_scr[k]); /* Convert to NR propagator */ STARTPRTIME; nr_propagator(F_OFFSET(quark_propagator), F_OFFSET(nr_prop1), nr_fb); diquarkprop(F_OFFSET(nr_prop1), F_OFFSET(diquark_prop1)); STOPPRTIME("make nr and diquark"); /* Diagonal spectroscopy - not needed */ /** w_nrbaryon(F_OFFSET(nr_prop1), F_OFFSET(nr_prop1), F_OFFSET(diquark_prop1), nrbar_prop[k][k]); **/ /** w_hdibaryon(F_OFFSET(diquark_prop1), F_OFFSET(diquark_prop1), hdibar_prop[k][k]); **/ /* Heavy-light spectroscopy */ /* Loop over light kappas for the point sink spectrum */ for(j=num_kap_heavy;j<num_kap;j++){ /* Read the propagator from the scratch file */ kappa = kappa_light = kap[j]; if(scratchflag == SAVE_CHECKPOINT) fp_scr[j] = r_parallel_w_i(scratch_file[j]); else fp_scr[j] = r_serial_w_i(scratch_file[j]); STARTIOTIME; for(color=0;color<3;color++) for(spin=0;spin<4;spin++){ if(scratchflag == SAVE_CHECKPOINT) r_parallel_w(fp_scr[j], spin, color, F_OFFSET(quark_prop2.c[color].d[spin])); else r_serial_w(fp_scr[j], spin, color, F_OFFSET(quark_prop2.c[color].d[spin])); } STOPIOTIME("do fast quark read"); if(scratchflag == SAVE_CHECKPOINT) r_parallel_w_f(fp_scr[j]); else r_serial_w_f(fp_scr[j]); /* Convert to NR propagator */ STARTPRTIME; nr_propagator(F_OFFSET(quark_prop2), F_OFFSET(nr_prop2),nr_fb); diquarkprop(F_OFFSET(nr_prop2), F_OFFSET(diquark_prop2)); STOPPRTIME("make nr and diquark propagators"); /* Diagonal spectroscopy - baryons only - done if any of them was not previously done */ for(kprop=0;kprop<NRPROPS;kprop++) { if(nrbar_prop[j][j][kprop].done == 0) { STARTPRTIME; w_nrbaryon(F_OFFSET(nr_prop2), F_OFFSET(nr_prop2), F_OFFSET(diquark_prop2), nrbar_prop[j][j]); STOPPRTIME("do diagonal baryons"); break; } } /* Heavy-light spectroscopy - baryons and H */ /* We don't do baryon heavy-light if the kappa values are the same, since the result is the same as the diagonal light propagator */ if(kappa_heavy != kappa_light) { /* Relativistic meson propagator: Do only once */ if(pmes_prop_done[j][k] == 0) { STARTPRTIME; for(color=0;color<3;color++){ w_meson_site(F_OFFSET(quark_propagator.c[color]), F_OFFSET(quark_prop2.c[color]), pmes_prop[j][k]); } pmes_prop_done[j][k] = 1; STOPPRTIME("do off-diagonal relativistic meson"); } STARTPRTIME; w_nrbaryon(F_OFFSET(nr_prop2), F_OFFSET(nr_prop1),F_OFFSET(diquark_prop1), nrbar_prop[j][k]); w_nrbaryon(F_OFFSET(nr_prop1), F_OFFSET(nr_prop2),F_OFFSET(diquark_prop2), nrbar_prop[k][j]); STOPPRTIME("do two sets of hl baryons"); } /* For H we do only the case prop2 = u (light) index j and prop1 = s (heavy) index k */ STARTPRTIME; w_hdibaryon(F_OFFSET(diquark_prop2), F_OFFSET(diquark_prop1), hdibar_prop[k][j]); STOPPRTIME("do one set of hl H dibaryons"); } /* light kappas */ } /* heavy kappas */ /* Stick with same convention as clover_invert/control_cl_hl.c */ space_vol = (Real)(nx*ny*nz); for(num_prop=0;num_prop<10;num_prop++) norm_fac[num_prop] = space_vol; norm_fac[4] *= 3.0; norm_fac[5] *= 3.0; norm_fac[8] *= 3.0; norm_fac[9] *= 3.0; /* print relativistic meson propagators */ for(num_prop=0;num_prop<10;num_prop++) for(i=0;i<num_kap;i++) for(j=0;j<=i;j++) if(pmes_prop_done[i][j] == 1){ for(t = 0; t < nt; t++){ t_off = (t + source_time)%nt; g_floatsum( &pmes_prop[i][j][num_prop][t_off].real ); pmes_prop[i][j][num_prop][t_off].real /= norm_fac[num_prop]; g_floatsum( &pmes_prop[i][j][num_prop][t_off].imag ); pmes_prop[i][j][num_prop][t_off].imag /= norm_fac[num_prop]; if(this_node == 0) printf("POINT%s %d %d %d %e %e\n", mes_kind[num_prop],i,j,t, (double)pmes_prop[i][j][num_prop][t_off].real, (double)pmes_prop[i][j][num_prop][t_off].imag); } } /* Once printed, this propagator should be neither calculated nor printed again */ for(i=0;i<num_kap;i++) for(j=0;j<=i;j++) if(pmes_prop_done[i][j] == 1) pmes_prop_done[i][j] = 2; /* print non-relativistic baryon propagators */ if(this_node == 0) for(kprop=0;kprop<NRPROPS;kprop++) for(i=0;i<num_kap;i++){ for(j=0;j<i;j++) if(nrbar_prop[i][j][kprop].done==1){ for(t = 0; t < nt; t++){ t_off = (t + source_time)%nt; /* Periodic boundary conditions - no wraparound sign */ printf("%s_NR%s %d %d %d %d %e %e\n", nr_fb_label[nr_fb], nrbar_prop[i][j][kprop].label,i,j,j,t, (double)nrbar_prop[i][j][kprop].c[t_off].real, (double)nrbar_prop[i][j][kprop].c[t_off].imag); } } if(nrbar_prop[i][i][kprop].done==1) for(t = 0; t < nt; t++){ t_off = (t + source_time)%nt; printf("%s_NR%s %d %d %d %d %e %e\n", nr_fb_label[nr_fb], nrbar_prop[i][j][kprop].label,i,i,i,t, (double)nrbar_prop[i][i][kprop].c[t_off].real, (double)nrbar_prop[i][i][kprop].c[t_off].imag); } for(j=i+1;j<num_kap;j++) if(nrbar_prop[i][j][kprop].done==1) for(t = 0; t < nt; t++){ t_off = (t + source_time)%nt; printf("%s_NR%s %d %d %d %d %e %e\n", nr_fb_label[nr_fb], nrbar_prop[i][j][kprop].label,j,j,i,t, (double)nrbar_prop[i][j][kprop].c[t_off].real, (double)nrbar_prop[i][j][kprop].c[t_off].imag); } } /* print H-dibaryon mixed channel propagators */ if(this_node == 0) for(kprop=0;kprop<HDIPROPS;kprop++) for(i=0;i<num_kap;i++){ for(j=0;j<num_kap;j++)if(hdibar_prop[i][j][kprop].done==1){ for(t = 0; t < nt; t++){ t_off = (t + source_time)%nt; printf("%s_%s %d %d %d %d %e %e\n", nr_fb_label[nr_fb], hdibar_prop[i][j][kprop].label,i,j,j,t, (double)hdibar_prop[i][j][kprop].c[t_off].real, (double)hdibar_prop[i][j][kprop].c[t_off].imag); } } } } /* Loop over nr forward - backward */ /* Cleanup */ for(kprop=0;kprop<NRPROPS;kprop++) for(i=0;i<num_kap;i++)for(j=0;j<num_kap;j++){ free(nrbar_prop[i][j][kprop].c); free(nrbar_prop[i][j][kprop].label); } for(kprop=0;kprop<HDIPROPS;kprop++) for(kh=0;kh<num_kap_heavy;kh++)for(kl=0;kl<num_kap_light;kl++){ i = kh; j = kl + num_kap_heavy; free(hdibar_prop[i][j][kprop].c); free(hdibar_prop[i][j][kprop].label); } if(this_node==0)printf("RUNNING COMPLETED\n"); if(meascount>0){ if(this_node==0)printf("total cg iters for measurement= %e\n", (double)avm_iters); if(this_node==0)printf("cg iters for measurement= %e\n", (double)avm_iters/(double)meascount); } endtime=dclock(); if(this_node==0){ printf("Time = %e seconds\n",(double)(endtime-starttime)); printf("total_iters = %d\n",total_iters); } fflush(stdout); } return 0; } /* control_H_cl */
int main(int argc, char *argv[]) { int meascount; int prompt; Real avm_iters,avs_iters; double ssplaq,stplaq; double starttime,endtime; double dtime; int MinCG,MaxCG; Real size_r,RsdCG; register int i,j,l; register site *s; int spinindex,spin,color,k,kk,t; int flag; int ci,si,sf,cf; int num_prop; Real space_vol; int status; int source_chirality; wilson_vector **eigVec ; double *eigVal ; int total_R_iters ; double norm; Real re,im,re5,im5; complex cc; char label[20] ; double *grad, *err, max_error; Matrix Array,V ; int key[4]; #define restrict rstrict /* C-90 T3D cludge */ int restrict[4]; Real norm_fac[10]; static char *mes_kind[10] = {"PION","PS505","PS055","PS0505", "RHO33","RHO0303","SCALAR","SCALA0","PV35","B12"}; static char *bar_kind[4] = {"PROTON","PROTON0","DELTA","DELTA0"}; complex *pmes_prop[MAX_MASSES][10]; complex *smes_prop[MAX_MASSES][10]; complex *bar_prop[MAX_MASSES][4]; w_prop_file *fp_in_w[MAX_MASSES]; /* For propagator files */ w_prop_file *fp_out_w[MAX_MASSES]; /* For propagator files */ initialize_machine(&argc,&argv); /* Remap standard I/O */ if(remap_stdio_from_args(argc, argv) == 1)terminate(1); g_sync(); /* set up */ prompt = setup_p(); /* loop over input sets */ while( readin(prompt) == 0) { starttime=dclock(); MaxCG=niter; avm_iters=0.0; meascount=0; if(this_node==0)printf("END OF HEADER\n"); setup_offset(); /* if(this_node==0)printf("warning--no fat link\n"); */ monte_block_ape_b(1); /* call plaquette measuring process */ d_plaquette(&ssplaq,&stplaq); if(this_node==0)printf("FATPLAQ %e %e\n", (double)ssplaq,(double)stplaq); /* flip the time oriented fat links if(this_node==0) printf("Periodic time BC\n"); */ if(this_node==0) printf("AP time BC\n"); boundary_flip(MINUS); setup_links(SIMPLE); /* if(this_node==0) printf("num_masses = %d\n", num_masses); */ /* Loop over mass */ for(k=0;k<num_masses;k++){ m0=mass[k]; if(m0 <= -10.0) exit(1); RsdCG=resid[k]; if(this_node==0)printf("mass= %g r0= %g residue= %g\n", (double)m0,(double)wqs[k].r0,(double)RsdCG); build_params(m0); make_clov1(); eigVal = (double *)malloc(Nvecs*sizeof(double)); eigVec = (wilson_vector **)malloc(Nvecs*sizeof(wilson_vector*)); for(i=0;i<Nvecs;i++) eigVec[i]= (wilson_vector*)malloc(sites_on_node*sizeof(wilson_vector)); /* open files for wilson propagators */ fp_in_w[k] = r_open_wprop(startflag_w[k], startfile_w[k]); fp_out_w[k] = w_open_wprop(saveflag_w[k], savefile_w[k], wqs[k].type); if(startflag_w[k] == FRESH)flag = 0; else flag = 1; spin=color=0; /* needed by wilson writing routines */ /* initialize the CG vectors */ if(flag==0){ if(this_node==0) printf("random (but chiral) initial vectors\n"); /* Initiallize all the eigenvectors to a random vector */ for(j=0;j<Nvecs;j++) { if(j< Nvecs/2){ source_chirality=1;} else{source_chirality= -1;} printf("source chirality %d\n",source_chirality); grsource_w(); FORALLSITES(i,s){ copy_wvec(&(s->g_rand),&(eigVec[j][i])); if(source_chirality==1){ for(kk=2;kk<4;kk++)for(l=0;l<3;l++) eigVec[j][i].d[kk].c[l]=cmplx(0.0,0.0); } if(source_chirality== -1){ for(kk=0;kk<2;kk++)for(l=0;l<3;l++) eigVec[j][i].d[kk].c[l]=cmplx(0.0,0.0); } } eigVal[j]=1.0e+16; } } else{ if(this_node==0) printf("reading in %d wilson_vectors--must be <= 12\n",Nvecs); /* load psi if requested */ for(j=0;j<Nvecs;j++){ printf("reading %d %d %d\n",j,spin,color); #ifdef IOTIME status = reload_wprop_sc_to_site( startflag_w[k], fp_in_w[k], spin, color, F_OFFSET(psi),1); #else status = reload_wprop_sc_to_site( startflag_w[k], fp_in_w[k], spin, color, F_OFFSET(psi),0); #endif /* compute eigenvalue */ herm_delt(F_OFFSET(psi),F_OFFSET(chi)); re=im=0.0; FORALLSITES(i,s){ cc = wvec_dot( &(s->chi), &(s->psi) ); re += cc.real ; } g_floatsum(&re); eigVal[j]=re; printf("trial eigenvalue of state %d %e\n",j,eigVal[j]); FORALLSITES(i,s){eigVec[j][i]=s->psi;} spin++; if((spin %4) == 0){spin=0;color++;} } }
int main( int argc, char **argv ){ register site *s; int i,si; int prompt; double dtime; su3_vector **eigVec ; su3_vector *tmp ; double *eigVal ; int total_R_iters ; double chirality, chir_ev, chir_od ; imp_ferm_links_t **fn; initialize_machine(&argc,&argv); /* Remap standard I/O */ if(remap_stdio_from_args(argc, argv) == 1)terminate(1); g_sync(); /* set up */ prompt = setup(); /* loop over input sets */ while( readin(prompt) == 0){ dtime = -dclock(); #ifdef HISQ_SVD_COUNTER hisq_svd_counter = 0; #endif restore_fermion_links_from_site(fn_links, PRECISION); /* call fermion_variable measuring routines */ /* results are printed in output file */ f_meas_imp( 1, PRECISION, F_OFFSET(phi), F_OFFSET(xxx), mass, 0, fn_links); eigVal = (double *)malloc(Nvecs*sizeof(double)); eigVec = (su3_vector **)malloc(Nvecs*sizeof(su3_vector*)); for(i=0;i<Nvecs;i++) eigVec[i]= (su3_vector*)malloc(sites_on_node*sizeof(su3_vector)); fn = get_fm_links(fn_links); active_parity = EVEN; total_R_iters=Kalkreuter(eigVec, eigVal, eigenval_tol, error_decr, Nvecs, MaxIter, Restart, Kiters); node0_printf("The above where eigenvalues of -Dslash^2 in MILC normalization\n"); node0_printf("Here we also list eigenvalues of iDslash in continuum normalization\n"); for(i=0;i<Nvecs;i++) { if ( eigVal[i] > 0.0 ){ chirality = sqrt(eigVal[i]) / 2.0; } else { chirality = 0.0; } node0_printf("eigenval(%i): %10g\n",i,chirality) ; } tmp = (su3_vector*)malloc(sites_on_node*sizeof(su3_vector)); for(i=0;i<Nvecs;i++) { // if ( eigVal[i] > 10.0*eigenval_tol ) // { /* Construct to odd part of the vector. * * Note that the true odd part of the eigenvector is * * i/sqrt(eigVal) Dslash Psi. But since I only compute * * the chirality the i factor is irrelevant (-i)*i=1!! */ dslash_field(eigVec[i], tmp, ODD, fn[0]) ; FORSOMEPARITY(si,s,ODD){ scalar_mult_su3_vector( &(tmp[si]), 1.0/sqrt(eigVal[i]), &(eigVec[i][si]) ) ; } // measure_chirality(eigVec[i], &chirality, EVENANDODD); /* Here I divide by 2 since the EVEN vector is normalized to * 1. The EVENANDODD vector is normalized to 2. I could have * normalized the EVENANDODD vector to 1 and then not devide * by to. The measure_chirality routine assumes vectors * normalized to 1. */ // node0_printf("Chirality(%i): %g\n",i,chirality/2) ; measure_chirality(eigVec[i], &chir_ev, EVEN); measure_chirality(eigVec[i], &chir_od, ODD); chirality = (chir_ev + chir_od) / 2.0; node0_printf("Chirality(%i) -- even, odd, total: %10g, %10g, %10g\n", i,chir_ev,chir_od,chirality) ; // } // else // { /* This is considered a "zero mode", and treated as such */ // measure_chirality(eigVec[i], &chirality, EVEN); // node0_printf("Chirality(%i): %g\n",i,chirality) ; // } } #ifdef EO cleanup_dslash_temps(); #endif free(tmp); /** for(i=0;i<Nvecs;i++) { sprintf(label,"DENSITY(%i)",i) ; print_densities(eigVec[i], label, ny/2,nz/2,nt/2, EVEN) ; } **/ for(i=0;i<Nvecs;i++) free(eigVec[i]) ; free(eigVec) ; free(eigVal) ; invalidate_fermion_links(fn_links); fflush(stdout); node0_printf("RUNNING COMPLETED\n"); fflush(stdout); dtime += dclock(); if(this_node==0){ printf("Time = %e seconds\n",dtime); printf("total_iters = %d\n",total_iters); printf("total Rayleigh iters = %d\n",total_R_iters); #ifdef HISQ_SVD_COUNTER printf("hisq_svd_counter = %d\n",hisq_svd_counter); #endif } fflush(stdout); }
int spectrum_nd( Real mass1, Real mass2, Real tol, ferm_links_t *fn ){ /* arguments are light and heavy quark masses, return C.G. iteration number */ int cgn; register int i,j,x,y,z,t,t_off; register site* s; register complex cc; register int t_source; int color; /* color for source */ int src_count; /* number of source time slices used */ complex **props; /* arrays of propagators */ su3_matrix tmat; Real finalrsq; cgn=0; /* number of CG iterations */ /* allocate arrays to accumulate propagators */ props = (complex **)malloc(nprops*sizeof(complex *)); props[0] = (complex *)malloc(nprops*nt*sizeof(complex)); for(i=1;i<nprops;i++)props[i]=props[i-1]+nt; /* set propagators to zero */ for(cc.real=cc.imag=0.0,i=0;i<nprops;i++)for(j=0;j<nt;j++){ props[i][j]=cc; } /* allocate light and heavy quark propagators for each color */ for( color=0; color<3; color++){ lightprop[color] = (su3_vector *)malloc( sizeof(su3_vector)*sites_on_node ); heavyprop[color] = (su3_vector *)malloc( sizeof(su3_vector)*sites_on_node ); } /* loop over "source" time slice */ for(src_count=0,t_source=source_start; t_source<nt && src_count<n_sources; t_source += source_inc,src_count++){ /* Corner wall source */ /* Use quark_source for quark source */ if(this_node==0)printf("spectrum_nd(): source time = %d\n",t_source); for(color=0;color<3;color++){ clear_latvec( F_OFFSET(quark_source), EVENANDODD ); for(x=0;x<nx;x+=2)for(y=0;y<ny;y+=2)for(z=0;z<nz;z+=2) { if( node_number(x,y,z,t_source) != mynode() )continue; i=node_index(x,y,z,t_source); lattice[i].quark_source.c[color].real = -1.0; } /* do a C.G. (source in quark_source, result in g_rand) */ if(t_source%2 == 0) { cgn += ks_congrad( F_OFFSET(quark_source), F_OFFSET(g_rand), mass1, niter, nrestart, rsqprop, PRECISION, EVEN, &finalrsq, fn); /* Multiply by -Madjoint */ dslash_site( F_OFFSET(g_rand), F_OFFSET(quark_prop), ODD, fn); scalar_mult_latvec( F_OFFSET(g_rand), -2.0*mass1, F_OFFSET(quark_prop),EVEN); } else { cgn += ks_congrad( F_OFFSET(quark_source), F_OFFSET(g_rand), mass1, niter, nrestart, rsqprop, PRECISION, ODD, &finalrsq, fn); /* Multiply by -Madjoint */ dslash_site( F_OFFSET(g_rand), F_OFFSET(quark_prop), EVEN, fn); scalar_mult_latvec( F_OFFSET(g_rand), -2.0*mass1, F_OFFSET(quark_prop),ODD); } FORALLSITES(i,s){ lightprop[color][i] = lattice[i].quark_prop; } scalar_mult_latvec( F_OFFSET(quark_prop), -1.0, F_OFFSET(g_rand), EVENANDODD ); check_invert( F_OFFSET(g_rand), F_OFFSET(quark_source), mass1, tol, fn); /* repeat for heavy quark */ if(t_source%2 == 0) { cgn += ks_congrad( F_OFFSET(quark_source), F_OFFSET(g_rand), mass2, niter, nrestart, rsqprop, PRECISION, EVEN, &finalrsq, fn); /* Multiply by -Madjoint */ dslash_site( F_OFFSET(g_rand), F_OFFSET(quark_prop), ODD, fn); scalar_mult_latvec( F_OFFSET(g_rand), -2.0*mass2, F_OFFSET(quark_prop),EVEN); } else { cgn += ks_congrad( F_OFFSET(quark_source), F_OFFSET(g_rand), mass2, niter, nrestart, rsqprop, PRECISION, ODD, &finalrsq, fn); /* Multiply by -Madjoint */ dslash_site( F_OFFSET(g_rand), F_OFFSET(quark_prop), EVEN, fn); scalar_mult_latvec( F_OFFSET(g_rand), -2.0*mass2, F_OFFSET(quark_prop),ODD); } FORALLSITES(i,s){ heavyprop[color][i] = lattice[i].quark_prop; } /* TEMP: test inversion, */ scalar_mult_latvec( F_OFFSET(quark_prop), -1.0, F_OFFSET(g_rand), EVENANDODD ); check_invert( F_OFFSET(g_rand), F_OFFSET(quark_source), mass2, tol, fn); } /* end color loop*/ /* add contributions into propagators */ /* measure the meson propagator */ for(t=0; t<nt; t++){ /* define the time value offset t from t_source */ t_off = (t+t_source)%nt; for(x=0;x<nx;x++)for(y=0;y<ny;y++)for(z=0;z<nz;z++) for(color=0;color<3;color++) { if( node_number(x,y,z,t_off) != mynode() )continue; i=node_index(x,y,z,t_off); /* light-light mesons */ cc = su3_dot( &lightprop[color][i], &lightprop[color][i] ); CSUM( props[prop_pion5_ll][t], cc ) if( (x+y)%2==0)CSUM( props[prop_rhoi0_ll][t], cc ) else CSUB( props[prop_rhoi0_ll][t], cc, props[prop_rhoi0_ll][t] ) if( (y+z)%2==0)CSUM( props[prop_rhoi0_ll][t], cc ) else CSUB( props[prop_rhoi0_ll][t], cc, props[prop_rhoi0_ll][t] ) if( (z+x)%2==0)CSUM( props[prop_rhoi0_ll][t], cc ) else CSUB( props[prop_rhoi0_ll][t], cc, props[prop_rhoi0_ll][t] ) if( x%2==0)CSUM( props[prop_rhoi_ll][t], cc ) else CSUB( props[prop_rhoi_ll][t], cc, props[prop_rhoi_ll][t] ) if( y%2==0)CSUM( props[prop_rhoi_ll][t], cc ) else CSUB( props[prop_rhoi_ll][t], cc, props[prop_rhoi_ll][t] ) if( z%2==0)CSUM( props[prop_rhoi_ll][t], cc ) else CSUB( props[prop_rhoi_ll][t], cc, props[prop_rhoi_ll][t] ) if( (x+y+z)%2==0)CSUM( props[prop_pion05_ll][t], cc ) else CSUB( props[prop_pion05_ll][t], cc, props[prop_pion05_ll][t] ) /* light-heavy mesons */ cc = su3_dot( &lightprop[color][i], &heavyprop[color][i] ); CSUM( props[prop_pion5_lh][t], cc ) if( (x+y)%2==0)CSUM( props[prop_rhoi0_lh][t], cc ) else CSUB( props[prop_rhoi0_lh][t], cc, props[prop_rhoi0_lh][t] ) if( (y+z)%2==0)CSUM( props[prop_rhoi0_lh][t], cc ) else CSUB( props[prop_rhoi0_lh][t], cc, props[prop_rhoi0_lh][t] ) if( (z+x)%2==0)CSUM( props[prop_rhoi0_lh][t], cc ) else CSUB( props[prop_rhoi0_lh][t], cc, props[prop_rhoi0_lh][t] ) if( x%2==0)CSUM( props[prop_rhoi_lh][t], cc ) else CSUB( props[prop_rhoi_lh][t], cc, props[prop_rhoi_lh][t] ) if( y%2==0)CSUM( props[prop_rhoi_lh][t], cc ) else CSUB( props[prop_rhoi_lh][t], cc, props[prop_rhoi_lh][t] ) if( z%2==0)CSUM( props[prop_rhoi_lh][t], cc ) else CSUB( props[prop_rhoi_lh][t], cc, props[prop_rhoi_lh][t] ) if( (x+y+z)%2==0)CSUM( props[prop_pion05_lh][t], cc ) else CSUB( props[prop_pion05_lh][t], cc, props[prop_pion05_lh][t] ) /* heavy-heavy mesons */ cc = su3_dot( &heavyprop[color][i], &heavyprop[color][i] ); CSUM( props[prop_pion5_hh][t], cc ) if( (x+y)%2==0)CSUM( props[prop_rhoi0_hh][t], cc ) else CSUB( props[prop_rhoi0_hh][t], cc, props[prop_rhoi0_hh][t] ) if( (y+z)%2==0)CSUM( props[prop_rhoi0_hh][t], cc ) else CSUB( props[prop_rhoi0_hh][t], cc, props[prop_rhoi0_hh][t] ) if( (z+x)%2==0)CSUM( props[prop_rhoi0_hh][t], cc ) else CSUB( props[prop_rhoi0_hh][t], cc, props[prop_rhoi0_hh][t] ) if( x%2==0)CSUM( props[prop_rhoi_hh][t], cc ) else CSUB( props[prop_rhoi_hh][t], cc, props[prop_rhoi_hh][t] ) if( y%2==0)CSUM( props[prop_rhoi_hh][t], cc ) else CSUB( props[prop_rhoi_hh][t], cc, props[prop_rhoi_hh][t] ) if( z%2==0)CSUM( props[prop_rhoi_hh][t], cc ) else CSUB( props[prop_rhoi_hh][t], cc, props[prop_rhoi_hh][t] ) if( (x+y+z)%2==0)CSUM( props[prop_pion05_hh][t], cc ) else CSUB( props[prop_pion05_hh][t], cc, props[prop_pion05_hh][t] ) } /* color */ } /* nt-loop */ /* measure the baryon propagator */ for(t=0; t<nt; t++) { /* define the time value offset t from t_source */ t_off = (t+t_source)%nt; for(x=0;x<nx;x+=2)for(y=0;y<ny;y+=2)for(z=0;z<nz;z+=2) { if( node_number(x,y,z,t_off) != mynode() )continue; i=node_index(x,y,z,t_off); /* three light quarks */ for(color=0;color<3;color++){ (tmat.e[0][color]) = lightprop[0][i].c[color]; (tmat.e[1][color]) = lightprop[1][i].c[color]; (tmat.e[2][color]) = lightprop[2][i].c[color]; } cc = det_su3( &tmat ); /* must get sign right. This looks to see if we have wrapped around the lattice. "t" is the distance from the source to the measurement, so we are trying to find out if t_source+t is greater than or equal to nt. the "-tsource/nt" is in there so that it will work correctly with tsource=nt. */ if( (((t+t_source)/nt-t_source/nt)%2) == 0 ) CSUM( props[prop_nuc_lll][t], cc ) else /* change sign because antiperiodic b.c. sink point should really be in a copy of the lattice */ CSUB( props[prop_nuc_lll][t], cc, props[prop_nuc_lll][t] ) /* two lights and one heavy */ for(color=0;color<3;color++){ (tmat.e[0][color]) = lightprop[0][i].c[color]; (tmat.e[1][color]) = lightprop[1][i].c[color]; (tmat.e[2][color]) = heavyprop[2][i].c[color]; } cc = det_su3( &tmat ); if( (((t+t_source)/nt-t_source/nt)%2) == 0 ) CSUM( props[prop_nuc_llh][t], cc ) else CSUB( props[prop_nuc_llh][t], cc, props[prop_nuc_llh][t] ) /* now repeat for hhl baryon */ for(color=0;color<3;color++){ (tmat.e[0][color]) = lightprop[0][i].c[color]; (tmat.e[1][color]) = heavyprop[1][i].c[color]; (tmat.e[2][color]) = heavyprop[2][i].c[color]; } cc = det_su3( &tmat ); if( (((t+t_source)/nt-t_source/nt)%2) == 0 ) CSUM( props[prop_nuc_lhh][t], cc ) else CSUB( props[prop_nuc_lhh][t], cc, props[prop_nuc_lhh][t] ) /* and hhh baryon (nonexistent particle!!) */ for(color=0;color<3;color++){ (tmat.e[0][color]) = heavyprop[0][i].c[color]; (tmat.e[1][color]) = heavyprop[1][i].c[color]; (tmat.e[2][color]) = heavyprop[2][i].c[color]; } cc = det_su3( &tmat ); if( (((t+t_source)/nt-t_source/nt)%2) == 0 ) CSUM( props[prop_nuc_hhh][t], cc ) else CSUB( props[prop_nuc_hhh][t], cc, props[prop_nuc_hhh][t] ) } } /* nt-loop */ } /* end loop on t_source */ /* Sum propagator arrays over nodes */ /* print out propagators */ g_veccomplexsum( props[0], nprops*nt ); for(i=0;i<nprops;i++)for(j=0;j<nt;j++){ CDIVREAL(props[i][j],n_sources,props[i][j]); } if(this_node==0){ /*meson propagators*/ printf("STARTPROP\n"); printf("MASSES: %e %e\n",mass1,mass1 ); printf("SOURCE: CORNER\n"); printf("SINKS: PION_5 PION_05 RHO_i RHO_i0 \n"); for(j=0;j<nt;j++){ printf("%d %e %e %e %e %e %e %e %e\n",j, props[prop_pion5_ll][j].real, props[prop_pion5_ll][j].imag, props[prop_pion05_ll][j].real, props[prop_pion05_ll][j].imag, props[prop_rhoi_ll][j].real, props[prop_rhoi_ll][j].imag, props[prop_rhoi0_ll][j].real, props[prop_rhoi0_ll][j].imag); } printf("ENDPROP\n"); printf("STARTPROP\n"); printf("MASSES: %e %e\n",mass1,mass2 ); printf("SOURCE: CORNER\n"); printf("SINKS: PION_5 PION_05 RHO_i RHO_i0 \n"); for(j=0;j<nt;j++){ printf("%d %e %e %e %e %e %e %e %e\n",j, props[prop_pion5_lh][j].real, props[prop_pion5_lh][j].imag, props[prop_pion05_lh][j].real, props[prop_pion05_lh][j].imag, props[prop_rhoi_lh][j].real, props[prop_rhoi_lh][j].imag, props[prop_rhoi0_lh][j].real, props[prop_rhoi0_lh][j].imag); } printf("ENDPROP\n"); printf("STARTPROP\n"); printf("MASSES: %e %e\n",mass2,mass2 ); printf("SOURCE: CORNER\n"); printf("SINKS: PION_5 PION_05 RHO_i RHO_i0 \n"); for(j=0;j<nt;j++){ printf("%d %e %e %e %e %e %e %e %e\n",j, props[prop_pion5_hh][j].real, props[prop_pion5_hh][j].imag, props[prop_pion05_hh][j].real, props[prop_pion05_hh][j].imag, props[prop_rhoi_hh][j].real, props[prop_rhoi_hh][j].imag, props[prop_rhoi0_hh][j].real, props[prop_rhoi0_hh][j].imag); } printf("ENDPROP\n"); /* Baryon propagators */ printf("STARTPROP\n"); printf("MASSES: %e %e %e\n",mass1,mass1,mass1); printf("SOURCE: CORNER\n"); printf("SINKS: NUCLEON \n"); for(j=0;j<nt;j++){ printf("%d %e %e\n",j, props[prop_nuc_lll][j].real, props[prop_nuc_lll][j].imag); } printf("ENDPROP\n"); printf("STARTPROP\n"); printf("MASSES: %e %e %e\n",mass1,mass1,mass2); printf("SOURCE: CORNER\n"); printf("SINKS: NUCLEON \n"); for(j=0;j<nt;j++){ printf("%d %e %e\n",j, props[prop_nuc_llh][j].real, props[prop_nuc_llh][j].imag); } printf("ENDPROP\n"); printf("STARTPROP\n"); printf("MASSES: %e %e %e\n",mass1,mass2,mass2); printf("SOURCE: CORNER\n"); printf("SINKS: NUCLEON \n"); for(j=0;j<nt;j++){ printf("%d %e %e\n",j, props[prop_nuc_lhh][j].real, props[prop_nuc_lhh][j].imag); } printf("ENDPROP\n"); printf("STARTPROP\n"); printf("MASSES: %e %e %e\n",mass2,mass2,mass2); printf("SOURCE: CORNER\n"); printf("SINKS: NUCLEON \n"); for(j=0;j<nt;j++){ printf("%d %e %e\n",j, props[prop_nuc_hhh][j].real, props[prop_nuc_hhh][j].imag); } printf("ENDPROP\n"); fflush(stdout); } /* end if(this_node==0) */ /* free arrays */ free(props[0]); free(props); for(color=0;color<3;color++){ free( lightprop[color] ); free( heavyprop[color] ); } return(cgn); } /* spectrum_nd */
OBSOLETE! See update_rhmc.c /********** update_rhmc_omelyan.c ******************************************/ /* MIMD version 7 */ /* See Takaishi and de Forcrand hep-lat/-0505020 Update lattice. compute PHI for both factors in fermion determinant at beginning update U by (epsilon/2)*lambda compute X for light and strange quarks for each term in rational function (or "both factors in det") update H, by epsilon update U by epsilon * (2-lambda) compute X for light and strange quarks for each term in rational function update H, by epsilon update U by (epsilon/2)*lambda This routine does not refresh the antihermitian momenta. This routine begins at "integral" time, with H and U evaluated at same time. "lambda" is adjustable parameter. At lambda=1 this is just two leapfrog steps of length epsilon. Note my lambda is 4X the lambda in Takaishi and de Forcrand and my epsilon is 1/2 theirs. This makes epsilon the same as for the leapfrog algorithm. Omelyan "optimum lambda" is 4*0.1932 */ #include "ks_imp_includes.h" /* definitions files and prototypes */ #define mat_invert mat_invert_uml /**#define mat_invert mat_invert_cg**/ int update() { int step, iters=0; double startaction,endaction; Real xrandom; int i; su3_vector **multi_x; su3_vector *sumvec; Real lambda; int iphi; lambda = 0.8; node0_printf("Omelyan integration, steps= %d eps= %e lambda= %e\n",steps,epsilon,lambda); if (steps %2 != 0 ){ node0_printf("BONEHEAD! need even number of steps\n"); exit(0); } /* allocate space for multimass solution vectors */ multi_x = (su3_vector **)malloc(max_rat_order*sizeof(su3_vector *)); if(multi_x == NULL){ printf("update: No room for multi_x\n"); terminate(1); } for(i=0;i<max_rat_order;i++) multi_x[i]=(su3_vector *)malloc( sizeof(su3_vector)*sites_on_node ); sumvec = (su3_vector *)malloc( sizeof(su3_vector)*sites_on_node ); /* refresh the momenta */ ranmom(); /* generate a pseudofermion configuration only at start*/ for(iphi = 0; iphi < n_pseudo; iphi++){ grsource_imp_rhmc( F_OFFSET(phi[iphi]), &(rparam[iphi].GR), EVEN, multi_x,sumvec, rsqmin_gr[iphi], niter_gr[iphi]); } /* find action */ startaction=d_action_rhmc(multi_x,sumvec); /* copy link field to old_link */ gauge_field_copy( F_OFFSET(link[0]), F_OFFSET(old_link[0])); /* do "steps" microcanonical steps (one "step" = one force evaluation)" */ for(step=2; step <= steps; step+=2){ /* update U's and H's - see header comment */ update_u(0.5*epsilon*lambda); update_h_rhmc( epsilon, multi_x); update_u(epsilon*(2.0-lambda)); update_h_rhmc( epsilon, multi_x); update_u(0.5*epsilon*lambda); /* reunitarize the gauge field */ rephase( OFF ); reunitarize(); rephase( ON ); /*TEMP - monitor action*/ //if(step%6==0)d_action_rhmc(multi_x,sumvec); } /* end loop over microcanonical steps */ /* find action */ /* do conjugate gradient to get (Madj M)inverse * phi */ endaction=d_action_rhmc(multi_x,sumvec); /* decide whether to accept, if not, copy old link field back */ /* careful - must generate only one random number for whole lattice */ #ifdef HMC if(this_node==0)xrandom = myrand(&node_prn); broadcast_float(&xrandom); if( exp( (double)(startaction-endaction) ) < xrandom ){ if(steps > 0) gauge_field_copy( F_OFFSET(old_link[0]), F_OFFSET(link[0]) ); #ifdef FN invalidate_all_ferm_links(&fn_links); invalidate_all_ferm_links(&fn_links_dmdu0); #endif node0_printf("REJECT: delta S = %e\n", (double)(endaction-startaction)); } else { node0_printf("ACCEPT: delta S = %e\n", (double)(endaction-startaction)); } #else // not HMC node0_printf("CHECK: delta S = %e\n", (double)(endaction-startaction)); #endif // HMC /* free multimass solution vector storage */ for(i=0;i<max_rat_order;i++)free(multi_x[i]); free(sumvec); if(steps > 0)return (iters/steps); else return(-99); }
void load_asqtad_links(int both, ferm_links_t *fn, ks_action_paths *ap) { su3_matrix **t_fl = &fn->fat; su3_matrix **t_ll = &fn->lng; Real *act_path_coeff = ap->act_path_coeff; QDP_ColorMatrix *fl[4]; QDP_ColorMatrix *ll[4]; QDP_ColorMatrix *gf[4]; int dir; double remaptime = -dclock(); char myname[] = "load_asqtad_links"; asqtad_path_coeff c; if( phases_in != 1){ node0_printf("%s: BOTCH: needs phases in\n",myname); terminate(1); } /* Create QDP fields for fat links, long links, and temp for gauge field */ FORALLUPDIR(dir){ fl[dir] = QDP_create_M(); ll[dir] = QDP_create_M(); gf[dir] = QDP_create_M(); } /* Map gauge links to QDP */ set4_M_from_site(gf, F_OFFSET(link), EVENANDODD); /* Load Asqtad path coefficients from table */ c.one_link = act_path_coeff[0]; c.naik = act_path_coeff[1]; c.three_staple = act_path_coeff[2]; c.five_staple = act_path_coeff[3]; c.seven_staple = act_path_coeff[4]; c.lepage = act_path_coeff[5]; /* Compute fat and long links as QDP fields */ remaptime += dclock(); create_fn_links_qdp(fl, ll, gf, &c); remaptime -= dclock(); /* Clean up */ FORALLUPDIR(dir){ QDP_destroy_M(gf[dir]); } /* Allocate space for t_fatlink if NULL */ if(*t_fl == NULL){ *t_fl = (su3_matrix *)special_alloc(sites_on_node*4*sizeof(su3_matrix)); if(*t_fl==NULL){ printf("%s(%d): no room for t_fatlink\n",myname,this_node); terminate(1); } } /* Allocate space for t_longlink if NULL and we are doing both fat and long */ if(*t_ll == NULL && both){ *t_ll = (su3_matrix *)special_alloc(sites_on_node*4*sizeof(su3_matrix)); if(*t_ll==NULL){ printf("%s(%d): no room for t_longlink\n",myname,this_node); terminate(1); } } /* Map QDP fields to MILC order */ set4_field_from_M(*t_fl, fl, EVENANDODD); if(both)set4_field_from_M(*t_ll, ll, EVENANDODD); /* Clean up */ FORALLUPDIR(dir){ QDP_destroy_M(fl[dir]); QDP_destroy_M(ll[dir]); } fn->valid = 1; remaptime += dclock(); #ifdef LLTIME #ifdef REMAP node0_printf("LLREMAP: time = %e\n",remaptime); #endif #endif }
/* Hadron wave functions. */ void wavefunc_t() { register int i,j,n; register site *s; register complex cc; msg_tag *tag; Real finalrsq,scale,x; int tmin,tmax,cgn,color; /* for baryon code */ int ca,ca1,ca2,cb,cb1,cb2; void symmetry_combine(field_offset src,field_offset space,int size,int dir); void block_fourier( field_offset src, /* src is field to be transformed */ field_offset space, /* space is working space, same size as src */ int size, /* Size of field in bytes. The field must consist of size/sizeof(complex) consecutive complex numbers. For example, an su3_vector is 3 complex numbers. */ int isign); /* 1 for x -> k, -1 for k -> x */ void fourier( field_offset src, /* src is field to be transformed */ field_offset space, /* space is working space, same size as src */ int size, /* Size of field in bytes. The field must consist of size/sizeof(complex) consecutive complex numbers. For example, an su3_vector is 3 complex numbers. */ int isign); /* 1 for x -> k, -1 for k -> x */ void write_wf(field_offset src,char *string,int tmin,int tmax); /* Fix TUP Coulomb gauge - gauge links only*/ rephase( OFF ); gaugefix(TUP,(Real)1.8,500,(Real)GAUGE_FIX_TOL); rephase( ON ); for(color=0;color<3;color++){ /* Make wall source */ FORALLSITES(i,s){ for(j=0;j<3;j++)s->phi.c[j]=cmplx(0.0,0.0); if( s->x%2==0 && s->y%2==0 && s->z%2==0 && s->t==0 ){ s->phi.c[color] = cmplx(-1.0,0.0); } } /* do a C.G. (source in phi, result in xxx) */ load_ferm_links(&fn_links); cgn = ks_congrad(F_OFFSET(phi),F_OFFSET(xxx),mass, niter, rsqprop, PRECISION, EVEN, &finalrsq, &fn_links); /* Multiply by -Madjoint, result in propmat[color] */ dslash_site( F_OFFSET(xxx), F_OFFSET(propmat[color]), ODD, &fn_links); scalar_mult_latvec( F_OFFSET(xxx), (Real)(-2.0*mass), F_OFFSET(propmat[color]), EVEN); } /* construct the diquark propagator--uses tempmat1 and do this before you fft the quark propagator */ FORALLSITES(i,s){ for(ca=0;ca<3;ca++)for(cb=0;cb<3;cb++){ ca1= (ca+1)%3; ca2= (ca+2)%3; cb1= (cb+1)%3; cb2= (cb+2)%3; CMUL((s->propmat[ca1].c[cb1]),(s->propmat[ca2].c[cb2]), (s->tempmat1.e[ca][cb])); CMUL((s->propmat[ca1].c[cb2]),(s->propmat[ca2].c[cb1]), cc); CSUB((s->tempmat1.e[ca][cb]),cc,(s->tempmat1.e[ca][cb])); } } /* complex conjugate the diquark prop */ FORALLSITES(i,s){ for(ca=0;ca<3;ca++)for(cb=0;cb<3;cb++){ CONJG((s->tempmat1.e[ca][cb]),(s->tempmat1.e[ca][cb])); } } /* Transform the diquark propagator. */ block_fourier( F_OFFSET(tempmat1), F_OFFSET(tempvec[0]), 3*sizeof(su3_vector), FORWARDS); /* complex conjugate the diquark prop. Now we have D(-k) for convolution */ FORALLSITES(i,s){ for(ca=0;ca<3;ca++)for(cb=0;cb<3;cb++){ CONJG((s->tempmat1.e[ca][cb]),(s->tempmat1.e[ca][cb])); } } /* Transform the propagator. */ block_fourier( F_OFFSET(propmat[0]), F_OFFSET(tempvec[0]), 3*sizeof(su3_vector), FORWARDS); /* CODE SPECIFIC TO PARTICULAR PARTICLES */ /* MESON CODE */ /* Square the result, component by component, sum over source and sink colors, result in ttt.c[0] */ FORALLSITES(i,s){ s->ttt.c[0].real = s->ttt.c[0].imag = 0.0; for(color=0;color<3;color++){ s->ttt.c[0].real += magsq_su3vec( &(s->propmat[color]) ); } }
int congrad_w(int niter, Real rsqmin, Real *final_rsq_ptr) { int i; int iteration; /* counter for iterations */ double source_norm; double rsqstop; QLA_Real a, b; double rsq,oldrsq,pkp; /* Sugar's a,b,resid**2,previous resid*2 */ /* pkp = cg_p.K.cg_p */ QLA_Real mkappa; QLA_Real sum; #ifdef CGTIME double dtime; #endif #ifdef LU mkappa = -kappa*kappa; #else mkappa = -kappa; #endif setup_cg(); for(i=0; i<4; i++) { set_M_from_site(gaugelink[i], F_OFFSET(link[i]),EVENANDODD); } set_D_from_site(psi, F_OFFSET(psi),EVENANDODD); set_D_from_site(chi, F_OFFSET(chi),EVENANDODD); #ifdef PRESHIFT_LINKS { QDP_ColorMatrix *tcm; tcm = QDP_create_M(); for(i=0; i<4; i++) { QDP_M_eq_sM(tcm, gaugelink[i], QDP_neighbor[i], QDP_backward, QDP_all); QDP_M_eq_Ma(gaugelink[i+4], tcm, QDP_all); } QDP_destroy_M(tcm); } #endif #ifdef CGTIME dtime = -dclock(); #endif iteration=0; start: /* mp <- M_adjoint*M*psi r,p <- chi - mp rsq = |r|^2 source_norm = |chi|^2 */ rsq = source_norm = 0.0; #ifdef LU QDP_D_eq_D(cgp, psi, QDP_even); dslash_special_qdp(tt1, cgp, 1, QDP_odd, temp1); dslash_special_qdp(ttt, tt1, 1, QDP_even, temp2); QDP_D_eq_r_times_D_plus_D(ttt, &mkappa, ttt, cgp, QDP_even); dslash_special_qdp(tt2, ttt, -1, QDP_odd, temp3); dslash_special_qdp(mp, tt2, -1, QDP_even, temp4); QDP_D_eq_r_times_D_plus_D(mp, &mkappa, mp, ttt, QDP_even); QDP_D_eq_D_minus_D(cgr, chi, mp, QDP_even); QDP_D_eq_D(cgp, cgr, QDP_even); QDP_r_eq_norm2_D(&sum, chi, QDP_even); source_norm = sum; QDP_r_eq_norm2_D(&sum, cgr, QDP_even); rsq = sum; #else QDP_D_eq_D(cgp, psi, QDP_even); dslash_special_qdp(ttt, cgp, 1, QDP_all, temp1); QDP_D_eq_r_times_D_plus_D(ttt, &mkappa, ttt, cgp, QDP_all); dslash_special_qdp(mp, ttt, -1, QDP_all, temp1); QDP_D_eq_r_times_D_plus_D(mp, &mkappa, mp, ttt, QDP_all); QDP_D_eq_D_minus_D(cgr, chi, mp, QDP_all); QDP_D_eq_D(cgp, cgr, QDP_all); QDP_r_eq_norm2_D(&sum, chi, QDP_all); source_norm = sum; QDP_r_eq_norm2_D(&sum, cgr, QDP_all); rsq = sum; #endif iteration++ ; /* iteration counts number of multiplications by M_adjoint*M */ total_iters++; /**if(this_node==0)printf("congrad2: source_norm = %e\n",source_norm); if(this_node==0)printf("congrad2: iter %d, rsq %e, pkp %e, a %e\n", iteration,(double)rsq,(double)pkp,(double)a );**/ rsqstop = rsqmin * source_norm; if( rsq <= rsqstop ){ *final_rsq_ptr= (Real)rsq; return (iteration); } /* main loop - do until convergence or time to restart */ /* oldrsq <- rsq mp <- M_adjoint*M*p pkp <- p.M_adjoint*M.p a <- rsq/pkp psi <- psi + a*p r <- r - a*mp rsq <- |r|^2 b <- rsq/oldrsq p <- r + b*p */ do { oldrsq = rsq; #ifdef LU dslash_special_qdp(tt1, cgp, 1, QDP_odd, temp1); dslash_special_qdp(ttt, tt1, 1, QDP_even, temp2); QDP_D_eq_r_times_D_plus_D(ttt, &mkappa, ttt, cgp, QDP_even); dslash_special_qdp(tt2, ttt, -1, QDP_odd, temp3); dslash_special_qdp(mp, tt2, -1, QDP_even, temp4); QDP_D_eq_r_times_D_plus_D(mp, &mkappa, mp, ttt, QDP_even); QDP_r_eq_re_D_dot_D(&sum, cgp, mp, QDP_even); pkp = sum; #else dslash_special_qdp(ttt, cgp, 1, QDP_all, temp1); QDP_D_eq_r_times_D_plus_D(ttt, &mkappa, ttt, cgp, QDP_all); dslash_special_qdp(mp, ttt, -1, QDP_all, temp1); QDP_D_eq_r_times_D_plus_D(mp, &mkappa, mp, ttt, QDP_all); QDP_r_eq_re_D_dot_D(&sum, cgp, mp, QDP_all); pkp = sum; #endif iteration++; total_iters++; a = rsq / pkp; QDP_D_peq_r_times_D(psi, &a, cgp, MYSUBSET); QDP_D_meq_r_times_D(cgr, &a, mp, MYSUBSET); QDP_r_eq_norm2_D(&sum, cgr, MYSUBSET); rsq = sum; /**if(this_node==0)printf("congrad2: iter %d, rsq %e, pkp %e, a %e\n", iteration,(double)rsq,(double)pkp,(double)a );**/ if( rsq <= rsqstop ){ *final_rsq_ptr= (Real)rsq; #ifdef CGTIME dtime += dclock(); if(this_node==0) printf("CONGRAD2: time = %.2e size_r= %.2e iters= %d MF = %.1f\n", dtime,rsq,iteration, (double)6480*iteration*even_sites_on_node/(dtime*1e6)); //(double)5616*iteration*even_sites_on_node/(dtime*1e6)); #endif set_site_from_D(F_OFFSET(psi), psi,EVENANDODD); return (iteration); } b = rsq / oldrsq; QDP_D_eq_r_times_D_plus_D(cgp, &b, cgp, cgr, MYSUBSET); } while( iteration%niter != 0); set_site_from_D(F_OFFSET(psi), psi,EVENANDODD); if( iteration < 3*niter ) goto start; *final_rsq_ptr= (Real)rsq; return(iteration); }
void calc_heavy_light_form() { int color , spin ; int k_sequential ; int p_insert ; int k_spectator , k_zonked_light , k_zonked_heavy ; int HH3_corr_dim , HH3_corr_stride ; int HL3_corr_dim , HL3_corr_stride ; complex *HH3_corr ; /*** The heavy-heavy 3pt correlators *****/ complex *HL3_corr ; /*** The heavy-light 3pt correlators *****/ complex *HL2_GE_corr ; /*** The heavy-light 2pt correlators *****/ complex *LL2_GG_corr ; /*** The light-light 2pt correlators *****/ complex *HL2_GG_corr ; /*** The sequential correlators *****/ complex *HL2_GL_corr ; /*** The local-sink correlators required for fB *****/ int HL2_GE_corr_dim ; int LL2_GG_corr_dim ; int HL2_GG_corr_dim ; int HL2_GL_corr_dim , HL2_GL_corr_stride ; w_prop_file *zonked_light_ssink_fp[MAX_KAPPA] ; /*** Quark propagator IO stuff **/ w_prop_file *zonked_heavy_fp[MAX_KAPPA] ; /*** Quark propagator IO stuff **/ w_prop_file *zonked_heavy_ssink_fp[MAX_KAPPA] ; /*** Quark propagator IO stuff **/ int t_source = wqs_zonked_heavy[0].t0 ; /** assume all the kappa start from the same point **/ field_offset null_argument = 0 ; int do_heavy_heavy; int change_mom_smear; int exists_zonked_light_ssink[MAX_KAPPA]; int exists_zonked_heavy_ssink[MAX_KAPPA]; int exists_zonked_heavy[MAX_KAPPA]; /**********----------------------------------------**********/ setup_w_meson_store(); setup_HL3_corr( &HL3_corr, &HL3_corr_dim, &HL3_corr_stride ); setup_HH3_corr( &HH3_corr, &HH3_corr_dim, &HH3_corr_stride); setup_LL2_corr(&LL2_GG_corr , &LL2_GG_corr_dim ); setup_HL2_corr(&HL2_GE_corr, &HL2_GE_corr_dim); setup_HL2_corr(&HL2_GG_corr, &HL2_GG_corr_dim) ; setup_HL2_corr_with_rotations(&HL2_GL_corr , &HL2_GL_corr_dim , &HL2_GL_corr_stride) ; set_zonked_save_intermediate(); /*** Generate heavy quark propagators Gaussian smear the propagators at the sink Calculate the light-light and heavy-light smeared sink 2 pt function Calculate heavy-heavy local sink 2 pt function *****/ /* Figure out what needs to be done and open any needed and available sink-smeared LIGHT quark propagator output files */ for(k_zonked_light=0 ; k_zonked_light < no_zonked_light ; ++k_zonked_light) { exists_zonked_light_ssink[k_zonked_light] = file_exists_broadcast(qfile_zonked_light_ssink[k_zonked_light]); kappa = kappa_zonked_light[k_zonked_light]; /* If it doesn't exist and we are computing two pt functions that use it, we will create it, so open the file for writing */ wqstmp = wqs_zonked_light[k_zonked_light]; /* For clover_info */ strcat(wqstmp.descrp,"; SMEARED SINK."); if(!exists_zonked_light_ssink[k_zonked_light] && ((saveflag_HL2_GG != FORGET) || (saveflag_LL2_GG != FORGET) )) zonked_light_ssink_fp[k_zonked_light] = w_open_wprop(saveflag_zonked_light_ssink, qfile_zonked_light_ssink[k_zonked_light], wqs_zonked_light[k_zonked_light].type); } /* See if the heavy-heavy correlators need to be computed */ do_heavy_heavy = !file_exists_broadcast(filename_HH2_GL); /* Figure out what needs to be done and open any needed and available sink-smeared HEAVY quark propagator output files */ for(k_zonked_heavy=0 ; k_zonked_heavy < no_zonked_heavy ; ++k_zonked_heavy) { exists_zonked_heavy[k_zonked_heavy] = file_exists_broadcast(qfile_zonked_heavy[k_zonked_heavy]); exists_zonked_heavy_ssink[k_zonked_heavy] = file_exists_broadcast(qfile_zonked_heavy_ssink[k_zonked_heavy]); /* We (re)compute the heavy_heavy 2 pt function if any of the heavy local propagator files is missing */ if(!exists_zonked_heavy[k_zonked_heavy])do_heavy_heavy = 1; kappa = kappa_zonked_heavy[k_zonked_heavy]; /* If it doesn't exist, we will write, so open the file for writing */ wqstmp = wqs_zonked_heavy[k_zonked_heavy]; /* For clover_info */ if(!exists_zonked_heavy[k_zonked_heavy]) zonked_heavy_fp[k_zonked_heavy] = w_open_wprop(saveflag_zonked_heavy[k_zonked_heavy], qfile_zonked_heavy[k_zonked_heavy], wqs_zonked_heavy[k_zonked_heavy].type); /* If it doesn't exist and we need it for the HL2_GG correlator, we will write, so open the file for writing */ wqstmp = wqs_zonked_heavy[k_zonked_heavy]; /* For clover_info */ strcat(wqstmp.descrp,"; SMEARED SINK."); if(!exists_zonked_heavy_ssink[k_zonked_heavy] && (saveflag_HL2_GG != FORGET)) zonked_heavy_ssink_fp[k_zonked_heavy] = w_open_wprop(saveflag_zonked_heavy_ssink, qfile_zonked_heavy_ssink[k_zonked_heavy], wqs_zonked_heavy[k_zonked_heavy].type); } /* We will compute the heavy_heavy spectrum if any one of the heavy local-sink propagator files is missing or if the correlator file doesn't exist. Call to initialize the calculation */ if(do_heavy_heavy) meson_spectrum(null_argument , t_source, 0 , no_zonked_heavy, SETUP_CORR,filename_HH2_GL) ; /* Calculate the local and smeared two-point functions HL2_GL HL2_GG and LL2_GG */ for(color=0 ; color < 3 ; ++color) { node0_printf("\nSTARTING SMEARED COLOR %d\n",color); fflush(stdout); /*** generate smeared light quark propagators ***/ /* We don't load the light propagators and don't calculate the smeared sink two-point functions unless a flag is set (see setup_form) */ if((saveflag_HL2_GG != FORGET) || (saveflag_LL2_GG != FORGET) ){ for(k_zonked_light=0 ; k_zonked_light < no_zonked_light ; ++k_zonked_light) { /* If the smeared light quark prop file exists, use it */ if(exists_zonked_light_ssink[k_zonked_light]) { /* Load the smeared sink propagator */ node0_printf("REUSING previous zonked light tmp file %s\n", qfile_zonked_light_ssink[k_zonked_light]); fflush(stdout); for(spin=0; spin < 4 ; ++spin ) load_in_zonked_light_ssink(color,spin,k_zonked_light, F_OFFSET(quark_zonked_light[k_zonked_light].d[spin])); } /* end if exists */ else { /* Load the local sink propagator and smear at sink */ for(spin=0; spin < 4 ; ++spin ) load_in_zonked_light2(color,spin,k_zonked_light, F_OFFSET(quark_zonked_light[k_zonked_light].d[spin])); /*** smear the light zonked quarks at the sink ****/ /* NOTE: WE ARE ASSUMING THE SHELL SMEARING FUNCTIONS ARE THE SAME FOR ZONKED AND SPECTATOR QUARKS */ M_SINK_SMEAR(quark_zonked_light[k_zonked_light], heavy_smear_func_mom[0] ) ; /** write the light ssink quark props to disk ***/ for(spin=0; spin < 4 ; ++spin ) save_wprop_sc_from_site(saveflag_zonked_light_ssink, zonked_light_ssink_fp[k_zonked_light], spin, color, F_OFFSET(quark_zonked_light[k_zonked_light].d[spin]), 1) ; } /* end if file doesn't exist */ } /* k_zonked_light */ } /* end if (saveflag_HL2_GG != FORGET) || (saveflag_LL2_GG != FORGET) */ /*** generate the heavy zonked local sink propagators if they don't already exist. We'll need them for the 3 pt functions even if we aren't calculating the smeared two pt functions. ***/ for(k_zonked_heavy=0 ; k_zonked_heavy < no_zonked_heavy ; ++k_zonked_heavy) { if(!exists_zonked_heavy[k_zonked_heavy]) { for(spin = 0 ; spin < 4 ; ++spin) generate_heavy_zonked(color,spin, kappa_zonked_heavy[k_zonked_heavy], inverter_type_zonked_heavy[k_zonked_heavy], F_OFFSET(quark_zonked_heavy[k_zonked_heavy].d[spin])) ; /*** store the heavy quark propagator to disk ****/ for(spin=0; spin < 4 ; ++spin ) save_wprop_sc_from_site(saveflag_zonked_heavy[k_zonked_heavy], zonked_heavy_fp[k_zonked_heavy], spin, color, F_OFFSET(quark_zonked_heavy[k_zonked_heavy].d[spin]), 1) ; } /* end if doesn't exist */ else if(do_heavy_heavy) { /* Load heavy zonked local from existing tmp now if we need it for the heavy_heavy prop */ for(spin=0; spin < 4 ; ++spin ) load_in_zonked_heavy_local(color,spin,k_zonked_heavy, F_OFFSET(quark_zonked_heavy[k_zonked_heavy].d[spin])); } /* end else if exists but do_heavy_heavy */ } /* k_zonked_heavy */ /** Calculate the heavy degenerate spectrum (HH2_GL) **/ if(do_heavy_heavy) { for(k_zonked_heavy=0 ; k_zonked_heavy < no_zonked_heavy ; ++k_zonked_heavy) meson_spectrum(F_OFFSET(quark_zonked_heavy[k_zonked_heavy]), t_source ,k_zonked_heavy , no_zonked_heavy, CALCULATE_SPECTRUM, filename_HH2_GL) ; } /*** generate the smeared zonked local sink propagators if they don't already exist and if we need them for two point functions ***/ if(saveflag_HL2_GG != FORGET){ for(k_zonked_heavy=0 ; k_zonked_heavy < no_zonked_heavy ; ++k_zonked_heavy) { /* If the sink smeared heavy quark prop file exists, use it */ if(exists_zonked_heavy_ssink[k_zonked_heavy]) { node0_printf("REUSING previous zonked heavy tmp file %s\n", qfile_zonked_heavy_ssink[k_zonked_heavy]); fflush(stdout); for(spin=0; spin < 4 ; ++spin ) load_in_zonked_heavy_smear(color,spin,k_zonked_heavy, F_OFFSET(quark_zonked_heavy[k_zonked_heavy].d[spin])); } /* end if exists */ else { /* Load local heavy quark prop unless we just computed or loaded it */ if(exists_zonked_heavy[k_zonked_heavy] && !do_heavy_heavy) { node0_printf("REUSING previous zonked heavy file %s\n", qfile_zonked_heavy[k_zonked_heavy]); fflush(stdout); for(spin=0; spin < 4 ; ++spin ) load_in_zonked_heavy_local(color,spin,k_zonked_heavy, F_OFFSET(quark_zonked_heavy[k_zonked_heavy].d[spin])); } /* smear heavy zonked quark at sink */ M_SINK_SMEAR(quark_zonked_heavy[k_zonked_heavy], heavy_smear_func_mom[0]); /*** store the smeared--smeared quark propagator to disk ***/ for(spin=0; spin < 4 ; ++spin ) save_wprop_sc_from_site(saveflag_zonked_heavy_ssink, zonked_heavy_ssink_fp[k_zonked_heavy], spin, color, F_OFFSET(quark_zonked_heavy[k_zonked_heavy].d[spin]), 1) ; } /* end if doesn't exist */ } /* k_zonked_heavy */ } /* if(saveflag_HL2_GG != FORGET) */ /** Calculate the source- and sink-smeared 2 pt functions **/ if((saveflag_HL2_GG != FORGET) || (saveflag_LL2_GG != FORGET)) { for(k_spectator = 0 ; k_spectator < no_spectator ; ++k_spectator) { /** generate or copy sink smeared spectator quark propagator **/ /* If the spectator quark is the same as one of the zonked light quarks, copy the preloaded smeared zonked light quark instead NOTE: WE ARE ASSUMING THE SMEARING FUNCTIONS ARE THE SAME FOR ZONKED AND SPECTATOR QUARKS */ restore_smeared_spectator(color,k_spectator); /****----- light-light two-pt (LL2_GG) (symmetric source and sink smearing) -----*****/ /* Skip this calculation if flag is set (see setup_form) */ if(saveflag_LL2_GG != FORGET){ node0_printf("Computing LL2_GG correlator\n"); fflush(stdout); for(k_zonked_light=0 ; k_zonked_light < no_zonked_light ; ++k_zonked_light) { /*** calculate the light-light two point functions (LL2_GG) (shell smearing functions) *****/ contract_LL2(LL2_GG_corr, F_OFFSET(quark_zonked_light[k_zonked_light]) , F_OFFSET(quark_spectator ) , k_zonked_light, k_spectator) ; } /*** end of the loop over the zonked light quark reads ***/ } /* end of if(saveflag_LL2_GG != FORGET) */ /****----- heavy-light two pt (HL2_GG) (shell smeared source and sink) -----*****/ /* Skip this calculation if flag is set (see setup_form) */ if(saveflag_HL2_GG != FORGET){ node0_printf("Computing HL2_GG correlator\n"); fflush(stdout); for(k_zonked_heavy=0 ; k_zonked_heavy < no_zonked_heavy ; ++k_zonked_heavy) { /*** contract the heavy-light two point function (HL2_GG) (BAG SMEARING AT THE SINK) ******/ contract_HL2(HL2_GG_corr , F_OFFSET(quark_zonked_heavy[k_zonked_heavy]) , F_OFFSET(quark_spectator), k_zonked_heavy, k_spectator) ; } /*** end of the loop over the zonked heavy quarks ***/ } /* End of if(saveflag_HL2_GG != FORGET) */ } /* k_spectator */ } /* End of if((saveflag_HL2_GG != FORGET) || (saveflag_LL2_GG != FORGET) ) */ } /* color */ /* Write heavy-heavy spectrum */ if(do_heavy_heavy) meson_spectrum(null_argument ,t_source ,0 ,no_zonked_heavy, WRITE_RESULTS,filename_HH2_GL) ; /*** write the sink-smeared 2 pt correlators to disk ****/ finish_LL2_GG_corr(LL2_GG_corr, LL2_GG_corr_dim ) ; finish_HL2_GG_corr(HL2_GG_corr, HL2_GG_corr_dim ) ; free(LL2_GG_corr); free(HL2_GG_corr) ; /* Close the temporary propagator output files if we opened them before */ for(k_zonked_light=0 ; k_zonked_light < no_zonked_light ; ++k_zonked_light) { if(!exists_zonked_light_ssink[k_zonked_light] && ((saveflag_HL2_GG != FORGET) || (saveflag_LL2_GG != FORGET) )) w_close_wprop(saveflag_zonked_light_ssink, zonked_light_ssink_fp[k_zonked_light]); } for(k_zonked_heavy=0 ; k_zonked_heavy < no_zonked_heavy ; ++k_zonked_heavy) { if(!exists_zonked_heavy[k_zonked_heavy]) w_close_wprop(saveflag_zonked_heavy[k_zonked_heavy], zonked_heavy_fp[k_zonked_heavy]); if(!exists_zonked_heavy_ssink[k_zonked_heavy] && (saveflag_HL2_GG != FORGET)) w_close_wprop(saveflag_zonked_heavy_ssink, zonked_heavy_ssink_fp[k_zonked_heavy]); } /*** Calculate the heavy to heavy and heavy to light 3 pt functions Calculate the heavy-light 2 pt functions requiring local-sink quark propagators ***/ for(color=0 ; color < 3 ; ++color) { node0_printf("\nSTARTING LOCAL COLOR %d\n",color); fflush(stdout); if((saveflag_HL2_GL != FORGET) || (saveflag_HL2_GE != FORGET) || (saveflag_HH3 != FORGET) || (saveflag_HL3 != FORGET)) { /*** reload all the light zonked quark propagators for this color, smeared at the source only **/ for(k_zonked_light=0 ; k_zonked_light < no_zonked_light ; ++k_zonked_light) for(spin=0; spin < 4 ; ++spin ) load_in_zonked_light2(color,spin,k_zonked_light, F_OFFSET(quark_zonked_light[k_zonked_light].d[spin])); /*** reload all the heavy zonked quark propagators for this color, smeared at the source only **/ for(k_zonked_heavy=0 ; k_zonked_heavy < no_zonked_heavy ; ++k_zonked_heavy) for(spin=0; spin < 4 ; ++spin ) load_in_zonked_heavy_local(color,spin,k_zonked_heavy, F_OFFSET(quark_zonked_heavy[k_zonked_heavy].d[spin])); } for(k_spectator = 0 ; k_spectator < no_spectator ; ++k_spectator) { /** restore spectator quark propagator to "quark_spectator" **/ restore_local_spectator(color, k_spectator); /****----- heavy-light two-pt (HL2_GL) (shell smeared sources, local sink) -----*****/ /* Skip this calculation if flag is set (see setup_form) */ if(saveflag_HL2_GL != FORGET){ for(k_zonked_heavy=0 ; k_zonked_heavy < no_zonked_heavy ; ++k_zonked_heavy) { node0_printf("Computing HL2_GL correlator\n"); fflush(stdout); /*** contract the heavy-light two point function (HL2_GL) (smeared-source local-sink) */ contract_HL2_with_rotations(HL2_GL_corr, F_OFFSET(quark_zonked_heavy[k_zonked_heavy]) , F_OFFSET(quark_spectator), F_OFFSET(quark_rot ), k_zonked_heavy, k_spectator) ; } /*** end of the loop over the zonked heavy inversions ***/ } /* End of if(saveflag_HL2_GL != FORGET) */ for(p_insert = 0 ; p_insert < no_p_values ; ++p_insert) { node0_printf("\nStarting momentum insertion %d\n",p_insert); fflush(stdout); /**** sink smear the spectator quark with the sequential smearing function ****/ /* If the smearing function did not change, retain the previous result */ if(p_insert == 0 || strcmp(seq_smear_file[p_insert], seq_smear_file[p_insert-1]) != 0) { node0_printf("Sequential smearing for momentum insertion %d\n",p_insert); fflush(stdout); restore_local_spectator(color, k_spectator); M_SINK_SMEAR(quark_spectator,seq_smear_func[ p_insert ] ) ; change_mom_smear = 1; } else { node0_printf("REUSING sequentially smeared spectator from previous momentum insertion\n"); fflush(stdout); change_mom_smear = 0; } /****----- heavy-light two pt (HL2_GE) (shell source, relative sink) -----*****/ /* Skip this calculation if flag is set (see setup_form) */ /* Note: We may, in the future, want to distiguish smearing functions for different B meson momenta. However, at present we have not made any provision for such a distinction in the relative-smeared two-point function. So we do the calculation only for the first momentum in the list! CD */ if((saveflag_HL2_GE != FORGET) && p_insert > 0 && change_mom_smear) node0_printf("WARNING: HL2_GE correlator is computed only for the first smearing function in the list\n"); fflush(stdout); if((saveflag_HL2_GE != FORGET) && p_insert == 0){ node0_printf("Computing HL2_GE correlator\n"); fflush(stdout); for(k_zonked_heavy=0 ; k_zonked_heavy < no_zonked_heavy ; ++k_zonked_heavy) { /*** contract the heavy-light two point functiion (HL2_GE) (RELATIVE SMEARING AT THE SINK) */ contract_HL2( HL2_GE_corr, F_OFFSET(quark_zonked_heavy[k_zonked_heavy]) , F_OFFSET(quark_spectator), k_zonked_heavy, k_spectator) ; } /*** end of the loop over the zonked heavy inversions ***/ } if( (saveflag_HH3 != FORGET) || (saveflag_HL3 != FORGET)) for(k_sequential = 0 ; k_sequential < no_sequential ; ++k_sequential ) { copy_site_spin_wilson_vector(F_OFFSET(quark_spectator) , F_OFFSET(quark_sequential) ); if( this_node == 0 ) printf("Computing form factors for k_sequential = %g k_spectator = %g p = %d,%d,%d \n", kappa_sequential[k_sequential], kappa_spectator[k_spectator] , p_momstore[p_insert ][0] , p_momstore[p_insert ][1] , p_momstore[p_insert ][2] ) ; fflush(stdout); /*** generate the sequential source propagator ****/ for(spin = 0 ; spin < 4 ; ++spin ) { /*** do the sequential source inversion ****/ kappa = kappa_sequential[k_sequential] ; sequential_source( F_OFFSET(quark_sequential.d[spin] ), F_OFFSET(psi), p_momstore[p_insert ][0] , p_momstore[p_insert ][1] , p_momstore[p_insert ][2] , tf, color,spin, kappa_sequential[k_sequential] , inverter_type_sequential[k_sequential], niter_zonked_heavy, nrestart_zonked_heavy, resid_zonked_heavy, p_insert ) ; } /*** end of the loop over spin ***/ /****----- heavy to light form factor -----*****/ if( (saveflag_HL3 != FORGET) ) { for(k_zonked_light=0 ; k_zonked_light < no_zonked_light ; ++k_zonked_light) { /*** tie the propagators together to calculate the three point function *****/ contract_HL3( HL3_corr, F_OFFSET(quark_zonked_light[k_zonked_light]), F_OFFSET(quark_sequential) , F_OFFSET(quark_rot ), p_insert, k_sequential, k_zonked_light, k_spectator ) ; } /*** end of the loop over the zonked light quark reads ***/ } /* End of if(saveflag_HL3 != FORGET) */ /****----- heavy to heavy form factor -----*****/ if( (saveflag_HH3 != FORGET) ) { for(k_zonked_heavy=0 ; k_zonked_heavy < no_zonked_heavy ; ++k_zonked_heavy) { /*** tie the propagators together *****/ contract_HH3( HH3_corr, F_OFFSET(quark_zonked_heavy[k_zonked_heavy]), F_OFFSET(quark_sequential ), F_OFFSET(quark_rot ), p_insert, k_sequential, k_zonked_heavy, k_spectator ) ; } /*** end of the loop over the zonked heavy quarks ***/ } /* End of if(saveflag_HH3 != FORGET) */ } /*** end of the loop over p_insert ****/ } /*** end of the loop over k_sequential ****/ } /*** end of the loop over k_spectator ****/ } /*** end the loop over the source colour *****/ /*** write the correlators to disk ****/ finish_HL3_corr(HL3_corr, HL3_corr_dim , HL3_corr_stride) ; finish_HH3_corr(HH3_corr, HH3_corr_dim , HH3_corr_stride) ; finish_HL2_GE_corr(HL2_GE_corr, HL2_GE_corr_dim ) ; finish_HL2_GL_corr(HL2_GL_corr, HL2_GL_corr_dim, HL2_GL_corr_stride ); /**** free up the memory used in this code *****/ free(HH3_corr) ; free(HL3_corr) ; free(HL2_GE_corr); free(HL2_GL_corr); } /***** end of calc_heavy_light_form ****/
/* CODE SPECIFIC TO PARTICULAR PARTICLES */ /* MESON CODE */ /* Square the result, component by component, sum over source and sink colors, result in ttt.c[0] */ FORALLSITES(i,s){ s->ttt.c[0].real = s->ttt.c[0].imag = 0.0; for(color=0;color<3;color++){ s->ttt.c[0].real += magsq_su3vec( &(s->propmat[color]) ); } } /* Transform back to coordinate space. */ block_fourier( F_OFFSET(ttt.c[0]), F_OFFSET(cg_p), sizeof(complex),BACKWARDS); /* make pion and rho wave functions by summing over block with signs */ /* Site sign particle x,y,z 0,0,0 +1 pi (PS) 1,0,0 (-1)^x rho-b1 (VT), gamma_x polarization 0,1,0 (-1)^y rho-b1 (VT), gamma_y polarization 0,0,1 (-1)^z rho-b1 (VT), gamma_z polarization 1,1,0 (-1)^(x+y) rho-a1 (PV), gamma_z polarization 1,0,1 (-1)^(x+z) rho-a1 (PV), gamma_y polarization 0,1,1 (-1)^(y+z) rho-a1 (PV), gamma_x polarization 1,1,1 (-1)^(x+y+z) pi_2, sigma (SC) */
void load_in_spectator(int color, int spin, int k_spectator, field_offset dest) { int MinCG; int restart_flag_spectator ; w_prop_file *spectator_fp_in ; /*** Quark propagator IO stuff **/ node0_printf("Loading spectator kappa = %f\n", kappa_spectator[k_spectator]); fflush(stdout); if( startflag_spectator[k_spectator] == FRESH ) restart_flag_spectator = 0 ; else restart_flag_spectator = 1 ; /*** open the spectator light quark file *****/ kappa = kappa_spectator[k_spectator] ; spectator_fp_in = r_open_wprop(startflag_spectator[k_spectator], qfile_spectator[k_spectator]); /*** Load in the spectator quark propagator ****/ if(reload_wprop_sc_to_site(startflag_spectator[k_spectator], spectator_fp_in, spin, color, dest, 1)!=0) terminate(1); /**** check the wilson vector loaded in, by using it as a new solution to the inverter *****/ /* Complete the definition of source structure */ wqs_spectator[k_spectator].color = color; wqs_spectator[k_spectator].spin = spin; kappa = kappa_spectator[k_spectator] ; /* If we are starting afresh, we set a minimum number of iterations */ if(startflag_spectator[k_spectator] == FRESH)MinCG = nt; else MinCG = 0; /* Load inversion control structure */ qic_spectator.prec = PRECISION; qic_spectator.min = MinCG; qic_spectator.max = niter_spectator; qic_spectator.nrestart = nrestart_spectator; qic_spectator.resid = resid_spectator; qic_spectator.start_flag = restart_flag_spectator; #ifdef CLOVER /* Load Dirac matrix parameters */ dcp.Kappa = kappa_spectator[k_spectator]; dcp.Clov_c = clov_c; dcp.U0 = u0; wilson_invert_site_wqs(F_OFFSET(chi), dest, w_source,&wqs_spectator[k_spectator], bicgilu_cl_site,&qic_spectator,(void *)&dcp); #else /* Load Dirac matrix parameters */ dwp.Kappa = kappa_spectator[k_spectator]; wilson_invert_site_wqs(F_OFFSET(chi), dest, w_source,&wqs_spectator[k_spectator], mrilu_w_site,&qic_spectator,(void *)&dwp); #endif /*** close the spectator light quark file *****/ r_close_wprop(startflag_spectator[k_spectator],spectator_fp_in); } /***** end of load_in_spectator ******/
/* D_slash routine - sets dest. on each site equal to sum of sources parallel transported to site, with minus sign for transport from negative directions. Use "fatlinks" for one link transport, "longlinks" for three link transport. */ void dslash_fn( field_offset src, field_offset dest, int parity ) { register int i; register site *s; register int dir,otherparity; register su3_matrix *fat4, *long4; msg_tag *tag[16]; if(!valid_longlinks)load_longlinks(); if(!valid_fatlinks)load_fatlinks(); switch(parity){ case EVEN: otherparity=ODD; break; case ODD: otherparity=EVEN; break; case EVENANDODD: otherparity=EVENANDODD; break; } /* Start gathers from positive directions */ /* And start the 3-step gather too */ for( dir=XUP; dir<=TUP; dir++ ){ tag[dir] = start_gather( src, sizeof(su3_vector), dir, parity, gen_pt[dir] ); tag[DIR3(dir)] = start_gather( src, sizeof(su3_vector), DIR3(dir), parity, gen_pt[DIR3(dir)] ); } /* Multiply by adjoint matrix at other sites */ /* Use fat link for single link transport */ FORSOMEPARITY( i, s, otherparity ){ if( i < loopend-FETCH_UP ){ #ifdef DSLASH_TMP_LINKS fat4 = &(t_fatlink[4*(i+FETCH_UP)]); long4 = &(t_longlink[4*(i+FETCH_UP)]); #else fat4 = (s+FETCH_UP)->fatlink; long4 = (s+FETCH_UP)->longlink; #endif prefetch_4MV4V( fat4, (su3_vector *)F_PT(s+FETCH_UP,src), (s+FETCH_UP)->tempvec ); prefetch_4MV4V( long4, (su3_vector *)F_PT(s+FETCH_UP,src), (s+FETCH_UP)->templongvec ); } #ifdef DSLASH_TMP_LINKS fat4 = &(t_fatlink[4*i]); long4 = &(t_longlink[4*i]); #else fat4 = s->fatlink; long4 = s->longlink; #endif mult_adj_su3_mat_vec_4dir( fat4, (su3_vector *)F_PT(s,src), s->tempvec ); /* multiply by 3-link matrices too */ mult_adj_su3_mat_vec_4dir( long4, (su3_vector *)F_PT(s,src), s->templongvec ); } END_LOOP /* Start gathers from negative directions */ for( dir=XUP; dir <= TUP; dir++){ tag[OPP_DIR(dir)] = start_gather( F_OFFSET(tempvec[dir]), sizeof(su3_vector), OPP_DIR( dir), parity, gen_pt[OPP_DIR(dir)] ); } /* Start 3-neighbour gathers from negative directions */ for( dir=X3UP; dir <= T3UP; dir++){ tag[OPP_3_DIR(dir)] = start_gather( F_OFFSET(templongvec[INDEX_3RD(dir)]), sizeof(su3_vector), OPP_3_DIR( dir), parity, gen_pt[OPP_3_DIR(dir)] ); } /* Wait gathers from positive directions, multiply by matrix and accumulate */ /* wait for the 3-neighbours from positive directions, multiply */ for(dir=XUP; dir<=TUP; dir++){ wait_gather(tag[dir]); wait_gather(tag[DIR3(dir)]); } /* Wait gathers from negative directions, accumulate (negative) */ /* and the same for the negative 3-rd neighbours */ for(dir=XUP; dir<=TUP; dir++){ wait_gather(tag[OPP_DIR(dir)]); } for(dir=X3UP; dir<=T3UP; dir++){ wait_gather(tag[OPP_3_DIR(dir)]); } FORSOMEPARITY(i,s,parity){ #ifdef DSLASH_TMP_LINKS fat4 = &(t_fatlink[4*i]); long4 = &(t_longlink[4*i]); #else fat4 = s->fatlink; long4 = s->longlink; #endif mult_su3_mat_vec_sum_4dir( fat4, (su3_vector *)gen_pt[XUP][i], (su3_vector *)gen_pt[YUP][i], (su3_vector *)gen_pt[ZUP][i], (su3_vector *)gen_pt[TUP][i], (su3_vector *)F_PT(s,dest)); mult_su3_mat_vec_sum_4dir( long4, (su3_vector *)gen_pt[X3UP][i], (su3_vector *)gen_pt[Y3UP][i], (su3_vector *)gen_pt[Z3UP][i], (su3_vector *)gen_pt[T3UP][i], (su3_vector *) &(s->templongv1)); if( i < loopend-FETCH_UP ){ #ifdef DSLASH_TMP_LINKS fat4 = &(t_fatlink[4*(i+FETCH_UP)]); long4 = &(t_longlink[4*(i+FETCH_UP)]); #else fat4 = (s+FETCH_UP)->fatlink; long4 = (s+FETCH_UP)->longlink; #endif prefetch_4MVVVV( fat4, (su3_vector *)gen_pt[XUP][i+FETCH_UP], (su3_vector *)gen_pt[YUP][i+FETCH_UP], (su3_vector *)gen_pt[ZUP][i+FETCH_UP], (su3_vector *)gen_pt[TUP][i+FETCH_UP] ); prefetch_4MVVVV( long4, (su3_vector *)gen_pt[X3UP][i+FETCH_UP], (su3_vector *)gen_pt[Y3UP][i+FETCH_UP], (su3_vector *)gen_pt[Z3UP][i+FETCH_UP], (su3_vector *)gen_pt[T3UP][i+FETCH_UP] ); prefetch_VVVV( (su3_vector *)gen_pt[XDOWN][i+FETCH_UP], (su3_vector *)gen_pt[YDOWN][i+FETCH_UP], (su3_vector *)gen_pt[ZDOWN][i+FETCH_UP], (su3_vector *)gen_pt[TDOWN][i+FETCH_UP] ); prefetch_VVVV( (su3_vector *)gen_pt[X3DOWN][i+FETCH_UP], (su3_vector *)gen_pt[Y3DOWN][i+FETCH_UP], (su3_vector *)gen_pt[Z3DOWN][i+FETCH_UP], (su3_vector *)gen_pt[T3DOWN][i+FETCH_UP] ); } sub_four_su3_vecs( (su3_vector *)F_PT(s,dest), (su3_vector *)(gen_pt[XDOWN][i]), (su3_vector *)(gen_pt[YDOWN][i]), (su3_vector *)(gen_pt[ZDOWN][i]), (su3_vector *)(gen_pt[TDOWN][i]) ); sub_four_su3_vecs( &(s->templongv1), (su3_vector *)(gen_pt[X3DOWN][i]), (su3_vector *)(gen_pt[Y3DOWN][i]), (su3_vector *)(gen_pt[Z3DOWN][i]), (su3_vector *)(gen_pt[T3DOWN][i]) ); /* Now need to add these things together */ add_su3_vector((su3_vector *)F_PT(s,dest), & (s->templongv1), (su3_vector *)F_PT(s,dest)); } END_LOOP
/* Make one corner with link[nu](x+mu) link[mu](x+nu)^dagger and multiply the two corners together in the two different ways */ /* Note f_mn is here used as a temporary! */ wait_gather(tag0); wait_gather(tag1); FORALLSITES(i,s){ mult_su3_na( (su3_matrix *)(gen_pt[0][i]), (su3_matrix *)(gen_pt[1][i]), ((su3_matrix *)F_PT(s,f_mn)) ); mult_su3_nn( &(s->tempmat1), ((su3_matrix *)F_PT(s,f_mn)), &(s->tempmat2) ); mult_su3_nn( ((su3_matrix *)F_PT(s,f_mn)), &(s->tempmat1), &(s->staple) ); } /* tempmat2 is the plaquette +mu -nu and must be gathered from -nu */ tag2 = start_gather_site( F_OFFSET(tempmat2), sizeof(su3_matrix), OPP_DIR(nu), EVENANDODD, gen_pt[2] ); /* staple is the plaquette -mu +nu and must be gather from -mu */ tag3 = start_gather_site( F_OFFSET(staple), sizeof(su3_matrix), OPP_DIR(mu), EVENANDODD, gen_pt[3] ); /* Now make +mu +nu plaquette and put in f_mn */ FORALLSITES(i,s){ mult_su3_nn( &(s->link[mu]), ((su3_matrix *)F_PT(s,f_mn)), &tmat4 ); mult_su3_na( &tmat4, &(s->link[nu]), ((su3_matrix *)F_PT(s,f_mn)) ); } /* Now gather +mu -nu plaquette and add to f_mn */ wait_gather(tag2); FORALLSITES(i,s){
int main( int argc, char **argv ){ register site *s; int i,si; int prompt; double dtime; su3_vector **eigVec ; su3_vector *tmp ; double *eigVal ; int total_R_iters ; double chirality ; initialize_machine(&argc,&argv); #ifdef HAVE_QDP QDP_initialize(&argc, &argv); #ifndef QDP_PROFILE QDP_profcontrol(0); #endif #endif /* Remap standard I/O */ if(remap_stdio_from_args(argc, argv) == 1)terminate(1); g_sync(); /* set up */ prompt = setup(); /* loop over input sets */ while( readin(prompt) == 0){ dtime = -dclock(); invalidate_all_ferm_links(&fn_links); make_path_table(&ks_act_paths, &ks_act_paths_dmdu0); /* Load fat and long links for fermion measurements if needed */ load_ferm_links(&fn_links, &ks_act_paths); /* call fermion_variable measuring routines */ /* results are printed in output file */ f_meas_imp( F_OFFSET(phi), F_OFFSET(xxx), mass, &fn_links, &fn_links_dmdu0); eigVal = (double *)malloc(Nvecs*sizeof(double)); eigVec = (su3_vector **)malloc(Nvecs*sizeof(su3_vector*)); for(i=0;i<Nvecs;i++) eigVec[i]= (su3_vector*)malloc(sites_on_node*sizeof(su3_vector)); total_R_iters=Kalkreuter(eigVec, eigVal, eigenval_tol, error_decr, Nvecs, MaxIter, Restart, Kiters, EVEN, &fn_links) ; tmp = (su3_vector*)malloc(sites_on_node*sizeof(su3_vector)); for(i=0;i<Nvecs;i++) { /* Construct to odd part of the vector. * * Note that the true odd part of the eigenvector is * * i/sqrt(eigVal) Dslash Psi. But since I only compute * * the chirality the i factor is irrelevant (-i)*i=1!! */ dslash_fn_field(eigVec[i], tmp, ODD, &fn_links) ; FORSOMEPARITY(si,s,ODD){ scalar_mult_su3_vector( &(tmp[si]), 1.0/sqrt(eigVal[i]), &(eigVec[i][si]) ) ; } measure_chirality(eigVec[i], &chirality, EVENANDODD); /* Here I divide by 2 since the EVEN vector is normalized to * 1. The EVENANDODD vector is normalized to 2. I could have * normalized the EVENANDODD vector to 1 and then not devide * by to. The measure_chirality routine assumes vectors * normalized to 1. */ node0_printf("Chirality(%i): %g\n",i,chirality/2) ; } free(tmp); /** for(i=0;i<Nvecs;i++) { sprintf(label,"DENSITY(%i)",i) ; print_densities(eigVec[i], label, ny/2,nz/2,nt/2, EVEN) ; } **/ for(i=0;i<Nvecs;i++) free(eigVec[i]) ; free(eigVec) ; free(eigVal) ; #ifdef FN invalidate_all_ferm_links(&fn_links); #endif fflush(stdout); node0_printf("RUNNING COMPLETED\n"); fflush(stdout); dtime += dclock(); if(this_node==0){ printf("Time = %e seconds\n",dtime); printf("total_iters = %d\n",total_iters); printf("total Rayleigh iters = %d\n",total_R_iters); } fflush(stdout); }
int nl_spectrum( Real vmass, field_offset temp1, field_offset temp2 ) { /* return the C.G. iteration number */ double *piprop,*pi2prop,*rhoprop,*rho2prop,*barprop; double *nlpiprop,*nlpi2prop,*ckpiprop,*ckpi2prop; double *delprop,*ckbarprop; Real vmass_x2; site* s; register complex cc; Real finalrsq; register int i,x,y,z,t,icol,cgn; register int t_source,t_off; int dir,isrc; msg_tag *mtag[16]; piprop = (double *)malloc( nt*sizeof(double) ); pi2prop = (double *)malloc( nt*sizeof(double) ); rhoprop = (double *)malloc( nt*sizeof(double) ); rho2prop = (double *)malloc( nt*sizeof(double) ); barprop = (double *)malloc( nt*sizeof(double) ); nlpiprop = (double *)malloc( nt*sizeof(double) ); nlpi2prop = (double *)malloc( nt*sizeof(double) ); ckpiprop = (double *)malloc( nt*sizeof(double) ); ckpi2prop = (double *)malloc( nt*sizeof(double) ); delprop = (double *)malloc( nt*sizeof(double) ); ckbarprop = (double *)malloc( nt*sizeof(double) ); for( t=0; t<nt; t++ ){ piprop[t]=0.0; pi2prop[t]=0.0; rhoprop[t]=0.0; rho2prop[t]=0.0; nlpiprop[t]=0.0; nlpi2prop[t]=0.0; ckpiprop[t]=0.0; ckpi2prop[t]=0.0; barprop[t]=0.0; delprop[t]=0.0; ckbarprop[t]=0.0; } vmass_x2 = 2.*vmass; cgn=0; /* Fix TUP Coulomb gauge - gauge links only*/ rephase( OFF ); gaugefix(TUP,(Real)1.8,500,(Real)GAUGE_FIX_TOL); rephase( ON ); #ifdef FN invalidate_all_ferm_links(&fn_links); #endif /* Unlike spectrum.c, here we calculate only with wall sources */ for(t_source=source_start, isrc=0; t_source<2*nt && isrc < n_sources; ++isrc, t_source += source_inc ) { /* Only work for even source slices */ if( t_source%2 != 0 ){ printf("DUMMY: Use even time slices for nl_spectrum()\n"); terminate(0); } /* Compute propagator from even wall sites */ /* Sources are normalized to 1/8 to make them comparable to */ /* propagators from a wall with ones on the cube origin. */ /* Put result in propmat */ for(icol=0; icol<3; icol++) { /* initialize temp1 and temp2 */ clear_latvec( temp1, EVEN); clear_latvec( temp2, EVEN); for(x=0;x<nx;x++)for(y=0;y<ny;y++)for(z=0;z<nz;z++) { if((x+y+z) % 2 == 0) { if( node_number(x,y,z,t_source) != mynode() )continue; i=node_index(x,y,z,t_source); ((su3_vector *)(F_PT(&lattice[i],temp1)))->c[icol].real = -0.25; } } /* do a C.G. */ load_ferm_links(&fn_links); cgn += congrad(niter,rsqprop,EVEN,&finalrsq, &fn_links); /* Multiply by -Madjoint */ dslash_site( temp2, temp2, ODD, &fn_links); scalar_mult_latvec( temp2, -vmass_x2, temp2, EVEN); /* fill the hadron matrix */ copy_latvec( temp2, F_OFFSET(propmat[icol]), EVENANDODD); } /* end loop on icol */ /* Compute propagator from odd wall sites */ /* Put result in propmat2 */ for(icol=0; icol<3; icol++) { /* initialize temp1 and temp2 */ clear_latvec( temp1, ODD); clear_latvec( temp2, ODD); for(x=0;x<nx;x++)for(y=0;y<ny;y++)for(z=0;z<nz;z++) { if((x+y+z) % 2 == 1) { if( node_number(x,y,z,t_source) != mynode() )continue; i=node_index(x,y,z,t_source); ((su3_vector *)(F_PT(&lattice[i],temp1)))->c[icol].real = -0.25; } } /* do a C.G. */ load_ferm_links(&fn_links); cgn += congrad(niter,rsqprop,ODD,&finalrsq,&fn_links); /* Multiply by -Madjoint */ dslash_site( temp2, temp2, EVEN, &fn_links); scalar_mult_latvec( temp2, -vmass_x2, temp2, ODD); /* fill the hadron matrix */ copy_latvec( temp2, F_OFFSET(propmat2[icol]), EVENANDODD); } /* end loop on icol */ /* cgn now gives the sum for both inversions */ /* measure the meson propagator for the E wall source */ for(t=0; t<nt; t++) { /* define the time value offset t from t_source */ t_off = (t+t_source)%nt; for(x=0;x<nx;x++)for(y=0;y<ny;y++)for(z=0;z<nz;z++) for(icol=0;icol<3;icol++) { if( node_number(x,y,z,t_off) != mynode() )continue; i=node_index(x,y,z,t_off); cc = su3_dot( &lattice[i].propmat[icol], &lattice[i].propmat[icol] ); piprop[t] += cc.real; /* (rhoprop and rho2prop are not generated by this source) */ if( (x+y+z)%2==0)pi2prop[t] += cc.real; else pi2prop[t] -= cc.real; } } /* nt-loop */ /* measure the baryon propagator for the E wall source */ for(t=0; t<nt; t++) { /* define the time value offset t from t_source */ t_off = (t+t_source)%nt; for(x=0;x<nx;x+=2)for(y=0;y<ny;y+=2)for(z=0;z<nz;z+=2) { if( node_number(x,y,z,t_off) != mynode() )continue; i=node_index(x,y,z,t_off); cc = det_su3( (su3_matrix *)(lattice[i].propmat) ); barprop[t] += cc.real; } /* must get sign right. This looks to see if we have wrapped around the lattice. "t" is the distance from the source to the measurement, so we are trying to find out if t_source+t is greater than or equal to nt. */ if( (((t+t_source)/nt-t_source/nt)%2) == 1 )barprop[t] *= -1.0; /* change sign because antiperiodic b.c. sink point should really be in a copy of the lattice */ } /* nt-loop */ /* Measure nonlocal (and some local for checking) propagators */ /* These propagators include the delta and some nonlocal mesons */ /* The method for the delta is described in M.F.L. Golterman and */ /* J. Smit, Nucl. Phys. B 255, 328 (1985) */ /* Equation (6.3) defines the sink operator for the delta */ /* The method for the mesons is described in M.F.L. Golterman */ /* Nucl. Phys. B 273, 663 (1986) */ /* The treatment of the source wall is described in Gupta, */ /* Guralnik, Kilcup, and Sharpe, (GGKS) NSF-ITP-90-172 (1990) */ /* To get the delta propagator, we take the "q" propagator */ /* matrices for each of the wall colors and antisymmetrize over */ /* wall color as well as s */ /* First construct the "q" and "o" propagators */ /* Put q = E + O in propmat and o = E - O in propmat2 */ FORALLSITES(i,s) { for(icol=0; icol<3; icol++) { add_su3_vector (&(s->propmat[icol]), &(s->propmat2[icol]), (su3_vector *)(s->tempmat1.e[icol]) ); sub_su3_vector (&(s->propmat[icol]), &(s->propmat2[icol]), &(s->propmat2[icol]) ); su3vec_copy( (su3_vector *)(s->tempmat1.e[icol]), &(s->propmat[icol]) ); } } /* Next gather the propagators in preparation for calculating */ /* shifted propagators Dq and Do */ FORALLUPDIRBUT(TUP,dir) { /* Start bringing "q" = propmat from forward sites */ mtag[dir] = start_gather_site(F_OFFSET(propmat[0]), sizeof(su3_matrix), dir, EVENANDODD, gen_pt[dir]); /* Start bringing "q" from backward neighbors */ mtag[dir+4] = start_gather_site(F_OFFSET(propmat[0]), sizeof(su3_matrix), OPP_DIR(dir), EVENANDODD, gen_pt[dir+4]); wait_gather(mtag[dir]); wait_gather(mtag[dir+4]); /* Start bringing "o" = propmat2 from forward sites */ mtag[8+dir] = start_gather_site(F_OFFSET(propmat2[0]), sizeof(su3_matrix), dir, EVENANDODD, gen_pt[8+dir]); /* Start bringing "o" from backward neighbors */ mtag[8+dir+4] = start_gather_site(F_OFFSET(propmat2[0]), sizeof(su3_matrix), OPP_DIR(dir), EVENANDODD, gen_pt[8+dir+4]); wait_gather(mtag[8+dir]); wait_gather(mtag[8+dir+4]); } /* Calculate and dump delta propagator */ for(t=0; t<nt; t++) { /* define the time value offset t from t_source */ t_off = (t+t_source)%nt; /* Calculate contribution for each permutation of source color */ delta_prop (0,1,2, 1, t_off, &delprop[t]); delta_prop (1,2,0, 1, t_off, &delprop[t]); delta_prop (2,0,1, 1, t_off, &delprop[t]); delta_prop (1,0,2,-1, t_off, &delprop[t]); delta_prop (0,2,1,-1, t_off, &delprop[t]); delta_prop (2,1,0,-1, t_off, &delprop[t]); if( (((t+t_source)/nt-t_source/nt)%2) == 1 ) delprop[t] *= -1; } /* nt-loop */ /* Calculate the "q" source nucleon as a check */ /* Calculate and dump nucleon check propagator */ for(t=0; t<nt; t++) { /* define the time value offset t from t_source */ t_off = (t+t_source)%nt; for(x=0;x<nx;x+=2)for(y=0;y<ny;y+=2)for(z=0;z<nz;z+=2) { if( node_number(x,y,z,t_off) != mynode() )continue; i=node_index(x,y,z,t_off); /* The q propagator is in propmat */ cc = det_su3( (su3_matrix *)(lattice[i].propmat) ); ckbarprop[t] += cc.real; } if( (((t+t_source)/nt-t_source/nt)%2) == 1 )ckbarprop[t]*= -1.0; /* change sign because antiperiodic b.c. sink point should really be in a copy of the lattice */ } /* nt-loop */ /* Calculate nonlocal meson propagators and local check */ for(t=0; t<nt; t++) { /* Calculate two nonlocal pion propagators */ /* These are pi_1 and pi_1 tilde of Gupta et al */ /* Also calculate two local propagators as a check */ /* define the time value offset t from t_source */ t_off = (t+t_source)%nt; nl_meson_prop(t_off,&nlpiprop[t],&nlpi2prop[t],&ckpiprop[t], &ckpi2prop[t]); } /* nt-loop */ /* Clean up gathers */ FORALLUPDIRBUT(TUP,dir) { cleanup_gather(mtag[dir]); cleanup_gather(mtag[dir+4]); cleanup_gather(mtag[8+dir]); cleanup_gather(mtag[8+dir+4]); }
/* do measurements: load density, ploop, etc. and phases onto lattice */ void measure() { register int i,j,k, c; register site *s; int dx,dy,dz; /* separation for correlated observables */ int dir; /* direction of separation */ msg_tag *tag; register complex cc,dd; /*scratch*/ complex ztr, zcof, znum, zdet, TC, zd, density, zphase; complex p[4]; /* probabilities of n quarks at a site */ complex np[4]; /* probabilities at neighbor site */ complex pp[4][4]; /* joint probabilities of n here and m there */ complex zplp, plp; Real locphase, phase; /* First make T (= timelike P-loop) from s->ploop_t T stored in s->tempmat1 */ ploop_less_slice(nt-1,EVEN); ploop_less_slice(nt-1,ODD); phase = 0.; density = plp = cmplx(0.0, 0.0); for(j=0;j<4;j++){ p[j]=cmplx(0.0,0.0); for(k=0;k<4;k++)pp[j][k]=cmplx(0.0,0.0); } FORALLSITES(i,s) { if(s->t != nt-1) continue; mult_su3_nn(&(s->link[TUP]), &(s->ploop_t), &(s->tempmat1)); zplp = trace_su3(&(s->tempmat1)); CSUM(plp, zplp); ztr = trace_su3(&(s->tempmat1)); CONJG(ztr, zcof); for(c=0; c<3; ++c) s->tempmat1.e[c][c].real += C; zdet = det_su3(&(s->tempmat1)); znum = numer(C, ztr, zcof); CDIV(znum, zdet, zd); CSUM(density, zd); /* store n_quark probabilities at this site in lattice variable qprob[], accumulate sum over lattice in p[] */ cc = cmplx(C*C*C,0.0); CDIV(cc,zdet,s->qprob[0]); CSUM(p[0],s->qprob[0]); CMULREAL(ztr,C*C,cc); CDIV(cc,zdet,s->qprob[1]); CSUM(p[1],s->qprob[1]); CMULREAL(zcof,C,cc); CDIV(cc,zdet,s->qprob[2]); CSUM(p[2],s->qprob[2]); cc = cmplx(1.0,0.0); CDIV(cc,zdet,s->qprob[3]); CSUM(p[3],s->qprob[3]); locphase = carg(&zdet); phase += locphase; } g_floatsum( &phase ); g_complexsum( &density ); g_complexsum( &p[0] ); g_complexsum( &p[1] ); g_complexsum( &p[2] ); g_complexsum( &p[3] ); g_complexsum( &plp ); CDIVREAL(density,(Real)(nx*ny*nz),density); CDIVREAL(p[0],(Real)(nx*ny*nz),p[0]); CDIVREAL(p[1],(Real)(nx*ny*nz),p[1]); CDIVREAL(p[2],(Real)(nx*ny*nz),p[2]); CDIVREAL(p[3],(Real)(nx*ny*nz),p[3]); CDIVREAL(plp,(Real)(nx*ny*nz),plp); zphase = ce_itheta(phase); if(this_node == 0) { printf("ZMES\t%e\t%e\t%e\t%e\t%e\t%e\n", zphase.real, zphase.imag, density.real, density.imag, plp.real, plp.imag); printf("PMES\t%e\t%e\t%e\t%e\t%e\t%e\t%e\t%e\n", p[0].real, p[0].imag, p[1].real, p[1].imag, p[2].real, p[2].imag, p[3].real, p[3].imag ); } #ifdef PPCORR dx=1; dy=0; dz=0; /* Temporary - right now we just do nearest neighbor */ for(dir=XUP;dir<=ZUP;dir++){ tag = start_gather_site( F_OFFSET(qprob[0]), 4*sizeof(complex), dir, EVENANDODD, gen_pt[0] ); wait_gather(tag); FORALLSITES(i,s)if(s->t==nt-1){ for(j=0;j<4;j++)for(k=0;k<4;k++){ CMUL( (s->qprob)[j],((complex *)gen_pt[0][i])[k],cc); CSUM(pp[j][k],cc); } } cleanup_gather(tag); } /* density correlation format: PP dx dy dz n1 n2 real imag */ for(j=0;j<4;j++)for(k=0;k<4;k++){ g_complexsum( &pp[j][k] ); CDIVREAL(pp[j][k],(Real)(3*nx*ny*nz),pp[j][k]); if(this_node==0) printf("PP %d %d %d %d %d %e %e\n",dx,dy,dz,j,k, pp[j][k].real,pp[j][k].imag); } #endif /*PPCORR*/ }
int quark_renorm( void ) { register int i, dir; register site *s; int j, cgn; Real mass_x2, finalrsq; Real pix, piy, piz, pit; Real sin_pmu, q_mu, prop_a, prop_b, z_fac, m_func, ftmp = 0; Real r1, r2, r3; int pmu, px, py, pz, pt; int pxn, pyn, pzn, ptn; int currentnode; int j1, jm2, k, dirs[4]; msg_tag *mtag[2]; int j_mass; su3_vector **psim = NULL; int xi, j2, j3, j4, parity; int multiflag; FILE *fp_mom_ks[MAX_NUM_MASS]; /* for writing mom propagator files */ char filename[50]; int prec = PRECISION; /* Make internal precision for CG the same as the prevailing precision */ pix = 2.*PI / (Real)nx; piy = 2.*PI / (Real)ny; piz = 2.*PI / (Real)nz; pit = 2.*PI / (Real)nt; cgn = 0; if( num_mass == 1){ multiflag = 0; } else{ multiflag = 1; psim = (su3_vector **)malloc(num_mass*sizeof(su3_vector *)); for(j=0; j<num_mass; j++){ psim[j] = (su3_vector *)malloc(sites_on_node*sizeof(su3_vector)); } } /* Open the momentum propagator files */ if(this_node == 0){ for(j=0; j<num_mass; j++){ sprintf(filename,"mom_pt_prop.m_%d",j); fp_mom_ks[j] = fopen(filename, "ab"); if(fp_mom_ks[j] == NULL){ printf("quark_renorm: Node %d can't open file %s, error %d\n", this_node,filename,errno);fflush(stdout); terminate(1); } } } rephase( ON ); /* Turn staggered phases on */ /* Create fat and long links */ load_ferm_links(&fn_links, &ks_act_paths); /* Loop over the 16 source points */ for(xi=0; xi<16; xi++){ /* Initialize color trace of the propagator */ FORALLSITES(i,s){ for(j=0; j<num_mass; j++){ s->trace_prop[j].real = 0.0; s->trace_prop[j].imag = 0.0; } } j1 = xi%2; k = xi/2; j2 = k%2; k /= 2; j3 = k%2; k /= 2; j4 = k%2; parity = (j1+j2+j3+j4)%2; /* dirs[XUP] = j1; dirs[YUP] = j2; dirs[ZUP] = j3; dirs[TUP] = j4; */ /* Loop over colors of source vector */ for(j=0; j<3; j++){ /* initialize the source in phi */ FORALLSITES(i,s){ clearvec( &(s->phi)); } /* Point source at site xi in the hypercube at origin */ if( node_number(j1,j2,j3,j4) == this_node ){ i=node_index(j1,j2,j3,j4); lattice[i].phi.c[j].real = -1.0; } if( multiflag == 0){ for(j_mass=0; j_mass<num_mass; j_mass++){ FORALLSITES(i,s){ clearvec( &(s->xxx1)); } if(parity == 0){ /* do a C.G. (source in phi, result in xxx1) */ cgn += ks_congrad( F_OFFSET(phi), F_OFFSET(xxx1), mass[j_mass], niter, nrestart, rsqprop, PRECISION, EVEN, &finalrsq, &fn_links); /* Multiply by -Madjoint */ dslash_site( F_OFFSET(xxx1), F_OFFSET(ttt), ODD, &fn_links); mass_x2 = 2.*mass[j_mass]; FOREVENSITES(i,s){ scalar_mult_su3_vector( &(s->xxx1), -mass_x2, &(s->ttt)); } } else{
void d_plaquette_minmax(double *ss_plaq,double *st_plaq, double *ss_plaq_min, double *st_plaq_min, double *ss_plaq_max, double *st_plaq_max) { /* su3mat is scratch space of size su3_matrix */ su3_matrix *su3mat; register int i,dir1,dir2; register site *s; register int first_pass_s,first_pass_t; register su3_matrix *m1,*m4; su3_matrix mtmp; double ss_sum,st_sum; double rtrace_s, rtrace_t, ss_min, st_min, ss_max, st_max; msg_tag *mtag0,*mtag1; ss_sum = st_sum = 0.0; first_pass_s=1; first_pass_t=1; su3mat = (su3_matrix *)malloc(sizeof(su3_matrix)*sites_on_node); if(su3mat == NULL) { printf("plaquette: can't malloc su3mat\n"); fflush(stdout); terminate(1); } for(dir1=YUP;dir1<=TUP;dir1++){ for(dir2=XUP;dir2<dir1;dir2++){ mtag0 = start_gather_site( F_OFFSET(link[dir2]), sizeof(su3_matrix), dir1, EVENANDODD, gen_pt[0] ); mtag1 = start_gather_site( F_OFFSET(link[dir1]), sizeof(su3_matrix), dir2, EVENANDODD, gen_pt[1] ); FORALLSITES(i,s){ m1 = &(s->link[dir1]); m4 = &(s->link[dir2]); mult_su3_an(m4,m1,&su3mat[i]); } wait_gather(mtag0); wait_gather(mtag1); FORALLSITES(i,s){ #ifdef SCHROED_FUN if(dir1==TUP ){ if(s->t==(nt-1)){ mult_su3_nn( &su3mat[i], &(s->boundary[dir2]), &mtmp); } else{ mult_su3_nn( &su3mat[i], (su3_matrix *)(gen_pt[0][i]), &mtmp); } rtrace_t = realtrace_su3((su3_matrix *)(gen_pt[1][i]), &mtmp); st_sum += rtrace_t; } else if(s->t > 0){ mult_su3_nn( &su3mat[i], (su3_matrix *)(gen_pt[0][i]), &mtmp); rtrace_s = realtrace_su3((su3_matrix *)(gen_pt[1][i]), &mtmp); ss_sum += rtrace_s; } #else mult_su3_nn( &su3mat[i], (su3_matrix *)(gen_pt[0][i]), &mtmp); if(dir1==TUP ) { rtrace_t = (double) realtrace_su3((su3_matrix *)(gen_pt[1][i]),&mtmp); st_sum += rtrace_t; } else { rtrace_s = (double) realtrace_su3((su3_matrix *)(gen_pt[1][i]),&mtmp); ss_sum += rtrace_s; } #endif // printf("Plaq i=%d, dir1=%d, dir2=%d: %f %f\n", // i,dir1,dir2,rtrace_s,rtrace_t); /* set min and max values on the first pass */ if( dir1==TUP ) { if( 1==first_pass_t ) { st_min = rtrace_t; st_max = rtrace_t; first_pass_t = 0; } else { if( rtrace_t < st_min ) st_min = rtrace_t; if( rtrace_t > st_max ) st_max = rtrace_t; } } else { if( 1==first_pass_s ) { ss_min = rtrace_s; ss_max = rtrace_s; first_pass_s = 0; } else { if( rtrace_s < ss_min ) ss_min = rtrace_s; if( rtrace_s > ss_max ) ss_max = rtrace_s; } } } cleanup_gather(mtag0); cleanup_gather(mtag1); } }
ferm_links_u1_t *fn ) { register int i; register site *s; FORALLMYSITES(i,s){ #ifdef SITERAND s->g_rand.real = gaussian_rand_no(&(s->site_prn)); s->g_rand.imag = gaussian_rand_no(&(s->site_prn)); #else s->g_rand.real = gaussian_rand_no(&node_prn); s->g_rand.imag = gaussian_rand_no(&node_prn); #endif } dslash_fn_site_u1( F_OFFSET(g_rand), dest, parity, fn); scalar_mult_latvec_u1( dest, -1.0, dest, parity ); scalar_mult_add_latvec_u1( dest, F_OFFSET(g_rand), 2.0*mass, dest, parity ); }/* grsource_imp_u1 */ /* construct a plain gaussian random vector in the site structure */ /* "parity" is EVEN, ODD, or EVENANDODD. */ void grsource_plain_u1( field_offset dest, int parity ) { int i,j; site *s; complex *rand; FORMYSITESANDPARITY(i,s,parity){ #ifdef SITERAND rand = (complex *)F_PT(s,dest); rand->real = gaussian_rand_no(&(s->site_prn)); rand->imag = gaussian_rand_no(&(s->site_prn));
cgn += ks_congrad( F_OFFSET(phi), F_OFFSET(xxx1), mass[j_mass], niter, nrestart, rsqprop, PRECISION, EVEN, &finalrsq, &fn_links); /* Multiply by -Madjoint */ dslash_site( F_OFFSET(xxx1), F_OFFSET(ttt), ODD, &fn_links); mass_x2 = 2.*mass[j_mass]; FOREVENSITES(i,s){ scalar_mult_su3_vector( &(s->xxx1), -mass_x2, &(s->ttt)); } } else{ /* do a C.G. (source in phi, result in xxx1) */ cgn += ks_congrad( F_OFFSET(phi), F_OFFSET(xxx1), mass[j_mass], niter, nrestart, rsqprop, PRECISION, ODD, &finalrsq, &fn_links); /* Multiply by -Madjoint */ dslash_site( F_OFFSET(xxx1), F_OFFSET(ttt), EVEN, &fn_links); mass_x2 = 2.*mass[j_mass]; FORODDSITES(i,s){ scalar_mult_su3_vector( &(s->xxx1), -mass_x2, &(s->ttt)); } } /* Get contribution to color trace of the propagator */ FORALLSITES(i,s){
dir, EVENANDODD, gen_pt[0], tag0); } wait_gather(tag1); /* copy_latvec( (field_offset)gen_pt[1], F_OFFSET(resid), EVENANDODD); */ FORALLSITES(i,s) { su3vec_copy((su3_vector *)gen_pt[1][i], &(s->resid)); } FORALLSITES(i,s) { mult_adj_su3_mat_vec(&(s->link[dir]), &(s->resid), &(s->ttt)); } restart_gather_site(F_OFFSET(ttt), sizeof(su3_vector), OPP_DIR(dir), EVENANDODD, gen_pt[1], tag1); } /* k<r0 */ wait_gather(tag0); FORALLSITES(i,s) { mult_su3_mat_vec_sum(&(s->link[dir]), (su3_vector *)(gen_pt[0][i]), (su3_vector *)F_PT(s,fprop)); } cleanup_gather(tag0); wait_gather(tag1); FORALLSITES(i,s) { add_su3_vector((su3_vector *)(gen_pt[1][i]), (su3_vector *)F_PT(s,fprop), (su3_vector *)F_PT(s,fprop));
void load_in_zonked_light(int color, int k_zonked_light) { int spin ; int restart_flag_zonked_light ; int MinCG; w_prop_file *zonked_fp_in ; /*** Quark propagator IO stuff **/ /************************************************************/ /*** load in the zonked quark propagator ********/ kappa = kappa_zonked_light[k_zonked_light] ; /** open the light quark zonked propagator ***/ zonked_fp_in = r_open_wprop(startflag_zonked_light[ k_zonked_light ], qfile_zonked_light[ k_zonked_light ]); node0_printf("Loading from %s\n",qfile_zonked_light[ k_zonked_light ]); for(spin = 0 ; spin < 4 ; ++spin ) { /*** load the light zonked quark propagagor from disk ***/ if(reload_wprop_sc_to_site( startflag_zonked_light[k_zonked_light], zonked_fp_in, spin, color, F_OFFSET(quark_zonked.d[spin]), 1)!=0) terminate(1); /**** check the wilson vector loaded in , by using it as a new solution to the inverter *****/ /* Complete the definition of source structure */ wqs_zonked_light[k_zonked_light].color = color; wqs_zonked_light[k_zonked_light].spin = spin; /* For clover_info if we ever use it */ wqstmp = wqs_zonked_light[k_zonked_light]; /* If we are starting afresh, we set a minimum number of iterations */ if(startflag_zonked_light[k_zonked_light] == FRESH)MinCG = nt; else MinCG = 0; /* Load inversion control structure */ qic_zonked_light.prec = PRECISION; qic_zonked_light.min = MinCG; qic_zonked_light.max = niter_zonked_light; qic_zonked_light.nrestart = nrestart_zonked_light; qic_zonked_light.resid = resid_zonked_light; qic_zonked_light.start_flag = startflag_zonked_light[k_zonked_light]; #ifdef CLOVER /* Load Dirac matrix parameters */ dcp.Kappa = kappa_zonked_light[k_zonked_light]; dcp.Clov_c = clov_c; dcp.U0 = u0; wilson_invert_site_wqs(F_OFFSET(chi), F_OFFSET(quark_zonked.d[spin]), w_source,&wqs_zonked_light[k_zonked_light], bicgilu_cl_site,&qic_zonked_light,(void *)&dcp); #else /* Load Dirac matrix parameters */ dwp.Kappa = kappa_zonked_light[k_zonked_light]; wilson_invert_site_wqs(F_OFFSET(chi), F_OFFSET(quark_zonked.d[spin]), w_source,&wqs_zonked_light[k_zonked_light], mrilu_w_site,&qic_zonked_light,(void *)&dwp); #endif } /*** end the loop over the source spin ****/ /** close light quark zonked propagator ***/ r_close_wprop(startflag_zonked_light[ k_zonked_light ], zonked_fp_in); } /***** end of load_in_zonked_light ******/
void contract_HL3(complex *corr, field_offset q_zonked, field_offset q_sequential, field_offset q_rot, int p_pt, int seq_pt, int zonked_pt, int spect_pt) { double t_start ; int base_pt, q_stride, op_stride ; /**********----------**********----------**********/ t_start = dclock() ; /* Compute partial offset for storage of result in corr[] */ base_pt = LIGHT_FORM_WHERE(0,zonked_pt,seq_pt,spect_pt,0,p_pt, 0 ) ; q_stride = LIGHT_FORM_WHERE(0,0,0, 0, 1,0, 0 ) ; op_stride = LIGHT_FORM_WHERE(0,0,0, 0, 0,0, 1 ) ; /* First, contract zonked and sequential */ meson_cont_mom_lean2(corr , q_zonked, q_sequential, base_pt, q_stride, op_stride, w_meson_store_t,w_meson_my_t,w_meson_nstore, no_q_values,q_momstore, MAX_THREEPT, three_pt, F_OFFSET(QTMP),DIMQTMP); /*** 3D derivative on the sequential ***/ base_pt += op_stride*MAX_THREEPT; clover_rotate_fermilab(q_sequential, q_rot); meson_cont_mom_lean2(corr, q_zonked, q_rot, base_pt, q_stride, op_stride, w_meson_store_t,w_meson_my_t,w_meson_nstore, no_q_values,q_momstore, MAX_THREEPT, three_pt, F_OFFSET(QTMP),DIMQTMP); /*** 3D derivative on the zonked ***/ base_pt += op_stride*MAX_THREEPT; clover_rotate_fermilab(q_zonked, q_rot); meson_cont_mom_lean2(corr, q_rot, q_sequential, base_pt, q_stride, op_stride, w_meson_store_t,w_meson_my_t,w_meson_nstore, no_q_values,q_momstore, MAX_THREEPT, three_pt, F_OFFSET(QTMP),DIMQTMP); /*** 4D derivative on the sequential ***/ /** base_pt += op_stride*MAX_THREEPT; clover_rotate(q_sequential, q_rot); meson_cont_mom_lean2(corr, q_zonked, q_rot, base_pt, q_stride, op_stride, w_meson_store_t,w_meson_my_t,w_meson_nstore, no_q_values,q_momstore, MAX_THREEPT, three_pt, F_OFFSET(QTMP),DIMQTMP); **/ /*** 4D derivative on the zonked ***/ /** base_pt += op_stride*MAX_THREEPT; clover_rotate(q_zonked, q_rot); meson_cont_mom_lean2(corr, q_rot, q_sequential, base_pt, q_stride, op_stride, w_meson_store_t,w_meson_my_t,w_meson_nstore, no_q_values,q_momstore, MAX_THREEPT, three_pt, F_OFFSET(QTMP),DIMQTMP); **/ /**** end of the section ****/ IF_VERBOSE_ON(1) printf("Time to Wick contract all the heavy-light 3pt correlators = %g sec\n", dclock() - t_start) ; }