HPhi++  3.1.0
SquareLattice.cpp File Reference

Standard mode for the tetragonal lattice. More...

#include "StdFace_vals.hpp"
#include "StdFace_ModelUtil.hpp"
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <complex>
#include <cstring>
#include <iostream>

Go to the source code of this file.

Functions

void StdFace_Tetragonal (struct StdIntList *StdI)
 Setup a Hamiltonian for the square lattice. More...
 

Detailed Description

Standard mode for the tetragonal lattice.

Definition in file SquareLattice.cpp.

Function Documentation

◆ StdFace_Tetragonal()

void StdFace_Tetragonal ( struct StdIntList *  StdI)

Setup a Hamiltonian for the square lattice.

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.

(5) Set Transfer & Interaction

Definition at line 34 of file SquareLattice.cpp.

References StdFace_Coulomb(), StdFace_GeneralJ(), StdFace_Hopping(), StdFace_HubbardLocal(), StdFace_InitSite(), StdFace_InputCoulombV(), StdFace_InputHopp(), StdFace_InputSpin(), StdFace_InputSpinNN(), StdFace_MagField(), StdFace_MallocInteractions(), StdFace_NotUsed_c(), StdFace_NotUsed_d(), StdFace_NotUsed_i(), StdFace_NotUsed_J(), StdFace_PrintGeometry(), StdFace_PrintVal_d(), StdFace_PrintVal_i(), and StdFace_SetLabel().

Referenced by StdFace_main().

35 {
36  int isite, jsite, ntransMax, nintrMax;
37  int iL, iW, kCell;
38  FILE *fp;
39  std::complex<double> Cphase;
40  double dR[3];
41 
45  fp = fopen("lattice.gp", "w");
46 
47  StdI->NsiteUC = 1;
48 
49  fprintf(stdout, " @ Lattice Size & Shape\n\n");
50 
51  StdFace_PrintVal_d("a", &StdI->a, 1.0);
52  StdFace_PrintVal_d("Wlength", &StdI->length[0], StdI->a);
53  StdFace_PrintVal_d("Llength", &StdI->length[1], StdI->a);
54  StdFace_PrintVal_d("Wx", &StdI->direct[0][0], StdI->length[0]);
55  StdFace_PrintVal_d("Wy", &StdI->direct[0][1], 0.0);
56  StdFace_PrintVal_d("Lx", &StdI->direct[1][0], 0.0);
57  StdFace_PrintVal_d("Ly", &StdI->direct[1][1], StdI->length[1]);
58 
59  StdFace_PrintVal_d("phase0", &StdI->phase[0], 0.0);
60  StdFace_PrintVal_d("phase1", &StdI->phase[1], 0.0);
61 
62  StdFace_InitSite(StdI, fp, 2);
63  StdI->tau[0][0] = 0.0; StdI->tau[0][1] = 0.0; StdI->tau[0][2] = 0.0;
67  fprintf(stdout, "\n @ Hamiltonian \n\n");
68  StdFace_NotUsed_J("J2", StdI->J2All, StdI->J2);
69  StdFace_NotUsed_J("J2'", StdI->J2pAll, StdI->J2p);
70  StdFace_NotUsed_c("t2", StdI->t2);
71  StdFace_NotUsed_d("t2'", real(StdI->t2p));
72  StdFace_NotUsed_d("V2", StdI->V2);
73  StdFace_NotUsed_d("V2'", StdI->V2p);
74  StdFace_NotUsed_d("K", StdI->K);
75  StdFace_PrintVal_d("h", &StdI->h, 0.0);
76  StdFace_PrintVal_d("Gamma", &StdI->Gamma, 0.0);
77 
78  if (strcmp(StdI->model, "spin") == 0 ) {
79  StdFace_PrintVal_i("2S", &StdI->S2, 1);
80  StdFace_PrintVal_d("D", &StdI->D[2][2], 0.0);
81  StdFace_InputSpinNN(StdI->J, StdI->JAll, StdI->J0, StdI->J0All, "J0");
82  StdFace_InputSpinNN(StdI->J, StdI->JAll, StdI->J1, StdI->J1All, "J1");
83  StdFace_InputSpinNN(StdI->Jp, StdI->JpAll, StdI->J0p, StdI->J0pAll, "J0'");
84  StdFace_InputSpinNN(StdI->Jp, StdI->JpAll, StdI->J1p, StdI->J1pAll, "J1'");
85  StdFace_InputSpinNN(StdI->Jpp, StdI->JppAll, StdI->J0pp, StdI->J0ppAll, "J0''");
86  StdFace_InputSpinNN(StdI->Jpp, StdI->JppAll, StdI->J1pp, StdI->J1ppAll, "J1''");
87 
88  StdFace_NotUsed_d("mu", StdI->mu);
89  StdFace_NotUsed_d("U", StdI->U);
90  StdFace_NotUsed_c("t", StdI->t);
91  StdFace_NotUsed_c("t0", StdI->t0);
92  StdFace_NotUsed_c("t1", StdI->t1);
93  StdFace_NotUsed_c("t'", StdI->tp);
94  StdFace_NotUsed_c("t0'", StdI->t0p);
95  StdFace_NotUsed_c("t1'", StdI->t1p);
96  StdFace_NotUsed_c("t''", StdI->tpp);
97  StdFace_NotUsed_c("t0''", StdI->t0pp);
98  StdFace_NotUsed_c("t1''", StdI->t1pp);
99  StdFace_NotUsed_d("V", StdI->V);
100  StdFace_NotUsed_d("V0", StdI->V0);
101  StdFace_NotUsed_d("V1", StdI->V1);
102  StdFace_NotUsed_d("V'", StdI->Vp);
103  StdFace_NotUsed_d("V0'", StdI->V0p);
104  StdFace_NotUsed_d("V1'", StdI->V1p);
105  StdFace_NotUsed_d("V''", StdI->Vpp);
106  StdFace_NotUsed_d("V0''", StdI->V0pp);
107  StdFace_NotUsed_d("V1''", StdI->V1pp);
108  }/*if (strcmp(StdI->model, "spin") == 0 )*/
109  else {
110  StdFace_PrintVal_d("mu", &StdI->mu, 0.0);
111  StdFace_PrintVal_d("U", &StdI->U, 0.0);
112  StdFace_InputHopp(StdI->t, &StdI->t0, "t0");
113  StdFace_InputHopp(StdI->t, &StdI->t1, "t1");
114  StdFace_InputHopp(StdI->tp, &StdI->t0p, "t0'");
115  StdFace_InputHopp(StdI->tp, &StdI->t1p, "t1'");
116  StdFace_InputHopp(StdI->tpp, &StdI->t0pp, "t0''");
117  StdFace_InputHopp(StdI->tpp, &StdI->t1pp, "t1''");
118  StdFace_InputCoulombV(StdI->V, &StdI->V0, "V0");
119  StdFace_InputCoulombV(StdI->V, &StdI->V1, "V1");
120  StdFace_InputCoulombV(StdI->Vp, &StdI->V0p, "V0'");
121  StdFace_InputCoulombV(StdI->Vp, &StdI->V1p, "V1'");
122  StdFace_InputCoulombV(StdI->Vpp, &StdI->V0pp, "V0''");
123  StdFace_InputCoulombV(StdI->Vpp, &StdI->V1pp, "V1''");
124  StdFace_PrintVal_d("V'", &StdI->Vp, 0.0);
125 
126  StdFace_NotUsed_J("J0", StdI->J0All, StdI->J0);
127  StdFace_NotUsed_J("J1", StdI->J1All, StdI->J1);
128  StdFace_NotUsed_J("J'", StdI->JpAll, StdI->Jp);
129  StdFace_NotUsed_d("D", StdI->D[2][2]);
130 
131  if (strcmp(StdI->model, "hubbard") == 0 ) {
132  StdFace_NotUsed_i("2S", StdI->S2);
133  StdFace_NotUsed_J("J", StdI->JAll, StdI->J);
134  }/*if (strcmp(StdI->model, "hubbard") == 0 )*/
135  else {
136  StdFace_PrintVal_i("2S", &StdI->S2, 1);
137  StdFace_InputSpin(StdI->J, StdI->JAll, "J");
138  }/*if (model != "hubbard")*/
139 
140  }/*if (model != "spin")*/
141  fprintf(stdout, "\n @ Numerical conditions\n\n");
146  StdI->nsite = StdI->NsiteUC * StdI->NCell;
147  if (strcmp(StdI->model, "kondo") == 0 ) StdI->nsite *= 2;
148  StdI->locspinflag = (int *)malloc(sizeof(int) * StdI->nsite);
149 
150  if(strcmp(StdI->model, "spin") == 0 )
151  for (isite = 0; isite < StdI->nsite; isite++) StdI->locspinflag[isite] = StdI->S2;
152  else if(strcmp(StdI->model, "hubbard") == 0 )
153  for (isite = 0; isite < StdI->nsite; isite++) StdI->locspinflag[isite] = 0;
154  else
155  for (iL = 0; iL < StdI->nsite / 2; iL++) {
156  StdI->locspinflag[iL] = StdI->S2;
157  StdI->locspinflag[iL + StdI->nsite / 2] = 0;
158  }
162  if (strcmp(StdI->model, "spin") == 0 ) {
163  ntransMax = StdI->nsite * (StdI->S2 + 1/*h*/ + 2 * StdI->S2/*Gamma*/);
164  nintrMax = StdI->NCell * (StdI->NsiteUC/*D*/ + 2/*J*/ + 2/*J'*/ + 2/*J''*/)
165  * (3 * StdI->S2 + 1) * (3 * StdI->S2 + 1);
166  }
167  else {
168  ntransMax = StdI->NCell * 2/*spin*/ * (
169  2 * StdI->NsiteUC/*mu+h+Gamma*/ + 4/*t*/ + 4/*t'*/ + 4/*t''*/);
170  nintrMax = StdI->NCell * (StdI->NsiteUC/*U*/ + 4 * (2/*V*/ + 2/*V'*/ + 2/*V''*/));
171 
172  if (strcmp(StdI->model, "kondo") == 0) {
173  ntransMax += StdI->nsite / 2 * (StdI->S2 + 1/*h*/ + 2 * StdI->S2/*Gamma*/);
174  nintrMax += StdI->nsite / 2 * (3 * StdI->S2 + 1) * (3 * StdI->S2 + 1);
175  }/*if (strcmp(StdI->model, "kondo") == 0)*/
176  }
177 
178  StdFace_MallocInteractions(StdI, ntransMax, nintrMax);
182  for (kCell = 0; kCell < StdI->NCell; kCell++){
183 
184  iW = StdI->Cell[kCell][0];
185  iL = StdI->Cell[kCell][1];
186  /*
187  Local term
188  */
189  isite = kCell;
190  if (strcmp(StdI->model, "kondo") == 0 ) isite += StdI->NCell;
191 
192  if (strcmp(StdI->model, "spin") == 0 ) {
193  StdFace_MagField(StdI, StdI->S2, -StdI->h, -StdI->Gamma, isite);
194  StdFace_GeneralJ(StdI, StdI->D, StdI->S2, StdI->S2, isite, isite);
195  }/*if (strcmp(StdI->model, "spin") == 0 )*/
196  else {
197  StdFace_HubbardLocal(StdI, StdI->mu, -StdI->h, -StdI->Gamma, StdI->U, isite);
198  if (strcmp(StdI->model, "kondo") == 0 ) {
199  jsite = kCell;
200  StdFace_GeneralJ(StdI, StdI->J, 1, StdI->S2, isite, jsite);
201  StdFace_MagField(StdI, StdI->S2, -StdI->h, -StdI->Gamma, jsite);
202  }/*if (strcmp(StdI->model, "kondo") == 0 )*/
203  }
204  /*
205  Nearest neighbor along W
206  */
207  StdFace_SetLabel(StdI, fp, iW, iL, 1, 0, 0, 0, &isite, &jsite, 1, &Cphase, dR);
208 
209  if (strcmp(StdI->model, "spin") == 0 ) {
210  StdFace_GeneralJ(StdI, StdI->J0, StdI->S2, StdI->S2, isite, jsite);
211  }/*if (strcmp(StdI->model, "spin") == 0 )*/
212  else {
213  StdFace_Hopping(StdI, Cphase * StdI->t0, isite, jsite, dR);
214  StdFace_Coulomb(StdI, StdI->V0, isite, jsite);
215  }
216  /*
217  Nearest neighbor along L
218  */
219  StdFace_SetLabel(StdI, fp, iW, iL, 0, 1, 0, 0, &isite, &jsite, 1, &Cphase, dR);
220 
221  if (strcmp(StdI->model, "spin") == 0 ) {
222  StdFace_GeneralJ(StdI, StdI->J1, StdI->S2, StdI->S2, isite, jsite);
223  }
224  else {
225  StdFace_Hopping(StdI, Cphase * StdI->t1, isite, jsite, dR);
226  StdFace_Coulomb(StdI, StdI->V1, isite, jsite);
227  }
228  /*
229  Second nearest neighbor W+L
230  */
231  StdFace_SetLabel(StdI, fp, iW, iL, 1, 1, 0, 0, &isite, &jsite, 2, &Cphase, dR);
232 
233  if (strcmp(StdI->model, "spin") == 0 ) {
234  StdFace_GeneralJ(StdI, StdI->J0p, StdI->S2, StdI->S2, isite, jsite);
235  }/*if (strcmp(StdI->model, "spin") == 0 )*/
236  else {
237  StdFace_Hopping(StdI, Cphase * StdI->t0p, isite, jsite, dR);
238  StdFace_Coulomb(StdI, StdI->V0p, isite, jsite);
239  }
240  /*
241  Second nearest neighbor W-L
242  */
243  StdFace_SetLabel(StdI, fp, iW, iL, 1, -1, 0, 0, &isite, &jsite, 2, &Cphase, dR);
244 
245  if (strcmp(StdI->model, "spin") == 0 ) {
246  StdFace_GeneralJ(StdI, StdI->J1p, StdI->S2, StdI->S2, isite, jsite);
247  }/*if (strcmp(StdI->model, "spin") == 0 )*/
248  else {
249  StdFace_Hopping(StdI, Cphase * StdI->t1p, isite, jsite, dR);
250  StdFace_Coulomb(StdI, StdI->V1p, isite, jsite);
251  }/*if (model != "spin")*/
252  /*
253  Third Nearest neighbor along 2W
254  */
255  StdFace_SetLabel(StdI, fp, iW, iL, 2, 0, 0, 0, &isite, &jsite, 3, &Cphase, dR);
256 
257  if (strcmp(StdI->model, "spin") == 0) {
258  StdFace_GeneralJ(StdI, StdI->J0pp, StdI->S2, StdI->S2, isite, jsite);
259  }/*if (strcmp(StdI->model, "spin") == 0 )*/
260  else {
261  StdFace_Hopping(StdI, Cphase * StdI->t0pp, isite, jsite, dR);
262  StdFace_Coulomb(StdI, StdI->V0pp, isite, jsite);
263  }
264  /*
265  Third Nearest neighbor along L
266  */
267  StdFace_SetLabel(StdI, fp, iW, iL, 0, 2, 0, 0, &isite, &jsite, 3, &Cphase, dR);
268 
269  if (strcmp(StdI->model, "spin") == 0) {
270  StdFace_GeneralJ(StdI, StdI->J1pp, StdI->S2, StdI->S2, isite, jsite);
271  }
272  else {
273  StdFace_Hopping(StdI, Cphase * StdI->t1pp, isite, jsite, dR);
274  StdFace_Coulomb(StdI, StdI->V1pp, isite, jsite);
275  }
276  }/*for (kCell = 0; kCell < StdI->NCell; kCell++)*/
277 
278  fprintf(fp, "plot \'-\' w d lc 7\n0.0 0.0\nend\npause -1\n");
279  fclose(fp);
280  StdFace_PrintGeometry(StdI);
281 }
void StdFace_InputHopp(std::complex< double > t, std::complex< double > *t0, const char *t0name)
Input hopping integral from the input file, if it is not specified, use the default value(0 or the is...
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, std::complex< double > *Cphase, double *dR)
Set Label in the gnuplot display (Only used in 2D system)
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&#39; + 1) interactions].
void StdFace_InputSpin(double Jp[3][3], double JpAll, const char *Jpname)
Input spin-spin interaction other than nearest-neighbor.
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_Hopping(struct StdIntList *StdI, std::complex< double > trans0, int isite, int jsite, double *dR)
Add Hopping for the both spin.
void StdFace_NotUsed_c(const char *valname, std::complex< double > val)
Stop HPhi if a variable (complex) not used is specified in the input file (!=NaN).
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_NotUsed_J(const char *valname, double JAll, double J[3][3])
Stop HPhi if variables (real) not used is specified in the input file (!=NaN).
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_InputCoulombV(double V, double *V0, const char *V0name)
Input off-site Coulomb interaction from the input file, if it is not specified, use the default value...
void StdFace_MallocInteractions(struct StdIntList *StdI, int ntransMax, int nintrMax)
Malloc Arrays for interactions.
void StdFace_NotUsed_i(const char *valname, int val)
Stop HPhi if a variable (integer) not used is specified in the input file (!=2147483647, the upper limt of Int).
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.
void StdFace_InputSpinNN(double J[3][3], double JAll, double J0[3][3], double J0All, const char *J0name)
Input nearest-neighbor spin-spin interaction.
void StdFace_NotUsed_d(const char *valname, double val)
Stop HPhi if a variable (real) not used is specified in the input file (!=NaN).