コード例 #1
0
ファイル: eigen_stuff_helpers.c プロジェクト: lattice/milc
void Matrix_Vec_mult(su3_vector *src, su3_vector *res, int parity,
		     imp_ferm_links_t *fn )
{  
  register site *s;
  register  int i;
  int otherparity = EVENANDODD;

  if(temp == NULL ){
    temp = (su3_vector *)malloc(sites_on_node*sizeof(su3_vector));
  }
  
  switch(parity){
  case EVEN:
    otherparity = ODD ;
    break ;
  case ODD:
    otherparity = EVEN ;
    break ;
  case EVENANDODD:
    otherparity = EVENANDODD ;
    break ;
  default:
    node0_printf("ERROR: wrong parity in eigen_stuff::Matrix_Vec_mult\n") ;
    terminate(1) ;
  }

  dslash_field(src , temp, otherparity, fn) ; 
  dslash_field(temp, res , parity     , fn) ;
  FORSOMEPARITY(i,s,parity){ 
    scalar_mult_su3_vector( &(res[i]), -1.0, &(res[i])) ;
  } 
コード例 #2
0
void eo_fermion_force_rhmc( Real eps, params_ratfunc *rf, 
			    su3_vector **multi_x, field_offset phi_off, 
			    Real my_rsqmin, int my_niter,
			    int cg_prec, int ff_prec, fermion_links_t *fl)
{
    // at different time steps

    Real final_rsq;
    int j;
    int order = rf->order;
    Real *residues = rf->res;
    Real *roots = rf->pole;
    imp_ferm_links_t **fn;

    // Compute ( M^\dagger M)^{-1} in xxx_even
    // Then compute M*xxx in temporary vector xxx_odd 
    /* See long comment at end of file */
	/* The diagonal term in M doesn't matter */
    //    load_ferm_links(fn);
    restore_fermion_links_from_site(fl, cg_prec);
    fn = get_fm_links(fl);

    /* Do the inversion for zero Naik term epsilon */
    ks_ratinv( phi_off, multi_x, roots, order, my_niter,
	       my_rsqmin, cg_prec, EVEN, &final_rsq, fn[0], 0, 0. );

    /* Do dslash for zero Naik term epsilon */
    for(j=0;j<order;j++){ dslash_field( multi_x[j], multi_x[j], ODD, fn[0] ); }

    eo_fermion_force_multi( eps, &(residues[1]), multi_x, order, ff_prec, fl );
}
コード例 #3
0
ファイル: mat_invert.c プロジェクト: erinaldi/milc_qcd
void ks_dirac_op( su3_vector *src, su3_vector *dst, Real mass, 
		  int parity, imp_ferm_links_t *fn){
    register int i;
    register site *s;

    dslash_field( src, dst, parity, fn);
    FORSOMEPARITYDOMAIN(i,s,parity){
      scalar_mult_add_su3_vector( dst+i, src+i, +2.0*mass, dst+i);
    }
コード例 #4
0
ファイル: control.c プロジェクト: winterowd/MILC_graphene
int main( int argc, char **argv ){
  register site *s;
  int i,si;
  int prompt;
  double dtime;
  su3_vector **eigVec ;
  su3_vector *tmp ;
  double *eigVal ;
  int total_R_iters ;
  double chirality, chir_ev, chir_od ;
  imp_ferm_links_t **fn;

  initialize_machine(&argc,&argv);
  /* Remap standard I/O */
  if(remap_stdio_from_args(argc, argv) == 1)terminate(1);

  g_sync();
  /* set up */
  prompt = setup();

  /* loop over input sets */
  while( readin(prompt) == 0){
    dtime = -dclock();
#ifdef HISQ_SVD_COUNTER
    hisq_svd_counter = 0;
#endif
    restore_fermion_links_from_site(fn_links, PRECISION);
    /* call fermion_variable measuring routines */
    /* results are printed in output file */
    f_meas_imp( 1, PRECISION, F_OFFSET(phi), F_OFFSET(xxx), mass,
		0, fn_links);

    eigVal = (double *)malloc(Nvecs*sizeof(double));
    eigVec = (su3_vector **)malloc(Nvecs*sizeof(su3_vector*));
    for(i=0;i<Nvecs;i++)
      eigVec[i]=
	(su3_vector*)malloc(sites_on_node*sizeof(su3_vector));
    
    fn = get_fm_links(fn_links);
    active_parity = EVEN;
    total_R_iters=Kalkreuter(eigVec, eigVal, eigenval_tol, 
			     error_decr, Nvecs, MaxIter, Restart, 
			     Kiters);

    node0_printf("The above where eigenvalues of -Dslash^2 in MILC normalization\n");
    node0_printf("Here we also list eigenvalues of iDslash in continuum normalization\n");
    for(i=0;i<Nvecs;i++)
      { 
	if ( eigVal[i] > 0.0 ){ chirality = sqrt(eigVal[i]) / 2.0; }
	else { chirality = 0.0; }
	node0_printf("eigenval(%i): %10g\n",i,chirality) ;
      } 

    tmp = (su3_vector*)malloc(sites_on_node*sizeof(su3_vector));
    for(i=0;i<Nvecs;i++)
      { 
//	if ( eigVal[i] > 10.0*eigenval_tol )
//	  {
	    /* Construct to odd part of the vector.                 *
	     * Note that the true odd part of the eigenvector is    *
	     *  i/sqrt(eigVal) Dslash Psi. But since I only compute *
	     * the chirality the i factor is irrelevant (-i)*i=1!!  */
	    dslash_field(eigVec[i], tmp, ODD, fn[0]) ;
	    FORSOMEPARITY(si,s,ODD){ 
	      scalar_mult_su3_vector( &(tmp[si]),
				      1.0/sqrt(eigVal[i]), 
				      &(eigVec[i][si]) ) ;
	    }
	
//	    measure_chirality(eigVec[i], &chirality, EVENANDODD);
	    /* Here I divide by 2 since the EVEN vector is normalized to
	     * 1. The EVENANDODD vector is normalized to 2. I could have
	     * normalized the EVENANDODD vector to 1 and then not devide
	     * by to.  The measure_chirality routine assumes vectors
	     * normalized to 1.  */
//	    node0_printf("Chirality(%i): %g\n",i,chirality/2) ;
	    measure_chirality(eigVec[i], &chir_ev, EVEN);
	    measure_chirality(eigVec[i], &chir_od, ODD);
	    chirality = (chir_ev + chir_od) / 2.0;
	    node0_printf("Chirality(%i) -- even, odd, total: %10g, %10g, %10g\n",
			 i,chir_ev,chir_od,chirality) ;
//	  }
//	else
//	  {
	    /* This is considered a "zero mode", and treated as such */
//	    measure_chirality(eigVec[i], &chirality, EVEN);
//	    node0_printf("Chirality(%i): %g\n",i,chirality) ;
//	  }
      }
#ifdef EO
    cleanup_dslash_temps();
#endif
    free(tmp);
    /**
       for(i=0;i<Nvecs;i++)
       {
       sprintf(label,"DENSITY(%i)",i) ;
       print_densities(eigVec[i], label, ny/2,nz/2,nt/2, EVEN) ;
       }
    **/
    for(i=0;i<Nvecs;i++)
      free(eigVec[i]) ;
    free(eigVec) ;
    free(eigVal) ;
    invalidate_fermion_links(fn_links);
    fflush(stdout);
    
    node0_printf("RUNNING COMPLETED\n"); fflush(stdout);
    dtime += dclock();
    if(this_node==0){
      printf("Time = %e seconds\n",dtime);
      printf("total_iters = %d\n",total_iters);
      printf("total Rayleigh iters = %d\n",total_R_iters);
#ifdef HISQ_SVD_COUNTER
      printf("hisq_svd_counter = %d\n",hisq_svd_counter);
#endif
    }
    fflush(stdout);
  }
コード例 #5
0
ファイル: update_h_rhmc.c プロジェクト: lattice/milc
// fermion force update grouping pseudofermions with the same path coeffs
int update_h_fermion( Real eps, su3_vector **multi_x ){
  int iphi,jphi;
  Real final_rsq;
  int i,j,n;
  int order, tmporder;
  Real *residues,*allresidues;
  Real *roots;
  int iters = 0;
  imp_ferm_links_t **fn;

  /* Algorithm sketch: assemble multi_x with all |X> fields,
     then call force routine for each part (so far we have to parts:
     zero correction to Naik and non-zero correction to Naik */

  allresidues = (Real *)malloc(n_order_naik_total*sizeof(Real));

  // Group the fermion force calculation according to sets of like
  // path coefficients.
  tmporder = 0;
  iphi = 0;
#if ( FERM_ACTION == HISQ || FERM_ACTION == HYPISQ )
  n = fermion_links_get_n_naiks(fn_links);
#else
  n = 1;
#endif
  for( i=0; i<n; i++ ) {
    for( jphi=0; jphi<n_pseudo_naik[i]; jphi++ ) {
      restore_fermion_links_from_site(fn_links, prec_md[iphi]);
      fn = get_fm_links(fn_links);

      // Add the current pseudofermion to the current set
      order = rparam[iphi].MD.order;
      residues = rparam[iphi].MD.res;
      roots = rparam[iphi].MD.pole;

      // Compute ( M^\dagger M)^{-1} in xxx_even
      // Then compute M*xxx in temporary vector xxx_odd 
      /* See long comment at end of file */
	/* The diagonal term in M doesn't matter */
      iters += ks_ratinv( F_OFFSET(phi[iphi]), multi_x+tmporder, roots, order, 
			  niter_md[iphi], rsqmin_md[iphi], prec_md[iphi], EVEN, 
			  &final_rsq, fn[i], 
			  i, rparam[iphi].naik_term_epsilon );

      for(j=0;j<order;j++){
	dslash_field( multi_x[tmporder+j], multi_x[tmporder+j],  ODD,
		      fn[i]);
	allresidues[tmporder+j] = residues[j+1];
	// remember that residues[0] is constant, no force contribution.
      }
    tmporder += order;
    iphi++;
    }
  }

#ifdef MILC_GLOBAL_DEBUG
  node0_printf("update_h_rhmc: MULTI_X ASSEMBLED\n");fflush(stdout);
  node0_printf("update_h_rhmc: n_distinct_Naik=%d\n",n);
  for(j=0;j<n;j++)
    node0_printf("update_h_rhmc: orders[%d]=%d\n",j,n_orders_naik[j]);
#if ( FERM_ACTION == HISQ || FERM_ACTION == HYPISQ )
  for(j=0;j<n;j++)
    node0_printf("update_h_rhmc: masses_Naik[%d]=%f\n",j,fn_links.hl.eps_naik[j]);
#endif
  fflush(stdout);
#endif /* MILC_GLOBAL_DEBUG */

  restore_fermion_links_from_site(fn_links, prec_ff);
  eo_fermion_force_multi( eps, allresidues, multi_x,
			  n_order_naik_total, prec_ff, fn_links );

  free(allresidues);
  return iters;
} /* update_h_fermion */