21 #include "StdFace_vals.hpp" 22 #include "StdFace_ModelUtil.hpp" 33 struct StdIntList *StdI
40 sprintf(filename,
"%s_geom.dat", StdI->CDataFileHead);
41 fprintf(stdout,
" Wannier90 Geometry file = %s\n", filename);
43 fp = fopen(filename,
"r");
47 for (ii = 0; ii < 3; ii++)
48 ierr = fscanf(fp,
"%lf%lf%lf", &StdI->direct[ii][0], &StdI->direct[ii][1], &StdI->direct[ii][2]);
49 if(ierr == EOF) printf(
"%d\n", ierr);
53 for (isite = 0; isite < StdI->NsiteUC; isite++) free(StdI->tau[isite]);
55 ierr = fscanf(fp,
"%d", &StdI->NsiteUC);
56 fprintf(stdout,
" Number of Correlated Sites = %d\n", StdI->NsiteUC);
58 StdI->tau = (
double **)malloc(
sizeof(
double*) * StdI->NsiteUC);
59 for (ii = 0; ii < StdI->NsiteUC; ii++) StdI->tau[ii] = (
double *)malloc(
sizeof(
double) * 3);
61 for (isite = 0; isite < StdI->NsiteUC; isite++)
62 ierr = fscanf(fp,
"%lf%lf%lf", &StdI->tau[isite][0], &StdI->tau[isite][1], &StdI->tau[isite][2]);
65 printf(
" Direct lattice vectors:\n");
66 for (ii = 0; ii < 3; ii++) printf(
" %10.5f %10.5f %10.5f\n",
67 StdI->direct[ii][0], StdI->direct[ii][1], StdI->direct[ii][2]);
68 printf(
" Wannier centres:\n");
69 for (isite = 0; isite < StdI->NsiteUC; isite++) printf(
" %10.5f %10.5f %10.5f\n",
70 StdI->tau[isite][0], StdI->tau[isite][1], StdI->tau[isite][2]);
78 struct StdIntList *StdI,
86 std::complex<double> **tUJ
90 int ierr, nWan, nWSC, iWSC, jWSC, iWan, jWan, iWan0, jWan0, ii, jj;
91 double dtmp[2], dR[3], length;
92 char ctmp[256], *ctmp2;
93 std::complex<double> ***Mat_tot;
98 fp = fopen(filename,
"r");
99 ctmp2 = fgets(ctmp, 256, fp);
100 ierr = fscanf(fp,
"%d", &nWan);
101 if (ierr == EOF) printf(
"%d %s\n", ierr, ctmp2);
102 ierr = fscanf(fp,
"%d", &nWSC);
103 for (iWSC = 0; iWSC < nWSC; iWSC++) {
104 ierr = fscanf(fp,
"%d", &ii);
109 Mat_tot = (std::complex<double> ***)malloc(
sizeof(std::complex<double> **) * nWSC);
110 indx_tot = (
int **)malloc(
sizeof(
int*) * nWSC);
111 for (iWSC = 0; iWSC < nWSC; iWSC++) {
112 Mat_tot[iWSC] = (std::complex<double> **)malloc(
sizeof(std::complex<double> *) * nWan);
113 indx_tot[iWSC] = (
int *)malloc(
sizeof(
int) * 3);
114 for (iWan = 0; iWan < nWan; iWan++) {
115 Mat_tot[iWSC][iWan] = (std::complex<double> *)malloc(
sizeof(std::complex<double>) * nWan);
121 for (iWSC = 0; iWSC < nWSC; iWSC++) {
122 for (iWan = 0; iWan < nWan; iWan++) {
123 for (jWan = 0; jWan < nWan; jWan++) {
124 ierr = fscanf(fp,
"%d%d%d%d%d%lf%lf",
125 &indx_tot[iWSC][0], &indx_tot[iWSC][1], &indx_tot[iWSC][2],
131 for (ii = 0; ii < 3; ii++) {
133 for (jj = 0; jj < 3; jj++)
134 dR[ii] += StdI->direct[jj][ii] * (StdI->tau[jWan][jj] - StdI->tau[iWan][jj] + indx_tot[iWSC][jj]);
136 length = sqrt(dR[0] * dR[0] + dR[1] * dR[1] + dR[2] * dR[2]);
137 if (length > cutoff_length && cutoff_length > 0.0) {
141 if (abs(indx_tot[iWSC][0]) > cutoff_R[0] ||
142 abs(indx_tot[iWSC][1]) > cutoff_R[1] ||
143 abs(indx_tot[iWSC][2]) > cutoff_R[2]) {
147 if (iWan0 <= StdI->NsiteUC && jWan0 <= StdI->NsiteUC)
148 Mat_tot[iWSC][iWan0 - 1][jWan0 - 1] = std::complex<double>(dtmp[0], dtmp[1]);
154 for (jWSC = 0; jWSC < iWSC; jWSC++) {
156 indx_tot[iWSC][0] == -indx_tot[jWSC][0] &&
157 indx_tot[iWSC][1] == -indx_tot[jWSC][1] &&
158 indx_tot[iWSC][2] == -indx_tot[jWSC][2]
160 for (iWan = 0; iWan < StdI->NsiteUC; iWan++) {
161 for (jWan = 0; jWan < StdI->NsiteUC; jWan++) {
162 Mat_tot[iWSC][iWan][jWan] = 0.0;
166 if (indx_tot[iWSC][0] == 0 &&
167 indx_tot[iWSC][1] == 0 &&
168 indx_tot[iWSC][2] == 0)
169 for (iWan = 0; iWan < StdI->NsiteUC; iWan++) {
170 for (jWan = 0; jWan < iWan; jWan++) {
171 Mat_tot[iWSC][iWan][jWan] = 0.0;
179 fprintf(stdout,
"\n EFFECTIVE terms:\n");
180 fprintf(stdout,
" R0 R1 R2 band_i band_f Hamiltonian\n");
182 for (iWSC = 0; iWSC < nWSC; iWSC++) {
183 for (iWan = 0; iWan < StdI->NsiteUC; iWan++) {
184 for (jWan = 0; jWan < StdI->NsiteUC; jWan++) {
185 if (cutoff < abs(Mat_tot[iWSC][iWan][jWan])) {
186 fprintf(stdout,
" %5d%5d%5d%5d%5d%12.6f%12.6f\n",
187 indx_tot[iWSC][0], indx_tot[iWSC][1], indx_tot[iWSC][2], iWan, jWan,
188 real(Mat_tot[iWSC][iWan][jWan]), imag(Mat_tot[iWSC][iWan][jWan]));
194 fprintf(stdout,
" Total number of EFFECTIVE term = %d\n", NtUJ[itUJ]);
195 tUJ[itUJ] = (std::complex<double> *)malloc(
sizeof(std::complex<double>) * NtUJ[itUJ]);
196 tUJindx[itUJ] = (
int **)malloc(
sizeof(
int*) * NtUJ[itUJ]);
197 for (ii = 0; ii < NtUJ[itUJ]; ii++) tUJindx[itUJ][ii] = (
int *)malloc(
sizeof(
int) * 5);
203 for (iWSC = 0; iWSC < nWSC; iWSC++) {
204 for (iWan = 0; iWan < StdI->NsiteUC; iWan++) {
205 for (jWan = 0; jWan < StdI->NsiteUC; jWan++) {
206 if (cutoff < abs(Mat_tot[iWSC][iWan][jWan])) {
207 for (ii = 0; ii < 3; ii++) tUJindx[itUJ][NtUJ[itUJ]][ii] = indx_tot[iWSC][ii];
208 tUJindx[itUJ][NtUJ[itUJ]][3] = iWan;
209 tUJindx[itUJ][NtUJ[itUJ]][4] = jWan;
210 tUJ[itUJ][NtUJ[itUJ]] = Mat_tot[iWSC][iWan][jWan];
217 for (iWSC = 0; iWSC < nWSC; iWSC++) {
218 for (iWan = 0; iWan < nWan; iWan++) {
219 free(Mat_tot[iWSC][iWan]);
222 free(indx_tot[iWSC]);
232 struct StdIntList *StdI,
237 int ierr, nWan, nWSC, iWSC, iWan, jWan, iWan0, jWan0, ii, Rmax[3], Rmin[3], NR[3], i0, i1, i2;
239 char ctmp[256], *ctmp2;
240 std::complex<double> ***Mat_tot, *****DenMat;
245 fp = fopen(filename,
"r");
246 ctmp2 = fgets(ctmp, 256, fp);
247 ierr = fscanf(fp,
"%d", &nWan);
248 if (ierr == EOF) printf(
"%d %s\n", ierr, ctmp2);
249 ierr = fscanf(fp,
"%d", &nWSC);
250 for (iWSC = 0; iWSC < nWSC; iWSC++) {
251 ierr = fscanf(fp,
"%d", &ii);
256 Mat_tot = (std::complex<double> ***)malloc(
sizeof(std::complex<double> **) * nWSC);
257 indx_tot = (
int **)malloc(
sizeof(
int*) * nWSC);
258 for (iWSC = 0; iWSC < nWSC; iWSC++) {
259 Mat_tot[iWSC] = (std::complex<double> **)malloc(
sizeof(std::complex<double> *) * nWan);
260 indx_tot[iWSC] = (
int *)malloc(
sizeof(
int) * 3);
261 for (iWan = 0; iWan < nWan; iWan++) {
262 Mat_tot[iWSC][iWan] = (std::complex<double> *)malloc(
sizeof(std::complex<double>) * nWan);
268 for (ii = 0; ii < 3; ii++) {
272 for (iWSC = 0; iWSC < nWSC; iWSC++) {
273 for (iWan = 0; iWan < nWan; iWan++) {
274 for (jWan = 0; jWan < nWan; jWan++) {
275 ierr = fscanf(fp,
"%d%d%d%d%d%lf%lf",
276 &indx_tot[iWSC][0], &indx_tot[iWSC][1], &indx_tot[iWSC][2],
279 if (iWan0 <= StdI->NsiteUC && jWan0 <= StdI->NsiteUC)
280 Mat_tot[iWSC][iWan0 - 1][jWan0 - 1] = std::complex<double>(dtmp[0], dtmp[1]);
281 for (ii = 0; ii < 3; ii++) {
282 if (indx_tot[iWSC][ii] < Rmin[ii]) Rmin[ii] = indx_tot[iWSC][ii];
283 if (indx_tot[iWSC][ii] > Rmax[ii]) Rmax[ii] = indx_tot[iWSC][ii];
289 for (ii = 0; ii < 3; ii++) NR[ii] = Rmax[ii] - Rmin[ii] + 1;
290 fprintf(stdout,
" Minimum R : %d %d %d\n", Rmin[0], Rmin[1], Rmin[2]);
291 fprintf(stdout,
" Maximum R : %d %d %d\n", Rmax[0], Rmax[1], Rmax[2]);
292 fprintf(stdout,
" Numver of R : %d %d %d\n", NR[0], NR[1], NR[2]);
294 DenMat = (std::complex<double> *****)malloc(
sizeof(std::complex<double> ****)*NR[0]);
295 DenMat = DenMat - Rmin[0];
296 for (i0 = Rmin[0]; i0 <= Rmax[0]; i0++) {
297 DenMat[i0] = (std::complex<double> ****)malloc(
sizeof(std::complex<double> ***)*NR[1]);
298 DenMat[i0] = DenMat[i0] - Rmin[1];
299 for (i1 = Rmin[1]; i1 <= Rmax[1]; i1++) {
300 DenMat[i0][i1] = (std::complex<double> ***)malloc(
sizeof(std::complex<double> **)*NR[2]);
301 DenMat[i0][i1] = DenMat[i0][i1] - Rmin[2];
302 for (i2 = Rmin[2]; i2 <= Rmax[2]; i2++) {
303 DenMat[i0][i1][i2] = (std::complex<double> **)malloc(
sizeof(std::complex<double> *) * StdI->NsiteUC);
304 for (iWan = 0; iWan < StdI->NsiteUC; iWan++) {
305 DenMat[i0][i1][i2][iWan] = (std::complex<double> *)malloc(
sizeof(std::complex<double>) * StdI->NsiteUC);
306 for (jWan = 0; jWan < StdI->NsiteUC; jWan++)DenMat[i0][i1][i2][iWan][jWan] = 0.0;
311 for (iWSC = 0; iWSC < nWSC; iWSC++)
312 for (iWan = 0; iWan < nWan; iWan++)
313 for (jWan = 0; jWan < nWan; jWan++)
314 DenMat[indx_tot[iWSC][0]][indx_tot[iWSC][1]][indx_tot[iWSC][2]][iWan][jWan]
315 = Mat_tot[iWSC][iWan][jWan];
317 for (iWSC = 0; iWSC < nWSC; iWSC++) {
318 for (iWan = 0; iWan < nWan; iWan++) {
319 free(Mat_tot[iWSC][iWan]);
322 free(indx_tot[iWSC]);
334 struct StdIntList *StdI,
336 std::complex<double> *****DenMat,
340 int iW, iL, iH, kCell, it, isite, jsite ,NIniGuess, ispin;
342 std::complex<double> Cphase, **IniGuess;
344 IniGuess = (std::complex<double> **)malloc(
sizeof(std::complex<double>*) * StdI->nsite);
345 for (isite = 0; isite < StdI->nsite; isite++)
346 IniGuess[isite] = (std::complex<double> *)malloc(
sizeof(std::complex<double>) * StdI->nsite);
348 for (kCell = 0; kCell < StdI->NCell; kCell++) {
350 iW = StdI->Cell[kCell][0];
351 iL = StdI->Cell[kCell][1];
352 iH = StdI->Cell[kCell][2];
356 for (isite = 0; isite < StdI->NsiteUC; isite++) {
357 jsite = isite + StdI->NsiteUC*kCell;
358 IniGuess[jsite][jsite] = DenMat[0][0][0][isite][isite];
363 for (it = 0; it < NtUJ[1]; it++) {
365 tUJindx[1][it][0], tUJindx[1][it][1], tUJindx[1][it][2],
366 tUJindx[1][it][3], tUJindx[1][it][4], &isite, &jsite, &Cphase, dR);
367 IniGuess[isite][jsite] = DenMat[tUJindx[1][it][0]][tUJindx[1][it][1]][tUJindx[1][it][2]]
368 [tUJindx[1][it][3]][tUJindx[1][it][4]];
369 IniGuess[jsite][isite] = conj(DenMat[tUJindx[1][it][0]][tUJindx[1][it][1]][tUJindx[1][it][2]]
370 [tUJindx[1][it][3]][tUJindx[1][it][4]]);
375 for (it = 0; it < NtUJ[2]; it++) {
377 tUJindx[2][it][0], tUJindx[2][it][1], tUJindx[2][it][2],
378 tUJindx[2][it][3], tUJindx[2][it][4], &isite, &jsite, &Cphase, dR);
379 IniGuess[isite][jsite] = DenMat[tUJindx[2][it][0]][tUJindx[2][it][1]][tUJindx[2][it][2]]
380 [tUJindx[2][it][3]][tUJindx[2][it][4]];
381 IniGuess[jsite][isite] = conj(DenMat[tUJindx[2][it][0]][tUJindx[2][it][1]][tUJindx[2][it][2]]
382 [tUJindx[2][it][3]][tUJindx[2][it][4]]);
387 for (isite = 0; isite < StdI->nsite; isite++) {
388 for (jsite = 0; jsite < StdI->nsite; jsite++) {
389 if (abs(IniGuess[isite][jsite]) > 1.0e-6)NIniGuess += 1;
393 fp = fopen(
"initial.def",
"w");
394 fprintf(fp,
"======================== \n");
395 fprintf(fp,
"NInitialGuess %7d \n", NIniGuess*2);
396 fprintf(fp,
"======================== \n");
397 fprintf(fp,
"========i_j_s_tijs====== \n");
398 fprintf(fp,
"======================== \n");
400 for (isite = 0; isite < StdI->nsite; isite++) {
401 for (jsite = 0; jsite < StdI->nsite; jsite++) {
402 if (abs(IniGuess[isite][jsite]) > 1.0e-6)
403 for (ispin = 0; ispin < 2; ispin++) {
404 fprintf(fp,
"%5d %5d %5d %5d %25.15f %25.15f\n",
405 jsite, ispin, isite, ispin,
406 0.5*real(IniGuess[isite][jsite]),
407 0.5*imag(IniGuess[isite][jsite]));
414 fprintf(stdout,
" initial.def is written.\n");
416 for (isite = 0; isite < StdI->nsite; isite++)
417 free(IniGuess[isite]);
425 struct StdIntList *StdI
428 int isite, jsite, ispin, ntransMax, nintrMax;
429 int iL, iW, iH, kCell, it, ii;
430 double Jtmp[3][3] = { {0.0} };
432 std::complex<double> Cphase, DenMat0;
433 double dR[3], *Uspin;
435 std::complex<double> **tUJ, *****DenMat;
441 fp = fopen(
"lattice.xsf",
"w");
448 fprintf(stdout,
"\n @ Wannier90 Geometry \n\n");
452 tUJ = (std::complex<double> **)malloc(
sizeof(std::complex<double>*) * 3);
453 tUJindx = (
int ***)malloc(
sizeof(
int**) * 3);
458 fprintf(stdout,
"\n @ Wannier90 hopping \n\n");
461 sprintf(filename,
"%s_hr.dat", StdI->CDataFileHead);
463 StdI->cutoff_t, StdI->cutoff_tR, StdI->cutoff_length_t,
464 0, NtUJ, tUJindx, tUJ);
468 fprintf(stdout,
"\n @ Wannier90 Coulomb \n\n");
471 sprintf(filename,
"%s_ur.dat", StdI->CDataFileHead);
473 StdI->cutoff_u, StdI->cutoff_UR, StdI->cutoff_length_U,
474 1, NtUJ, tUJindx, tUJ);
478 fprintf(stdout,
"\n @ Wannier90 Hund \n\n");
481 sprintf(filename,
"%s_jr.dat", StdI->CDataFileHead);
483 StdI->cutoff_j, StdI->cutoff_JR, StdI->cutoff_length_J,
484 2, NtUJ, tUJindx, tUJ);
488 fprintf(stdout,
"\n @ Wannier90 Density-matrix \n\n");
489 sprintf(filename,
"%s_dr.dat", StdI->CDataFileHead);
494 fprintf(stdout,
"\n @ Hamiltonian \n\n");
500 if (strcmp(StdI->model,
"spin") == 0 ) {
503 else if (strcmp(StdI->model,
"hubbard") == 0) {
507 printf(
"wannier + Kondo is not available !\n");
510 fprintf(stdout,
"\n @ Numerical conditions\n\n");
515 StdI->nsite = StdI->NsiteUC * StdI->NCell;
516 StdI->locspinflag = (
int *)malloc(
sizeof(
int) * StdI->nsite);
518 if(strcmp(StdI->model,
"spin") == 0 )
519 for (isite = 0; isite < StdI->nsite; isite++) StdI->locspinflag[isite] = StdI->S2;
520 else if(strcmp(StdI->model,
"hubbard") == 0 )
521 for (isite = 0; isite < StdI->nsite; isite++) StdI->locspinflag[isite] = 0;
525 if (strcmp(StdI->model,
"spin") == 0 ) {
526 ntransMax = StdI->nsite * (StdI->S2 + 1 + 2 * StdI->S2);
527 nintrMax = StdI->NCell * (StdI->NsiteUC + NtUJ[0] + NtUJ[1] + NtUJ[2])
528 * (3 * StdI->S2 + 1) * (3 * StdI->S2 + StdI->NsiteUC);
530 else if (strcmp(StdI->model,
"hubbard") == 0) {
531 ntransMax = StdI->NCell * 2 * (2 * StdI->NsiteUC + NtUJ[0] * 2
532 + NtUJ[1] * 2 * 3 + NtUJ[2] * 2 * 2);
533 nintrMax = StdI->NCell * (NtUJ[1] + NtUJ[2] + StdI->NsiteUC);
540 if (strcmp(StdI->model,
"spin") == 0) {
541 Uspin = (
double *)malloc(
sizeof(
double) * StdI->NsiteUC);
542 for (it = 0; it < NtUJ[1]; it++)
543 if (tUJindx[1][it][0] == 0 && tUJindx[1][it][1] == 0 && tUJindx[1][it][2] == 0
544 && tUJindx[1][it][3] == tUJindx[1][it][4])
545 Uspin[tUJindx[1][it][3]] = real(tUJ[1][it]);
550 for (kCell = 0; kCell < StdI->NCell; kCell++){
552 iW = StdI->Cell[kCell][0];
553 iL = StdI->Cell[kCell][1];
554 iH = StdI->Cell[kCell][2];
558 if (strcmp(StdI->model,
"spin") == 0) {
559 for (isite = StdI->NsiteUC*kCell; isite < StdI->NsiteUC*(kCell + 1); isite++) {
564 for (isite = StdI->NsiteUC*kCell; isite < StdI->NsiteUC*(kCell + 1); isite++) {
571 for (it = 0; it < NtUJ[0]; it++) {
575 if (tUJindx[0][it][0] == 0 && tUJindx[0][it][1] == 0 && tUJindx[0][it][2] == 0
576 && tUJindx[0][it][3] == tUJindx[0][it][4])
578 if (strcmp(StdI->model,
"hubbard") == 0) {
579 isite = StdI->NsiteUC*kCell + tUJindx[0][it][3];
580 for (ispin = 0; ispin < 2; ispin++) {
581 StdI->trans[StdI->ntrans] = -tUJ[0][it];
582 StdI->transindx[StdI->ntrans][0] = isite;
583 StdI->transindx[StdI->ntrans][1] = ispin;
584 StdI->transindx[StdI->ntrans][2] = isite;
585 StdI->transindx[StdI->ntrans][3] = ispin;
586 StdI->ntrans = StdI->ntrans + 1;
595 tUJindx[0][it][0], tUJindx[0][it][1], tUJindx[0][it][2],
596 tUJindx[0][it][3], tUJindx[0][it][4], &isite, &jsite, &Cphase, dR);
597 if (strcmp(StdI->model,
"spin") == 0) {
598 for (ii = 0; ii < 3; ii++)
599 Jtmp[ii][ii] = 2.0 * real(tUJ[0][it] * conj(tUJ[0][it]))
600 * (1.0 / Uspin[tUJindx[0][it][3]] + 1.0 / Uspin[tUJindx[0][it][4]]);
611 for (it = 0; it < NtUJ[1]; it++) {
615 if (tUJindx[1][it][0] == 0 && tUJindx[1][it][1] == 0 && tUJindx[1][it][2] == 0
616 && tUJindx[1][it][3] == tUJindx[1][it][4])
618 StdI->Cintra[StdI->NCintra] = real(tUJ[1][it]);
619 StdI->CintraIndx[StdI->NCintra][0] = StdI->NsiteUC*kCell + tUJindx[1][it][3];
624 if (StdI->double_counting == 1) {
625 isite = StdI->NsiteUC*kCell + tUJindx[1][it][3];
626 for (ispin = 0; ispin < 2; ispin++) {
627 DenMat0 = DenMat[0][0][0][tUJindx[1][it][3]][tUJindx[1][it][3]];
628 StdI->trans[StdI->ntrans] = 0.5*real(tUJ[1][it])*DenMat0;
629 StdI->transindx[StdI->ntrans][0] = isite;
630 StdI->transindx[StdI->ntrans][1] = ispin;
631 StdI->transindx[StdI->ntrans][2] = isite;
632 StdI->transindx[StdI->ntrans][3] = ispin;
633 StdI->ntrans = StdI->ntrans + 1;
642 tUJindx[1][it][0], tUJindx[1][it][1], tUJindx[1][it][2],
643 tUJindx[1][it][3], tUJindx[1][it][4], &isite, &jsite, &Cphase, dR);
648 if (StdI->double_counting == 1) {
649 for (ispin = 0; ispin < 2; ispin++) {
653 DenMat0 = DenMat[0][0][0][tUJindx[1][it][4]][tUJindx[1][it][4]];
654 StdI->trans[StdI->ntrans] = real(tUJ[1][it])*DenMat0;
655 StdI->transindx[StdI->ntrans][0] = isite;
656 StdI->transindx[StdI->ntrans][1] = ispin;
657 StdI->transindx[StdI->ntrans][2] = isite;
658 StdI->transindx[StdI->ntrans][3] = ispin;
659 StdI->ntrans = StdI->ntrans + 1;
663 DenMat0 = DenMat[0][0][0][tUJindx[1][it][3]][tUJindx[1][it][3]];
664 StdI->trans[StdI->ntrans] = real(tUJ[1][it])*DenMat0;
665 StdI->transindx[StdI->ntrans][0] = jsite;
666 StdI->transindx[StdI->ntrans][1] = ispin;
667 StdI->transindx[StdI->ntrans][2] = jsite;
668 StdI->transindx[StdI->ntrans][3] = ispin;
669 StdI->ntrans = StdI->ntrans + 1;
674 DenMat0 = DenMat[tUJindx[1][it][0]][tUJindx[1][it][1]][tUJindx[1][it][2]]
675 [tUJindx[1][it][3]][tUJindx[1][it][4]];
676 StdFace_Hopping(StdI, -0.5*Cphase * real(tUJ[1][it])*DenMat0, jsite, isite, dR);
683 for (it = 0; it < NtUJ[2]; it++) {
687 if (tUJindx[2][it][0] != 0 || tUJindx[2][it][1] != 0 || tUJindx[2][it][2] != 0
688 || tUJindx[2][it][3] != tUJindx[2][it][4])
691 tUJindx[2][it][0], tUJindx[2][it][1], tUJindx[2][it][2],
692 tUJindx[2][it][3], tUJindx[2][it][4], &isite, &jsite, &Cphase, dR);
694 StdI->Hund[StdI->NHund] = real(tUJ[2][it]);
695 StdI->HundIndx[StdI->NHund][0] = isite;
696 StdI->HundIndx[StdI->NHund][1] = jsite;
699 if (strcmp(StdI->model,
"hubbard") == 0) {
700 StdI->Ex[StdI->NEx] = real(tUJ[2][it]);
701 StdI->ExIndx[StdI->NEx][0] = isite;
702 StdI->ExIndx[StdI->NEx][1] = jsite;
705 StdI->PairHopp[StdI->NPairHopp] = real(tUJ[2][it]);
706 StdI->PHIndx[StdI->NPairHopp][0] = isite;
707 StdI->PHIndx[StdI->NPairHopp][1] = jsite;
708 StdI->NPairHopp += 1;
712 if (StdI->double_counting == 1) {
713 for (ispin = 0; ispin < 2; ispin++) {
717 DenMat0 = DenMat[0][0][0][tUJindx[2][it][4]][tUJindx[2][it][4]];
718 StdI->trans[StdI->ntrans] = -0.5*real(tUJ[2][it]) *DenMat0;
719 StdI->transindx[StdI->ntrans][0] = isite;
720 StdI->transindx[StdI->ntrans][1] = ispin;
721 StdI->transindx[StdI->ntrans][2] = isite;
722 StdI->transindx[StdI->ntrans][3] = ispin;
723 StdI->ntrans = StdI->ntrans + 1;
727 DenMat0 = DenMat[0][0][0][tUJindx[2][it][3]][tUJindx[2][it][3]];
728 StdI->trans[StdI->ntrans] = -0.5*real(tUJ[2][it]) *DenMat0;
729 StdI->transindx[StdI->ntrans][0] = jsite;
730 StdI->transindx[StdI->ntrans][1] = ispin;
731 StdI->transindx[StdI->ntrans][2] = jsite;
732 StdI->transindx[StdI->ntrans][3] = ispin;
733 StdI->ntrans = StdI->ntrans + 1;
738 DenMat0 = DenMat[tUJindx[2][it][0]][tUJindx[2][it][1]][tUJindx[2][it][2]]
739 [tUJindx[2][it][3]][tUJindx[2][it][4]];
741 0.5*Cphase * real(tUJ[2][it])*(DenMat0 + 2.0*real(DenMat0)), jsite, isite, dR);
746 StdI->Ex[StdI->NEx] = real(tUJ[2][it]);
748 StdI->Ex[StdI->NEx] = -real(tUJ[2][it]);
750 StdI->ExIndx[StdI->NEx][0] = isite;
751 StdI->ExIndx[StdI->NEx][1] = jsite;
763 for (it = 0; it < NtUJ[0]; it++) free(tUJindx[0][it]);
766 for (it = 0; it < NtUJ[1]; it++) free(tUJindx[1][it]);
769 for (it = 0; it < NtUJ[2]; it++) free(tUJindx[2][it]);
772 if (strcmp(StdI->model,
"spin") == 0) free(Uspin);
static void read_W90(struct StdIntList *StdI, char *filename, double cutoff, int *cutoff_R, double cutoff_length, int itUJ, int *NtUJ, int ***tUJindx, std::complex< double > **tUJ)
Read Wannier90 hamiltonian file (*_hr)
void StdFace_Coulomb(struct StdIntList *StdI, double V, int isite, int jsite)
Add onsite/offsite Coulomb term to the list StdIntList::Cinter and StdIntList::CinterIndx, and increase the number of them (StdIntList::NCinter).
void StdFace_GeneralJ(struct StdIntList *StdI, double J[3][3], int Si2, int Sj2, int isite, int jsite)
Treat J as a 3*3 matrix [(6S + 1)*(6S' + 1) interactions].
void StdFace_PrintVal_d(const char *valname, double *val, double val0)
Print a valiable (real) read from the input file if it is not specified in the input file (=NaN)...
void StdFace_FindSite(struct StdIntList *StdI, int iW, int iL, int iH, int diW, int diL, int diH, int isiteUC, int jsiteUC, int *isite, int *jsite, std::complex< double > *Cphase, double *dR)
Find the index of transfer and interaction.
void StdFace_exit(int errorcode)
MPI Abortation wrapper.
static void geometry_W90(struct StdIntList *StdI)
Read Geometry file for wannier90.
void StdFace_Hopping(struct StdIntList *StdI, std::complex< double > trans0, int isite, int jsite, double *dR)
Add Hopping for the both spin.
void StdFace_HubbardLocal(struct StdIntList *StdI, double mu0, double h0, double Gamma0, double U0, int isite)
Add intra-Coulomb, magnetic field, chemical potential for the itenerant electron. ...
void StdFace_MagField(struct StdIntList *StdI, int S2, double h, double Gamma, int isite)
Add longitudinal and transvars magnetic field to the list.
void StdFace_PrintGeometry(struct StdIntList *StdI)
Print geometry of sites for the pos-process of correlation function.
void StdFace_PrintXSF(struct StdIntList *StdI)
Print lattice.xsf (XCrysDen format)
void StdFace_Wannier90(struct StdIntList *StdI)
Setup a Hamiltonian for the Wannier90 *_hr.dat.
void StdFace_MallocInteractions(struct StdIntList *StdI, int ntransMax, int nintrMax)
Malloc Arrays for interactions.
static void PrintUHFinitial(struct StdIntList *StdI, int *NtUJ, std::complex< double > *****DenMat, int ***tUJindx)
Print the initial guess of UHF.
void StdFace_PrintVal_i(const char *valname, int *val, int val0)
Print a valiable (integer) read from the input file if it is not specified in the input file (=214748...
void StdFace_InitSite(struct StdIntList *StdI, FILE *fp, int dim)
Initialize the super-cell where simulation is performed.
static std::complex< double > ***** read_density_matrix(struct StdIntList *StdI, char *filename)
Read RESPACK Density-matrix file (*_dr.dat)
void StdFace_NotUsed_d(const char *valname, double val)
Stop HPhi if a variable (real) not used is specified in the input file (!=NaN).