HΦ  3.1.0
Wannier90.c
Go to the documentation of this file.
1 /*
2 HPhi-mVMC-StdFace - Common input generator
3 Copyright (C) 2015 The University of Tokyo
4 
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
21 #include "StdFace_vals.h"
22 #include "StdFace_ModelUtil.h"
23 #include <stdlib.h>
24 #include <stdio.h>
25 #include <math.h>
26 #include <complex.h>
27 #include <string.h>
32 static void geometry_W90(
33  struct StdIntList *StdI
34 )
35 {
36  int isite, ii, ierr;
37  char filename[256];
38  FILE *fp;
39 
40  sprintf(filename, "%s_geom.dat", StdI->CDataFileHead);
41  fprintf(stdout, " Wannier90 Geometry file = %s\n", filename);
42 
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]);
54  free(StdI->tau);
55  ierr = fscanf(fp, "%d", &StdI->NsiteUC);
56  fprintf(stdout, " Number of Correlated Sites = %d\n", StdI->NsiteUC);
57 
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);
60 
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]);
63  fclose(fp);
64 
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]);
71 
72 }/*static void geometry_W90(struct StdIntList *StdI) */
77 static int read_W90_query(
78  struct StdIntList *StdI,
79  char *filename,
80  double cutoff
81 )
82 {
83  FILE *fp;
84  int nMat;
85  int ierr, nWan, nWSC, iWSC, jWSC, iWan, jWan, iWan0, jWan0, ii;
86  double dtmp[2];
87  char ctmp[256], *ctmp2;
88  double complex ***Mat_tot;
89  int **indx_tot;
90 
91  fprintf(stdout, " Wannier90 file = %s\n", filename);
92  /*
93  Header part
94  */
95  fp = fopen(filename, "r");
96  ctmp2 = fgets(ctmp, 256, fp);
97  ierr = fscanf(fp, "%d", &nWan);
98  if(ierr == EOF) printf("%d %s\n", ierr, ctmp2);
99  ierr = fscanf(fp, "%d", &nWSC);
100  for (iWSC = 0; iWSC < nWSC; iWSC++) {
101  ierr = fscanf(fp, "%d", &ii);
102  }
103  fprintf(stdout, " Number of Wannier = %d\n", nWan);
104  fprintf(stdout, " Number of Wigner-Seitz Cell = %d\n", nWSC);
105  /*
106  Allocation of matgrix element and its index
107  */
108  Mat_tot = (double complex ***)malloc(sizeof(double complex **) * nWSC);
109  indx_tot = (int **)malloc(sizeof(int*) * nWSC);
110  for (iWSC = 0; iWSC < nWSC; iWSC++) {
111  Mat_tot[iWSC] = (double complex **)malloc(sizeof(double complex *) * nWan);
112  indx_tot[iWSC] = (int *)malloc(sizeof(int) * 3);
113  for (iWan = 0; iWan < nWan; iWan++) {
114  Mat_tot[iWSC][iWan] = (double complex *)malloc(sizeof(double complex) * nWan);
115  }
116  }
117  /*
118  Read body
119  */
120  for (iWSC = 0; iWSC < nWSC; iWSC++) {
121  for (iWan = 0; iWan < nWan; iWan++) {
122  for (jWan = 0; jWan < nWan; jWan++) {
123  ierr = fscanf(fp, "%d%d%d%d%d%lf%lf",
124  &indx_tot[iWSC][0], &indx_tot[iWSC][1], &indx_tot[iWSC][2], &iWan0, &jWan0,
125  &dtmp[0], &dtmp[1]);
126  if(iWan0 <= StdI->NsiteUC && jWan0 <= StdI->NsiteUC)
127  Mat_tot[iWSC][iWan0 - 1][jWan0 - 1] = dtmp[0] + I * dtmp[1];
128  }
129  }
133  for (jWSC = 0; jWSC < iWSC; jWSC++) {
134  if (
135  indx_tot[iWSC][0] == -indx_tot[jWSC][0] &&
136  indx_tot[iWSC][1] == -indx_tot[jWSC][1] &&
137  indx_tot[iWSC][2] == -indx_tot[jWSC][2]
138  )
139  for (iWan = 0; iWan < StdI->NsiteUC; iWan++) {
140  for (jWan = 0; jWan < StdI->NsiteUC; jWan++) {
141  Mat_tot[iWSC][iWan][jWan] = 0.0;
142  }
143  }
144  }/*for (jWSC = 0; jWSC < iWSC; jWSC++)*/
145  if (indx_tot[iWSC][0] == 0 &&
146  indx_tot[iWSC][1] == 0 &&
147  indx_tot[iWSC][2] == 0)
148  for (iWan = 0; iWan < StdI->NsiteUC; iWan++) {
149  for (jWan = 0; jWan < iWan; jWan++) {
150  Mat_tot[iWSC][iWan][jWan] = 0.0;
151  }
152  }
153  }/*for (iWSC = 0; iWSC < nWSC; iWSC++)*/
154  fclose(fp);
158  fprintf(stdout, "\n EFFECTIVE terms:\n");
159  fprintf(stdout, " R0 R1 R2 band_i band_f Hamiltonian\n");
160  nMat = 0;
161  for (iWSC = 0; iWSC < nWSC; iWSC++) {
162  for (iWan = 0; iWan < StdI->NsiteUC; iWan++) {
163  for (jWan = 0; jWan < StdI->NsiteUC; jWan++) {
164  if (cutoff < cabs(Mat_tot[iWSC][iWan][jWan])) {
165  fprintf(stdout, " %5d%5d%5d%5d%5d%12.6f%12.6f\n",
166  indx_tot[iWSC][0], indx_tot[iWSC][1], indx_tot[iWSC][2], iWan, jWan,
167  creal(Mat_tot[iWSC][iWan][jWan]), cimag(Mat_tot[iWSC][iWan][jWan]));
168  nMat += 1;
169  }
170  }
171  }
172  }
173  fprintf(stdout, " Total number of EFFECTIVE term = %d\n", nMat);
174 
175  for (iWSC = 0; iWSC < nWSC; iWSC++) {
176  for (iWan = 0; iWan < nWan; iWan++) {
177  free(Mat_tot[iWSC][iWan]);
178  }
179  free(Mat_tot[iWSC]);
180  free(indx_tot[iWSC]);
181  }
182  free(Mat_tot);
183  free(indx_tot);
184 
185  return nMat;
186 }/*static int read_W90_query(struct StdIntList *StdI, char *model)*/
191 static void read_W90(
192  struct StdIntList *StdI,
193  char *filename,
194  double cutoff,
195  double complex *Mat,
196  int **Matindx
197 )
198 {
199  FILE *fp;
200  int nMat;
201  int ierr, nWan, nWSC, iWSC, jWSC, iWan, jWan, iWan0, jWan0, ii;
202  double dtmp[2];
203  char ctmp[256], *ctmp2;
204  double complex ***Mat_tot;
205  int **indx_tot;
206  /*
207  Header part
208  */
209  fp = fopen(filename, "r");
210  ctmp2 = fgets(ctmp, 256, fp);
211  ierr = fscanf(fp, "%d", &nWan);
212  if (ierr == EOF) printf("%d %s\n", ierr, ctmp2);
213  ierr = fscanf(fp, "%d", &nWSC);
214  for (iWSC = 0; iWSC < nWSC; iWSC++) {
215  ierr = fscanf(fp, "%d", &ii);
216  }
217  /*
218  Malloc Matrix elements and their indices
219  */
220  Mat_tot = (double complex ***)malloc(sizeof(double complex **) * nWSC);
221  indx_tot = (int **)malloc(sizeof(int*) * nWSC);
222  for (iWSC = 0; iWSC < nWSC; iWSC++) {
223  Mat_tot[iWSC] = (double complex **)malloc(sizeof(double complex *) * nWan);
224  indx_tot[iWSC] = (int *)malloc(sizeof(int) * 3);
225  for (iWan = 0; iWan < nWan; iWan++) {
226  Mat_tot[iWSC][iWan] = (double complex *)malloc(sizeof(double complex) * nWan);
227  }
228  }
229  /*
230  Read body
231  */
232  for (iWSC = 0; iWSC < nWSC; iWSC++) {
233  for (iWan = 0; iWan < nWan; iWan++) {
234  for (jWan = 0; jWan < nWan; jWan++) {
235  ierr = fscanf(fp, "%d%d%d%d%d%lf%lf",
236  &indx_tot[iWSC][0], &indx_tot[iWSC][1], &indx_tot[iWSC][2],
237  &iWan0, &jWan0,
238  &dtmp[0], &dtmp[1]);
239  if (iWan0 <= StdI->NsiteUC && jWan0 <= StdI->NsiteUC)
240  Mat_tot[iWSC][iWan0 - 1][jWan0 - 1] = dtmp[0] + I * dtmp[1];
241  }
242  }
246  for (jWSC = 0; jWSC < iWSC; jWSC++) {
247  if (
248  indx_tot[iWSC][0] == -indx_tot[jWSC][0] &&
249  indx_tot[iWSC][1] == -indx_tot[jWSC][1] &&
250  indx_tot[iWSC][2] == -indx_tot[jWSC][2]
251  )
252  for (iWan = 0; iWan < StdI->NsiteUC; iWan++) {
253  for (jWan = 0; jWan < StdI->NsiteUC; jWan++) {
254  Mat_tot[iWSC][iWan][jWan] = 0.0;
255  }
256  }
257  }/*for (jWSC = 0; jWSC < iWSC; jWSC++)*/
258  if (indx_tot[iWSC][0] == 0 &&
259  indx_tot[iWSC][1] == 0 &&
260  indx_tot[iWSC][2] == 0)
261  for (iWan = 0; iWan < StdI->NsiteUC; iWan++) {
262  for (jWan = 0; jWan < iWan; jWan++) {
263  Mat_tot[iWSC][iWan][jWan] = 0.0;
264  }
265  }
266  }/*for (iWSC = 0; iWSC < nWSC; iWSC++)*/
267  fclose(fp);
272  nMat = 0;
273  for (iWSC = 0; iWSC < nWSC; iWSC++) {
274  for (iWan = 0; iWan < StdI->NsiteUC; iWan++) {
275  for (jWan = 0; jWan < StdI->NsiteUC; jWan++) {
276  if (cutoff < cabs(Mat_tot[iWSC][iWan][jWan])) {
277  for (ii = 0; ii < 3; ii++) Matindx[nMat][ii] = indx_tot[iWSC][ii];
278  Matindx[nMat][3] = iWan;
279  Matindx[nMat][4] = jWan;
280  Mat[nMat] = Mat_tot[iWSC][iWan][jWan];
281  nMat += 1;
282  }
283  }/*for (jWan = 0; jWan < StdI->NsiteUC; jWan++)*/
284  }/*for (iWan = 0; iWan < StdI->NsiteUC; iWan++)*/
285  }/*for (iWSC = 0; iWSC < nWSC; iWSC++)*/
286 
287  for (iWSC = 0; iWSC < nWSC; iWSC++) {
288  for (iWan = 0; iWan < nWan; iWan++) {
289  free(Mat_tot[iWSC][iWan]);
290  }
291  free(Mat_tot[iWSC]);
292  free(indx_tot[iWSC]);
293  }
294  free(Mat_tot);
295  free(indx_tot);
296 }/*static int read_W90(struct StdIntList *StdI, char *model)*/
301  struct StdIntList *StdI
302 )
303 {
304  int isite, jsite, ispin, ntransMax, nintrMax;
305  int iL, iW, iH, kCell, it, ii;
306  double Jtmp[3][3] = { {0.0} };
307  FILE *fp;
308  double complex Cphase;
309  double dR[3], *Uspin;
310  int n_t, n_u, n_j;
311  double complex *W90_t, *W90_j, *W90_u;
312  int **t_indx, **u_indx, **j_indx;
313  char filename[256];
314 
315  fprintf(stdout, "\n @ Wannier90 Geometry \n\n");
316  geometry_W90(StdI);
317 
321  fp = fopen("lattice.xsf", "w");
322 
323  StdFace_PrintVal_d("phase0", &StdI->phase[0], 0.0);
324  StdFace_PrintVal_d("phase1", &StdI->phase[1], 0.0);
325  StdFace_PrintVal_d("phase2", &StdI->phase[2], 0.0);
326  StdFace_InitSite(StdI, fp, 3);
327  /*
328  Read Hopping
329  */
330  fprintf(stdout, "\n @ Wannier90 hopping \n\n");
331  StdFace_PrintVal_d("cutoff_t", &StdI->cutoff_t, 1.0e-8);
332  sprintf(filename, "%s_hr.dat", StdI->CDataFileHead);
333  n_t = read_W90_query(StdI, filename, StdI->cutoff_t);
334  W90_t = (double complex *)malloc(sizeof(double complex) * n_t);
335  t_indx = (int **)malloc(sizeof(int*) * n_t);
336  for (ii = 0; ii < n_t; ii++) t_indx[ii] = (int *)malloc(sizeof(int) * 5);
337  read_W90(StdI, filename, StdI->cutoff_t, W90_t, t_indx);
338  /*
339  Read Coulomb
340  */
341  fprintf(stdout, "\n @ Wannier90 Coulomb \n\n");
342  StdFace_PrintVal_d("cutoff_u", &StdI->cutoff_u, 1.0e-8);
343  sprintf(filename, "%s_ur.dat", StdI->CDataFileHead);
344  n_u = read_W90_query(StdI, filename, StdI->cutoff_u);
345  W90_u = (double complex *)malloc(sizeof(double complex) * n_u);
346  u_indx = (int **)malloc(sizeof(int*) * n_u);
347  for (ii = 0; ii < n_u; ii++) u_indx[ii] = (int *)malloc(sizeof(int) * 5);
348  read_W90(StdI, filename, StdI->cutoff_u, W90_u, u_indx);
349  /*
350  Read Hund
351  */
352  fprintf(stdout, "\n @ Wannier90 Hund \n\n");
353  StdFace_PrintVal_d("cutoff_j", &StdI->cutoff_j, 1.0e-8);
354  sprintf(filename, "%s_jr.dat", StdI->CDataFileHead);
355  n_j = read_W90_query(StdI, filename, StdI->cutoff_j);
356  W90_j = (double complex *)malloc(sizeof(double complex) * n_j);
357  j_indx = (int **)malloc(sizeof(int*) * n_j);
358  for (ii = 0; ii < n_j; ii++) j_indx[ii] = (int *)malloc(sizeof(int) * 5);
359  read_W90(StdI, filename, StdI->cutoff_j, W90_j, j_indx);
363  fprintf(stdout, "\n @ Hamiltonian \n\n");
364  StdFace_NotUsed_d("K", StdI->K);
365  StdFace_PrintVal_d("h", &StdI->h, 0.0);
366  StdFace_PrintVal_d("Gamma", &StdI->Gamma, 0.0);
367  StdFace_NotUsed_d("U", StdI->U);
368 
369  if (strcmp(StdI->model, "spin") == 0 ) {
370  StdFace_PrintVal_i("2S", &StdI->S2, 1);
371  }/*if (strcmp(StdI->model, "spin") == 0 )*/
372  else if (strcmp(StdI->model, "hubbard") == 0) {
373  StdFace_PrintVal_d("mu", &StdI->mu, 0.0);
374  }
375  else{
376  printf("wannier + Kondo is not available !\n");
377  StdFace_exit(-1);
378  }/*if (model != "spin")*/
379  fprintf(stdout, "\n @ Numerical conditions\n\n");
384  StdI->nsite = StdI->NsiteUC * StdI->NCell;
385  StdI->locspinflag = (int *)malloc(sizeof(int) * StdI->nsite);
386 
387  if(strcmp(StdI->model, "spin") == 0 )
388  for (isite = 0; isite < StdI->nsite; isite++) StdI->locspinflag[isite] = StdI->S2;
389  else if(strcmp(StdI->model, "hubbard") == 0 )
390  for (isite = 0; isite < StdI->nsite; isite++) StdI->locspinflag[isite] = 0;
394  if (strcmp(StdI->model, "spin") == 0 ) {
395  ntransMax = StdI->nsite * (StdI->S2 + 1/*h*/ + 2 * StdI->S2/*Gamma*/);
396  nintrMax = StdI->NCell * (StdI->NsiteUC/*D*/ + n_t/*J*/ + n_u + n_j)
397  * (3 * StdI->S2 + 1) * (3 * StdI->S2 + 1);
398  }
399  else if (strcmp(StdI->model, "hubbard") == 0) {
400  ntransMax = StdI->NCell * 2/*spin*/ * (2 * StdI->NsiteUC/*mu+h+Gamma*/ + n_t * 2/*t*/);
401  nintrMax = StdI->NCell * (n_u + n_j + 1);
402  }
403 
404  StdFace_MallocInteractions(StdI, ntransMax, nintrMax);
408  if (strcmp(StdI->model, "spin") == 0) {
409  Uspin = (double *)malloc(sizeof(double) * StdI->NsiteUC);
410  for (it = 0; it < n_u; it++)
411  if (u_indx[it][0] == 0 && u_indx[it][1] == 0 && u_indx[it][2] == 0
412  && u_indx[it][3] == u_indx[it][4])
413  Uspin[u_indx[it][3]] = creal(W90_u[it]);
414  }/*if (strcmp(StdI->model, "spin") == 0)*/
418  for (kCell = 0; kCell < StdI->NCell; kCell++){
419 
420  iW = StdI->Cell[kCell][0];
421  iL = StdI->Cell[kCell][1];
422  iH = StdI->Cell[kCell][2];
423  /*
424  Local term 1
425  */
426  if (strcmp(StdI->model, "spin") == 0) {
427  for (isite = StdI->NsiteUC*kCell; isite < StdI->NsiteUC*(kCell + 1); isite++) {
428  StdFace_MagField(StdI, StdI->S2, -StdI->h, -StdI->Gamma, isite);
429  }
430  }/*if (strcmp(StdI->model, "spin") == 0 )*/
431  else {
432  for (isite = StdI->NsiteUC*kCell; isite < StdI->NsiteUC*(kCell + 1); isite++) {
433  StdFace_HubbardLocal(StdI, StdI->mu, -StdI->h, -StdI->Gamma, 0.0, isite);
434  }
435  }/*if (strcmp(StdI->model, "spin") != 0 )*/
436  /*
437  Hopping
438  */
439  for (it = 0; it < n_t; it++) {
440  /*
441  Local term
442  */
443  if (t_indx[it][0] == 0 && t_indx[it][1] == 0 && t_indx[it][2] == 0
444  && t_indx[it][3] == t_indx[it][4])
445  {
446  if (strcmp(StdI->model, "hubbard") == 0) {
447  isite = StdI->NsiteUC*kCell + t_indx[it][3];
448  for (ispin = 0; ispin < 2; ispin++) {
449  StdI->trans[StdI->ntrans] = -W90_t[it];
450  StdI->transindx[StdI->ntrans][0] = isite;
451  StdI->transindx[StdI->ntrans][1] = ispin;
452  StdI->transindx[StdI->ntrans][2] = isite;
453  StdI->transindx[StdI->ntrans][3] = ispin;
454  StdI->ntrans = StdI->ntrans + 1;
455  }/*for (ispin = 0; ispin < 2; ispin++)*/
456  }/*if (strcmp(StdI->model, "hubbrad") == 0 )*/
457  }/*Local term*/
458  else {
459  /*
460  Non-local term
461  */
462  StdFace_FindSite(StdI, iW, iL, iH,
463  t_indx[it][0], t_indx[it][1], t_indx[it][2],
464  t_indx[it][3], t_indx[it][4], &isite, &jsite, &Cphase, dR);
465  if (strcmp(StdI->model, "spin") == 0) {
466  for (ii = 0; ii < 3; ii++)
467  Jtmp[ii][ii] = 2.0 * W90_t[it] * conj(W90_t[it])
468  * (1.0 / Uspin[t_indx[it][3]] + 1.0 / Uspin[t_indx[it][4]]);
469  StdFace_GeneralJ(StdI, Jtmp, StdI->S2, StdI->S2, isite, jsite);
470  }/*if (strcmp(StdI->model, "spin") == 0 )*/
471  else {
472  StdFace_Hopping(StdI, - Cphase * W90_t[it], isite, jsite, dR);
473  }
474  }/*Non-local term*/
475  }/*for (it = 0; it < n_t; it++)*/
476  /*
477  Coulomb integral (U)
478  */
479  for (it = 0; it < n_u; it++) {
480  /*
481  Local term
482  */
483  if (u_indx[it][0] == 0 && u_indx[it][1] == 0 && u_indx[it][2] == 0
484  && u_indx[it][3] == u_indx[it][4])
485  {
486  StdI->Cintra[StdI->NCintra] = creal(W90_u[it]);
487  StdI->CintraIndx[StdI->NCintra][0] = StdI->NsiteUC*kCell + u_indx[it][3];
488  StdI->NCintra += 1;
489  }/*Local term*/
490  else {
491  /*
492  Non-local term
493  */
494  StdFace_FindSite(StdI, iW, iL, iH,
495  u_indx[it][0], u_indx[it][1], u_indx[it][2],
496  u_indx[it][3], u_indx[it][4], &isite, &jsite, &Cphase, dR);
497  StdFace_Coulomb(StdI, creal(W90_u[it]), isite, jsite);
498  }/*Non-local term*/
499  }/*for (it = 0; it < n_t; it++)*/
500  /*
501  Hund coupling (J)
502  */
503  for (it = 0; it < n_j; it++) {
504  /*
505  Local term should not be computed
506  */
507  if (j_indx[it][0] != 0 || j_indx[it][1] != 0 || j_indx[it][2] != 0
508  || j_indx[it][3] != j_indx[it][4])
509  {
510  StdFace_FindSite(StdI, iW, iL, iH,
511  j_indx[it][0], j_indx[it][1], j_indx[it][2],
512  j_indx[it][3], j_indx[it][4], &isite, &jsite, &Cphase, dR);
513 
514  StdI->Hund[StdI->NHund] = creal(W90_j[it]);
515  StdI->HundIndx[StdI->NHund][0] = isite;
516  StdI->HundIndx[StdI->NHund][1] = jsite;
517  StdI->NHund += 1;
518 
519  if (strcmp(StdI->model, "hubbard") == 0) {
520  StdI->Ex[StdI->NEx] = creal(W90_j[it]);
521  StdI->ExIndx[StdI->NEx][0] = isite;
522  StdI->ExIndx[StdI->NEx][1] = jsite;
523  StdI->NEx += 1;
524 
525  StdI->PairHopp[StdI->NPairHopp] = creal(W90_j[it]);
526  StdI->PHIndx[StdI->NPairHopp][0] = isite;
527  StdI->PHIndx[StdI->NPairHopp][1] = jsite;
528  StdI->NPairHopp += 1;
529  }
530  else {
531 #if defined(_mVMC)
532  StdI->Ex[StdI->NEx] = creal(W90_j[it]);
533 #else
534  StdI->Ex[StdI->NEx] = -creal(W90_j[it]);
535 #endif
536  StdI->ExIndx[StdI->NEx][0] = isite;
537  StdI->ExIndx[StdI->NEx][1] = jsite;
538  StdI->NEx += 1;
539  }
540  }/*Non-local term*/
541  }/*for (it = 0; it < n_t; it++)*/
542  }/*for (kCell = 0; kCell < StdI->NCell; kCell++)*/
543 
544  fclose(fp);
545  StdFace_PrintXSF(StdI);
546  StdFace_PrintGeometry(StdI);
547 
548  for (it = 0; it < n_t; it++) free(t_indx[it]);
549  free(t_indx);
550  free(W90_t);
551  for (it = 0; it < n_u; it++) free(u_indx[it]);
552  free(u_indx);
553  free(W90_u);
554  for (it = 0; it < n_j; it++) free(j_indx[it]);
555  free(j_indx);
556  free(W90_j);
557  if (strcmp(StdI->model, "spin") == 0) free(Uspin);
558 
559 }/*void StdFace_Wannier90*/
void StdFace_PrintVal_i(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...
int NPairHopp
Number of pair-hopping term, counted in each lattice file.
Definition: StdFace_vals.h:200
static int read_W90_query(struct StdIntList *StdI, char *filename, double cutoff)
Read Wannier90 hamiltonian file (*_hr) and compute the number of effective term.
Definition: Wannier90.c:77
int NHund
Number of Hund term, counted in each lattice file.
Definition: StdFace_vals.h:176
double cutoff_t
Cutoof for the hopping in wannier90, input from file.
Definition: StdFace_vals.h:225
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&#39; + 1) interactions].
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_PrintGeometry(struct StdIntList *StdI)
Print geometry of sites for the pos-process of correlation function.
double * Ex
[StdIntList::NEx] Coefficient of exchange term, malloc in StdFace_MallocInteractions() and set in Std...
Definition: StdFace_vals.h:189
double complex * trans
[StdIntList::ntrans] Coefficient of one-body term, malloc in StdFace_MallocInteractions() and set in ...
Definition: StdFace_vals.h:147
void StdFace_Hopping(struct StdIntList *StdI, double complex trans0, int isite, int jsite, double *dR)
Add Hopping for the both spin.
void StdFace_MallocInteractions(struct StdIntList *StdI, int ntransMax, int nintrMax)
Malloc Arrays for interactions.
int S2
Total spin |S| of a local spin, input from file.
Definition: StdFace_vals.h:215
int ** ExIndx
[StdIntList::NEx][2] Site indices of exchange term, malloc in StdFace_MallocInteractions() and set in...
Definition: StdFace_vals.h:186
double cutoff_j
Cutoof for the Hund in wannier90, input from file.
Definition: StdFace_vals.h:227
int NsiteUC
Number of sites in the unit cell. Defined in the beginning of each lattice function.
Definition: StdFace_vals.h:53
void StdFace_InitSite(struct StdIntList *StdI, FILE *fp, int dim)
Initialize the super-cell where simulation is performed.
int ntrans
Number of transfer, counted in each lattice file.
Definition: StdFace_vals.h:143
char model[256]
Name of model, input parameter.
Definition: StdFace_vals.h:60
int ** CintraIndx
[StdIntList::NCintra][1] Site indices of intra-site Coulomb term, malloc in StdFace_MallocInteraction...
Definition: StdFace_vals.h:161
double Gamma
Transvars magnetic field, input parameter.
Definition: StdFace_vals.h:127
int NCintra
Number of intra-site Coulomb interaction, counted in each lattice file.
Definition: StdFace_vals.h:158
double U
On-site Coulomb potential, input parameter.
Definition: StdFace_vals.h:71
double * Hund
[StdIntList::NHund] Coefficient of Hund term, malloc in StdFace_MallocInteractions() and set in StdFa...
Definition: StdFace_vals.h:181
int ** Cell
[StdIntList][3] The cell position in the fractional coordinate. Malloc and Set in StdFace_InitSite()...
Definition: StdFace_vals.h:51
double phase[3]
Boundary phase, input parameter phase0, etc.
Definition: StdFace_vals.h:133
int * locspinflag
[StdIntList::nsite] LocSpin in Expert mode, malloc and set in each lattice file.
Definition: StdFace_vals.h:141
static void read_W90(struct StdIntList *StdI, char *filename, double cutoff, double complex *Mat, int **Matindx)
Read Wannier90 hamiltonian file (*_hr)
Definition: Wannier90.c:191
int ** HundIndx
[StdIntList::NHund][2] Site indices of Hund term, malloc in StdFace_MallocInteractions() and set in S...
Definition: StdFace_vals.h:178
static void geometry_W90(struct StdIntList *StdI)
Read Geometry file for wannier90.
Definition: Wannier90.c:32
double direct[3][3]
The unit direct lattice vector. Set in StdFace_InitSite().
Definition: StdFace_vals.h:42
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_NotUsed_d(char *valname, double val)
Stop HPhi if a variable (real) not used is specified in the input file (!=NaN).
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).
int NEx
Number of exchange term, counted in each lattice file.
Definition: StdFace_vals.h:184
double mu
Chemical potential, input parameter.
Definition: StdFace_vals.h:61
void StdFace_PrintVal_d(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)...
int NCell
The number of the unit cell in the super-cell (determinant of StdIntList::box). Set in StdFace_InitSi...
Definition: StdFace_vals.h:49
double * PairHopp
[StdIntList::NPairLift] Coefficient of pair-hopping term, malloc in StdFace_MallocInteractions() and ...
Definition: StdFace_vals.h:205
int nsite
Number of sites, set in the each lattice file.
Definition: StdFace_vals.h:140
int ** transindx
[StdIntList::ntrans][4] Site/spin indices of one-body term, malloc in StdFace_MallocInteractions() an...
Definition: StdFace_vals.h:144
Variables used in the Standard mode. These variables are passed as a pointer of the structure(StdIntL...
double * Cintra
[StdIntList::NCintra] Coefficient of intra-site Coulomb term, malloc in StdFace_MallocInteractions() ...
Definition: StdFace_vals.h:164
void StdFace_PrintXSF(struct StdIntList *StdI)
Print lattice.xsf (XCrysDen format)
double h
Longitudinal magnetic field, input parameter.
Definition: StdFace_vals.h:126
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, double complex *Cphase, double *dR)
Find the index of transfer and interaction.
int ** PHIndx
[StdIntList::NPairLift][2] Site indices of pair-hopping term, malloc in StdFace_MallocInteractions() ...
Definition: StdFace_vals.h:202
void StdFace_Wannier90(struct StdIntList *StdI)
Setup a Hamiltonian for the Wannier90 *_hr.dat.
Definition: Wannier90.c:300
double ** tau
Cell-internal site position in the fractional coordinate. Defined in the beginning of each lattice fu...
Definition: StdFace_vals.h:55
void StdFace_exit(int errorcode)
MPI Abortation wrapper.
char CDataFileHead[256]
Header of the output files. Input from file.
Definition: StdFace_vals.h:218
double cutoff_u
Cutoof for the Coulomb in wannier90, input from file.
Definition: StdFace_vals.h:226
double K
4-spin term. Not used.
Definition: StdFace_vals.h:128