double calc_rect_plaq( void ) { int x; int x_p_mu; int x_p_nu; int x_p_nu_m_mu; int x_m_mu; int mu; int nu; su3* u_mu_x; su3* u_nu_x_p_mu; su3* u_mu_x_p_nu; su3* u_mu_x_p_nu_m_mu; su3* u_nu_x_m_mu; su3* u_mu_x_m_mu; su3 tmp1; su3 tmp2; su3 tmp3; double tr; double sum = 0; for( x=0; x<VOLUME; x++ ) for( mu=0; mu<4; mu++ ) for( nu=0; nu<4; nu++ ) if( mu != nu ) { x_p_mu = g_iup[ x ][ mu ]; x_p_nu = g_iup[ x ][ nu ]; x_p_nu_m_mu = g_idn[ x_p_nu ][ mu ]; x_m_mu = g_idn[ x ][ mu ]; u_mu_x = &g_gauge_field[ x ][ mu ]; u_nu_x_p_mu = &g_gauge_field[ x_p_mu ][ nu ]; u_mu_x_p_nu = &g_gauge_field[ x_p_nu ][ mu ]; u_mu_x_p_nu_m_mu = &g_gauge_field[ x_p_nu_m_mu ][ mu ]; u_nu_x_m_mu = &g_gauge_field[ x_m_mu ][ nu ]; u_mu_x_m_mu = &g_gauge_field[ x_m_mu ][ mu ]; _su3_times_su3( tmp1, *u_mu_x_p_nu_m_mu, *u_mu_x_p_nu ); _su3_times_su3( tmp2, *u_nu_x_m_mu, tmp1 ); _su3_times_su3( tmp1, *u_mu_x, *u_nu_x_p_mu ); _su3_times_su3( tmp3, *u_mu_x_m_mu, tmp1 ); _trace_su3_times_su3d( tr, tmp2, tmp3 ); sum += tr; } sum /= ((double)3); return sum; }
double calc_bulk_sq_plaq( void ) { int x; int x_p_mu; int x_p_nu; int mu; int nu; su3* u_mu_x; su3* u_nu_x_p_mu; su3* u_mu_x_p_nu; su3* u_nu_x; su3 tmp1; su3 tmp2; double tr; double sum = 0; /* None of the forward plaquettes for t=T-1 contribute. */ /* None of the forward plaquettes for t=0 contribute. */ /* Also the space-time square for t=T-2 does not contribute. */ for( x=0; x<VOLUME; x++ ) for( mu=0; mu<4; mu++ ) for( nu=0; nu<mu; nu++ ) if( ( g_t[ x ] != (T-1) ) & ( ( g_t[ x ] != (T-2) ) || ( ( mu != 3 ) && ( nu != 3 ) ) ) & ( g_t[ x ] != 0 ) ) { x_p_mu = g_iup[ x ][ mu ]; x_p_nu = g_iup[ x ][ nu ]; u_mu_x = &g_gauge_field[ x ][ mu ]; u_nu_x_p_mu = &g_gauge_field[ x_p_mu ][ nu ]; u_mu_x_p_nu = &g_gauge_field[ x_p_nu ][ mu ]; u_nu_x = &g_gauge_field[ x ][ nu ]; _su3_times_su3( tmp1, *u_nu_x, *u_mu_x_p_nu ); _su3_times_su3( tmp2, *u_mu_x, *u_nu_x_p_mu ); _trace_su3_times_su3d( tr, tmp1, tmp2 ); sum += tr; } sum /= ((double)3); return sum; }
double calc_boundary_space_time_sq_plaq( void ) { int x; int x_p_mu; int x_p_nu; int mu; int nu; su3* u_mu_x; su3* u_nu_x_p_mu; su3* u_mu_x_p_nu; su3* u_nu_x; su3 tmp1; su3 tmp2; double tr; double sum = 0; /* The space-time square for t=T-2 contributes. */ /* The space-time square for t=0 contributes. */ for( x=0; x<VOLUME; x++ ) for( mu=0; mu<4; mu++ ) for( nu=0; nu<mu; nu++ ) if( ( ( g_t[ x ] == (T-2) ) & ( ( mu == 3 ) || ( nu == 3 ) ) ) || ( ( g_t[ x ] == 0 ) & ( ( mu == 3 ) || ( nu == 3 ) ) ) ) { x_p_mu = g_iup[ x ][ mu ]; x_p_nu = g_iup[ x ][ nu ]; u_mu_x = &g_gauge_field[ x ][ mu ]; u_nu_x_p_mu = &g_gauge_field[ x_p_mu ][ nu ]; u_mu_x_p_nu = &g_gauge_field[ x_p_nu ][ mu ]; u_nu_x = &g_gauge_field[ x ][ nu ]; _su3_times_su3( tmp1, *u_nu_x, *u_mu_x_p_nu ); _su3_times_su3( tmp2, *u_mu_x, *u_nu_x_p_mu ); _trace_su3_times_su3d( tr, tmp1, tmp2 ); sum += tr; } sum /= ((double)3); return sum; }
double calc_boundary_space_space_sq_plaq( void ) { int x; int x_p_mu; int x_p_nu; int mu; int nu; su3* u_mu_x; su3* u_nu_x_p_mu; su3* u_mu_x_p_nu; su3* u_nu_x; su3 tmp1; su3 tmp2; double tr; double sum = 0; /* We need the space-space plaquettes for t=T-1 and t=0. */ for( x=0; x<VOLUME; x++ ) for( mu=0; mu<4; mu++ ) for( nu=0; nu<mu; nu++ ) if( ( ( g_t[ x ] == (T-1) ) & ( mu != 3 ) & ( nu != 3 ) ) || ( ( g_t[ x ] == 0 ) & ( mu != 3 ) & ( nu != 3 ) ) ) { x_p_mu = g_iup[ x ][ mu ]; x_p_nu = g_iup[ x ][ nu ]; u_mu_x = &g_gauge_field[ x ][ mu ]; u_nu_x_p_mu = &g_gauge_field[ x_p_mu ][ nu ]; u_mu_x_p_nu = &g_gauge_field[ x_p_nu ][ mu ]; u_nu_x = &g_gauge_field[ x ][ nu ]; _su3_times_su3( tmp1, *u_nu_x, *u_mu_x_p_nu ); _su3_times_su3( tmp2, *u_mu_x, *u_nu_x_p_mu ); _trace_su3_times_su3d( tr, tmp1, tmp2 ); sum += tr; } sum /= ((double)3); return sum; }
double measure_gauge_action(su3 ** const gf) { int ix,ix1,ix2,mu1,mu2; static su3 pr1,pr2; su3 *v,*w; static double ga,ac; #ifdef MPI static double gas; #endif static double ks,kc,tr,ts,tt; if(g_update_gauge_energy) { kc=0.0; ks=0.0; for (ix=0;ix<VOLUME;ix++){ for (mu1=0;mu1<3;mu1++){ ix1=g_iup[ix][mu1]; for (mu2=mu1+1;mu2<4;mu2++){ ix2=g_iup[ix][mu2]; v=&gf[ix][mu1]; w=&gf[ix1][mu2]; _su3_times_su3(pr1,*v,*w); v=&gf[ix][mu2]; w=&gf[ix2][mu1]; _su3_times_su3(pr2,*v,*w); _trace_su3_times_su3d(ac,pr1,pr2); tr=ac+kc; ts=tr+ks; tt=ts-ks; ks=ts; kc=tr-tt; } } } ga=(kc+ks)/3.0; #ifdef MPI MPI_Allreduce(&ga, &gas, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); ga = gas; #endif GaugeInfo.plaquetteEnergy = ga; g_update_gauge_energy = 0; } return ga; }
double calc_wrapped_sq_plaq( void ) { int x; int x_p_mu; int x_p_nu; int mu; int nu; su3* u_mu_x; su3* u_nu_x_p_mu; su3* u_mu_x_p_nu; su3* u_nu_x; su3 tmp1; su3 tmp2; double tr; double sum = 0; for( x=0; x<VOLUME; x++ ) for( mu=0; mu<4; mu++ ) for( nu=0; nu<mu; nu++ ) if( ( g_t[ x ] == (T-1) ) & ( ( mu == 3 ) || ( nu == 3 ) ) ) { x_p_mu = g_iup[ x ][ mu ]; x_p_nu = g_iup[ x ][ nu ]; u_mu_x = &g_gauge_field[ x ][ mu ]; u_nu_x_p_mu = &g_gauge_field[ x_p_mu ][ nu ]; u_mu_x_p_nu = &g_gauge_field[ x_p_nu ][ mu ]; u_nu_x = &g_gauge_field[ x ][ nu ]; _su3_times_su3( tmp1, *u_nu_x, *u_mu_x_p_nu ); _su3_times_su3( tmp2, *u_mu_x, *u_nu_x_p_mu ); _trace_su3_times_su3d( tr, tmp1, tmp2 ); sum += tr; } sum /= ((double)3); return sum; }
double measure_rectangles(const su3 ** const gf) { static double res; #ifdef TM_USE_MPI double ALIGN mres; #endif #ifdef TM_USE_OMP #pragma omp parallel { int thread_num = omp_get_thread_num(); #endif int i, j, k, mu, nu; su3 ALIGN pr1, pr2, tmp; const su3 *v = NULL , *w = NULL; double ALIGN ac, ks, kc, tr, ts, tt; kc = 0.0; ks = 0.0; #ifdef TM_USE_OMP #pragma omp for #endif for (i = 0; i < VOLUME; i++) { for (mu = 0; mu < 4; mu++) { for (nu = 0; nu < 4; nu++) { if(nu != mu) { /* ^ | ^ | -> */ j = g_iup[i][mu]; k = g_iup[j][nu]; v = &gf[i][mu]; w = &gf[j][nu]; _su3_times_su3(tmp, *v, *w); v = &gf[k][nu]; _su3_times_su3(pr1, tmp, *v); /* -> ^ | ^ | */ j = g_iup[i][nu]; k = g_iup[j][nu]; v = &gf[i][nu]; w = &gf[j][nu]; _su3_times_su3(tmp, *v, *w); v = &gf[k][mu]; _su3_times_su3(pr2, tmp, *v); /* Trace it */ _trace_su3_times_su3d(ac,pr1,pr2); /* printf("i mu nu: %d %d %d, ac = %e\n", i, mu, nu, ac); */ /* Kahan summation */ tr=ac+kc; ts=tr+ks; tt=ts-ks; ks=ts; kc=tr-tt; } } } } kc=(kc+ks)/3.0; #ifdef TM_USE_OMP g_omp_acc_re[thread_num] = kc; #else res = kc; #endif #ifdef TM_USE_OMP } /* OpenMP parallel closing brace */ res = 0.0; for(int i = 0; i < omp_num_threads; ++i) res += g_omp_acc_re[i]; #else #endif #ifdef TM_USE_MPI MPI_Allreduce(&res, &mres, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); res = mres; #endif return res; }
double measure_gauge_action(const su3 ** const gf) { static double res; #ifdef MPI double ALIGN mres; #endif #ifdef OMP #pragma omp parallel { int thread_num = omp_get_thread_num(); #endif int ix,ix1,ix2,mu1,mu2; su3 ALIGN pr1,pr2; const su3 *v,*w; double ALIGN ac,ks,kc,tr,ts,tt; if(g_update_gauge_energy) { kc=0.0; ks=0.0; #ifdef OMP #pragma omp for #endif for (ix=0;ix<VOLUME;ix++){ for (mu1=0;mu1<3;mu1++){ ix1=g_iup[ix][mu1]; for (mu2=mu1+1;mu2<4;mu2++){ ix2=g_iup[ix][mu2]; v=&gf[ix][mu1]; w=&gf[ix1][mu2]; _su3_times_su3(pr1,*v,*w); v=&gf[ix][mu2]; w=&gf[ix2][mu1]; _su3_times_su3(pr2,*v,*w); _trace_su3_times_su3d(ac,pr1,pr2); tr=ac+kc; ts=tr+ks; tt=ts-ks; ks=ts; kc=tr-tt; } } } kc=(kc+ks)/3.0; #ifdef OMP g_omp_acc_re[thread_num] = kc; #else res = kc; #endif } #ifdef OMP } /* OpenMP parallel closing brace */ if(g_update_gauge_energy) { res = 0.0; for(int i=0; i < omp_num_threads; ++i) res += g_omp_acc_re[i]; #else if(g_update_gauge_energy) { #endif #ifdef MPI MPI_Allreduce(&res, &mres, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); res = mres; #endif GaugeInfo.plaquetteEnergy = res; g_update_gauge_energy = 0; } return res; }
double measure_rectangles() { int i, j, k, mu, nu; static su3 pr1, pr2, tmp; su3 *v = NULL , *w = NULL; static double ga, ac; #ifdef MPI static double gas; #endif static double ks, kc, tr, ts, tt; kc=0.0; ks=0.0; if(g_update_rectangle_energy) { for (i = 0; i < VOLUME; i++) { for (mu = 0; mu < 4; mu++) { for (nu = 0; nu < 4; nu++) { if(nu != mu) { /* ^ | ^ | -> */ j = g_iup[i][mu]; k = g_iup[j][nu]; v = &g_gauge_field[i][mu]; w = &g_gauge_field[j][nu]; _su3_times_su3(tmp, *v, *w); v = &g_gauge_field[k][nu]; _su3_times_su3(pr1, tmp, *v); /* -> ^ | ^ | */ j = g_iup[i][nu]; k = g_iup[j][nu]; v = &g_gauge_field[i][nu]; w = &g_gauge_field[j][nu]; _su3_times_su3(tmp, *v, *w); v = &g_gauge_field[k][mu]; _su3_times_su3(pr2, tmp, *v); /* Trace it */ _trace_su3_times_su3d(ac,pr1,pr2); /* printf("i mu nu: %d %d %d, ac = %e\n", i, mu, nu, ac); */ /* Kahan summation */ tr=ac+kc; ts=tr+ks; tt=ts-ks; ks=ts; kc=tr-tt; } } } } ga=(kc+ks)/3.0; #ifdef MPI MPI_Allreduce(&ga, &gas, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); ga = gas; #endif g_update_rectangle_energy = 0; } return ga; }
double measure_rectangles() { int i, j, k, mu, nu; int x, y, z, t; static su3 pr1, pr2, tmp; su3 *v = NULL , *w = NULL; static double ga, ac, gas; static double ks, kc, tr, ts, tt; kc=0.0; ks=0.0; double d = 0.; FILE * debugfile; char filename[100]; sprintf(filename,"debug_mr.s"); #ifdef PARALLELT sprintf(filename,"debug_mr.pt.%d", g_proc_id); #endif #ifdef PARALLELXT sprintf(filename,"debug_mr.pxt.%d", g_proc_id); #endif debugfile = fopen(filename,"w"); for(x = 0; x < LX; x++) { for(y = 0; y < LY; y++) { for(z = 0; z < LZ; z++) { for(t = 0; t < T; t++) { i = g_ipt[t][x][y][z]; for (mu = 0; mu < 4; mu++) { d = 0.; for (nu = 0; nu < 4; nu++) { if(nu != mu) { /* ^ | ^ | -> */ j = g_iup[i][mu]; k = g_iup[j][nu]; v = &g_gauge_field[i][mu]; w = &g_gauge_field[j][nu]; _su3_times_su3(tmp, *v, *w); v = &g_gauge_field[k][nu]; _su3_times_su3(pr1, tmp, *v); /* -> ^ | ^ | */ j = g_iup[i][nu]; k = g_iup[j][nu]; v = &g_gauge_field[i][nu]; w = &g_gauge_field[j][nu]; _su3_times_su3(tmp, *v, *w); v = &g_gauge_field[k][mu]; _su3_times_su3(pr2, tmp, *v); /* Trace it */ _trace_su3_times_su3d(ac,pr1,pr2); d += ac; /* printf("i mu nu: %d %d %d, ac = %e\n", i, mu, nu, ac); */ /* Kahan summation */ tr=ac+kc; ts=tr+ks; tt=ts-ks; ks=ts; kc=tr-tt; } } fprintf(debugfile,"%d %d %d %d %d %e\n", g_proc_coords[0]*T+t, g_proc_coords[1]*LX+x, y, z, mu, d); } } } } } /* fprintf(debugfile,"###\n"); */ fclose(debugfile); ga=(kc+ks)/3.0; #ifdef TM_USE_MPI MPI_Allreduce(&ga, &gas, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); return gas; #else return ga; #endif }