HΦ  3.1.0
SquareLattice.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>
28 
33 void StdFace_Tetragonal(struct StdIntList *StdI)
34 {
35  int isite, jsite, ntransMax, nintrMax;
36  int iL, iW, kCell;
37  FILE *fp;
38  double complex Cphase;
39  double dR[3];
40 
44  fp = fopen("lattice.gp", "w");
45 
46  StdI->NsiteUC = 1;
47 
48  fprintf(stdout, " @ Lattice Size & Shape\n\n");
49 
50  StdFace_PrintVal_d("a", &StdI->a, 1.0);
51  StdFace_PrintVal_d("Wlength", &StdI->length[0], StdI->a);
52  StdFace_PrintVal_d("Llength", &StdI->length[1], StdI->a);
53  StdFace_PrintVal_d("Wx", &StdI->direct[0][0], StdI->length[0]);
54  StdFace_PrintVal_d("Wy", &StdI->direct[0][1], 0.0);
55  StdFace_PrintVal_d("Lx", &StdI->direct[1][0], 0.0);
56  StdFace_PrintVal_d("Ly", &StdI->direct[1][1], StdI->length[1]);
57 
58  StdFace_PrintVal_d("phase0", &StdI->phase[0], 0.0);
59  StdFace_PrintVal_d("phase1", &StdI->phase[1], 0.0);
60 
61  StdFace_InitSite(StdI, fp, 2);
62  StdI->tau[0][0] = 0.0; StdI->tau[0][1] = 0.0; StdI->tau[0][2] = 0.0;
66  fprintf(stdout, "\n @ Hamiltonian \n\n");
67  StdFace_NotUsed_J("J2", StdI->J2All, StdI->J2);
68  StdFace_NotUsed_J("J1'", StdI->J1pAll, StdI->J1p);
69  StdFace_NotUsed_J("J2'", StdI->J2pAll, StdI->J2p);
70  StdFace_NotUsed_c("t2", StdI->t2);
71  StdFace_NotUsed_d("t1'", StdI->t1p);
72  StdFace_NotUsed_d("t2'", StdI->t2p);
73  StdFace_NotUsed_d("V2", StdI->V2);
74  StdFace_NotUsed_d("V1'", StdI->V1p);
75  StdFace_NotUsed_d("V2'", StdI->V2p);
76  StdFace_NotUsed_d("K", StdI->K);
77  StdFace_PrintVal_d("h", &StdI->h, 0.0);
78  StdFace_PrintVal_d("Gamma", &StdI->Gamma, 0.0);
79 
80  if (strcmp(StdI->model, "spin") == 0 ) {
81  StdFace_PrintVal_i("2S", &StdI->S2, 1);
82  StdFace_PrintVal_d("D", &StdI->D[2][2], 0.0);
83  StdFace_InputSpinNN(StdI, StdI->J0, StdI->J0All, "J0");
84  StdFace_InputSpinNN(StdI, StdI->J1, StdI->J1All, "J1");
85  StdFace_InputSpin(StdI, StdI->Jp, StdI->JpAll, "J'");
86 
87  StdFace_NotUsed_d("mu", StdI->mu);
88  StdFace_NotUsed_d("U", StdI->U);
89  StdFace_NotUsed_c("t", StdI->t);
90  StdFace_NotUsed_c("t0", StdI->t0);
91  StdFace_NotUsed_c("t1", StdI->t1);
92  StdFace_NotUsed_c("t'", StdI->tp);
93  StdFace_NotUsed_d("V", StdI->V);
94  StdFace_NotUsed_d("V0", StdI->V0);
95  StdFace_NotUsed_d("V1", StdI->V1);
96  StdFace_NotUsed_d("V'", StdI->Vp);
97  }/*if (strcmp(StdI->model, "spin") == 0 )*/
98  else {
99  StdFace_PrintVal_d("mu", &StdI->mu, 0.0);
100  StdFace_PrintVal_d("U", &StdI->U, 0.0);
101  StdFace_InputHopp(StdI, &StdI->t0, "t0");
102  StdFace_InputHopp(StdI, &StdI->t1, "t1");
103  StdFace_PrintVal_c("t'", &StdI->tp, 0.0);
104  StdFace_InputCoulombV(StdI, &StdI->V0, "V0");
105  StdFace_InputCoulombV(StdI, &StdI->V1, "V1");
106  StdFace_PrintVal_d("V'", &StdI->Vp, 0.0);
107 
108  StdFace_NotUsed_J("J0", StdI->J0All, StdI->J0);
109  StdFace_NotUsed_J("J1", StdI->J1All, StdI->J1);
110  StdFace_NotUsed_J("J'", StdI->JpAll, StdI->Jp);
111  StdFace_NotUsed_d("D", StdI->D[2][2]);
112 
113  if (strcmp(StdI->model, "hubbard") == 0 ) {
114  StdFace_NotUsed_i("2S", StdI->S2);
115  StdFace_NotUsed_J("J", StdI->JAll, StdI->J);
116  }/*if (strcmp(StdI->model, "hubbard") == 0 )*/
117  else {
118  StdFace_PrintVal_i("2S", &StdI->S2, 1);
119  StdFace_InputSpin(StdI, StdI->J, StdI->JAll, "J");
120  }/*if (model != "hubbard")*/
121 
122  }/*if (model != "spin")*/
123  fprintf(stdout, "\n @ Numerical conditions\n\n");
128  StdI->nsite = StdI->NsiteUC * StdI->NCell;
129  if (strcmp(StdI->model, "kondo") == 0 ) StdI->nsite *= 2;
130  StdI->locspinflag = (int *)malloc(sizeof(int) * StdI->nsite);
131 
132  if(strcmp(StdI->model, "spin") == 0 )
133  for (isite = 0; isite < StdI->nsite; isite++) StdI->locspinflag[isite] = StdI->S2;
134  else if(strcmp(StdI->model, "hubbard") == 0 )
135  for (isite = 0; isite < StdI->nsite; isite++) StdI->locspinflag[isite] = 0;
136  else
137  for (iL = 0; iL < StdI->nsite / 2; iL++) {
138  StdI->locspinflag[iL] = StdI->S2;
139  StdI->locspinflag[iL + StdI->nsite / 2] = 0;
140  }
144  if (strcmp(StdI->model, "spin") == 0 ) {
145  ntransMax = StdI->nsite * (StdI->S2 + 1/*h*/ + 2 * StdI->S2/*Gamma*/);
146  nintrMax = StdI->NCell * (StdI->NsiteUC/*D*/ + 2/*J*/ + 2/*J'*/)
147  * (3 * StdI->S2 + 1) * (3 * StdI->S2 + 1);
148  }
149  else {
150  ntransMax = StdI->NCell * 2/*spin*/ * (2 * StdI->NsiteUC/*mu+h+Gamma*/ + 4/*t*/ + 4/*t'*/);
151  nintrMax = StdI->NCell * (StdI->NsiteUC/*U*/ + 4 * (2/*V*/ + 2/*V'*/));
152 
153  if (strcmp(StdI->model, "kondo") == 0) {
154  ntransMax += StdI->nsite / 2 * (StdI->S2 + 1/*h*/ + 2 * StdI->S2/*Gamma*/);
155  nintrMax += StdI->nsite / 2 * (3 * StdI->S2 + 1) * (3 * StdI->S2 + 1);
156  }/*if (strcmp(StdI->model, "kondo") == 0)*/
157  }
158 
159  StdFace_MallocInteractions(StdI, ntransMax, nintrMax);
163  for (kCell = 0; kCell < StdI->NCell; kCell++){
164 
165  iW = StdI->Cell[kCell][0];
166  iL = StdI->Cell[kCell][1];
167  /*
168  Local term
169  */
170  isite = kCell;
171  if (strcmp(StdI->model, "kondo") == 0 ) isite += StdI->NCell;
172 
173  if (strcmp(StdI->model, "spin") == 0 ) {
174  StdFace_MagField(StdI, StdI->S2, -StdI->h, -StdI->Gamma, isite);
175  StdFace_GeneralJ(StdI, StdI->D, StdI->S2, StdI->S2, isite, isite);
176  }/*if (strcmp(StdI->model, "spin") == 0 )*/
177  else {
178  StdFace_HubbardLocal(StdI, StdI->mu, -StdI->h, -StdI->Gamma, StdI->U, isite);
179  if (strcmp(StdI->model, "kondo") == 0 ) {
180  jsite = kCell;
181  StdFace_GeneralJ(StdI, StdI->J, 1, StdI->S2, isite, jsite);
182  StdFace_MagField(StdI, StdI->S2, -StdI->h, -StdI->Gamma, jsite);
183  }/*if (strcmp(StdI->model, "kondo") == 0 )*/
184  }
185  /*
186  Nearest neighbor along W
187  */
188  StdFace_SetLabel(StdI, fp, iW, iL, 1, 0, 0, 0, &isite, &jsite, 1, &Cphase, dR);
189 
190  if (strcmp(StdI->model, "spin") == 0 ) {
191  StdFace_GeneralJ(StdI, StdI->J0, StdI->S2, StdI->S2, isite, jsite);
192  }/*if (strcmp(StdI->model, "spin") == 0 )*/
193  else {
194  StdFace_Hopping(StdI, Cphase * StdI->t0, isite, jsite, dR);
195  StdFace_Coulomb(StdI, StdI->V0, isite, jsite);
196  }
197  /*
198  Nearest neighbor along L
199  */
200  StdFace_SetLabel(StdI, fp, iW, iL, 0, 1, 0, 0, &isite, &jsite, 1, &Cphase, dR);
201 
202  if (strcmp(StdI->model, "spin") == 0 ) {
203  StdFace_GeneralJ(StdI, StdI->J1, StdI->S2, StdI->S2, isite, jsite);
204  }
205  else {
206  StdFace_Hopping(StdI, Cphase * StdI->t1, isite, jsite, dR);
207  StdFace_Coulomb(StdI, StdI->V1, isite, jsite);
208  }
209  /*
210  Second nearest neighbor 1
211  */
212  StdFace_SetLabel(StdI, fp, iW, iL, 1, 1, 0, 0, &isite, &jsite, 2, &Cphase, dR);
213 
214  if (strcmp(StdI->model, "spin") == 0 ) {
215  StdFace_GeneralJ(StdI, StdI->Jp, StdI->S2, StdI->S2, isite, jsite);
216  }/*if (strcmp(StdI->model, "spin") == 0 )*/
217  else {
218  StdFace_Hopping(StdI, Cphase * StdI->tp, isite, jsite, dR);
219  StdFace_Coulomb(StdI, StdI->Vp, isite, jsite);
220  }
221  /*
222  Second nearest neighbor 2
223  */
224  StdFace_SetLabel(StdI, fp, iW, iL, 1, -1, 0, 0, &isite, &jsite, 2, &Cphase, dR);
225 
226  if (strcmp(StdI->model, "spin") == 0 ) {
227  StdFace_GeneralJ(StdI, StdI->Jp, StdI->S2, StdI->S2, isite, jsite);
228  }/*if (strcmp(StdI->model, "spin") == 0 )*/
229  else {
230  StdFace_Hopping(StdI, Cphase * StdI->tp, isite, jsite, dR);
231  StdFace_Coulomb(StdI, StdI->Vp, isite, jsite);
232  }/*if (model != "spin")*/
233  }/*for (kCell = 0; kCell < StdI->NCell; kCell++)*/
234 
235  fprintf(fp, "plot \'-\' w d lc 7\n0.0 0.0\nend\npause -1\n");
236  fclose(fp);
237  StdFace_PrintGeometry(StdI);
238 }
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...
double V2
Anisotropic Coulomb potential (1st), input parameter.
Definition: StdFace_vals.h:78
double Jp[3][3]
Isotropic, diagonal/off-diagonal spin coupling (2nd Near.), input parameter J&#39;x, J&#39;y, J&#39;z, J&#39;xy, etc.
Definition: StdFace_vals.h:102
double complex t2p
Anisotropic hopping (2nd), input parameter.
Definition: StdFace_vals.h:69
double J[3][3]
Isotropic, diagonal/off-diagonal spin coupling (1st Near.), input parameter Jx, Jy, Jz, Jxy, etc.
Definition: StdFace_vals.h:100
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. ...
double D[3][3]
Coefficient for input parameter D. Only D[2][2] is used.
Definition: StdFace_vals.h:124
double J1p[3][3]
Isotropic, diagonal/off-diagonal spin coupling (2nd Near.), input parameter J1&#39;x, J1&#39;y...
Definition: StdFace_vals.h:113
void StdFace_PrintGeometry(struct StdIntList *StdI)
Print geometry of sites for the pos-process of correlation function.
double JpAll
Isotropic, diagonal spin coupling (2nd Near), input parameter Jp.
Definition: StdFace_vals.h:84
double J1[3][3]
Isotropic, diagonal/off-diagonal spin coupling (1st Near.), input parameter J1x, J1y, J1z, J1xy, etc. or set in StdFace_InputSpinNN().
Definition: StdFace_vals.h:110
double J2p[3][3]
Isotropic, diagonal/off-diagonal spin coupling (2nd Near.), input parameter J2&#39;x, J2&#39;y...
Definition: StdFace_vals.h:119
void StdFace_Hopping(struct StdIntList *StdI, double complex trans0, int isite, int jsite, double *dR)
Add Hopping for the both spin.
double complex t
Nearest-neighbor hopping, input parameter.
Definition: StdFace_vals.h:62
void StdFace_MallocInteractions(struct StdIntList *StdI, int ntransMax, int nintrMax)
Malloc Arrays for interactions.
double JAll
Isotropic, diagonal spin coupling (1st Near.), input parameter J.
Definition: StdFace_vals.h:82
int S2
Total spin |S| of a local spin, input from file.
Definition: StdFace_vals.h:215
int NsiteUC
Number of sites in the unit cell. Defined in the beginning of each lattice function.
Definition: StdFace_vals.h:53
double J1All
Anisotropic, diagonal spin coupling (1nd Near), input parameter J1.
Definition: StdFace_vals.h:90
void StdFace_InputCoulombV(struct StdIntList *StdI, double *V0, char *V0name)
Input off-site Coulomb interaction from the input file, if it is not specified, use the default value...
void StdFace_InputHopp(struct StdIntList *StdI, double complex *t0, char *t0name)
Input hopping integral from the input file, if it is not specified, use the default value(0 or the is...
void StdFace_InitSite(struct StdIntList *StdI, FILE *fp, int dim)
Initialize the super-cell where simulation is performed.
double V2p
Anisotropic Coulomb potential (2nd), input parameter.
Definition: StdFace_vals.h:79
char model[256]
Name of model, input parameter.
Definition: StdFace_vals.h:60
void StdFace_NotUsed_J(char *valname, double JAll, double J[3][3])
Stop HPhi if variables (real) not used is specified in the input file (!=NaN).
double Gamma
Transvars magnetic field, input parameter.
Definition: StdFace_vals.h:127
double V1
Anisotropic Coulomb potential (1st), input parameter.
Definition: StdFace_vals.h:76
double J0All
Anisotropic, diagonal spin coupling (1nd Near), input parameter J0.
Definition: StdFace_vals.h:86
double J0[3][3]
Isotropic, diagonal/off-diagonal spin coupling (1st Near.), input parameter J0x, J0y, J0z, J0xy, etc. or set in StdFace_InputSpinNN().
Definition: StdFace_vals.h:104
double U
On-site Coulomb potential, input parameter.
Definition: StdFace_vals.h:71
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
double length[3]
Anisotropic lattice constant, input parameter wlength, llength, hlength.
Definition: StdFace_vals.h:37
int * locspinflag
[StdIntList::nsite] LocSpin in Expert mode, malloc and set in each lattice file.
Definition: StdFace_vals.h:141
double complex tp
2nd-nearest hopping, input parameter
Definition: StdFace_vals.h:63
double complex t1
Anisotropic hopping (1st), input parameter.
Definition: StdFace_vals.h:66
double V
Off-site Coulomb potential (1st), input parameter.
Definition: StdFace_vals.h:72
double complex t0
Anisotropic hopping (1st), input parameter.
Definition: StdFace_vals.h:64
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).
double V0
Anisotropic Coulomb potential (1st), input parameter.
Definition: StdFace_vals.h:74
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_InputSpin(struct StdIntList *StdI, double Jp[3][3], double JpAll, char *Jpname)
Input spin-spin interaction other than nearest-neighbor.
void StdFace_SetLabel(struct StdIntList *StdI, FILE *fp, int iW, int iL, int diW, int diL, int isiteUC, int jsiteUC, int *isite, int *jsite, int connect, double complex *Cphase, double *dR)
Set Label in the gnuplot display (Only used in 2D system)
double complex t1p
Anisotropic hopping (2nd), input parameter.
Definition: StdFace_vals.h:67
double complex t2
Anisotropic hopping (1st), input parameter.
Definition: StdFace_vals.h:68
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)...
void StdFace_InputSpinNN(struct StdIntList *StdI, double J0[3][3], double J0All, char *J0name)
Input nearest-neighbor spin-spin interaction.
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 Vp
Off-site Coulomb potential (2nd), input parameter.
Definition: StdFace_vals.h:73
double J1pAll
Anisotropic, diagonal spin coupling (2nd Near), input parameter J1&#39;.
Definition: StdFace_vals.h:92
void StdFace_Tetragonal(struct StdIntList *StdI)
Setup a Hamiltonian for the square lattice.
Definition: SquareLattice.c:33
void StdFace_NotUsed_c(char *valname, double complex val)
Stop HPhi if a variable (complex) not used is specified in the input file (!=NaN).
void StdFace_PrintVal_c(char *valname, double complex *val, double complex val0)
Print a valiable (complex) read from the input file if it is not specified in the input file (=NaN)...
int nsite
Number of sites, set in the each lattice file.
Definition: StdFace_vals.h:140
double J2All
Anisotropic, diagonal spin coupling (1nd Near), input parameter J2.
Definition: StdFace_vals.h:94
Variables used in the Standard mode. These variables are passed as a pointer of the structure(StdIntL...
void StdFace_NotUsed_i(char *valname, int val)
Stop HPhi if a variable (integer) not used is specified in the input file (!=2147483647, the upper limt of Int).
double h
Longitudinal magnetic field, input parameter.
Definition: StdFace_vals.h:126
double a
The lattice constant. Input parameter.
Definition: StdFace_vals.h:36
double J2[3][3]
Isotropic, diagonal/off-diagonal spin coupling (1st Near.), input parameter J2x, J2y, J2z, J2xy, etc. or set in StdFace_InputSpinNN().
Definition: StdFace_vals.h:116
double J2pAll
Anisotropic, diagonal spin coupling (2nd Near), input parameter J2&#39;.
Definition: StdFace_vals.h:96
double ** tau
Cell-internal site position in the fractional coordinate. Defined in the beginning of each lattice fu...
Definition: StdFace_vals.h:55
double V1p
Anisotropic Coulomb potential (2nd), input parameter.
Definition: StdFace_vals.h:77
double K
4-spin term. Not used.
Definition: StdFace_vals.h:128