mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-03 21:44:33 +00:00 
			
		
		
		
	One more function to generalise the HMC integrator
This commit is contained in:
		@@ -96,6 +96,17 @@ public:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  static inline RealD FieldSquareNorm(Field& U){
 | 
				
			||||||
 | 
					    LatticeComplex Hloc(U._grid);
 | 
				
			||||||
 | 
					    Hloc = zero;
 | 
				
			||||||
 | 
					    for (int mu = 0; mu < Nd; mu++) {
 | 
				
			||||||
 | 
					      auto Umu = PeekIndex<LorentzIndex>(U, mu);
 | 
				
			||||||
 | 
					      Hloc += trace(Umu * Umu);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    Complex Hsum = sum(Hloc);
 | 
				
			||||||
 | 
					    return Hsum.real();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Composition with smeared link, bc's etc.. probably need multiple inheritance
 | 
					// Composition with smeared link, bc's etc.. probably need multiple inheritance
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -253,17 +253,7 @@ class Integrator {
 | 
				
			|||||||
  // Calculate action
 | 
					  // Calculate action
 | 
				
			||||||
  RealD S(Field& U) {  // here also U not used
 | 
					  RealD S(Field& U) {  // here also U not used
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    LatticeComplex Hloc(U._grid);
 | 
					    RealD H = - FieldImplementation::FieldSquareNorm(P); // - trace (P*P)
 | 
				
			||||||
    Hloc = zero;
 | 
					 | 
				
			||||||
    // Momenta  --- modify this (take the trace of field)
 | 
					 | 
				
			||||||
    // momenta_action()
 | 
					 | 
				
			||||||
    for (int mu = 0; mu < Nd; mu++) {
 | 
					 | 
				
			||||||
      auto Pmu = PeekIndex<LorentzIndex>(P, mu);
 | 
					 | 
				
			||||||
      Hloc -= trace(Pmu * Pmu);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    Complex Hsum = sum(Hloc);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    RealD H = Hsum.real();
 | 
					 | 
				
			||||||
    RealD Hterm;
 | 
					    RealD Hterm;
 | 
				
			||||||
    std::cout << GridLogMessage << "Momentum action H_p = " << H << "\n";
 | 
					    std::cout << GridLogMessage << "Momentum action H_p = " << H << "\n";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user