Exemplo n.º 1
0
int main(int argc, char *argv[])  {
int meascount,todo;
int prompt;
double dssplaq,dstplaq;
int m_iters,s_iters,avm_iters,avs_iters,avspect_iters;
#ifdef SPECTRUM
int spect_iters;
#endif
complex plp;
double dtime;

 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();

    /* loop over input sets */
    while( readin(prompt) == 0){

/* set up loop tables */
        make_loop_table2();

	/* perform warmup trajectories */
	dtime = -dclock();

	/* call plaquette measuring process */
/* Check: compute initial plaquette (T. D.) */
                d_plaquette(&dssplaq,&dstplaq);
                if(this_node==0)printf("START %e %e %e\n",
                    dssplaq,dstplaq, 
                        dssplaq+dstplaq);

	for(todo=warms; todo > 0; --todo ){
	    update();
	}
	if(this_node==0)printf("WARMUPS COMPLETED\n");

	/* perform measuring trajectories, reunitarizing and measuring 	*/
	meascount=0;		/* number of measurements 		*/
	plp = cmplx(99.9,99.9);
	avspect_iters = avm_iters = avs_iters = 0;
	for(todo=trajecs; todo > 0; --todo ){ 

	    /* do the trajectories */
	    s_iters=update();

	    /* Do "local" measurements every trajectory! */
            /* The action from the RG trans */
            gauge_action(&dssplaq);
            if(this_node==0)printf("ACTION_V  %e  %e\n",
                dssplaq,(dssplaq)/(double)(volume*6));

	    /* call plaquette measuring process */
	    d_plaquette(&dssplaq,&dstplaq);

	    /* call the Polyakov loop measuring program */
	    plp = ploop();

            /* generate a pseudofermion configuration */
	    boundary_flip(MINUS);
	    m_iters = f_measure_cl();
	    boundary_flip(PLUS);

	    ++meascount;
	    avm_iters += m_iters;
	    avs_iters += s_iters;
	           
	    if(this_node==0)printf("GMES %e %e %e %e %e\n",
		(double)plp.real,(double)plp.imag,(double)m_iters,
		dssplaq,dstplaq);
	    /* Re(Polyakov) Im(Poyakov) cg_iters ss_plaq st_plaq */

	    /* measure other stuff every "propinterval" trajectories */
	    if(((todo-1)%propinterval) == 0){

	      fixflag = NO_GAUGE_FIX;
#ifdef SPECTRUM 
#ifdef SCREEN 
	      gaugefix(ZUP,(Real)1.5,500,(Real)GAUGE_FIX_TOL);
	      invalidate_this_clov(gen_clov);
		fixflag = COULOMB_GAUGE_FIX;
		boundary_flip(MINUS);
		spect_iters = s_props_cl();
		avspect_iters += spect_iters;
		boundary_flip(PLUS);
#else	/* spectrum in time direction */
		gaugefix(TUP,(Real)1.5,500,(Real)GAUGE_FIX_TOL);
		invalidate_this_clov(gen_clov);
		fixflag = COULOMB_GAUGE_FIX;
/* commented 15 OCT 95, MBW....we'll use periodic b.c. for spect. */
/*		boundary_flip(MINUS); */
/* Don't need t_props if we are doing w_spectrum  - C. DeTar */
/*		spect_iters = t_props_cl();
		avspect_iters += spect_iters; */
		spect_iters = w_spectrum_cl();
		avspect_iters += spect_iters;
/*		boundary_flip(PLUS); */
#endif	/* end ifndef SCREEN */
#endif	/* end ifdef SPECTRUM */

	    }
	    fflush(stdout);

	}	/* end loop over trajectories */

	if(this_node==0)printf("RUNNING COMPLETED\n");
/* Check: compute final plaquette (T. D.) */
                d_plaquette(&dssplaq,&dstplaq);
                if(this_node==0)printf("STOP %e %e %e\n",
                    dssplaq,dstplaq,
                        dssplaq+dstplaq);

	if(meascount>0)  {
	    if(this_node==0)printf("average cg iters for step= %e\n",
		(double)avs_iters/meascount);
	    if(this_node==0)printf("average cg iters for measurement= %e\n",
		(double)avm_iters/meascount);
#ifdef SPECTRUM
	    if(this_node==0)printf("average cg iters for spectrum = %e\n",
		(double)avspect_iters/meascount);
#endif
	}

	dtime += dclock();
	if(this_node==0){
	    printf("Time = %e seconds\n",dtime);
	    printf("total_iters = %d\n",total_iters);
	}
	fflush(stdout);
	dtime = -dclock();

	/* save lattice if requested */
        if( saveflag != FORGET ){
	  save_lattice( saveflag, savefile, stringLFN );
        }
    }
    return 0;
}
Exemplo n.º 2
0
int main(int argc, char *argv[])  {
int meascount,todo;
int prompt;
double dssplaq,dstplaq;
complex plp;
double dtime;

initialize_machine(&argc,&argv);

  /* Remap standard I/O */
  if(remap_stdio_from_args(argc, argv) == 1)terminate(1);

 g_sync();
    /* set up */
    prompt = setup();

#ifdef GBALL
    make_glueball_ops();
#endif

    /* loop over input sets */
    while( readin(prompt) == 0){

        /* perform warmup trajectories */
        dtime = -dclock();
 
#ifdef FUZZ
if(this_node==0)printf("Fat Polyakov loop parameter %f\n",ALPHA_FUZZ);
#endif

        for(todo=warms; todo > 0; --todo ){
            update();
        }
        if(this_node==0)printf("WARMUPS COMPLETED\n");

        /* perform measuring trajectories, reunitarizing and measuring  */
        meascount=0;            /* number of measurements               */
        plp = cmplx(99.9,99.9);
        for(todo=trajecs; todo > 0; --todo ){ 

            /* do the trajectories */
            update();

            /* measure every "propinterval" trajectories */
            if((todo%propinterval) == 0){
            
                /* call plaquette measuring process */
                d_plaquette(&dssplaq,&dstplaq);

                /* don't bother to */
                /* call the Polyakov loop measuring program */
                /* plp = ploop(); */
#ifdef FUZZ
                plp_fuzzy = ploop_staple((Real)ALPHA_FUZZ);
#endif

                ++meascount;
                if(this_node==0)printf("GMES %e %e %e %e %e\n",
                    (double)plp.real,(double)plp.imag,99.9,dssplaq,dstplaq);
                /* Re(Polyakov) Im(Poyakov) cg_iters ss_plaq st_plaq */

#ifdef FUZZ
		if(this_node==0)printf("GFUZZ %e %e\n",
		    (double)plp_fuzzy.real,(double)plp_fuzzy.imag);
#endif
#ifdef GBALL
		measure_glueball_ops();
#endif

                fflush(stdout);
            }
        }       /* end loop over trajectories */

#ifdef ORA_ALGORITHM
       /* gaugefix if requested */
       if( fixflag == COULOMB_GAUGE_FIX){
	 gaugefix(TUP,(Real)1.8,600,(Real)GAUGE_FIX_TOL);
           if(this_node==0)printf("FIXED TO COULOMB GAUGE\n");
           fflush(stdout);
       }
       else if( fixflag == LANDAU_GAUGE_FIX){
	 gaugefix(8,(Real)1.8,600,(Real)GAUGE_FIX_TOL);
           if(this_node==0)printf("FIXED TO LANDAU GAUGE\n");
           fflush(stdout);
       }
#endif


        if(this_node==0)printf("RUNNING COMPLETED\n");

        dtime += dclock();
        if(this_node==0){
            printf("Time = %e seconds\n",dtime);
        }
        fflush(stdout);
	dtime = -dclock();

        /* save lattice if requested */
        if( saveflag != FORGET ){
	  save_lattice( saveflag, savefile, stringLFN );
        }
    }
    return 0;
}
Exemplo n.º 3
0
MUST COMPILE WITH QIO FOR THE SCRATCH FILE
#endif

/* Comment these out if you want to suppress detailed timing */
/*#define IOTIME*/
/*#define PRTIME*/

int main(int argc, char *argv[])
{
  int meascount;
  int prompt;
  Real avm_iters,avs_iters;
  
  double starttime,endtime;
#ifdef IOTIME
  double dtime;
  int iotime = 1;
#else
  int iotime = 0;
#endif
  
  int MinCG,MaxCG;
  Real RsdCG, RRsdCG;
  
  int spin,color,j,k;
  int flag;
  int status;
  
  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];
  quark_source wqs_scr;  /* scratch file */
  char scratch_file[MAX_KAP][MAXFILENAME];
  
  wilson_vector *psi = NULL;
  wilson_prop_field *quark_propagator = NULL;
  wilson_prop_field *quark_prop2 = NULL;
  int cg_cl = CL_CG;
  int source_type;
  
  initialize_machine(&argc,&argv);

  /* Remap standard I/O */
  if(remap_stdio_from_args(argc, argv) == 1)terminate(1);
  
  g_sync();
  /* set up */
  prompt = setup_cl();
  /* loop over input sets */
  
  psi = create_wv_field();
  quark_propagator = create_wp_field(3);
  quark_prop2 = create_wp_field(3);

  while( readin(prompt) == 0)
    {
      
      starttime=dclock();
      MaxCG=niter;
      
      avm_iters=0.0;
      meascount=0;
      
      spectrum_cl_hl_init();
  
      if( fixflag == COULOMB_GAUGE_FIX)
	{
	  if(this_node == 0) 
	    printf("Fixing to Coulomb gauge\n");
#ifdef IOTIME
	  dtime = -dclock();
#endif
	  gaugefix(TUP,(Real)1.5,500,GAUGE_FIX_TOL);
#ifdef IOTIME
	  dtime += dclock();
	  if(this_node==0)printf("Time to gauge fix = %e\n",dtime);
#endif
	  invalidate_this_clov(gen_clov);
	}
      else
	if(this_node == 0)printf("COULOMB GAUGE FIXING SKIPPED.\n");
      
      /* save lattice if requested */
      if( saveflag != FORGET ){
	savelat_p = save_lattice( saveflag, savefile, stringLFN );
      }
      
      if(this_node==0)printf("END OF HEADER\n");
      
      /*	if(this_node==0) printf("num_kap = %d\n", num_kap); */
      /* Loop over kappas to compute and store quark propagator */
      for(k=0;k<num_kap;k++){
	
	kappa=kap[k];
	RsdCG=resid[k];
	RRsdCG=relresid[k];
	if(this_node==0)printf("Kappa= %g r0= %g residue= %g rel= %g\n",
			       (double)kappa,(double)wqs.r0,(double)RsdCG,
			       (double)RRsdCG);
	
	/* open files for wilson propagators */
	
#ifdef IOTIME
	dtime = -dclock();
#endif
	wqstmp = wqs;  /* For clover_info.c */
	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.type);
#ifdef IOTIME
	dtime += dclock();
	if(startflag_w[k] != FRESH)
	  node0_printf("Time to open prop = %e\n",dtime);
#endif
	
	/* Open scratch file and write header */
	sprintf(scratch_file[k],"%s_%02d",scratchstem_w,k);
	source_type = UNKNOWN;
	fp_scr[k] = w_open_wprop(scratchflag, scratch_file[k], source_type);
	init_qs(&wqs_scr);

	  
	/* Loop over source spins */
	for(spin=0;spin<4;spin++){
	  /* Loop over source colors */
	  for(color=0;color<3;color++){
	    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
		  {
		    copy_wv_from_wp(psi, quark_propagator, color, spin);
		  }
	      }
	    
	    /* Saves one multiplication by zero in cgilu */
	    if(startflag_w[k] == FRESH)flag = 0;
	    else 
	      flag = 1;      
	    
	    /* load psi if requested */
	    status = reload_wprop_sc_to_field( startflag_w[k], fp_in_w[k], 
					       &wqs, spin, color, psi, iotime);
	    if(status != 0)
	      {
		node0_printf("control_cl_hl: Recovering from error by resetting initial guess to zero\n");
		reload_wprop_sc_to_field( FRESH, fp_in_w[k], &wqs,
					  spin, color, psi,0);
		flag = 0;
	      }
	    
	    /* Complete the source structure */
	    wqs.color = color;
	    wqs.spin = spin;
	    
	    /* If we are starting afresh, we set a minimum number
	       of iterations */
	    if(startflag_w[k] == FRESH || status != 0)MinCG = nt/2; 
	    else MinCG = 0;
	    
	    /* Load inversion control structure */
	    qic.prec = PRECISION;
	    qic.min = 0;
	    qic.max = MaxCG;
	    qic.nrestart = nrestart;
	    qic.parity = EVENANDODD;
	    qic.start_flag = flag;
	    qic.nsrc = 1;
	    qic.resid = RsdCG;
	    qic.relresid = RRsdCG;
	    
	    /* Load Dirac matrix parameters */
	    dcp.Kappa = kappa;
	    dcp.Clov_c = clov_c;
	    dcp.U0 = u0;
	    
	    switch (cg_cl) {
	    case BICG:
	      avs_iters =
		(Real)wilson_invert_field_wqs(&wqs, w_source_field, psi,
					      bicgilu_cl_field,
					      &qic,(void *)&dcp);
	      break;
	    case HOP:
	      avs_iters = 
		(Real)wilson_invert_field_wqs(&wqs, w_source_field, psi,
					      hopilu_cl_field,
					      &qic,(void *)&dcp);
	      break;
	    case MR:
	      avs_iters = 
		(Real)wilson_invert_field_wqs(&wqs, w_source_field, psi,
					      mrilu_cl_field,
					      &qic,(void *)&dcp);
		break;
	    case CG:
	      avs_iters = 
		(Real)wilson_invert_field_wqs(&wqs, w_source_field, psi,
					      cgilu_cl_field,
					      &qic,(void *)&dcp);
	      break;
	    default:
	      node0_printf("main(%d): Inverter choice %d not supported\n",
			   cg_cl, this_node);
	    }
	    
	    avm_iters += avs_iters;
	    
	    copy_wp_from_wv(quark_propagator, psi, color, spin);
	    
	    /* Write psi to scratch disk */
#ifdef IOTIME
	    dtime = -dclock();
#endif
	    save_wprop_sc_from_field(scratchflag, fp_scr[k], &wqs_scr,
				     spin, color, psi, "Scratch record", iotime);
#ifdef IOTIME
	    dtime += dclock();
	    if(this_node==0) 
	      printf("Time to dump prop spin %d color %d %e\n",
		     spin,color,dtime);
#endif
	    
	    /* save psi if requested */
	    save_wprop_sc_from_field( saveflag_w[k],fp_out_w[k], &wqs,
				      spin,color,psi,"", iotime);
	    
	  } /* source colors */
	} /* source spins */
	
	/* Close and release scratch file */
	w_close_wprop(scratchflag, fp_scr[k]);
	
	/*if(this_node==0)printf("Dumped prop to file  %s\n",
	  scratch_file[k]); */
	
	/* close files for wilson propagators */
#ifdef IOTIME
	dtime = -dclock();
#endif
	r_close_wprop(startflag_w[k],fp_in_w[k]);
	w_close_wprop(saveflag_w[k],fp_out_w[k]);
#ifdef IOTIME
	dtime += dclock();
	if(saveflag_w[k] != FORGET)
	  node0_printf("Time to close prop = %e\n",dtime);
#endif
	
      } /* kappas */
      
      
      /* Loop over heavy kappas for the point sink spectrum */
      for(k=0;k<num_kap;k++){
	
	/* Read the propagator from the scratch file */

#ifdef IOTIME
	dtime = -dclock();
#endif
	kappa=kap[k];
	init_qs(&wqs_scr);
	reload_wprop_to_wp_field(scratchflag, scratch_file[k], &wqs_scr,
				 quark_propagator, iotime);
#ifdef IOTIME
	dtime += dclock();
	if(this_node==0) 
	  {
	    printf("Time to read 12 spin,color combinations %e\n",dtime);
	    fflush(stdout);
	  }
#endif
	
	/*if(this_node==0)
	  printf("Closed scratch file %s\n",scratch_file[k]);
	  fflush(stdout); */
	
	/* Diagonal spectroscopy */
	spectrum_cl_hl_diag_baryon(quark_propagator, k);
	spectrum_cl_hl_diag_meson(quark_propagator, k);
	spectrum_cl_hl_diag_rot_meson(quark_propagator, k);
	if(strstr(spectrum_request,",sink_smear,") != NULL){
	  spectrum_cl_hl_diag_smeared_meson(quark_propagator, k);
	}
	
	/* Heavy-light spectroscopy */
	/* Loop over light kappas for the point sink spectrum */
	for(j=k+1;j<num_kap;j++){

#ifdef IOTIME
	  dtime = -dclock();
#endif
	  /* Read the propagator from the scratch file */
	  kappa=kap[j];
	  init_qs(&wqs_scr);
	  reload_wprop_to_wp_field(scratchflag,  scratch_file[j], &wqs_scr,
				   quark_prop2, iotime);
#ifdef IOTIME
	  dtime += dclock();
	  if(this_node==0) 
	    {
	      printf("Time to read 12 spin,color combinations %e\n",dtime);
	      fflush(stdout);
	    }
#endif
#ifdef PRTIME
	  dtime = -dclock();
#endif
	  spectrum_cl_hl_offdiag_baryon( quark_propagator, quark_prop2, 
					 j, k);
	  spectrum_cl_hl_offdiag_meson( quark_propagator, quark_prop2, 
					j, k);
	  spectrum_cl_hl_offdiag_rot_meson( quark_propagator, quark_prop2, 
					    j, k);
	  
#ifdef PRTIME
	  dtime = -dclock();
#endif
	} /* light kappas */
	
	/* Smear the heavy propagator in place */
	sink_smear_prop( quark_propagator );
	
	/* Write the smeared propagator to the scratch file (overwriting)*/
	
	kappa=kap[k];

#ifdef IOTIME
	dtime = -dclock();
#endif
	save_wprop_from_wp_field(scratchflag, scratch_file[k], &wqs_scr,
				 quark_propagator, "Scratch propagator", 
				 iotime);
	
#ifdef IOTIME
	dtime += dclock();
	if(this_node==0) 
	  {
	    printf("Time to dump convolution %d %e\n",k,dtime);
	    fflush(stdout);
	  }
#endif
      } /* heavy kappas */
      
      /* Loop over heavy kappas for the shell sink spectrum */
      if(strstr(spectrum_request,",sink_smear,") != NULL)
	for(k=0;k<num_kap;k++){
	  
#ifdef IOTIME
	  dtime = -dclock();
#endif
	  /* Read the propagator from the scratch file */
	  kappa=kap[k];
	  init_qs(&wqs_scr);
	  reload_wprop_to_wp_field(scratchflag,  scratch_file[k], &wqs_scr,
				   quark_propagator, iotime);
#ifdef IOTIME
	  dtime += dclock();
	  if(this_node==0) 
	    {
	      printf("Time to read convolution %d %e\n",k,dtime);
	      fflush(stdout);
	    }
#endif
	  
	  /* Diagonal spectroscopy */
	  spectrum_cl_hl_diag_smeared_meson(quark_propagator, k);
	  
	  /* Heavy-light spectroscopy */
	  /* Loop over light kappas for the shell sink spectrum */
	  for(j=k+1;j<num_kap;j++){
#ifdef PRTIME
	    dtime = -dclock();
#endif
	    /* Read the propagator from the scratch file */
	    kappa=kap[j];
	    init_qs(&wqs_scr);
	    reload_wprop_to_wp_field(scratchflag,  scratch_file[j], &wqs_scr,
				     quark_prop2, iotime);
	      
	    /* Compute the spectrum */
	    spectrum_cl_hl_offdiag_smeared_meson( quark_propagator,
						  quark_prop2, j, k);
	    
#ifdef PRTIME
	    dtime += dclock();
	    if(this_node==0) 
	      {
		printf("Time to read and do off diagonal mesons %d %d %e\n",
		       j,k,dtime);
		fflush(stdout);
	      }
#endif
	} /* light kappas */
	
      } /* heavy kappas */
      
      spectrum_cl_hl_print(wqs.t0);
      spectrum_cl_hl_cleanup();

      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);
    }
      
  destroy_wv_field(psi);
  destroy_wp_field(quark_propagator);
  
  return 0;
}
Exemplo n.º 4
0
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 */
Exemplo n.º 5
0
int main(int argc, char *argv[])
{
  int prompt;
  int i, j, iq0, iq1;
#ifdef CLOV_LEAN
  int oldiq0, oldiq1, oldip0;
#endif
  double starttime, endtime;
#ifdef PRTIME
  double dtime;
#endif
  wilson_prop_field *prop[MAX_PROP];
  wilson_prop_field *quark[MAX_QK];
  
  initialize_machine(&argc,&argv);

  /* Remap standard I/O */
  if(remap_stdio_from_args(argc, argv) == 1)terminate(1);
  
  g_sync();
  
  starttime=dclock();
    
  /* set up */
  STARTTIME;
  prompt = setup();
  ENDTIME("setup");

  /* loop over input sets */

  while( readin(prompt) == 0){

    if(prompt == 2)continue;
    
    total_iters=0;
    
#ifdef HISQ_SVD_COUNTER
    hisq_svd_counter = 0;
#endif
    
    /**************************************************************/
    /* Set up gauge field */
    
    if( param.fixflag == COULOMB_GAUGE_FIX)
      {
	if(this_node == 0) 
	  printf("Fixing to Coulomb gauge\n");

	STARTTIME;
	gaugefix(TUP,(Real)1.5,500,GAUGE_FIX_TOL);
	ENDTIME("gauge fix");

	/* (Re)construct APE smeared links after gauge fixing.  
	   No KS phases here! */
	destroy_ape_links_3D(ape_links);
	ape_links = ape_smear_3D( param.staple_weight, param.ape_iter );

	invalidate_this_clov(gen_clov);
      }
    else
      if(this_node == 0)printf("COULOMB GAUGE FIXING SKIPPED.\n");
    
    /* save lattice if requested */
    if( param.saveflag != FORGET ){
      savelat_p = save_lattice( param.saveflag, param.savefile, 
				param.stringLFN );
    } else {
      savelat_p = NULL;
    }

    if(this_node==0)printf("END OF HEADER\n");
    
    /**************************************************************/


    /* Loop over the propagators */

    STARTTIME;
    for(i=0; i<param.num_prop; i++){
      node0_printf("******* Creating propagator %d ********\n",i);fflush(stdout);
      
      /**************************************************************/
      /* Read and/or generate quark propagator */

      if(param.prop_type[i] == CLOVER_TYPE)
	{
	  int ncolor = convert_ksource_to_color(param.src_qs[i].nsource);
	  
	  prop[i] = create_wp_field(ncolor);
      
	  node0_printf("Generate Dirac propagator\n");
	  node0_printf("Kappa= %g source %s residue= %g rel= %g\n",
		       (double)param.dcp[i].Kappa,
		       param.src_qs[i].descrp,
		       (double)param.qic[i].resid,
		       (double)param.qic[i].relresid);
	  
	  /* For clover_info */
	  wqstmp = param.src_qs[i];
	  dcptmp = param.dcp[i];

	  total_iters += get_wprop_to_wp_field(param.prop_type[i],
					       param.startflag_w[i], 
					       param.startfile_w[i], 
					       param.saveflag_w[i], 
					       param.savefile_w[i],
					       prop[i], 
					       &param.src_qs[i],
					       &param.qic[i], 
					       (void *)&param.dcp[i],
					       param.bdry_phase[i],
					       param.coord_origin,
					       param.check[i]);
#ifdef CLOV_LEAN
	  /* Free clover prop memory if we have saved the prop to disk */
	  if(param.saveflag_w[i] != FORGET){
	    free_wp_field(prop[i]);
	    clear_qs(&param.src_qs[i]);
	    node0_printf("destroy prop[%d]\n",i);
	  }
#endif
	}
	
      /* ------------------------------------------- */
      else if(param.prop_type[i] == IFLA_TYPE)
	{
	  int ncolor = convert_ksource_to_color(param.src_qs[i].nsource);
	  

	  prop[i] = create_wp_field(ncolor);
      
	  node0_printf("Generate Dirac IFLA propagator\n");
	  if(this_node==0)printf("Kappa= %g source %s residue= %g rel= %g\n",
				 (double)param.nap[i].kapifla,
				 param.src_qs[i].descrp,
				 (double)param.qic[i].resid,
				 (double)param.qic[i].relresid);
	 
	  /* For clover_info */
	  wqstmp = param.src_qs[i];
	  naptmp = param.nap[i];
	  
	  total_iters += get_wprop_to_wp_field(param.prop_type[i],
					       param.startflag_w[i], 
					       param.startfile_w[i], 
					       param.saveflag_w[i], 
					       param.savefile_w[i],
					       prop[i], 
					       &param.src_qs[i], 
					       &param.qic[i], 
					       (void *)&param.nap[i],
					       param.bdry_phase[i],
					       param.coord_origin,
					       param.check[i]);
#ifdef CLOV_LEAN
	  /* Free clover prop memory if we have saved the prop to disk */
	  if(param.saveflag_w[i] != FORGET){
	    free_wp_field(prop[i]);
	    clear_qs(&param.src_qs[i]);
	    node0_printf("destroy prop[%d]\n",i);
	  }
#endif
	}
      else if(param.prop_type[i] == KS_TYPE || param.prop_type[i] == KS0_TYPE ) /* KS_TYPE */
	{
	  prop[i] = create_wp_field(param.src_qs[i].ncolor);

	  if(this_node==0)printf("Mass= %g source %s residue= %g rel= %g\n",
				 (double)param.ksp[i].mass,
				 param.src_qs[i].descrp,
				 (double)param.qic[i].resid,
				 (double)param.qic[i].relresid);
	  
	  total_iters += get_ksprop_to_wp_field(param.startflag_ks[i], 
						param.startfile_ks[i], 
						param.saveflag_ks[i], 
						param.savefile_ks[i],
						prop[i], 
						&param.src_qs[i],
						&param.qic[i], 
						&param.ksp[i],
						param.bdry_phase[i],
						param.coord_origin,
						param.check[i],
						param.prop_type[i] == KS0_TYPE);
#ifdef CLOV_LEAN
	  /* (We don't free naive prop memory, since we don't save it
	     as a clover prop in get_ksprop_to_wp_field) */
#endif
	}
      else /* KS4_TYPE */
	{
	  prop[i] = create_wp_field(param.src_qs[i].ncolor);

	  if(this_node==0)printf("Mass= %g source %s residue= %g rel= %g\n",
				 (double)param.ksp[i].mass,
				 param.src_qs[i].descrp,
				 (double)param.qic[i].resid,
				 (double)param.qic[i].relresid);
	  
	  total_iters += get_ksprop4_to_wp_field(param.startflag_w[i], 
						 param.startfile_w[i], 
						 param.saveflag_w[i], 
						 param.savefile_w[i],
						 prop[i], 
						 &param.src_qs[i],
						 &param.qic[i], 
						 &param.ksp[i],
						 param.bdry_phase[i],
						 param.coord_origin,
						 param.check[i]);
	}
      
    } /* propagators */
    ENDTIME("compute propagators");

    /*****************************************************************/
    /* Complete the quark propagators by applying the sink operators
       to either the raw propagator or by building on an existing quark
       propagator */
    
    STARTTIME;
#ifdef CLOV_LEAN
    oldip0 = -1;
    oldiq0 = -1;
    oldiq1 = -1;
#endif
    for(j=0; j<param.num_qk; j++){
      node0_printf("******* Creating quark %d ********\n",j); fflush(stdout);
      i = param.prop_for_qk[j];

      if(param.parent_type[j] == PROP_TYPE){
#ifdef CLOV_LEAN
	/* Restore clover prop[i] from file. */
	/* But first destroy the old one, unless we still need it */
	if(oldip0 >= 0 && oldip0 != i)
	  if(param.prop_type[oldip0] == CLOVER_TYPE &&
	     param.saveflag_w[oldip0] != FORGET){
	    free_wp_field(prop[oldip0]);
	    node0_printf("destroy prop[%d]\n",oldip0);
	  }
	
	/* In this case we won't need any old quarks */
	if(oldiq0 >= 0)
	  if(param.saveflag_q[oldiq0] != FORGET){
	    free_wp_field(quark[oldiq0]);
	    node0_printf("destroy quark[%d]\n",oldiq0);
	  }

	if(oldiq1 >= 0)
	  if(param.saveflag_q[oldiq1] != FORGET){
	    free_wp_field(quark[oldiq1]);
	    node0_printf("destroy quark[%d]\n",oldiq1);
	  }

	if(prop[i]->swv[0] == NULL)
	  reread_wprop_to_wp_field(param.saveflag_w[i], param.savefile_w[i], prop[i]);
#endif
	/* Before applying operator, apply momentum twist to
	   ape_links.  Use the momentum twist of the parent
	   propagator */
	momentum_twist_ape_links(i, +1);
	/* Apply sink operator quark[j] <- Op[j] prop[i] */
	quark[j] = create_wp_field_copy(prop[i]);
	wp_sink_op(&param.snk_qs_op[j], quark[j]);
	/* Remove twist */
	momentum_twist_ape_links(i, -1);
#ifdef CLOV_LEAN
	oldip0 = i;
	oldiq0 = -1;
#endif
      }
      else if(param.parent_type[j] == QUARK_TYPE) { /* QUARK_TYPE */
#ifdef CLOV_LEAN
	/* Restore quark[i] from file */
	/* But first destroy the old ones, unless we still need one of them */
	
	/* In this case we won't need the old prop */
	if(oldip0 >= 0)
	   if(param.prop_type[oldip0] == CLOVER_TYPE &&
	      param.saveflag_w[oldip0] != FORGET){
	     free_wp_field(prop[oldip0]);
	     node0_printf("destroy prop[%d]\n",oldip0);
	   }

	if(oldiq0 >= 0 && oldiq0 != i)
	  if(param.saveflag_q[oldiq0] != FORGET){
	    free_wp_field(quark[oldiq0]);
	    node0_printf("destroy quark[%d]\n",oldiq0);
	  }

	if(oldiq1 >= 0 && oldiq1 != i)
	  if(param.saveflag_q[oldiq1] != FORGET){
	    free_wp_field(quark[oldiq1]);
	    node0_printf("destroy quark[%d]\n",oldiq1);
	  }

	if(quark[i]->swv[0] == NULL)
	  reread_wprop_to_wp_field(param.saveflag_q[i], param.savefile_q[i], quark[i]);
	
#endif
	/* Apply sink operator quark[j] <- Op[j] quark[i] */
	momentum_twist_ape_links(i, +1);
	quark[j] = create_wp_field_copy(quark[i]);
	wp_sink_op(&param.snk_qs_op[j], quark[j]);
	momentum_twist_ape_links(i, -1);
#ifdef CLOV_LEAN
	oldip0 = -1;
	oldiq0 = i;
#endif
      } else { /* COMBO_TYPE */
	int k;
	int nc = quark[param.combo_qk_index[j][0]]->nc;
	/* Create a zero field */
	quark[j] = create_wp_field(nc);
	/* Compute the requested linear combination */
	for(k = 0; k < param.num_combo[j]; k++){
	  wilson_prop_field *q = quark[param.combo_qk_index[j][k]];
	  if(nc != q->nc){
	    printf("Error: Attempting to combine an inconsistent number of colors: %d != %d\n",nc, q->nc);
	    terminate(1);
	  }
	  scalar_mult_add_wprop_field(quark[j], q, param.combo_coeff[j][k], quark[j]);
	}
      }
	
      /* Save the resulting quark[j] if requested */
      dump_wprop_from_wp_field( param.saveflag_q[j], param.savetype_q[j],
				param.savefile_q[j], quark[j]);

      /* Can we delete any props and quarks now? */
      /* If nothing later depends on a prop or quark, free it up. */
      for(i = 0; i < param.num_prop; i++)
	if( prop[i]->swv[0] != NULL  &&  param.prop_dep_qkno[i] < j ){
	  free_wp_field(prop[i]);
	  node0_printf("free prop[%d]\n",i);
	}
      
      for(i = 0; i < j; i++)
	if( quark[i]->swv[0] != NULL  &&  param.quark_dep_qkno[i] < j ){
	  free_wp_field(quark[i]);
	  node0_printf("free quark[%d]\n",i);
	}
#ifdef CLOV_LEAN
      oldiq1 = j;
#endif
    }

#ifdef CLOV_LEAN
    /* Free remaining memory */
    if(oldip0 >= 0)
       if(param.prop_type[oldip0] == CLOVER_TYPE &&
	  param.saveflag_w[oldip0] != FORGET){
	 free_wp_field(prop[oldip0]);
	 node0_printf("destroy prop[%d]\n",oldip0);
       }
    
    if(oldiq0 >= 0)
      if(param.saveflag_q[oldiq0] != FORGET){
	free_wp_field(quark[oldiq0]);
	node0_printf("destroy quark[%d]\n",oldiq0);
      }
    
    if(oldiq1 >= 0)
      if(param.saveflag_q[oldiq1] != FORGET){
	free_wp_field(quark[oldiq1]);
	node0_printf("destroy quark[%d]\n",oldiq1);
      }
#endif

    /* Now destroy all remaining propagator fields */

    for(i = 0; i < param.num_prop; i++){
      if(prop[i] != NULL)node0_printf("destroy prop[%d]\n",i);
      destroy_wp_field(prop[i]);
      prop[i] = NULL;
    }
    ENDTIME("generate quarks");
    
    /****************************************************************/
    /* Compute the meson propagators */

    STARTTIME;
    for(i = 0; i < param.num_pair; i++){

      /* Index for the quarks making up this meson */
      iq0 = param.qkpair[i][0];
      iq1 = param.qkpair[i][1];

      node0_printf("Mesons for quarks %d and %d\n",iq0,iq1);

#ifdef CLOV_LEAN
      /* Restore quarks from file and free old memory */
      /* We try to reuse props that are already in memory, so we don't
         destroy them immediately, but wait to see if we need
         them again for the next pair. */
      if(i > 0 && oldiq0 != iq0 && oldiq0 != iq1)
	if(param.saveflag_q[oldiq0] != FORGET){
	  free_wp_field(quark[oldiq0]);
	  node0_printf("destroy quark[%d]\n",oldiq0);
	}
      
      if(i > 0 && oldiq1 != iq0 && oldiq1 != iq1)
	if(param.saveflag_q[oldiq1] != FORGET){
	  free_wp_field(quark[oldiq1]);
	  node0_printf("destroy quark[%d]\n",oldiq1);
	}

      if(quark[iq0]->swv[0] == NULL)
	reread_wprop_to_wp_field(param.saveflag_q[iq0], param.savefile_q[iq0], quark[iq0]);

      if(quark[iq1]->swv[0] == NULL){
	reread_wprop_to_wp_field(param.saveflag_q[iq1], param.savefile_q[iq1], quark[iq1]);
      }
#endif

      /* Tie together to generate hadron spectrum */
      spectrum_cl(quark[iq0], quark[iq1], i);

      /* Remember, in case we need to free memory */
#ifdef CLOV_LEAN
      oldiq0 = iq0;
      oldiq1 = iq1;
#endif
    }
#ifdef CLOV_LEAN
    /* Free any remaining quark prop memory */
    if(quark[oldiq0]->swv[0] != NULL)
      if(param.saveflag_q[oldiq0] != FORGET){
	free_wp_field(quark[oldiq0]);
	node0_printf("destroy quark[%d]\n",oldiq0);
      }
    if(quark[oldiq1]->swv[0] != NULL)
      if(param.saveflag_q[oldiq1] != FORGET){
	free_wp_field(quark[oldiq1]);
	node0_printf("destroy quark[%d]\n",oldiq1);
      }
#endif
    ENDTIME("tie hadron correlators");

    node0_printf("RUNNING COMPLETED\n");
    endtime=dclock();

    node0_printf("Time = %e seconds\n",(double)(endtime-starttime));
    node0_printf("total_iters = %d\n",total_iters);
#ifdef HISQ_SVD_COUNTER
    printf("hisq_svd_counter = %d\n",hisq_svd_counter);
#endif
    fflush(stdout);

    for(i = 0; i < param.num_qk; i++){
      if(quark[i] != NULL)node0_printf("destroy quark[%d]\n",i);
      destroy_wp_field(quark[i]);
      quark[i] = NULL;
    }

    destroy_ape_links_3D(ape_links);

    /* Destroy fermion links (possibly created in make_prop()) */

#if FERM_ACTION == HISQ
    destroy_fermion_links_hisq(fn_links);
#else
    destroy_fermion_links(fn_links);
#endif
    fn_links = NULL;

  } /* readin(prompt) */

#ifdef HAVE_QUDA
  qudaFinalize();
#endif
  normal_exit(0);

  return 0;
}
Exemplo n.º 6
0
int main(int argc, char *argv[])  {
int meascount,todo;
int prompt;
double dssplaq,dstplaq,ds_deta,bd_plaq;
double dtime;

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){

	/* perform warmup trajectories */
	dtime = -dclock();
 
	for(todo=warms; todo > 0; --todo ){
	    update();
	}
	if(this_node==0)printf("WARMUPS COMPLETED\n");

	/* perform measuring trajectories, reunitarizing and measuring  */
	meascount=0;            /* number of measurements               */
	ds_deta = 0.0;
	bd_plaq = 0.0;
	for(todo=trajecs; todo > 0; --todo ){ 

	    /* do the trajectories */
	    update();

	    /* measure every "propinterval" trajectories */
	    if((todo%propinterval) == 0){
            
		/* call plaquette measuring process */
		d_plaquette(&dssplaq,&dstplaq);

		/* call the coupling measuring process */
		if(bc_flag > 0){
		    coupling(&ds_deta,&bd_plaq);
		}
		++meascount;
		if(this_node==0)printf("GMES %e %e %e %e %e\n",
		    ds_deta,bd_plaq,99.9,dssplaq,dstplaq);
		/* dS/deta bd_plaq dummy ss_plaq st_plaq */

		fflush(stdout);
	    }
	}       /* end loop over trajectories */

	if(this_node==0)printf("RUNNING COMPLETED\n");

	dtime += dclock();
	if(this_node==0){
	    printf("Time = %e seconds\n",dtime);
	}
	fflush(stdout);
	dtime = -dclock();

	/* save lattice if requested */
	if( saveflag != FORGET ){
	  save_lattice( saveflag, savefile, stringLFN );
	}
    }
    return 0;
}
Exemplo n.º 7
0
int main( int argc, char **argv ){
  int prompt;
  char *filexml;
  
  initialize_machine(&argc,&argv);

  /* Remap standard I/O if needed */
  if(remap_stdio_from_args(argc, argv) == 1)terminate(1);
  
  g_sync();
  /* set up */
  prompt = setup();

  /* loop over input sets */
  while( readin(prompt) == 0){
    
    if(prompt == 2)continue;
    
    node0_printf("BEGIN\n");
#ifdef CHECK_INVERT
    
    check_ks_invert( par_buf.srcfile[0], srcflag, par_buf.ansfile, par_buf.ansflag, 
		     par_buf.nmass, par_buf.ksp, par_buf.qic);
    
#else
#ifndef HAVE_QIO
    BOMB Checking the fermion force requires QIO compilation;
#endif
    
    check_fermion_force( par_buf.srcfile, srcflag, par_buf.ansfile[0], 
			 par_buf.ansflag[0], par_buf.nmass, par_buf.ksp);
    node0_printf("Done checking fermion force\n");
#endif
    
    /* save lattice if requested */
    if( saveflag != FORGET ){
      rephase( OFF );
      node0_printf("Saving the lattice\n");
      save_lattice( saveflag, savefile, NULL );
      rephase( ON );
    }
    
#ifdef FN
    /* save longlinks if requested */
    if (savelongflag != FORGET ){
#ifdef HAVE_QIO
      filexml = create_QCDML();
      node0_printf("Saving the long links\n");
      save_color_matrix_scidac_from_field( savelongfile, filexml, 
		   "Long links", QIO_SINGLEFILE, 
		   get_lnglinks(get_fm_links(fn_links)[0]), 4, PRECISION);
      /* REMOVE NEXT STATEMENT */
      //      save_color_matrix_scidac_from_field( "lngback.scidac", filexml, 
      //		   "Long back links", QIO_SINGLEFILE, 
      //                   get_lngbacklinks(get_fm_links(fn_links)[0]), 4, PRECISION);
      free_QCDML(filexml);
#else
      printf("ERROR: Can't save the longlinks.  Recompile with QIO\n");
#endif
    }
    
    /* save fatlinks if requested */
    if (savefatflag != FORGET ){
#ifdef HAVE_QIO
      filexml = create_QCDML();
      node0_printf("Saving the fat links\n");
      save_color_matrix_scidac_from_field( savefatfile, filexml, 
            "Fat links", QIO_SINGLEFILE, 
	    get_fatlinks(get_fm_links(fn_links)[0]), 4, PRECISION);
      /* REMOVE NEXT STATEMENT */
      //      save_color_matrix_scidac_from_field( "fatback.scidac", filexml, 
      //	   "Fat back links", QIO_SINGLEFILE, 
      //	    get_fatbacklinks(get_fm_links(fn_links)[0]), 4, PRECISION);
      free_QCDML(filexml);
#else
      printf("ERROR: Can't save the fatlinks.  Recompile with QIO\n");
#endif
    }
#endif
    
  }
  node0_printf("RUNNING COMPLETED\n");

#ifndef CHECK_INVERT

#ifdef HISQ_SVD_COUNTER
  printf("hisq_svd_counter = %d\n", hisq_svd_counter);
#endif
  
#ifdef HISQ_FORCE_FILTER_COUNTER
  printf("hisq_force_filter_counter = %d\n", hisq_force_filter_counter);
#endif

#endif

  return 0;
}
Exemplo n.º 8
0
int main( int argc, char **argv ){
  int prompt;
  char *filexml;
  
  initialize_machine(&argc,&argv);

  /* Remap standard I/O if needed */
  if(remap_stdio_from_args(argc, argv) == 1)terminate(1);
  
  g_sync();
  /* set up */
  prompt = setup();

  /* loop over input sets */
  while( readin(prompt) == 0){
    
    node0_printf("BEGIN\n");
#ifdef CHECK_INVERT
    
    check_ks_invert( srcfile, srcflag, F_OFFSET(phi), 
		     ansfile, ansflag, F_OFFSET(xxx), 
		     F_OFFSET(g_rand), mass);
    
#else
#ifndef HAVE_QIO
BOMB Checking the fermion force requires QIO compilation
#endif
    
    check_fermion_force( srcfile, srcflag, F_OFFSET(xxx), 
			 ansfile, ansflag, mass);
    node0_printf("Done checking fermion force\n");
#endif
    
    /* save lattice if requested */
    if( saveflag != FORGET ){
      rephase( OFF );
      node0_printf("Saving the lattice\n");
      save_lattice( saveflag, savefile, NULL );
      rephase( ON );
    }
    
#ifdef FN
    /* save longlinks if requested */
    if (savelongflag != FORGET ){
#ifdef HAVE_QIO
      filexml = create_QCDML();
      node0_printf("Saving the long links\n");
      save_color_matrix_scidac_from_field( savelongfile, filexml, 
         "Long links", QIO_SINGLEFILE, get_lnglinks(get_fm_links(fn_links)[0]), 4);
      free_QCDML(filexml);
#else
      printf("ERROR: Can't save the longlinks.  Recompile with QIO\n");
#endif
    }
    
    /* save fatlinks if requested */
    if (savefatflag != FORGET ){
#ifdef HAVE_QIO
      filexml = create_QCDML();
      node0_printf("Saving the fat links\n");
      save_color_matrix_scidac_from_field( savefatfile, filexml, 
	   "Fat links", QIO_SINGLEFILE, get_fatlinks(get_fm_links(fn_links)[0]), 4);
      free_QCDML(filexml);
#else
      printf("ERROR: Can't save the fatlinks.  Recompile with QIO\n");
#endif
    }
#endif
    
  }
  node0_printf("RUNNING COMPLETED\n");
  return 0;
}
Exemplo n.º 9
0
int main(int argc, char *argv[])
{
  int meascount;
  int prompt;
  Real avm_iters,avs_iters;
  
  double starttime,endtime;
#ifdef IOTIME
  double dtime;
  int iotime = 1;
#else
  int iotime = 0;
#endif
  
  int MaxCG;
  Real RsdCG, RRsdCG;
  
  int spin,color,k;
  int flag;

  int status;

  int cl_cg = CL_CG;

  w_prop_file *fp_in_w[MAX_KAP];        /* For propagator files */
  w_prop_file *fp_out_w[MAX_KAP];       /* For propagator files */

  wilson_vector *psi = NULL;
  wilson_prop_field quark_propagator = NULL;
  
  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_cl();
  /* loop over input sets */

  psi = create_wv_field();
  quark_propagator = create_wp_field();
  
  while( readin(prompt) == 0)
    {
      
      starttime=dclock();
      MaxCG=niter;
      wqstmp = wqs;  /* For clover_info.c */
      
      avm_iters=0.0;
      meascount=0;
      
      if( fixflag == COULOMB_GAUGE_FIX)
	{
	  if(this_node == 0) 
	    printf("Fixing to Coulomb gauge\n");
#ifdef IOTIME
	  dtime = -dclock();
#endif
	  gaugefix(TUP,(Real)1.5,500,GAUGE_FIX_TOL);
#ifdef IOTIME
	  dtime += dclock();
	  if(this_node==0)printf("Time to gauge fix = %e\n",dtime);
#endif
	  invalidate_this_clov(gen_clov);
	}
      else
	if(this_node == 0)printf("COULOMB GAUGE FIXING SKIPPED.\n");
      
      /* save lattice if requested */
      if( saveflag != FORGET ){
	savelat_p = save_lattice( saveflag, savefile, stringLFN );
      }
      
      if(this_node==0)printf("END OF HEADER\n");
      
      /*	if(this_node==0) printf("num_kap = %d\n", num_kap); */
      /* Loop over kappas */
      for(k=0;k<num_kap;k++){
	
	kappa=kap[k];
	RsdCG=resid[k];
	RRsdCG=relresid[k];
	if(this_node==0)printf("Kappa= %g r0= %g residue= %g rel= %g\n",
			       (double)kappa,(double)wqs.r0,(double)RsdCG,
			       (double)RRsdCG);
	
	/* open files for wilson propagators */
	
#ifdef IOTIME
	dtime = -dclock();
#endif
	fp_in_w[k]  = r_open_wprop(startflag_w[k], startfile_w[k]);
#ifdef IOTIME
	dtime += dclock();
	if(startflag_w[k] != FRESH)
	node0_printf("Time to open prop = %e\n",dtime);
#endif
	fp_out_w[k] = w_open_wprop(saveflag_w[k],  savefile_w[k],
				   wqs.type);
	
	
	/* Loop over source spins */
	for(spin=0;spin<4;spin++){
	  /* Loop over source colors */
	  for(color=0;color<3;color++){
	  
	    meascount ++;
	    /*if(this_node==0)printf("color=%d spin=%d\n",color,spin); */
	    if(startflag_w[k] == CONTINUE)
	      {
		node0_printf("Can not continue propagator here! Zeroing it instead\n");
		startflag_w[k] = FRESH;
	      }
	    
	    /* Saves one multiplication by zero in cgilu */
	    if(startflag_w[k] == FRESH)flag = 0;
	    else 
	      flag = 1;      
	    
	    /* load psi if requested */
	    status = reload_wprop_sc_to_field( startflag_w[k], fp_in_w[k], 
				       &wqs, spin, color, psi, iotime);

	    if(status != 0)
	      {
		node0_printf("control_cl: Recovering from error by resetting initial guess to zero\n");
		reload_wprop_sc_to_field( FRESH, fp_in_w[k], &wqs,
			       spin, color, psi, 0);
		flag = 0;
	      }

	    /* Complete the source structure */
	    wqs.color = color;
	    wqs.spin = spin;

	    /* Load inversion control structure */
	    qic.prec = PRECISION;
	    qic.max = MaxCG;
	    qic.nrestart = nrestart;
	    qic.resid = RsdCG;
	    qic.relresid = RRsdCG;
	    qic.start_flag = flag;
	    
	    /* Load Dirac matrix parameters */
	    dcp.Kappa = kappa;
	    dcp.Clov_c = clov_c;
	    dcp.U0 = u0;


	    /* compute the propagator.  Result in psi. */
	    
	    switch (cl_cg) {
	      case BICG:
		avs_iters =
		  (Real)wilson_invert_field_wqs(&wqs, w_source_field, psi,
						bicgilu_cl_field,
						&qic,(void *)&dcp);
		break;
	      case HOP:
		avs_iters = 
		  (Real)wilson_invert_field_wqs(&wqs, w_source_field, psi,
						hopilu_cl_field,
						&qic,(void *)&dcp);
		break;
	      case MR:
		avs_iters = 
		  (Real)wilson_invert_field_wqs(&wqs, w_source_field, psi,
						mrilu_cl_field,
						&qic,(void *)&dcp);
		break;
	      case CG:
		avs_iters = 
		  (Real)wilson_invert_field_wqs(&wqs, w_source_field, psi,
						cgilu_cl_field,
						&qic,(void *)&dcp);
		break;
	      default:
		node0_printf("main(%d): Inverter choice %d not supported\n",
			     this_node,cl_cg);
	      }

	    avm_iters += avs_iters;

	    copy_wp_from_wv(quark_propagator, psi, color, spin);
	    
	    /* save psi if requested */
	    save_wprop_sc_from_field( saveflag_w[k],fp_out_w[k], &wqs,
			     spin,color,psi,"Fill in record info here",iotime);
	  } /* source spins */
	} /* source colors */
	
	/* close files for wilson propagators */
	r_close_wprop(startflag_w[k],fp_in_w[k]);
#ifdef IOTIME
	dtime = -dclock();
#endif
	w_close_wprop(saveflag_w[k],fp_out_w[k]);
#ifdef IOTIME
      dtime += dclock();
      if(saveflag_w[k] != FORGET)
	node0_printf("Time to close prop = %e\n",dtime);
#endif
	
	/* spectrum, if requested */

	if(strstr(spectrum_request,",spectrum,") != NULL)
	  spectrum_cl(quark_propagator, wqs.t0, k);

      } /* kappas */


      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);
      
    }

  destroy_wv_field(psi);
  destroy_wp_field(quark_propagator);
  return 0;
}
Exemplo n.º 10
0
int
main( int argc, char **argv )
{
  int meascount,traj_done;
  int prompt;
  int s_iters, avs_iters, avspect_iters, avbcorr_iters;
  double dtime, dclock();
  
  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();

//  restore_random_state_scidac_to_site("randsave", F_OFFSET(site_prn));
//  restore_color_vector_scidac_to_site("xxx1save", F_OFFSET(xxx1),1);
//  restore_color_vector_scidac_to_site("xxx2save", F_OFFSET(xxx2),1);

  /* loop over input sets */
  while( readin(prompt) == 0) {
    
    /* perform warmup trajectories */
    dtime = -dclock();
    for( traj_done=0; traj_done < warms; traj_done++ ){
      update();
    }
    node0_printf("WARMUPS COMPLETED\n"); fflush(stdout);
    
    /* perform measuring trajectories, reunitarizing and measuring 	*/
    meascount=0;		/* number of measurements 		*/
    avspect_iters = avs_iters = avbcorr_iters = 0;
    for( traj_done=0; traj_done < trajecs; traj_done++ ){ 
      
      /* do the trajectories */
      s_iters=update();
      
      /* measure every "propinterval" trajectories */
      if( (traj_done%propinterval)==(propinterval-1) ){
	
	/* call gauge_variable fermion_variable measuring routines */
	/* results are printed in output file */
	rephase(OFF);
	g_measure( );
	rephase(ON);

	/* Load fat and long links for fermion measurements */
	load_ferm_links(&fn_links, &ks_act_paths);
#ifdef DM_DU0
	load_ferm_links(&fn_links_dmdu0, &ks_act_paths_dmdu0);
#endif

	/* Measure pbp, etc */
#ifdef ONEMASS
	f_meas_imp(F_OFFSET(phi),F_OFFSET(xxx),mass, &fn_links, 
		   &fn_links_dmdu0);
#else
	f_meas_imp( F_OFFSET(phi1), F_OFFSET(xxx1), mass1, 
		    &fn_links, &fn_links_dmdu0);
	f_meas_imp( F_OFFSET(phi2), F_OFFSET(xxx2), mass2,
		    &fn_links, &fn_links_dmdu0);
#endif

	/* Measure derivatives wrto chemical potential */
#ifdef D_CHEM_POT
#ifdef ONEMASS
	Deriv_O6( F_OFFSET(phi1), F_OFFSET(xxx1), F_OFFSET(xxx2), mass,
		  &fn_links, &fn_links_dmdu0);
#else
	Deriv_O6( F_OFFSET(phi1), F_OFFSET(xxx1), F_OFFSET(xxx2), mass1,
		  &fn_links, &fn_links_dmdu0);
	Deriv_O6( F_OFFSET(phi1), F_OFFSET(xxx1), F_OFFSET(xxx2), mass2,
		  &fn_links, &fn_links_dmdu0);
#endif
#endif

#ifdef SPECTRUM 
	/* 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);
#ifdef DM_DU0
	invalidate_all_ferm_links(&fn_links_dmdu0);
#endif
#endif
	/* Load fat and long links for fermion measurements */
	load_ferm_links(&fn_links, &ks_act_paths);
#ifdef DM_DU0
	load_ferm_links(&fn_links_dmdu0, &ks_act_paths_dmdu0);
#endif	
	if(strstr(spectrum_request,",spectrum,") != NULL){
#ifdef ONEMASS
	  avspect_iters += spectrum2(mass,F_OFFSET(phi),F_OFFSET(xxx),
				     &fn_links);
#else
	  avspect_iters += spectrum2( mass1, F_OFFSET(phi1),
				      F_OFFSET(xxx1), &fn_links);
	  avspect_iters += spectrum2( mass2, F_OFFSET(phi1),
				      F_OFFSET(xxx1), &fn_links);
#endif
	}
	
	if(strstr(spectrum_request,",spectrum_point,") != NULL){
#ifdef ONEMASS
	  avspect_iters += spectrum_fzw(mass,F_OFFSET(phi),F_OFFSET(xxx),
					&fn_links);
#else
	  avspect_iters += spectrum_fzw( mass1, F_OFFSET(phi1),
					 F_OFFSET(xxx1), &fn_links);
	  avspect_iters += spectrum_fzw( mass2, F_OFFSET(phi1),
					 F_OFFSET(xxx1), &fn_links);
#endif
	}
	
	if(strstr(spectrum_request,",nl_spectrum,") != NULL){
#ifdef ONEMASS
	  avspect_iters += nl_spectrum(mass,F_OFFSET(phi),F_OFFSET(xxx),
				       F_OFFSET(tempmat1),F_OFFSET(staple),
				       &fn_links);
#else
	  avspect_iters += nl_spectrum( mass1, F_OFFSET(phi1), 
		F_OFFSET(xxx1), F_OFFSET(tempmat1),F_OFFSET(staple),
					&fn_links);
#endif
	}
	
	if(strstr(spectrum_request,",spectrum_mom,") != NULL){
#ifdef ONEMASS
	  avspect_iters += spectrum_mom(mass,mass,F_OFFSET(phi),5e-3,
					&fn_links);
#else
	  avspect_iters += spectrum_mom( mass1, mass1, 
					 F_OFFSET(phi1), 1e-1,
					 &fn_links);
#endif
	}
	
	if(strstr(spectrum_request,",spectrum_multimom,") != NULL){
#ifdef ONEMASS
	  avspect_iters += spectrum_multimom(mass,
					     spectrum_multimom_low_mass,
					     spectrum_multimom_mass_step,
					     spectrum_multimom_nmasses,
					     5e-3, &fn_links);
#else
	  avspect_iters += spectrum_multimom(mass1,
					     spectrum_multimom_low_mass,
					     spectrum_multimom_mass_step,
					     spectrum_multimom_nmasses,
					     5e-3, &fn_links);

#endif
	}
	
#ifndef ONEMASS
	if(strstr(spectrum_request,",spectrum_nd,") != NULL){
	  avspect_iters += spectrum_nd( mass1, mass2, 1e-1,
					&fn_links);
	}
#endif
	if(strstr(spectrum_request,",spectrum_nlpi2,") != NULL){
#ifdef ONEMASS
	  avspect_iters += spectrum_nlpi2(mass,mass,F_OFFSET(phi),5e-3,
					  &fn_links );
#else
	  avspect_iters += spectrum_nlpi2( mass1, mass1, 
					   F_OFFSET(phi1),1e-1,
					   &fn_links );
	  avspect_iters += spectrum_nlpi2( mass2, mass2, 
					   F_OFFSET(phi1),1e-1,
					   &fn_links );
#endif
	}
	
	if(strstr(spectrum_request,",spectrum_singlets,") != NULL){
#ifdef ONEMASS
	  avspect_iters += spectrum_singlets(mass, 5e-3, F_OFFSET(phi),
					     &fn_links);
#else
	  avspect_iters += spectrum_singlets(mass1, 5e-3, F_OFFSET(phi1),
					     &fn_links );
	  avspect_iters += spectrum_singlets(mass2, 5e-3, F_OFFSET(phi1),
					     &fn_links );
#endif
	}

	if(strstr(spectrum_request,",fpi,") != NULL)
	  {
	    avspect_iters += fpi_2( fpi_mass, fpi_nmasses, 2e-3,
				    &fn_links );
	  }
	
#ifdef HYBRIDS
	if(strstr(spectrum_request,",spectrum_hybrids,") != NULL){
#ifdef ONEMASS
	  avspect_iters += spectrum_hybrids( mass,F_OFFSET(phi),1e-1,
					     &fn_links);
#else
	  avspect_iters += spectrum_hybrids( mass1, F_OFFSET(phi1), 5e-3,
					     &fn_links);
	  avspect_iters += spectrum_hybrids( mass2, F_OFFSET(phi1), 2e-3,
					     &fn_links);
#endif
	}
#endif
	if(strstr(spectrum_request,",hvy_pot,") != NULL){
	  rephase( OFF );
	  hvy_pot( F_OFFSET(link[XUP]) );
	  rephase( ON );
	}
#endif /* SPECTRUM */
	avs_iters += s_iters;
	++meascount;
	fflush(stdout);
      }
    }	/* end loop over trajectories */
    
    node0_printf("RUNNING COMPLETED\n"); fflush(stdout);
    if(meascount>0)  {
      node0_printf("average cg iters for step= %e\n",
		   (double)avs_iters/meascount);
#ifdef SPECTRUM
      node0_printf("average cg iters for spectrum = %e\n",
		   (double)avspect_iters/meascount);
#endif
    }
    
    dtime += dclock();
    if(this_node==0){
      printf("Time = %e seconds\n",dtime);
      printf("total_iters = %d\n",total_iters);
    }
    fflush(stdout);
    
    /* save lattice if requested */
    if( saveflag != FORGET ){
      rephase( OFF );
      save_lattice( saveflag, savefile, stringLFN );
      rephase( ON );
#ifdef HAVE_QIO
//       save_random_state_scidac_from_site("randsave", "Dummy file XML",
//        "Random number state", QIO_SINGLEFILE, F_OFFSET(site_prn));
//       save_color_vector_scidac_from_site("xxx1save", "Dummy file XML",
//        "xxx vector", QIO_SINGLEFILE, F_OFFSET(xxx1),1);
//       save_color_vector_scidac_from_site("xxx2save", "Dummy file XML",
//        "xxx vector", QIO_SINGLEFILE, F_OFFSET(xxx2),1);
#endif
    }
  }
#ifdef HAVE_QDP
  QDP_finalize();
#endif  
  normal_exit(0);
  return 0;
}
Exemplo n.º 11
0
int main(int argc, char *argv[]){
int meascount,todo;
int prompt;
double ssplaq,stplaq;
int m_iters,s_iters,avm_iters,avs_iters,avspect_iters;
#ifdef SPECTRUM
int spect_iters;
#endif
#ifdef QUARK
int disp_iters;
#endif
complex plp;
double dtime;

 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){

	/* perform warmup trajectories */
	dtime = -dclock();
	for(todo=warms; todo > 0; --todo ){
	    update();
	}
	if(this_node==0)printf("WARMUPS COMPLETED\n");

	/* perform measuring trajectories, reunitarizing and measuring 	*/
	meascount=0;		/* number of measurements 		*/
	plp = cmplx(99.9,99.9);
	avspect_iters = avm_iters = avs_iters = 0;
	for(todo=trajecs; todo > 0; --todo ){ 

	    /* do the trajectories */
	    if(steps>0)s_iters=update(); else s_iters=-99;

	    /* measure every "propinterval" trajectories */
	    if((todo%propinterval) == 0){
	    
                /* generate a pseudofermion configuration */
		boundary_flip(MINUS);
		m_iters = f_measure2();

#ifdef SPECTRUM 
#ifdef SCREEN 
		boundary_flip(PLUS);
		gaugefix(ZUP,(Real)1.5,100,(Real)GAUGE_FIX_TOL);
		boundary_flip(MINUS);
		spect_iters = s_props();
		avspect_iters += spect_iters;
		spect_iters = w_spectrum_z();
		avspect_iters += spect_iters;
#ifdef QUARK
		boundary_flip(PLUS);
		/* Lorentz gauge*/
		gaugefix(8,(Real)1.5,100,(Real)GAUGE_FIX_TOL);
		boundary_flip(MINUS);
                disp_iters = quark();
                avspect_iters += disp_iters;
#endif /* ifdef QUARK */
#else	/* spectrum in time direction */
		boundary_flip(PLUS);
		gaugefix(TUP,(Real)1.5,100,(Real)GAUGE_FIX_TOL);
		boundary_flip(MINUS);
		spect_iters = t_props();
		avspect_iters += spect_iters;
		spect_iters = w_spectrum();
		avspect_iters += spect_iters;
#endif	/* end ifndef SCREEN */
#endif	/* end ifdef SPECTRUM */
		boundary_flip(PLUS);

	        /* call plaquette measuring process */
		d_plaquette(&ssplaq,&stplaq);

		/* call the Polyakov loop measuring program */
		plp = ploop();

		avm_iters += m_iters;
		avs_iters += s_iters;
	           
	        ++meascount;
	        if(this_node==0)printf("GMES %e %e %e %e %e\n",
		    (double)plp.real,(double)plp.imag,(double)m_iters,
		    (double)ssplaq,(double)stplaq);
		/* Re(Polyakov) Im(Poyakov) cg_iters ss_plaq st_plaq */

		fflush(stdout);
	    }
	}	/* end loop over trajectories */

	if(this_node==0)printf("RUNNING COMPLETED\n");
	if(meascount>0)  {
	    if(this_node==0)printf("average cg iters for step= %e\n",
		(double)avs_iters/meascount);
	    if(this_node==0)printf("average cg iters for measurement= %e\n",
		(double)avm_iters/meascount);
#ifdef SPECTRUM
	    if(this_node==0)printf("average cg iters for spectrum = %e\n",
		(double)avspect_iters/meascount);
#endif
	}

	dtime += dclock();
	if(this_node==0){
	    printf("Time = %e seconds\n",dtime);
	    printf("total_iters = %d\n",total_iters);
	}
	fflush(stdout);

	/* save lattice if requested */
        if( saveflag != FORGET ){
	  save_lattice( saveflag, savefile, stringLFN );
        }
    }
    return 0;
}
Exemplo n.º 12
0
int main(int argc, char *argv[])
{
   int meascount;
   int todo;
   int prompt;
   double ssplaq;
   double stplaq;
   complex plp;
   double dtime;

   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();
   make_loop_table2();

   if(startflag != CONTINUE)total_sweeps = 0;

   /* loop over input sets */
   while ( readin(prompt) == 0 )
   {
      total_sweeps += sweeps;
      dtime = -dclock();

      /* perform smoothing sweeps, reunitarizing and measuring */

      meascount = 0;   /* number of measurements */
      for (todo=sweeps; todo > 0; --todo )
      {
         /* do one smoothing sweep */
         smooth();

         /* measure every "measinterval" trajectories */
         if ((todo%measinterval) == 0)
         {
            /* call plaquette measuring process */
            d_plaquette(&ssplaq, &stplaq);

            /* don't bother to */
            /* call the Polyakov loop measuring program */
            /* plp = ploop(); */
            plp = cmplx(99.9, 99.9);

            ++meascount;
            if (this_node==0)
            {
               /* Re(Polyakov) Im(Poyakov) cg_iters ss_plaq st_plaq */
               printf("GMES %e %e %e %e %e\n",
                      (double)plp.real, (double)plp.imag, 99.9,
                      (double)ssplaq, (double)stplaq);
            }

            fflush(stdout);
         }
      }       /* end loop over sweeps */


      /* perform gauge fixing after smoothing if requested */

      if ( fixflag == COULOMB_GAUGE_FIX )
      {
         if (this_node == 0)
         {
            printf("Fixing to Coulomb gauge\n");
         }
         gaugefix(TUP, (Real)1.5, 500, GAUGE_FIX_TOL);
      }
      else if (this_node == 0)
      {
         printf("GAUGE FIXING SKIPPED.\n");
      }

      /* measure the instanton charge on the fitted config */
      instanton_density();
	  
      if (this_node==0)
	{
	  printf("RUNNING COMPLETED\n");
	}
      
      dtime += dclock();
      if (this_node==0)
	{
	  printf("Time = %e seconds\n", dtime);
	}
      fflush(stdout);
      
      /* save FFdual */
      if(savetopoflag != FORGET) save_topo(topofile);

      /* save lattice if requested */
      if ( saveflag != FORGET )
      {
	save_lattice( saveflag, savefile, stringLFN );
      }
   }

   return 0;
}
Exemplo n.º 13
0
int
main( int argc, char **argv )
{
  int meascount,traj_done,i;
  int prompt;
  int s_iters, avs_iters, avspect_iters, avbcorr_iters;
  double dtime, dclock();
  
  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) {
    
    /* perform warmup trajectories */
#ifdef MILC_GLOBAL_DEBUG
    global_current_time_step = 0;
#endif /* MILC_GLOBAL_DEBUG */

    dtime = -dclock();
    for( traj_done=0; traj_done < warms; traj_done++ ){
      update();
    }
    node0_printf("WARMUPS COMPLETED\n"); fflush(stdout);
    
    /* perform measuring trajectories, reunitarizing and measuring 	*/
    meascount=0;		/* number of measurements 		*/
    avspect_iters = avs_iters = avbcorr_iters = 0;

    for( traj_done=0; traj_done < trajecs; traj_done++ ){ 
#ifdef MILC_GLOBAL_DEBUG
#ifdef HISQ_REUNITARIZATION_DEBUG
  {
  int isite, idir;
  site *s;
  FORALLSITES(isite,s) {
    for( idir=XUP;idir<=TUP;idir++ ) {
      lattice[isite].on_step_Y[idir] = 0;
      lattice[isite].on_step_W[idir] = 0;
      lattice[isite].on_step_V[idir] = 0;
    }
  }
  }
#endif /* HISQ_REUNITARIZATION_DEBUG */
#endif /* MILC_GLOBAL_DEBUG */
      /* do the trajectories */
      s_iters=update();

      /* measure every "propinterval" trajectories */
      if( (traj_done%propinterval)==(propinterval-1) ){
	
	/* call gauge_variable fermion_variable measuring routines */
	/* results are printed in output file */
	rephase(OFF);
	g_measure( );
	rephase(ON);
#ifdef MILC_GLOBAL_DEBUG
#ifdef HISQ
        g_measure_plaq( );
#endif
#ifdef MEASURE_AND_TUNE_HISQ
        g_measure_tune( );
#endif /* MEASURE_AND_TUNE_HISQ */
#endif /* MILC_GLOBAL_DEBUG */

	/************************************************************/
	/* WARNING: The spectrum code below is under revision       */
	/* It works only in special cases                           */
	/* For the asqtad spectrum, please create the lattice first */
	/* and then run the appropriate executable in ks_imp_dyn.   */
	/************************************************************/
	/* Do some fermion measurements */
#ifdef SPECTRUM 
	/* Fix TUP Coulomb gauge - gauge links only*/
	rephase( OFF );
	gaugefix(TUP,(Real)1.8,500,(Real)GAUGE_FIX_TOL);
	rephase( ON );

	invalidate_all_ferm_links(&fn_links);
#ifdef DM_DU0
	invalidate_all_ferm_links(&fn_links_dmdu0);
#endif
#endif


	for(i=0;i<n_dyn_masses;i++){
	  // Remake the path table if the fermion coeffs change for this mass
// DT IT CAN"T BE RIGHT TO CALL IT WITH dyn_mass
	  //if(make_path_table(&ks_act_paths, &ks_act_paths_dmdu0,dyn_mass[i]))
//AB: NOT SURE IF WE ARE DOING THIS RIGHT HERE
//    HAVE TO THINK THROUGH HOW LINKS ARE LOADED FOR MEASUREMENTS
//    AND WHERE NAIK CORRECTION CAN EVER POSSIBLY ENTER
//	  if(make_path_table(&ks_act_paths, &ks_act_paths_dmdu0,   0.0/*TEMP*/   ))
	    {
	      // If they change, invalidate only fat and long links
	      //node0_printf("INVALIDATE\n");
	      invalidate_all_ferm_links(&fn_links);
#ifdef DM_DU0
	      invalidate_all_ferm_links(&fn_links_dmdu0);
#endif
	    }
	    /* Load fat and long links for fermion measurements if needed */
#ifdef HISQ
//AB: QUICK FIX TO USE NAIK EPSILON FOR SPECTRUM MEASUREMENTS,
//    WORKS ONLY IF IN THE RATIONAL FUNCTION FILE naik_term_epsilon IS NON-ZERO
//    FOR LAST PSEUDO-FIELD
//    IT IS ASSUMED THAT THIS CORRECTION CORRESPONDS TO LAST DYNAMICAL MASS
//AB: OLD WAY OF INITIALIZING THE LINKS:  fn_links.hl.current_X_set = 0;
//    INSTEAD WE DO:
////	    if(n_dyn_masses-1==i) { // last dynamical mass, assumed to be c-quark
////	      fn_links.hl.current_X_set = n_naiks-1;
//DT CHARM QUARK NEEDS SMALLER RESIDUAL
////	      node0_printf("TEMP: reset rsqprop from %e to %e\n",rsqprop,1e-8*rsqprop);
////	      rsqprop *= 1e-8;
////	    }
////	    else { // light quarks
	      fn_links.hl.current_X_set = 0;
////	    }
#endif
	    load_ferm_links(&fn_links, &ks_act_paths);
#ifdef DM_DU0
#ifdef HISQ
	    fn_links_dmdu0.hl.current_X_set = 0;
#endif
	    load_ferm_links(&fn_links_dmdu0, &ks_act_paths_dmdu0);
#endif
	    
	    f_meas_imp( F_OFFSET(phi1), F_OFFSET(xxx1), dyn_mass[i],
			&fn_links, &fn_links_dmdu0);
	    /* Measure derivatives wrto chemical potential */
#ifdef D_CHEM_POT
	    Deriv_O6( F_OFFSET(phi1), F_OFFSET(xxx1), F_OFFSET(xxx2), 
		      dyn_mass[i], &fn_links, &fn_links_dmdu0);
#endif
	    
#ifdef SPECTRUM 

	    // DT: At the moment spectrum_nd does only the first two masses
	    // this only makes sense to get the kaon, and only works if
	    // eps_naik is the same for both the first two quarks
            if( strstr(spectrum_request,",spectrum_nd,") != NULL && i==0 )
              avspect_iters += spectrum_nd( dyn_mass[0], dyn_mass[1],  1e-2, &fn_links);

	    // AB: spectrum() is used only for the charm quark,
	    // i.e., last dynamical mass
	    if(strstr(spectrum_request,",spectrum,") != NULL && n_dyn_masses-1==i)
	      avspect_iters += spectrum2( dyn_mass[i], F_OFFSET(phi1),
					  F_OFFSET(xxx1), &fn_links);
	    
	    if(strstr(spectrum_request,",spectrum_point,") != NULL)
	      avspect_iters += spectrum_fzw( dyn_mass[i], F_OFFSET(phi1),
					     F_OFFSET(xxx1), &fn_links);
	    
	    // AB: nl_spectrum is used only for strange,
	    // i.e., second mass
	    if(strstr(spectrum_request,",nl_spectrum,") != NULL && 1==i)
	      avspect_iters += nl_spectrum( dyn_mass[i], F_OFFSET(phi1), 
					    F_OFFSET(xxx1), 
					    F_OFFSET(tempmat1),
					    F_OFFSET(staple),
					    &fn_links);
	    
	    // AB: spectrum_mom is used only for charm,
	    // i.e., last mass
	    if(strstr(spectrum_request,",spectrum_mom,") != NULL && n_dyn_masses-1==i)
	      avspect_iters += spectrum_mom( dyn_mass[i], dyn_mass[i], 
					     F_OFFSET(phi1), 1e-1,
					     &fn_links);
	    
	    // For now we can't do the off-diagonal spectrum if Dirac operators
            // depend on masses.  We need two propagators
	    // if(strstr(spectrum_request,",spectrum_multimom,") != NULL)
	    //     avspect_iters += spectrum_multimom(dyn_mass[i],
	    //				 spectrum_multimom_low_mass,
	    //				 spectrum_multimom_mass_step,
	    //				 spectrum_multimom_nmasses,
	    //				 5e-3, &fn_links);

	    // For now we can't do the off-diagonal spectrum if Dirac operators
            // depend on masses.  We need two propagators
	    //	    if(strstr(spectrum_request,",spectrum_nd,") != NULL){
	    //	      avspect_iters += spectrum_nd( mass1, mass2, 1e-1,
	    //					    &fn_links);

	    // AB: spectrum_nlpi2 is used only for up/down,
	    // i.e., first mass
	    if(strstr(spectrum_request,",spectrum_nlpi2,") != NULL && 0==i)
	      avspect_iters += spectrum_nlpi2( dyn_mass[i], dyn_mass[i],
					       F_OFFSET(phi1),1e-1,
					       &fn_links );
	
	    if(strstr(spectrum_request,",spectrum_singlets,") != NULL)
	      avspect_iters += spectrum_singlets(dyn_mass[i], 5e-3, 
						 F_OFFSET(phi1), &fn_links );

	    // For now we can't do the off-diagonal spectrum if Dirac operators
            // depend on masses.  We need two propagators
	    // if(strstr(spectrum_request,",fpi,") != NULL)
	    // avspect_iters += fpi_2( fpi_mass, fpi_nmasses, 2e-3,
	    //			    &fn_links );
	
#ifdef HYBRIDS
	  if(strstr(spectrum_request,",spectrum_hybrids,") != NULL)
	    avspect_iters += spectrum_hybrids( dyn_mass[i], F_OFFSET(phi1), 
					       5e-3, &fn_links);
#endif
	  if(strstr(spectrum_request,",hvy_pot,") != NULL){
	    rephase( OFF );
	    hvy_pot( F_OFFSET(link[XUP]) );
	    rephase( ON );
	  }
#endif
//	    if(n_dyn_masses-1==i) { // last dynamical mass, assumed to be c-quark
//DT CHARM QUARK NEEDS SMALLER RESIDUAL
//AB NEED TO RETURN RESIDUAL TO THE ORIGINAL VALUE
//	      node0_printf("TEMP: reset rsqprop from %e to %e\n",rsqprop,1e+8*rsqprop);
//	      rsqprop *= 1e+8;
//	    }
	}
	avs_iters += s_iters;
	++meascount;
	fflush(stdout);
      }
    }	/* end loop over trajectories */
    
    node0_printf("RUNNING COMPLETED\n"); fflush(stdout);
    if(meascount>0)  {
      node0_printf("average cg iters for step= %e\n",
		   (double)avs_iters/meascount);
    }
    
    dtime += dclock();
    if(this_node==0){
      printf("Time = %e seconds\n",dtime);
      printf("total_iters = %d\n",total_iters);
    }
    fflush(stdout);
    
    /* save lattice if requested */
    if( saveflag != FORGET ){
      rephase( OFF );
      save_lattice( saveflag, savefile, stringLFN );
      rephase( ON );
    }
  }
#ifdef HAVE_QDP
  QDP_finalize();
#endif  
  normal_exit(0);
  return 0;
}
Exemplo n.º 14
0
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() */
Exemplo n.º 15
0
int main(int argc, char *argv[])  {
#ifndef COULOMB
  int todo,sm_lev,lsmeared=0;
#else
  su3_matrix *links, *ape_links;
#endif
  int prompt;
  double dtime;
  
  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){
    
    if(prompt == 2)continue;
    dtime = -dclock();
    
#ifdef COULOMB
    if(this_node == 0) 
      printf("Fixing to Coulomb gauge\n");
    fixflag = COULOMB_GAUGE_FIX;
    
    gaugefix(TUP,(Real)1.8,500,GAUGE_FIX_TOL);
    
    links = create_G_from_site();
    ape_links = create_G();
    ape_smear_field_dir( links, TUP, ape_links, staple_weight, u0, 0, ape_iter, 0.0 ); 
    free(links);
    hvy_pot( ape_links, max_t, max_x );
    free(ape_links);
#else
    
    /* fix to axial gauge */
    if( startflag != CONTINUE){
      ax_gauge();
      fixflag = AXIAL_GAUGE_FIX;
      tot_smear = 0;
    }
    
    /* Compute unsmeared simple, i.e one-plaquette, glueball operators */
    if( no_smear_level > 0 ){
      gball_simp(tot_smear);
    }
    
    /* Loop over the different smearing levels */
    for(sm_lev=0; sm_lev < no_smear_level; sm_lev++ ){
      
      /* Do the smearing iterations */
      for(todo=smear_num[sm_lev]; todo > 0; --todo ){
	smearing();
        lsmeared=1;
      }

      if(this_node==0 && lsmeared!=0)
#ifdef HYP_3D_SMEARING
        printf("HYP SMEARING COMPLETED\n"); 
#else
        printf("APE SMEARING COMPLETED\n"); 
#endif
      tot_smear += smear_num[sm_lev];
      
      /* Compute simple, i.e one-plaquette, glueball operators */
      gball_simp(tot_smear);
      
#ifndef HYBRIDS_MEASURE
      /* Compute on-axis time-like Wilson loops */
      w_loop1(tot_smear);
#else
      /* Compute on-axis time-like hybrid potential loops 
	 and on-axis time-like Wilson loops */
      hybrid_loop1(tot_smear);
#endif
      
      /* Compute off-axis time-like Wilson loops, if desired */
      if( off_axis_flag == 1 ){
	w_loop2(tot_smear);
      }
    }
#endif
    if(this_node==0)printf("RUNNING COMPLETED\n");
    
    dtime += dclock();
    if(this_node==0){
      printf("Time = %e seconds\n",dtime);
    }
    fflush(stdout);
    dtime = -dclock();
    
    /* save lattice if requested */
    if( saveflag != FORGET ){
      save_lattice( saveflag, savefile, stringLFN );
    }
  }
  return 0;
}