-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.cpp
More file actions
69 lines (61 loc) · 2.09 KB
/
main.cpp
File metadata and controls
69 lines (61 loc) · 2.09 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
// main.cpp
// ED_solver
//
// Created by Bin Xu on 12/19/14.
// Copyright (c) 2014 Bin Xu. All rights reserved.
//
#include <iostream>
#include <iomanip>
#include "measurement.h"
#include "output.h"
bool interest(const Orbital & orb) // describe the interesting sectors
{
if (orb.p.px == 0 && orb.p.py == 8) return true;
else return false;
}
int main(int argc, const char * argv[])
{
Hamiltonian ham;
ham.getParameters(); // This will invoke the keyboard input
HilbertSpace hilbert_space(ham);
hilbert_space.buildOrbitalList();
hilbert_space.buildReverseOrbitalMap();
hilbert_space.buildPairMap();
hilbert_space.buildStateMap();
vector<Measurement> measure_list;
for (auto orb : hilbert_space.getStateMap())
{
cout<<"Sector "<<orb.first<<" Dimension: "<<orb.second.size()<<endl;
}
for (auto orb : hilbert_space.getStateMap())
// if (interest(orb.first))
{
cout<<"Sector "<<orb.first<<" Dimension: "<<orb.second.size()<<endl;
pair<double, double> k = ham.computeK(orb.first.p.px, orb.first.p.py);
cout<<"Momentum: ("<<k.first<<", "<<k.second<<")"<<endl;
Interaction interaction(hilbert_space, orb.first); //This is the interaction matrix
interaction.decorateState();
interaction.build2bodyMatrix();
Solver diagonalize(interaction, orb.first);
diagonalize.diagonalize();
Measurement measurement(diagonalize, hilbert_space, ham);
measurement.measure();
measure_list.push_back(measurement);
}
for (auto it : measure_list)
{
cout<<it.orb_sector<<endl;
pair<double, double> k = ham.computeK(it.orb_sector.p.px, it.orb_sector.p.py);
cout<<"Momentum: ("<<k.first<<", "<<k.second<<")"<<endl;
for (int i = 0; i < it.eigenvalues.size(); i++)
{
cout<<"Eigenvalue: "<<it.eigenvalues[i]<<endl;
// cout<<"Density: "<<endl;
// for(auto it3 : it.one_state_results[i].occupation_nbr) cout<<it3<<" ";
// cout<<endl;
}
cout<<endl;
}
return 0;
}