9#include "ParamHandler.h"
10#include "CuthillMcKeeCompressor.h"
11#include <boost/rational.hpp>
12#include "termcolor.hpp"
17 ArrayXXd res(L,L); res.setZero();
19 res.matrix().diagonal<1>().setConstant(lambda1);
20 res.matrix().diagonal<-1>().setConstant(lambda1);
22 res.matrix().diagonal<2>().setConstant(lambda2);
23 res.matrix().diagonal<-2>().setConstant(lambda2);
30ArrayXXd
create_1D_PBC (
size_t L,
double lambda1=1.,
double lambda2=0.,
bool COMPRESSED=
false)
45 if (COMPRESSED and lambda2 == 0.)
49 res(0,1) = lambda1; res(1,0) = lambda1;
50 res(L-2,L-1) = lambda1; res(L-1,L-2) = lambda1;
51 for (
size_t l=0; l<L-2; l++)
57 else if (COMPRESSED and lambda2 != 0.)
59 auto res_ = compress_CuthillMcKee(res,
true);
68 ArrayXXd res(2*L,2*L); res.setZero();
70 for (
int i=0; i<L; ++i)
71 for (
int j=0; j<L; ++j)
73 if (abs(tFull(i,j)) > 1e-10)
75 res(2*i,2*j) = tFull(i,j);
76 res(2*i+1,2*j+1) = factor*tFull(i,j);
82ArrayXXd
create_1D_AB (
size_t L,
double lambda1A=1.,
double lambda1B=1.,
double lambda2A=0.,
double lambda2B=0.)
87 for (
int i=0; i<L; i+=2)
89 if (i+1<L) res(i, i+1) = lambda1A;
90 if (i+2<L) res(i+1,i+2) = lambda1B;
93 for (
int i=0; i<L; i+=2)
95 if (i+2<L) res(i ,i+2) = lambda2A;
96 if (i+3<L) res(i+1,i+3) = lambda2B;
99 res += res.transpose().eval();
104ArrayXXd
create_1D_PBC_AB (
size_t L,
double lambda1A=1.,
double lambda1B=1.,
double lambda2A=0.,
double lambda2B=0.,
bool COMPRESSED=
true)
109 for (
int i=0; i<L; i+=2)
111 res(i, (i+1)%L) = lambda1A;
112 if (i+1<L) res(i+1,(i+2)%L) = lambda1B;
115 for (
int i=0; i<L; i+=2)
117 res(i, (i+2)%L) = lambda2A;
118 if (i+1<L) res(i+1,(i+3)%L) = lambda2B;
121 res += res.transpose().eval();
127 auto res_ = compress_CuthillMcKee(res,
true);
134ArrayXXd
hopping_square (
int Lx,
int Ly,
bool PBCx=
false,
bool PBCy=
true,
double lambda=1.)
136 ArrayXXd res(Lx*Ly,Lx*Ly); res.setZero();
138 for (
int x=0; x<Lx; ++x)
141 for (
int i=i0; i<=i0+Ly-2; ++i)
146 if (PBCy) res(i0,i0+Ly-1) = lambda;
149 for (
int y=0; y<Ly; ++y)
151 for (
int x=0; x<Lx-1; ++x)
154 res(i,i+Ly) = lambda;
160 for (
int i=0; i<Ly; ++i)
162 res(i,Ly*Lx-Ly+i) = lambda;
165 res += res.transpose().eval();
170void split_kagomeYC_AB (
int Lx,
int Ly, std::vector<std::vector<int>> &
A, std::vector<std::vector<int>> &
B)
174 int L = Ly*Nevn+Ly/2*Nodd;
176 vector<int> input(L);
177 for (
int j=0; j<L; ++j) input[j] = j;
183 std::vector<int> batchA;
184 std::vector<int> batchB;
186 for (
int j=0; j<Ly; j++)
188 batchA.push_back(input[i+j]);
196 for (
int j=0; j<Ly/2; j++)
198 batchB.push_back(input[i+j]);
211 int L = Ly/2*Nevn+Ly*Nodd;
213 std::vector<int> input(L);
214 for (
int j=0; j<L; ++j) input[j] = j;
218 while (i + Ly/2 <= L)
220 std::vector<int> batchA;
222 for (
int j=0; j<Ly/2; j++)
224 batchA.push_back(input[i+j]);
232 std::vector<int> batchB;
234 for (
int j=0; j<Ly; j++)
236 batchB.push_back(input[i+j]);
245int find_x_kagomeYC (
int index,
int L,
const std::vector<std::vector<int>> &
A,
const std::vector<std::vector<int>> &
B)
257 for (
int i=0; i<
A.size(); ++i)
259 auto it = find(
A[i].begin(),
A[i].end(), index);
260 if (it !=
A[i].end())
270 for (
int i=0; i<
B.size(); ++i)
272 auto it = find(
B[i].begin(),
B[i].end(), index);
273 if (it !=
B[i].end())
284 return (EVN)? 2*i0 : 2*i0+1;
289 assert(PBCx==
false and PBCy==
true);
293 int L = Ly*Nevn+Ly/2*Nodd;
295 ArrayXXd res(L,L); res.setZero();
297 vector<vector<int>> i_evn;
298 vector<vector<int>> i_odd;
325 for (
int x=0; x<i_evn.size(); ++x)
326 for (
int i=0; i<i_evn[x].size(); ++i)
329 int l = i_evn[x][(i+1)%Ly];
331 res(min(k,l),max(k,l)) = lambda;
335 for (
int x=0; x<i_evn.size(); ++x)
336 for (
int i=1; i<i_evn[x].size(); i+=2)
339 int l = i_odd[x][(i-1)/2];
341 res(min(k,l),max(k,l)) = lambda;
345 for (
int x=0; x<i_odd.size()-1; ++x)
346 for (
int i=0; i<i_odd[x].size(); i+=1)
349 int l = i_evn[x+1][2*i+1];
351 res(min(k,l),max(k,l)) = lambda;
355 for (
int x=0; x<i_evn.size(); ++x)
356 for (
int i=0; i<i_evn[x].size(); i+=2)
359 int l = i_odd[x][i/2];
361 res(min(k,l),max(k,l)) = lambda;
365 for (
int x=0; x<i_odd.size()-1; ++x)
366 for (
int i=0; i<i_odd[x].size(); ++i)
369 int l = i_evn[x+1][(2*i+2)%Ly];
371 res(min(k,l),max(k,l)) = lambda;
374 res += res.transpose().eval();
381ArrayXXd
hopping_kagomeYC_BAB (
int Lx,
int Ly,
bool PBCx=
false,
bool PBCy=
true,
double lambda=1.,
bool VERBOSE=
false)
383 assert(PBCx==
false and PBCy==
true);
387 int L = Ly/2*Nevn+Ly*Nodd;
389 ArrayXXd res(L,L); res.setZero();
391 vector<vector<int>> i_evn;
392 vector<vector<int>> i_odd;
398 lout <<
"EVN:" << endl;
399 for (
int i=0; i<i_evn.size(); ++i)
401 for (
int j=0; j<i_evn[i].size(); ++j)
403 lout << i_evn[i][j] << endl;
405 lout <<
"----" << endl;
408 lout <<
"ODD:" << endl;
409 for (
int i=0; i<i_odd.size(); ++i)
411 for (
int j=0; j<i_odd[i].size(); ++j)
413 lout << i_odd[i][j] << endl;
415 lout <<
"----" << endl;
420 for (
int x=0; x<i_odd.size(); ++x)
421 for (
int i=0; i<i_odd[x].size(); ++i)
424 int l = i_odd[x][(i+1)%Ly];
425 if (VERBOSE) lout <<
"vertical odd bond: " << min(k,l) <<
", " << max(k,l) << endl;
426 res(min(k,l),max(k,l)) = lambda;
430 for (
int x=0; x<i_evn.size()-1; ++x)
431 for (
int i=0; i<i_evn[x].size(); i+=1)
434 int l = i_odd[x][2*i+1];
435 if (VERBOSE) lout <<
"horizontal evn bond: " << min(k,l) <<
", " << max(k,l) << endl;
436 res(min(k,l),max(k,l)) = lambda;
440 for (
int x=0; x<i_odd.size(); ++x)
441 for (
int i=1; i<i_odd[x].size(); i+=2)
444 int l = i_evn[x+1][(i-1)/2];
445 if (VERBOSE) lout <<
"horizontal odd bond: " << min(k,l) <<
", " << max(k,l) << endl;
446 res(min(k,l),max(k,l)) = lambda;
450 for (
int x=0; x<i_evn.size()-1; ++x)
451 for (
int i=0; i<i_evn[x].size(); ++i)
454 int l = i_odd[x][(2*i+2)%Ly];
455 if (VERBOSE) lout <<
"diagonal evn bond: " << min(k,l) <<
", " << max(k,l) << endl;
456 res(min(k,l),max(k,l)) = lambda;
460 for (
int x=0; x<i_odd.size(); ++x)
461 for (
int i=0; i<i_odd[x].size(); i+=2)
464 int l = i_evn[x+1][i/2];
465 if (VERBOSE) lout <<
"diagonal odd bond: " << min(k,l) <<
", " << max(k,l) << endl;
466 res(min(k,l),max(k,l)) = lambda;
469 res += res.transpose().eval();
476void split_kagomeXC (
int Lx,
int Ly, std::vector<std::vector<int>> &
A, std::vector<std::vector<int>> &
B, std::vector<std::vector<int>> &C, std::vector<std::vector<int>> &D)
479 int L = N*Lx + N*(Lx/2+1) + N*Lx + N*Lx/2;
481 std::vector<int> input(L);
482 for (
int j=0; j<L; ++j) input[j] = j;
484 int currentIndex = 0;
485 while(currentIndex < L)
489 for(
int i=currentIndex; i<currentIndex+Lx && i<L; i++) {
490 subA.push_back(input[i]);
494 if(currentIndex >= L)
break;
498 for(
int i=currentIndex; i<currentIndex+Lx/2+1 && i<L; i++) {
499 subB.push_back(input[i]);
502 currentIndex += Lx/2+1;
503 if(currentIndex >= L)
break;
507 for(
int i=currentIndex; i<currentIndex+Lx && i<L; i++) {
508 subC.push_back(input[i]);
512 if(currentIndex >= L)
break;
516 for(
int i=currentIndex; i<currentIndex+Lx/2 && i<L; i++) {
517 subD.push_back(input[i]);
520 currentIndex += Lx/2;
552ArrayXXd
hopping_kagomeXC (
int Lx,
int Ly,
bool PBCx=
false,
bool PBCy=
true,
double lambda=1.,
bool VERBOSE=
false)
555 int L = N*Lx + N*(Lx/2+1) + N*Lx + N*Lx/2;
557 ArrayXXd res(L,L); res.setZero();
559 vector<vector<int>> iA, iB, iC, iD;
562 for (
int y=0; y<N; ++y)
564 if (VERBOSE) lout <<
"y=" << y << endl;
567 for (
int i=0; i<iA[y].size()-1; ++i)
571 res(min(k,l),max(k,l)) = lambda;
572 if (VERBOSE) lout <<
"A-A: " << min(k,l) <<
", " << max(k,l) << endl;
574 for (
int i=0; i<iC[y].size()-1; ++i)
578 res(min(k,l),max(k,l)) = lambda;
579 if (VERBOSE) lout <<
"C-C: " << min(k,l) <<
", " << max(k,l) << endl;
583 for (
int i=0; i<iA[y].size(); ++i)
589 res(min(k,l),max(k,l)) = lambda;
590 if (VERBOSE) lout <<
"A-B first: " << min(k,l) <<
", " << max(k,l) << endl;
596 res(min(k,l),max(k,l)) = lambda;
597 if (VERBOSE) lout <<
"A-B last: " << min(k,l) <<
", " << max(k,l) << endl;
605 res(min(k,l),max(k,l)) = lambda;
606 if (VERBOSE) lout <<
"A-B: " << min(k,l) <<
", " << max(k,l) << endl;
611 int l = iB[y][(i+1)/2];
612 res(min(k,l),max(k,l)) = lambda;
613 if (VERBOSE) lout <<
"A-B: " << min(k,l) <<
", " << max(k,l) << endl;
618 for (
int i=0; i<iB[y].size(); ++i)
624 res(min(k,l),max(k,l)) = lambda;
625 if (VERBOSE) lout <<
"B-C first: " << min(k,l) <<
", " << max(k,l) << endl;
631 res(min(k,l),max(k,l)) = lambda;
632 if (VERBOSE) lout <<
"B-C last: " << min(k,l) <<
", " << max(k,l) << endl;
640 res(min(k,l),max(k,l)) = lambda;
641 if (VERBOSE) lout <<
"B-C: " << min(k,l) <<
", " << max(k,l) << endl;
645 res(min(k,l),max(k,l)) = lambda;
646 if (VERBOSE) lout <<
"B-C: " << min(k,l) <<
", " << max(k,l) << endl;
652 res(min(k,l),max(k,l)) = lambda;
653 if (VERBOSE) lout <<
"B-C: " << min(k,l) <<
", " << max(k,l) << endl;
657 res(min(k,l),max(k,l)) = lambda;
658 if (VERBOSE) lout <<
"B-C: " << min(k,l) <<
", " << max(k,l) << endl;
663 for (
int i=0; i<iD[y].size(); ++i)
667 res(min(k,l),max(k,l)) = lambda;
668 if (VERBOSE) lout <<
"C-D: " << min(k,l) <<
", " << max(k,l) << endl;
672 res(min(k,l),max(k,l)) = lambda;
673 if (VERBOSE) lout <<
"C-D: " << min(k,l) <<
", " << max(k,l) << endl;
677 for (
int i=0; i<iD[y].size(); ++i)
679 int k = iA[(y+1)%iA.size()][2*i];
681 res(min(k,l),max(k,l)) = lambda;
682 if (VERBOSE) lout <<
"D-A: " << min(k,l) <<
", " << max(k,l) << endl;
684 k = iA[(y+1)%iA.size()][2*i+1];
686 res(min(k,l),max(k,l)) = lambda;
687 if (VERBOSE) lout <<
"D-A: " << min(k,l) <<
", " << max(k,l) << endl;
691 res += res.transpose().eval();
698 res.matrix().triangularView<Eigen::Upper>().
setZero();
700 for (
int x=0; x<Lx-1; ++x)
702 for (
int y=1; y<Ly; ++y)
705 res(i,i+Ly-1) = lambda;
708 if (PBCy) res(Ly*x,Ly*x+2*Ly-1) = lambda;
713 for (
int i=0; i<Ly-1; ++i)
715 res(i,Ly*Lx-Ly+i+1) = lambda;
717 res(Ly-1,Ly*Lx-Ly) = lambda;
719 res += res.transpose().eval();
723void add_triangle (
int i,
int j,
int k, ArrayXXd &target,
double lambda=1.)
726 target(i,j) = lambda;
727 target(j,k) = lambda;
728 target(i,k) = lambda;
762 res += res.transpose().eval();
764 auto res_ = compress_CuthillMcKee(res,
true);
772 ArrayXXd res(L,L); res.setZero();
774 if (L == 28 or L == 36 or L == 45 or L == 55 or L == 66)
903 res += res.transpose().eval();
905 auto res_ = compress_CuthillMcKee(res,
true);
913 ArrayXXd res(L,L); res.setZero();
998 res += res.transpose().eval();
1000 auto res_ = compress_CuthillMcKee(res,
true);
1010 if (vertex_conf ==
"3.5.3.5")
1013 res.resize(L,L); res.setZero();
1015 if (VARIANT==1 or VARIANT==0)
1034 res(5,11) = lambda1;
1035 res(5,12) = lambda1;
1036 res(6,13) = lambda1;
1037 res(6,14) = lambda1;
1038 res(7,15) = lambda1;
1039 res(7,16) = lambda1;
1040 res(8,17) = lambda1;
1041 res(8,18) = lambda1;
1042 res(9,10) = lambda1;
1043 res(9,19) = lambda1;
1045 res(12,13) = lambda1;
1046 res(13,14) = lambda1;
1047 res(14,15) = lambda1;
1048 res(15,16) = lambda1;
1049 res(16,17) = lambda1;
1050 res(17,18) = lambda1;
1051 res(18,19) = lambda1;
1052 res(10,19) = lambda1;
1053 res(10,11) = lambda1;
1054 res(11,12) = lambda1;
1056 res(12,22) = lambda1;
1057 res(13,22) = lambda1;
1058 res(14,23) = lambda1;
1059 res(15,23) = lambda1;
1060 res(16,24) = lambda1;
1061 res(17,24) = lambda1;
1062 res(18,20) = lambda1;
1063 res(19,20) = lambda1;
1064 res(10,21) = lambda1;
1065 res(11,21) = lambda1;
1067 res(20,28) = lambda1;
1068 res(20,29) = lambda1;
1069 res(21,27) = lambda1;
1070 res(21,28) = lambda1;
1071 res(22,26) = lambda1;
1072 res(22,27) = lambda1;
1073 res(23,25) = lambda1;
1074 res(23,26) = lambda1;
1075 res(24,25) = lambda1;
1076 res(24,29) = lambda1;
1078 res(25,26) = lambda1;
1079 res(26,27) = lambda1;
1080 res(27,28) = lambda1;
1081 res(28,29) = lambda1;
1082 res(25,29) = lambda1;
1084 else if (VARIANT==2)
1086 res(1-1,3-1) = lambda1;
1087 res(1-1,4-1) = lambda1;
1088 res(1-1,28-1) = lambda1;
1089 res(1-1,29-1) = lambda1;
1091 res(2-1,5-1) = lambda1;
1092 res(2-1,8-1) = lambda1;
1093 res(2-1,26-1) = lambda1;
1094 res(2-1,29-1) = lambda1;
1096 res(3-1,4-1) = lambda1;
1097 res(3-1,6-1) = lambda1;
1098 res(3-1,30-1) = lambda1;
1100 res(4-1,5-1) = lambda1;
1101 res(4-1,7-1) = lambda1;
1103 res(5-1,7-1) = lambda1;
1104 res(5-1,8-1) = lambda1;
1106 res(6-1,30-1) = lambda1;
1107 res(6-1,9-1) = lambda1;
1108 res(6-1,12-1) = lambda1;
1110 res(7-1,9-1) = lambda1;
1111 res(7-1,10-1) = lambda1;
1113 res(8-1,11-1) = lambda1;
1114 res(8-1,14-1) = lambda1;
1116 res(9-1,10-1) = lambda1;
1117 res(9-1,12-1) = lambda1;
1119 res(10-1,11-1) = lambda1;
1120 res(10-1,13-1) = lambda1;
1122 res(11-1,13-1) = lambda1;
1123 res(11-1,14-1) = lambda1;
1125 res(12-1,15-1) = lambda1;
1126 res(12-1,18-1) = lambda1;
1128 res(13-1,15-1) = lambda1;
1129 res(13-1,16-1) = lambda1;
1131 res(14-1,17-1) = lambda1;
1132 res(14-1,20-1) = lambda1;
1134 res(15-1,16-1) = lambda1;
1135 res(15-1,18-1) = lambda1;
1137 res(16-1,17-1) = lambda1;
1138 res(16-1,19-1) = lambda1;
1140 res(17-1,19-1) = lambda1;
1141 res(17-1,20-1) = lambda1;
1143 res(18-1,21-1) = lambda1;
1144 res(18-1,24-1) = lambda1;
1146 res(19-1,21-1) = lambda1;
1147 res(19-1,22-1) = lambda1;
1149 res(20-1,23-1) = lambda1;
1150 res(20-1,26-1) = lambda1;
1152 res(21-1,22-1) = lambda1;
1153 res(21-1,24-1) = lambda1;
1155 res(22-1,23-1) = lambda1;
1156 res(22-1,25-1) = lambda1;
1158 res(23-1,25-1) = lambda1;
1159 res(23-1,26-1) = lambda1;
1161 res(24-1,27-1) = lambda1;
1162 res(24-1,30-1) = lambda1;
1164 res(25-1,27-1) = lambda1;
1165 res(25-1,28-1) = lambda1;
1167 res(26-1,29-1) = lambda1;
1169 res(27-1,28-1) = lambda1;
1170 res(27-1,30-1) = lambda1;
1172 res(28-1,29-1) = lambda1;
1175 else if (vertex_conf ==
"3^4.5")
1178 res.resize(L,L); res.setZero();
1180 for (
int i=0; i<=58; ++i) res(i,i+1) = lambda1;
1182 res( 0, 4) = lambda1;
1183 res( 0, 6) = lambda1;
1184 res( 0, 7) = lambda1;
1185 res( 0, 8) = lambda1;
1187 res( 1, 8) = lambda1;
1188 res( 1, 9) = lambda1;
1189 res( 1,10) = lambda1;
1191 res( 2,10) = lambda1;
1192 res( 2,11) = lambda1;
1193 res( 2,12) = lambda1;
1195 res( 3,12) = lambda1;
1196 res( 3,13) = lambda1;
1197 res( 3,14) = lambda1;
1199 res( 4, 6) = lambda1;
1200 res( 4,14) = lambda1;
1202 res( 5,14) = lambda1;
1203 res( 5,15) = lambda1;
1204 res( 5,16) = lambda1;
1206 res( 6,18) = lambda1;
1208 res( 7,18) = lambda1;
1209 res( 7,19) = lambda1;
1211 res( 8,21) = lambda1;
1213 res( 9,21) = lambda1;
1214 res( 9,22) = lambda1;
1216 res(10,24) = lambda1;
1218 res(11,24) = lambda1;
1219 res(11,25) = lambda1;
1221 res(12,27) = lambda1;
1223 res(13,27) = lambda1;
1224 res(13,28) = lambda1;
1226 res(15,29) = lambda1;
1227 res(15,30) = lambda1;
1229 res(16,30) = lambda1;
1230 res(16,31) = lambda1;
1232 res(17,31) = lambda1;
1233 res(17,32) = lambda1;
1234 res(17,33) = lambda1;
1236 res(18,33) = lambda1;
1238 res(19,33) = lambda1;
1239 res(19,34) = lambda1;
1241 res(20,34) = lambda1;
1242 res(20,35) = lambda1;
1243 res(20,36) = lambda1;
1245 res(21,36) = lambda1;
1247 res(22,36) = lambda1;
1248 res(22,37) = lambda1;
1250 res(23,37) = lambda1;
1251 res(23,38) = lambda1;
1252 res(23,39) = lambda1;
1254 res(24,39) = lambda1;
1256 res(25,39) = lambda1;
1257 res(25,40) = lambda1;
1259 res(26,40) = lambda1;
1260 res(26,41) = lambda1;
1261 res(26,42) = lambda1;
1263 res(27,42) = lambda1;
1265 res(28,42) = lambda1;
1266 res(28,43) = lambda1;
1268 res(29,43) = lambda1;
1269 res(29,44) = lambda1;
1271 res(30,44) = lambda1;
1273 res(31,46) = lambda1;
1275 res(32,46) = lambda1;
1276 res(32,47) = lambda1;
1278 res(34,48) = lambda1;
1280 res(35,48) = lambda1;
1281 res(35,49) = lambda1;
1283 res(37,50) = lambda1;
1285 res(38,50) = lambda1;
1286 res(38,51) = lambda1;
1288 res(40,52) = lambda1;
1290 res(41,52) = lambda1;
1291 res(41,53) = lambda1;
1293 res(43,54) = lambda1;
1295 res(44,54) = lambda1;
1297 res(45,54) = lambda1;
1298 res(45,55) = lambda1;
1299 res(45,56) = lambda1;
1301 res(46,56) = lambda1;
1303 res(47,56) = lambda1;
1304 res(47,57) = lambda1;
1306 res(48,57) = lambda1;
1308 res(49,57) = lambda1;
1309 res(49,58) = lambda1;
1311 res(50,58) = lambda1;
1313 res(51,58) = lambda1;
1314 res(51,59) = lambda1;
1316 res(52,59) = lambda1;
1318 res(53,55) = lambda1;
1319 res(53,59) = lambda1;
1321 res(55,59) = lambda1;
1323 else if (vertex_conf ==
"4.6^2")
1326 res.resize(L,L); res.setZero();
1328 for (
int i=0; i<=4; ++i) res(i,i+1) = lambda1;
1333 res(1,10) = lambda1;
1334 res(2,13) = lambda1;
1335 res(3,14) = lambda1;
1336 res(4,17) = lambda1;
1338 for (
int i=6; i<=16; ++i) res(i,i+1) = lambda1;
1339 res(6,17) = lambda1;
1341 res(7,19) = lambda1;
1342 res(8,20) = lambda1;
1343 res(11,21) = lambda1;
1344 res(12,22) = lambda1;
1345 res(15,23) = lambda1;
1346 res(16,18) = lambda1;
1348 for (
int i=18; i<=22; ++i) res(i,i+1) = lambda1;
1349 res(18,23) = lambda1;
1351 else if (vertex_conf ==
"3.8^2")
1354 res.resize(L,L); res.setZero();
1356 for (
int i=0; i<=6; ++i) res(i,i+1) = lambda1;
1363 res(3,10) = lambda1;
1364 res(4,10) = lambda1;
1365 res(5,11) = lambda1;
1366 res(6,11) = lambda1;
1368 res(8,13) = lambda1;
1369 res(9,14) = lambda1;
1370 res(10,15) = lambda1;
1371 res(11,12) = lambda1;
1373 res(12,17) = lambda1;
1374 res(12,18) = lambda1;
1375 res(13,19) = lambda1;
1376 res(13,20) = lambda1;
1377 res(14,21) = lambda1;
1378 res(14,22) = lambda1;
1379 res(15,16) = lambda1;
1380 res(15,23) = lambda1;
1382 for (
int i=15; i<=22; ++i) res(i,i+1) = lambda1;
1383 res(15,23) = lambda1;
1385 res(19,20) = lambda1;
1386 res(16,23) = lambda1;
1388 else if (vertex_conf ==
"3.4.3.4")
1391 res.resize(L,L); res.setZero();
1393 for (
int i=0; i<=2; ++i) res(i,i+1) = lambda1;
1409 res(5,10) = lambda1;
1410 res(6,10) = lambda1;
1411 res(6,11) = lambda1;
1412 res(7,11) = lambda1;
1414 for (
int i=8; i<=10; ++i) res(i,i+1) = lambda1;
1415 res(8,11) = lambda1;
1417 else if (vertex_conf ==
"3.6^2")
1420 res.resize(L,L); res.setZero();
1438 res(7,10) = lambda1;
1439 res(7,11) = lambda1;
1440 res(10,11) = lambda1;
1443 res(6,10) = lambda2;
1444 res(9,11) = lambda2;
1451 res += res.transpose().eval();
1453 if (VARIANT==0 and vertex_conf !=
"3.6^2" and vertex_conf !=
"3.4.3.4")
1455 auto res_ = compress_CuthillMcKee(res,
true);
1465 ArrayXXd res(L,L); res.setZero();
1467 res( 0 , 2 ) = lambda1;
1468 res( 0 , 26 ) = lambda1;
1469 res( 0 , 1 ) = lambda1;
1470 res( 1 , 9 ) = lambda1;
1471 res( 1 , 28 ) = lambda1;
1472 res( 2 , 3 ) = lambda1;
1473 res( 2 , 5 ) = lambda1;
1474 res( 3 , 4 ) = lambda1;
1475 res( 3 , 15 ) = lambda1;
1476 res( 4 , 7 ) = lambda1;
1477 res( 4 , 16 ) = lambda1;
1478 res( 5 , 6 ) = lambda1;
1479 res( 5 , 9 ) = lambda1;
1480 res( 6 , 7 ) = lambda1;
1481 res( 6 , 10 ) = lambda1;
1482 res( 7 , 18 ) = lambda1;
1483 res( 8 , 9 ) = lambda1;
1484 res( 8 , 12 ) = lambda1;
1485 res( 8 , 11 ) = lambda1;
1486 res( 10 , 11 ) = lambda1;
1487 res( 10 , 37 ) = lambda1;
1488 res( 11 , 38 ) = lambda1;
1489 res( 12 , 39 ) = lambda1;
1490 res( 12 , 29 ) = lambda1;
1491 res( 13 , 15 ) = lambda1;
1492 res( 13 , 19 ) = lambda1;
1493 res( 13 , 14 ) = lambda1;
1494 res( 14 , 16 ) = lambda1;
1495 res( 14 , 23 ) = lambda1;
1496 res( 15 , 26 ) = lambda1;
1497 res( 16 , 17 ) = lambda1;
1498 res( 17 , 18 ) = lambda1;
1499 res( 17 , 21 ) = lambda1;
1500 res( 18 , 37 ) = lambda1;
1501 res( 19 , 20 ) = lambda1;
1502 res( 19 , 24 ) = lambda1;
1503 res( 20 , 23 ) = lambda1;
1504 res( 20 , 31 ) = lambda1;
1505 res( 21 , 22 ) = lambda1;
1506 res( 21 , 35 ) = lambda1;
1507 res( 22 , 23 ) = lambda1;
1508 res( 22 , 32 ) = lambda1;
1509 res( 24 , 25 ) = lambda1;
1510 res( 24 , 27 ) = lambda1;
1511 res( 25 , 26 ) = lambda1;
1512 res( 25 , 28 ) = lambda1;
1513 res( 27 , 30 ) = lambda1;
1514 res( 27 , 31 ) = lambda1;
1515 res( 28 , 29 ) = lambda1;
1516 res( 29 , 30 ) = lambda1;
1517 res( 30 , 34 ) = lambda1;
1518 res( 31 , 32 ) = lambda1;
1519 res( 32 , 33 ) = lambda1;
1520 res( 33 , 34 ) = lambda1;
1521 res( 33 , 36 ) = lambda1;
1522 res( 34 , 39 ) = lambda1;
1523 res( 35 , 37 ) = lambda1;
1524 res( 35 , 36 ) = lambda1;
1525 res( 36 , 38 ) = lambda1;
1526 res( 38 , 39 ) = lambda1;
1528 res += res.transpose().eval();
1532 auto res_ = compress_CuthillMcKee(res,
true);
1542 ArrayXXd res(L,L); res.setZero();
1549 for (
int i=0; i<=3; ++i) res(i,i+1) = lambda1;
1553 res(1,11) = lambda2;
1554 res(2,14) = lambda2;
1555 res(3,17) = lambda2;
1558 for (
int i=5; i<=18; ++i) res(i,i+1) = lambda1;
1560 res(9,10) = lambda2;
1561 res(12,13) = lambda2;
1562 res(15,16) = lambda2;
1563 res(18,19) = lambda2;
1564 res(5,19) = lambda1;
1566 res(7,24) = lambda1;
1567 res(9,25) = lambda1;
1568 res(10,28) = lambda1;
1569 res(12,29) = lambda1;
1570 res(13,32) = lambda1;
1571 res(15,33) = lambda1;
1572 res(16,36) = lambda1;
1573 res(18,37) = lambda1;
1574 res(19,20) = lambda1;
1575 res(6,21) = lambda1;
1577 for (
int i=20; i<=38; ++i) res(i,i+1) = lambda1;
1578 res(21,22) = lambda2;
1579 res(23,24) = lambda2;
1580 res(25,26) = lambda2;
1581 res(27,28) = lambda2;
1582 res(29,30) = lambda2;
1583 res(31,32) = lambda2;
1584 res(33,34) = lambda2;
1585 res(35,36) = lambda2;
1586 res(37,38) = lambda2;
1587 res(20,39) = lambda2;
1589 res(26,44) = lambda1;
1590 res(27,46) = lambda1;
1591 res(30,47) = lambda1;
1592 res(31,49) = lambda1;
1593 res(34,50) = lambda1;
1594 res(35,52) = lambda1;
1595 res(38,53) = lambda1;
1596 res(39,40) = lambda1;
1597 res(22,41) = lambda1;
1598 res(23,43) = lambda1;
1600 for (
int i=40; i<=54; ++i) res(i,i+1) = lambda1;
1601 res(40,41) = lambda2;
1602 res(43,44) = lambda2;
1603 res(46,47) = lambda2;
1604 res(49,50) = lambda2;
1605 res(52,53) = lambda2;
1606 res(40,54) = lambda1;
1608 res(45,57) = lambda2;
1609 res(48,58) = lambda2;
1610 res(51,59) = lambda2;
1611 res(54,55) = lambda2;
1612 res(42,56) = lambda2;
1614 for (
int i=55; i<=58; ++i) res(i,i+1) = lambda1;
1615 res(55,59) = lambda1;
1619 else if (VARIANT==2 or VARIANT==0)
1629 res(3,17) = lambda1;
1630 res(2,14) = lambda1;
1631 res(1,11) = lambda1;
1636 res(5,19) = lambda1;
1637 res(18,19) = lambda1;
1638 res(17,18) = lambda1;
1639 res(16,17) = lambda1;
1640 res(15,16) = lambda1;
1641 res(14,15) = lambda1;
1642 res(13,14) = lambda1;
1643 res(12,13) = lambda1;
1644 res(11,12) = lambda1;
1645 res(10,11) = lambda1;
1646 res(9,10) = lambda1;
1649 res(7,22) = lambda1;
1650 res(6,21) = lambda1;
1651 res(19,20) = lambda1;
1652 res(18,29) = lambda1;
1653 res(16,28) = lambda1;
1654 res(15,27) = lambda1;
1655 res(13,26) = lambda1;
1656 res(12,25) = lambda1;
1657 res(10,24) = lambda1;
1658 res(9,23) = lambda1;
1660 res(22,33) = lambda1;
1661 res(32,33) = lambda1;
1662 res(21,32) = lambda1;
1663 res(20,21) = lambda1;
1664 res(20,31) = lambda1;
1665 res(30,31) = lambda1;
1666 res(29,30) = lambda1;
1667 res(28,29) = lambda1;
1668 res(28,39) = lambda1;
1669 res(38,39) = lambda1;
1670 res(27,38) = lambda1;
1671 res(26,27) = lambda1;
1672 res(26,37) = lambda1;
1673 res(36,37) = lambda1;
1674 res(25,36) = lambda1;
1675 res(24,25) = lambda1;
1676 res(24,35) = lambda1;
1677 res(34,35) = lambda1;
1678 res(23,34) = lambda1;
1679 res(22,23) = lambda1;
1681 res(33,46) = lambda1;
1682 res(32,44) = lambda1;
1683 res(31,43) = lambda1;
1684 res(30,41) = lambda1;
1685 res(39,40) = lambda1;
1686 res(38,53) = lambda1;
1687 res(37,52) = lambda1;
1688 res(36,50) = lambda1;
1689 res(35,49) = lambda1;
1690 res(34,47) = lambda1;
1692 res(45,46) = lambda1;
1693 res(44,45) = lambda1;
1694 res(43,44) = lambda1;
1695 res(42,43) = lambda1;
1696 res(41,42) = lambda1;
1697 res(40,41) = lambda1;
1698 res(40,54) = lambda1;
1699 res(53,54) = lambda1;
1700 res(52,53) = lambda1;
1701 res(51,52) = lambda1;
1702 res(50,51) = lambda1;
1703 res(49,50) = lambda1;
1704 res(48,49) = lambda1;
1705 res(47,48) = lambda1;
1706 res(46,47) = lambda1;
1708 res(45,57) = lambda1;
1709 res(42,56) = lambda1;
1710 res(54,55) = lambda1;
1711 res(51,59) = lambda1;
1712 res(48,58) = lambda1;
1713 res(56,57) = lambda1;
1714 res(55,56) = lambda1;
1715 res(55,59) = lambda1;
1716 res(58,59) = lambda1;
1717 res(57,58) = lambda1;
1768 res(2,11) = lambda1;
1769 res(3,13) = lambda1;
1776 res(9,10) = lambda1;
1777 res(10,11) = lambda1;
1778 res(11,12) = lambda1;
1779 res(12,13) = lambda1;
1780 res(13,14) = lambda1;
1781 res(5,14) = lambda1;
1783 res(6,16) = lambda1;
1784 res(8,17) = lambda1;
1785 res(10,18) = lambda1;
1786 res(12,19) = lambda1;
1787 res(14,15) = lambda1;
1789 res(15,16) = lambda1;
1790 res(16,17) = lambda1;
1791 res(17,18) = lambda1;
1792 res(18,19) = lambda1;
1793 res(15,19) = lambda1;
1797 for (
int i=0; i<=3; ++i) res(i,i+1) = lambda1;
1801 res(1,11) = lambda1;
1802 res(2,14) = lambda1;
1803 res(3,17) = lambda1;
1806 for (
int i=5; i<=18; ++i) res(i,i+1) = lambda1;
1807 res(5,19) = lambda1;
1809 res(6,21) = lambda1;
1810 res(7,23) = lambda1;
1811 res(9,24) = lambda1;
1812 res(10,26) = lambda1;
1813 res(12,27) = lambda1;
1814 res(13,29) = lambda1;
1815 res(15,30) = lambda1;
1816 res(16,32) = lambda1;
1817 res(18,33) = lambda1;
1818 res(19,20) = lambda1;
1820 for (
int i=20; i<=33; ++i) res(i,i+1) = lambda1;
1821 res(20,34) = lambda1;
1823 res(22,36) = lambda1;
1824 res(25,37) = lambda1;
1825 res(28,38) = lambda1;
1826 res(31,39) = lambda1;
1827 res(34,35) = lambda1;
1829 for (
int i=35; i<=38; ++i) res(i,i+1) = lambda1;
1830 res(35,39) = lambda1;
1834 for (
int i=0; i<=4; ++i) res(i,i+1) = lambda1;
1838 res(1,10) = lambda1;
1839 res(2,12) = lambda1;
1840 res(3,14) = lambda1;
1841 res(4,16) = lambda1;
1844 for (
int i=6; i<=16; ++i) res(i,i+1) = lambda1;
1845 res(6,17) = lambda1;
1847 res(7,20) = lambda1;
1848 res(9,22) = lambda1;
1849 res(11,24) = lambda1;
1850 res(13,26) = lambda1;
1851 res(15,28) = lambda1;
1852 res(17,18) = lambda1;
1854 for (
int i=18; i<=28; ++i) res(i,i+1) = lambda1;
1855 res(18,29) = lambda1;
1857 res(19,31) = lambda1;
1858 res(21,32) = lambda1;
1859 res(23,33) = lambda1;
1860 res(25,34) = lambda1;
1861 res(27,35) = lambda1;
1862 res(29,30) = lambda1;
1864 for (
int i=30; i<=34; ++i) res(i,i+1) = lambda1;
1865 res(30,35) = lambda1;
1869 for (
int i=0; i<=3; ++i) res(i,i+1) = lambda1;
1874 res(2,11) = lambda1;
1875 res(3,13) = lambda1;
1878 for (
int i=5; i<=13; ++i) res(i,i+1) = lambda1;
1879 res(5,14) = lambda1;
1881 res(6,17) = lambda1;
1882 res(8,19) = lambda1;
1883 res(10,21) = lambda1;
1884 res(12,23) = lambda1;
1885 res(14,15) = lambda1;
1887 for (
int i=15; i<=23; ++i) res(i,i+1) = lambda1;
1888 res(15,24) = lambda1;
1890 res(16,26) = lambda1;
1891 res(18,27) = lambda1;
1892 res(20,28) = lambda1;
1893 res(22,29) = lambda1;
1894 res(24,25) = lambda1;
1896 for (
int i=25; i<=28; ++i) res(i,i+1) = lambda1;
1897 res(25,29) = lambda1;
1901 res( 0 , 4 ) = lambda1;
1902 res( 0 , 20 ) = lambda1;
1903 res( 0 , 3 ) = lambda1;
1904 res( 1 , 19 ) = lambda1;
1905 res( 1 , 17 ) = lambda1;
1906 res( 1 , 2 ) = lambda1;
1907 res( 2 , 7 ) = lambda1;
1908 res( 2 , 3 ) = lambda1;
1909 res( 3 , 5 ) = lambda1;
1910 res( 4 , 8 ) = lambda1;
1911 res( 4 , 6 ) = lambda1;
1912 res( 5 , 23 ) = lambda1;
1913 res( 5 , 6 ) = lambda1;
1914 res( 6 , 14 ) = lambda1;
1915 res( 7 , 23 ) = lambda1;
1916 res( 7 , 27 ) = lambda1;
1917 res( 8 , 11 ) = lambda1;
1918 res( 8 , 9 ) = lambda1;
1919 res( 9 , 20 ) = lambda1;
1920 res( 9 , 10 ) = lambda1;
1921 res( 10 , 16 ) = lambda1;
1922 res( 10 , 13 ) = lambda1;
1923 res( 11 , 14 ) = lambda1;
1924 res( 11 , 12 ) = lambda1;
1925 res( 12 , 22 ) = lambda1;
1926 res( 12 , 13 ) = lambda1;
1927 res( 13 , 18 ) = lambda1;
1928 res( 14 , 25 ) = lambda1;
1929 res( 15 , 18 ) = lambda1;
1930 res( 15 , 16 ) = lambda1;
1931 res( 15 , 17 ) = lambda1;
1932 res( 16 , 19 ) = lambda1;
1933 res( 17 , 27 ) = lambda1;
1934 res( 18 , 21 ) = lambda1;
1935 res( 19 , 20 ) = lambda1;
1936 res( 21 , 22 ) = lambda1;
1937 res( 21 , 26 ) = lambda1;
1938 res( 22 , 25 ) = lambda1;
1939 res( 23 , 24 ) = lambda1;
1940 res( 24 , 25 ) = lambda1;
1941 res( 24 , 26 ) = lambda1;
1942 res( 26 , 27 ) = lambda1;
1946 for (
int i=0; i<=3; ++i) res(i,i+1) = lambda1;
1950 res(1,10) = lambda1;
1951 res(2,12) = lambda1;
1952 res(3,14) = lambda1;
1955 for (
int i=5; i<=14; ++i) res(i,i+1) = lambda1;
1956 res(5,15) = lambda1;
1958 res(6,18) = lambda1;
1959 res(8,19) = lambda1;
1960 res(9,21) = lambda1;
1961 res(11,22) = lambda1;
1962 res(13,25) = lambda1;
1963 res(15,16) = lambda1;
1965 for (
int i=16; i<=23; ++i) res(i,i+1) = lambda1;
1967 res(16,25) = lambda1;
1968 res(17,24) = lambda1;
1969 res(20,24) = lambda1;
1970 res(23,25) = lambda1;
1974 for (
int i=0; i<=4; ++i) res(i,i+1) = lambda1;
1978 res(1,10) = lambda1;
1979 res(2,12) = lambda1;
1980 res(3,14) = lambda1;
1981 res(4,16) = lambda1;
1984 for (
int i=6; i<=16; ++i) res(i,i+1) = lambda1;
1985 res(6,17) = lambda1;
1987 res(17,18) = lambda1;
1988 res(7,19) = lambda1;
1989 res(9,20) = lambda1;
1990 res(11,21) = lambda1;
1991 res(13,22) = lambda1;
1992 res(15,23) = lambda1;
1994 for (
int i=18; i<=22; ++i) res(i,i+1) = lambda1;
1995 res(18,23) = lambda1;
2002 res += res.transpose().eval();
2006 auto res_ = compress_CuthillMcKee(res,
true);
2015 ArrayXXd res(L,L); res.setZero();
2137 res(4,10) = lambda1;
2138 res(5,10) = lambda1;
2139 res(6,10) = lambda1;
2140 res(6,11) = lambda1;
2141 res(7,11) = lambda1;
2142 res(8,11) = lambda1;
2145 res(9,10) = lambda1;
2146 res(10,11) = lambda1;
2147 res(9,11) = lambda1;
2171 res += res.transpose().eval();
2185 ArrayXXd res(L,L); res.setZero();
2226 res += res.transpose().eval();
2234 (i<j)? target.push_back(pair<size_t,size_t>(i,j)) : target.push_back(pair<size_t,size_t>(j,i));
2235 (i<k)? target.push_back(pair<size_t,size_t>(i,k)) : target.push_back(pair<size_t,size_t>(k,i));
2236 (i<l)? target.push_back(pair<size_t,size_t>(i,l)) : target.push_back(pair<size_t,size_t>(l,i));
2237 (j<k)? target.push_back(pair<size_t,size_t>(j,k)) : target.push_back(pair<size_t,size_t>(k,j));
2238 (j<l)? target.push_back(pair<size_t,size_t>(j,l)) : target.push_back(pair<size_t,size_t>(l,j));
2239 (k<l)? target.push_back(pair<size_t,size_t>(k,l)) : target.push_back(pair<size_t,size_t>(l,k));
2248void add_edge (
int i,
int j, vector<pair<size_t,size_t>> &target)
2250 (i<j)? target.push_back(pair<size_t,size_t>(i,j)) : target.push_back(pair<size_t,size_t>(j,i));
2255 std::vector<std::pair<std::size_t, std::size_t>> edges;
2257 ArrayXXd res(L,L); res.setZero();
2292 else if (VARIANT==1)
2352 else if (VARIANT==1)
2393 else if (VARIANT==1)
2439 for (
int e=0; e<edges.size(); ++e)
2441 int i = edges[e].first;
2442 int j = edges[e].second;
2446 res += res.transpose().eval();
2450 compress_CuthillMcKee(res,
true);
2456ArrayXXd
hopping_Mn32 (
double lambda_cap=1.,
double lambda_corner=0.,
double lambda_edge=1.,
int VARIANT=0)
2458 std::vector<std::pair<std::size_t, std::size_t>> edges;
2460 ArrayXXd res(32,32); res.setZero();
2473 vector<int> caps = {3,7,11,15, 19,23,27,31};
2475 for (
int e=0; e<edges.size(); ++e)
2477 int i = edges[e].first;
2478 int j = edges[e].second;
2480 auto it_i = find(caps.begin(), caps.end(), i);
2481 auto it_j = find(caps.begin(), caps.end(), j);
2483 if (it_i!=caps.end() or it_j!=caps.end())
2485 res(i,j) = lambda_cap;
2489 res(i,j) = lambda_corner;
2496 edges.push_back(pair<size_t,size_t>(1,4));
2497 edges.push_back(pair<size_t,size_t>(5,8));
2498 edges.push_back(pair<size_t,size_t>(9,12));
2499 edges.push_back(pair<size_t,size_t>(0,13));
2501 edges.push_back(pair<size_t,size_t>(2,16));
2502 edges.push_back(pair<size_t,size_t>(6,21));
2503 edges.push_back(pair<size_t,size_t>(10,26));
2504 edges.push_back(pair<size_t,size_t>(14,29));
2506 edges.push_back(pair<size_t,size_t>(17,20));
2507 edges.push_back(pair<size_t,size_t>(22,24));
2508 edges.push_back(pair<size_t,size_t>(25,28));
2509 edges.push_back(pair<size_t,size_t>(18,30));
2511 for (
int e=0; e<edges.size(); ++e)
2513 int i = edges[e].first;
2514 int j = edges[e].second;
2515 res(i,j) = lambda_edge;
2518 res += res.transpose().eval();
2522 compress_CuthillMcKee(res,
true);
2528pair<ArrayXXd,vector<SUB_LATTICE> >
hopping_PPV (
int L,
int VARIANT=0,
double t0=1.,
double tsingle=1.,
double tdouble=1.,
string BC=
"")
2530 ArrayXXd res(L,L); res.setZero();
2532 vector<SUB_LATTICE> G;
2534 if (
BC ==
"INIT_HEX")
2578 res += res.transpose().eval();
2582 CuthillMcKeeCompressor CMK(res,
true);
2583 CMK.apply_compression(res);
2585 vector<SUB_LATTICE> G_ = G;
2586 for (
int i=0; i<L; ++i)
2588 G[CMK.get_transform()[i]] = G_[i];
2592 pair<ArrayXXd,vector<SUB_LATTICE> > ret(res,G);
2596pair<ArrayXXd,vector<SUB_LATTICE> >
hopping_triangulene (
int L,
int VARIANT=0,
double lambda=1.,
double lambda2=1.,
string BC=
"")
2598 ArrayXXd res(L,L); res.setZero();
2599 assert(L==13 or L==8 or L==10 or L==22 or L==4);
2602 vector<SUB_LATTICE> G;
2617 if (
BC ==
"CUT_HEX")
2693 for (
int i=0; i<=10; ++i) res(i,i+1) = lambda;
2698 res(10,12) = lambda;
2702 res(11,15) = lambda;
2703 res(15,19) = lambda;
2706 res(16,19) = lambda;
2710 res(12,16) = lambda;
2711 res(16,20) = lambda;
2715 res(17,20) = lambda;
2721 res(13,17) = lambda;
2722 res(17,21) = lambda;
2726 res(10,13) = lambda;
2727 res(18,21) = lambda;
2733 res(10,14) = lambda;
2734 res(14,18) = lambda;
2759 res(12,15) = lambda2;
2760 res(11,16) = lambda2;
2761 res(8,19) = lambda2;
2764 res(3,12) = lambda2;
2767 res(13,16) = lambda2;
2768 res(12,17) = lambda2;
2769 res(9,20) = lambda2;
2775 res(6,10) = lambda2;
2777 res(4,13) = lambda2;
2779 res(10,21) = lambda2;
2780 res(14,17) = lambda2;
2781 res(13,18) = lambda2;
2784 res += res.transpose().eval();
2790 CuthillMcKeeCompressor CMK(res,
true);
2791 CMK.apply_compression(res);
2793 vector<SUB_LATTICE> G_ = G;
2794 for (
int i=0; i<L; ++i)
2796 G[CMK.get_transform()[i]] = G_[i];
2805 pair<ArrayXXd,vector<SUB_LATTICE> > ret(res,G);
2812 ArrayXXd res(44,44); res = 0.;
2813 res.topLeftCorner(22,22) = T;
2814 res.bottomRightCorner(22,22) = T;
2816 ArrayXXd coupling(44,44); coupling = 0.;
2817 coupling(2,1+22) = lambda;
2818 coupling(7,5+22) = lambda;
2819 coupling(14,11+22) = lambda;
2821 coupling(2,1+22) = lambda2;
2822 coupling(2,5+22) = lambda2;
2824 coupling(4,3+22) = lambda2;
2826 coupling(7,1+22) = lambda2;
2827 coupling(7,11+22) = lambda2;
2829 coupling(10,8+22) = lambda2;
2831 coupling(14,5+22) = lambda2;
2832 coupling(14,11+22) = lambda2;
2834 coupling += coupling.transpose().eval();
2838 vector<SUB_LATTICE> G;
2839 for (
int i=0; i<22; ++i) G.push_back(G0[i]);
2844 CuthillMcKeeCompressor CMK(res,
true);
2845 CMK.apply_compression(res);
2847 vector<SUB_LATTICE> G_ = G;
2848 for (
int i=0; i<44; ++i)
2850 G[CMK.get_transform()[i]] = G_[i];
2854 pair<ArrayXXd,vector<SUB_LATTICE> > ret(res,G);
2860 ArrayXXd res(L,L); res.setZero();
2880 res(10,14) = lambda;
2881 res(11,15) = lambda;
2882 res(12,16) = lambda;
2883 res(13,16) = lambda;
2884 res(13,17) = lambda;
2885 res(14,17) = lambda;
2886 res(14,18) = lambda;
2887 res(15,18) = lambda;
2888 res(16,19) = lambda;
2889 res(17,20) = lambda;
2890 res(18,21) = lambda;
2891 res(19,22) = lambda;
2892 res(20,22) = lambda;
2893 res(20,23) = lambda;
2894 res(21,23) = lambda;
2897 res += res.transpose().eval();
2901 compress_CuthillMcKee(res,
true);
2909 ArrayXXd res(L,L); res.setZero();
2914 for (
int i=0; i<=13; ++i) res(i,i+1) = lambda;
2917 res(13,15) = lambda;
2918 res(10,16) = lambda;
2923 for (
int i=15; i<=18; ++i) res(i,i+1) = lambda;
2924 res(15,19) = lambda;
2927 res += res.transpose().eval();
2931 compress_CuthillMcKee(res,
true);
2939 ArrayXXd res(L,L); res.setZero();
2943 for (
int i=0; i<3; ++i) res(i,i+1) = lambda;
2944 for (
int i=4; i<7; ++i) res(i,i+1) = lambda;
2945 for (
int i=8; i<11; ++i) res(i,i+1) = lambda;
2946 for (
int i=12; i<15; ++i) res(i,i+1) = lambda;
2948 for (
int i=0; i<=2; ++i) res(4*i,4*i+4) = lambda;
2949 for (
int i=0; i<=2; ++i) res(1+4*i,1+4*i+4) = lambda;
2950 for (
int i=0; i<=2; ++i) res(2+4*i,2+4*i+4) = lambda;
2951 for (
int i=0; i<=2; ++i) res(3+4*i,3+4*i+4) = lambda;
2965 for (
int i=0; i<3; ++i) res(i,i+1) = lambda;
2966 for (
int i=4; i<7; ++i) res(i,i+1) = lambda;
2967 for (
int i=8; i<11; ++i) res(i,i+1) = lambda;
2968 for (
int i=12; i<15; ++i) res(i,i+1) = lambda;
2969 for (
int i=16; i<19; ++i) res(i,i+1) = lambda;
2971 for (
int i=0; i<=3; ++i) res(4*i,4*i+4) = lambda;
2972 for (
int i=0; i<=3; ++i) res(1+4*i,1+4*i+4) = lambda;
2973 for (
int i=0; i<=3; ++i) res(2+4*i,2+4*i+4) = lambda;
2974 for (
int i=0; i<=3; ++i) res(3+4*i,3+4*i+4) = lambda;
2979 res(12,15) = lambda;
2980 res(16,19) = lambda;
2988 res += res.transpose().eval();
2992 compress_CuthillMcKee(res,
true);
3002 int L = adjacencyMatrix.rows();
3003 assert(adjacencyMatrix.cols() == L);
3005 ArrayXXi dist0(L,L); dist0 = 0;
3006 dist0.matrix().diagonal().setConstant(1);
3008 ArrayXXi dist1(L,L); dist1 = 0;
3009 for (
int i=0; i<L; ++i)
3010 for (
int j=0; j<L; ++j)
3012 if (abs(adjacencyMatrix(i,j)) > 0.)
3018 ArrayXXi next = dist1;
3021 vector<ArrayXXi> dist;
3022 dist.push_back(dist0);
3023 dist.push_back(dist1);
3025 while (next.sum() != 0)
3028 next = next.matrix()*dist1.matrix();
3031 for (
int d=0; d<dist.size(); ++d) next = next*(1-dist[d]);
3033 for (
int i=0; i<L; ++i)
for (
int j=0; j<L; ++j)
if (next(i,j)>0) next(i,j) = 1;
3035 dist.push_back(next);
3038 ArrayXXi res(L,L); res = 0;
3039 for (
int d=0; d<dist.size(); ++d) res = res+d*dist[d];
3043ArrayXXi
hopping_MnRing (
int Ncells,
double J1,
double J2,
double J3,
double J4=0.,
double J5=0.,
double J6=0.,
double J7=0.)
3048 for (
int ic=0; ic<Ncells; ++ic)
3052 res((0+icell)%L,(1+icell)%L) = 1.;
3053 res((1+icell)%L,(2+icell)%L) = 1.;
3055 res((0+icell)%L,(3+icell)%L) = J2/J1;
3056 res((1+icell)%L,(3+icell)%L) = J2/J1;
3057 res((1+icell)%L,(4+icell)%L) = J2/J1;
3058 res((2+icell)%L,(4+icell)%L) = J2/J1;
3060 res((3+icell)%L,(4+icell)%L) = J3/J1;
3061 res((3+icell)%L,(5+icell)%L) = J3/J1;
3062 res((3+icell)%L,(6+icell)%L) = J3/J1;
3063 res((4+icell)%L,(5+icell)%L) = J3/J1;
3064 res((5+icell)%L,(6+icell)%L) = J3/J1;
3066 res((5+icell)%L,(7+icell)%L) = J2/J1;
3067 res((5+icell)%L,(8+icell)%L) = J2/J1;
3068 res((6+icell)%L,(8+icell)%L) = J2/J1;
3069 res((6+icell)%L,(9+icell)%L) = J2/J1;
3071 res((0+icell)%L,(4+icell)%L) = J4/J1;
3072 res((2+icell)%L,(3+icell)%L) = J4/J1;
3073 res((1+icell)%L,(6+icell)%L) = J4/J1;
3075 res((5+icell)%L,(9+icell)%L) = J4/J1;
3076 res((6+icell)%L,(7+icell)%L) = J4/J1;
3077 res((4+icell)%L,(8+icell)%L) = J4/J1;
3080 res += res.transpose().eval();
3081 compress_CuthillMcKee(res,
true);
3088 int SPIN_PARITY = (START_WITH_SPIN==
true)? 0:1;
3089 for (
size_t l=0; l<2*L; ++l)
3092 if (l%2 == SPIN_PARITY)
3094 params.push_back({
"D",D,l});
3095 params.push_back({
"LyF",0ul,l});
3096 if (START_WITH_SPIN==
true)
3098 params.push_back({
"Inext",J,l});
3099 params.push_back({
"Iprev",0.,l});
3103 params.push_back({
"Inext",0.,l});
3104 params.push_back({
"Iprev",J,l});
3106 params.push_back({
"tPrime",0.,l});
3111 params.push_back({
"D",1ul,l});
3112 params.push_back({
"LyF",1ul,l});
3113 params.push_back({
"tPrime",t,l});
3114 params.push_back({
"Inext",0.,l});
3115 params.push_back({
"Iprev",0.,l});
3222 res.push_back({
"Ly",Ly});
3223 res.push_back({
"maxPower",maxPower});
3224 res.push_back({
"OPEN_BC",
true});
3227 res.push_back({
"t",0.});
3228 res.push_back({
"tRung",1.});
3232 res.push_back({
"t",1.,0});
3233 res.push_back({
"t",0.,1});
3235 vector<SUB_LATTICE> G;
3236 for (
int l=0; l<L; l+=4)
3243 res.push_back({
"G",G});
3249vector<Param>
Tinf_params_spins (
size_t L,
size_t Ly,
size_t maxPower=1ul,
size_t DA=2ul,
size_t DB=2ul,
bool SOFT=
false)
3252 res.push_back({
"Ly",Ly});
3253 res.push_back({
"maxPower",maxPower});
3254 if (SOFT and DA==3ul and DB==3ul)
3259 for (
size_t l=1; l<L-1; ++l)
3261 res.push_back({
"D",D,l});
3263 res.push_back({
"D",2ul,0});
3264 res.push_back({
"D",2ul,L-1});
3268 for (
size_t l=2; l<2*L-2; ++l)
3270 res.push_back({
"D",D,l});
3272 res.push_back({
"D",2ul,0});
3273 res.push_back({
"D",2ul,1});
3274 res.push_back({
"D",2ul,L-2});
3275 res.push_back({
"D",2ul,L-1});
3282 for (
size_t l=0; l<L; l+=2)
3284 res.push_back({
"D",DA,l});
3285 res.push_back({
"D",DB,l+1});
3290 for (
size_t l=0; l<L; l+=4)
3292 res.push_back({
"D",DA,l});
3293 res.push_back({
"D",DA,l+1});
3294 res.push_back({
"D",DB,l+2});
3295 res.push_back({
"D",DB,l+3});
3301 res.push_back({
"J",0.});
3302 res.push_back({
"Jrung",1.});
3306 res.push_back({
"J",1.,0});
3307 res.push_back({
"J",0.,1});
3313inline std::complex<double>
conjIfImag (std::complex<double> x) {
return conj(x);}
3315template<
typename Scalar>
3316Array<Scalar,Dynamic,Dynamic>
hopping_PAM (
int L, Scalar tfc, Scalar tcc, Scalar tff, Scalar tx, Scalar ty,
bool PBC=
false)
3318 Array<Scalar,Dynamic,Dynamic> t1site(2,2); t1site = 0;
3322 Array<Scalar,Dynamic,Dynamic> res(2*L,2*L); res = 0;
3324 for (
int l=0; l<L; ++l)
3326 res.block(2*l,2*l, 2,2) = t1site;
3329 for (
int l=0; l<L-1; ++l)
3331 res(2*l, 2*l+2) = tcc;
3332 res(2*l+1, 2*l+3) = tff;
3333 res(2*l+1, 2*l+2) = tx;
3341 for (
int l=0; l<2*L-4; l+=2)
3344 res(l, l+4) = res(l, l+2);
3345 res(l, l+5) = res(l, l+3);
3346 res(l+1,l+4) = res(l+1,l+2);
3347 res(l+1,l+5) = res(l+1,l+3);
3365 res.matrix() += res.matrix().adjoint().eval();
3370template<
typename Scalar>
3371Array<Scalar,Dynamic,Dynamic>
hopping_PAM_T (
int L, Scalar tfc, Scalar tcc, Scalar tff, Scalar tx, Scalar ty,
bool ANCILLA_HOPPING=
false,
double bugfix=1e-7)
3373 Array<Scalar,Dynamic,Dynamic> res_tmp =
hopping_PAM(L/2,tfc,tcc,tff,tx,ty);
3374 Array<Scalar,Dynamic,Dynamic> res(2*L,2*L); res = 0;
3376 for (
int i=0; i<L; ++i)
3377 for (
int j=0; j<L; ++j)
3379 res(2*i,2*j) = res_tmp(i,j);
3380 if (ANCILLA_HOPPING)
3382 res(2*i+1,2*j+1) = res_tmp(i,j);
3386 for (
int i=0; i<2*L-1; ++i)
3388 res(i,i+1) += bugfix;
3389 res(i+1,i) += bugfix;
3398ArrayXXd
hopping_spinChain (
int L,
double JA,
double JB,
double JpA,
double JpB,
bool ANCILLA_HOPPING=
false,
bool PBC=
false)
3400 ArrayXXd res_tmp(L,L);
3404 lout << termcolor::yellow <<
"Warning: ignoring JB, JpB for PBC!" << termcolor::reset << endl;
3410 res_tmp.matrix().diagonal<1> ()(Eigen::seq(0,Eigen::last,2)).setConstant(JA);
3411 res_tmp.matrix().diagonal<1> ()(Eigen::seq(1,Eigen::last,2)).setConstant(JB);
3412 res_tmp.matrix().diagonal<2> ()(Eigen::seq(0,Eigen::last,2)).setConstant(JpA);
3413 res_tmp.matrix().diagonal<2> ()(Eigen::seq(1,Eigen::last,2)).setConstant(JpB);
3414 res_tmp += res_tmp.transpose().eval();
3419ArrayXXd
hopping_spinChain_T (
int L,
double JA,
double JB,
double JpA,
double JpB,
bool ANCILLA_HOPPING=
false,
double bugfix=1e-7,
bool PBC=
false)
3424 lout << termcolor::yellow <<
"Warning: ignoring JB, JpB for PBC!" << termcolor::reset << endl;
3432 ArrayXXd res(2*L,2*L); res = 0;
3434 for (
int i=0; i<L; ++i)
3435 for (
int j=0; j<L; ++j)
3437 res(2*i,2*j) = res_tmp(i,j);
3438 if (ANCILLA_HOPPING)
3440 res(2*i+1,2*j+1) = res_tmp(i,j);
3444 for (
int i=0; i<2*L-1; ++i)
3446 res(i,i+1) += bugfix;
3447 res(i+1,i) += bugfix;
3453ArrayXXd
hopping_ladder (
int L,
double tPara=1.,
double tPerp=1.,
double tPrime=0.,
double tPPrime=0.,
bool PBC=
false,
bool BABA=
false)
3461 for (
int l=0; l<L; ++l)
3463 if (l+1<L) res(l,l+1) = (l%2==0)? tPerp:0.;
3464 if (l+2<L) res(l,l+2) = tPara;
3466 if (l%2==0 and l+3<L) res(l,l+3) = tPrime;
3467 if (l%2==1 and l+1<L) res(l,l+1) = tPrime;
3469 if (l+4<L) res(l,l+4) = tPPrime;
3474 for (
int l=0; l<L; ++l)
3476 if (l+1<L) res(l,l+1) = (l%2==1)? tPerp:0.;
3477 if (l+2<L) res(l,l+2) = tPara;
3479 if (l%2==0 and l+1<L) res(l,l+1) = tPrime;
3480 if (l%2==1 and l+3<L) res(l,l+3) = tPrime;
3492 for (
int l=0; l<L; ++l)
3494 res(l,(l+1)%L) = (l%2==0)? tPerp:0.;
3495 res(l,(l+2)%L) = tPara;
3497 if (l%2==0) res(l,(l+3)%L) = tPrime;
3498 if (l%2==1) res(l,(l+1)%L) = tPrime;
3500 res(l,(l+4)%L) = tPPrime;
3503 res += res.transpose().eval();
3509 double J = J_input+0.5*beta;
3510 double R = -0.5*beta;
3511 double offset = -4./3.*beta;
3512 return make_tuple(J,R,offset);
3531 double beta = -sin(theta);
3532 double J = cos(theta)+0.5*beta;
3533 double R = -0.5*beta;
3534 double offset = -4./3.*beta;
3535 return make_tuple(J,R,offset);
void setZero(PivotVector< Symmetry, Scalar_ > &V)
SUB_LATTICE flip_sublattice(SUB_LATTICE sublat)
void split_kagomeYC_AB(int Lx, int Ly, std::vector< std::vector< int > > &A, std::vector< std::vector< int > > &B)
ArrayXXd hopping_square(int Lx, int Ly, bool PBCx=false, bool PBCy=true, double lambda=1.)
Array< Scalar, Dynamic, Dynamic > hopping_PAM_T(int L, Scalar tfc, Scalar tcc, Scalar tff, Scalar tx, Scalar ty, bool ANCILLA_HOPPING=false, double bugfix=1e-7)
ArrayXXd hopping_square_plaquette(int L, int VARIANT=0, double lambda=1.)
ArrayXXd hopping_corannulene(int L, int VARIANT=0, double lambda=1.)
ArrayXXd create_1D_PBC_AB(size_t L, double lambda1A=1., double lambda1B=1., double lambda2A=0., double lambda2B=0., bool COMPRESSED=true)
ArrayXXd hopping_triangular(int L, int VARIANT=0, double lambda1=1.)
ArrayXXd hopping_coronene(int L, int VARIANT=0, double lambda=1.)
ArrayXXd hopping_spinChain_T(int L, double JA, double JB, double JpA, double JpB, bool ANCILLA_HOPPING=false, double bugfix=1e-7, bool PBC=false)
ArrayXXd create_1D_OBC(size_t L, double lambda1=1., double lambda2=0.)
pair< ArrayXXd, vector< SUB_LATTICE > > hopping_triangulene_dimer(int VARIANT=0, double lambda=1., double lambda2=1., string BC="")
void add_triangle(int i, int j, int k, ArrayXXd &target, double lambda=1.)
ArrayXXd hopping_kagome36d(double lambda=1.)
ArrayXXd hopping_kagomeXC(int Lx, int Ly, bool PBCx=false, bool PBCy=true, double lambda=1., bool VERBOSE=false)
ArrayXXd hopping_spinChain(int L, double JA, double JB, double JpA, double JpB, bool ANCILLA_HOPPING=false, bool PBC=false)
void add_edge(int i, int j, vector< pair< size_t, size_t > > &target)
ArrayXXd create_1D_PBC(size_t L, double lambda1=1., double lambda2=0., bool COMPRESSED=false)
tuple< double, double, double > params_bilineraBiquadratic_beta(double beta, double J_input=1.)
pair< ArrayXXd, vector< SUB_LATTICE > > hopping_triangulene(int L, int VARIANT=0, double lambda=1., double lambda2=1., string BC="")
void push_back_KondoUnpacked(vector< Param > ¶ms, size_t L, double J, double t, size_t D, bool START_WITH_SPIN=true)
void add_tetrahedron(int i, int j, int k, int l, vector< pair< size_t, size_t > > &target)
pair< ArrayXXd, vector< SUB_LATTICE > > hopping_PPV(int L, int VARIANT=0, double t0=1., double tsingle=1., double tdouble=1., string BC="")
ArrayXXd hopping_fullerene(int L=60, int VARIANT=0, double lambda1=1., double lambda2=1.)
ArrayXXd hopping_ladder(int L, double tPara=1., double tPerp=1., double tPrime=0., double tPPrime=0., bool PBC=false, bool BABA=false)
ArrayXXi hopping_MnRing(int Ncells, double J1, double J2, double J3, double J4=0., double J5=0., double J6=0., double J7=0.)
vector< Param > Tinf_params_spins(size_t L, size_t Ly, size_t maxPower=1ul, size_t DA=2ul, size_t DB=2ul, bool SOFT=false)
tuple< double, double, double > params_bilineraBiquadratic_theta(double theta)
ArrayXXd hopping_sodaliteCage(int L=60, int VARIANT=0, double lambda1=1.)
ArrayXXd hopping_fullerene_C40Td(int VARIANT=0, double lambda1=1., double lambda2=1.)
ArrayXXd hopping_kagomeYC_BAB(int Lx, int Ly, bool PBCx=false, bool PBCy=true, double lambda=1., bool VERBOSE=false)
void split_kagomeYC_BAB(int Lx, int Ly, std::vector< std::vector< int > > &A, std::vector< std::vector< int > > &B)
vector< Param > Tinf_params_fermions(size_t L, size_t Ly, size_t maxPower=1ul)
ArrayXXd extend_to_thermal(const ArrayXXd &tFull, double factor)
Array< Scalar, Dynamic, Dynamic > hopping_PAM(int L, Scalar tfc, Scalar tcc, Scalar tff, Scalar tx, Scalar ty, bool PBC=false)
int find_x_kagomeYC(int index, int L, const std::vector< std::vector< int > > &A, const std::vector< std::vector< int > > &B)
ArrayXXi calc_distanceMatrix(ArrayXXd adjacencyMatrix)
ArrayXXd hopping_kagomeYC_AB(int Lx, int Ly, bool PBCx=false, bool PBCy=true, double lambda=1.)
ArrayXXd create_1D_AB(size_t L, double lambda1A=1., double lambda1B=1., double lambda2A=0., double lambda2B=0.)
ArrayXXd hopping_Platonic(int L, int VARIANT=0, double lambda1=1.)
double conjIfImag(double x)
void split_kagomeXC(int Lx, int Ly, std::vector< std::vector< int > > &A, std::vector< std::vector< int > > &B, std::vector< std::vector< int > > &C, std::vector< std::vector< int > > &D)
ArrayXXd hopping_triangularYC(int Lx, int Ly, bool PBCx=false, bool PBCy=true, double lambda=1.)
ArrayXXd hopping_Archimedean(string vertex_conf, int VARIANT=0, double lambda1=1., double lambda2=1.)
ArrayXXd hexagonalFlake(int L, double lambda=1.)
ArrayXXd triangularFlake(int L, double lambda=1.)
ArrayXXd hopping_Mn32(double lambda_cap=1., double lambda_corner=0., double lambda_edge=1., int VARIANT=0)