-
Notifications
You must be signed in to change notification settings - Fork 0
/
LadderFree.cpp
117 lines (99 loc) · 2.77 KB
/
LadderFree.cpp
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#include "LadderFree.hpp"
LadderFree::LadderFree(System const& s, Vector<double> const& t, Vector<double> const& mu):
System(s),
Ladder<double>(set_spuc(t,mu,N_/m_),"ladder-free"),
t_(t),
mu_(mu)
{
if(status_==2 && t_.ptr()){
init_fermionic();
system_info_.text("LadderFree :");
system_info_.text(" Each color has the same Hamiltonian.");
filename_ += "-t";
for(unsigned int i(0);i<t_.size();i++){
filename_ += ((t_(i)>=0)?"+":"")+my::tostring(t_(i));
}
filename_ += "-mu";
for(unsigned int i(0);i<mu_.size();i++){
filename_ += ((mu_(i)>=0)?"+":"")+my::tostring(mu_(i));
}
}
}
/*{method needed for running*/
void LadderFree::compute_H(){
H_.set(n_,n_,0);
unsigned int s0(0);
unsigned int s1(0);
unsigned int k(0);
unsigned int l(0);
for(unsigned int i(0);i<obs_[0].nlinks();i++){
s0 = obs_[0](i,0);
s1 = obs_[0](i,1);
H_(s0,s1) = (obs_[0](i,4)?bc_*t_(k):t_(k));
k = (k+1)%(3*spuc_/2);
if(!obs_[0](i,3)){
H_(s0,s0) = mu_(l)/2.0;
l = (l+1)%spuc_;
}
}
H_ += H_.transpose();
}
void LadderFree::create(){
compute_H();
diagonalize(true);
if(status_==1){
for(unsigned int c(0);c<N_;c++){
for(unsigned int i(0);i<n_;i++){
for(unsigned int j(0);j<M_(c);j++){
EVec_[c](i,j) = H_(i,j);
}
}
}
}
}
void LadderFree::save_param(IOFiles& w) const {
if(w.is_binary()){
Vector<double> param(t_.size()+mu_.size());
for(unsigned int i(0);i<t_.size();i++){ param(i) = t_(i); }
for(unsigned int i(0);i<mu_.size();i++){ param(i+t_.size()) = mu_(i); }
w<<param;
w.add_to_header()->title("t=("+my::tostring(t_)+") "+RST::math("\\mu")+"=("+my::tostring(mu_)+")",'<');
w.add_to_header()->add(system_info_.get());
} else { w<<t_<<" "<<mu_<<" "; }
}
unsigned int LadderFree::set_spuc(Vector<double> const& t, Vector<double> const& mu, unsigned int const& spuc){
if((t.size()*2/3)%spuc == 0 && mu.size()%spuc==0 && mu.size()<9){ return mu.size(); }
else {
std::cerr<<__PRETTY_FUNCTION__<<" : invalid or incoherent t and mu sizes : t:="<<t.size()<<", mu:="<<mu.size()<<std::endl;
return 1;
}
}
/*}*/
/*{method needed for checking*/
void LadderFree::display_results(){
compute_H();
std::string t(my::tostring(t_));
std::string mu(my::tostring(mu_));
draw_lattice(true,true,true,"-d:t "+t+" -d:mu "+mu,"t=("+t+") "+RST::math("\\mu")+"=("+mu+")");
}
void LadderFree::check(){
info_ = "";
path_ = "";
dir_ = "./";
filename_ ="ladder-free";
display_results();
//compute_H();
//plot_band_structure();
//create_obs(0);
//std::cout<<obs_[3].get_links()<<std::endl;
}
/*}*/
/*{method needed for analysing*/
std::string LadderFree::extract_level_6(){
(*data_write_)<<N_<<" "<<m_<<" "<<n_<<" "<<bc_<<" "<<asin(J_(1))<<" "<<obs_[0][0]<<IOFiles::endl;
display_results();
save_param(*jd_write_);
save(*jd_write_);
return filename_;
}
/*}*/