int main(){ su3_matrix FW, U, V, W, Fdiag, ILambda; int i,j; printf("Enter V\n"); for(i = 0; i < 3; i++) for(j = 0; j < 3; j++) scanf("%lf %lf",&V.e[i][j].real, &V.e[i][j].imag); printf("Enter U\n"); for(i = 0; i < 3; i++) for(j = 0; j < 3; j++) scanf("%lf %lf",&U.e[i][j].real, &U.e[i][j].imag); printf("Enter FW\n"); for(i = 0; i < 3; i++) for(j = 0; j < 3; j++) scanf("%lf %lf",&FW.e[i][j].real, &FW.e[i][j].imag); stout_smear( &W, &V, &U); printf("Result W\n"); for(i = 0; i < 3; i++){ for(j = 0; j < 3; j++) printf("(%f, %f) ",W.e[i][j].real, W.e[i][j].imag); printf("\n"); } stout_force_terms(&Fdiag, &ILambda, &V, &U, &FW); printf("Result Fdiag\n"); for(i = 0; i < 3; i++){ for(j = 0; j < 3; j++) printf("(%f, %f) ",Fdiag.e[i][j].real, Fdiag.e[i][j].imag); printf("\n"); } printf("Result ILambda\n"); for(i = 0; i < 3; i++){ for(j = 0; j < 3; j++) printf("(%f, %f) ",ILambda.e[i][j].real, ILambda.e[i][j].imag); printf("\n"); } }
int main(int argc,char *argv[]) { FILE *parameterfile=NULL; int c, j, is=0, ic=0; int x, X, y, Y, z, Z, t, tt, i, sum; char * filename = NULL; char datafilename[50]; char parameterfilename[50]; char conf_filename[50]; char * input_filename = NULL; double plaquette_energy, nrm; double * norm; struct stout_parameters params_smear; #ifdef _GAUGE_COPY int kb=0; #endif #ifdef MPI double atime=0., etime=0.; #endif #ifdef _KOJAK_INST #pragma pomp inst init #pragma pomp inst begin(main) #endif DUM_DERI = 6; /* DUM_DERI + 2 is enough (not 7) */ DUM_SOLVER = DUM_DERI+2; DUM_MATRIX = DUM_SOLVER+6; /* DUM_MATRIX + 2 is enough (not 6) */ NO_OF_SPINORFIELDS = DUM_MATRIX+2; verbose = 0; g_use_clover_flag = 0; g_nr_of_psf = 1; #ifdef MPI MPI_Init(&argc, &argv); #endif while ((c = getopt(argc, argv, "h?f:o:")) != -1) { switch (c) { case 'f': input_filename = calloc(200, sizeof(char)); strcpy(input_filename,optarg); break; case 'o': filename = calloc(200, sizeof(char)); strcpy(filename,optarg); break; case 'h': case '?': default: usage(); break; } } if(input_filename == NULL){ input_filename = "hmc.input"; } if(filename == NULL){ filename = "output"; } /* Read the input file */ read_input(input_filename); /* here we want no even/odd preconditioning */ even_odd_flag = 0; /* this DBW2 stuff is not needed for the inversion ! */ g_rgi_C1 = 0; if(Nsave == 0){ Nsave = 1; } tmlqcd_mpi_init(argc, argv); g_dbw2rand = 0; #ifndef MPI g_dbw2rand = 0; #endif #ifdef _GAUGE_COPY j = init_gauge_field(VOLUMEPLUSRAND, 1); #else j = init_gauge_field(VOLUMEPLUSRAND, 0); #endif if ( j!= 0) { fprintf(stderr, "Not enough memory for gauge_fields! Aborting...\n"); exit(-1); } j = init_geometry_indices(VOLUMEPLUSRAND); if ( j!= 0) { fprintf(stderr, "Not enough memory for geometry indices! Aborting...\n"); exit(-1); } if(even_odd_flag) { j = init_spinor_field(VOLUMEPLUSRAND/2, NO_OF_SPINORFIELDS); } else { j = init_spinor_field(VOLUMEPLUSRAND, NO_OF_SPINORFIELDS); } if ( j!= 0) { fprintf(stderr, "Not enough memory for spinor fields! Aborting...\n"); exit(-1); } g_mu = g_mu1; if(g_proc_id == 0){ /*construct the filenames for the observables and the parameters*/ strcpy(datafilename,filename); strcat(datafilename,".data"); strcpy(parameterfilename,filename); strcat(parameterfilename,".para"); parameterfile=fopen(parameterfilename, "w"); write_first_messages(parameterfile, 0, 1); } /* define the geometry */ geometry(); /* define the boundary conditions for the fermion fields */ boundary(); #ifdef _USE_HALFSPINOR j = init_dirac_halfspinor(); if ( j!= 0) { fprintf(stderr, "Not enough memory for halffield! Aborting...\n"); exit(-1); } if(g_sloppy_precision_flag == 1) { j = init_dirac_halfspinor32(); if ( j!= 0) { fprintf(stderr, "Not enough memory for 32-Bit halffield! Aborting...\n"); exit(-1); } } # if (defined _PERSISTENT) init_xchange_halffield(); # endif #endif norm = (double*)calloc(3.*LX/2.+T/2., sizeof(double)); for(j=0;j<Nmeas; j++) { sprintf(conf_filename,"%s.%.4d", gauge_input_filename, nstore); if (g_proc_id == 0){ printf("Reading Gauge field from file %s\n", conf_filename); fflush(stdout); } read_lime_gauge_field(conf_filename); if (g_proc_id == 0){ printf("done!\n"); fflush(stdout); } #ifdef MPI xchange_gauge(); #endif #ifdef _GAUGE_COPY update_backward_gauge(); #endif /* Compute minimal eigenvalues, if wanted */ if(compute_evs != 0) { eigenvalues(&no_eigenvalues, 1000, eigenvalue_precision, 0, compute_evs, nstore, even_odd_flag); } /*compute the energy of the gauge field*/ plaquette_energy = measure_gauge_action(); if(g_proc_id == 0) { printf("The plaquette value is %e\n", plaquette_energy/(6.*VOLUME*g_nproc)); fflush(stdout); } if (use_stout_flag == 1){ params_smear.rho = stout_rho; params_smear.iterations = stout_no_iter; if (stout_smear((su3_tuple*)(g_gauge_field[0]), ¶ms_smear, (su3_tuple*)(g_gauge_field[0])) != 0) exit(1) ; g_update_gauge_copy = 1; g_update_gauge_energy = 1; g_update_rectangle_energy = 1; plaquette_energy = measure_gauge_action(); if (g_proc_id == 0) { printf("# The plaquette value after stouting is %e\n", plaquette_energy / (6.*VOLUME*g_nproc)); fflush(stdout); } } source_spinor_field(g_spinor_field[0], g_spinor_field[1], 0, 0); convert_eo_to_lexic(g_spinor_field[DUM_DERI], g_spinor_field[0], g_spinor_field[1]); D_psi(g_spinor_field[DUM_DERI+1], g_spinor_field[DUM_DERI]); if(even_odd_flag) { i = invert_eo(g_spinor_field[2], g_spinor_field[3], g_spinor_field[0], g_spinor_field[1], solver_precision, max_solver_iterations, solver_flag, g_relative_precision_flag, sub_evs_cg_flag, even_odd_flag); convert_eo_to_lexic(g_spinor_field[DUM_DERI+1], g_spinor_field[2], g_spinor_field[3]); } for(i = 0; i < 3*LX/2+T/2; i++){ norm[i] = 0.; } for(x = 0; x < LX; x++){ if(x > LX/2) X = LX-x; else X = x; for(y = 0; y < LY; y++){ if(y > LY/2) Y = LY-y; else Y = y; for(z = 0; z < LZ; z++){ if(z > LZ/2) Z = LZ-z; else Z = z; for(t = 0; t < T; t++){ if(t > T/2) tt = T - t; else tt = t; sum = X + Y + Z + tt; _spinor_norm_sq(nrm, g_spinor_field[DUM_DERI+1][ g_ipt[t][x][y][z] ]); /* _spinor_norm_sq(nrm, qprop[0][0][1][ g_ipt[t][x][y][z] ]); */ printf("%e %e\n", g_spinor_field[DUM_DERI+1][ g_ipt[t][x][y][z] ].s0.c0.re, g_spinor_field[DUM_DERI+1][ g_ipt[t][x][y][z] ].s0.c0.im); nrm = sqrt( nrm ); printf("%1.12e\n", nrm); if(nrm > norm[sum]) norm[sum] = nrm; } } } } for(i = 0; i < 3*L/2+T/2; i++){ printf("%d %1.12e\n", i, norm[i]); } printf("\n"); nstore+=Nsave; } #ifdef MPI MPI_Finalize(); #endif free_gauge_field(); free_geometry_indices(); free_spinor_field(); free_moment_field(); return(0); #ifdef _KOJAK_INST #pragma pomp inst end(main) #endif }
static void load_Y_from_V(info_t *info, hisq_auxiliary_t *aux, int umethod){ int dir,i; su3_matrix tmat; su3_matrix *U_link = aux->U_link; su3_matrix *V_link = aux->V_link; su3_matrix *Y_unitlink = aux->Y_unitlink; /* Temporary. FIX THIS! */ int r0[4] = {0, 0, 0, 0}; double dtime; dtime=-dclock(); int nhits = 100; // this is just a guess Real tol = 1.0e-5; // this is just a guess info->final_flop = 0.; switch(umethod){ case UNITARIZE_NONE: //node0_printf("WARNING: UNITARIZE_NONE\n"); FORALLFIELDSITES_OMP(i,private(dir))for(dir=XUP;dir<=TUP;dir++) Y_unitlink[4*i+dir] = V_link[4*i+dir]; END_LOOP_OMP; break; case UNITARIZE_APE: node0_printf("UNITARIZE_APE: derivative is not ready for this method\n"); terminate(0); FORALLFIELDSITES_OMP(i,private(dir,tmat))for(dir=XUP;dir<=TUP;dir++){ /* Use partially reunitarized link for guess */ tmat = V_link[4*i+dir]; reunit_su3(&tmat); project_su3(&tmat, &(V_link[4*i+dir]), nhits, tol); Y_unitlink[4*i+dir] = tmat; } END_LOOP_OMP; break; case UNITARIZE_ROOT: //node0_printf("WARNING: UNITARIZE_ROOT is performed\n"); // REPHASING IS NOT NEEDED IN THIS ROUTINE BUT THIS // HAS TO BE CHECKED FIRST FOR NONTRIVIAL V_link ARRAYS /* rephase (out) V_link array */ rephase_field_offset( V_link, OFF, NULL , r0); FORALLFIELDSITES_OMP(i,private(dir,tmat))for(dir=XUP;dir<=TUP;dir++){ /* unitarize - project on U(3) */ u3_unitarize( &( V_link[4*i+dir] ), &tmat ); Y_unitlink[4*i+dir] = tmat; } END_LOOP_OMP; /* rephase (in) Y_unitlink array */ rephase_field_offset( Y_unitlink, ON, NULL , r0); //printf("UNITARIZATION RESULT\n"); //dumpmat( &( V_link[TUP][3] ) ); //dumpmat( &( Y_unitlink[TUP][3] ) ); break; case UNITARIZE_RATIONAL: //node0_printf("WARNING: UNITARIZE_RATIONAL is performed\n"); // REPHASING IS NOT NEEDED IN THIS ROUTINE BUT THIS // HAS TO BE CHECKED FIRST FOR NONTRIVIAL V_link ARRAYS /* rephase (out) V_link array */ rephase_field_offset( V_link, OFF, NULL , r0); FORALLFIELDSITES_OMP(i,private(dir,tmat))for(dir=XUP;dir<=TUP;dir++){ /* unitarize - project on U(3) */ u3_unitarize_rational( &( V_link[4*i+dir] ), &tmat ); Y_unitlink[4*i+dir] = tmat; } END_LOOP_OMP; rephase_field_offset( V_link, ON, NULL , r0); /* rephase (in) Y_unitlink array */ rephase_field_offset( Y_unitlink, ON, NULL , r0); //printf("UNITARIZATION RESULT\n"); //dumpmat( &( V_link[TUP][3] ) ); //dumpmat( &( Y_unitlink[TUP][3] ) ); break; case UNITARIZE_ANALYTIC: //node0_printf("WARNING: UNITARIZE_ANALYTIC is performed\n"); // REPHASING IS NOT NEEDED IN THIS ROUTINE BUT THIS // HAS TO BE CHECKED FIRST FOR NONTRIVIAL V_link ARRAYS /* rephase (out) V_link array */ rephase_field_offset( V_link, OFF, NULL , r0); FORALLFIELDSITES_OMP(i,private(dir,tmat))for(dir=XUP;dir<=TUP;dir++){ /* unitarize - project on U(3) */ #ifdef MILC_GLOBAL_DEBUG #ifdef HISQ_REUNITARIZATION_DEBUG u3_unitarize_analytic_index( &( V_link[4*i+dir] ), &tmat, i, dir ); #else /* HISQ_REUNITARIZATION_DEBUG */ u3_unitarize_analytic( info, &( V_link[4*i+dir] ), &tmat ); #endif /* HISQ_REUNITARIZATION_DEBUG */ #else /* MILC_GLOBAL_DEBUG */ u3_unitarize_analytic( info, &( V_link[4*i+dir] ), &tmat ); #endif /* MILC_GLOBAL_DEBUG */ Y_unitlink[4*i+dir] = tmat; } END_LOOP_OMP; /* rephase (in) V_link array */ rephase_field_offset( V_link, ON, NULL , r0); /* rephase (in) Y_unitlink array */ rephase_field_offset( Y_unitlink, ON, NULL , r0); //printf("UNITARIZATION RESULT\n"); //dumpmat( &( V_link[TUP][3] ) ); //dumpmat( &( Y_unitlink[TUP][3] ) ); break; case UNITARIZE_STOUT: rephase_field_offset( U_link, OFF, NULL , r0); rephase_field_offset( V_link, OFF, NULL , r0); FORALLFIELDSITES_OMP(i,private(dir))for(dir=XUP;dir<=TUP;dir++){ /* unitarize - project on SU(3) with "stout" procedure */ stout_smear( &( Y_unitlink[4*i+dir] ), &( V_link[4*i+dir] ), &( U_link[4*i+dir] ) ); } END_LOOP_OMP; rephase_field_offset( U_link, ON, NULL , r0); rephase_field_offset( V_link, ON, NULL , r0); /* rephase (in) Y_unitlink array */ rephase_field_offset( Y_unitlink, ON, NULL , r0); //printf("UNITARIZATION RESULT\n"); //dumpmat( &( V_link[TUP][3] ) ); //dumpmat( &( Y_unitlink[TUP][3] ) ); break; case UNITARIZE_HISQ: node0_printf("UNITARIZE_HISQ: not ready!\n"); terminate(0); break; default: node0_printf("Unknown unitarization method\n"); terminate(0); } /* umethod */ dtime += dclock(); info->final_sec = dtime; }
int main(int argc, char *argv[]) { FILE *parameterfile = NULL; int c, j, i, ix = 0, isample = 0, op_id = 0; char * filename = NULL; char datafilename[50]; char parameterfilename[50]; char conf_filename[50]; char * input_filename = NULL; double plaquette_energy; struct stout_parameters params_smear; spinor **s, *s_; #ifdef _KOJAK_INST #pragma pomp inst init #pragma pomp inst begin(main) #endif #if (defined SSE || defined SSE2 || SSE3) signal(SIGILL, &catch_ill_inst); #endif DUM_DERI = 8; DUM_MATRIX = DUM_DERI + 5; NO_OF_SPINORFIELDS = DUM_MATRIX + 2; verbose = 0; g_use_clover_flag = 0; #ifdef MPI MPI_Init(&argc, &argv); #endif while ((c = getopt(argc, argv, "h?vVf:o:")) != -1) { switch (c) { case 'f': input_filename = calloc(200, sizeof(char)); strcpy(input_filename, optarg); break; case 'o': filename = calloc(200, sizeof(char)); strcpy(filename, optarg); break; case 'v': verbose = 1; break; case 'V': fprintf(stdout,"%s %s\n",PACKAGE_STRING,git_hash); exit(0); break; case 'h': case '?': default: usage(); break; } } if (input_filename == NULL) { input_filename = "invert.input"; } if (filename == NULL) { filename = "output"; } /* Read the input file */ if( (j = read_input(input_filename)) != 0) { fprintf(stderr, "Could not find input file: %s\nAborting...\n", input_filename); exit(-1); } /* this DBW2 stuff is not needed for the inversion ! */ if (g_dflgcr_flag == 1) { even_odd_flag = 0; } g_rgi_C1 = 0; if (Nsave == 0) { Nsave = 1; } if (g_running_phmc) { NO_OF_SPINORFIELDS = DUM_MATRIX + 8; } tmlqcd_mpi_init(argc, argv); g_dbw2rand = 0; /* starts the single and double precision random number */ /* generator */ start_ranlux(rlxd_level, random_seed); /* we need to make sure that we don't have even_odd_flag = 1 */ /* if any of the operators doesn't use it */ /* in this way even/odd can still be used by other operators */ for(j = 0; j < no_operators; j++) if(!operator_list[j].even_odd_flag) even_odd_flag = 0; #ifndef MPI g_dbw2rand = 0; #endif #ifdef _GAUGE_COPY j = init_gauge_field(VOLUMEPLUSRAND, 1); #else j = init_gauge_field(VOLUMEPLUSRAND, 0); #endif if (j != 0) { fprintf(stderr, "Not enough memory for gauge_fields! Aborting...\n"); exit(-1); } j = init_geometry_indices(VOLUMEPLUSRAND); if (j != 0) { fprintf(stderr, "Not enough memory for geometry indices! Aborting...\n"); exit(-1); } if (no_monomials > 0) { if (even_odd_flag) { j = init_monomials(VOLUMEPLUSRAND / 2, even_odd_flag); } else { j = init_monomials(VOLUMEPLUSRAND, even_odd_flag); } if (j != 0) { fprintf(stderr, "Not enough memory for monomial pseudo fermion fields! Aborting...\n"); exit(-1); } } if (even_odd_flag) { j = init_spinor_field(VOLUMEPLUSRAND / 2, NO_OF_SPINORFIELDS); } else { j = init_spinor_field(VOLUMEPLUSRAND, NO_OF_SPINORFIELDS); } if (j != 0) { fprintf(stderr, "Not enough memory for spinor fields! Aborting...\n"); exit(-1); } if (g_running_phmc) { j = init_chi_spinor_field(VOLUMEPLUSRAND / 2, 20); if (j != 0) { fprintf(stderr, "Not enough memory for PHMC Chi fields! Aborting...\n"); exit(-1); } } g_mu = g_mu1; if (g_cart_id == 0) { /*construct the filenames for the observables and the parameters*/ strcpy(datafilename, filename); strcat(datafilename, ".data"); strcpy(parameterfilename, filename); strcat(parameterfilename, ".para"); parameterfile = fopen(parameterfilename, "w"); write_first_messages(parameterfile, 1); fclose(parameterfile); } /* define the geometry */ geometry(); /* define the boundary conditions for the fermion fields */ boundary(g_kappa); phmc_invmaxev = 1.; init_operators(); /* this could be maybe moved to init_operators */ #ifdef _USE_HALFSPINOR j = init_dirac_halfspinor(); if (j != 0) { fprintf(stderr, "Not enough memory for halffield! Aborting...\n"); exit(-1); } if (g_sloppy_precision_flag == 1) { j = init_dirac_halfspinor32(); if (j != 0) { fprintf(stderr, "Not enough memory for 32-bit halffield! Aborting...\n"); exit(-1); } } # if (defined _PERSISTENT) if (even_odd_flag) init_xchange_halffield(); # endif #endif for (j = 0; j < Nmeas; j++) { sprintf(conf_filename, "%s.%.4d", gauge_input_filename, nstore); if (g_cart_id == 0) { printf("#\n# Trying to read gauge field from file %s in %s precision.\n", conf_filename, (gauge_precision_read_flag == 32 ? "single" : "double")); fflush(stdout); } if( (i = read_gauge_field(conf_filename)) !=0) { fprintf(stderr, "Error %d while reading gauge field from %s\n Aborting...\n", i, conf_filename); exit(-2); } if (g_cart_id == 0) { printf("# Finished reading gauge field.\n"); fflush(stdout); } #ifdef MPI xchange_gauge(); #endif /*compute the energy of the gauge field*/ plaquette_energy = measure_gauge_action(); if (g_cart_id == 0) { printf("# The computed plaquette value is %e.\n", plaquette_energy / (6.*VOLUME*g_nproc)); fflush(stdout); } if (use_stout_flag == 1){ params_smear.rho = stout_rho; params_smear.iterations = stout_no_iter; if (stout_smear((su3_tuple*)(g_gauge_field[0]), ¶ms_smear, (su3_tuple*)(g_gauge_field[0])) != 0) exit(1) ; g_update_gauge_copy = 1; g_update_gauge_energy = 1; g_update_rectangle_energy = 1; plaquette_energy = measure_gauge_action(); if (g_cart_id == 0) { printf("# The plaquette value after stouting is %e\n", plaquette_energy / (6.*VOLUME*g_nproc)); fflush(stdout); } } if (reweighting_flag == 1) { reweighting_factor(reweighting_samples, nstore); } /* Compute minimal eigenvalues, if wanted */ if (compute_evs != 0) { eigenvalues(&no_eigenvalues, 5000, eigenvalue_precision, 0, compute_evs, nstore, even_odd_flag); } if (phmc_compute_evs != 0) { #ifdef MPI MPI_Finalize(); #endif return(0); } /* Compute the mode number or topological susceptibility using spectral projectors, if wanted*/ if(compute_modenumber != 0 || compute_topsus !=0){ s_ = calloc(no_sources_z2*VOLUMEPLUSRAND+1, sizeof(spinor)); s = calloc(no_sources_z2, sizeof(spinor*)); if(s_ == NULL) { printf("Not enough memory in %s: %d",__FILE__,__LINE__); exit(42); } if(s == NULL) { printf("Not enough memory in %s: %d",__FILE__,__LINE__); exit(42); } for(i = 0; i < no_sources_z2; i++) { #if (defined SSE3 || defined SSE2 || defined SSE) s[i] = (spinor*)(((unsigned long int)(s_)+ALIGN_BASE)&~ALIGN_BASE)+i*VOLUMEPLUSRAND; #else s[i] = s_+i*VOLUMEPLUSRAND; #endif z2_random_spinor_field(s[i], VOLUME); /* what is this here needed for?? */ /* spinor *aux_,*aux; */ /* #if ( defined SSE || defined SSE2 || defined SSE3 ) */ /* aux_=calloc(VOLUMEPLUSRAND+1, sizeof(spinor)); */ /* aux = (spinor *)(((unsigned long int)(aux_)+ALIGN_BASE)&~ALIGN_BASE); */ /* #else */ /* aux_=calloc(VOLUMEPLUSRAND, sizeof(spinor)); */ /* aux = aux_; */ /* #endif */ if(g_proc_id == 0) { printf("source %d \n", i); } if(compute_modenumber != 0){ mode_number(s[i], mstarsq); } if(compute_topsus !=0) { top_sus(s[i], mstarsq); } } free(s); free(s_); } /* move to operators as well */ if (g_dflgcr_flag == 1) { /* set up deflation blocks */ init_blocks(nblocks_t, nblocks_x, nblocks_y, nblocks_z); /* the can stay here for now, but later we probably need */ /* something like init_dfl_solver called somewhere else */ /* create set of approximate lowest eigenvectors ("global deflation subspace") */ /* g_mu = 0.; */ /* boundary(0.125); */ generate_dfl_subspace(g_N_s, VOLUME); /* boundary(g_kappa); */ /* g_mu = g_mu1; */ /* Compute little Dirac operators */ /* alt_block_compute_little_D(); */ if (g_debug_level > 0) { check_projectors(); check_local_D(); } if (g_debug_level > 1) { check_little_D_inversion(); } } if(SourceInfo.type == 1) { index_start = 0; index_end = 1; } g_precWS=NULL; if(use_preconditioning == 1){ /* todo load fftw wisdom */ #if (defined HAVE_FFTW ) && !( defined MPI) loadFFTWWisdom(g_spinor_field[0],g_spinor_field[1],T,LX); #else use_preconditioning=0; #endif } if (g_cart_id == 0) { fprintf(stdout, "#\n"); /*Indicate starting of the operator part*/ } for(op_id = 0; op_id < no_operators; op_id++) { boundary(operator_list[op_id].kappa); g_kappa = operator_list[op_id].kappa; g_mu = 0.; if(use_preconditioning==1 && PRECWSOPERATORSELECT[operator_list[op_id].solver]!=PRECWS_NO ){ printf("# Using preconditioning with treelevel preconditioning operator: %s \n", precWSOpToString(PRECWSOPERATORSELECT[operator_list[op_id].solver])); /* initial preconditioning workspace */ operator_list[op_id].precWS=(spinorPrecWS*)malloc(sizeof(spinorPrecWS)); spinorPrecWS_Init(operator_list[op_id].precWS, operator_list[op_id].kappa, operator_list[op_id].mu/2./operator_list[op_id].kappa, -(0.5/operator_list[op_id].kappa-4.), PRECWSOPERATORSELECT[operator_list[op_id].solver]); g_precWS = operator_list[op_id].precWS; if(PRECWSOPERATORSELECT[operator_list[op_id].solver] == PRECWS_D_DAGGER_D) { fitPrecParams(op_id); } } for(isample = 0; isample < no_samples; isample++) { for (ix = index_start; ix < index_end; ix++) { if (g_cart_id == 0) { fprintf(stdout, "#\n"); /*Indicate starting of new index*/ } /* we use g_spinor_field[0-7] for sources and props for the moment */ /* 0-3 in case of 1 flavour */ /* 0-7 in case of 2 flavours */ prepare_source(nstore, isample, ix, op_id, read_source_flag, source_location); operator_list[op_id].inverter(op_id, index_start); } } if(use_preconditioning==1 && operator_list[op_id].precWS!=NULL ){ /* free preconditioning workspace */ spinorPrecWS_Free(operator_list[op_id].precWS); free(operator_list[op_id].precWS); } if(operator_list[op_id].type == OVERLAP){ free_Dov_WS(); } } nstore += Nsave; } #ifdef MPI MPI_Finalize(); #endif free_blocks(); free_dfl_subspace(); free_gauge_field(); free_geometry_indices(); free_spinor_field(); free_moment_field(); free_chi_spinor_field(); return(0); #ifdef _KOJAK_INST #pragma pomp inst end(main) #endif }
// Evolve momenta according to the rooted staggered force THREADABLE_FUNCTION_7ARG(evolve_momenta_with_quark_force, quad_su3**,H, quad_su3**,conf, std::vector<std::vector<pseudofermion_t> >*,pf, theory_pars_t*,theory_pars, hmc_evol_pars_t*,simul_pars, std::vector<rat_approx_t>*,rat_appr, double,dt) { GET_THREAD_ID(); verbosity_lv2_master_printf("Evolving momenta with quark force, dt=%lg\n",dt); //allocate forces quad_su3 *F[2]={nissa_malloc("F0",loc_volh,quad_su3),nissa_malloc("F1",loc_volh,quad_su3)}; //compute the force compute_quark_force(F,conf,pf,theory_pars,rat_appr,simul_pars->md_residue); //#define DEBUG #ifdef DEBUG int par=1,ieo=1,mu=1; double eps=1e-5; //store initial link su3 sto; su3_copy(sto,conf[par][ieo][mu]); //allocate smeared conf quad_su3 *sme_conf[2]; for(int eo=0;eo<2;eo++) sme_conf[eo]=nissa_malloc("sme_conf",loc_volh+bord_volh+edge_volh,quad_su3); //compute action before double act_ori; stout_smear(sme_conf,conf,&(theory_pars->stout_pars)); rootst_eoimpr_quark_action(&act_ori,sme_conf,theory_pars->nflavs,theory_pars->backfield,pf,simul_pars); //store derivative su3 nu_plus,nu_minus; su3_put_to_zero(nu_plus); su3_put_to_zero(nu_minus); for(int igen=0;igen<NCOL*NCOL-1;igen++) { //prepare increment and change su3 ba; su3_prod_double(ba,gell_mann_matr[igen],eps/2); su3 exp_mod; safe_hermitian_exact_i_exponentiate(exp_mod,ba); //change -, compute action unsafe_su3_dag_prod_su3(conf[par][ieo][mu],exp_mod,sto); double act_minus; stout_smear(sme_conf,conf,&(theory_pars->stout_pars)); rootst_eoimpr_quark_action(&act_minus,sme_conf,theory_pars->nflavs,theory_pars->backfield,pf,simul_pars); //change +, compute action unsafe_su3_prod_su3(conf[par][ieo][mu],exp_mod,sto); double act_plus; stout_smear(sme_conf,conf,&(theory_pars->stout_pars)); rootst_eoimpr_quark_action(&act_plus,sme_conf,theory_pars->nflavs,theory_pars->backfield,pf,simul_pars); //set back everything su3_copy(conf[par][ieo][mu],sto); //printf("plus: %+016.016le, ori: %+016.016le, minus: %+016.016le, eps: %lg\n",act_plus,act_ori,act_minus,eps); double gr_plus=-(act_plus-act_ori)/eps; double gr_minus=-(act_ori-act_minus)/eps; su3_summ_the_prod_idouble(nu_plus,gell_mann_matr[igen],gr_plus); su3_summ_the_prod_idouble(nu_minus,gell_mann_matr[igen],gr_minus); } //take the average su3 nu; su3_summ(nu,nu_plus,nu_minus); su3_prodassign_double(nu,0.5); master_printf("checking pure gauge force\n"); master_printf("an\n"); su3_print(F[par][ieo][mu]); master_printf("nu\n"); su3_print(nu); master_printf("nu_plus\n"); su3_print(nu_plus); master_printf("nu_minus\n"); su3_print(nu_minus); //crash("anna"); #endif //evolve for(int par=0;par<2;par++) { NISSA_PARALLEL_LOOP(ivol,0,loc_volh) for(int mu=0;mu<NDIM;mu++) for(int ic1=0;ic1<NCOL;ic1++) for(int ic2=0;ic2<NCOL;ic2++) complex_subt_the_prod_idouble(H[par][ivol][mu][ic1][ic2],F[par][ivol][mu][ic1][ic2],dt); nissa_free(F[par]); } }