-
Notifications
You must be signed in to change notification settings - Fork 0
/
KagomeChiral.cpp
108 lines (97 loc) · 3.27 KB
/
KagomeChiral.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
#include "KagomeChiral.hpp"
KagomeChiral::KagomeChiral(System const& s, double const& phi):
System(s),
Kagome<std::complex<double> >(set_ab(),6,"kagome-chiral"),
phi_(phi)
{
if(phi<=3.0){
if(status_==3){ init_lattice(); }
if(status_==2){
init_fermionic();
system_info_.text("KagomeChiral :");
system_info_.item("Each color has the same Hamiltonian.");
system_info_.item("6 sites per unit cell.");
system_info_.item("Flux of "+RST::math(my::tostring(phi)+"\\pi/3")+" per plaquette.");
}
} else { std::cerr<<__PRETTY_FUNCTION__<<" : the flux per plaquette shouldn't be bigger than pi (phi<=3)"<<std::endl; }
}
/*{method needed for running*/
void KagomeChiral::compute_H(){
H_.set(n_,n_,0);
double t(-1.0);
double phi(phi_*M_PI/3.0);
for(unsigned int i(0);i<obs_[0].nlinks();i++){
switch(obs_[0](i,5)){
case 0:{ H_(obs_[0](i,0),obs_[0](i,1)) = std::polar((obs_[0](i,4)?bc_*t:t),(obs_[0](i,3)==0?-phi:0.0)); }break;
case 1:{ H_(obs_[0](i,0),obs_[0](i,1)) = std::polar((obs_[0](i,4)?bc_*t:t),(obs_[0](i,3)==2?phi:0.0)); }break;
case 2:{ H_(obs_[0](i,0),obs_[0](i,1)) = std::polar((obs_[0](i,4)?bc_*t:t),(obs_[0](i,3)==0?3.0*phi:0.0)); }break;
case 3:{ H_(obs_[0](i,0),obs_[0](i,1)) = std::polar((obs_[0](i,4)?bc_*t:t),(obs_[0](i,3)==0?-phi:0.0)); }break;
case 4:{ H_(obs_[0](i,0),obs_[0](i,1)) = std::polar((obs_[0](i,4)?bc_*t:t),(obs_[0](i,3)==2?-2.0*phi:0.0)); }break;
case 5:{ H_(obs_[0](i,0),obs_[0](i,1)) = (obs_[0](i,4)?bc_*t:t); }break;
}
}
H_ += H_.conjugate_transpose();
}
void KagomeChiral::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 KagomeChiral::save_param(IOFiles& w) const {
if(w.is_binary()){
w<<Vector<double>(1,phi_);
w.add_to_header()->title(RST::math("\\phi")+"="+my::tostring(phi_),'<');
w.add_to_header()->add(system_info_.get());
} else { w<<phi_<<" "; }
}
Matrix<double> KagomeChiral::set_ab() const {
Matrix<double> tmp(2,2);
tmp(0,0) = 2.0;
tmp(1,0) = 0.0;
tmp(0,1) = 0.0;
tmp(1,1) = 2.0*sqrt(3.0);
return tmp;
}
unsigned int KagomeChiral::unit_cell_index(Vector<double> const& x) const {
if(my::are_equal(x(1),0.0,eq_prec_,eq_prec_)){
if(my::are_equal(x(0),0.0,eq_prec_,eq_prec_)){ return 0; }
if(my::are_equal(x(0),0.5,eq_prec_,eq_prec_)){ return 2; }
}
if(my::are_equal(x(1),0.25,eq_prec_,eq_prec_)){
if(my::are_equal(x(0),0.25,eq_prec_,eq_prec_)){ return 1; }
}
if(my::are_equal(x(1),0.5,eq_prec_,eq_prec_)){
if(my::are_equal(x(0),0.0,eq_prec_,eq_prec_)){ return 5; }
if(my::are_equal(x(0),0.5,eq_prec_,eq_prec_)){ return 3; }
}
if(my::are_equal(x(1),0.75,eq_prec_,eq_prec_)){
if(my::are_equal(x(0),0.75,eq_prec_,eq_prec_)){ return 4; }
}
std::cerr<<__PRETTY_FUNCTION__<<" : unknown position in ab for x="<<x<<std::endl;
return spuc_;
}
/*}*/
/*{method needed for checking*/
void KagomeChiral::display_results(){
compute_H();
std::string phi(my::tostring(phi_));
draw_lattice(true,true,false,(dir_nn_[4]+dir_nn_[3])*0.5,"-d:phi "+phi,RST::math("\\phi")+"="+phi);
}
void KagomeChiral::check(){
info_ = "";
path_ = "";
dir_ = "./";
filename_ ="kagome-chiral";
display_results();
//compute_H();
//plot_band_structure();
}
/*}*/