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 */
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 ******/
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 ******/
int main(int argc, char **argv) { int meascount[MAX_NKAP]; int prompt, count1, count2; Real avm_iters[MAX_NKAP]; double starttime, endtime; int MaxMR, restart_flag; Real RsdMR; /******/ int spin, color, nk; /******/ int max_prop; int cl_cg = CL_CG; double ssplaq, stplaq; FILE *fp_m_out = NULL; /*** meson IO stuff **/ int fb_m_out = 0; /*** meson IO stuff **/ w_prop_file *fp_in_w[MAX_NKAP]; /* For propagator files */ w_prop_file *fp_out_w[MAX_NKAP]; /* For propagator files */ double g_time ; int i ; int MinMR; /*** variables required for the static variational code ***/ int nodata = 0 ; complex *meson = NULL; /****** start of the execution of the code ************/ initialize_machine(&argc, &argv); /* Remap standard I/O */ if(remap_stdio_from_args(argc, argv) == 1)terminate(1); g_sync(); /* set up */ prompt = setup_h(); /**DEBUG***/ #ifdef DEBUGDEF light_quark_pion(0) ; #endif /* loop over input sets */ while( readin(prompt) == 0) { if( fixflag == COULOMB_GAUGE_FIX) { if(this_node == 0) printf("Fixing to Coulomb gauge\n"); g_time = -dclock(); gaugefix(TUP,(Real)1.5,500,GAUGE_FIX_TOL); g_time += dclock(); if(this_node==0)printf("Time to gauge fix = %e\n",g_time); invalidate_this_clov(gen_clov); } else if(this_node == 0)printf("COULOMB GAUGE FIXING SKIPPED.\n"); /* save lattice if requested */ if( saveflag != FORGET ) { save_lattice( saveflag, savefile, stringLFN ); } /* call plaquette measuring process */ d_plaquette(&ssplaq, &stplaq); if (this_node == 0) printf("START %e %e\n",(double) ssplaq, (double) stplaq); /******* set up code for the static variational calculation *****/ if( nkap == 1 ) { nodata = nt*nosmear*144 ; /** reserve memory for the smeared meson correlators on each node ****/ if( ( meson = (complex *) calloc( (size_t) nodata, sizeof(complex) ) ) == NULL ) { printf("ERROR: could not reserve buffer space for the meson smearing functions\n"); terminate(1); } /** call a number of set up routines for the static variational code ***/ setup_vary(meson, nodata); } /*** end of set up section for the static-variational calculation ***/ /***DEBUG check_calc_matrix() ; ****/ starttime=dclock(); MaxMR = niter; RsdMR = (Real) sqrt((double) rsqprop); if (this_node == 0) printf("Residue=%e\n",(double) RsdMR); for (nk = 0; nk < nkap; nk++) { avm_iters[nk] = 0.0; meascount[nk] = 0; } max_prop = 12; count1 = 0; count2 = 0; for (spin = start_spin; spin < 4; spin++) { for (color = 0; color < 3; color++) { count1++; if (count1 == 1) color += start_color; for (nk = 0; nk < nkap; nk++) { count2++; if (count2 == 1) nk += start_kap; kappa = cappa[nk]; meascount[nk]++; /* open file for wilson propagators */ fp_in_w[nk] = r_open_wprop(startflag_w[nk], startfile_w[nk]); if ((spin + color) == 0) { /*** first pass of the code **/ fp_out_w[nk] = w_open_wprop(saveflag_w[nk], savefile_w[nk], wqs.type); /* open file for meson output and write the header */ if (saveflag_m == SAVE_MESON_ASCII) { fp_m_out = w_ascii_m_i(savefile_m[nk], max_prop); fb_m_out = -1; /* i.e. file is NOT binary */ } else if (saveflag_m == SAVE_MESON_BINARY) { fb_m_out = w_binary_m_i(savefile_m[nk], max_prop); fp_m_out = NULL; /* i.e. file is NOT ascii */ } else { if( this_node == 0 ) printf("ERROR in main saveflag_m = %d is out of range in initial opening\n",saveflag_m) ; terminate(1); } } /*** end of spin =0 && color == 0 **/ else { fp_out_w[nk] = w_open_wprop(saveflag_w[nk], savefile_w[nk], wqs.type); /* open file for meson output for appending output*/ if (saveflag_m == SAVE_MESON_ASCII) { fp_m_out = a_ascii_m_i(savefile_m[nk], max_prop); fb_m_out = -1; /* i.e. file is NOT binary */ } if (saveflag_m == SAVE_MESON_BINARY) { fb_m_out = a_binary_m_i(savefile_m[nk], max_prop); fp_m_out = NULL; /* i.e. file is NOT ascii */ } else { if( this_node == 0 ) printf("ERROR in main saveflag_m = %d is out of range in appending opening\n",saveflag_m) ; terminate(1); } } /*** end of spin && color not equal to zero ***/ if (this_node == 0) printf("color=%d spin=%d kappa=%f nk=%d\n", color, spin, (double) kappa, nk); /* load psi if requested */ init_qs(&wqstmp2); reload_wprop_sc_to_site(startflag_w[nk], fp_in_w[nk],&wqstmp2, spin, color, F_OFFSET(psi),1); if (nk == 0 || count2 == 1) restart_flag = flag; else restart_flag = 1; /* Conjugate gradient inversion uses site structure temporary"chi" */ /* Complete the source structure */ wqs.color = color; wqs.spin = spin; wqs.parity = EVENANDODD; /* For wilson_info */ wqstmp = wqs; /* If we are starting fresh, we want to set a mininum number of iterations */ if(startflag_w[nk] == FRESH)MinMR = nt/2; else MinMR = 0; /* Load inversion control structure */ qic.prec = PRECISION; qic.min = MinMR; qic.max = MaxMR; qic.nrestart = nrestart; qic.parity = EVENANDODD; qic.start_flag = restart_flag; qic.nsrc = 1; qic.resid = RsdMR; qic.relresid = 0; /* Load Dirac matrix parameters */ dwp.Kappa = kappa; switch (cl_cg) { case CG: /* Load temporaries specific to inverter */ /* compute the propagator. Result in psi. */ avm_iters[nk] += (Real)wilson_invert_site_wqs(F_OFFSET(chi),F_OFFSET(psi), w_source_h,&wqs, cgilu_w_site,&qic,(void *)&dwp); break; case MR: /* Load temporaries specific to inverter */ /* compute the propagator. Result in psi. */ avm_iters[nk] += (Real)wilson_invert_site_wqs(F_OFFSET(chi),F_OFFSET(psi), w_source_h,&wqs, mrilu_w_site,&qic,(void *)&dwp); break; default: node0_printf("main(%d): Inverter choice %d not supported\n", this_node,cl_cg); } /* save psi if requested */ save_wprop_sc_from_site( saveflag_w[nk],fp_out_w[nk], &wqstmp2, spin,color,F_OFFSET(psi),1); light_meson(F_OFFSET(psi), color, spin, wqs.type, fp_m_out, fb_m_out); if (this_node == 0) printf("Light mesons found\n"); /*** calculate the correlators required for the static variational code **/ if( nkap == 1 ) { /** calculate the smeared meson correlators required for Bparam **/ calc_smeared_meson(meson, F_OFFSET(psi) , F_OFFSET(mp), color, spin); /** calculate the object required for the 2-pt variational calculation ***/ buildup_strip(F_OFFSET(psi) , color, spin); } /** end of the partial calculations for the variationl project ***/ /* * find source again since mrilu overwrites it; for hopping * expansion */ /* source must be of definite parity */ wqs.parity = source_parity; w_source_h(F_OFFSET(chi), &wqs); hopping(F_OFFSET(chi), F_OFFSET(mp), F_OFFSET(psi), nhop, kappa_c, wqs.parity, color, spin, wqs.type, fp_m_out, fb_m_out); /* close files */ r_close_wprop(startflag_w[nk], fp_in_w[nk]); w_close_wprop(saveflag_w[nk],fp_out_w[nk]); if (saveflag_m == SAVE_MESON_ASCII) w_ascii_m_f(fp_m_out, savefile_m[nk]); else if (saveflag_m == SAVE_MESON_BINARY) w_binary_m_f(fb_m_out, savefile_m[nk]); if (spin == end_spin && color == end_color && nk == end_kap) goto end_of_loops; } } } /* end of loop over spin, color, kappa */ end_of_loops: if (this_node == 0) printf("RUNNING COMPLETED\n"); /**DEBUG***/ #ifdef DEBUGDEF light_quark_pion(2) ; #endif for (nk = 0; nk < nkap; nk++) { if (meascount[nk] > 0) { if (this_node == 0) printf("total mr iters for measurement= %e\n", (double) avm_iters[nk]); if (this_node == 0) printf("average mr iters per spin-color= %e\n", (double) avm_iters[nk] / (double) meascount[nk]); } } endtime=dclock(); node0_printf("Time = %e seconds\n", (double) (endtime - starttime)); fflush(stdout); /*** calculation section for the variational code *****/ if( nkap == 1 ) { /** sum up the smeared meson correlators over all the nodes ***/ for(i=0 ; i < nodata ;++i) { g_complexsum(meson + i) ; } /* write the smeared correlators to a single disk file ***/ IF_MASTER write_smear_mesonx(meson); free(meson); /*** free up the memory for the b-parameter correlators ***/ calc_vary_matrix() ; /** calculate the static variational matrix **/ node0_printf(">> The end of the static variational code <<<<\n"); }/** end of the final static variational code *****/ node0_printf("Time = %e seconds\n",(double)(endtime-starttime)); fflush(stdout); } /* end of while(prompt) */ return 0; } /* end of main() */