HΦ  3.2.0
Wannier90.c File Reference

Standard mode for wannier90. More...

#include "StdFace_vals.h"
#include "StdFace_ModelUtil.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <complex.h>
#include <string.h>
+ Include dependency graph for Wannier90.c:

Go to the source code of this file.

Functions

static void geometry_W90 (struct StdIntList *StdI)
 Read Geometry file for wannier90. More...
 
static int read_W90_query (struct StdIntList *StdI, char *filename, double cutoff, int *cutoff_R, double cutoff_length)
 Read Wannier90 hamiltonian file (*_hr) and compute the number of effective term. More...
 
static void read_W90 (struct StdIntList *StdI, char *filename, double cutoff, int *cutoff_R, double cutoff_length, double complex *Mat, int **Matindx)
 Read Wannier90 hamiltonian file (*_hr) More...
 
void StdFace_Wannier90 (struct StdIntList *StdI)
 Setup a Hamiltonian for the Wannier90 *_hr.dat. More...
 

Detailed Description

Standard mode for wannier90.

Definition in file Wannier90.c.

Function Documentation

◆ geometry_W90()

static void geometry_W90 ( struct StdIntList StdI)
static

Read Geometry file for wannier90.

Author
Mitsuaki Kawamura (The University of Tokyo)

Direct lattice vector StdIntList::direct

Intrinsic site position StdIntList::tau and its number StdIntList::NsiteUC

Parameters
[in,out]StdI

Definition at line 32 of file Wannier90.c.

References StdIntList::CDataFileHead, StdIntList::direct, StdIntList::NsiteUC, and StdIntList::tau.

Referenced by StdFace_Wannier90().

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) */
int NsiteUC
Number of sites in the unit cell. Defined in the beginning of each lattice function.
Definition: StdFace_vals.h:53
double direct[3][3]
The unit direct lattice vector. Set in StdFace_InitSite().
Definition: StdFace_vals.h:42
double ** tau
Cell-internal site position in the fractional coordinate. Defined in the beginning of each lattice fu...
Definition: StdFace_vals.h:55
char CDataFileHead[256]
Header of the output files. Input from file.
Definition: StdFace_vals.h:239
+ Here is the caller graph for this function:

◆ read_W90()

static void read_W90 ( struct StdIntList StdI,
char *  filename,
double  cutoff,
int *  cutoff_R,
double  cutoff_length,
double complex *  Mat,
int **  Matindx 
)
static

Read Wannier90 hamiltonian file (*_hr)

Author
Mitsuaki Kawamura (The University of Tokyo)

(1) Apply inversion symmetry and delete duplication

Then Store to the hopping Integeral and its site index.

Parameters
[in,out]StdI
[in]filenameInput file name
[in]cutoffThreshold for the Hamiltonian
[out]MatMatrix element
[out]MatindxR, band index of matrix element

Definition at line 212 of file Wannier90.c.

References StdIntList::direct, StdIntList::NsiteUC, and StdIntList::tau.

Referenced by StdFace_Wannier90().

221 {
222  FILE *fp;
223  int nMat;
224  int ierr, nWan, nWSC, iWSC, jWSC, iWan, jWan, iWan0, jWan0, ii, jj;
225  double dtmp[2], dR[3], length;
226  char ctmp[256], *ctmp2;
227  double complex ***Mat_tot;
228  int **indx_tot;
229  /*
230  Header part
231  */
232  fp = fopen(filename, "r");
233  ctmp2 = fgets(ctmp, 256, fp);
234  ierr = fscanf(fp, "%d", &nWan);
235  if (ierr == EOF) printf("%d %s\n", ierr, ctmp2);
236  ierr = fscanf(fp, "%d", &nWSC);
237  for (iWSC = 0; iWSC < nWSC; iWSC++) {
238  ierr = fscanf(fp, "%d", &ii);
239  }
240  /*
241  Malloc Matrix elements and their indices
242  */
243  Mat_tot = (double complex ***)malloc(sizeof(double complex **) * nWSC);
244  indx_tot = (int **)malloc(sizeof(int*) * nWSC);
245  for (iWSC = 0; iWSC < nWSC; iWSC++) {
246  Mat_tot[iWSC] = (double complex **)malloc(sizeof(double complex *) * nWan);
247  indx_tot[iWSC] = (int *)malloc(sizeof(int) * 3);
248  for (iWan = 0; iWan < nWan; iWan++) {
249  Mat_tot[iWSC][iWan] = (double complex *)malloc(sizeof(double complex) * nWan);
250  }
251  }
252  /*
253  Read body
254  */
255  for (iWSC = 0; iWSC < nWSC; iWSC++) {
256  for (iWan = 0; iWan < nWan; iWan++) {
257  for (jWan = 0; jWan < nWan; jWan++) {
258  ierr = fscanf(fp, "%d%d%d%d%d%lf%lf",
259  &indx_tot[iWSC][0], &indx_tot[iWSC][1], &indx_tot[iWSC][2],
260  &iWan0, &jWan0,
261  &dtmp[0], &dtmp[1]);
262  /*
263  Compute Euclid length
264  */
265  for (ii = 0; ii < 3; ii++) {
266  dR[ii] = 0.0;
267  for (jj = 0; jj < 3; jj++)
268  dR[ii] += StdI->direct[jj][ii] * (StdI->tau[jWan][jj] - StdI->tau[iWan][jj] + indx_tot[iWSC][jj]);
269  }
270  length = sqrt(dR[0] * dR[0] + dR[1] * dR[1] + dR[2] * dR[2]);
271  if (length > cutoff_length && cutoff_length > 0.0) {
272  dtmp[0] = 0.0;
273  dtmp[1] = 0.0;
274  }
275  if (abs(indx_tot[iWSC][0]) > cutoff_R[0] ||
276  abs(indx_tot[iWSC][1]) > cutoff_R[1] ||
277  abs(indx_tot[iWSC][2]) > cutoff_R[2]) {
278  dtmp[0] = 0.0;
279  dtmp[1] = 0.0;
280  }
281  if (iWan0 <= StdI->NsiteUC && jWan0 <= StdI->NsiteUC)
282  Mat_tot[iWSC][iWan0 - 1][jWan0 - 1] = dtmp[0] + I * dtmp[1];
283  }
284  }
288  for (jWSC = 0; jWSC < iWSC; jWSC++) {
289  if (
290  indx_tot[iWSC][0] == -indx_tot[jWSC][0] &&
291  indx_tot[iWSC][1] == -indx_tot[jWSC][1] &&
292  indx_tot[iWSC][2] == -indx_tot[jWSC][2]
293  )
294  for (iWan = 0; iWan < StdI->NsiteUC; iWan++) {
295  for (jWan = 0; jWan < StdI->NsiteUC; jWan++) {
296  Mat_tot[iWSC][iWan][jWan] = 0.0;
297  }
298  }
299  }/*for (jWSC = 0; jWSC < iWSC; jWSC++)*/
300  if (indx_tot[iWSC][0] == 0 &&
301  indx_tot[iWSC][1] == 0 &&
302  indx_tot[iWSC][2] == 0)
303  for (iWan = 0; iWan < StdI->NsiteUC; iWan++) {
304  for (jWan = 0; jWan < iWan; jWan++) {
305  Mat_tot[iWSC][iWan][jWan] = 0.0;
306  }
307  }
308  }/*for (iWSC = 0; iWSC < nWSC; iWSC++)*/
309  fclose(fp);
314  nMat = 0;
315  for (iWSC = 0; iWSC < nWSC; iWSC++) {
316  for (iWan = 0; iWan < StdI->NsiteUC; iWan++) {
317  for (jWan = 0; jWan < StdI->NsiteUC; jWan++) {
318  if (cutoff < cabs(Mat_tot[iWSC][iWan][jWan])) {
319  for (ii = 0; ii < 3; ii++) Matindx[nMat][ii] = indx_tot[iWSC][ii];
320  Matindx[nMat][3] = iWan;
321  Matindx[nMat][4] = jWan;
322  Mat[nMat] = Mat_tot[iWSC][iWan][jWan];
323  nMat += 1;
324  }
325  }/*for (jWan = 0; jWan < StdI->NsiteUC; jWan++)*/
326  }/*for (iWan = 0; iWan < StdI->NsiteUC; iWan++)*/
327  }/*for (iWSC = 0; iWSC < nWSC; iWSC++)*/
328 
329  for (iWSC = 0; iWSC < nWSC; iWSC++) {
330  for (iWan = 0; iWan < nWan; iWan++) {
331  free(Mat_tot[iWSC][iWan]);
332  }
333  free(Mat_tot[iWSC]);
334  free(indx_tot[iWSC]);
335  }
336  free(Mat_tot);
337  free(indx_tot);
338 }/*static int read_W90(struct StdIntList *StdI, char *model)*/
int NsiteUC
Number of sites in the unit cell. Defined in the beginning of each lattice function.
Definition: StdFace_vals.h:53
double length[3]
Anisotropic lattice constant, input parameter wlength, llength, hlength.
Definition: StdFace_vals.h:37
double direct[3][3]
The unit direct lattice vector. Set in StdFace_InitSite().
Definition: StdFace_vals.h:42
double ** tau
Cell-internal site position in the fractional coordinate. Defined in the beginning of each lattice fu...
Definition: StdFace_vals.h:55
+ Here is the caller graph for this function:

◆ read_W90_query()

static int read_W90_query ( struct StdIntList StdI,
char *  filename,
double  cutoff,
int *  cutoff_R,
double  cutoff_length 
)
static

Read Wannier90 hamiltonian file (*_hr) and compute the number of effective term.

Author
Mitsuaki Kawamura (The University of Tokyo)

(1) Apply inversion symmetry and delete duplication

(3-1) Compute the number of terms lerger than cut-off.

Parameters
[in,out]StdI
[in]filenameInput file name
[in]cutoffThreshold for the Hamiltonian

Definition at line 77 of file Wannier90.c.

References StdIntList::direct, StdIntList::NsiteUC, and StdIntList::tau.

Referenced by StdFace_Wannier90().

84 {
85  FILE *fp;
86  int nMat;
87  int ierr, nWan, nWSC, iWSC, jWSC, iWan, jWan, iWan0, jWan0, ii, jj;
88  double dtmp[2], dR[3], length;
89  char ctmp[256], *ctmp2;
90  double complex ***Mat_tot;
91  int **indx_tot;
92 
93  fprintf(stdout, " Wannier90 file = %s\n", filename);
94  /*
95  Header part
96  */
97  fp = fopen(filename, "r");
98  ctmp2 = fgets(ctmp, 256, fp);
99  ierr = fscanf(fp, "%d", &nWan);
100  if(ierr == EOF) printf("%d %s\n", ierr, ctmp2);
101  ierr = fscanf(fp, "%d", &nWSC);
102  for (iWSC = 0; iWSC < nWSC; iWSC++) {
103  ierr = fscanf(fp, "%d", &ii);
104  }
105  fprintf(stdout, " Number of Wannier = %d\n", nWan);
106  fprintf(stdout, " Number of Wigner-Seitz Cell = %d\n", nWSC);
107  /*
108  Allocation of matgrix element and its index
109  */
110  Mat_tot = (double complex ***)malloc(sizeof(double complex **) * nWSC);
111  indx_tot = (int **)malloc(sizeof(int*) * nWSC);
112  for (iWSC = 0; iWSC < nWSC; iWSC++) {
113  Mat_tot[iWSC] = (double complex **)malloc(sizeof(double complex *) * nWan);
114  indx_tot[iWSC] = (int *)malloc(sizeof(int) * 3);
115  for (iWan = 0; iWan < nWan; iWan++) {
116  Mat_tot[iWSC][iWan] = (double complex *)malloc(sizeof(double complex) * nWan);
117  }
118  }
119  /*
120  Read body
121  */
122  for (iWSC = 0; iWSC < nWSC; iWSC++) {
123  for (iWan = 0; iWan < nWan; iWan++) {
124  for (jWan = 0; jWan < nWan; jWan++) {
125  ierr = fscanf(fp, "%d%d%d%d%d%lf%lf",
126  &indx_tot[iWSC][0], &indx_tot[iWSC][1], &indx_tot[iWSC][2], &iWan0, &jWan0,
127  &dtmp[0], &dtmp[1]);
128  /*
129  Compute Euclid length
130  */
131  for (ii = 0; ii < 3; ii++) {
132  dR[ii] = 0.0;
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]);
135  }
136  length = sqrt(dR[0] * dR[0] + dR[1] * dR[1] + dR[2] * dR[2]);
137  if (length > cutoff_length && cutoff_length > 0.0) {
138  dtmp[0] = 0.0;
139  dtmp[1] = 0.0;
140  }
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]) {
144  dtmp[0] = 0.0;
145  dtmp[1] = 0.0;
146  }
147  if(iWan0 <= StdI->NsiteUC && jWan0 <= StdI->NsiteUC)
148  Mat_tot[iWSC][iWan0 - 1][jWan0 - 1] = dtmp[0] + I * dtmp[1];
149  }
150  }
154  for (jWSC = 0; jWSC < iWSC; jWSC++) {
155  if (
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]
159  )
160  for (iWan = 0; iWan < StdI->NsiteUC; iWan++) {
161  for (jWan = 0; jWan < StdI->NsiteUC; jWan++) {
162  Mat_tot[iWSC][iWan][jWan] = 0.0;
163  }
164  }
165  }/*for (jWSC = 0; jWSC < iWSC; jWSC++)*/
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;
172  }
173  }
174  }/*for (iWSC = 0; iWSC < nWSC; iWSC++)*/
175  fclose(fp);
179  fprintf(stdout, "\n EFFECTIVE terms:\n");
180  fprintf(stdout, " R0 R1 R2 band_i band_f Hamiltonian\n");
181  nMat = 0;
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 < cabs(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  creal(Mat_tot[iWSC][iWan][jWan]), cimag(Mat_tot[iWSC][iWan][jWan]));
189  nMat += 1;
190  }
191  }
192  }
193  }
194  fprintf(stdout, " Total number of EFFECTIVE term = %d\n", nMat);
195 
196  for (iWSC = 0; iWSC < nWSC; iWSC++) {
197  for (iWan = 0; iWan < nWan; iWan++) {
198  free(Mat_tot[iWSC][iWan]);
199  }
200  free(Mat_tot[iWSC]);
201  free(indx_tot[iWSC]);
202  }
203  free(Mat_tot);
204  free(indx_tot);
205 
206  return nMat;
207 }/*static int read_W90_query(struct StdIntList *StdI, char *model)*/
int NsiteUC
Number of sites in the unit cell. Defined in the beginning of each lattice function.
Definition: StdFace_vals.h:53
double length[3]
Anisotropic lattice constant, input parameter wlength, llength, hlength.
Definition: StdFace_vals.h:37
double direct[3][3]
The unit direct lattice vector. Set in StdFace_InitSite().
Definition: StdFace_vals.h:42
double ** tau
Cell-internal site position in the fractional coordinate. Defined in the beginning of each lattice fu...
Definition: StdFace_vals.h:55
+ Here is the caller graph for this function:

◆ StdFace_Wannier90()

void StdFace_Wannier90 ( struct StdIntList StdI)

Setup a Hamiltonian for the Wannier90 *_hr.dat.

Author
Mitsuaki Kawamura (The University of Tokyo)

(1) Compute the shape of the super-cell and sites in the super-cell

(2) check & store parameters of Hamiltonian

(3) Set local spin flag (StdIntList::locspinflag) and the number of sites (StdIntList::nsite)

(4) Compute the upper limit of the number of Transfer & Interaction and malloc them.

(4.5) For spin system, compute super exchange interaction.

(5) Set Transfer & Interaction

Parameters
[in,out]StdI

Definition at line 342 of file Wannier90.c.

References StdIntList::CDataFileHead, StdIntList::Cell, StdIntList::Cintra, StdIntList::CintraIndx, StdIntList::cutoff_j, StdIntList::cutoff_JR, StdIntList::cutoff_length_J, StdIntList::cutoff_length_t, StdIntList::cutoff_length_U, StdIntList::cutoff_t, StdIntList::cutoff_tR, StdIntList::cutoff_u, StdIntList::cutoff_UR, StdIntList::Ex, StdIntList::ExIndx, StdIntList::Gamma, geometry_W90(), StdIntList::h, StdIntList::Hund, StdIntList::HundIndx, StdIntList::K, StdIntList::locspinflag, StdIntList::model, StdIntList::mu, StdIntList::NCell, StdIntList::NCintra, StdIntList::NEx, StdIntList::NHund, StdIntList::NPairHopp, StdIntList::nsite, StdIntList::NsiteUC, StdIntList::ntrans, StdIntList::PairHopp, StdIntList::phase, StdIntList::PHIndx, read_W90(), read_W90_query(), StdIntList::S2, StdFace_Coulomb(), StdFace_exit(), StdFace_FindSite(), StdFace_GeneralJ(), StdFace_Hopping(), StdFace_HubbardLocal(), StdFace_InitSite(), StdFace_MagField(), StdFace_MallocInteractions(), StdFace_NotUsed_d(), StdFace_PrintGeometry(), StdFace_PrintVal_d(), StdFace_PrintVal_i(), StdFace_PrintXSF(), StdIntList::trans, StdIntList::transindx, and StdIntList::U.

Referenced by StdFace_main().

345 {
346  int isite, jsite, ispin, ntransMax, nintrMax;
347  int iL, iW, iH, kCell, it, ii;
348  double Jtmp[3][3] = { {0.0} };
349  FILE *fp;
350  double complex Cphase;
351  double dR[3], *Uspin;
352  int n_t, n_u, n_j;
353  double complex *W90_t, *W90_j, *W90_u;
354  int **t_indx, **u_indx, **j_indx;
355  char filename[256];
359  fp = fopen("lattice.xsf", "w");
360 
361  StdFace_PrintVal_d("phase0", &StdI->phase[0], 0.0);
362  StdFace_PrintVal_d("phase1", &StdI->phase[1], 0.0);
363  StdFace_PrintVal_d("phase2", &StdI->phase[2], 0.0);
364  StdI->NsiteUC = 1;
365  StdFace_InitSite(StdI, fp, 3);
366  fprintf(stdout, "\n @ Wannier90 Geometry \n\n");
367  geometry_W90(StdI);
368  /*
369  Read Hopping
370  */
371  fprintf(stdout, "\n @ Wannier90 hopping \n\n");
372  StdFace_PrintVal_d("cutoff_t", &StdI->cutoff_t, 1.0e-8);
373  StdFace_PrintVal_d("cutoff_length_t", &StdI->cutoff_length_t, -1.0);
374  sprintf(filename, "%s_hr.dat", StdI->CDataFileHead);
375  n_t = read_W90_query(StdI, filename,
376  StdI->cutoff_t, StdI->cutoff_tR,StdI->cutoff_length_t);
377  W90_t = (double complex *)malloc(sizeof(double complex) * n_t);
378  t_indx = (int **)malloc(sizeof(int*) * n_t);
379  for (ii = 0; ii < n_t; ii++) t_indx[ii] = (int *)malloc(sizeof(int) * 5);
380  read_W90(StdI, filename,
381  StdI->cutoff_t, StdI->cutoff_tR, StdI->cutoff_length_t, W90_t, t_indx);
382  /*
383  Read Coulomb
384  */
385  fprintf(stdout, "\n @ Wannier90 Coulomb \n\n");
386  StdFace_PrintVal_d("cutoff_u", &StdI->cutoff_u, 1.0e-8);
387  StdFace_PrintVal_d("cutoff_length_U", &StdI->cutoff_length_U, -1.0);
388  sprintf(filename, "%s_ur.dat", StdI->CDataFileHead);
389  n_u = read_W90_query(StdI, filename,
390  StdI->cutoff_u, StdI->cutoff_UR, StdI->cutoff_length_U);
391  W90_u = (double complex *)malloc(sizeof(double complex) * n_u);
392  u_indx = (int **)malloc(sizeof(int*) * n_u);
393  for (ii = 0; ii < n_u; ii++) u_indx[ii] = (int *)malloc(sizeof(int) * 5);
394  read_W90(StdI, filename,
395  StdI->cutoff_u, StdI->cutoff_UR, StdI->cutoff_length_U, W90_u, u_indx);
396  /*
397  Read Hund
398  */
399  fprintf(stdout, "\n @ Wannier90 Hund \n\n");
400  StdFace_PrintVal_d("cutoff_j", &StdI->cutoff_j, 1.0e-8);
401  StdFace_PrintVal_d("cutoff_length_J", &StdI->cutoff_length_J, -1.0);
402  sprintf(filename, "%s_jr.dat", StdI->CDataFileHead);
403  n_j = read_W90_query(StdI, filename,
404  StdI->cutoff_j, StdI->cutoff_JR, StdI->cutoff_length_J);
405  W90_j = (double complex *)malloc(sizeof(double complex) * n_j);
406  j_indx = (int **)malloc(sizeof(int*) * n_j);
407  for (ii = 0; ii < n_j; ii++) j_indx[ii] = (int *)malloc(sizeof(int) * 5);
408  read_W90(StdI, filename,
409  StdI->cutoff_j, StdI->cutoff_JR, StdI->cutoff_length_J, W90_j, j_indx);
413  fprintf(stdout, "\n @ Hamiltonian \n\n");
414  StdFace_NotUsed_d("K", StdI->K);
415  StdFace_PrintVal_d("h", &StdI->h, 0.0);
416  StdFace_PrintVal_d("Gamma", &StdI->Gamma, 0.0);
417  StdFace_NotUsed_d("U", StdI->U);
418 
419  if (strcmp(StdI->model, "spin") == 0 ) {
420  StdFace_PrintVal_i("2S", &StdI->S2, 1);
421  }/*if (strcmp(StdI->model, "spin") == 0 )*/
422  else if (strcmp(StdI->model, "hubbard") == 0) {
423  StdFace_PrintVal_d("mu", &StdI->mu, 0.0);
424  }
425  else{
426  printf("wannier + Kondo is not available !\n");
427  StdFace_exit(-1);
428  }/*if (model != "spin")*/
429  fprintf(stdout, "\n @ Numerical conditions\n\n");
434  StdI->nsite = StdI->NsiteUC * StdI->NCell;
435  StdI->locspinflag = (int *)malloc(sizeof(int) * StdI->nsite);
436 
437  if(strcmp(StdI->model, "spin") == 0 )
438  for (isite = 0; isite < StdI->nsite; isite++) StdI->locspinflag[isite] = StdI->S2;
439  else if(strcmp(StdI->model, "hubbard") == 0 )
440  for (isite = 0; isite < StdI->nsite; isite++) StdI->locspinflag[isite] = 0;
444  if (strcmp(StdI->model, "spin") == 0 ) {
445  ntransMax = StdI->nsite * (StdI->S2 + 1/*h*/ + 2 * StdI->S2/*Gamma*/);
446  nintrMax = StdI->NCell * (StdI->NsiteUC/*D*/ + n_t/*J*/ + n_u + n_j)
447  * (3 * StdI->S2 + 1) * (3 * StdI->S2 + StdI->NsiteUC);
448  }
449  else if (strcmp(StdI->model, "hubbard") == 0) {
450  ntransMax = StdI->NCell * 2/*spin*/ * (2 * StdI->NsiteUC/*mu+h+Gamma*/ + n_t * 2/*t*/);
451  nintrMax = StdI->NCell * (n_u + n_j + StdI->NsiteUC);
452  }
453 
454  StdFace_MallocInteractions(StdI, ntransMax, nintrMax);
458  if (strcmp(StdI->model, "spin") == 0) {
459  Uspin = (double *)malloc(sizeof(double) * StdI->NsiteUC);
460  for (it = 0; it < n_u; it++)
461  if (u_indx[it][0] == 0 && u_indx[it][1] == 0 && u_indx[it][2] == 0
462  && u_indx[it][3] == u_indx[it][4])
463  Uspin[u_indx[it][3]] = creal(W90_u[it]);
464  }/*if (strcmp(StdI->model, "spin") == 0)*/
468  for (kCell = 0; kCell < StdI->NCell; kCell++){
469 
470  iW = StdI->Cell[kCell][0];
471  iL = StdI->Cell[kCell][1];
472  iH = StdI->Cell[kCell][2];
473  /*
474  Local term 1
475  */
476  if (strcmp(StdI->model, "spin") == 0) {
477  for (isite = StdI->NsiteUC*kCell; isite < StdI->NsiteUC*(kCell + 1); isite++) {
478  StdFace_MagField(StdI, StdI->S2, -StdI->h, -StdI->Gamma, isite);
479  }
480  }/*if (strcmp(StdI->model, "spin") == 0 )*/
481  else {
482  for (isite = StdI->NsiteUC*kCell; isite < StdI->NsiteUC*(kCell + 1); isite++) {
483  StdFace_HubbardLocal(StdI, StdI->mu, -StdI->h, -StdI->Gamma, 0.0, isite);
484  }
485  }/*if (strcmp(StdI->model, "spin") != 0 )*/
486  /*
487  Hopping
488  */
489  for (it = 0; it < n_t; it++) {
490  /*
491  Local term
492  */
493  if (t_indx[it][0] == 0 && t_indx[it][1] == 0 && t_indx[it][2] == 0
494  && t_indx[it][3] == t_indx[it][4])
495  {
496  if (strcmp(StdI->model, "hubbard") == 0) {
497  isite = StdI->NsiteUC*kCell + t_indx[it][3];
498  for (ispin = 0; ispin < 2; ispin++) {
499  StdI->trans[StdI->ntrans] = -W90_t[it];
500  StdI->transindx[StdI->ntrans][0] = isite;
501  StdI->transindx[StdI->ntrans][1] = ispin;
502  StdI->transindx[StdI->ntrans][2] = isite;
503  StdI->transindx[StdI->ntrans][3] = ispin;
504  StdI->ntrans = StdI->ntrans + 1;
505  }/*for (ispin = 0; ispin < 2; ispin++)*/
506  }/*if (strcmp(StdI->model, "hubbrad") == 0 )*/
507  }/*Local term*/
508  else {
509  /*
510  Non-local term
511  */
512  StdFace_FindSite(StdI, iW, iL, iH,
513  t_indx[it][0], t_indx[it][1], t_indx[it][2],
514  t_indx[it][3], t_indx[it][4], &isite, &jsite, &Cphase, dR);
515  if (strcmp(StdI->model, "spin") == 0) {
516  for (ii = 0; ii < 3; ii++)
517  Jtmp[ii][ii] = 2.0 * W90_t[it] * conj(W90_t[it])
518  * (1.0 / Uspin[t_indx[it][3]] + 1.0 / Uspin[t_indx[it][4]]);
519  StdFace_GeneralJ(StdI, Jtmp, StdI->S2, StdI->S2, isite, jsite);
520  }/*if (strcmp(StdI->model, "spin") == 0 )*/
521  else {
522  StdFace_Hopping(StdI, - Cphase * W90_t[it], isite, jsite, dR);
523  }
524  }/*Non-local term*/
525  }/*for (it = 0; it < n_t; it++)*/
526  /*
527  Coulomb integral (U)
528  */
529  for (it = 0; it < n_u; it++) {
530  /*
531  Local term
532  */
533  if (u_indx[it][0] == 0 && u_indx[it][1] == 0 && u_indx[it][2] == 0
534  && u_indx[it][3] == u_indx[it][4])
535  {
536  StdI->Cintra[StdI->NCintra] = creal(W90_u[it]);
537  StdI->CintraIndx[StdI->NCintra][0] = StdI->NsiteUC*kCell + u_indx[it][3];
538  StdI->NCintra += 1;
539  }/*Local term*/
540  else {
541  /*
542  Non-local term
543  */
544  StdFace_FindSite(StdI, iW, iL, iH,
545  u_indx[it][0], u_indx[it][1], u_indx[it][2],
546  u_indx[it][3], u_indx[it][4], &isite, &jsite, &Cphase, dR);
547  StdFace_Coulomb(StdI, creal(W90_u[it]), isite, jsite);
548  }/*Non-local term*/
549  }/*for (it = 0; it < n_t; it++)*/
550  /*
551  Hund coupling (J)
552  */
553  for (it = 0; it < n_j; it++) {
554  /*
555  Local term should not be computed
556  */
557  if (j_indx[it][0] != 0 || j_indx[it][1] != 0 || j_indx[it][2] != 0
558  || j_indx[it][3] != j_indx[it][4])
559  {
560  StdFace_FindSite(StdI, iW, iL, iH,
561  j_indx[it][0], j_indx[it][1], j_indx[it][2],
562  j_indx[it][3], j_indx[it][4], &isite, &jsite, &Cphase, dR);
563 
564  StdI->Hund[StdI->NHund] = creal(W90_j[it]);
565  StdI->HundIndx[StdI->NHund][0] = isite;
566  StdI->HundIndx[StdI->NHund][1] = jsite;
567  StdI->NHund += 1;
568 
569  if (strcmp(StdI->model, "hubbard") == 0) {
570  StdI->Ex[StdI->NEx] = creal(W90_j[it]);
571  StdI->ExIndx[StdI->NEx][0] = isite;
572  StdI->ExIndx[StdI->NEx][1] = jsite;
573  StdI->NEx += 1;
574 
575  StdI->PairHopp[StdI->NPairHopp] = creal(W90_j[it]);
576  StdI->PHIndx[StdI->NPairHopp][0] = isite;
577  StdI->PHIndx[StdI->NPairHopp][1] = jsite;
578  StdI->NPairHopp += 1;
579  }
580  else {
581 #if defined(_mVMC)
582  StdI->Ex[StdI->NEx] = creal(W90_j[it]);
583 #else
584  StdI->Ex[StdI->NEx] = -creal(W90_j[it]);
585 #endif
586  StdI->ExIndx[StdI->NEx][0] = isite;
587  StdI->ExIndx[StdI->NEx][1] = jsite;
588  StdI->NEx += 1;
589  }
590  }/*Non-local term*/
591  }/*for (it = 0; it < n_t; it++)*/
592  }/*for (kCell = 0; kCell < StdI->NCell; kCell++)*/
593 
594  fclose(fp);
595  StdFace_PrintXSF(StdI);
596  StdFace_PrintGeometry(StdI);
597 
598  for (it = 0; it < n_t; it++) free(t_indx[it]);
599  free(t_indx);
600  free(W90_t);
601  for (it = 0; it < n_u; it++) free(u_indx[it]);
602  free(u_indx);
603  free(W90_u);
604  for (it = 0; it < n_j; it++) free(j_indx[it]);
605  free(j_indx);
606  free(W90_j);
607  if (strcmp(StdI->model, "spin") == 0) free(Uspin);
608 
609 }/*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:221
int NHund
Number of Hund term, counted in each lattice file.
Definition: StdFace_vals.h:197
double cutoff_t
Cutoof for the hopping in wannier90, input from file.
Definition: StdFace_vals.h:246
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:210
double complex * trans
[StdIntList::ntrans] Coefficient of one-body term, malloc in StdFace_MallocInteractions() and set in ...
Definition: StdFace_vals.h:168
static void read_W90(struct StdIntList *StdI, char *filename, double cutoff, int *cutoff_R, double cutoff_length, double complex *Mat, int **Matindx)
Read Wannier90 hamiltonian file (*_hr)
Definition: Wannier90.c:212
int cutoff_UR[3]
Definition: StdFace_vals.h:253
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:236
int ** ExIndx
[StdIntList::NEx][2] Site indices of exchange term, malloc in StdFace_MallocInteractions() and set in...
Definition: StdFace_vals.h:207
double cutoff_j
Cutoof for the Hund in wannier90, input from file.
Definition: StdFace_vals.h:248
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:164
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:182
double Gamma
Transvars magnetic field, input parameter.
Definition: StdFace_vals.h:148
int NCintra
Number of intra-site Coulomb interaction, counted in each lattice file.
Definition: StdFace_vals.h:179
double cutoff_length_J
Cutoof for R in wannier90, input from file.
Definition: StdFace_vals.h:251
double U
On-site Coulomb potential, input parameter.
Definition: StdFace_vals.h:74
double * Hund
[StdIntList::NHund] Coefficient of Hund term, malloc in StdFace_MallocInteractions() and set in StdFa...
Definition: StdFace_vals.h:202
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:154
int * locspinflag
[StdIntList::nsite] LocSpin in Expert mode, malloc and set in each lattice file.
Definition: StdFace_vals.h:162
int cutoff_JR[3]
Definition: StdFace_vals.h:254
int ** HundIndx
[StdIntList::NHund][2] Site indices of Hund term, malloc in StdFace_MallocInteractions() and set in S...
Definition: StdFace_vals.h:199
static void geometry_W90(struct StdIntList *StdI)
Read Geometry file for wannier90.
Definition: Wannier90.c:32
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).
double cutoff_length_t
Cutoof for R in wannier90, input from file.
Definition: StdFace_vals.h:249
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:205
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
static int read_W90_query(struct StdIntList *StdI, char *filename, double cutoff, int *cutoff_R, double cutoff_length)
Read Wannier90 hamiltonian file (*_hr) and compute the number of effective term.
Definition: Wannier90.c:77
double cutoff_length_U
Cutoof for R in wannier90, input from file.
Definition: StdFace_vals.h:250
double * PairHopp
[StdIntList::NPairLift] Coefficient of pair-hopping term, malloc in StdFace_MallocInteractions() and ...
Definition: StdFace_vals.h:226
int nsite
Number of sites, set in the each lattice file.
Definition: StdFace_vals.h:161
int ** transindx
[StdIntList::ntrans][4] Site/spin indices of one-body term, malloc in StdFace_MallocInteractions() an...
Definition: StdFace_vals.h:165
int cutoff_tR[3]
Definition: StdFace_vals.h:252
double * Cintra
[StdIntList::NCintra] Coefficient of intra-site Coulomb term, malloc in StdFace_MallocInteractions() ...
Definition: StdFace_vals.h:185
void StdFace_PrintXSF(struct StdIntList *StdI)
Print lattice.xsf (XCrysDen format)
double h
Longitudinal magnetic field, input parameter.
Definition: StdFace_vals.h:147
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:223
void StdFace_exit(int errorcode)
MPI Abortation wrapper.
char CDataFileHead[256]
Header of the output files. Input from file.
Definition: StdFace_vals.h:239
double cutoff_u
Cutoof for the Coulomb in wannier90, input from file.
Definition: StdFace_vals.h:247
double K
4-spin term. Not used.
Definition: StdFace_vals.h:149
+ Here is the call graph for this function:
+ Here is the caller graph for this function: