Exemplo n.º 1
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.º 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;
  char savebuf[128];
  int i,j;

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

    /*------------------------------------------------------------*/
    /* Quarks and their sources                                   */
    /*------------------------------------------------------------*/

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

    /* Quark parameters */
    IF_OK for(i = 0; i < param.num_qk; i++){

      /* Input propagator type */
      IF_OK status += get_s(stdin, prompt,"quark_type", savebuf );
      IF_OK {
	if(strcmp(savebuf,"clover") == 0)param.qk_type[i] = CLOVER_TYPE;
	else if(strcmp(savebuf,"KS") == 0)param.qk_type[i] = KS_TYPE;
	else {
	  printf("Unknown quark type %s\n",savebuf);
	  status++;
	}
      }

      /* Output propagator type */
      /* The KS4_TYPE is designed for extended naive propagators that
         follow the spin conventions of the clover_invert2 code. */
      IF_OK status += get_s(stdin, prompt,"output_type", savebuf );
      IF_OK {
	if(strcmp(savebuf,"clover") == 0)param.dst_type[i] = CLOVER_TYPE;
	else if(strcmp(savebuf,"KS") == 0)param.dst_type[i] = KS_TYPE;
	else if(strcmp(savebuf,"KS4") == 0)param.dst_type[i] = KS4_TYPE;
	else {
	  printf("Unknown output type %s\n",savebuf);
	  status++;
	}
      }

      /* Input Dirac propagator */
      if(param.qk_type[i] == CLOVER_TYPE){
	/* Name of starting Dirac propagator file */
	IF_OK status += ask_starting_wprop( stdin, prompt, 
					    &param.startflag_w[i],
					    param.startfile_w[i]);
	IF_OK status += get_i(stdin,prompt,"ncolor", &param.ncolor[i] );
	
	/* Dirac sink operator */
	IF_OK {
	  if(param.dst_type[i] == CLOVER_TYPE ||
	     param.dst_type[i] == KS4_TYPE){
	    IF_OK init_qss_op(&param.snk_qs_op[i]);
	    IF_OK status += get_wv_field_op( stdin, prompt, &param.snk_qs_op[i]);
	    
	  } else {
	    printf("Unsupported output source type\n");
	    status++;
	  }
	}
	
      } else {  /* Input KS propagator */
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
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 */