mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-04 05:54:32 +00:00 
			
		
		
		
	Moving the topological charge outside the HMC related routines
This commit is contained in:
		@@ -49,24 +49,7 @@ class TopologicalCharge : public HmcObservable<typename Impl::Field> {
 | 
				
			|||||||
                            GridSerialRNG &sRNG,
 | 
					                            GridSerialRNG &sRNG,
 | 
				
			||||||
                            GridParallelRNG &pRNG) {
 | 
					                            GridParallelRNG &pRNG) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 4d topological charge
 | 
					    Real q = WilsonLoops<Impl>::TopologicalCharge(U);
 | 
				
			||||||
    // Bx = -iF(y,z), By = -iF(z,y), Bz = -iF(x,y)
 | 
					 | 
				
			||||||
    GaugeLinkField Bx(U._grid), By(U._grid), Bz(U._grid);
 | 
					 | 
				
			||||||
    WilsonLoops<Impl>::FieldStrength(Bx, U, Ydir, Zdir);
 | 
					 | 
				
			||||||
    WilsonLoops<Impl>::FieldStrength(By, U, Zdir, Xdir);
 | 
					 | 
				
			||||||
    WilsonLoops<Impl>::FieldStrength(Bz, U, Xdir, Ydir);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Ex = -iF(t,x), Ey = -iF(t,y), Ez = -iF(t,z)
 | 
					 | 
				
			||||||
    GaugeLinkField Ex(U._grid), Ey(U._grid), Ez(U._grid);
 | 
					 | 
				
			||||||
    WilsonLoops<Impl>::FieldStrength(Ex, U, Tdir, Xdir);
 | 
					 | 
				
			||||||
    WilsonLoops<Impl>::FieldStrength(Ey, U, Tdir, Ydir);
 | 
					 | 
				
			||||||
    WilsonLoops<Impl>::FieldStrength(Ez, U, Tdir, Zdir);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    double coeff = 8.0/(32.0*M_PI*M_PI);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    LatticeComplex qfield = coeff*trace(Bx*Ex + By*Ey + Bz*Ez);
 | 
					 | 
				
			||||||
    TComplex Tq = sum(qfield);
 | 
					 | 
				
			||||||
    Real q = TensorRemove(Tq).real();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    int def_prec = std::cout.precision();
 | 
					    int def_prec = std::cout.precision();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -313,6 +313,27 @@ public:
 | 
				
			|||||||
      FS = 0.25*Ta(u*v + Cshift(vu, mu, +1));
 | 
					      FS = 0.25*Ta(u*v + Cshift(vu, mu, +1));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  static Real TopologicalCharge(GaugeLorentz &U){
 | 
				
			||||||
 | 
					    // 4d topological charge
 | 
				
			||||||
 | 
					    assert(Nd==4);
 | 
				
			||||||
 | 
					    // Bx = -iF(y,z), By = -iF(z,y), Bz = -iF(x,y)
 | 
				
			||||||
 | 
					    GaugeMat Bx(U._grid), By(U._grid), Bz(U._grid);
 | 
				
			||||||
 | 
					    FieldStrength(Bx, U, Ydir, Zdir);
 | 
				
			||||||
 | 
					    FieldStrength(By, U, Zdir, Xdir);
 | 
				
			||||||
 | 
					    FieldStrength(Bz, U, Xdir, Ydir);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Ex = -iF(t,x), Ey = -iF(t,y), Ez = -iF(t,z)
 | 
				
			||||||
 | 
					    GaugeMat Ex(U._grid), Ey(U._grid), Ez(U._grid);
 | 
				
			||||||
 | 
					    FieldStrength(Ex, U, Tdir, Xdir);
 | 
				
			||||||
 | 
					    FieldStrength(Ey, U, Tdir, Ydir);
 | 
				
			||||||
 | 
					    FieldStrength(Ez, U, Tdir, Zdir);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    double coeff = 8.0/(32.0*M_PI*M_PI);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    LatticeComplex qfield = coeff*trace(Bx*Ex + By*Ey + Bz*Ez);
 | 
				
			||||||
 | 
					    TComplex Tq = sum(qfield);
 | 
				
			||||||
 | 
					    return TensorRemove(Tq).real();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //////////////////////////////////////////////////////
 | 
					  //////////////////////////////////////////////////////
 | 
				
			||||||
  // Similar to above for rectangle is required
 | 
					  // Similar to above for rectangle is required
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user