Example #1
0
/* SETUP ROUTINES */
int 
initial_set()
{
  int prompt,status,i,tmporder;
  Real current_naik_mass;

  /* On node zero, read lattice size, seed, and send to others */
  if(mynode()==0){
    /* print banner */
    printf("SU3 with improved KS action\n");
    printf("Microcanonical simulation with refreshing\n");
    printf("MIMD version 7 $Name:  $\n");
    printf("Machine = %s, with %d nodes\n",machine_type(),numnodes());
    printf("Rational function hybrid Monte Carlo algorithm\n");
    /* Print list of options selected */
    node0_printf("Options selected...\n");
    show_generic_opts();
    show_generic_ks_opts();
#ifdef INT_ALG
    node0_printf("INT_ALG=%s\n",ks_int_alg_opt_chr());
#endif
    //#ifdef HISQ_NAIK_ADJUSTABLE
    //    node0_printf("HISQ_NAIK_ADJUSTABLE (means Naik correction is full epsilon and not just mass)\n");
    //#endif
#ifdef HISQ_FORCE_FILTER
    node0_printf("HISQ_FORCE_FILTER=%f\n",HISQ_FORCE_FILTER);
#endif
#ifdef HISQ_REUNIT_ALLOW_SVD
    node0_printf("HISQ_REUNIT_ALLOW_SVD\n");
#endif
#ifdef HISQ_REUNIT_SVD_ONLY
    node0_printf("HISQ_REUNIT_SVD_ONLY (used together with HISQ_REUNIT_ALLOW_SVD)\n");
#endif
#ifdef MILC_GLOBAL_DEBUG
    node0_printf("MILC_GLOBAL_DEBUG ***********************\n");
#endif
#ifdef HISQ_REUNITARIZATION_DEBUG
    node0_printf("HISQ_REUNITARIZATION_DEBUG is ON\n");
#endif
#ifdef HISQ_FF_MULTI_WRAPPER
    node0_printf("HISQ_FF_MULTI_WRAPPER is ON\n");
#endif
#ifdef HISQ_FF_DEBUG
    node0_printf("HISQ_FF_DEBUG is ON\n");
#endif
    status=get_prompt(stdin, &prompt);
    IF_OK status += get_i(stdin, prompt,"nx", &par_buf.nx );
    IF_OK status += get_i(stdin, prompt,"ny", &par_buf.ny );
    IF_OK status += get_i(stdin, prompt,"nz", &par_buf.nz );
    IF_OK status += get_i(stdin, prompt,"nt", &par_buf.nt );
#ifdef FIX_NODE_GEOM
    IF_OK status += get_vi(stdin, prompt, "node_geometry", 
			   par_buf.node_geometry, 4);
#ifdef FIX_IONODE_GEOM
    IF_OK status += get_vi(stdin, prompt, "ionode_geometry", 
			   par_buf.ionode_geometry, 4);
#endif
#endif
    IF_OK status += get_i(stdin, prompt,"iseed", &par_buf.iseed );
    /* Number of pseudofermions */
    IF_OK status += get_i(stdin, prompt,"n_pseudo", &par_buf.n_pseudo );
    if(par_buf.n_pseudo > MAX_N_PSEUDO){
      printf("Error:  Too many pseudofermion fields.  Recompile. Current max is %d\n"
	     ,MAX_N_PSEUDO);
      terminate(1);
    }
    /* get name of file containing rational function parameters */
    IF_OK status += get_s(stdin, prompt, "load_rhmc_params", 
			  par_buf.rparamfile);
    /* beta, quark masses */
    IF_OK status += get_f(stdin, prompt,"beta", &par_buf.beta );

    IF_OK status += get_i(stdin, prompt,"n_dyn_masses", &par_buf.n_dyn_masses );
    IF_OK status += get_vf(stdin, prompt, "dyn_mass", par_buf.dyn_mass, par_buf.n_dyn_masses);
    IF_OK status += get_vi(stdin, prompt, "dyn_flavors", par_buf.dyn_flavors, par_buf.n_dyn_masses);

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

    if(status>0) par_buf.stopflag=1; else par_buf.stopflag=0;
  } /* end if(mynode()==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);
  
  nx        = par_buf.nx;
  ny        = par_buf.ny;
  nz        = par_buf.nz;
  nt        = par_buf.nt;
#ifdef FIX_NODE_GEOM
  for(i = 0; i < 4; i++)
    node_geometry[i] = par_buf.node_geometry[i];
#ifdef FIX_IONODE_GEOM
  for(i = 0; i < 4; i++)
    ionode_geometry[i] = par_buf.ionode_geometry[i];
#endif
#endif
  iseed     = par_buf.iseed;
  n_pseudo  = par_buf.n_pseudo;
  strcpy(rparamfile,par_buf.rparamfile);
  
  this_node = mynode();
  number_of_nodes = numnodes();
  volume=nx*ny*nz*nt;
  total_iters=0;

  /* Load rational function parameters */
  rparam = load_rhmc_params(rparamfile, n_pseudo);  
  if(rparam == NULL)terminate(1);

  /* Determine the maximum rational fcn order */
  max_rat_order = 0;
  for(i = 0; i < n_pseudo; i++){
    if(rparam[i].MD.order > max_rat_order)max_rat_order = rparam[i].MD.order;
    if(rparam[i].GR.order > max_rat_order)max_rat_order = rparam[i].GR.order;
    if(rparam[i].FA.order > max_rat_order)max_rat_order = rparam[i].FA.order;
  }
  node0_printf("Maximum rational func order is %d\n",max_rat_order);


  /* Determine the number of different Naik masses */
  current_naik_mass = rparam[0].naik_term_epsilon;
  tmporder = 0;
  n_naiks = 0;
  n_order_naik_total = 0;
  for( i=0; i<n_pseudo; i++ ) {
    if( rparam[i].naik_term_epsilon != current_naik_mass ) {
      if( tmporder > 0 ) {
        n_orders_naik[n_naiks] = tmporder;
        masses_naik[n_naiks] = current_naik_mass;
        current_naik_mass = rparam[i].naik_term_epsilon;
        n_naiks++;
        n_order_naik_total += tmporder;
        tmporder = 0;
      }
    }
    tmporder += rparam[i].MD.order;
    n_pseudo_naik[n_naiks]++;
  }
  if( tmporder > 0 ) {
    n_orders_naik[n_naiks] = tmporder;
    masses_naik[n_naiks] = current_naik_mass;
    n_order_naik_total += tmporder;
    n_naiks++;
  }
  // calculate epsilon corrections for different Naik terms
  if( 0!=masses_naik[0] ) {
    node0_printf("IN HISQ ACTION FIRST SET OF PSEUDO FERMION FIELDS SHOULD HAVE EPSILON CORRECTION TO NAIK TERM ZERO.\n");
    terminate(1);
  }
  eps_naik[0] = 0.0; // first set of X links always has 0 correction
  for( i=1; i<n_naiks; i++ ) {
#ifdef HISQ
    //#ifdef HISQ_NAIK_ADJUSTABLE
    // value read from rational function file is considered full epsilon correction
    eps_naik[i] = masses_naik[i];
    //#else
    // value read from rational function file is considered quark mass
    // and epsilon correction is calculated with the second order perturbation theory,
    // HISQ_NAIK_2ND_ORDER is set in the hisq_action.h
    //    eps_naik[i] = HISQ_NAIK_2ND_ORDER*masses_naik[i]*masses_naik[i];
//#endif
#else /* HISQ */
    // IT IS ASSUMED THAT ACTIONS OTHER THAN HISQ DO NOT HAVE
    // ANY EPSILON CORRECTION TERMS
    eps_naik[i] = 0;
#endif /* HISQ */
  }
  node0_printf("Naik term correction structure of multi_x:\n");
  node0_printf("n_naiks %d\n",n_naiks);
  for( i=0; i<n_naiks; i++ ) {
    node0_printf("n_pseudo_naik[%d]=%d\n",i,n_pseudo_naik[i]);
    node0_printf("n_orders_naik[%d]=%d\n",i,n_orders_naik[i]);
    node0_printf("masses_naik[%d]=%f\n",i,masses_naik[i]);
    node0_printf("eps_naik[%d]=%f\n",i,eps_naik[i]);
  }
  node0_printf("n_order_naik_total %d\n",n_order_naik_total);
#ifdef HISQ
  if( n_naiks+1 > MAX_NAIK ) {
    node0_printf("MAX_NAIK=%d < n_naiks+1=%d\n", MAX_NAIK, n_naiks+1 );
    node0_printf("Increase MAX_NAIK\n");
    terminate(1);
  }
#else /* HISQ */
  if( n_naiks>1 ) {
    node0_printf("FOR ACTIONS OTHER THAN HISQ EPSILON CORRECTION IS NOT USED.\n");
    node0_printf("ONLY ONE SET OF X LINKS IS USED.\n");
    node0_printf("SET ALL naik_mass TO 0 IN RATIONAL FUNCTION FILE.\n");
    terminate(1);
  }
#endif /* HISQ */

  beta = par_buf.beta;
  
  n_dyn_masses = par_buf.n_dyn_masses;
  for(i = 0; i < n_dyn_masses; i++){
    dyn_mass[i] = par_buf.dyn_mass[i];
    dyn_flavors[i] = par_buf.dyn_flavors[i];
  }
  u0 = par_buf.u0;

  return(prompt);
}
Example #2
0
/* SETUP ROUTINES */
static int 
initial_set(void)
{
  int prompt,status,i,tmporder;
  Real current_naik_epsilon;

  /* On node zero, read lattice size, seed, and send to others */
  if(mynode()==0){
    /* print banner */
    printf("SU3 with improved KS action\n");
    printf("Microcanonical simulation with refreshing\n");
    printf("Rational function hybrid Monte Carlo algorithm\n");
    printf("MIMD version %s\n",MILC_CODE_VERSION);
    printf("Machine = %s, with %d nodes\n",machine_type(),numnodes());
    gethostname(hostname, 128);
    printf("Host(0) = %s\n",hostname);
    printf("Username = %s\n", getenv("USER"));
    time_stamp("start");

    /* Print list of options selected */
    node0_printf("Options selected...\n");
    show_generic_opts();
    show_generic_ks_opts();
    show_generic_ks_md_opts();
#ifdef INT_ALG
    node0_printf("INT_ALG=%s\n",ks_int_alg_opt_chr());
#endif
#if FERM_ACTION == HISQ
    show_su3_mat_opts();
    show_hisq_links_opts();
    show_hisq_force_opts();
#endif

    status=get_prompt(stdin, &prompt);
    IF_OK status += get_i(stdin, prompt,"nx", &par_buf.nx );
    IF_OK status += get_i(stdin, prompt,"ny", &par_buf.ny );
    IF_OK status += get_i(stdin, prompt,"nz", &par_buf.nz );
    IF_OK status += get_i(stdin, prompt,"nt", &par_buf.nt );
#ifdef FIX_NODE_GEOM
    IF_OK status += get_vi(stdin, prompt, "node_geometry", 
			   par_buf.node_geometry, 4);
#ifdef FIX_IONODE_GEOM
    IF_OK status += get_vi(stdin, prompt, "ionode_geometry", 
			   par_buf.ionode_geometry, 4);
#endif
#endif
    IF_OK status += get_i(stdin, prompt,"iseed", &par_buf.iseed );
    /* Number of pseudofermions */
    IF_OK status += get_i(stdin, prompt,"n_pseudo", &par_buf.n_pseudo );
    if(par_buf.n_pseudo > MAX_N_PSEUDO){
      printf("Error:  Too many pseudofermion fields.  Recompile. Current max is %d\n"
	     ,MAX_N_PSEUDO);
      terminate(1);
    }
    /* get name of file containing rational function parameters */
    IF_OK status += get_s(stdin, prompt, "load_rhmc_params", 
			  par_buf.rparamfile);
    /* beta, quark masses */
    IF_OK status += get_f(stdin, prompt,"beta", &par_buf.beta );

    IF_OK status += get_i(stdin, prompt,"n_dyn_masses", &par_buf.n_dyn_masses );
    IF_OK status += get_vf(stdin, prompt, "dyn_mass", par_buf.dyn_mass, par_buf.n_dyn_masses);
    IF_OK status += get_vi(stdin, prompt, "dyn_flavors", par_buf.dyn_flavors, par_buf.n_dyn_masses);

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

    if(status>0) par_buf.stopflag=1; else par_buf.stopflag=0;
  } /* end if(mynode()==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);
  
  nx        = par_buf.nx;
  ny        = par_buf.ny;
  nz        = par_buf.nz;
  nt        = par_buf.nt;
#ifdef FIX_NODE_GEOM
  for(i = 0; i < 4; i++)
    node_geometry[i] = par_buf.node_geometry[i];
#ifdef FIX_IONODE_GEOM
  for(i = 0; i < 4; i++)
    ionode_geometry[i] = par_buf.ionode_geometry[i];
#endif
#endif
  iseed     = par_buf.iseed;
  n_pseudo  = par_buf.n_pseudo;
  strcpy(rparamfile,par_buf.rparamfile);
  
  this_node = mynode();
  number_of_nodes = numnodes();
  volume=nx*ny*nz*nt;
  total_iters=0;
#ifdef HISQ_SVD_COUNTER
  hisq_svd_counter = 0;
#endif
      
#ifdef HISQ_FORCE_FILTER_COUNTER
  hisq_force_filter_counter = 0;
#endif

  /* Load rational function parameters */
  rparam = load_rhmc_params(rparamfile, n_pseudo);  
  if(rparam == NULL)terminate(1);

  /* Determine the maximum rational fcn order */
  max_rat_order = 0;
  for(i = 0; i < n_pseudo; i++){
    if(rparam[i].MD.order > max_rat_order)max_rat_order = rparam[i].MD.order;
    if(rparam[i].GR.order > max_rat_order)max_rat_order = rparam[i].GR.order;
    if(rparam[i].FA.order > max_rat_order)max_rat_order = rparam[i].FA.order;
  }
  node0_printf("Maximum rational func order is %d\n",max_rat_order);

  /* Determine the number of different Naik masses
     and fill in n_orders_naik and n_pseudo_naik        */
  current_naik_epsilon = rparam[0].naik_term_epsilon;
  tmporder = 0;
  n_naiks = 0;
  n_order_naik_total = 0;
  for( i=0; i<n_pseudo; i++ ) {
    if( rparam[i].naik_term_epsilon != current_naik_epsilon ) {
      if( tmporder > 0 ) {
        n_orders_naik[n_naiks] = tmporder;
	eps_naik[n_naiks] = current_naik_epsilon;
        current_naik_epsilon = rparam[i].naik_term_epsilon;
        n_naiks++;
        n_order_naik_total += tmporder;
        tmporder = 0;
      }
    }
    tmporder += rparam[i].MD.order;
    n_pseudo_naik[n_naiks]++;
  }
  if( tmporder > 0 ) {
    n_orders_naik[n_naiks] = tmporder;
    eps_naik[n_naiks] = current_naik_epsilon;
    n_order_naik_total += tmporder;
    n_naiks++;
  }
#if FERM_ACTION == HISQ
  // calculate epsilon corrections for different Naik terms
  if( 0 != eps_naik[0] ) {
    node0_printf("IN HISQ ACTION FIRST SET OF PSEUDO FERMION FIELDS SHOULD HAVE EPSILON CORRECTION TO NAIK TERM ZERO.\n");
    terminate(1);
  }
#endif
  node0_printf("Naik term correction structure of multi_x:\n");
  node0_printf("n_naiks %d\n",n_naiks);
  for( i=0; i<n_naiks; i++ ) {
    node0_printf("n_pseudo_naik[%d]=%d\n", i, n_pseudo_naik[i]);
    node0_printf("n_orders_naik[%d]=%d\n", i, n_orders_naik[i]);
#if FERM_ACTION == HISQ
    node0_printf("eps_naik[%d]=%f\n", i, eps_naik[i]);
#endif
  }
  node0_printf("n_order_naik_total %d\n",n_order_naik_total);
#if FERM_ACTION == HISQ
  if( n_naiks+1 > MAX_NAIK ) {
    node0_printf("MAX_NAIK=%d < n_naiks+1=%d\n", MAX_NAIK, n_naiks+1 );
    node0_printf("Increase MAX_NAIK\n");
    terminate(1);
  }
#else /* HISQ */
  if( n_naiks>1 ) {
    node0_printf("FOR ACTIONS OTHER THAN HISQ EPSILON CORRECTION IS NOT USED.\n");
    node0_printf("ONLY ONE SET OF X LINKS IS USED.\n");
    node0_printf("SET ALL naik_mass TO 0 IN RATIONAL FUNCTION FILE.\n");
    terminate(1);
  }
#endif /* HISQ */

  beta = par_buf.beta;
  
  n_dyn_masses = par_buf.n_dyn_masses;
  for(i = 0; i < n_dyn_masses; i++){
    dyn_mass[i] = par_buf.dyn_mass[i];
    dyn_flavors[i] = par_buf.dyn_flavors[i];
  }
  u0 = par_buf.u0;

  return(prompt);
}