コード例 #1
0
ファイル: clover_leaf.c プロジェクト: franzdirenzo/tmLQCD
double sw_trace(const int ieo, const double mu) {
  int i,x,icx,ioff;
  static su3 v;
  static _Complex double a[6][6];
  static double tra;
  static double ks,kc,tr,ts,tt;
  static _Complex double det;
  
  ks=0.0;
  kc=0.0;

  if(ieo==0) {
    ioff=0;
  } 
  else {
    ioff=(VOLUME+RAND)/2;
  }
  for(icx = ioff; icx < (VOLUME/2+ioff); icx++) {
    x = g_eo2lexic[icx];
    for(i=0;i<2;i++) {
      populate_6x6_matrix(a, &sw[x][0][i], 0, 0);
      populate_6x6_matrix(a, &sw[x][1][i], 0, 3);
      _su3_dagger(v, sw[x][1][i]); 
      populate_6x6_matrix(a, &v, 3, 0);
      populate_6x6_matrix(a, &sw[x][2][i], 3, 3);
      // we add the twisted mass term
      if(i == 0) add_tm(a, mu);
      else add_tm(a, -mu);
      // and compute the tr log (or log det)
      det = six_det(a);
      tra = log(conj(det)*det);
      // we need to compute only the one with +mu
      // the one with -mu must be the complex conjugate!

      tr=tra+kc;
      ts=tr+ks;
      tt=ts-ks;
      ks=ts;
      kc=tr-tt;
    }
  }
  kc=ks+kc;
#ifdef MPI
  MPI_Allreduce(&kc, &ks, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
  return(ks);
#else
  return(kc);
#endif

}
コード例 #2
0
ファイル: temporalgauge.c プロジェクト: Finkenrath/tmLQCD
void apply_inv_gtrafo (su3 ** gfield, su3 * trafofield) {

 int it, iz, iy, ix;
 int xpos;
 int mu;
  
 su3 temp1, temp2;
 
 if(g_proc_id == 0) {
   printf("Applying INVERSE gauge transformation...");
 }
 
 for (it = 0; it < T; it++) {
   for (ix = 0; ix < LX; ix++) {
     for (iy = 0; iy < LY; iy++) {
       for (iz = 0; iz < LZ; iz++) {
       
         xpos = g_ipt[it][ix][iy][iz];
         
         for (mu = 0; mu < 4; mu++) {
            /*
            _su3d_times_su3( temp1, trafofield[xpos],  gfield[xpos][mu]  );

            _su3_times_su3( gfield[xpos][mu],temp1, trafofield[ g_iup[xpos][mu]  ]);            
            */
           
           /* help = U^{'}_mu(x) g(x+mu)*/
            _su3_times_su3( temp1,  gfield[xpos][mu], trafofield[ g_iup[xpos][mu]]  );	// temp1  =  gfield[xpos][mu]  *  trafofield[ g_iup[xpos][mu] ]

            /* U_mu(x) <- g^{+}(x) help */
            _su3_dagger(temp2, trafofield[xpos]  )					// temp2  =  trafofield[xpos]_{dagger}
            _su3_times_su3( gfield[xpos][mu], temp2, temp1);				// gfield[xpos][mu]  =  temp2  * temp1
											//                   =  trafofield[xpos]_{dagger}  *  gfield[xpos][mu]  *  trafofield[ g_iup[xpos][mu] ]
          }  
  }}}}
  
  if(g_proc_id == 0) {
    printf("done\n");
  }
  
  /* update gauge copy fields in the next call to HoppingMatrix */
  g_update_gauge_copy = 1;
  
}
コード例 #3
0
ファイル: rnd_gauge_trafo.c プロジェクト: Finkenrath/tmLQCD
void rnd_gauge_trafo(const int repro, su3 ** const gf){
  int ix,iy,mu;
  static su3 u,v,w,x,y;
  su3 * _gauge_trafo = NULL;
  su3 * gauge_trafo = NULL;

  if((_gauge_trafo = calloc(VOLUMEPLUSRAND+1, sizeof(su3))) == NULL) {
    fprintf(stderr, "Could not allocate memory in rnd_gauge_trafo. Exiting!\n");
    exit(0);
  }
  gauge_trafo = (su3*)(((unsigned long int)(gauge_trafo)+ALIGN_BASE)&~ALIGN_BASE);

  random_gauge_field(repro, gauge_trafo);

#ifdef TM_USE_MPI
  xchange_gauge(gauge_trafo);
#endif

  for (ix=0;ix<VOLUME;ix++){

    u=gauge_trafo[ix];

    for (mu=0;mu<4;mu++){
      iy=g_iup[ix][mu];
      w=gauge_trafo[iy];
      _su3_dagger(v,w);
      w=g_gauge_field[ix][mu];

      _su3_times_su3(x,w,v);
      _su3_times_su3(y,u,x);

      gf[ix][mu]=y;
    }
  }
      
  free(_gauge_trafo);
}
コード例 #4
0
ファイル: clover_leaf.c プロジェクト: franzdirenzo/tmLQCD
void sw_term(su3 ** const gf, const double kappa, const double c_sw) {
  int k,l;
  int x,xpk,xpl,xmk,xml,xpkml,xplmk,xmkml;
  su3 *w1,*w2,*w3,*w4;
  double ka_csw_8 = kappa*c_sw/8.;
  static su3 v1,v2,plaq;
  static su3 fkl[4][4];
  static su3 magnetic[4],electric[4];
  static su3 aux;
  
  /*  compute the clover-leave */
  /*  l  __   __
        |  | |  |
        |__| |__|
         __   __
        |  | |  |
        |__| |__| k  */
  
  for(x = 0; x < VOLUME; x++) {
    for(k = 0; k < 4; k++) {
      for(l = k+1; l < 4; l++) {
	xpk=g_iup[x][k];
	xpl=g_iup[x][l];
	xmk=g_idn[x][k];
	xml=g_idn[x][l];
	xpkml=g_idn[xpk][l];
	xplmk=g_idn[xpl][k];
	xmkml=g_idn[xml][k];
	w1=&gf[x][k];
	w2=&gf[xpk][l];
	w3=&gf[xpl][k];
	w4=&gf[x][l];
	_su3_times_su3(v1,*w1,*w2);
	_su3_times_su3(v2,*w4,*w3);
	_su3_times_su3d(plaq,v1,v2);
	w1=&gf[x][l];
	w2=&gf[xplmk][k];
	w3=&gf[xmk][l];
	w4=&gf[xmk][k];
	_su3_times_su3d(v1,*w1,*w2);
	_su3d_times_su3(v2,*w3,*w4);
	_su3_times_su3_acc(plaq,v1,v2);
	w1=&gf[xmk][k];
	w2=&gf[xmkml][l];
	w3=&gf[xmkml][k];
	w4=&gf[xml][l];
	_su3_times_su3(v1,*w2,*w1);
	_su3_times_su3(v2,*w3,*w4);
	_su3d_times_su3_acc(plaq,v1,v2);
	w1=&gf[xml][l];
	w2=&gf[xml][k];
	w3=&gf[xpkml][l];
	w4=&gf[x][k];
	_su3d_times_su3(v1,*w1,*w2);
	_su3_times_su3d(v2,*w3,*w4);
	_su3_times_su3_acc(plaq,v1,v2);
	_su3_dagger(v2,plaq); 
	_su3_minus_su3(fkl[k][l],plaq,v2);
      }
    }

    // this is the one in flavour and colour space
    // twisted mass term is treated in clover, sw_inv and
    // clover_gamma5
    _su3_one(sw[x][0][0]);
    _su3_one(sw[x][2][0]);
    _su3_one(sw[x][0][1]);
    _su3_one(sw[x][2][1]);
    
    for(k = 1; k < 4; k++)
    {
      _su3_assign(electric[k], fkl[0][k]);
    }
    _su3_assign(magnetic[1], fkl[2][3]);
    _su3_minus_assign(magnetic[2], fkl[1][3]);
    _su3_assign(magnetic[3], fkl[1][2]);
    
    /*  upper left block 6x6 matrix  */
    
    _itimes_su3_minus_su3(aux,electric[3],magnetic[3]);
    _su3_refac_acc(sw[x][0][0],ka_csw_8,aux);
    
    _itimes_su3_minus_su3(aux,electric[1],magnetic[1]);
    _su3_minus_su3(v2,electric[2],magnetic[2]); 
    _su3_acc(aux,v2);
    _real_times_su3(sw[x][1][0],ka_csw_8,aux);
    
    _itimes_su3_minus_su3(aux,magnetic[3],electric[3]);
    _su3_refac_acc(sw[x][2][0],ka_csw_8,aux);

    /*  lower right block 6x6 matrix */
    
    _itimes_su3_plus_su3(aux,electric[3],magnetic[3]);
    _su3_refac_acc(sw[x][0][1],(-ka_csw_8),aux);

    _itimes_su3_plus_su3(aux,electric[1],magnetic[1]);
    _su3_plus_su3(v2,electric[2],magnetic[2]); 
    _su3_acc(aux,v2);
    _real_times_su3(sw[x][1][1],(-ka_csw_8),aux);

    _itimes_su3_plus_su3(aux,magnetic[3],electric[3]);
    _su3_refac_acc(sw[x][2][1],ka_csw_8,aux);
  }
  return;
}
コード例 #5
0
ファイル: clover_leaf.c プロジェクト: franzdirenzo/tmLQCD
void sw_all(hamiltonian_field_t * const hf, const double kappa, 
	    const double c_sw) {
  int k,l;
  int x,xpk,xpl,xmk,xml,xpkml,xplmk,xmkml;
  su3 *w1,*w2,*w3,*w4;
  double ka_csw_8 = kappa*c_sw/8.;
  static su3 v1,v2,vv1,vv2,plaq;
  static su3 vis[4][4];
  
  for(x = 0; x < VOLUME; x++) {
    _minus_itimes_su3_plus_su3(vis[0][1],swm[x][1],swm[x][3]);
    _su3_minus_su3(vis[0][2],swm[x][1],swm[x][3]);
    _itimes_su3_minus_su3(vis[0][3],swm[x][2],swm[x][0]);
    
    _minus_itimes_su3_plus_su3(vis[2][3],swp[x][1],swp[x][3]);
    _su3_minus_su3(vis[1][3],swp[x][3],swp[x][1]);
    _itimes_su3_minus_su3(vis[1][2],swp[x][2],swp[x][0]);

    // project to the traceless anti-hermitian part
    _su3_dagger(v1,vis[0][1]); 
    _su3_minus_su3(vis[0][1],vis[0][1],v1);
    _su3_dagger(v1,vis[0][2]); 
    _su3_minus_su3(vis[0][2],vis[0][2],v1);
    _su3_dagger(v1,vis[0][3]); 
    _su3_minus_su3(vis[0][3],vis[0][3],v1);
    _su3_dagger(v1,vis[2][3]); 
    _su3_minus_su3(vis[2][3],vis[2][3],v1);
    _su3_dagger(v1,vis[1][3]); 
    _su3_minus_su3(vis[1][3],vis[1][3],v1);
    _su3_dagger(v1,vis[1][2]); 
    _su3_minus_su3(vis[1][2],vis[1][2],v1);
    
    for(k = 0; k < 4; k++) {
      for(l = k+1; l < 4; l++) {
	xpk=g_iup[x][k];
	xpl=g_iup[x][l];
	xmk=g_idn[x][k];
	xml=g_idn[x][l];
	xpkml=g_idn[xpk][l];
	xplmk=g_idn[xpl][k];
	xmkml=g_idn[xml][k];
	w1=&hf->gaugefield[x][k];
	w2=&hf->gaugefield[xpk][l];
	w3=&hf->gaugefield[xpl][k];   /*dag*/
	w4=&hf->gaugefield[x][l];     /*dag*/
	
	_su3_times_su3(v1,*w1,*w2);
	_su3_times_su3(v2,*w4,*w3);
	_su3_times_su3d(plaq,v1,v2);
	
	_su3_times_su3(vv1,plaq,vis[k][l]);
 	_trace_lambda_mul_add_assign(hf->derivative[x][k], -2.*ka_csw_8, vv1);

	_su3d_times_su3(vv2,*w1,vv1); 
	_su3_times_su3(vv1,vv2,*w1);
 	_trace_lambda_mul_add_assign(hf->derivative[xpk][l], -2.*ka_csw_8, vv1);
	
	_su3_times_su3(vv2,vis[k][l],plaq); 
	_su3_dagger(vv1,vv2);
 	_trace_lambda_mul_add_assign(hf->derivative[x][l], -2.*ka_csw_8, vv1);

	_su3d_times_su3(vv2,*w4,vv1); 
	_su3_times_su3(vv1,vv2,*w4);
 	_trace_lambda_mul_add_assign(hf->derivative[xpl][k], -2.*ka_csw_8, vv1);
	
	w1=&hf->gaugefield[x][l];
	w2=&hf->gaugefield[xplmk][k];   /*dag*/
	w3=&hf->gaugefield[xmk][l];     /*dag*/
	w4=&hf->gaugefield[xmk][k];
	_su3_times_su3d(v1,*w1,*w2);
	_su3d_times_su3(v2,*w3,*w4);
	_su3_times_su3(plaq,v1,v2);
	
	_su3_times_su3(vv1,plaq,vis[k][l]);
 	_trace_lambda_mul_add_assign(hf->derivative[x][l], -2.*ka_csw_8, vv1);
	
	_su3_dagger(vv1,v1); 
	_su3_times_su3d(vv2,vv1,vis[k][l]);
	_su3_times_su3d(vv1,vv2,v2);
 	_trace_lambda_mul_add_assign(hf->derivative[xplmk][k], -2.*ka_csw_8, vv1);

	_su3_times_su3(vv2,*w3,vv1); 
	_su3_times_su3d(vv1,vv2,*w3);
 	_trace_lambda_mul_add_assign(hf->derivative[xmk][l], -2.*ka_csw_8, vv1);

	_su3_dagger(vv2,vv1);
 	_trace_lambda_mul_add_assign(hf->derivative[xmk][k], -2.*ka_csw_8, vv2);
	
	w1=&hf->gaugefield[xmk][k];   /*dag*/
	w2=&hf->gaugefield[xmkml][l]; /*dag*/
	w3=&hf->gaugefield[xmkml][k];
	w4=&hf->gaugefield[xml][l];
	_su3_times_su3(v1,*w2,*w1);
	_su3_times_su3(v2,*w3,*w4);
	
	_su3_times_su3d(vv1,*w1,vis[k][l]);
	_su3_times_su3d(vv2,vv1,v2);
	_su3_times_su3(vv1,vv2,*w2);
 	_trace_lambda_mul_add_assign(hf->derivative[xmk][k], -2.*ka_csw_8, vv1);

	_su3_times_su3(vv2,*w2,vv1); 
	_su3_times_su3d(vv1,vv2,*w2);
 	_trace_lambda_mul_add_assign(hf->derivative[xmkml][l], -2.*ka_csw_8, vv1);

	_su3_dagger(vv2,vv1);
 	_trace_lambda_mul_add_assign(hf->derivative[xmkml][k], -2.*ka_csw_8, vv2);

	_su3d_times_su3(vv1,*w3,vv2); 
	_su3_times_su3(vv2,vv1,*w3);
 	_trace_lambda_mul_add_assign(hf->derivative[xml][l], -2.*ka_csw_8, vv2);
	
	w1=&hf->gaugefield[xml][l];   /*dag*/
	w2=&hf->gaugefield[xml][k];
	w3=&hf->gaugefield[xpkml][l];
	w4=&hf->gaugefield[x][k];     /*dag*/
	_su3d_times_su3(v1,*w1,*w2);
	_su3_times_su3d(v2,*w3,*w4);
	
	_su3_times_su3d(vv1,*w1,vis[k][l]);
	_su3_times_su3d(vv2,vv1,v2);
	_su3_times_su3d(vv1,vv2,*w2);
 	_trace_lambda_mul_add_assign(hf->derivative[xml][l], -2.*ka_csw_8, vv1);
	
	_su3_dagger(vv2,vv1);
 	_trace_lambda_mul_add_assign(hf->derivative[xml][k], -2.*ka_csw_8, vv2);

	_su3d_times_su3(vv1,*w2,vv2); 
	_su3_times_su3(vv2,vv1,*w2);
 	_trace_lambda_mul_add_assign(hf->derivative[xpkml][l], -2.*ka_csw_8, vv2);

	_su3_dagger(vv2,v2);  
	_su3_times_su3d(vv1,vv2,v1);
	_su3_times_su3d(vv2,vv1,vis[k][l]);
 	_trace_lambda_mul_add_assign(hf->derivative[x][k], -2.*ka_csw_8, vv2);
      }
    }
  }
  return;
}
コード例 #6
0
ファイル: clover_leaf.c プロジェクト: franzdirenzo/tmLQCD
void sw_invert(const int ieo, const double mu) {
  int ioff, err=0;
  int i, x;
  static su3 v;
  static _Complex double a[6][6];
  if(ieo==0) {
    ioff=0;
  } 
  else {
    ioff=(VOLUME+RAND)/2;
  }

  for(int icx = ioff, icy = 0; icx < (VOLUME/2+ioff); icx++, icy++) {
    x = g_eo2lexic[icx];

    for(i = 0; i < 2; i++) {
      populate_6x6_matrix(a, &sw[x][0][i], 0, 0);
      populate_6x6_matrix(a, &sw[x][1][i], 0, 3);
      _su3_dagger(v, sw[x][1][i]); 
      populate_6x6_matrix(a, &v, 3, 0);
      populate_6x6_matrix(a, &sw[x][2][i], 3, 3);
      // we add the twisted mass term
      if(i == 0) add_tm(a, +mu);
      else add_tm(a, -mu);
      // and invert the resulting matrix

      err = six_invert(a); 
      // here we need to catch the error! 
      if(err > 0 && g_proc_id == 0) {
	printf("# inversion failed in six_invert code %d\n", err);
	err = 0;
      }

      /*  copy "a" back to sw_inv */
      get_3x3_block_matrix(&sw_inv[icy][0][i], a, 0, 0);
      get_3x3_block_matrix(&sw_inv[icy][1][i], a, 0, 3);
      get_3x3_block_matrix(&sw_inv[icy][2][i], a, 3, 3);
      get_3x3_block_matrix(&sw_inv[icy][3][i], a, 3, 0);
    }

    if(fabs(mu) > 0.) {
      for(i = 0; i < 2; i++) {
	populate_6x6_matrix(a, &sw[x][0][i], 0, 0);
	populate_6x6_matrix(a, &sw[x][1][i], 0, 3);
	_su3_dagger(v, sw[x][1][i]); 
	populate_6x6_matrix(a, &v, 3, 0);
	populate_6x6_matrix(a, &sw[x][2][i], 3, 3);

	// we add the twisted mass term
	if(i == 0) add_tm(a, -mu);
	else add_tm(a, +mu);
	// and invert the resulting matrix
	err = six_invert(a); 
	// here we need to catch the error! 
	if(err > 0 && g_proc_id == 0) {
	  printf("# %d\n", err);
	  err = 0;
	}

	/*  copy "a" back to sw_inv */
	get_3x3_block_matrix(&sw_inv[icy+VOLUME/2][0][i], a, 0, 0);
	get_3x3_block_matrix(&sw_inv[icy+VOLUME/2][1][i], a, 0, 3);
	get_3x3_block_matrix(&sw_inv[icy+VOLUME/2][2][i], a, 3, 3);
	get_3x3_block_matrix(&sw_inv[icy+VOLUME/2][3][i], a, 3, 0);
      }
    }
  }
  return;
}