Ejemplo n.º 1
0
static void vsmap_to_table(lua_State *L, int index, VSMap *map)
{
    struct vf_instance *vf = get_vf(L);
    struct vf_priv_s *p = vf->priv;
    const VSAPI *vsapi = p->vsapi;
    for (int n = 0; n < vsapi->propNumKeys(map); n++) {
        const char *key = vsapi->propGetKey(map, n);
        VSPropTypes t = vsapi->propGetType(map, key);
        switch (t) {
        case ptInt:
            lua_pushnumber(L, vsapi->propGetInt(map, key, 0, NULL));
            break;
        case ptFloat:
            lua_pushnumber(L, vsapi->propGetFloat(map, key, 0, NULL));
            break;
        case ptNode: {
            VSNodeRef *r = vsapi->propGetNode(map, key, 0, NULL);
            MP_TARRAY_APPEND(p, p->gc_noderef, p->num_gc_noderef, r);
            lua_pushlightuserdata(L, r);
            break;
        }
        default:
            luaL_error(L, "unknown map type");
        }
        lua_setfield(L, index, key);
    }
}
Ejemplo n.º 2
0
static VSMap *table_to_vsmap(lua_State *L, int index)
{
    struct vf_instance *vf = get_vf(L);
    struct vf_priv_s *p = vf->priv;
    const VSAPI *vsapi = p->vsapi;
    assert(index > 0);
    VSMap *map = vsapi->createMap();
    MP_TARRAY_APPEND(p, p->gc_map, p->num_gc_map, map);
    if (!map)
        luaL_error(L, "out of memory");
    lua_pushnil(L); // nil
    while (lua_next(L, index) != 0) { // key value
        if (lua_type(L, -2) != LUA_TSTRING) {
            luaL_error(L, "key must be a string, but got %s",
                       lua_typename(L, -2));
        }
        const char *key = lua_tostring(L, -2);
        switch (lua_type(L, -1)) {
        case LUA_TNUMBER: {
            // gross hack because we hate everything
            if (strncmp(key, "i_", 2) == 0) {
                vsapi->propSetInt(map, key + 2, lua_tointeger(L, -1), 0);
            } else {
                vsapi->propSetFloat(map, key, lua_tonumber(L, -1), 0);
            }
            break;
        }
        case LUA_TSTRING: {
            const char *s = lua_tostring(L, -1);
            vsapi->propSetData(map, key, s, strlen(s), 0);
            break;
        }
        case LUA_TLIGHTUSERDATA: { // assume it's VSNodeRef*
            VSNodeRef *node = lua_touserdata(L, -1);
            vsapi->propSetNode(map, key, node, 0);
            break;
        }
        default:
            luaL_error(L, "unknown type");
            break;
        }
        lua_pop(L, 1); // key
    }
    return map;
}
Ejemplo n.º 3
0
static int l_invoke(lua_State *L)
{
    struct vf_instance *vf = get_vf(L);
    struct vf_priv_s *p = vf->priv;
    const VSAPI *vsapi = p->vsapi;

    VSPlugin *plugin = vsapi->getPluginByNs(luaL_checkstring(L, 1), p->vscore);
    if (!plugin)
        luaL_error(L, "plugin not found");
    VSMap *map = table_to_vsmap(L, 3);
    VSMap *r = vsapi->invoke(plugin, luaL_checkstring(L, 2), map);
    MP_TARRAY_APPEND(p, p->gc_map, p->num_gc_map, r);
    if (!r)
        luaL_error(L, "?");
    const char *err = vsapi->getError(r);
    if (err)
        luaL_error(L, "error calling invoke(): %s", err);
    int err2 = 0;
    VSNodeRef *node = vsapi->propGetNode(r, "clip", 0, &err2);
    MP_TARRAY_APPEND(p, p->gc_noderef, p->num_gc_noderef, node);
    if (node)
        lua_pushlightuserdata(L, node);
    return 1;
}
Ejemplo n.º 4
0
/* SETUP ROUTINES */
int 
initial_set()
{
  int prompt,status;
  int i;

  /* On node zero, read lattice size, seed, nflavors1, nflavors2,
     nflavors, and send to others */
  if(mynode()==0){
    /* print banner */
    printf("SU3 gauge utility program\n");
    printf("MIMD version 7\n");
    printf("Machine = %s, with %d nodes\n",machine_type(),numnodes());
    status=get_prompt(stdin, &prompt);
    IF_OK status += get_i(stdin, prompt,"nx", &param.nx );
    IF_OK status += get_i(stdin, prompt,"ny", &param.ny );
    IF_OK status += get_i(stdin, prompt,"nz", &param.nz );
    IF_OK status += get_i(stdin, prompt,"nt", &param.nt );
#ifdef FIX_NODE_GEOM
    IF_OK status += get_vi(stdin, prompt, "node_geometry", 
			   param.node_geometry, 4);
#ifdef FIX_IONODE_GEOM
    IF_OK status += get_vi(stdin, prompt, "ionode_geometry", 
			   param.ionode_geometry, 4);
#endif
#endif
    IF_OK status += get_i(stdin, prompt,"iseed", &param.iseed );

    /* beta, quark masses */
    IF_OK status += get_f(stdin, prompt,"beta", &param.beta );

    IF_OK status += get_i(stdin, prompt,"n_dyn_masses", &param.n_dyn_masses );
    IF_OK status += get_vf(stdin, prompt, "dyn_mass", param.dyn_mass, param.n_dyn_masses);
    IF_OK status += get_vi(stdin, prompt, "dyn_flavors", param.dyn_flavors, param.n_dyn_masses);
    /* Get tadpole factor */
    IF_OK status += get_f(stdin, prompt, "u0", &param.u0);

    /* Get translation vector */

    if(status>0) param.stopflag=1; else param.stopflag=0;
  } /* end if(mynode()==0) */
  
    /* Node 0 broadcasts parameter buffer to all other nodes */
  broadcast_bytes((char *)&param,sizeof(param));
  
  if( param.stopflag != 0 )
    normal_exit(0);
  
  nx=param.nx;
  ny=param.ny;
  nz=param.nz;
  nt=param.nt;
#ifdef FIX_NODE_GEOM
  for(i = 0; i < 4; i++)
    node_geometry[i] = param.node_geometry[i];
#ifdef FIX_IONODE_GEOM
  for(i = 0; i < 4; i++)
    ionode_geometry[i] = param.ionode_geometry[i];
#endif
#endif
  iseed=param.iseed;
  
  this_node = mynode();
  number_of_nodes = numnodes();
  volume=nx*ny*nz*nt;
  beta = param.beta;
  
  n_dyn_masses = param.n_dyn_masses;
  for(i = 0; i < n_dyn_masses; i++){
    dyn_mass[i] = param.dyn_mass[i];
    dyn_flavors[i] = param.dyn_flavors[i];
  }
  u0 = param.u0;
  return prompt;
}
Ejemplo 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;
  
  /* 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) */
Ejemplo 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;
  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) */
Ejemplo n.º 7
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);
}
Ejemplo 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;
  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 */
Ejemplo n.º 9
0
/**
 * @brief Initialize and start the GUI.
 */
void guiInit(void)
{
    char **argvf;
    int ret;
    plItem *playlist;

    mp_msg(MSGT_GPLAYER, MSGL_V, "GUI init.\n");

    /* check options */

    if (!cdrom_device)
        cdrom_device = strdup(DEFAULT_CDROM_DEVICE);
    if (!dvd_device)
        dvd_device = strdup(DEFAULT_DVD_DEVICE);
#ifdef CONFIG_DXR3
    if (!gtkDXR3Device)
        gtkDXR3Device = strdup("/dev/em8300-0");
#endif

    if (stream_cache_size > 0) {
        gtkCacheOn   = True;
        gtkCacheSize = stream_cache_size;
    } else if (stream_cache_size == 0)
        gtkCacheOn = False;

    if (autosync && (autosync != gtkAutoSync)) {
        gtkAutoSyncOn = True;
        gtkAutoSync   = autosync;
    }

    gtkASS.enabled       = ass_enabled;
    gtkASS.use_margins   = ass_use_margins;
    gtkASS.top_margin    = ass_top_margin;
    gtkASS.bottom_margin = ass_bottom_margin;

    argvf = get_vf("rotate");
    guiInfo.Rotation = (argvf && argvf[1] ? atoi(argvf[1]) : -1);

    /* initialize graphical user interfaces */

    wsInit(mDisplay);
    gtkInit(mDisplayName);

    /* load skin */

    skinDirInHome = get_path("skins");
    skinDirInData = MPLAYER_DATADIR "/skins";

    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[interface] skin directory #1: %s\n", skinDirInHome);
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[interface] skin directory #2: %s\n", skinDirInData);

    if (!skinName)
        skinName = strdup("default");

    ret = skinRead(skinName);

    if (ret == -1 && strcmp(skinName, "default") != 0) {
        mp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_GUI_MSG_SkinCfgSelectedNotFound, skinName);

        skinName = strdup("default");
        ret      = skinRead(skinName);
    }

    switch (ret) {
    case -1:
        gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_GUI_MSG_SkinCfgNotFound, skinName);
        mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);

    case -2:
        gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_GUI_MSG_SkinCfgError, skinName);
        mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
    }

    /* initialize windows */

    if (gui_save_pos) {
        if (gui_main_pos_x != -3)
            guiApp.main.x = gui_main_pos_x;
        if (gui_main_pos_y != -3)
            guiApp.main.y = gui_main_pos_y;
        if (gui_video_pos_x != -3)
            guiApp.video.x = gui_video_pos_x;
        if (gui_video_pos_y != -3)
            guiApp.video.y = gui_video_pos_y;
    }

    if (WinID > 0) {
        guiApp.videoWindow.Parent = WinID;
        guiApp.video.x = 0;
        guiApp.video.y = 0;
    }

    if (guiWinID >= 0)
        guiApp.mainWindow.Parent = guiWinID;

    uiMainInit();      // main window must be first!
    uiVideoInit();     // video window must be second!
    uiPlaybarInit();
    uiMenuInit();

    WinID = (Window)guiApp.videoWindow.WindowID;

    btnValue(evSetVolume, &guiInfo.Volume);
    btnValue(evSetBalance, &guiInfo.Balance);
    btnValue(evSetMoviePosition, &guiInfo.Position);

    if (guiInfo.Position)
        uiEvent(evSetMoviePosition, guiInfo.Position);

    wsWindowVisibility(&guiApp.mainWindow, wsShowWindow);

    if (gtkShowVideoWindow) {
        wsWindowVisibility(&guiApp.videoWindow, wsShowWindow);

        guiInfo.VideoWindow = True;

        if (gtkLoadFullscreen)
            uiFullScreen();
    } else
        wsWindowBackground(&guiApp.videoWindow, 0, 0, 0);

    if (gtkLoadFullscreen)
        btnSet(evFullScreen, btnPressed);

    guiInfo.Playing = GUI_STOP;

    playlist = listMgr(PLAYLIST_ITEM_GET_CURR, 0);

    if (playlist && !filename) {
        uiSetFile(playlist->path, playlist->name, STREAMTYPE_FILE);
        guiInfo.Tracks = (uintptr_t)listMgr(PLAYLIST_ITEM_GET_POS, 0);
        guiInfo.Track  = 1;
        filename       = NULL; // don't start playing
    }

    if (subdata)
        setdup(&guiInfo.SubtitleFilename, subdata->filename);

    orig_fontconfig = font_fontconfig;
    set_fontconfig();

    guiInitialized = True;
}
Ejemplo n.º 10
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;
    
    /* 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];
      }
    }

    /* Max restarts for cleanup solves */
    IF_OK par_buf.nrestart = 5;
    
    /* Precision for fermion force calculation */
    IF_OK status = get_i(stdin, prompt, "prec_ff", &par_buf.prec_ff);

    /*------------------------------------------------------------*/
    /* Chiral condensate and related quantities                   */
    /*------------------------------------------------------------*/
    
    IF_OK status += get_i(stdin, prompt, "number_of_pbp_masses",
			  &par_buf.num_pbp_masses);
    if(par_buf.num_pbp_masses > MAX_MASS_PBP){
      printf("Number of masses exceeds dimension %d\n",MAX_MASS_PBP);
      status++;
    }
    IF_OK if(par_buf.num_pbp_masses > 0){
      IF_OK status += get_i(stdin, prompt, "max_cg_prop",
			    &par_buf.qic_pbp[0].max);
      IF_OK status += get_i(stdin, prompt, "max_cg_prop_restarts",
			    &par_buf.qic_pbp[0].nrestart);
      IF_OK status += get_i(stdin, prompt, "npbp_reps", &par_buf.npbp_reps );
      IF_OK status += get_i(stdin, prompt, "prec_pbp", &par_buf.prec_pbp);
      IF_OK for(i = 0; i < par_buf.num_pbp_masses; i++){
	IF_OK status += get_f(stdin, prompt, "mass", &par_buf.ksp_pbp[i].mass);
#if FERM_ACTION == HISQ
	IF_OK status += get_f(stdin, prompt, "naik_term_epsilon", 
			      &par_buf.ksp_pbp[i].naik_term_epsilon);
#endif
	par_buf.qic_pbp[i].min = 0;
	par_buf.qic_pbp[i].start_flag = 0;
	par_buf.qic_pbp[i].nsrc = 1;
	par_buf.qic_pbp[i].max = par_buf.qic_pbp[0].max;
	par_buf.qic_pbp[i].nrestart = par_buf.qic_pbp[0].nrestart;
	par_buf.qic_pbp[i].prec = par_buf.prec_pbp;
	IF_OK status += get_f(stdin, prompt, "error_for_propagator", &par_buf.qic_pbp[i].resid);
	IF_OK status += get_f(stdin, prompt, "rel_error_for_propagator", &par_buf.qic_pbp[i].relresid );
      }
    }
Ejemplo n.º 11
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);
}