17 #include <bitcalc.hpp> 18 #include "common/setmemory.hpp" 21 #include "wrapperMPI.hpp" 22 #include "xsetmem.hpp" 66 unsigned long int ia, ja, jb;
67 unsigned long int div_down, div_up;
68 unsigned long int num_up, num_down;
69 unsigned long int tmp_num_up, tmp_num_down;
70 unsigned int icheck_loc;
78 for (j = X->
Def.
Nsite / 2; j < X->Def.Nsite; j++) {
79 div_up = i & X->
Def.
Tpow[2 * j];
80 div_up = div_up / X->
Def.
Tpow[2 * j];
81 div_down = i & X->
Def.
Tpow[2 * j + 1];
82 div_down = div_down / X->
Def.
Tpow[2 * j + 1];
92 icheck_loc = icheck_loc;
95 icheck_loc = icheck_loc * (div_up^div_down);
102 tmp_num_down = num_down;
103 if (icheck_loc == 1) {
109 while (ia < (
unsigned long)X->
Check.
sdim && ia != 0) {
114 num_down = tmp_num_down;
116 for (j = 0; j < (X->
Def.
Nsite + 1) / 2; j++) {
117 div_up = i & X->
Def.
Tpow[2 * j];
118 div_up = div_up / X->
Def.
Tpow[2 * j];
119 div_down = i & X->
Def.
Tpow[2 * j + 1];
120 div_down = div_down / X->
Def.
Tpow[2 * j + 1];
124 num_down += div_down;
128 num_down += div_down;
130 icheck_loc = icheck_loc;
133 icheck_loc = icheck_loc * (div_up^div_down);
143 icheck_loc = icheck_loc * (div_up^div_down);
146 if (num_up == (
unsigned long)X->
Def.
Nup 147 && num_down == (
unsigned long)X->
Def.
Ndown && icheck_loc == 1) {
149 list_1_[ja + jb] = ia + ib * ihfbit;
150 list_2_1_[ia] = ja + 1;
151 list_2_2_[ib] = jb + 1;
178 long int Binomial(
int n,
int k,
long int **comb,
int Nsite){
185 else if(n<0 || k<0 || n<k){
189 for(tmp_i=0;tmp_i<=Nsite;tmp_i++){
190 for(tmp_j=0;tmp_j<=Nsite;tmp_j++){
191 comb[tmp_i][tmp_j] = 0;
198 for(tmp_i=2;tmp_i<=n;tmp_i++){
199 for(tmp_j=0;tmp_j<=tmp_i;tmp_j++){
201 comb[tmp_i][tmp_j] = 1;
202 }
else if(tmp_j==tmp_i){
203 comb[tmp_i][tmp_j] = 1;
205 comb[tmp_i][tmp_j] = comb[tmp_i-1][tmp_j-1]+comb[tmp_i-1][tmp_j];
239 long int div_down, div_up;
240 long int num_up,num_down;
241 long int tmp_num_up,tmp_num_down;
250 div_up = div_up/X->
Def.
Tpow[2*j];
251 div_down = i & X->
Def.
Tpow[2*j+1];
252 div_down = div_down/X->
Def.
Tpow[2*j+1];
254 num_down += div_down;
259 tmp_num_down = num_down;
265 num_down = tmp_num_down;
269 div_up = div_up/X->
Def.
Tpow[2*j];
270 div_down = i & X->
Def.
Tpow[2*j+1];
271 div_down = div_down/X->
Def.
Tpow[2*j+1];
273 num_down += div_down;
276 list_1_[ja+jb]=ia+ib*ihfbit;
287 num_down = tmp_num_down;
291 div_up = div_up/X->
Def.
Tpow[2*j];
292 div_down = i & X->
Def.
Tpow[2*j+1];
293 div_down = div_down/X->
Def.
Tpow[2*j+1];
295 num_down += div_down;
297 if( (num_up+num_down) == X->
Def.
Ne){
298 list_1_[ja+jb]=ia+ib*ihfbit;
334 unsigned long int ia, ja, jb;
335 unsigned long int div_down, div_up;
336 unsigned long int num_up, num_down;
337 unsigned long int tmp_num_up, tmp_num_down;
344 for (j = 0; j < X->
Def.
Nsite; j++) {
345 div_up = i & X->
Def.
Tpow[2 * j];
346 div_up = div_up / X->
Def.
Tpow[2 * j];
347 div_down = i & X->
Def.
Tpow[2 * j + 1];
348 div_down = div_down / X->
Def.
Tpow[2 * j + 1];
350 num_down += div_down;
355 tmp_num_down = num_down;
358 if (tmp_num_up <= (
unsigned long)X->
Def.
Nup 359 && tmp_num_down <= (
unsigned long)X->
Def.
Ndown) {
363 num_down = tmp_num_down;
364 for (j = 0; j < X->
Def.
Nsite; j++) {
365 div_up = ia & X->
Def.
Tpow[2 * j];
366 div_up = div_up / X->
Def.
Tpow[2 * j];
367 div_down = ia & X->
Def.
Tpow[2 * j + 1];
368 div_down = div_down / X->
Def.
Tpow[2 * j + 1];
370 num_down += div_down;
372 if (num_up == (
unsigned long)X->
Def.
Nup && num_down == (
unsigned long)X->
Def.
Ndown) {
373 list_1_[ja + jb] = ia + ib * ihfbit;
374 list_2_1_[ia] = ja + 1;
375 list_2_2_[ib] = jb + 1;
380 while (ia < (
unsigned long)X->
Check.
sdim) {
382 num_down = tmp_num_down;
383 for (j = 0; j < X->
Def.
Nsite; j++) {
384 div_up = ia & X->
Def.
Tpow[2 * j];
385 div_up = div_up / X->
Def.
Tpow[2 * j];
386 div_down = ia & X->
Def.
Tpow[2 * j + 1];
387 div_down = div_down / X->
Def.
Tpow[2 * j + 1];
389 num_down += div_down;
391 if (num_up == (
unsigned long)X->
Def.
Nup && num_down == (
unsigned long)X->
Def.
Ndown) {
392 list_1_[ja + jb] = ia + ib * ihfbit;
393 list_2_1_[ia] = ja + 1;
394 list_2_2_[ib] = jb + 1;
404 if (tmp_num_up + tmp_num_down <= (
unsigned long)X->
Def.
Ne) {
405 ia = X->
Def.
Tpow[X->
Def.
Ne - tmp_num_up - tmp_num_down] - 1;
407 list_1_[ja + jb] = ia + ib * ihfbit;
408 list_2_1_[ia] = ja + 1;
409 list_2_2_[ib] = jb + 1;
413 while (ia < (
unsigned long)X->
Check.
sdim) {
414 list_1_[ja + jb] = ia + ib * ihfbit;
415 list_2_1_[ia] = ja + 1;
416 list_2_2_[ib] = jb + 1;
453 long int div_down, div_up;
454 long int num_up,num_down;
455 long int tmp_num_up,tmp_num_down;
464 for(j=X->
Def.
Nsite/2; j< X->Def.Nsite ;j++){
466 div_up = div_up/X->
Def.
Tpow[2*j];
467 div_down = i & X->
Def.
Tpow[2*j+1];
468 div_down = div_down/X->
Def.
Tpow[2*j+1];
472 num_down += div_down;
475 num_down += div_down;
477 icheck_loc= icheck_loc;
480 icheck_loc = icheck_loc*(div_up^div_down);
487 tmp_num_down = num_down;
492 num_down = tmp_num_down;
496 div_up = div_up/X->
Def.
Tpow[2*j];
497 div_down = i & X->
Def.
Tpow[2*j+1];
498 div_down = div_down/X->
Def.
Tpow[2*j+1];
502 num_down += div_down;
505 num_down += div_down;
507 icheck_loc= icheck_loc;
510 icheck_loc = icheck_loc*(div_up^div_down);
520 icheck_loc= icheck_loc*(div_up^div_down);
523 if(num_up == X->
Def.
Nup && num_down == X->
Def.
Ndown && icheck_loc==1){
524 list_1_[ja+jb]=ia+ib*ihfbit;
563 long int div_down, div_up;
569 for(j=X->
Def.
Nsite/2; j< X->Def.Nsite ;j++){
571 div_up = div_up/X->
Def.
Tpow[2*j];
572 div_down = i & X->
Def.
Tpow[2*j+1];
573 div_down = div_down/X->
Def.
Tpow[2*j+1];
576 icheck_loc= icheck_loc;
579 icheck_loc = icheck_loc*(div_up^div_down);
591 div_up = div_up/X->
Def.
Tpow[2*j];
592 div_down = i & X->
Def.
Tpow[2*j+1];
593 div_down = div_down/X->
Def.
Tpow[2*j+1];
596 icheck_loc= icheck_loc;
599 icheck_loc = icheck_loc*(div_up^div_down);
609 icheck_loc= icheck_loc*(div_up^div_down);
613 list_1_[ja+jb]=ia+ib*ihfbit;
659 for (j = 0; j < N; j++) {
667 for (ia = 0; ia < ihfbit; ia++) {
670 for (j = 0; j < N; j++) {
676 if (num_up == X->
Def.
Ne) {
677 list_1_[ja + jb] = ia + ib * ihfbit;
678 list_2_1_[ia] = ja + 1;
679 list_2_2_[ib] = jb + 1;
714 unsigned long int i, div;
715 unsigned long int ia, ja, jb;
716 unsigned long int num_up;
717 unsigned int tmp_num_up;
722 for (j = 0; j < N; j++) {
731 if (tmp_num_up <= (
unsigned long)X->
Def.
Ne 732 && ((
unsigned long)X->
Def.
Ne - tmp_num_up) <= (
unsigned long)X->
Def.
Nsite - 1) {
734 if (ia < (
unsigned long)ihfbit) {
735 list_1_[ja + jb] = ia + ib * ihfbit;
736 list_2_1_[ia] = ja + 1;
737 list_2_2_[ib] = jb + 1;
742 while (ia < (
unsigned long)ihfbit) {
744 list_1_[ja + jb] = ia + ib * ihfbit;
745 list_2_1_[ia] = ja + 1;
746 list_2_2_[ib] = jb + 1;
779 long int *list_2_1_Sz_,
780 long int *list_2_2_Sz_,
785 int list_2_2_Sz_ib=0;
788 list_2_2_Sz_ib =list_2_2_Sz_[ib];
790 for(ia=0;ia<ihfbit;ia++){
791 tmp_2Sz=list_2_1_Sz_[ia]+list_2_2_Sz_ib;
793 list_1_[ja+jb]=ia+ib*ihfbit;
819 const long int irght,
821 const long int ihfbit,
826 char sdt[D_FileNameMax];
827 char buf[D_FileNameMax];
836 TimeKeeper(X,
"%s_sz_TimeKeeper.dat",
"READ = 1: read starts: %s",
"a");
837 TimeKeeper(X,
"%s_TimeKeeper.dat",
"READ = 1: read starts: %s",
"a");
847 sprintf(sdt,
"ListForKondo_Ns%d_Ncond%d.dat",X->
Def.
Nsite,X->
Def.
Ne);
858 fprintf(fp_err,
"%s",
"No file. Please set READ=0.\n");
859 fprintf(stderr,
"%s",
"No file. Please set READ=0.\n");
860 fprintf(fp_err,
" %s does not exist. \n",sdt);
861 fprintf(stderr,
" %s does not exist. \n", sdt);
864 while(NULL !=
fgetsMPI(buf,
sizeof(buf),fp)){
889 TimeKeeper(X,
"%s_sz_TimeKeeper.dat",
"READ = 1: read finishes: %s",
"a");
890 TimeKeeper(X,
"%s_TimeKeeper.dat",
"READ = 1: read finishes: %s",
"a");
916 char sdt[D_FileNameMax], sdt_err[D_FileNameMax];
917 long int *HilbertNumToSz;
923 long int num_up, num_down;
924 long int irght, ilft, ihfbit;
927 int all_up, all_down, tmp_res, num_threads;
928 long int tmp_1, tmp_2, tmp_3;
933 int N_all_up, N_all_down;
935 long int num_loc, div_down;
946 long int *list_2_1_Sz;
947 long int *list_2_2_Sz;
949 list_2_1_Sz = li_1d_allocate(X->
Check.
sdim + 2);
951 for (j = 0; j < X->
Check.
sdim + 2; j++) {
968 long int tmp_i, tmp_j, tmp_pow, max_tmp_i;
973 int iSpnup, iMinup, iAllup;
976 fprintf(
stdoutMPI,
"%s",
" Start: Calculate HilbertNum for fixed Sz. \n");
977 TimeKeeper(X,
"%s_sz_TimeKeeper.dat",
"initial sz : %s",
"w");
978 TimeKeeper(X,
"%s_TimeKeeper.dat",
"initial sz : %s",
"a");
983 case HubbardNConserved:
993 for (j = 0; j < N; j++) {
1005 for (j = 0; j < N; j++) {
1015 case HubbardNConserved:
1042 if (
Read_sz(X, irght, ilft, ihfbit, &i_max) != 0) {
1049 num_threads = omp_get_max_threads();
1054 fprintf(fp,
"num_threads==%d\n", num_threads);
1059 TimeKeeper(X,
"%s_sz_TimeKeeper.dat",
"omp parallel sz starts: %s",
"a");
1060 TimeKeeper(X,
"%s_TimeKeeper.dat",
"omp parallel sz starts: %s",
"a");
1079 for (j = X->
Def.
Nsite / 2; j < X->Def.Nsite; j++) {
1085 for (ib = 0; ib < X->
Check.
sdim; ib++) {
1089 for (j = (X->
Def.
Nsite + 1) / 2; j < X->Def.Nsite; j++) {
1090 div_up = i & X->
Def.
Tpow[2 * j];
1091 div_up = div_up / X->
Def.
Tpow[2 * j];
1092 div_down = i & X->
Def.
Tpow[2 * j + 1];
1093 div_down = div_down / X->
Def.
Tpow[2 * j + 1];
1096 icheck_loc = icheck_loc;
1099 icheck_loc = icheck_loc * (div_up^div_down);
1103 if (icheck_loc == 1) {
1114 #pragma omp parallel for default(none) reduction(+:icnt) private(ib) firstprivate(ihfbit, N2, X) shared(list_1_, list_2_1_, list_2_2_, list_jb) 1115 for (ib = 0; ib < X->
Check.
sdim; ib++) {
1125 for (ib = 0; ib < X->
Check.
sdim; ib++) {
1130 for (j = 0; j <= N2 - 2; j += 2) {
1136 for (j = 1; j <= N2 - 1; j += 2) {
1143 all_up = (X->
Def.
Nsite + tmp_res) / 2;
1144 all_down = (X->
Def.
Nsite - tmp_res) / 2;
1148 jb += tmp_1 * tmp_2;
1152 TimeKeeper(X,
"%s_sz_TimeKeeper.dat",
"mid omp parallel sz : %s",
"a");
1153 TimeKeeper(X,
"%s_TimeKeeper.dat",
"mid omp parallel sz : %s",
"a");
1156 for (ib = 0; ib < X->
Check.
sdim; ib++) {
1157 icnt +=
child_omp_sz(ib, ihfbit, X, list_1_, list_2_1_, list_2_2_, list_jb);
1161 else if (hacker == 1) {
1165 for (ib = 0; ib < X->
Check.
sdim; ib++) {
1170 for (j = 0; j <= N2 - 2; j += 2) {
1176 for (j = 1; j <= N2 - 1; j += 2) {
1183 all_up = (X->
Def.
Nsite + tmp_res) / 2;
1184 all_down = (X->
Def.
Nsite - tmp_res) / 2;
1188 jb += tmp_1 * tmp_2;
1192 TimeKeeper(X,
"%s_sz_TimeKeeper.dat",
"mid omp parallel sz : %s",
"a");
1193 TimeKeeper(X,
"%s_TimeKeeper.dat",
"mid omp parallel sz : %s",
"a");
1196 #pragma omp parallel for default(none) reduction(+:icnt) private(ib) firstprivate(ihfbit, X) shared(list_1_, list_2_1_, list_2_2_, list_jb) 1197 for (ib = 0; ib < X->
Check.
sdim; ib++) {
1203 fprintf(stderr,
"Error: CalcHS in ModPara file must be 0 or 1 for Hubbard model.");
1207 case HubbardNConserved:
1219 for (ib = 0; ib < X->
Check.
sdim; ib++) {
1223 for (j = 0; j <= N2 - 2; j += 2) {
1229 for (j = 1; j <= N2 - 1; j += 2) {
1235 all_up = (X->
Def.
Nsite + tmp_res) / 2;
1236 all_down = (X->
Def.
Nsite - tmp_res) / 2;
1238 for (iSpnup = iMinup; iSpnup <= iAllup; iSpnup++) {
1239 tmp_1 =
Binomial(all_up, iSpnup - num_up, comb, all_up);
1240 tmp_2 =
Binomial(all_down, X->
Def.
Ne - iSpnup - num_down, comb, all_down);
1241 jb += tmp_1 * tmp_2;
1245 TimeKeeper(X,
"%s_sz_TimeKeeper.dat",
"mid omp parallel sz : %s",
"a");
1246 TimeKeeper(X,
"%s_TimeKeeper.dat",
"mid omp parallel sz : %s",
"a");
1249 #pragma omp parallel for default(none) reduction(+:icnt) private(ib) firstprivate(ihfbit, N2, X) shared(list_1_, list_2_1_, list_2_2_, list_jb) 1250 for (ib = 0; ib < X->
Check.
sdim; ib++) {
1251 icnt +=
child_omp_sz(ib, ihfbit, X, list_1_, list_2_1_, list_2_2_, list_jb);
1255 else if (hacker == 1) {
1265 for (ib = 0; ib < X->
Check.
sdim; ib++) {
1269 for (j = 0; j <= N2 - 2; j += 2) {
1275 for (j = 1; j <= N2 - 1; j += 2) {
1281 all_up = (X->
Def.
Nsite + tmp_res) / 2;
1282 all_down = (X->
Def.
Nsite - tmp_res) / 2;
1284 for (iSpnup = iMinup; iSpnup <= iAllup; iSpnup++) {
1285 tmp_1 =
Binomial(all_up, iSpnup - num_up, comb, all_up);
1286 tmp_2 =
Binomial(all_down, X->
Def.
Ne - iSpnup - num_down, comb, all_down);
1287 jb += tmp_1 * tmp_2;
1291 TimeKeeper(X,
"%s_sz_TimeKeeper.dat",
"mid omp parallel sz : %s",
"a");
1292 TimeKeeper(X,
"%s_TimeKeeper.dat",
"mid omp parallel sz : %s",
"a");
1295 #pragma omp parallel for default(none) reduction(+:icnt) private(ib) firstprivate(ihfbit, N2, X) shared(list_1_, list_2_1_, list_2_2_, list_jb) 1296 for (ib = 0; ib < X->
Check.
sdim; ib++) {
1303 fprintf(stderr,
"Error: CalcHS in ModPara file must be 0 or 1 for Hubbard model.");
1311 fprintf(
stdoutMPI,
" N_all_up = %d N_all_down = %d \n", N_all_up, N_all_down);
1315 for (j = X->
Def.
Nsite / 2; j < X->Def.Nsite; j++) {
1321 for (ib = 0; ib < X->
Check.
sdim; ib++) {
1328 for (j = X->
Def.
Nsite / 2; j < X->Def.Nsite; j++) {
1329 div_up = i & X->
Def.
Tpow[2 * j];
1330 div_up = div_up / X->
Def.
Tpow[2 * j];
1331 div_down = i & X->
Def.
Tpow[2 * j + 1];
1332 div_down = div_down / X->
Def.
Tpow[2 * j + 1];
1335 num_down += div_down;
1339 num_down += div_down;
1341 icheck_loc = icheck_loc;
1342 ihfSpinDown = div_down;
1343 if (div_down == 0) {
1348 icheck_loc = icheck_loc * (div_up^div_down);
1353 if (icheck_loc == 1) {
1356 all_up = (X->
Def.
Nsite + tmp_res) / 2 - all_loc;
1357 all_down = (X->
Def.
Nsite - tmp_res) / 2 - all_loc;
1359 all_up = (X->
Def.
Nsite) / 2 - all_loc;
1360 all_down = (X->
Def.
Nsite) / 2 - all_loc;
1363 for (num_loc_up = 0; num_loc_up <= all_loc; num_loc_up++) {
1364 tmp_1 =
Binomial(all_loc, num_loc_up, comb, all_loc);
1366 if (ihfSpinDown != 0) {
1367 tmp_2 =
Binomial(all_up, X->
Def.
Nup - num_up - num_loc_up, comb, all_up);
1368 tmp_3 =
Binomial(all_down, X->
Def.
Ndown - num_down - (all_loc - num_loc_up), comb, all_down);
1371 tmp_2 =
Binomial(all_up, X->
Def.
Nup - num_up - num_loc_up, comb, all_up);
1372 tmp_3 =
Binomial(all_down, X->
Def.
Ndown - num_down - (all_loc - num_loc_up), comb, all_down);
1376 tmp_2 =
Binomial(all_up, X->
Def.
Nup - num_up - num_loc_up, comb, all_up);
1377 tmp_3 =
Binomial(all_down, X->
Def.
Ndown - num_down - (all_loc - num_loc_up), comb, all_down);
1379 jb += tmp_1 * tmp_2*tmp_3;
1385 TimeKeeper(X,
"%s_sz_TimeKeeper.dat",
"mid omp parallel sz : %s",
"a");
1386 TimeKeeper(X,
"%s_TimeKeeper.dat",
"mid omp parallel sz : %s",
"a");
1391 #pragma omp parallel for default(none) reduction(+:icnt) private(ib) firstprivate(ihfbit, N2, X) shared(list_1_, list_2_1_, list_2_2_, list_jb) 1392 for (ib = 0; ib < X->
Check.
sdim; ib++) {
1396 else if (hacker == 1) {
1398 #pragma omp parallel for default(none) reduction(+:icnt) private(ib) firstprivate(ihfbit, N2, X) shared(list_1_, list_2_1_, list_2_2_, list_jb) 1399 for (ib = 0; ib < X->
Check.
sdim; ib++) {
1417 while (tmp_pow < X->Def.Tpow[X->
Def.
Ne]) {
1419 tmp_pow = tmp_pow * 2;
1428 while (tmp_i < max_tmp_i) {
1429 list_1_[icnt] = tmp_i;
1443 list_2_1_[ia] = ja + 1;
1444 list_2_2_[ib] = jb + 1;
1445 tmp_j =
snoob(tmp_i);
1452 else if (hacker == 1) {
1454 for (ib = 0; ib < X->
Check.
sdim; ib++) {
1458 for (j = 0; j < N; j++) {
1460 div_up = div_up / X->
Def.
Tpow[j];
1468 TimeKeeper(X,
"%s_sz_TimeKeeper.dat",
"mid omp parallel sz : %s",
"a");
1469 TimeKeeper(X,
"%s_TimeKeeper.dat",
"mid omp parallel sz : %s",
"a");
1472 #pragma omp parallel for default(none) reduction(+:icnt) private(ib) firstprivate(ihfbit, N, X, list_1_, list_2_1_, list_2_2_, list_jb) 1473 for (ib = 0; ib < X->
Check.
sdim; ib++) {
1479 else if (hacker == 0) {
1481 for (ib = 0; ib < X->
Check.
sdim; ib++) {
1485 for (j = 0; j < N; j++) {
1487 div_up = div_up / X->
Def.
Tpow[j];
1495 TimeKeeper(X,
"%s_sz_TimeKeeper.dat",
"mid omp parallel sz : %s",
"a");
1496 TimeKeeper(X,
"%s_TimeKeeper.dat",
"mid omp parallel sz : %s",
"a");
1499 #pragma omp parallel for default(none) reduction(+:icnt) private(ib) firstprivate(ihfbit, N, X) shared(list_1_, list_2_1_, list_2_2_, list_jb) 1500 for (ib = 0; ib < X->
Check.
sdim; ib++) {
1501 icnt +=
child_omp_sz_spin(ib, ihfbit, N, X, list_1_, list_2_1_, list_2_2_, list_jb);
1505 fprintf(stderr,
"Error: CalcHS in ModPara file must be -1 or 0 or 1 for Spin model.");
1512 long int itmpSize = 1;
1514 for (j = 0; j < X->
Def.
Nsite; j++) {
1516 if (itmpSize == ihfbit) {
1521 for (j = 0; j < X->
Def.
Nsite; j++) {
1525 HilbertNumToSz = li_1d_allocate(2 * Max2Sz + 1);
1526 for (ib = 0; ib < 2 * Max2Sz + 1; ib++) {
1527 HilbertNumToSz[ib] = 0;
1530 for (ib = 0; ib < ihfbit; ib++) {
1532 for (j = 1; j <= irghtsite; j++) {
1535 list_2_1_Sz[ib] = i2Sz;
1536 HilbertNumToSz[i2Sz + Max2Sz]++;
1540 for (ib = 0; ib < ilftdim; ib++) {
1543 for (j = 1; j <= (N - irghtsite); j++) {
1546 list_2_2_Sz[ib] = i2Sz;
1548 jb += HilbertNumToSz[X->
Def.
Total2Sz - i2Sz + Max2Sz];
1552 TimeKeeper(X,
"%s_sz_TimeKeeper.dat",
"mid omp parallel sz : %s",
"a");
1553 TimeKeeper(X,
"%s_TimeKeeper.dat",
"mid omp parallel sz : %s",
"a");
1556 #pragma omp parallel for default(none) reduction(+:icnt) private(ib) firstprivate(ilftdim, ihfbit, X) shared(list_1_, list_2_1_, list_2_2_, list_2_1_Sz, list_2_2_Sz,list_jb) 1557 for (ib = 0; ib < ilftdim; ib++) {
1561 free_li_1d_allocate(HilbertNumToSz);
1571 TimeKeeper(X,
"%s_sz_TimeKeeper.dat",
"omp parallel sz finishes: %s",
"a");
1572 TimeKeeper(X,
"%s_TimeKeeper.dat",
"omp parallel sz finishes: %s",
"a");
1585 fprintf(stderr,
"%s",
"Error: in sz. \n");
1586 fprintf(stderr,
"imax = %ld, Check.idim_max=%ld \n", i_max, X->
Check.
idim_max);
1587 strcpy(sdt_err,
"Err_sz.dat");
1591 fprintf(fp_err,
"%s",
"Caution!! Error in sz !!!! idim_max is not correct \n");
1596 free_li_2d_allocate(comb);
1598 fprintf(
stdoutMPI,
"%s",
" End : Calculate HilbertNum for fixed Sz. \n\n");
void exitMPI(int errorcode)
MPI Abortation wrapper.
long int Binomial(int n, int k, long int **comb, int Nsite)
int Nup
Number of spin-up electrons in this process.
struct DefineList Def
Definision of system (Hamiltonian) etc.
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
int GetSplitBitByModel(const int Nsite, const int iCalcModel, long int *irght, long int *ilft, long int *ihfbit)
function of splitting original bit into right and left spaces.
int child_omp_sz_Kondo_hacker(long int ib, long int ihfbit, struct BindStruct *X, long int *list_1_, long int *list_2_1_, long int *list_2_2_, long int *list_jb_)
calculating restricted Hilbert space for Kondo-GC systems
int Total2Sz
Total in this process.
int Nsite
Number of sites in the INTRA process region.
struct LargeList Large
Variables for Matrix-Vector product.
int * LocSpn
[DefineList::NLocSpn] Flag (and size) of the local spin. malloc in setmem_def().
int Read_sz(struct BindStruct *X, const long int irght, const long int ilft, const long int ihfbit, long int *i_max)
reading the list of the restricted Hilbert space
int child_omp_sz_spin(long int ib, long int ihfbit, int N, struct BindStruct *X, long int *list_1_, long int *list_2_1_, long int *list_2_2_, long int *list_jb_)
calculating restricted Hilbert space for spin-1/2 systems
int child_omp_sz_Kondo(long int ib, long int ihfbit, struct BindStruct *X, long int *list_1_, long int *list_2_1_, long int *list_2_2_, long int *list_jb_)
calculating restricted Hilbert space for Kondo systems
int child_omp_sz(long int ib, long int ihfbit, struct BindStruct *X, long int *list_1_, long int *list_2_1_, long int *list_2_2_, long int *list_jb_)
calculating restricted Hilbert space for Hubbard systems
long int irght
Used for Ogata-Lin ???
int sz(struct BindStruct *X, long int *list_1_, long int *list_2_1_, long int *list_2_2_)
generating Hilbert space
int Ne
Number of electrons in this process.
long int ilft
Used for Ogata-Lin ???
int READ
It is ALWAYS 0 ???
int read_hacker
Whether use an efficient method (=1) in sz.c or not (=0)
long int ihfbit
Used for Ogata-Lin ???
int child_omp_sz_KondoGC(long int ib, long int ihfbit, struct BindStruct *X, long int *list_1_, long int *list_2_1_, long int *list_2_2_, long int *list_jb_)
char * fgetsMPI(char *InputString, int maxcount, FILE *fp)
MPI file I/O (get a line, fgets) wrapper. Only the root node (myrank = 0) reads and broadcast string...
int GetLocal2Sz(const int isite, const long int org_bit, const long int *SiteToBit, const long int *Tpow)
get 2sz at a site for general spin
int iFlgGeneralSpin
Flag for the general (Sz/=1/2) spin.
int child_omp_sz_hacker(long int ib, long int ihfbit, struct BindStruct *X, long int *list_1_, long int *list_2_1_, long int *list_2_2_, long int *list_jb_)
efficient version of calculating restricted Hilbert space for Hubbard systems using snoob details of ...
int child_omp_sz_GeneralSpin(long int ib, long int ihfbit, struct BindStruct *X, long int *list_1_, long int *list_2_1_, long int *list_2_2_, long int *list_2_1_Sz_, long int *list_2_2_Sz_, long int *list_jb_)
calculating restricted Hilbert space for general spin systems (S>1/2)
int child_omp_sz_spin_hacker(long int ib, long int ihfbit, int N, struct BindStruct *X, long int *list_1_, long int *list_2_1_, long int *list_2_2_, long int *list_jb_)
efficient version of calculating restricted Hilbert space for spin-1/2 systems details of snoob is fo...
long int * SiteToBit
[DefineList::NsiteMPI] Similar to DefineList::Tpow. For general spin.
long int snoob(long int x)
"finding the next higher number after a given number that has the same number of 1-bits" This method ...
long int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
int TimeKeeper(struct BindStruct *X, const char *cFileName, const char *cTimeKeeper_Message, const char *cWriteType)
Functions for writing a time log.
int iCalcModel
Switch for model. 0:Hubbard, 1:Spin, 2:Kondo, 3:HubbardGC, 4:SpinGC, 5:KondoGC, 6:HubbardNConserved.
int iFlgCalcSpec
Input parameter CalcSpec in teh CalcMod file.
int Ndown
Number of spin-down electrons in this process.
long int SizeOflistjb
Used for computing Sz.
int NLocSpn
Number of local spins.
struct CheckList Check
Size of the Hilbert space.
char * CDataFileHead
Read from Calcmod in readdef.h. Header of output file such as Green's function.
long int sdim
Dimension for Ogata-Lin ???
long int idim_max
The dimension of the Hilbert space of this process.
int childfopenMPI(const char *_cPathChild, const char *_cmode, FILE **_fp)
Only the root process open file in output/ directory.