Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

fermiqcd_staggered_propagator.h

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00034 class staggered_propagator: public mdp_field<mdp_complex> {
00035  public:
00036   int nc;
00037   staggered_propagator(mdp_lattice &mylattice, int nc_) {
00038     nc=nc_;
00039     int ndim=mylattice.ndim;
00040     allocate_field(mylattice, ndim*ndim*nc*nc);
00041   }
00042   inline mdp_matrix operator() (site x, int a) {
00043     mdp_matrix tmp(address(x,a*nc*nc),nc,nc);
00044     return tmp;
00045   }
00046   inline mdp_complex &operator() (site x, int a, int i, int j) {
00047     return *(address(x)+a*nc*nc+i*nc+j);
00048   }
00049   friend void generate(staggered_propagator &S, gauge_field &U,
00050                        coefficients &coeff,
00051                        mdp_real absolute_precision=fermi_inversion_precision,
00052                        mdp_real relative_precision=0,
00053                        int max_steps=2000,
00054                        void (*smf)(staggered_field&,gauge_field&)=0, 
00055                        int comp=0) {
00056     staggered_field psi(S.lattice(),S.nc);
00057     staggered_field chi(S.lattice(),S.nc);
00058     site        x(S.lattice());
00059     int ndim=S.lattice().ndim;
00060     int nc=S.nc;
00061     int i,j,mu,a;
00062     
00063     double time=mpi.time();
00064 
00065     if(ME==0 && shutup==FALSE) {
00066       printf("BEGIN Generating ordinary propagator\n");
00067       fflush(stdout);
00068     }
00069 
00070     for(a=0; a<(0x1 << ndim); a++) 
00071        for(j=0; j<nc; j++) {
00072         forallsitesandcopies(x) 
00073           for(i=0; i<nc; i++) 
00074             psi(x,i)=0;
00075         
00076         x=binary2versor(a);
00077         if(ME==0 && shutup==FALSE) {
00078           printf("(source at (");
00079           for(mu=0; mu<ndim; mu++) printf("%i ", x(mu));
00080           printf("), Color: %i\n", j);
00081           fflush(stdout);
00082         }
00083         if(x.is_here()) psi(x,j)=1;
00084 
00085         /*
00086           If a smearing function is passed (smf)
00087           the source is smeared before the inversion
00088           the sink must be smeared using smear_sink.
00089         */      
00090         if(smf!=0) (*smf)(psi,U);
00091         mul_invQ(chi,psi,U,coeff,absolute_precision,relative_precision,max_steps);
00092         
00093         forallsites(x)
00094           for(i=0; i<nc; i++)
00095             S(x,a,i,j)=chi(x,i);
00096        }
00097     if(ME==0 && shutup==FALSE) {
00098       printf("END Generating ordinary propagator. Time: %f (sec)\n",
00099              mpi.time()-time);
00100       fflush(stdout);
00101     }
00102   }
00103 };

Generated on Sun Feb 27 15:12:19 2005 by  doxygen 1.4.1