/* 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, ¶m.startflag, param.startfile ); IF_OK status += get_f(stdin, prompt,"u0", ¶m.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", ¶m.staple_weight); IF_OK status += get_i(stdin, prompt, "ape_iter", ¶m.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", ¶m.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(¶m.base_src_qs[i]); IF_OK status += get_wv_quark_source( stdin, prompt, ¶m.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(¶m.src_qs_op[i]); IF_OK set_qss_op_offset(¶m.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", ¶m.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", ¶m.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(¶m.src_qs_op[is]); set_qss_op_offset(¶m.src_qs_op[is], param.coord_origin); /* Get source operator attributes */ IF_OK status += get_wv_field_op( stdin, prompt, ¶m.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(¶m.base_src_qs[is], ¶m.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", ¶m.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", ¶m.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", ¶m.nap[i].kappa_s); IF_OK status += get_f(stdin, prompt, "kappa_t", ¶m.nap[i].kappa_t); IF_OK status += get_f(stdin, prompt, "r_s", ¶m.nap[i].r_s); IF_OK status += get_f(stdin, prompt, "r_t", ¶m.nap[i].r_t); IF_OK status += get_f(stdin, prompt, "zeta", ¶m.nap[i].zeta); IF_OK status += get_f(stdin, prompt, "c_E", ¶m.nap[i].c_E); IF_OK status += get_f(stdin, prompt, "c_B", ¶m.nap[i].c_B); IF_OK status += get_f(stdin, prompt, "c_1", ¶m.nap[i].c_1); IF_OK status += get_f(stdin, prompt, "c_2", ¶m.nap[i].c_2); IF_OK status += get_f(stdin, prompt, "c_3", ¶m.nap[i].c_3); IF_OK status += get_f(stdin, prompt, "c_4", ¶m.nap[i].c_4); IF_OK status += get_f(stdin, prompt, "c_5", ¶m.nap[i].c_5); IF_OK status += get_f(stdin, prompt, "c_EE", ¶m.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", ¶m.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", ¶m.qic[i].resid ); IF_OK status += get_f(stdin, prompt,"rel_error_for_propagator", ¶m.qic[i].relresid ); IF_OK status += get_i(stdin, prompt,"precision", ¶m.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 */
/* 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", ¶m.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, ¶m.startflag_w[i], param.startfile_w[i]); IF_OK status += get_i(stdin,prompt,"ncolor", ¶m.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(¶m.snk_qs_op[i]); IF_OK status += get_wv_field_op( stdin, prompt, ¶m.snk_qs_op[i]); } else { printf("Unsupported output source type\n"); status++; } } } else { /* Input KS propagator */