1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-14 22:07:05 +01:00

Debugged vector version of ProjectOnGroup

This commit is contained in:
neo
2015-07-06 02:24:58 +09:00
parent b1f94fa292
commit 62d8952c0a
10 changed files with 89 additions and 26 deletions

View File

@ -9,7 +9,7 @@ namespace Grid{
////////////////////////////// Default values
Nsweeps = 10;
TotalSweeps = 10;
ThermalizationSteps = 0;
ThermalizationSteps = 1;
StartingConfig = 0;
SaveInterval = 1;
Filename_prefix = "Conf_";

View File

@ -53,13 +53,13 @@ namespace Grid{
RealD evolve_step(LatticeLorentzColourMatrix& U){
MD->init(U,pRNG); // set U and initialize P and phi's
RealD H0 = MD->S(); // current state
MD.init(U,pRNG); // set U and initialize P and phi's
RealD H0 = MD.S(U); // current state
std::cout<<"Total H_before = "<< H0 << "\n";
MD->integrate(U,0);
MD.integrate(U,0);
RealD H1 = MD->S(); // updated state
RealD H1 = MD.S(U); // updated state
std::cout<<"Total H_after = "<< H1 << "\n";
return (H1-H0);
@ -104,10 +104,11 @@ namespace Grid{
for(int iter=Params.StartingConfig;
iter < Params.Nsweeps+Params.StartingConfig; ++iter){
std::cout << "-- # Sweep = "<< iter << "\n";
Ucopy = Uin;
DeltaH = evolve_step(Ucopy);
if(metropolis_test(DeltaH)) Uin = Ucopy;
if(metropolis_test(DeltaH)) Uin = Ucopy;
// need sync?
}

View File

@ -25,7 +25,7 @@ namespace Grid{
typedef std::vector<Observer*> ObserverList;
class LeapFrog;
struct IntegratorParameters{
int Nexp;
@ -77,7 +77,9 @@ namespace Grid{
for (int mu = 0; mu < Nd; mu++){
Umu=peekLorentz(U, mu);
Pmu=peekLorentz(*P, mu);
std::cout << "U norm ["<<mu<<"] = "<< norm2(Umu) << " : Pmu "<< norm2(Pmu)<<"\n";
Umu = expMat(Pmu, Complex(ep, 0.0))*Umu;
pokeLorentz(U, Umu, mu);
}
}
@ -102,10 +104,15 @@ namespace Grid{
void init(LatticeLorentzColourMatrix& U,
GridParallelRNG& pRNG){
std::cout<< "Integrator init\n";
if (!P)
P = new LatticeLorentzColourMatrix(U._grid);
if (!P){
std::unique_ptr<LatticeLorentzColourMatrix> Pnew(new LatticeLorentzColourMatrix(U._grid));
P = std::move(Pnew);
}
MDutils::generate_momenta(*P,pRNG);
for(int level=0; level< as.size(); ++level){
for(int actionID=0; actionID<as.at(level).size(); ++actionID){
as[level].at(actionID)->init(U, pRNG);
@ -116,12 +123,19 @@ namespace Grid{
RealD S(LatticeLorentzColourMatrix& U){
LatticeComplex Hloc(U._grid);
Hloc = zero;
// Momenta
LatticeComplex Hloc = - trace((*P)*adj(*P));
for (int mu=0; mu <Nd; mu++){
LatticeColourMatrix Pmu = peekLorentz(*P, mu);
Hloc -= trace(Pmu*adj(Pmu));
}
Complex Hsum = sum(Hloc);
RealD H = Hsum.real();
std::cout << "H_p = "<< H << "\n";
// Actions
for(int level=0; level<as.size(); ++level)
for(int actionID=0; actionID<as.at(level).size(); ++actionID)
@ -136,7 +150,7 @@ namespace Grid{
std::vector<int> clock;
clock.resize(as.size(),0);
for(int step=0; step< Params.MDsteps; ++step) // MD step
TheIntegrator.step(U,0,clock, *(this));
TheIntegrator.step(U,0,clock, (this));
}
};