-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathStagMagnTrack.cpp
More file actions
52 lines (49 loc) · 1.5 KB
/
StagMagnTrack.cpp
File metadata and controls
52 lines (49 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "StagMagnTrack.h"
#include "Stepper.h"
#include "SlaterDeterminant.h"
#include "LatticeState.h"
#include "FileManager.h"
#include "Lattice.h"
StagMagnTrack::StagMagnTrack(const Stepper* stepper, FileManager* fm)
:Quantity(stepper,fm,"StagMagnTrack")
{}
StagMagnTrack::~StagMagnTrack() {}
void StagMagnTrack::init()
{
Quantity::init();
m_vals.clear();
}
void StagMagnTrack::save() const
{
m_fm->FileStream(m_basename).Write(m_vals.size()*2,1,(double*)m_vals.data());
}
void StagMagnTrack::measure()
{
const LatticeState* st=m_stepper->GetLatticeState();
if((st->GetNfl()==1 && st->GetNifs()[0]==2) ||
(st->GetNfl()==2 && st->GetNifs()[0]==1 && st->GetNifs()[1]==1))
{
m_vals.push_back(0);
const Lattice* lat=st->GetLattice();
for(size_t v=0;v<st->GetNsites();++v){
complex<double> ph=std::exp(
complex<double>(0,1)*M_PI*(
lat->GetVertices()[v]->uc[0]
+lat->GetVertices()[v]->pos[0]
+lat->GetVertices()[v]->uc[1]
+lat->GetVertices()[v]->pos[1]));
vector<uint_vec_t> vst;
st->GetLatOc(v,vst);
int up=0;
if(st->GetNfl()==2){
if(vst[0].size())
up=1;
} else {
if(vst[0][0]==0)
up=1;
}
m_vals.back()+=double(2*up-1)*ph;
}
m_vals.back()/=st->GetNsites();
}
}