Exemplo n.º 1
0
/* Read in configuration specific parameters */
int
readin(int prompt)
{
  int status;

  /* On node zero, read parameters and send to all other nodes */
  if(this_node==0) {
    
    printf("\n\n");
    status=0;

    /* Identify the starting configuration */
    IF_OK status += ask_starting_lattice(stdin,  prompt, &(par_buf.startflag), 
                                         par_buf.startfile);

    /* Get flow parameters */
    IF_OK {
      /* Get flow description */
      if (prompt==1)
        printf("enter 'wilson' or 'symanzik'\n");
      scanf("%s", par_buf.flow_description);
      printf("%s\n", par_buf.flow_description);

      /* Check flow description and set staple flag */
      if( strcmp("wilson", par_buf.flow_description) == 0 ) {
        par_buf.stapleflag = WILSON;
        printf("set staple to wilson\n");
      }
      else if( strcmp("symanzik", par_buf.flow_description) == 0 ) {
        par_buf.stapleflag = SYMANZIK;
        printf("set staple to symanzik\n");
      }
      else {
        printf("Error: flow_description %s is invalid\n", 
               par_buf.flow_description);
        status++;
      }
    } /*end: flow_description IF_OK */

    IF_OK status += get_i(stdin, prompt, "exp_order", &par_buf.exp_order);
    IF_OK status += get_f(stdin, prompt, "stepsize", &par_buf.stepsize);
    IF_OK status += get_f(stdin, prompt, "stoptime", &par_buf.stoptime);

    /* Determine what to do with the final configuration */
    IF_OK status += ask_ending_lattice(stdin,  prompt, &(par_buf.saveflag), 
                                       par_buf.savefile );
    IF_OK status += ask_ildg_LFN(stdin, prompt, par_buf.saveflag, 
                                 par_buf.stringLFN );

    if( status > 0) 
      par_buf.stopflag=1; 
    else
      par_buf.stopflag=0;

  } /* end if(this_node==0) */
Exemplo n.º 2
0
/* read in parameters and coupling constants	*/
int readin(int prompt) {
  /* read in parameters for su3 monte carlo	*/
  /* argument "prompt" is 1 if prompts are to be given for input	*/
  
  int status;
  int i, k, npbp_masses;
#ifdef PRTIME
  double dtime;
#endif

  STARTTIME;

  /* On node zero, read parameters and send to all other nodes */
  if(this_node==0){
    
    printf("\n\n");
    status=0;

    /*------------------------------------------------------------*/
    /* Gauge configuration section                                */
    /*------------------------------------------------------------*/

    IF_OK status += ask_starting_lattice(stdin,  prompt, &param.startflag,
	param.startfile );
    IF_OK status += get_f(stdin, prompt,"u0", &param.u0 );

    /* find out what to do with lattice at end */
    IF_OK status += ask_ending_lattice(stdin,  prompt, &(param.saveflag),
				       param.savefile );
    IF_OK status += ask_ildg_LFN(stdin,  prompt, param.saveflag,
				  param.stringLFN );

    /* Provision is made to build covariant sources from smeared
       links */
    /* APE smearing parameters (if needed) */
    /* Zero suppresses APE smearing */
    IF_OK status += get_f(stdin, prompt, "staple_weight", 
			  &param.staple_weight);
    IF_OK status += get_i(stdin, prompt, "ape_iter",
			  &param.ape_iter);

#if EIGMODE == EIGCG
    /* for eigcg */
    /* restart for Lanczos */
    IF_OK status += get_i(stdin, prompt,"restart_lanczos", &param.eigcgp.m);

    /* number of eigenvectors per inversion */
    IF_OK status += get_i(stdin, prompt,"Number_of_eigenvals", &param.eigcgp.Nvecs);

    if(param.eigcgp.m <= 2*param.eigcgp.Nvecs){
      printf("restart_lanczos should be larger than 2*Number_of_eigenvals!\n");
      status++;
    }

    /* maximum number of eigenvectors */
    IF_OK status += get_i(stdin, prompt,"Max_Number_of_eigenvals",
			  &param.eigcgp.Nvecs_max);

    /* eigenvector input */
    IF_OK status += ask_starting_ks_eigen(stdin, prompt, &param.ks_eigen_startflag,
					  param.ks_eigen_startfile);

    /* eigenvector output */
    IF_OK status += ask_ending_ks_eigen(stdin, prompt, &param.ks_eigen_saveflag,
					param.ks_eigen_savefile);

    param.eigcgp.Nvecs_curr = 0;
    param.eigcgp.H = NULL;
#endif

#if EIGMODE == DEFLATION
    /*------------------------------------------------------------*/
    /* Dirac eigenpair calculation                                */
    /*------------------------------------------------------------*/

    /* number of eigenvectors */
    IF_OK status += get_i(stdin, prompt,"Number_of_eigenvals", &param.Nvecs);

    /* max  Rayleigh iterations */
    IF_OK status += get_i(stdin, prompt,"Max_Rayleigh_iters", &param.MaxIter);

    /* Restart  Rayleigh every so many iterations */
    IF_OK status += get_i(stdin, prompt,"Restart_Rayleigh", &param.Restart);

    /* Kalkreuter iterations */
    IF_OK status += get_i(stdin, prompt,"Kalkreuter_iters", &param.Kiters);

     /* Tolerance for the eigenvalue computation */
    IF_OK status += get_f(stdin, prompt,"eigenval_tolerance", &param.eigenval_tol);

     /* error decrease per Rayleigh minimization */
    IF_OK status += get_f(stdin, prompt,"error_decrease", &param.error_decr);

    /* eigenvector input */
    IF_OK status += ask_starting_ks_eigen(stdin, prompt, &param.ks_eigen_startflag,
					  param.ks_eigen_startfile);

    /* eigenvector output */
    IF_OK status += ask_ending_ks_eigen(stdin, prompt, &param.ks_eigen_saveflag,
					param.ks_eigen_savefile);
#endif

    /*------------------------------------------------------------*/
    /* Chiral condensate and related quantities                   */
    /*------------------------------------------------------------*/

    IF_OK status += get_i(stdin,prompt,"number_of_sets", &param.num_set);
    if( param.num_set>MAX_SET ){
      printf("num_set = %d must be <= %d!\n", param.num_set, MAX_SET);
      status++;
    }

    npbp_masses = 0;
    IF_OK for(k = 0; k < param.num_set; k++){
      int max_cg_iterations, max_cg_restarts, prec_pbp;
      Real error_for_propagator, rel_error_for_propagator;
#ifdef CURRENT_DISC
      int max_cg_iterations_sloppy, max_cg_restarts_sloppy, prec_pbp_sloppy;
      Real error_for_propagator_sloppy, rel_error_for_propagator_sloppy;
#endif

      /* Number of stochastic sources */
      IF_OK status += get_i(stdin, prompt, "npbp_reps", &param.npbp_reps[k] );

#ifdef CURRENT_DISC
      /* For some applications.  Random source count between writes */
      IF_OK status += get_i(stdin, prompt, "nwrite", &param.nwrite[k] );
      IF_OK status += get_i(stdin, prompt, "source_spacing", &param.thinning[k] );
      /* For truncated solver Take difference of sloppy and precise?*/
      char savebuf[128];
      IF_OK status += get_s(stdin, prompt, "take_truncate_diff", savebuf);
      IF_OK {
	if(strcmp(savebuf,"no") == 0)param.truncate_diff[k] = 0;
	else if(strcmp(savebuf,"yes") == 0)param.truncate_diff[k] = 1;
	else {
	  printf("Unrecognized response %s\n",savebuf);
	  printf("Choices are 'yes' and 'no'\n");
	  status++;
	}
      }
#endif

      /* The following parameters are common to the set and will be copied
	 to each member */

      /* maximum no. of conjugate gradient iterations */
      IF_OK status += get_i(stdin,prompt,"max_cg_iterations", 
			    &max_cg_iterations );
      
      /* maximum no. of conjugate gradient restarts */
      IF_OK status += get_i(stdin,prompt,"max_cg_restarts", 
			    &max_cg_restarts );

      IF_OK status += get_i(stdin, prompt, "prec_pbp", 
			    &prec_pbp );

#ifdef CURRENT_DISC
      /* If we are taking the difference between a sloppy and a precise solve,
	 get the sloppy solve parameters */
      if(param.truncate_diff[k]){
	Real error_for_propagator_sloppy, rel_error_for_propagator_sloppy;

	/* The following parameters are common to the set and will be copied
	   to each member */
	
	/* maximum no. of conjugate gradient iterations */
	IF_OK status += get_i(stdin,prompt,"max_cg_iterations_sloppy", 
			      &max_cg_iterations_sloppy );
	
	/* maximum no. of conjugate gradient restarts */
	IF_OK status += get_i(stdin,prompt,"max_cg_restarts_sloppy", 
			      &max_cg_restarts_sloppy );
	
	IF_OK status += get_i(stdin, prompt, "prec_pbp_sloppy", 
			      &prec_pbp_sloppy );
	
      }
#endif

      /* Number of pbp masses in this set */
      IF_OK status += get_i(stdin, prompt, "number_of_pbp_masses",
			    &param.num_pbp_masses[k]);
      if(param.num_pbp_masses[k] > MAX_MASS_PBP){
	printf("Number of masses exceeds dimension %d\n",MAX_MASS_PBP);
	status++;
      }

      /* Indexing range for set */
      param.begin_pbp_masses[k] = npbp_masses;
      param.end_pbp_masses[k] = npbp_masses + param.num_pbp_masses[k] - 1;
      if(param.end_pbp_masses[k] > MAX_PBP_MASSES){
	printf("Total number of masses must be <= %d!\n", MAX_PBP_MASSES);
	status++;
      }

      IF_OK for(i = 0; i < param.num_pbp_masses[k]; i++){
    
	/* PBP mass parameters */
	
	IF_OK status += get_s(stdin, prompt,"mass", param.mass_label[npbp_masses] );
	IF_OK param.ksp_pbp[npbp_masses].mass = atof(param.mass_label[npbp_masses]);
#if ( FERM_ACTION == HISQ || FERM_ACTION == HYPISQ )
	IF_OK status += get_f(stdin, prompt,"naik_term_epsilon", 
			      &param.ksp_pbp[npbp_masses].naik_term_epsilon );
#else
	IF_OK param.ksp_pbp[npbp_masses].naik_term_epsilon = 0.0;
#endif
	/* error for staggered propagator conjugate gradient */
	IF_OK status += get_f(stdin, prompt,"error_for_propagator", 
			      &error_for_propagator );
	IF_OK status += get_f(stdin, prompt,"rel_error_for_propagator", 
			      &rel_error_for_propagator );
	
#ifdef CURRENT_DISC
	if(param.truncate_diff[k]){
	  /* error for staggered propagator conjugate gradient */
	  IF_OK status += get_f(stdin, prompt,"error_for_propagator_sloppy", 
				&error_for_propagator_sloppy );
	  IF_OK status += get_f(stdin, prompt,"rel_error_for_propagator_sloppy", 
				&rel_error_for_propagator_sloppy );
	}

	IF_OK status += get_s(stdin, prompt, "save_file", param.pbp_filenames[npbp_masses] );
#endif

	/* The set to which this pbp_mass belongs */
	IF_OK param.set[npbp_masses] = k;

	/* maximum no. of conjugate gradient iterations */
	param.qic_pbp[npbp_masses].max = max_cg_iterations;
      
	/* maximum no. of conjugate gradient restarts */
	param.qic_pbp[npbp_masses].nrestart = max_cg_restarts;
      
	/* precision */
	param.qic_pbp[npbp_masses].prec = prec_pbp;

	/* errors */
	param.qic_pbp[npbp_masses].resid = error_for_propagator;
	param.qic_pbp[npbp_masses].relresid = rel_error_for_propagator;

	param.qic_pbp[npbp_masses].parity = EVENANDODD;
	param.qic_pbp[npbp_masses].min = 0;
	param.qic_pbp[npbp_masses].start_flag = 0;
	param.qic_pbp[npbp_masses].nsrc = 1;

#ifdef CURRENT_DISC
      /* If we are taking the difference between a sloppy and a precise solve,
	 get the sloppy solve parameters */
	if(param.truncate_diff[k]){
	  
	  /* maximum no. of conjugate gradient iterations */
	  param.qic_pbp_sloppy[npbp_masses].max = max_cg_iterations_sloppy;
	  
	  /* maximum no. of conjugate gradient restarts */
	  param.qic_pbp_sloppy[npbp_masses].nrestart = max_cg_restarts_sloppy;
	  
	  /* precision */
	  param.qic_pbp_sloppy[npbp_masses].prec = prec_pbp_sloppy;
	  
	  /* errors */
	  param.qic_pbp_sloppy[npbp_masses].resid = error_for_propagator_sloppy;
	  param.qic_pbp_sloppy[npbp_masses].relresid = rel_error_for_propagator_sloppy;
	  
	  param.qic_pbp_sloppy[npbp_masses].parity = EVENANDODD;
	  param.qic_pbp_sloppy[npbp_masses].min = 0;
	  param.qic_pbp_sloppy[npbp_masses].start_flag = 0;
	  param.qic_pbp_sloppy[npbp_masses].nsrc = 1;
	  
	}
	
#endif
	
	npbp_masses++;
      }
    }
    
    /* End of input fields */
    if( status > 0)param.stopflag=1; else param.stopflag=0;
  } /* end if(this_node==0) */
Exemplo n.º 3
0
int readin(int prompt)  {
  
  /* argument "prompt" is 1 if prompts are to be given for input	*/
  
  int status,i;
  
  /* On node zero, read parameters and send to all other nodes */
  if(this_node==0){
    
    status=0;
    
    /* find out what kind of starting lattice to use */
    IF_OK status += ask_starting_lattice(stdin,  prompt, &(par_buf.startflag),
					  par_buf.startfile );
    
    /* find out what to do with lattice at end */
    IF_OK status += ask_ending_lattice(stdin,  prompt, &(par_buf.saveflag),
					par_buf.savefile );
    IF_OK status += ask_ildg_LFN(stdin,  prompt, par_buf.saveflag,
				  par_buf.stringLFN );
    
    /* Get ensemble values for NERSC archive */
    IF_OK if (par_buf.saveflag == SAVE_SERIAL_ARCHIVE)
      status += get_s(stdin,  prompt,"ensemble_id", par_buf.ensemble_id );
    IF_OK if (par_buf.saveflag == SAVE_SERIAL_ARCHIVE)
      status += get_i(stdin,  prompt,"sequence_number", 
		       &par_buf.sequence_number );
    /* Number of kappas */
    
    IF_OK status += get_i(stdin, prompt,"number_of_kappas", &par_buf.num_kap );
    if( par_buf.num_kap>MAX_KAP ){
      printf("num_kap = %d must be <= %d!\n", par_buf.num_kap, MAX_KAP);
      status++;
    }
    
    /* To be safe initialize the following to zero */
    for(i=0;i<MAX_KAP;i++){
      kap[i] = 0.0;
    }
    
    for(i=0;i<par_buf.num_kap;i++){
      IF_OK status += ask_starting_wprop(stdin, prompt, 
					 &par_buf.startflag_w[i], 
					 par_buf.startfile_w[i]);
      /* Save the string to create the FNAL file name */
      IF_OK status += get_s(stdin, prompt,"kappa", par_buf.kap_label[i] );
      IF_OK par_buf.kap[i] = atof(par_buf.kap_label[i]);
      IF_OK status += get_s(stdin, prompt,"source_label", 
			    par_buf.src_label_w[i] );       
      IF_OK status += get_f(stdin, prompt,"d1", &par_buf.d1[i] );
    }
    
    IF_OK status += get_i(stdin, prompt,"number_of_smearings", &par_buf.num_smear );
    /* We always have a point sink */
    par_buf.num_smear++;
    strcpy(par_buf.sink_label[0],"d");
    par_buf.smearfile[0][0] = '\0';

    for(i=1;i<par_buf.num_smear;i++){
      IF_OK status += get_s(stdin, prompt,"sink_label", par_buf.sink_label[i] );       
      IF_OK status += get_s(stdin, prompt,"smear_func_file", par_buf.smearfile[i]);
    }

    IF_OK status += ask_starting_ksprop (stdin, prompt, 
					 &par_buf.ks_prop_startflag,
					 par_buf.start_ks_prop_file);
    IF_OK status += get_s(stdin, prompt,"mass", 
			  par_buf.mass_label );       
    IF_OK par_buf.mass = atof(par_buf.mass_label);
    /* What file for the resulting correlators? */
    
    IF_OK status += ask_corr_file( stdin, prompt, &par_buf.saveflag_c,
				   par_buf.savefile_c);

    IF_OK status += get_i(stdin, prompt, "log_correlators", 
			  &par_buf.log_correlators);

    if( status > 0)par_buf.stopflag=1; else par_buf.stopflag=0;

  } /* end if(this_node==0) */
Exemplo n.º 4
0
/* read in parameters and coupling constants	*/
int
readin(int prompt)
{
  /* read in parameters for su3 monte carlo	*/
  /* argument "prompt" is 1 if prompts are to be given for input	*/

  int i, status, current_index;
#ifdef CHECK_INVERT
  char invert_string[16];
#endif

  /* On node zero, read parameters and send to all other nodes */
  if(this_node==0) {

    printf("\n\n");
    status=0;

    /* find out what kind of starting lattice to use */
    IF_OK status += ask_starting_lattice(stdin,  prompt, &(par_buf.startflag),
					  par_buf.startfile );

    IF_OK status += get_f(stdin, prompt,"u0", &par_buf.u0 );

    /* find out what to do with lattice at end */
    IF_OK status += ask_ending_lattice(stdin,  prompt, &(par_buf.saveflag),
					par_buf.savefile );
    IF_OK status += ask_ildg_LFN(stdin,  prompt, par_buf.saveflag,
				  par_buf.stringLFN );

    /* find out what to do with longlinks at end */
    IF_OK status += ask_ending_lattice(stdin,  prompt, &(par_buf.savelongflag),
				       par_buf.savelongfile );
    
    /* find out what to do with fatlinks at end */
    IF_OK status += ask_ending_lattice(stdin,  prompt, &(par_buf.savefatflag),
				       par_buf.savefatfile );

    /* Inversion parameters */
    IF_OK status += get_i(stdin, prompt,"number_of_masses", &par_buf.nmass );

    /* maximum no. of conjugate gradient iterations */
    IF_OK status += get_i(stdin, prompt,"max_cg_iterations", &par_buf.qic[0].max );

    /* maximum no. of conjugate gradient restarts */
    IF_OK status += get_i(stdin, prompt,"max_cg_restarts", &par_buf.qic[0].nrestart );
    
    /* find out what kind of color vector source to use */
#ifdef CHECK_INVERT
    IF_OK status += ask_color_vector( prompt, &(par_buf.srcflag[0]),
				      par_buf.srcfile[0] );
#endif
    IF_OK for(i = 0; i < par_buf.nmass; i++){
    
#ifndef CHECK_INVERT
      IF_OK status += ask_color_vector( prompt, &(par_buf.srcflag[i]),
					par_buf.srcfile[i] );
      IF_OK if(par_buf.srcflag[i] != par_buf.srcflag[0]){
	node0_printf("Must reload all or save all alike.");
	status++;
      }
#endif
      IF_OK status += get_f(stdin, prompt,"mass", &par_buf.ksp[i].mass );
#if FERM_ACTION == HISQ || FERM_ACTION == HYPISQ
      IF_OK status += get_f(stdin, prompt, "naik_term_epsilon", 
			    &par_buf.ksp[i].naik_term_epsilon);
      IF_OK {
	if(i == 0){
	  if(par_buf.ksp[i].naik_term_epsilon != 0.0){
	    node0_printf("First Naik term epsilon must be zero.");
	    status++;
	  }
	} else {
	  if(par_buf.ksp[i].naik_term_epsilon > par_buf.ksp[i-1].naik_term_epsilon){
	    node0_printf("Naik term epsilons must be in descending order.");
	    status++;
	  }
	}
      }

#else
      par_buf.ksp[i].naik_term_epsilon = 0.0;
#endif

      par_buf.qic[i].min = 0;
      par_buf.qic[i].start_flag = 0;
      par_buf.qic[i].nsrc = 1;
      par_buf.qic[i].max = par_buf.qic[0].max;
      par_buf.qic[i].nrestart = par_buf.qic[0].nrestart;
      par_buf.qic[i].prec = PRECISION;
      par_buf.qic[i].parity = EVENANDODD;
      /* error for propagator conjugate gradient */
      IF_OK status += get_f(stdin, prompt, "error_for_propagator", 
			    &par_buf.qic[i].resid);
      IF_OK status += get_f(stdin, prompt, "rel_error_for_propagator", 
			    &par_buf.qic[i].relresid );
#ifdef CHECK_INVERT
      /* find out what kind of color vector result to use */
      IF_OK status += ask_color_vector( prompt, &(par_buf.ansflag[i]),
					par_buf.ansfile[i] );
      IF_OK if(par_buf.ansflag[i] != par_buf.ansflag[0]){
	node0_printf("Must reload all or save all alike.");
	status++;
      }
#endif
    }
#ifndef CHECK_INVERT
    /* find out what kind of color matrix momentum to use */
    IF_OK status += ask_color_matrix( prompt, &(par_buf.ansflag[0]),
				      par_buf.ansfile[0] );
#endif


#ifdef CHECK_INVERT
    /* find out which inversion to check */
    IF_OK status += get_s(stdin,  prompt, "invert", invert_string);
    if(status == 0){
      if(strcmp(invert_string,"M")==0)
	par_buf.inverttype = INVERT_M;
      else if(strcmp(invert_string,"MdaggerM")==0)
	par_buf.inverttype = INVERT_MdaggerM;
      else{
	printf("Unrecognized invert string %s\n",invert_string);
	status++;
      }
    }
#endif

    if( status > 0)par_buf.stopflag=1; else par_buf.stopflag=0;
  } /* end if(this_node==0) */
Exemplo n.º 5
0
/* read in parameters and coupling constants	*/
int
readin(int prompt)
{
  /* read in parameters for su3 monte carlo	*/
  /* argument "prompt" is 1 if prompts are to be given for input	*/
  
  int status;
  Real x;
  int i;
#ifdef SPECTRUM
  char request_buf[MAX_SPECTRUM_REQUEST];
#endif
  
  /* On node zero, read parameters and send to all other nodes */
  if(this_node==0) {
    
    printf("\n\n");
    status=0;
    
    /* warms, trajecs */
    IF_OK status += get_i(stdin, prompt,"warms", &par_buf.warms );
    IF_OK status += get_i(stdin, prompt,"trajecs", &par_buf.trajecs );
    
    /* trajectories between propagator measurements */
    IF_OK status += 
      get_i(stdin, prompt,"traj_between_meas", &par_buf.propinterval );
    
    /* microcanonical time step */
    IF_OK status += 
      get_f(stdin, prompt,"microcanonical_time_step", &par_buf.epsilon );
    
    /*microcanonical steps per trajectory */
    IF_OK status += get_i(stdin, prompt,"steps_per_trajectory", &par_buf.steps );
    
    /* Data for each pseudofermion */

    for(i = 0; i < par_buf.n_pseudo; i++){
      Real tmp[3]; int itmp[3];

      /* Residuals for multicg solves */
      IF_OK status += get_vf(stdin, prompt,"cgresid_md_fa_gr", tmp, 3 );
      /* rsqmin is r**2 in conjugate gradient */
      IF_OK {
	par_buf.rsqmin_md[i] = tmp[0]*tmp[0];
	par_buf.rsqmin_fa[i] = tmp[1]*tmp[1];
	par_buf.rsqmin_gr[i] = tmp[2]*tmp[2];
      }

      /* Max CG iterations for multicg solves */
      IF_OK status += get_vi(stdin, prompt, "max_multicg_md_fa_gr", itmp, 3);
      IF_OK {
	par_buf.niter_md[i] = itmp[0];
	par_buf.niter_fa[i] = itmp[1];
	par_buf.niter_gr[i] = itmp[2];
      }

      /* Precision for multicg solves */
      IF_OK status += get_vi(stdin, prompt, "cgprec_md_fa_gr", itmp, 3);
      IF_OK {
	par_buf.prec_md[i] = itmp[0];
	par_buf.prec_fa[i] = itmp[1];
	par_buf.prec_gr[i] = itmp[2];
      }
    }

    /* Precision for fermion force calculation */
    IF_OK status = get_i(stdin, prompt, "prec_ff", &par_buf.prec_ff);

    /* error for propagator conjugate gradient */
    IF_OK status += get_f(stdin, prompt,"error_for_propagator", &x );
    IF_OK par_buf.rsqprop = x*x;
    
    /* maximum no. of conjugate gradient iterations for propagator
       etc. and maximum no. of restarts */
    IF_OK status += get_i(stdin, prompt,"max_cg_prop", &par_buf.niter );
    IF_OK status += get_i(stdin, prompt,"max_cg_prop_restarts", 
			  &par_buf.nrestart );
    
#ifdef NPBP_REPS
    /* number of random sources npbp_reps and precision for inversions */
    IF_OK status += get_i(stdin, prompt,"npbp_reps", &par_buf.npbp_reps_in );
    IF_OK status += get_i(stdin, prompt,"prec_pbp", &par_buf.prec_pbp );
#endif
    
#ifdef SPECTRUM
    /* request list for spectral measurments */
    /* prepend and append a comma for ease in parsing */
    IF_OK status += get_s(stdin, prompt,"spectrum_request", request_buf );
    IF_OK strcpy(par_buf.spectrum_request,",");
    IF_OK strcat(par_buf.spectrum_request,request_buf);
    IF_OK strcat(par_buf.spectrum_request,",");
    
    /* source time slice and increment */
    IF_OK status += get_i(stdin, prompt,"source_start", &par_buf.source_start );
    IF_OK status += get_i(stdin, prompt,"source_inc", &par_buf.source_inc );
    IF_OK status += get_i(stdin, prompt,"n_sources", &par_buf.n_sources );
    
    /* Additional parameters for spectrum_multimom */
    if(strstr(par_buf.spectrum_request,",spectrum_multimom,") != NULL){
      IF_OK status += get_i(stdin, prompt,"spectrum_multimom_nmasses",
			    &par_buf.spectrum_multimom_nmasses );
      IF_OK status += get_f(stdin, prompt,"spectrum_multimom_low_mass",
			    &par_buf.spectrum_multimom_low_mass );
      IF_OK status += get_f(stdin, prompt,"spectrum_multimom_mass_step",
			    &par_buf.spectrum_multimom_mass_step );
    }
    /* Additional parameters for fpi */
    par_buf.fpi_nmasses = 0;
    if(strstr(par_buf.spectrum_request,",fpi,") != NULL){
      IF_OK status += get_i(stdin, prompt,"fpi_nmasses",
			    &par_buf.fpi_nmasses );
      if(par_buf.fpi_nmasses > MAX_FPI_NMASSES){
	printf("Maximum of %d exceeded.\n",MAX_FPI_NMASSES);
	terminate(1);
      }
      for(i = 0; i < par_buf.fpi_nmasses; i++){
	IF_OK status += get_f(stdin, prompt,"fpi_mass",
			      &par_buf.fpi_mass[i]);
      }
    }
    
#endif /*SPECTRUM*/

    /* find out what kind of starting lattice to use */
    IF_OK status += ask_starting_lattice(stdin,  prompt, &(par_buf.startflag),
					  par_buf.startfile );
    
    /* find out what to do with lattice at end */
    IF_OK status += ask_ending_lattice(stdin,  prompt, &(par_buf.saveflag),
					par_buf.savefile );
    IF_OK status += ask_ildg_LFN(stdin,  prompt, par_buf.saveflag,
				  par_buf.stringLFN );
    
    if( status > 0)par_buf.stopflag=1; else par_buf.stopflag=0;
  } /* end if(this_node==0) */
Exemplo n.º 6
0
/* read in parameters and coupling constants	*/
int readin(int prompt) {
/* read in parameters for su3 monte carlo	*/
/* argument "prompt" is 1 if prompts are to be given for input	*/

     int status;
     Real x;

    /* On node zero, read parameters and send to all other nodes */
    if(this_node==0){

	printf("\n\n");
	status=0;
    
	/* get couplings and broadcast to nodes	*/
	/* beta, mass */
	IF_OK status += get_f(stdin, prompt,"mass", &par_buf.mass );
	IF_OK status += get_f(stdin, prompt,"u0", &par_buf.u0 );

	/* maximum no. of conjugate gradient iterations */
	IF_OK status += get_i(stdin, prompt,"max_cg_iterations", &par_buf.niter );
	/* maximum no. of conjugate gradient restarts */
	IF_OK status += get_i(stdin, prompt,"max_cg_restarts", &par_buf.nrestart );
    
	/* error per site for conjugate gradient */
	IF_OK status += get_f(stdin, prompt,"error_per_site", &x );
	IF_OK par_buf.rsqmin = x*x;   /* rsqmin is r**2 in conjugate gradient */
	    /* New conjugate gradient normalizes rsqmin by norm of source */
    
	/* error for propagator conjugate gradient */
	IF_OK status += get_f(stdin, prompt,"error_for_propagator", &x );
	IF_OK par_buf.rsqprop = x*x;
	IF_OK status += get_i(stdin, prompt,"Number_of_eigenvals", &par_buf.Nvecs );
	IF_OK status += get_i(stdin, prompt,"Max_Rayleigh_iters", &par_buf.MaxIter );
	IF_OK status += get_i(stdin, prompt,"Restart_Rayleigh", &par_buf.Restart );
	IF_OK status += get_i(stdin, prompt,"Kalkreuter_iters", &par_buf.Kiters );
	IF_OK status += get_f(stdin, prompt,"eigenval_tolerance", 
			      &par_buf.eigenval_tol );
	IF_OK status += get_f(stdin, prompt,"error_decrease", &par_buf.error_decr);

        /* find out what kind of starting lattice to use */
	IF_OK status += ask_starting_lattice(stdin,  prompt, &(par_buf.startflag),
	    par_buf.startfile );

	if( status > 0)par_buf.stopflag=1; else par_buf.stopflag=0;
    } /* end if(this_node==0) */

    /* Node 0 broadcasts parameter buffer to all other nodes */
    broadcast_bytes((char *)&par_buf,sizeof(par_buf));

    if( par_buf.stopflag != 0 )return par_buf.stopflag;

    niter = par_buf.niter;
    nrestart = par_buf.nrestart;
    rsqmin = par_buf.rsqmin;
    rsqprop = par_buf.rsqprop;
    mass = par_buf.mass;
    u0 = par_buf.u0;
    Nvecs = par_buf.Nvecs ;
    MaxIter = par_buf.MaxIter ;
    Restart = par_buf.Restart ;
    Kiters = par_buf.Kiters ;
    eigenval_tol = par_buf.eigenval_tol ;
    error_decr = par_buf.error_decr ;
    startflag = par_buf.startflag;
    strcpy(startfile,par_buf.startfile);

#if ( FERM_ACTION == HISQ || FERM_ACTION == HYPISQ )
    n_naiks = 1;
    eps_naik[0] = 0.0;
#endif

    /* Do whatever is needed to get lattice */
    if( startflag == CONTINUE ){
        rephase( OFF );
    }
    if( startflag != CONTINUE )
      startlat_p = reload_lattice( startflag, startfile );
    /* if a lattice was read in, put in KS phases and AP boundary condition */
    phases_in = OFF;
    rephase( ON );

  /* Set uptions for fermion links */
    
#ifdef DBLSTORE_FN
    /* We want to double-store the links for optimization */
    fermion_links_want_back(1);
#endif
    
#if ( FERM_ACTION == HISQ || FERM_ACTION == HYPISQ )
    fn_links = create_fermion_links_from_site(PRECISION, n_naiks, eps_naik);
#else
    fn_links = create_fermion_links_from_site(PRECISION, 0, NULL);
#endif
    
//    node0_printf("Calling for path table\n");fflush(stdout);
//    /* make table of coefficients and permutations of paths in quark action */
//    init_path_table(fn_links.ap);
//    make_path_table(fn_links.ap, NULL);
//    node0_printf("Done with path table\n");fflush(stdout);

    return(0);
}
Exemplo n.º 7
0
/* read in parameters and coupling constants	*/
int readin(int prompt) {
  /* read in parameters for su3 monte carlo	*/
  /* argument "prompt" is 1 if prompts are to be given for input	*/
  
  int status;
  char savebuf[128];
  int i,k,nprop;
  int ipair, itriplet;
#ifdef PRTIME
  double dtime;
#endif

  STARTTIME;

  /* On node zero, read parameters and send to all other nodes */
  if(this_node==0){
    
    printf("\n\n");
    status=0;

    /*------------------------------------------------------------*/
    /* Gauge configuration section                                */
    /*------------------------------------------------------------*/

    IF_OK status += ask_starting_lattice(stdin,  prompt, &param.startflag,
	param.startfile );
    IF_OK status += get_f(stdin, prompt,"u0", &param.u0 );

    IF_OK if (prompt==1) 
      printf("enter 'no_gauge_fix', or 'coulomb_gauge_fix'\n");
    IF_OK scanf("%s",savebuf);
    IF_OK printf("%s\n",savebuf);
    IF_OK {
      if(strcmp("coulomb_gauge_fix",savebuf) == 0 ){
	param.fixflag = COULOMB_GAUGE_FIX;
      }
      else if(strcmp("no_gauge_fix",savebuf) == 0 ) {
	param.fixflag = NO_GAUGE_FIX;
      }
      else{
	printf("error in input: fixing_command %s is invalid\n",savebuf); status++;
      }
    }
    
    /* find out what to do with lattice at end */
    IF_OK status += ask_ending_lattice(stdin,  prompt, &(param.saveflag),
			     param.savefile );
    IF_OK status += ask_ildg_LFN(stdin,  prompt, param.saveflag,
				  param.stringLFN );
#ifdef U1_FIELD
    /* what kind of starting U(1) lattice to use, read filename */
    IF_OK status+=ask_starting_u1_lattice(stdin,prompt,
					  &param.start_u1flag, param.start_u1file );
    IF_OK status+=ask_ending_u1_lattice(stdin,prompt,
					&param.save_u1flag, param.save_u1file );
#endif
    /* Provision is made to build covariant sources from smeared
       links */
    /* APE smearing parameters (if needed) */
    /* Zero suppresses APE smearing */
    IF_OK status += get_f(stdin, prompt, "staple_weight", 
			  &param.staple_weight);
    IF_OK status += get_i(stdin, prompt, "ape_iter",
			  &param.ape_iter);

    /* Coordinate origin for KS phases and antiperiodic boundary condition */
    IF_OK status += get_vi(stdin, prompt, "coordinate_origin", param.coord_origin, 4);
    
    /*------------------------------------------------------------*/
    /* Chiral condensate and related quantities                   */
    /*------------------------------------------------------------*/

    IF_OK status += get_i(stdin, prompt, "number_of_pbp_masses",
			  &param.num_pbp_masses);
    if(param.num_pbp_masses > MAX_MASS_PBP){
      printf("Number of masses exceeds dimension %d\n",MAX_MASS_PBP);
      status++;
    }
    IF_OK if(param.num_pbp_masses > 0){
      IF_OK status += get_i(stdin, prompt, "max_cg_iterations",
			    &param.qic_pbp[0].max);
      IF_OK status += get_i(stdin, prompt, "max_cg_restarts",
			    &param.qic_pbp[0].nrestart);
      IF_OK status += get_i(stdin, prompt, "npbp_reps", &param.npbp_reps );
      IF_OK status += get_i(stdin, prompt, "prec_pbp", &param.qic_pbp[0].prec);
      IF_OK for(i = 0; i < param.num_pbp_masses; i++){
	IF_OK status += get_f(stdin, prompt, "mass", &param.ksp_pbp[i].mass);
#if ( FERM_ACTION == HISQ || FERM_ACTION == HYPISQ )
	IF_OK status += get_f(stdin, prompt, "naik_term_epsilon", 
			      &param.ksp_pbp[i].naik_term_epsilon);
#else
	param.ksp_pbp[i].naik_term_epsilon = 0.0;
#endif
#ifdef U1_FIELD
	IF_OK status += get_f(stdin, prompt, "charge", &param.charge_pbp[i]);
#endif
	param.qic_pbp[i].min = 0;
	param.qic_pbp[i].start_flag = 0;
	param.qic_pbp[i].nsrc = 1;
	param.qic_pbp[i].max = param.qic_pbp[0].max;
	param.qic_pbp[i].nrestart = param.qic_pbp[0].nrestart;
	param.qic_pbp[i].prec = param.qic_pbp[0].prec;
	IF_OK status += get_f(stdin, prompt, "error_for_propagator", &param.qic_pbp[i].resid);
	IF_OK status += get_f(stdin, prompt, "rel_error_for_propagator", &param.qic_pbp[i].relresid );
      }
    }
Exemplo n.º 8
0
/* read in parameters and coupling constants	*/
int readin(int prompt) {
    /* read in parameters for su3 monte carlo	*/
    /* argument "prompt" is 1 if prompts are to be given for input	*/

    int status;
    Real x;

    /* On node zero, read parameters and send to all other nodes */
    if(this_node==0) {

        printf("\n\n");
        status=0;

        /* warms, trajecs */
        IF_OK status += get_i(stdin, prompt,"warms", &par_buf.warms );
        IF_OK status += get_i(stdin, prompt,"trajecs", &par_buf.trajecs );

        /* trajectories between propagator measurements */
        IF_OK status +=
            get_i(stdin, prompt,"traj_between_meas", &par_buf.propinterval );

        /* get couplings and broadcast to nodes	*/
        /* beta, kappa */
        IF_OK status += get_f(stdin, prompt,"beta", &par_buf.beta );
        IF_OK status += get_f(stdin, prompt,"kappa", &par_buf.kappa );

        /* microcanonical time step */
        IF_OK status +=
            get_f(stdin, prompt,"microcanonical_time_step", &par_buf.epsilon );

        /*microcanonical steps per trajectory */
        IF_OK status += get_i(stdin, prompt,"steps_per_trajectory", &par_buf.steps );

        /* maximum no. of conjugate gradient iterations */
        IF_OK status += get_i(stdin, prompt,"max_cg_iterations", &par_buf.niter);

        /* error per site for conjugate gradient */
        IF_OK status += get_f(stdin, prompt,"error_per_site", &x );
        IF_OK par_buf.rsqmin = x*x;   /* rsqmin is r**2 in conjugate gradient */

        /* error for propagator conjugate gradient */
        IF_OK status += get_f(stdin, prompt,"error_for_propagator", &x );
        IF_OK par_buf.rsqprop = x*x;


        /* find out what kind of starting lattice to use */
        IF_OK status += ask_starting_lattice(stdin,  prompt, &(par_buf.startflag),
                                             par_buf.startfile );

        /* find out what to do with lattice at end */
        IF_OK status += ask_ending_lattice(stdin,  prompt, &(par_buf.saveflag),
                                           par_buf.savefile );
        IF_OK status += ask_ildg_LFN(stdin,  prompt, par_buf.saveflag,
                                     par_buf.stringLFN );

        /* send parameter structure */
        if( status > 0)par_buf.stopflag=1;
        else par_buf.stopflag=0;
    } /* end if(this_node==0) */

    /* Node 0 broadcasts parameter buffer to all other nodes */
    broadcast_bytes((char *)&par_buf,sizeof(par_buf));

    if( par_buf.stopflag != 0 )
        normal_exit(0);

    warms = par_buf.warms;
    trajecs = par_buf.trajecs;
    steps = par_buf.steps;
    propinterval = par_buf.propinterval;
    startflag = par_buf.startflag;
    saveflag = par_buf.saveflag;
    niter = par_buf.niter;
    rsqmin = par_buf.rsqmin;
    rsqprop = par_buf.rsqprop;
    epsilon = par_buf.epsilon;
    beta = par_buf.beta;
    kappa = par_buf.kappa;
    strcpy(startfile,par_buf.startfile);
    strcpy(savefile,par_buf.savefile);
    strcpy(stringLFN, par_buf.stringLFN);

    /* Do whatever is needed to get lattice */
    if( startflag != CONTINUE )
        startlat_p = reload_lattice( startflag, startfile );

    return(0);
}
Exemplo n.º 9
0
/* read in parameters and coupling constants	*/
int readin(int prompt) {
  /* read in parameters for su3 monte carlo	*/
  /* argument "prompt" is 1 if prompts are to be given for input	*/

  int status;
  char savebuf[128];
  int i;
  int ipair;
  int max_cg_iterations, max_cg_restarts;
  Real bdry_phase[4];
#ifdef PRTIME
  double dtime;
#endif

  STARTTIME;

  /* On node zero, read parameters and send to all other nodes */
  if(this_node==0){
    
    printf("\n\n");
    status=0;

    /*------------------------------------------------------------*/
    /* Gauge configuration section                                */
    /*------------------------------------------------------------*/

    IF_OK status += ask_starting_lattice(stdin,  prompt, &param.startflag,
	param.startfile );
    IF_OK status += get_f(stdin, prompt,"u0", &param.u0 );

    IF_OK if (prompt==1) 
      printf("enter 'no_gauge_fix', or 'coulomb_gauge_fix'\n");
    IF_OK scanf("%s",savebuf);
    IF_OK printf("%s\n",savebuf);
    IF_OK {
      if(strcmp("coulomb_gauge_fix",savebuf) == 0 ){
	param.fixflag = COULOMB_GAUGE_FIX;
      }
      else if(strcmp("no_gauge_fix",savebuf) == 0 ) {
	param.fixflag = NO_GAUGE_FIX;
      }
      else{
	printf("error in input: fixing_command %s is invalid\n",savebuf); status++;
      }
    }
    
    /* find out what to do with lattice at end */
    IF_OK status += ask_ending_lattice(stdin,  prompt, &(param.saveflag),
			     param.savefile );
    IF_OK status += ask_ildg_LFN(stdin,  prompt, param.saveflag,
				  param.stringLFN );

    /* APE smearing parameters (if needed) */
    /* Zero suppresses APE smearing */
    IF_OK status += get_f(stdin, prompt, "staple_weight", 
			  &param.staple_weight);
    IF_OK status += get_i(stdin, prompt, "ape_iter",
			  &param.ape_iter);

    /* Coordinate origin for KS phases and antiperiodic boundary condition */
    IF_OK status += get_vi(stdin, prompt, "coordinate_origin", param.coord_origin, 4);
    
    /*------------------------------------------------------------*/
    /* Propagator inversion control                               */
    /*------------------------------------------------------------*/

    /* maximum no. of conjugate gradient iterations */
    IF_OK status += get_i(stdin,prompt,"max_cg_iterations", 
			  &max_cg_iterations );
    
    /* maximum no. of conjugate gradient restarts */
    IF_OK status += get_i(stdin,prompt,"max_cg_restarts", 
			  &max_cg_restarts );
    
    /*------------------------------------------------------------*/
    /* Base sources                                               */
    /*------------------------------------------------------------*/

    IF_OK status += get_i(stdin,prompt,"number_of_base_sources", 
			  &param.num_base_source);
    IF_OK {
      if(param.num_base_source > MAX_SOURCE){
	printf("Exceeded dimension %d\n",MAX_SOURCE);
	status++;
      }
    }

    for(i = 0; i < param.num_base_source; i++){
      
      IF_OK init_qs(&param.base_src_qs[i]);
      IF_OK status += get_wv_quark_source( stdin, prompt, 
					   &param.base_src_qs[i]);
      /* Base sources have no parents or ops */
      IF_OK param.parent_source[i] = BASE_SOURCE_PARENT;
      IF_OK init_qss_op(&param.src_qs_op[i]);
      IF_OK set_qss_op_offset(&param.src_qs_op[i], param.coord_origin);

      /* Get optional file for saving the base source */
      IF_OK {
	int source_type, saveflag_s;
	char descrp[MAXDESCRP];
	char savefile_s[MAXFILENAME];
	status += 
	  ask_output_quark_source_file( stdin, prompt, &saveflag_s,
					&source_type, NULL, descrp,
					savefile_s );
	IF_OK {
	  param.base_src_qs[i].savetype = source_type;
	  param.base_src_qs[i].saveflag = saveflag_s;
	  strcpy(param.base_src_qs[i].save_file, savefile_s);
	  if(saveflag_s != FORGET && source_type != DIRAC_FIELD_FILE
	     && source_type != VECTOR_FIELD_FILE){
	    printf("Unsupported output source type\n");
	    status++;
	  }
	} /* OK */
      } /* OK */
    }

    /*------------------------------------------------------------*/
    /* Modified sources                                           */
    /*------------------------------------------------------------*/

    IF_OK status += get_i(stdin,prompt,"number_of_modified_sources", 
			  &param.num_modified_source);

    IF_OK {
      if(param.num_base_source + param.num_modified_source > MAX_SOURCE){
	printf("Total including base sources exceeds dimension %d\n",
	       MAX_SOURCE);
	status++;
      }
    }

    for(i = 0; i < param.num_modified_source; i++){
      /* We append the modified sources to the list of base sources */
      int is = param.num_base_source + i;
      
      IF_OK status += get_i(stdin,prompt,"source", &param.parent_source[is]);
      
      IF_OK {
	if( param.parent_source[is] >= is){
	  printf("Source index must be less than %d here\n",is);
	  status++;
	}
      }

      IF_OK init_qss_op(&param.src_qs_op[is]);
      set_qss_op_offset(&param.src_qs_op[is], param.coord_origin);

      /* Get source operator attributes */
      IF_OK status += get_wv_field_op( stdin, prompt, &param.src_qs_op[is]);

      /* Copy parent source attributes to the derived source structure */
      IF_OK {
	int p = param.parent_source[is];
	param.base_src_qs[is] = param.base_src_qs[p];
	param.base_src_qs[is].op = copy_qss_op_list(param.base_src_qs[p].op);
	
	/* Add the new operator to the linked list */
	insert_qss_op(&param.base_src_qs[is], &param.src_qs_op[is]);
	
	/* Append the operator info to the description if the operator
	   is nontrivial, but simply copy the label */
	if(param.src_qs_op[is].type != IDENTITY){
	  char *descrp = param.base_src_qs[is].descrp;
	  char *op_descrp = param.src_qs_op[is].descrp;
	  char *label = param.base_src_qs[is].label;
	  char *op_label = param.src_qs_op[is].label;
	  strncat(descrp, "/", MAXDESCRP-strlen(descrp)-1);
	  strncat(descrp, op_descrp, MAXDESCRP-strlen(descrp)-1);
	  strncpy(label,  op_label, MAXSRCLABEL-strlen(label)-1);
	}
      }

      /* Get optional file for saving the modified source */
      IF_OK {
	int source_type, saveflag_s;
	char descrp[MAXDESCRP];
	char savefile_s[MAXFILENAME];
	status += 
	  ask_output_quark_source_file( stdin, prompt, &saveflag_s,
					&source_type, NULL, descrp,
					savefile_s );
	IF_OK {
	    param.base_src_qs[is].savetype = source_type;
	    param.base_src_qs[is].saveflag = saveflag_s;
	    strcpy(param.base_src_qs[is].save_file, savefile_s);
	  if(saveflag_s != FORGET && source_type != DIRAC_FIELD_FILE &&
	     source_type != VECTOR_FIELD_FILE){
	    printf("Unsupported output source type\n");
	    status++;
	  }
	} /* OK */
      } /* OK */
    }
	
    /*------------------------------------------------------------*/
    /* Propagators and their sources                              */
    /*------------------------------------------------------------*/

    /* Number of propagators */
    IF_OK status += get_i(stdin,prompt,"number_of_propagators", 
			  &param.num_prop );
    if( param.num_prop>MAX_PROP ){
      printf("num_prop = %d must be <= %d!\n", param.num_prop, MAX_PROP);
      status++;
    }
    
    /* Get propagator parameters */

    IF_OK for(i = 0; i < param.num_prop; i++){
      
      /* Initialize dependency */
      param.prop_dep_qkno[i] = 0;

      /* Type of propagator */

      IF_OK status += get_s(stdin, prompt,"propagator_type", savebuf );
      IF_OK {
	/* Standard clover */
	if(strcmp(savebuf,"clover") == 0)param.prop_type[i] = CLOVER_TYPE;
	/* Standard staggered (asqtad or HISQ) to be converted to naive */
	else if(strcmp(savebuf,"KS") == 0)param.prop_type[i] = KS_TYPE;
	/* Same as standard staggered, but conversion to naive is based on hypercube offset 0 */
	else if(strcmp(savebuf,"KS0") == 0)param.prop_type[i] = KS0_TYPE;
	/* Staggered propagator originating from an extended Dirac source */
	else if(strcmp(savebuf,"KS4") == 0)param.prop_type[i] = KS4_TYPE;
	/* Improved fermion lattice action (OK action) */
	else if(strcmp(savebuf,"ifla") == 0 )param.prop_type[i] = IFLA_TYPE;
	else {
	  printf("Unknown quark type %s\n",savebuf);
	  status++;
	}
      }

      /* Mass parameters, etc */

      if(param.prop_type[i] == CLOVER_TYPE){

	IF_OK status += get_s(stdin, prompt,"kappa", param.kappa_label[i]);
	IF_OK param.dcp[i].Kappa = atof(param.kappa_label[i]);
	IF_OK status += get_f(stdin, prompt,"clov_c", &param.dcp[i].Clov_c );
	param.dcp[i].U0 = param.u0;

      } else if(param.prop_type[i] == IFLA_TYPE) { 

	printf("Ifla Type Fermion\n");
#ifndef HAVE_QOP
	printf("Compilation with the QOP package is required for this fermion type\n");
	terminate(1);
#endif
	
	IF_OK status += get_s(stdin,prompt,"kapifla",param.kappa_label[i]);
	IF_OK param.nap[i].kapifla = atof(param.kappa_label[i]);
	IF_OK status += get_f(stdin, prompt, "kappa_s", &param.nap[i].kappa_s);
	IF_OK status += get_f(stdin, prompt, "kappa_t", &param.nap[i].kappa_t);
	IF_OK status += get_f(stdin, prompt, "r_s",     &param.nap[i].r_s);
	IF_OK status += get_f(stdin, prompt, "r_t",     &param.nap[i].r_t);
	IF_OK status += get_f(stdin, prompt, "zeta",    &param.nap[i].zeta);
	IF_OK status += get_f(stdin, prompt, "c_E",     &param.nap[i].c_E);
	IF_OK status += get_f(stdin, prompt, "c_B",     &param.nap[i].c_B);
	IF_OK status += get_f(stdin, prompt, "c_1",     &param.nap[i].c_1);
	IF_OK status += get_f(stdin, prompt, "c_2",     &param.nap[i].c_2);
	IF_OK status += get_f(stdin, prompt, "c_3",     &param.nap[i].c_3);
	IF_OK status += get_f(stdin, prompt, "c_4",     &param.nap[i].c_4);
	IF_OK status += get_f(stdin, prompt, "c_5",     &param.nap[i].c_5);
	IF_OK status += get_f(stdin, prompt, "c_EE",    &param.nap[i].c_EE);
	param.nap[i].u0 = param.u0;
	
      } else {  /* KS_TYPE || KS0_TYPE || KS4_TYPE */
	
	IF_OK status += get_s(stdin, prompt,"mass", param.mass_label[i] );
	IF_OK param.ksp[i].mass = atof(param.mass_label[i]);
#if FERM_ACTION == HISQ
	IF_OK status += get_f(stdin, prompt, "naik_term_epsilon", 
			      &param.ksp[i].naik_term_epsilon);
#else
	IF_OK param.ksp[i].naik_term_epsilon = 0.0;
#endif
      }

      /* Should we solve for the propagator? */
      IF_OK status += get_s(stdin, prompt,"check", savebuf);
      IF_OK {
	/* Should we be checking the propagator by running the solver? */
	if(strcmp(savebuf,"no") == 0)param.check[i] = CHECK_NO;
	else if(strcmp(savebuf,"yes") == 0)
	  param.check[i] = CHECK_YES;
	else if(strcmp(savebuf,"sourceonly") == 0)
	  param.check[i] = CHECK_SOURCE_ONLY;
	else{
	  printf("Unrecognized 'check' option. Wanted 'no', 'yes', or 'sourceonly'\n");
	  status++;
	}
      }

      /* Error for propagator conjugate gradient or bicg */
      
      IF_OK status += get_f(stdin, prompt,"error_for_propagator", 
			    &param.qic[i].resid );
      IF_OK status += get_f(stdin, prompt,"rel_error_for_propagator", 
			    &param.qic[i].relresid );
      IF_OK status += get_i(stdin, prompt,"precision", &param.qic[i].prec );
#if ! defined(HAVE_QOP) && ! defined(USE_CG_GPU)
      if(param.qic[i].prec != PRECISION){
	node0_printf("WARNING: Compiled precision %d overrides request\n",PRECISION);
	node0_printf("QOP or CG_GPU compilation is required for mixed precision\n");
	param.qic[i].prec = PRECISION;
      }
#endif
      param.qic[i].max = max_cg_iterations;
      param.qic[i].nrestart = max_cg_restarts;
      param.qic[i].parity = EVENANDODD;
      param.qic[i].min = 0;
      param.qic[i].start_flag = 0;
      param.qic[i].nsrc = 1;
      
      /* Momentum twist and time boundary condition */

      IF_OK status += get_vf(stdin, prompt, "momentum_twist",
			     bdry_phase, 3);
      
      IF_OK status += get_s(stdin, prompt,"time_bc", savebuf);

      if(param.prop_type[i] == CLOVER_TYPE || param.prop_type[i] == IFLA_TYPE){

	/* NOTE: The Dirac built-in bc is periodic. */
	IF_OK {
	  if(strcmp(savebuf,"antiperiodic") == 0)bdry_phase[3] = 1;
	  else if(strcmp(savebuf,"periodic") == 0)bdry_phase[3] = 0;
	  else{
	    node0_printf("Expecting 'periodic' or 'antiperiodic' but found %s\n",
			 savebuf);
	    status++;
	  }
	}

      } else {  /* KS_TYPE || KS0_TYPE || KS4_TYPE */
Exemplo n.º 10
0
/* read in parameters and coupling constants	*/
int readin(int prompt) {
/* read in parameters for U1 monte carlo	*/
/* argument "prompt" is 1 if prompts are to be given for input	*/
    complex *temp_field; 
    complex *temp_link;
    register int dir, j;
    register site *s;
    int status;
    Real x;

    /* On node zero, read parameters and send to all other nodes */
    if(this_node==0){

	printf("\n\n");
	status=0;
    
	/* get couplings and broadcast to nodes	*/
	/* beta, mass */
	IF_OK status += get_f(stdin, prompt,"mass", &par_buf.mass );
	IF_OK status += get_f(stdin, prompt,"u0_s", &par_buf.u0_s );
	IF_OK status += get_f(stdin, prompt,"u0_t", &par_buf.u0_t );

	IF_OK status += get_f(stdin, prompt,"v_Fermi", &par_buf.v_Fermi);
	printf("par_buf.v_Fermi = %f\n", par_buf.v_Fermi);
	/* maximum no. of conjugate gradient iterations */
	IF_OK status += get_i(stdin, prompt,"max_cg_iterations", &par_buf.niter );
	/* maximum no. of conjugate gradient restarts */
	IF_OK status += get_i(stdin, prompt,"max_cg_restarts", &par_buf.nrestart );
    
	/* error per site for conjugate gradient */
	IF_OK status += get_f(stdin, prompt,"error_per_site", &x );
	IF_OK par_buf.rsqmin = x*x;   /* rsqmin is r**2 in conjugate gradient */
	    /* New conjugate gradient normalizes rsqmin by norm of source */
    
	/* error for propagator conjugate gradient */
	IF_OK status += get_f(stdin, prompt,"error_for_propagator", &x );
	IF_OK par_buf.rsqprop = x*x;
	IF_OK status += get_i(stdin, prompt,"Number_of_eigenvals", &par_buf.Nvecs );
	IF_OK status += get_i(stdin, prompt,"Max_Rayleigh_iters", &par_buf.MaxIter );
	IF_OK status += get_i(stdin, prompt,"Restart_Rayleigh", &par_buf.Restart );
	IF_OK status += get_i(stdin, prompt,"Kalkreuter_iters", &par_buf.Kiters );
	IF_OK status += get_f(stdin, prompt,"eigenval_tolerance", 
			      &par_buf.eigenval_tol );
	IF_OK status += get_f(stdin, prompt,"error_decrease", &par_buf.error_decr);

        /* find out what kind of starting lattice to use */
	IF_OK status += ask_starting_lattice(stdin,  prompt, &(par_buf.startflag),
	    par_buf.startfile );

	if( status > 0)par_buf.stopflag=1; else par_buf.stopflag=0;
    } /* end if(this_node==0) */

    /* Node 0 broadcasts parameter buffer to all other nodes */
    broadcast_bytes((char *)&par_buf,sizeof(par_buf));

    if( par_buf.stopflag != 0 )return par_buf.stopflag;

    niter = par_buf.niter;
    nrestart = par_buf.nrestart;
    rsqmin = par_buf.rsqmin;
    rsqprop = par_buf.rsqprop;
    mass = par_buf.mass;
    u0_s = par_buf.u0_s;
    u0_t = par_buf.u0_t;
    v_Fermi = par_buf.v_Fermi;
    Nvecs = par_buf.Nvecs ;
    MaxIter = par_buf.MaxIter ;
    Restart = par_buf.Restart ;
    Kiters = par_buf.Kiters ;
    eigenval_tol = par_buf.eigenval_tol ;
    error_decr = par_buf.error_decr ;
    startflag = par_buf.startflag;
    strcpy(startfile,par_buf.startfile);

    /* Do whatever is needed to get lattice */
    if( startflag == CONTINUE ){
        rephase( OFF );
    }
    if( startflag != CONTINUE ) {
      if(startflag == FRESH ) {
	coldlat_u1();
	//funnylat_u1(); /*testing SciDAC routines and eigenvalues*/
      }
      else {
	temp_field = (complex *)malloc(sites_on_node*4*sizeof(complex));
	if(temp_field == NULL) {
	  printf("Malloc failed to create temp_field in setup\n");
	  exit(1);
	}
	restore_complex_scidac_to_field( startfile, QIO_SERIAL, 
					 temp_field, 4);
	//put back into site structure
	FORALLSITES(j,s) {
	  for(dir=XUP;dir<=TUP;dir++){
	    temp_link = temp_field + 4*j + dir;
	    s->link[dir].real = temp_link->real;
	    s->link[dir].imag = temp_link->imag;
	  }
	}
	free(temp_field);
      }//else
      
    } //if
    
    /* if a lattice was read in, put in KS phases and AP boundary condition */
    phases_in = OFF;
    rephase( ON );

    node0_printf("Calling for path table\n");fflush(stdout);
    /* make table of coefficients and permutations of paths in quark action */
    init_path_table(&ks_act_paths);
    make_path_table(&ks_act_paths, NULL);
    node0_printf("Done with path table\n");fflush(stdout);

    return(0);
}
Exemplo n.º 11
0
/* read in parameters and coupling constants	*/
int readin(int prompt) {
  /* read in parameters for su3 monte carlo	*/
  /* argument "prompt" is 1 if prompts are to be given for input	*/

  int status;
  int i;

  /* On node zero, read parameters and send to all other nodes */
  if(this_node==0){

    printf("\n\n");
    status=0;

    /* Number of kappas */
    IF_OK status += get_i(stdin, prompt,"number_of_kappas", &par_buf.num_kap );
    if( par_buf.num_kap>MAX_KAP ){
      printf("num_kap = %d must be <= %d!\n", par_buf.num_kap, MAX_KAP);
      status++;
    }

    /* boundary condition flag */
    IF_OK status += get_i(stdin, prompt, "bc_flag", &par_buf.bc_flag);

    /* Number of APE smearings */
    IF_OK status += get_i(stdin, prompt, "num_smear", &par_buf.num_smear);

    /* APE smearing parameter (Boulder convention) */
    IF_OK status += get_f(stdin, prompt, "alpha", &par_buf.alpha);

    /* To be save initialize the following to zero */
    for(i=0;i<MAX_KAP;i++){
      kap[i] = 0.0;
      resid[i] = 0.0;
    }

    for(i=0;i<par_buf.num_kap;i++){
      IF_OK status += get_f(stdin, prompt,"kappa", &par_buf.kap[i] );
    }

    /* Clover coefficient */
    IF_OK status += get_f(stdin, prompt,"clov_c", &par_buf.clov_c );

    /* fermion phase factors */
    IF_OK status += get_f(stdin, prompt,"ferm_phases[0]", &par_buf.ferm_phas[0] );
    IF_OK status += get_f(stdin, prompt,"ferm_phases[1]", &par_buf.ferm_phas[1] );
    IF_OK status += get_f(stdin, prompt,"ferm_phases[2]", &par_buf.ferm_phas[2] );

    /* maximum no. of conjugate gradient iterations */
    IF_OK status += get_i(stdin, prompt,"max_cg_iterations", &par_buf.niter );

    /* maximum no. of conjugate gradient restarts */
    IF_OK status += get_i(stdin, prompt,"max_cg_restarts", &par_buf.nrestart );

    /* error for propagator conjugate gradient */
    for(i=0;i<par_buf.num_kap;i++){
      IF_OK status += get_f(stdin, prompt,"error_for_propagator", &par_buf.resid[i] );
    }

    /* find out what kind of starting lattice to use */
    IF_OK status += ask_starting_lattice(stdin,  prompt, &par_buf.startflag,
	par_buf.startfile );

    /* send parameter structure */
    if( status > 0)par_buf.stopflag=1; else par_buf.stopflag=0;
  } /* end if(this_node==0) */

  /* Node 0 broadcasts parameter buffer to all other nodes */
  broadcast_bytes((char *)&par_buf,sizeof(par_buf));

  if( par_buf.stopflag != 0 )
    normal_exit(0);

  startflag = par_buf.startflag;
  bc_flag = par_buf.bc_flag;
  num_kap = par_buf.num_kap;
  clov_c = par_buf.clov_c;
  niter = par_buf.niter;
  nrestart = par_buf.nrestart;
  num_smear = par_buf.num_smear;
  alpha = par_buf.alpha;
  for(i=0;i<par_buf.num_kap;i++){
    kap[i] = par_buf.kap[i];
    resid[i] = par_buf.resid[i];
  }
  for(i=0;i<3;i++){
    ferm_phases[i] = par_buf.ferm_phas[i];
  }
  strcpy(startfile,par_buf.startfile);

  for(i=0;i<par_buf.num_kap;i++){
    wqs[i].c_src = NULL;
    wqs[i].wv_src = NULL;
    wqs[i].type = 0;
    wqs[i].x0 = 0;
    wqs[i].y0 = 0;
    wqs[i].z0 = 0;
    wqs[i].t0 = 0;
    strcpy(wqs[i].descrp,"Schroedinger wall source");
  }

  beta = 1e20;	/* Only needed in io_helpers for setting boundary fields */
  c_t11 = 0;	/* Only needed in io_helpers for setting boundary fields */
		/* These boundary fields are actually never used here */

  /* Do whatever is needed to get lattice */
  if( startflag != CONTINUE ){
    startlat_p = reload_lattice( startflag, startfile );
    invalidate_this_clov(gen_clov);
  }

  /* put in fermion phases */
  if( startflag != CONTINUE) do_phases();
  return(0);
}
Exemplo n.º 12
0
/* read in parameters and coupling constants */
int readin(const int prompt)
{
   /* read in parameters for su3 monte carlo */
   /* argument "prompt" is 1 if prompts are to be given for input */

   int status;
   char savebuf[128];

   /* On node zero, read parameters and send to all other nodes */
   if(this_node==0)
   {
      printf("\n\n");
      status=0;

#ifdef HYP
      /* Weights for hypercube blocking */
      IF_OK status += get_f(stdin,  prompt, "alpha", &par_buf.alpha );
      IF_OK status += get_f(stdin,  prompt, "alpha2", &par_buf.alpha2 );
      IF_OK status += get_f(stdin,  prompt, "alpha3", &par_buf.alpha3 );
#else      
      /* Weight for simple APE blocking */
      IF_OK status += get_f(stdin,  prompt, "ape_weight", &par_buf.ape_weight );
#endif

      /* sweeps */
      IF_OK status += get_i(stdin,  prompt, "sweeps", &par_buf.sweeps );

      /* trajectories between propagator measurements */
      IF_OK status +=
        get_i(stdin,  prompt, "sweeps_between_meas", &par_buf.measinterval );

      /* number of hits in SU(3) projection */
      IF_OK status += get_i(stdin,  prompt, "hits_per_sweep", &par_buf.hits );

      /* find out what kind of starting lattice to use */
      IF_OK status += ask_starting_lattice(stdin,  prompt, &(par_buf.startflag),
                                           par_buf.startfile );

      /* what kind of gauge fixing */
      IF_OK if (prompt!=0)
      {
         printf("enter 'no_gauge_fix', or 'coulomb_gauge_fix'\n");
      }
      IF_OK scanf("%s",savebuf);
      IF_OK { 
	if(strcmp( "coulomb_gauge_fix",savebuf) == 0 )
	  {
	    par_buf.fixflag = COULOMB_GAUGE_FIX;
	    printf("fixing to coulomb gauge\n");
	  }
	else if(strcmp("no_gauge_fix",savebuf) == 0 )
	  {
	    par_buf.fixflag = NO_GAUGE_FIX;
	    printf("NOT fixing the gauge\n");
	  }
	else
	  {
	    printf("error in input: fixing_command is invalid\n"); status++;
	  }
      }

      /* where to store topological density */
      IF_OK status += ask_ending_topo( prompt, &(par_buf.savetopoflag),
				       par_buf.topofile);

      /* find out what to do with lattice at end */
      IF_OK status += ask_ending_lattice(stdin,  prompt, &(par_buf.saveflag),
                                         par_buf.savefile );
      IF_OK status += ask_ildg_LFN(stdin,  prompt, par_buf.saveflag,
				    par_buf.stringLFN );

      /* send parameter structure */
      if( status > 0) par_buf.stopflag=1; else par_buf.stopflag=0;
   } /* end if(this_node==0) */
Exemplo n.º 13
0
// -----------------------------------------------------------------
// Read in parameters for SU(3) eigenvalues
int readin(int prompt) {
  // prompt=1 indicates prompts are to be given for input
  int status;

  // On node zero, read parameters and send to all other nodes
  if (this_node == 0) {
    printf("\n\n");
    status = 0;

    // Always calculating massless eigenvalues
    IF_OK status += get_i(stdin, prompt, "nsmear", &par_buf.nsmear);
    IF_OK status += get_f(stdin, prompt, "alpha_hyp0", &par_buf.alpha_hyp0);
    IF_OK status += get_f(stdin, prompt, "alpha_hyp1", &par_buf.alpha_hyp1);
    IF_OK status += get_f(stdin, prompt, "alpha_hyp2", &par_buf.alpha_hyp2);

    IF_OK status += get_f(stdin, prompt, "start", &par_buf.start);
    IF_OK status += get_i(stdin, prompt, "Nvecs", &par_buf.Nvecs);
    IF_OK status += get_i(stdin, prompt, "block", &par_buf.block);
    IF_OK status += get_f(stdin, prompt, "eig_tol", &par_buf.eig_tol);
    IF_OK status += get_i(stdin, prompt, "maxIter", &par_buf.maxIter);

    // Find out what kind of starting lattice to use
    IF_OK status += ask_starting_lattice(stdin, prompt, &par_buf.startflag,
                                         par_buf.startfile);

    if (status > 0)
      par_buf.stopflag = 1;
    else
      par_buf.stopflag = 0;
  }

  // Broadcast parameter buffer from node0 to all other nodes
  broadcast_bytes((char *)&par_buf, sizeof(par_buf));
  if (par_buf.stopflag != 0)
    normal_exit(0);

  nsmear = par_buf.nsmear;
  alpha_smear[0] = par_buf.alpha_hyp0;
  alpha_smear[1] = par_buf.alpha_hyp1;
  alpha_smear[2] = par_buf.alpha_hyp2;

  start = par_buf.start;
  Nvecs = par_buf.Nvecs;
  block = par_buf.block;
  eig_tol = par_buf.eig_tol;
  maxIter = par_buf.maxIter;

  startflag = par_buf.startflag;
  strcpy(startfile, par_buf.startfile);

  // Do whatever is needed to get lattice
  if (startflag == CONTINUE)
    rephase(OFF);

  startlat_p = reload_lattice(startflag, startfile);
  // If a lattice was read in, put in staggered phase factors
  // and antiperiodic boundary condition
  phases_in = OFF;
  rephase(ON);
  return 0;
}
Exemplo n.º 14
0
/* read in parameters and coupling constants	*/
int readin(int prompt) {
    /* read in parameters for su3 monte carlo	*/
    /* argument "prompt" is 1 if prompts are to be given for input	*/

    int status,status2;
    char savebuf[128];
    char save_w[128];
    int i;
    char descrp[30];

    /* On node zero, read parameters and send to all other nodes */
    if(this_node==0) {

        printf("\n\n");
        status=0;

        /* Number of heavy kappas */
        IF_OK status += get_i(stdin, prompt,"number_of_heavy_kappas",
                              &par_buf.num_kap_heavy );
        IF_OK if( par_buf.num_kap_heavy>MAX_KAP ) {
            printf("num_kap_heavy = %d must be in [1,%d]!\n",
                   num_kap_heavy, MAX_KAP);
            status++;
        }

        /* Values of heavy kappas */
        for(i=0; i<par_buf.num_kap_heavy; i++) {
            IF_OK status += get_f(stdin, prompt,"kappa_heavy", &par_buf.kap[i] );
        }

        /* Number of light kappas */
        IF_OK status += get_i(stdin, prompt,"number_of_light_kappas",
                              &par_buf.num_kap_light );
        par_buf.num_kap = par_buf.num_kap_heavy + par_buf.num_kap_light;
        IF_OK if(par_buf.num_kap_light>MAX_KAP-num_kap_heavy ||
                 par_buf.num_kap_light < 1) {
            printf("num_kap_light = %d must be in [1,%d]!\n",
                   par_buf.num_kap_light, MAX_KAP - num_kap_heavy);
            status++;
        }

        /* Values of light kappas */
        for(i=par_buf.num_kap_heavy; i<par_buf.num_kap; i++) {
            IF_OK status += get_f(stdin, prompt,"kappa_light", &par_buf.kap[i] );
        }

        /* Clover coefficient, u0 */
        IF_OK status += get_f(stdin, prompt,"clov_c", &par_buf.clov_c );
        IF_OK status += get_f(stdin, prompt,"u0", &par_buf.u0 );

        IF_OK {
            if (prompt!=0)
                printf("enter 'nr_forward, nr_backward, nr_forward_backward'\n");
            status2=scanf("%s",savebuf);
            if(status2!=1) {
                printf("ERROR IN INPUT: nr type command\n");
                status++;
            }

            else if(strcmp("nr_forward",savebuf) == 0 ) par_buf.nr_forw_back = 1;
            else if(strcmp("nr_backward",savebuf) == 0 ) par_buf.nr_forw_back = 2;
            else if(strcmp("nr_forward_backward",savebuf) == 0 ) par_buf.nr_forw_back = 3;
            else{
                printf("ERROR IN INPUT: nr command is invalid\n");
                status++;
            }
        }

        /** starting timeslice for the inversion ***/
        IF_OK status += get_i(stdin, prompt,"q_source_time", &par_buf.source_time );

        /* maximum no. of conjugate gradient iterations */
        IF_OK status += get_i(stdin, prompt,"max_cg_iterations", &par_buf.niter );

        /* maximum no. of conjugate gradient restarts */
        IF_OK status += get_i(stdin, prompt,"max_cg_restarts", &par_buf.nrestart );

        /* error for propagator conjugate gradient */
        for(i=0; i<par_buf.num_kap; i++) {
            IF_OK status += get_f(stdin, prompt,"error_for_propagator", &par_buf.resid[i] );
        }

        /* Get source type */
        IF_OK status += ask_w_quark_source( stdin, prompt, &wallflag, descrp);

        /* width: psi=exp(-(r/r0)^2) */
        IF_OK if (prompt!=0)
            printf("enter width(s) r0 as in: source=exp(-(r/r0)^2)\n");
        for(i=0; i<par_buf.num_kap; i++) {
            IF_OK status += get_f(stdin, prompt,"r0", &par_buf.wqs[i].r0 );
            /* (Same source type for each spectator) */
            IF_OK par_buf.wqs[i].type = wallflag;
            IF_OK strcpy(par_buf.wqs[i].descrp,descrp);
            /* (Hardwired source location for each spectator) */
            IF_OK {
                par_buf.wqs[i].x0 = source_loc[0];
                par_buf.wqs[i].y0 = source_loc[1];
                par_buf.wqs[i].z0 = source_loc[2];
                par_buf.wqs[i].t0 = par_buf.source_time ;
            }
        }

        /* find out what kind of starting lattice to use */
        IF_OK status += ask_starting_lattice(stdin,  prompt, &par_buf.startflag,
                                             par_buf.startfile );

        IF_OK if (prompt!=0)
            printf("enter 'no_gauge_fix', or 'coulomb_gauge_fix'\n");
        IF_OK scanf("%s",savebuf);
        IF_OK printf("%s\n",savebuf);
        IF_OK {
            if(strcmp("coulomb_gauge_fix",savebuf) == 0 ) {
                par_buf.fixflag = COULOMB_GAUGE_FIX;
            }
            else if(strcmp("no_gauge_fix",savebuf) == 0 ) {
                par_buf.fixflag = NO_GAUGE_FIX;
            }
            else{
                printf("error in input: fixing_command is invalid\n");
                status++;
            }
        }

        /* find out what to do with lattice at end */
        IF_OK status += ask_ending_lattice(stdin,  prompt, &(par_buf.saveflag),
                                           par_buf.savefile );
        IF_OK status += ask_ildg_LFN(stdin,  prompt, par_buf.saveflag,
                                     par_buf.stringLFN );

        /* find out starting propagator */
        IF_OK for(i=0; i<par_buf.num_kap; i++)
            status += ask_starting_wprop(stdin, prompt,&par_buf.startflag_w[i],
                                         par_buf.startfile_w[i]);

        /* what to do with computed propagator */
        IF_OK for(i=0; i<par_buf.num_kap; i++)
            status += ask_ending_wprop(stdin, prompt,&par_buf.saveflag_w[i],
                                       par_buf.savefile_w[i]);

        IF_OK if(prompt!=0)
            printf("propagator scratch file:\n enter 'serial_scratch_wprop' or 'parallel_scratch_wprop'\n");
        IF_OK status2=scanf("%s",save_w);
        IF_OK printf("%s ",save_w);
        IF_OK
        {
            if(strcmp("serial_scratch_wprop",save_w) == 0 )
                par_buf.scratchflag = SAVE_SERIAL;
            else if(strcmp("parallel_scratch_wprop",save_w) == 0 )
                par_buf.scratchflag = SAVE_CHECKPOINT;
            else
            {
                printf("error in input: %s is not a scratch file command\n",save_w);
                status++;
            }
            IF_OK
            {
                /*read name of file and load it */
                if(prompt!=0)printf("enter name of scratch file stem for props\n");
                status2=scanf("%s",par_buf.scratchstem_w);
                if(status2 !=1) {
                    printf("error in input: scratch file stem name\n");
                    status++;
                }
                printf("%s\n",par_buf.scratchstem_w);
            }
        }

        if( status > 0)par_buf.stopflag=1;
        else par_buf.stopflag=0;
    } /* end if(this_node==0) */
Exemplo n.º 15
0
/* read in parameters and coupling constants    */
int readin(int prompt) {
/* read in parameters for su3 monte carlo       */
/* argument "prompt" is 1 if prompts are to be given for input */

int status;

    /* On node zero, read parameters and send to all other nodes */
    if(this_node==0){

        printf("\n\n");
	status=0;
    
	/* warms, trajecs */
	IF_OK status += get_i(stdin, prompt,"warms", &par_buf.warms );
	IF_OK status += get_i(stdin, prompt,"trajecs", &par_buf.trajecs );
    
	/* trajectories between propagator measurements */
	IF_OK status += 
	    get_i(stdin, prompt,"traj_between_meas", &par_buf.propinterval );
    
	/* get couplings and broadcast to nodes	*/
	/* beta */
	IF_OK status += get_f(stdin, prompt,"beta", &par_buf.beta );

	/* boundary condition flag */
	IF_OK status += get_i(stdin, prompt,"bc_flag", &par_buf.bc_flag );

#if ( defined HMC_ALGORITHM || defined RMD_ALGORITHM )
        /* microcanonical time step */
	IF_OK status +=
            get_f(stdin, prompt,"microcanonical_time_step", &par_buf.epsilon );
#endif  
        /*microcanonical steps per trajectory */
	IF_OK status += get_i(stdin, prompt,"steps_per_trajectory", &par_buf.steps );
    
#ifdef ORA_ALGORITHM
        /*qhb steps per trajectory */
	IF_OK status += get_i(stdin, prompt,"qhb_steps", &par_buf.stepsQ );
#endif   

        /* find out what kind of starting lattice to use */
	IF_OK status += ask_starting_lattice(stdin,  prompt, &(par_buf.startflag),
	    par_buf.startfile );

        /* find out what to do with lattice at end */
	IF_OK status += ask_ending_lattice(stdin,  prompt, &(par_buf.saveflag),
	    par_buf.savefile );
	IF_OK status += ask_ildg_LFN(stdin,  prompt, par_buf.saveflag,
				      par_buf.stringLFN );
 
        /* send parameter structure */
	if( status > 0)par_buf.stopflag=1; else par_buf.stopflag=0;
    } /* end if(this_node==0) */

    /* Node 0 broadcasts parameter buffer to all other nodes */
    broadcast_bytes((char *)&par_buf,sizeof(par_buf));

    if( par_buf.stopflag != 0 )
      normal_exit(0);

    warms = par_buf.warms;
    trajecs = par_buf.trajecs;
    steps = par_buf.steps;
    stepsQ = par_buf.stepsQ;
    propinterval = par_buf.propinterval;
    startflag = par_buf.startflag;
    saveflag = par_buf.saveflag;
    epsilon = par_buf.epsilon;
    beta = par_buf.beta;
    bc_flag = par_buf.bc_flag;
    strcpy(startfile,par_buf.startfile);
    strcpy(savefile,par_buf.savefile);
    strcpy(stringLFN, par_buf.stringLFN);

    c_t11 = 0;

    /* Do whatever is needed to get lattice */
    if( startflag != CONTINUE )
      startlat_p = reload_lattice( startflag, startfile );

    return(0);
} /*readin()*/
Exemplo n.º 16
0
/* read in parameters and coupling constants	*/
int
readin(int prompt)
{
  /* read in parameters for su3 monte carlo	*/
  /* argument "prompt" is 1 if prompts are to be given for input	*/
  
  int status;
  
  /* On node zero, read parameters and send to all other nodes */
  if(this_node==0) {
    
    printf("\n\n");
    status=0;
    
    /* find out what kind of starting lattice to use */
    IF_OK status += ask_starting_lattice(stdin,  prompt, &(param.startflag),
					  param.startfile );

    /* Gauge fixing parameters */
    IF_OK if (prompt==1) 
      printf("enter 'no_gauge_fix', 'landau_gauge_fix', or 'coulomb_gauge_fix'\n");
    IF_OK scanf("%s",param.gauge_fix_description);
    IF_OK printf("%s\n",param.gauge_fix_description);
    IF_OK {
      if(strcmp("coulomb_gauge_fix",param.gauge_fix_description) == 0 ){
	param.fixflag = COULOMB_GAUGE_FIX;
	if(this_node==0)printf("fixing to coulomb gauge\n");
      }
      else if(strcmp("landau_gauge_fix",param.gauge_fix_description) == 0 ) {
	param.fixflag = LANDAU_GAUGE_FIX; 
	if(this_node==0)printf("fixing to landau gauge\n");
      }
      else if(strcmp("no_gauge_fix",param.gauge_fix_description) == 0 ) {
	param.fixflag = NO_GAUGE_FIX;
	if(this_node==0)printf("NOT fixing the gauge\n");
      }
      else{
	printf("error in input: fixing_command %s is invalid\n",
	       param.gauge_fix_description);
	status++;
      }
    }

    /* Gauge fixing parameters */
    if(param.fixflag != NO_GAUGE_FIX){
      IF_OK status += get_f(stdin, prompt, "gauge_fix_tol", &param.gauge_fix_tol);
    }

    /* Get translation vector */
    IF_OK status += get_vi(stdin, prompt, "rshift", param.rshift, 4);

    /* Get boundary twist */
    IF_OK status += get_vf(stdin, prompt, "momentum_twist",
			   param.bdry_phase, 4);
    
    /* find out what to do with lattice at end */
    IF_OK status += ask_ending_lattice(stdin,  prompt, &(param.saveflag),
					param.savefile );
    IF_OK status += ask_ildg_LFN(stdin,  prompt, param.saveflag,
				  param.stringLFN );
    if( status > 0)param.stopflag=1; else param.stopflag=0;
  } /* end if(this_node==0) */
Exemplo n.º 17
0
Arquivo: setup.c Projeto: andypea/MILC
/* read in parameters and coupling constants	*/
int readin(int prompt) {
  /* read in parameters for su3 monte carlo	*/
  /* argument "prompt" is 1 if prompts are to be given for input	*/
  
  int status;
  char savebuf[128];
  int i;
  int ipair;

  /* On node zero, read parameters and send to all other nodes */
  if(this_node==0){
    
    printf("\n\n");
    status=0;

    /*------------------------------------------------------------*/
    /* Gauge configuration section                                */
    /*------------------------------------------------------------*/

    IF_OK status += ask_starting_lattice(stdin,  prompt, &param.startflag,
	param.startfile );
    IF_OK status += get_f(stdin, prompt,"u0", &param.u0 );

    IF_OK if (prompt!=0) 
      printf("enter 'no_gauge_fix', or 'coulomb_gauge_fix'\n");
    IF_OK scanf("%s",savebuf);
    IF_OK printf("%s\n",savebuf);
    IF_OK {
      if(strcmp("coulomb_gauge_fix",savebuf) == 0 ){
	param.fixflag = COULOMB_GAUGE_FIX;
      }
      else if(strcmp("no_gauge_fix",savebuf) == 0 ) {
	param.fixflag = NO_GAUGE_FIX;
      }
      else{
	printf("error in input: fixing_command is invalid\n"); status++;
      }
    }
    
    /* find out what to do with lattice at end */
    IF_OK status += ask_ending_lattice(stdin,  prompt, &(param.saveflag),
			     param.savefile );
    IF_OK status += ask_ildg_LFN(stdin,  prompt, param.saveflag,
				  param.stringLFN );

    /* APE smearing parameters (if needed) */
    /* Zero suppresses APE smearing */
    IF_OK status += get_f(stdin, prompt, "staple_weight", 
			  &param.staple_weight);
    IF_OK status += get_i(stdin, prompt, "ape_iter",
			  &param.ape_iter);
    
    /*------------------------------------------------------------*/
    /* Propagator inversion control                               */
    /*------------------------------------------------------------*/

    /* maximum no. of conjugate gradient iterations */
    IF_OK status += get_i(stdin,prompt,"max_cg_iterations", 
			  &param.qic.max );
    
    /* maximum no. of conjugate gradient restarts */
    IF_OK status += get_i(stdin,prompt,"max_cg_restarts", 
			  &param.qic.nrestart );
    
    /* error for clover propagator conjugate gradient */
    IF_OK status += get_f(stdin, prompt,"error_for_propagator", 
			  &param.qic.resid );
    IF_OK status += get_f(stdin, prompt,"rel_error_for_propagator", 
			  &param.qic.relresid );
    /* Precision fixed to prevailing precision for now */
    param.qic.prec = PRECISION;
    param.qic.parity = EVENANDODD;
    

    /*------------------------------------------------------------*/
    /* Propagators and their sources                              */
    /*------------------------------------------------------------*/

    /* Number of propagators */
    IF_OK status += get_i(stdin,prompt,"number_of_propagators", 
			  &param.num_prop );
    if( param.num_prop>MAX_PROP ){
      printf("num_prop = %d must be <= %d!\n", param.num_prop, MAX_PROP);
      status++;
    }

    IF_OK for(i = 0; i < param.num_prop; i++){
    
      /* Propagator parameters */
      IF_OK status += get_s(stdin, prompt,"propagator_type", savebuf );
      IF_OK {
	if(strcmp(savebuf,"clover") == 0)param.prop_type[i] = CLOVER_TYPE;
	else if(strcmp(savebuf,"KS") == 0)param.prop_type[i] = KS_TYPE;
	else {
	  printf("Unknown quark type %s\n",savebuf);
	  status++;
	}
      }
      if(param.prop_type[i] == CLOVER_TYPE){
	IF_OK status += get_s(stdin, prompt,"kappa", param.kappa_label[i]);
	IF_OK param.dcp[i].Kappa = atof(param.kappa_label[i]);
	IF_OK status += get_f(stdin, prompt,"clov_c", &param.dcp[i].Clov_c );
	param.dcp[i].U0 = param.u0;
	IF_OK status += get_s(stdin, prompt,"check", savebuf);
	IF_OK {
	  /* Should we be checking the propagator by running the solver? */
	  if(strcmp(savebuf,"no") == 0)param.check[i] = 0;
	  else param.check[i] = 1;
	}
	IF_OK status += ask_starting_wprop( stdin, prompt, 
					    &param.startflag_w[i],
					    param.startfile_w[i]);
	
	IF_OK status += ask_ending_wprop( stdin, prompt, &param.saveflag_w[i],
					  param.savefile_w[i]);
	
	/* Get source type */
	IF_OK init_wqs(&param.src_wqs[i]);
	IF_OK status += get_w_quark_source( stdin, prompt, &param.src_wqs[i]);
	
      } else {  /* KS_TYPE */