Пример #1
0
void unit_g_gauge_field(void) {
  int ix,mu;

  for (ix=0;ix<VOLUME;ix++) {
    for (mu=0;mu<4;mu++) {
      g_gauge_field[ix][mu]=unit_su3();
    }
  }
  g_update_gauge_copy = 1;
  g_update_gauge_energy = 1;
  g_update_rectangle_energy = 1;
  return;
}
Пример #2
0
/*
  Set the trafo field for a temporal gauge 
  g(t=0) == ID 
  other g's are determined recursively from U (gfield) requiering that U^{'}_0 != ID
  => only the U(t=T-1) are not ID!!
*/
int init_temporalgauge_trafo (const int V, su3** gfield) {

#ifndef TM_USE_MPI

   int it, iz, iy, ix;
   
   int pos;
   
   if ((void *)(g_trafo = (su3 *) calloc(V, sizeof(su3))) == NULL ) {
    printf("malloc error in 'init_temporalgauge_trafo'\n"); 
    return(2);
  }
  
  /* initialize first timeslice (t=0) with unit matrices*/
  for (ix = 0; ix < LX; ix++) {
    for (iy = 0; iy < LY; iy++) {
      for (iz = 0; iz < LZ; iz++) {
        g_trafo[g_ipt[0][ix][iy][iz]] = unit_su3();
      }
    }
  }
  
  /* U^{'}_0(x)  g(x) U_0(x) g^{+}(x+0) != ID   =>  g_(x+0) = g(x) U_0(x)  */
  for (it = 1; it < T; it++) {
    for (ix = 0; ix < LX; ix++) {
      for (iy = 0; iy < LY; iy++) {
        for (iz = 0; iz < LZ; iz++) {
          pos = g_ipt[it][ix][iy][iz];
          _su3_times_su3( g_trafo[ g_ipt[it  ][ix][iy][iz] ] ,
                          g_trafo[ g_ipt[it-1][ix][iy][iz] ] ,
                          //gfield [ g_ipt[it-1][ix][iy][iz] ] [0]  );
                          gfield [ g_idn[pos][0]           ] [0]  );
        }
      }
    } 
  }

#else // MPI

  int it, iz, iy, ix;
  
  int pos;
  
  MPI_Status status;
  
  
  
  if ((void *)(left = (su3 *) calloc(LX*LY*LZ, sizeof(su3))) == NULL ) {		// allocates memory for a time-slice of su3-matrices
    printf("malloc error in 'init_temporalgauge_trafo_mpi'\n"); 
    return(-1);
  }
  
  if ((void *)(right = (su3 *) calloc(LX*LY*LZ, sizeof(su3))) == NULL ) {		// allocates memory for a time-slice of su3-matrices
    printf("malloc error in 'init_temporalgauge_trafo_mpi'\n"); 
    return(-1);
  }
  
  
  
  
  if ((void *)(g_trafo = (su3 *) calloc(V, sizeof(su3))) == NULL ) {			// allocates memory for V su3-matrices
    printf("malloc error in 'init_temporalgauge_trafo'\n"); 
    return(2);
  } 
  
  
  
  
  //////////////////////////////////////////////
  // initializing the transformation matrices //
  //////////////////////////////////////////////
  
  
  // first process in t-direction
  
  if (g_cart_id == 0) {
  	
  	/* initialize first timeslice (t=0) with unit matrices*/
  	for (ix = 0; ix < LX; ix++) {
  	  for (iy = 0; iy < LY; iy++) {
  	    for (iz = 0; iz < LZ; iz++) {
  	      g_trafo[g_ipt[0][ix][iy][iz]] = unit_su3();					// g_trafo[0-th time slice]  =  ID
  	    }
  	  }
  	}
  	
  	/* U^{'}_0(x)  =  g(x) U_0(x) g^{+}(x+0)  !=  ID   =>   g_(x+0)  =  g(x) U_0(x)  */
  	for (it = 1; it < T; it++) {
  	  for (ix = 0; ix < LX; ix++) {
  	    for (iy = 0; iy < LY; iy++) {
  	      for (iz = 0; iz < LZ; iz++) {
  	        _su3_times_su3( g_trafo[ g_ipt[it  ][ix][iy][iz] ] , 				// g_trafo[next t-slice]  =  g_trafo[old t-slice]  *  gfield[old t-slice][t-dir.]
  	                        g_trafo[ g_ipt[it-1][ix][iy][iz] ] ,
  	                        gfield [ g_ipt[it-1][ix][iy][iz] ] [0] );
  	        
  	      }
  	    }
  	  } 
  	}
  	
  	
  	// sending
  	MPI_Send((void *)(g_trafo+(T-1)*LX*LY*LZ), LX*LY*LZ, mpi_su3, g_nb_t_up, 0, g_cart_grid);
  	//MPI_Send((void *)(g_trafo+(T-1)*LX*LY*LZ), LX*LY*LZ, mpi_su3, g_cart_id+1, 0, g_cart_grid);
  	
  	printf("g_cart_id = %i has send a message to %i\n", g_cart_id, g_nb_t_up);
  	
  	
  } // first process
  
  
  
  
  // following processes
  
  else {
  	
  	// receiving
  	MPI_Recv((void *)left, LX*LY*LZ, mpi_su3, g_nb_t_dn, 0, g_cart_grid, &status);
  	//MPI_Recv((void *)left, LX*LY*LZ, mpi_su3, g_cart_id-1, 0, g_cart_grid, &status);
  	
  	
  	printf("g_cart_id = %i has received a message from %i\n", g_cart_id, g_nb_t_dn);
  	
  	it = 0;
  	for (ix = 0; ix < LX; ix++) {
  	  for (iy = 0; iy < LY; iy++) {
  	    for (iz = 0; iz < LZ; iz++) {
  	      pos = g_ipt[it][ix][iy][iz];
  	      _su3_times_su3( g_trafo[ g_ipt[it  ][ix][iy][iz] ] ,				// g_trafo[0-th time slice]  =  left[xchanged t-slice]  * gfield[
  	                      left   [ g_ipt[it  ][ix][iy][iz] ] ,
  	                      gfield [ g_idn[pos ][0]          ] [0] );				// notice: have to access the RAND region of the gauge field
  	    }
  	  }
  	}
  	
  	
  	for (it = 1; it < T; it++) {
  	  for (ix = 0; ix < LX; ix++) {
  	    for (iy = 0; iy < LY; iy++) {
  	      for (iz = 0; iz < LZ; iz++) {
  	        _su3_times_su3( g_trafo[ g_ipt[it  ][ix][iy][iz] ] ,
  	                        g_trafo[ g_ipt[it-1][ix][iy][iz] ] ,
  	                        gfield [ g_ipt[it-1][ix][iy][iz] ] [0] );
  	        
  	      }
  	    }
  	  } 
  	}
  	
  	
  	// sending
  	if (g_cart_id != g_nproc-1) {
  	  MPI_Send((void *)(g_trafo+(T-1)*LX*LY*LZ), LX*LY*LZ, mpi_su3, g_nb_t_up, 0, g_cart_grid);
  	  //MPI_Send((void *)(g_trafo+(T-1)*LX*LY*LZ), LX*LY*LZ, mpi_su3, g_cart_id+1, 0, g_cart_grid);
  	  
  	  printf("g_cart_id = %i has send a message to %i\n", g_cart_id, g_nb_t_up);
  	  
  	}
  	
  
  } // following processes
  
  
  
  
  ////////////////////////////////////////////
  // exchanging the transformation matrices //
  ////////////////////////////////////////////
  
  
  MPI_Sendrecv((void *)(g_trafo), LX*LY*LZ, mpi_su3, g_nb_t_dn, 1,
               (void *)(right  ), LX*LY*LZ, mpi_su3, g_nb_t_up, 1,
               g_cart_grid, &status);
  
  printf("g_cart_id = %i has send to %i and received from %i\n", g_cart_id, g_nb_t_dn, g_nb_t_up);


#endif // MPI


  /* 
    allocate and initialize g_tempgauge_field which holds a copy of the 
    global gauge field g_gauge_field which is copied back after the inversion
    when the temporal gauge is undone again
  */
  
  int i = 0;
  
  if ((void *)(g_tempgauge_field = (su3 **) calloc(V, sizeof(su3*))) == NULL ) {
    printf ("malloc error in 'init_temporalgauge_trafo'\n"); 
    return(1);
  }
  if ((void *)(tempgauge_field = (su3 *) calloc(4*V+1, sizeof(su3))) == NULL ) {
    printf ("malloc error in 'init_temporalgauge_trafo'\n"); 
    return(2);
  }
  
  #if (defined SSE || defined SSE2 || defined SSE3)
    g_tempgauge_field[0] = (su3*)(((unsigned long int)(tempgauge_field)+ALIGN_BASE)&~ALIGN_BASE);
  #else
    g_tempgauge_field[0] = tempgauge_field;
  #endif
  
  for(i = 1; i < V; i++){
    g_tempgauge_field[i] = g_tempgauge_field[i-1]+4;
  }

  /* copy the original field */
  copy_gauge_field(g_tempgauge_field, g_gauge_field);
  
  return(0);
  
}