mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-04 14:04:32 +00:00 
			
		
		
		
	Debugged the threaded version. Cleaning up
This commit is contained in:
		@@ -122,6 +122,12 @@ public:
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    inline void InOutCoorToLocalCoor (std::vector<int> &ocoor, std::vector<int> &icoor, std::vector<int> &lcoor) {
 | 
			
		||||
      lcoor.resize(_ndimension);
 | 
			
		||||
      for (int d = 0; d < _ndimension; d++)
 | 
			
		||||
        lcoor[d] = ocoor[d] + _rdimensions[d] * icoor[d];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //////////////////////////////////////////////////////////
 | 
			
		||||
    // SIMD lane addressing
 | 
			
		||||
    //////////////////////////////////////////////////////////
 | 
			
		||||
@@ -129,6 +135,7 @@ public:
 | 
			
		||||
    {
 | 
			
		||||
      Lexicographic::CoorFromIndex(coor,lane,_simd_layout);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    inline int PermuteDim(int dimension){
 | 
			
		||||
      return _simd_layout[dimension]>1;
 | 
			
		||||
    }
 | 
			
		||||
@@ -175,7 +182,7 @@ public:
 | 
			
		||||
    inline const std::vector<int> &VirtualLocalDimensions(void) { return _ldimensions;};
 | 
			
		||||
 | 
			
		||||
    ////////////////////////////////////////////////////////////////
 | 
			
		||||
    // Print decomposition
 | 
			
		||||
    // Utility to print the full decomposition details 
 | 
			
		||||
    ////////////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
    void show_decomposition(){
 | 
			
		||||
@@ -183,6 +190,8 @@ public:
 | 
			
		||||
      std::cout << GridLogMessage << "Global Dimensions  : " << _gdimensions << std::endl;
 | 
			
		||||
      std::cout << GridLogMessage << "Local Dimensions   : " << _ldimensions << std::endl;
 | 
			
		||||
      std::cout << GridLogMessage << "Reduced Dimensions : " << _rdimensions << std::endl;
 | 
			
		||||
      std::cout << GridLogMessage << "Outer strides      : " << _ostride << std::endl;
 | 
			
		||||
      std::cout << GridLogMessage << "Inner strides      : " << _istride << std::endl;
 | 
			
		||||
      std::cout << GridLogMessage << "iSites             : " << _isites << std::endl;
 | 
			
		||||
      std::cout << GridLogMessage << "oSites             : " << _osites << std::endl;
 | 
			
		||||
      std::cout << GridLogMessage << "lSites             : " << lSites() << std::endl;        
 | 
			
		||||
@@ -199,6 +208,9 @@ public:
 | 
			
		||||
    void LocalIndexToLocalCoor(int lidx,std::vector<int> &lcoor){
 | 
			
		||||
      Lexicographic::CoorFromIndex(lcoor,lidx,_ldimensions);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    void GlobalCoorToGlobalIndex(const std::vector<int> & gcoor,int & gidx){
 | 
			
		||||
      gidx=0;
 | 
			
		||||
      int mult=1;
 | 
			
		||||
 
 | 
			
		||||
@@ -292,35 +292,43 @@ class DomainWallVec5dImpl :  public PeriodicGaugeImpl< GaugeImplTypes< S,Nrepres
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  inline void InsertForce5D(GaugeField &mat, FermionField &Btilde, FermionField Ã, int mu) {
 | 
			
		||||
    int LLs = Btilde._grid->_rdimensions[0];
 | 
			
		||||
    conformable(Atilde._grid,Btilde._grid);
 | 
			
		||||
    GaugeLinkField tmp(mat._grid); 
 | 
			
		||||
    tmp = zero;
 | 
			
		||||
    typedef decltype(traceIndex<SpinIndex>(outerProduct(Btilde[0], Atilde[0]))) result_type;
 | 
			
		||||
    std::vector<typename result_type::scalar_object> v_scalar_object(Btilde._grid->Nsimd());
 | 
			
		||||
    unsigned int LLs = Btilde._grid->_rdimensions[0];
 | 
			
		||||
    conformable(Atilde._grid,Btilde._grid);
 | 
			
		||||
    GridBase* grid = mat._grid;
 | 
			
		||||
    GridBase* Bgrid = Btilde._grid;
 | 
			
		||||
    unsigned int dimU = grid->Nd();
 | 
			
		||||
    unsigned int dimF = Bgrid->Nd();
 | 
			
		||||
    GaugeLinkField tmp(grid); 
 | 
			
		||||
    tmp = zero;
 | 
			
		||||
    
 | 
			
		||||
    // FIXME 
 | 
			
		||||
    // Current implementation works, thread safe, probably suboptimal
 | 
			
		||||
 | 
			
		||||
    PARALLEL_FOR_LOOP
 | 
			
		||||
    for (int sss = 0; sss < tmp._grid->oSites(); sss++) {
 | 
			
		||||
      std::vector<int> ocoor;
 | 
			
		||||
      tmp._grid->oCoorFromOindex(ocoor,sss); 
 | 
			
		||||
    for (int so = 0; so < grid->oSites(); so++) {
 | 
			
		||||
      std::vector<typename result_type::scalar_object> vres(Bgrid->Nsimd());
 | 
			
		||||
      std::vector<int> ocoor;  grid->oCoorFromOindex(ocoor,so); 
 | 
			
		||||
      for (int si = 0; si < tmp._grid->iSites(); si++){
 | 
			
		||||
        typename result_type::scalar_object scalar_object;
 | 
			
		||||
        scalar_object = zero;
 | 
			
		||||
        std::vector<int> local_coor(tmp._grid->Nd());      
 | 
			
		||||
        std::vector<int> icoor;  
 | 
			
		||||
        tmp._grid->iCoorFromIindex(icoor,si);
 | 
			
		||||
        for (int i = 0; i < tmp._grid->Nd(); i++) local_coor[i] = ocoor[i] + tmp._grid->_rdimensions[i]*icoor[i];
 | 
			
		||||
        typename result_type::scalar_object scalar_object; scalar_object = zero;
 | 
			
		||||
        std::vector<int> local_coor;      
 | 
			
		||||
        std::vector<int> icoor; grid->iCoorFromIindex(icoor,si);
 | 
			
		||||
        grid->InOutCoorToLocalCoor(ocoor, icoor, local_coor);
 | 
			
		||||
        //for (int i = 0; i < dimU; i++) local_coor[i] = ocoor[i] + grid->_rdimensions[i]*icoor[i];
 | 
			
		||||
        //std::cout << "so: " << so << "  si: "<< si << "  local_coor: " << local_coor << std::endl;
 | 
			
		||||
 | 
			
		||||
        for (int s = 0; s < LLs; s++) {
 | 
			
		||||
          std::vector<int> slocal_coor(Btilde._grid->Nd());
 | 
			
		||||
          std::vector<int> slocal_coor(dimF);
 | 
			
		||||
          slocal_coor[0] = s;
 | 
			
		||||
          for (int s4d = 1; s4d< Btilde._grid->Nd(); s4d++) slocal_coor[s4d] = local_coor[s4d-1];
 | 
			
		||||
          int sF = Btilde._grid->oIndexReduced(slocal_coor);  
 | 
			
		||||
          assert(sF < Btilde._grid->oSites());
 | 
			
		||||
          extract(traceIndex<SpinIndex>(outerProduct(Btilde[sF], Atilde[sF])), v_scalar_object); 
 | 
			
		||||
          for (int sv = 0; sv < v_scalar_object.size(); sv++) scalar_object += v_scalar_object[sv];  // sum across the 5d dimension
 | 
			
		||||
          for (int s4d = 1; s4d< dimF; s4d++) slocal_coor[s4d] = local_coor[s4d-1];
 | 
			
		||||
          int sF = Bgrid->oIndexReduced(slocal_coor);  
 | 
			
		||||
          assert(sF < Bgrid->oSites());
 | 
			
		||||
 | 
			
		||||
          extract(traceIndex<SpinIndex>(outerProduct(Btilde[sF], Atilde[sF])), vres); 
 | 
			
		||||
          // sum across the 5d dimension
 | 
			
		||||
          for (auto v : vres) scalar_object += v;  
 | 
			
		||||
        }
 | 
			
		||||
        tmp._odata[sss].putlane(scalar_object, si);
 | 
			
		||||
        tmp._odata[so].putlane(scalar_object, si);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    PokeIndex<LorentzIndex>(mat, tmp, mu);
 | 
			
		||||
 
 | 
			
		||||
@@ -222,8 +222,7 @@ void WilsonFermion<Impl>::DerivInternal(StencilImpl &st, DoubledGaugeField &U,
 | 
			
		||||
    ////////////////////////
 | 
			
		||||
    PARALLEL_FOR_LOOP
 | 
			
		||||
    for (int sss = 0; sss < B._grid->oSites(); sss++) {
 | 
			
		||||
      Kernels::DiracOptDhopDir(st, U, st.CommBuf(), sss, sss, B, Btilde, mu,
 | 
			
		||||
                               gamma);
 | 
			
		||||
      Kernels::DiracOptDhopDir(st, U, st.CommBuf(), sss, sss, B, Btilde, mu, gamma);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //////////////////////////////////////////////////
 | 
			
		||||
@@ -234,8 +233,7 @@ void WilsonFermion<Impl>::DerivInternal(StencilImpl &st, DoubledGaugeField &U,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <class Impl>
 | 
			
		||||
void WilsonFermion<Impl>::DhopDeriv(GaugeField &mat, const FermionField &U,
 | 
			
		||||
                                    const FermionField &V, int dag) {
 | 
			
		||||
void WilsonFermion<Impl>::DhopDeriv(GaugeField &mat, const FermionField &U, const FermionField &V, int dag) {
 | 
			
		||||
  conformable(U._grid, _grid);
 | 
			
		||||
  conformable(U._grid, V._grid);
 | 
			
		||||
  conformable(U._grid, mat._grid);
 | 
			
		||||
@@ -246,8 +244,7 @@ void WilsonFermion<Impl>::DhopDeriv(GaugeField &mat, const FermionField &U,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <class Impl>
 | 
			
		||||
void WilsonFermion<Impl>::DhopDerivOE(GaugeField &mat, const FermionField &U,
 | 
			
		||||
                                      const FermionField &V, int dag) {
 | 
			
		||||
void WilsonFermion<Impl>::DhopDerivOE(GaugeField &mat, const FermionField &U, const FermionField &V, int dag) {
 | 
			
		||||
  conformable(U._grid, _cbgrid);
 | 
			
		||||
  conformable(U._grid, V._grid);
 | 
			
		||||
  conformable(U._grid, mat._grid);
 | 
			
		||||
@@ -260,8 +257,7 @@ void WilsonFermion<Impl>::DhopDerivOE(GaugeField &mat, const FermionField &U,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <class Impl>
 | 
			
		||||
void WilsonFermion<Impl>::DhopDerivEO(GaugeField &mat, const FermionField &U,
 | 
			
		||||
                                      const FermionField &V, int dag) {
 | 
			
		||||
void WilsonFermion<Impl>::DhopDerivEO(GaugeField &mat, const FermionField &U, const FermionField &V, int dag) {
 | 
			
		||||
  conformable(U._grid, _cbgrid);
 | 
			
		||||
  conformable(U._grid, V._grid);
 | 
			
		||||
  conformable(U._grid, mat._grid);
 | 
			
		||||
 
 | 
			
		||||
@@ -11,6 +11,7 @@ Author: Peter Boyle <pabobyle@ph.ed.ac.uk>
 | 
			
		||||
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
 | 
			
		||||
Author: Peter Boyle <peterboyle@Peters-MacBook-Pro-2.local>
 | 
			
		||||
Author: paboyle <paboyle@ph.ed.ac.uk>
 | 
			
		||||
Author: Guido Cossu <guido.cossu@ed.ac.uk>
 | 
			
		||||
 | 
			
		||||
    This program is free software; you can redistribute it and/or modify
 | 
			
		||||
    it under the terms of the GNU General Public License as published by
 | 
			
		||||
@@ -132,48 +133,6 @@ WilsonFermion5D<Impl>::WilsonFermion5D(GaugeField &_Umu,
 | 
			
		||||
  // Allocate the required comms buffer
 | 
			
		||||
  ImportGauge(_Umu);
 | 
			
		||||
}
 | 
			
		||||
  /*
 | 
			
		||||
template<class Impl>
 | 
			
		||||
WilsonFermion5D<Impl>::WilsonFermion5D(int simd,GaugeField &_Umu,
 | 
			
		||||
               GridCartesian         &FiveDimGrid,
 | 
			
		||||
               GridRedBlackCartesian &FiveDimRedBlackGrid,
 | 
			
		||||
               GridCartesian         &FourDimGrid,
 | 
			
		||||
               RealD _M5,const ImplParams &p) :
 | 
			
		||||
{
 | 
			
		||||
  int nsimd = Simd::Nsimd();
 | 
			
		||||
 | 
			
		||||
  // some assertions
 | 
			
		||||
  assert(FiveDimGrid._ndimension==5);
 | 
			
		||||
  assert(FiveDimRedBlackGrid._ndimension==5);
 | 
			
		||||
  assert(FiveDimRedBlackGrid._checker_dim==0); // Checkerboard the s-direction
 | 
			
		||||
  assert(FourDimGrid._ndimension==4);
 | 
			
		||||
 | 
			
		||||
  // Dimension zero of the five-d is the Ls direction
 | 
			
		||||
  Ls=FiveDimGrid._fdimensions[0];
 | 
			
		||||
  assert(FiveDimGrid._processors[0]         ==1);
 | 
			
		||||
  assert(FiveDimGrid._simd_layout[0]        ==nsimd);
 | 
			
		||||
 | 
			
		||||
  assert(FiveDimRedBlackGrid._fdimensions[0]==Ls);
 | 
			
		||||
  assert(FiveDimRedBlackGrid._processors[0] ==1);
 | 
			
		||||
  assert(FiveDimRedBlackGrid._simd_layout[0]==nsimd);
 | 
			
		||||
 | 
			
		||||
  // Other dimensions must match the decomposition of the four-D fields 
 | 
			
		||||
  for(int d=0;d<4;d++){
 | 
			
		||||
    assert(FiveDimRedBlackGrid._fdimensions[d+1]==FourDimGrid._fdimensions[d]);
 | 
			
		||||
    assert(FiveDimRedBlackGrid._processors[d+1] ==FourDimGrid._processors[d]);
 | 
			
		||||
 | 
			
		||||
    assert(FourDimGrid._simd_layout[d]=1);
 | 
			
		||||
    assert(FiveDimRedBlackGrid._simd_layout[d+1]==1);
 | 
			
		||||
 | 
			
		||||
    assert(FiveDimGrid._fdimensions[d+1]        ==FourDimGrid._fdimensions[d]);
 | 
			
		||||
    assert(FiveDimGrid._processors[d+1]         ==FourDimGrid._processors[d]);
 | 
			
		||||
    assert(FiveDimGrid._simd_layout[d+1]        ==FourDimGrid._simd_layout[d]);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  {
 | 
			
		||||
  }
 | 
			
		||||
}  
 | 
			
		||||
  */
 | 
			
		||||
     
 | 
			
		||||
template<class Impl>
 | 
			
		||||
void WilsonFermion5D<Impl>::Report(void)
 | 
			
		||||
@@ -352,7 +311,8 @@ void WilsonFermion5D<Impl>::DhopDeriv(GaugeField &mat,
 | 
			
		||||
{
 | 
			
		||||
  conformable(A._grid,FermionGrid());  
 | 
			
		||||
  conformable(A._grid,B._grid);
 | 
			
		||||
  //conformable(GaugeGrid(),mat._grid);
 | 
			
		||||
 | 
			
		||||
  //conformable(GaugeGrid(),mat._grid);// this is not general! leaving as a comment
 | 
			
		||||
 | 
			
		||||
  mat.checkerboard = A.checkerboard;
 | 
			
		||||
 | 
			
		||||
@@ -366,7 +326,6 @@ void WilsonFermion5D<Impl>::DhopDerivEO(GaugeField &mat,
 | 
			
		||||
                                        int dag)
 | 
			
		||||
{
 | 
			
		||||
  conformable(A._grid,FermionRedBlackGrid());
 | 
			
		||||
  //conformable(GaugeRedBlackGrid(),mat._grid);
 | 
			
		||||
  conformable(A._grid,B._grid);
 | 
			
		||||
 | 
			
		||||
  assert(B.checkerboard==Odd);
 | 
			
		||||
@@ -384,7 +343,6 @@ void WilsonFermion5D<Impl>::DhopDerivOE(GaugeField &mat,
 | 
			
		||||
                                        int dag)
 | 
			
		||||
{
 | 
			
		||||
  conformable(A._grid,FermionRedBlackGrid());
 | 
			
		||||
  //conformable(GaugeRedBlackGrid(),mat._grid);
 | 
			
		||||
  conformable(A._grid,B._grid);
 | 
			
		||||
 | 
			
		||||
  assert(B.checkerboard==Even);
 | 
			
		||||
 
 | 
			
		||||
@@ -7,6 +7,7 @@
 | 
			
		||||
    Copyright (C) 2015
 | 
			
		||||
 | 
			
		||||
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
 | 
			
		||||
Author: Guido Cossu <guido.cossu@ed.ac.uk>
 | 
			
		||||
 | 
			
		||||
    This program is free software; you can redistribute it and/or modify
 | 
			
		||||
    it under the terms of the GNU General Public License as published by
 | 
			
		||||
@@ -53,10 +54,6 @@ namespace Grid{
 | 
			
		||||
        
 | 
			
		||||
          GridBase *fgrid   = this->_Mat.FermionGrid();
 | 
			
		||||
          GridBase *fcbgrid = this->_Mat.FermionRedBlackGrid();
 | 
			
		||||
	  GridBase *ugrid   = this->_Mat.GaugeGrid();
 | 
			
		||||
	  GridBase *ucbgrid = this->_Mat.GaugeRedBlackGrid();
 | 
			
		||||
 | 
			
		||||
	  Real coeff = 1.0;
 | 
			
		||||
 | 
			
		||||
          FermionField tmp1(fcbgrid);
 | 
			
		||||
          FermionField tmp2(fcbgrid);
 | 
			
		||||
@@ -68,10 +65,9 @@ namespace Grid{
 | 
			
		||||
          assert(U.checkerboard==Odd);
 | 
			
		||||
          assert(V.checkerboard==U.checkerboard);
 | 
			
		||||
 | 
			
		||||
          // NOTE Guido: WE DO NOT WANT TO USE THIS GRID FOR THE FORCE
 | 
			
		||||
          // INHERIT FROM THE Force field
 | 
			
		||||
          //GaugeField ForceO(ucbgrid);
 | 
			
		||||
          //GaugeField ForceE(ucbgrid);
 | 
			
		||||
          // NOTE Guido: WE DO NOT WANT TO USE THE ucbgrid GRID FOR THE FORCE
 | 
			
		||||
          // it is not conformable with the HMC force field
 | 
			
		||||
          // INHERIT FROM THE Force field instead
 | 
			
		||||
          GridRedBlackCartesian* forcecb = new GridRedBlackCartesian(Force._grid);
 | 
			
		||||
          GaugeField ForceO(forcecb);
 | 
			
		||||
          GaugeField ForceE(forcecb);
 | 
			
		||||
@@ -94,6 +90,8 @@ namespace Grid{
 | 
			
		||||
          setCheckerboard(Force,ForceE); 
 | 
			
		||||
          setCheckerboard(Force,ForceO);
 | 
			
		||||
          Force=-Force;
 | 
			
		||||
 | 
			
		||||
          delete forcecb;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -101,10 +99,6 @@ namespace Grid{
 | 
			
		||||
        
 | 
			
		||||
          GridBase *fgrid   = this->_Mat.FermionGrid();
 | 
			
		||||
          GridBase *fcbgrid = this->_Mat.FermionRedBlackGrid();
 | 
			
		||||
	  GridBase *ugrid   = this->_Mat.GaugeGrid();
 | 
			
		||||
	  GridBase *ucbgrid = this->_Mat.GaugeRedBlackGrid();
 | 
			
		||||
 | 
			
		||||
	  Real coeff = 1.0;
 | 
			
		||||
 | 
			
		||||
          FermionField tmp1(fcbgrid);
 | 
			
		||||
          FermionField tmp2(fcbgrid);
 | 
			
		||||
@@ -116,11 +110,9 @@ namespace Grid{
 | 
			
		||||
          assert(V.checkerboard==Odd);
 | 
			
		||||
          assert(V.checkerboard==V.checkerboard);
 | 
			
		||||
 | 
			
		||||
          // NOTE Guido: WE DO NOT WANT TO USE THIS GRID FOR THE FORCE
 | 
			
		||||
          // INHERIT FROM THE Force field
 | 
			
		||||
 | 
			
		||||
	  //GaugeField ForceO(ucbgrid);
 | 
			
		||||
	  //GaugeField ForceE(ucbgrid);
 | 
			
		||||
          // NOTE Guido: WE DO NOT WANT TO USE THE ucbgrid GRID FOR THE FORCE
 | 
			
		||||
          // it is not conformable with the HMC force field
 | 
			
		||||
          // INHERIT FROM THE Force field instead
 | 
			
		||||
	  GridRedBlackCartesian* forcecb = new GridRedBlackCartesian(Force._grid);
 | 
			
		||||
          GaugeField ForceO(forcecb);
 | 
			
		||||
          GaugeField ForceE(forcecb);
 | 
			
		||||
@@ -143,7 +135,7 @@ namespace Grid{
 | 
			
		||||
          setCheckerboard(Force,ForceO);
 | 
			
		||||
          Force=-Force;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
          delete forcecb;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    };
 | 
			
		||||
 
 | 
			
		||||
@@ -166,9 +166,8 @@ namespace Grid{
 | 
			
		||||
        FermionField  X(NumOp.FermionRedBlackGrid());
 | 
			
		||||
        FermionField  Y(NumOp.FermionRedBlackGrid());
 | 
			
		||||
 | 
			
		||||
	//GaugeField   force(NumOp.GaugeGrid());
 | 
			
		||||
        // This assignment is necessary to be compliant with the HMC grids
 | 
			
		||||
	GaugeField force(dSdU._grid);
 | 
			
		||||
        conformable(force._grid, dSdU._grid);
 | 
			
		||||
 | 
			
		||||
        //Y=Vdag phi
 | 
			
		||||
        //X = (Mdag M)^-1 V^dag phi
 | 
			
		||||
@@ -179,22 +178,21 @@ namespace Grid{
 | 
			
		||||
        Mpc.Mpc(X,Y);                  // Y=  Mdag^-1 Vdag phi
 | 
			
		||||
 | 
			
		||||
        // phi^dag V (Mdag M)^-1 dV^dag  phi
 | 
			
		||||
	Vpc.MpcDagDeriv(force , X, PhiOdd );  dSdU=force;
 | 
			
		||||
        Vpc.MpcDagDeriv(force , X, PhiOdd );   dSdU = force;
 | 
			
		||||
  
 | 
			
		||||
        // phi^dag dV (Mdag M)^-1 V^dag  phi
 | 
			
		||||
	Vpc.MpcDeriv(force , PhiOdd, X );  dSdU=dSdU+force;
 | 
			
		||||
        Vpc.MpcDeriv(force , PhiOdd, X );      dSdU = dSdU+force;
 | 
			
		||||
 | 
			
		||||
        //    -    phi^dag V (Mdag M)^-1 Mdag dM   (Mdag M)^-1 V^dag  phi
 | 
			
		||||
        //    -    phi^dag V (Mdag M)^-1 dMdag M   (Mdag M)^-1 V^dag  phi
 | 
			
		||||
	Mpc.MpcDeriv(force,Y,X);   dSdU=dSdU-force;
 | 
			
		||||
	Mpc.MpcDagDeriv(force,X,Y);  dSdU=dSdU-force;
 | 
			
		||||
        Mpc.MpcDeriv(force,Y,X);              dSdU = dSdU-force;
 | 
			
		||||
        Mpc.MpcDagDeriv(force,X,Y);           dSdU = dSdU-force;
 | 
			
		||||
 | 
			
		||||
        // FIXME No force contribution from EvenEven assumed here
 | 
			
		||||
        // Needs a fix for clover.
 | 
			
		||||
        assert(NumOp.ConstEE() == 1);
 | 
			
		||||
        assert(DenOp.ConstEE() == 1);
 | 
			
		||||
 | 
			
		||||
	//dSdU = -Ta(dSdU);
 | 
			
		||||
        dSdU = -dSdU;
 | 
			
		||||
        
 | 
			
		||||
      };
 | 
			
		||||
 
 | 
			
		||||
@@ -99,11 +99,9 @@ class Integrator {
 | 
			
		||||
        FieldType forceR(U._grid);
 | 
			
		||||
        // Implement smearing only for the fundamental representation now
 | 
			
		||||
        repr_set.at(a)->deriv(Rep.U, forceR);
 | 
			
		||||
        GF force =
 | 
			
		||||
            Rep.RtoFundamentalProject(forceR);  // Ta for the fundamental rep
 | 
			
		||||
        Real force_abs = std::sqrt(norm2(force));
 | 
			
		||||
        std::cout << GridLogIntegrator << "Hirep Force average: "
 | 
			
		||||
                  << force_abs / (U._grid->gSites()) << std::endl;
 | 
			
		||||
        GF force = Rep.RtoFundamentalProject(forceR);  // Ta for the fundamental rep
 | 
			
		||||
        Real force_abs = std::sqrt(norm2(force)/(U._grid->gSites()));
 | 
			
		||||
        std::cout << GridLogIntegrator << "Hirep Force average: " << force_abs << std::endl;
 | 
			
		||||
        Mom -= force * ep ;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
@@ -118,15 +116,11 @@ class Integrator {
 | 
			
		||||
      Field& Us = Smearer.get_U(as[level].actions.at(a)->is_smeared);
 | 
			
		||||
      as[level].actions.at(a)->deriv(Us, force);  // deriv should NOT include Ta
 | 
			
		||||
 | 
			
		||||
      std::cout << GridLogIntegrator
 | 
			
		||||
                << "Smearing (on/off): " << as[level].actions.at(a)->is_smeared
 | 
			
		||||
                << std::endl;
 | 
			
		||||
      std::cout << GridLogIntegrator << "Smearing (on/off): " << as[level].actions.at(a)->is_smeared << std::endl;
 | 
			
		||||
      if (as[level].actions.at(a)->is_smeared) Smearer.smeared_force(force);
 | 
			
		||||
      force = FieldImplementation::projectForce(force); // Ta for gauge fields
 | 
			
		||||
      Real force_abs = std::sqrt(norm2(force));
 | 
			
		||||
      std::cout << GridLogIntegrator
 | 
			
		||||
                << "Force average: " << force_abs / (U._grid->gSites())
 | 
			
		||||
                << std::endl;
 | 
			
		||||
      Real force_abs = std::sqrt(norm2(force)/U._grid->gSites());
 | 
			
		||||
      std::cout << GridLogIntegrator << "Force average: " << force_abs << std::endl;
 | 
			
		||||
      Mom -= force * ep;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -139,10 +133,9 @@ class Integrator {
 | 
			
		||||
 | 
			
		||||
    t_U += ep;
 | 
			
		||||
    int fl = levels - 1;
 | 
			
		||||
    std::cout << GridLogIntegrator << "   "
 | 
			
		||||
              << "[" << fl << "] U "
 | 
			
		||||
              << " dt " << ep << " : t_U " << t_U << std::endl;
 | 
			
		||||
    std::cout << GridLogIntegrator << "   " << "[" << fl << "] U " << " dt " << ep << " : t_U " << t_U << std::endl;
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  void update_U(MomentaField& Mom, Field& U, double ep) {
 | 
			
		||||
    // exponential of Mom*U in the gauge fields case
 | 
			
		||||
    FieldImplementation::update_field(Mom, U, ep);
 | 
			
		||||
 
 | 
			
		||||
@@ -85,6 +85,7 @@ public:
 | 
			
		||||
    FrbGrid = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,UGrid);
 | 
			
		||||
    */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // temporarily need a gauge field
 | 
			
		||||
    LatticeGaugeField  U(UGrid);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user