HPhi++  3.1.0
FCOrtho.cpp
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.hpp"
22 #include "StdFace_ModelUtil.hpp"
23 #include <cstdlib>
24 #include <cstdio>
25 #include <cmath>
26 #include <complex>
27 #include <cstring>
28 
34  struct StdIntList *StdI
35 )
36 {
37  int isite, jsite, ntransMax, nintrMax;
38  int iL, iW, iH, kCell;
39  FILE *fp;
40  std::complex<double> Cphase;
41  double dR[3];
42 
46  fp = fopen("lattice.xsf", "w");
47 
48  StdI->NsiteUC = 1;
49 
50  fprintf(stdout, " @ Lattice Size & Shape\n\n");
51 
52  StdFace_PrintVal_d("a", &StdI->a, 1.0);
53  StdFace_PrintVal_d("Wlength", &StdI->length[0], StdI->a);
54  StdFace_PrintVal_d("Llength", &StdI->length[1], StdI->a);
55  StdFace_PrintVal_d("Hlength", &StdI->length[2], StdI->a);
56  StdFace_PrintVal_d("Wx", &StdI->direct[0][0], 0.0);
57  StdFace_PrintVal_d("Wy", &StdI->direct[0][1], 0.5 * StdI->length[0]);
58  StdFace_PrintVal_d("Wz", &StdI->direct[0][2], 0.5 * StdI->length[0]);
59  StdFace_PrintVal_d("Lx", &StdI->direct[1][0], 0.5 * StdI->length[1]);
60  StdFace_PrintVal_d("Ly", &StdI->direct[1][1], 0.0);
61  StdFace_PrintVal_d("Lz", &StdI->direct[1][2], 0.5 * StdI->length[1]);
62  StdFace_PrintVal_d("Hx", &StdI->direct[2][0], 0.5 * StdI->length[2]);
63  StdFace_PrintVal_d("Hy", &StdI->direct[2][1], 0.5 * StdI->length[2]);
64  StdFace_PrintVal_d("Hz", &StdI->direct[2][2], 0.0);
65 
66  StdFace_PrintVal_d("phase0", &StdI->phase[0], 0.0);
67  StdFace_PrintVal_d("phase1", &StdI->phase[1], 0.0);
68  StdFace_PrintVal_d("phase2", &StdI->phase[2], 0.0);
69 
70  StdFace_InitSite(StdI, fp, 3);
71  StdI->tau[0][0] = 0.0; StdI->tau[0][1] = 0.0; ; StdI->tau[0][2] = 0.0;
75  fprintf(stdout, "\n @ Hamiltonian \n\n");
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->J, StdI->JAll, StdI->J0, StdI->J0All, "J0");
84  StdFace_InputSpinNN(StdI->J, StdI->JAll, StdI->J1, StdI->J1All, "J1");
85  StdFace_InputSpinNN(StdI->J, StdI->JAll, StdI->J2, StdI->J2All, "J2");
86  StdFace_InputSpinNN(StdI->Jp, StdI->JpAll, StdI->J0p, StdI->J0pAll, "J0'");
87  StdFace_InputSpinNN(StdI->Jp, StdI->JpAll, StdI->J1p, StdI->J1pAll, "J1'");
88  StdFace_InputSpinNN(StdI->Jp, StdI->JpAll, StdI->J2p, StdI->J2pAll, "J2'");
89  StdFace_InputSpinNN(StdI->Jpp, StdI->JppAll, StdI->J0pp, StdI->J0ppAll, "J0''");
90  StdFace_InputSpinNN(StdI->Jpp, StdI->JppAll, StdI->J1pp, StdI->J1ppAll, "J1''");
91  StdFace_InputSpinNN(StdI->Jpp, StdI->JppAll, StdI->J2pp, StdI->J2ppAll, "J2''");
92 
93  StdFace_NotUsed_d("mu", StdI->mu);
94  StdFace_NotUsed_d("U", StdI->U);
95  StdFace_NotUsed_c("t", StdI->t);
96  StdFace_NotUsed_c("t0", StdI->t0);
97  StdFace_NotUsed_c("t1", StdI->t1);
98  StdFace_NotUsed_c("t2", StdI->t2);
99  StdFace_NotUsed_c("t'", StdI->tp);
100  StdFace_NotUsed_c("t0'", StdI->t0p);
101  StdFace_NotUsed_c("t1'", StdI->t1p);
102  StdFace_NotUsed_c("t2'", StdI->t2p);
103  StdFace_NotUsed_c("t''", StdI->tpp);
104  StdFace_NotUsed_d("V", StdI->V);
105  StdFace_NotUsed_d("V0", StdI->V0);
106  StdFace_NotUsed_d("V1", StdI->V1);
107  StdFace_NotUsed_d("V'", StdI->Vp);
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->t, &StdI->t2, "t2");
115  StdFace_InputHopp(StdI->tp, &StdI->t0p, "t0'");
116  StdFace_InputHopp(StdI->tp, &StdI->t1p, "t1'");
117  StdFace_InputHopp(StdI->tp, &StdI->t2p, "t2'");
118  StdFace_InputCoulombV(StdI->V, &StdI->V0, "V0");
119  StdFace_InputCoulombV(StdI->V, &StdI->V1, "V1");
120  StdFace_InputCoulombV(StdI->V, &StdI->V2, "V2");
121  StdFace_InputCoulombV(StdI->Vp, &StdI->V0p, "V0'");
122  StdFace_InputCoulombV(StdI->Vp, &StdI->V1p, "V1'");
123  StdFace_InputCoulombV(StdI->Vp, &StdI->V2p, "V2'");
124 
125  StdFace_NotUsed_J("J0", StdI->J0All, StdI->J0);
126  StdFace_NotUsed_J("J1", StdI->J1All, StdI->J1);
127  StdFace_NotUsed_J("J2", StdI->J2All, StdI->J2);
128  StdFace_NotUsed_J("J0'", StdI->J0pAll, StdI->J0p);
129  StdFace_NotUsed_J("J1'", StdI->J1pAll, StdI->J1p);
130  StdFace_NotUsed_J("J2'", StdI->J2pAll, StdI->J2p);
131  StdFace_NotUsed_J("J''", StdI->JppAll, StdI->Jpp);
132  StdFace_NotUsed_d("D", StdI->D[2][2]);
133 
134  if (strcmp(StdI->model, "hubbard") == 0 ) {
135  StdFace_NotUsed_i("2S", StdI->S2);
136  StdFace_NotUsed_J("J", StdI->JAll, StdI->J);
137  }/*if (strcmp(StdI->model, "hubbard") == 0 )*/
138  else {
139  StdFace_PrintVal_i("2S", &StdI->S2, 1);
140  StdFace_InputSpin(StdI->J, StdI->JAll, "J");
141  }/*if (model != "hubbard")*/
142 
143  }/*if (model != "spin")*/
144  fprintf(stdout, "\n @ Numerical conditions\n\n");
149  StdI->nsite = StdI->NsiteUC * StdI->NCell;
150  if (strcmp(StdI->model, "kondo") == 0 ) StdI->nsite *= 2;
151  StdI->locspinflag = (int *)malloc(sizeof(int) * StdI->nsite);
152 
153  if(strcmp(StdI->model, "spin") == 0 )
154  for (isite = 0; isite < StdI->nsite; isite++) StdI->locspinflag[isite] = StdI->S2;
155  else if(strcmp(StdI->model, "hubbard") == 0 )
156  for (isite = 0; isite < StdI->nsite; isite++) StdI->locspinflag[isite] = 0;
157  else
158  for (iL = 0; iL < StdI->nsite / 2; iL++) {
159  StdI->locspinflag[iL] = StdI->S2;
160  StdI->locspinflag[iL + StdI->nsite / 2] = 0;
161  }
165  if (strcmp(StdI->model, "spin") == 0 ) {
166  ntransMax = StdI->nsite * (StdI->S2 + 1/*h*/ + 2 * StdI->S2/*Gamma*/);
167  nintrMax = StdI->NCell * (StdI->NsiteUC/*D*/ + 6/*J*/ + 3/*J'*/ + 0/*J''*/)
168  * (3 * StdI->S2 + 1) * (3 * StdI->S2 + 1);
169  }
170  else {
171  ntransMax = StdI->NCell * 2/*spin*/ * (2 * StdI->NsiteUC/*mu+h+Gamma*/ + 12/*t*/ + 6/*t'*/ + 0/*t''*/);
172  nintrMax = StdI->NCell * (StdI->NsiteUC/*U*/ + 4 * (6/*V*/ + 3/*V'*/ + 0/*V''*/));
173 
174  if (strcmp(StdI->model, "kondo") == 0) {
175  ntransMax += StdI->nsite / 2 * (StdI->S2 + 1/*h*/ + 2 * StdI->S2/*Gamma*/);
176  nintrMax += StdI->nsite / 2 * (3 * StdI->S2 + 1) * (3 * StdI->S2 + 1);
177  }/*if (strcmp(StdI->model, "kondo") == 0)*/
178  }
179 
180  StdFace_MallocInteractions(StdI, ntransMax, nintrMax);
184  for (kCell = 0; kCell < StdI->NCell; kCell++){
185 
186  iW = StdI->Cell[kCell][0];
187  iL = StdI->Cell[kCell][1];
188  iH = StdI->Cell[kCell][2];
189  /*
190  (1) Local term
191  */
192  isite = kCell;
193  if (strcmp(StdI->model, "kondo") == 0 ) isite += StdI->NCell;
194 
195  if (strcmp(StdI->model, "spin") == 0 ) {
196  StdFace_MagField(StdI, StdI->S2, -StdI->h, -StdI->Gamma, isite);
197  StdFace_GeneralJ(StdI, StdI->D, StdI->S2, StdI->S2, isite, isite);
198  }/*if (strcmp(StdI->model, "spin") == 0 )*/
199  else {
200  StdFace_HubbardLocal(StdI, StdI->mu, -StdI->h, -StdI->Gamma, StdI->U, isite);
201 
202  if (strcmp(StdI->model, "kondo") == 0 ) {
203  jsite = kCell;
204  StdFace_GeneralJ(StdI, StdI->J, 1, StdI->S2, isite, jsite);
205  }/*if (strcmp(StdI->model, "kondo") == 0 )*/
206  }
207  /*
208  (2) Nearest neighbor along W
209  */
210  StdFace_FindSite(StdI, iW, iL, iH, 1, 0, 0, 0, 0, &isite, &jsite, &Cphase, dR);
211 
212  if (strcmp(StdI->model, "spin") == 0 ) {
213  StdFace_GeneralJ(StdI, StdI->J0, StdI->S2, StdI->S2, isite, jsite);
214  }/*if (strcmp(StdI->model, "spin") == 0 )*/
215  else {
216  StdFace_Hopping(StdI, Cphase * StdI->t0, isite, jsite, dR);
217  StdFace_Coulomb(StdI, StdI->V0, isite, jsite);
218  }
219  /*
220  (3) Nearest neighbor along W
221  */
222  StdFace_FindSite(StdI, iW, iL, iH, 0, 1, -1, 0, 0, &isite, &jsite, &Cphase, dR);
223 
224  if (strcmp(StdI->model, "spin") == 0) {
225  StdFace_GeneralJ(StdI, StdI->J0, StdI->S2, StdI->S2, isite, jsite);
226  }/*if (strcmp(StdI->model, "spin") == 0 )*/
227  else {
228  StdFace_Hopping(StdI, Cphase * StdI->t0, isite, jsite, dR);
229  StdFace_Coulomb(StdI, StdI->V0, isite, jsite);
230  }
231  /*
232  (4) Nearest neighbor along L
233  */
234  StdFace_FindSite(StdI, iW, iL, iH, 0, 1, 0, 0, 0, &isite, &jsite, &Cphase, dR);
235 
236  if (strcmp(StdI->model, "spin") == 0) {
237  StdFace_GeneralJ(StdI, StdI->J1, StdI->S2, StdI->S2, isite, jsite);
238  }
239  else {
240  StdFace_Hopping(StdI, Cphase * StdI->t1, isite, jsite, dR);
241  StdFace_Coulomb(StdI, StdI->V1, isite, jsite);
242  }
243  /*
244  (5) Nearest neighbor along L
245  */
246  StdFace_FindSite(StdI, iW, iL, iH, -1, 0, 1, 0, 0, &isite, &jsite, &Cphase, dR);
247 
248  if (strcmp(StdI->model, "spin") == 0) {
249  StdFace_GeneralJ(StdI, StdI->J1, StdI->S2, StdI->S2, isite, jsite);
250  }
251  else {
252  StdFace_Hopping(StdI, Cphase * StdI->t1, isite, jsite, dR);
253  StdFace_Coulomb(StdI, StdI->V1, isite, jsite);
254  }
255  /*
256  (6) Nearest neighbor along H
257  */
258  StdFace_FindSite(StdI, iW, iL, iH, 0, 0, 1, 0, 0, &isite, &jsite, &Cphase, dR);
259 
260  if (strcmp(StdI->model, "spin") == 0) {
261  StdFace_GeneralJ(StdI, StdI->J2, StdI->S2, StdI->S2, isite, jsite);
262  }
263  else {
264  StdFace_Hopping(StdI, Cphase * StdI->t2, isite, jsite, dR);
265  StdFace_Coulomb(StdI, StdI->V2, isite, jsite);
266  }
267  /*
268  (7) Nearest neighbor along H
269  */
270  StdFace_FindSite(StdI, iW, iL, iH, 1, -1, 0, 0, 0, &isite, &jsite, &Cphase, dR);
271 
272  if (strcmp(StdI->model, "spin") == 0) {
273  StdFace_GeneralJ(StdI, StdI->J2, StdI->S2, StdI->S2, isite, jsite);
274  }
275  else {
276  StdFace_Hopping(StdI, Cphase * StdI->t2, isite, jsite, dR);
277  StdFace_Coulomb(StdI, StdI->V2, isite, jsite);
278  }
279  /*
280  (8) Second nearest neighbor along -W+L+H
281  */
282  StdFace_FindSite(StdI, iW, iL, iH, -1, 1, 1, 0, 0, &isite, &jsite, &Cphase, dR);
283 
284  if (strcmp(StdI->model, "spin") == 0 ) {
285  StdFace_GeneralJ(StdI, StdI->J0p, StdI->S2, StdI->S2, isite, jsite);
286  }/*if (strcmp(StdI->model, "spin") == 0 )*/
287  else {
288  StdFace_Hopping(StdI, Cphase * StdI->t0p, isite, jsite, dR);
289  StdFace_Coulomb(StdI, StdI->V0p, isite, jsite);
290  }
291  /*
292  (9) Second nearest neighbor along -L+H+W
293  */
294  StdFace_FindSite(StdI, iW, iL, iH, 1, -1, 1, 0, 0, &isite, &jsite, &Cphase, dR);
295 
296  if (strcmp(StdI->model, "spin") == 0) {
297  StdFace_GeneralJ(StdI, StdI->J1p, StdI->S2, StdI->S2, isite, jsite);
298  }/*if (strcmp(StdI->model, "spin") == 0 )*/
299  else {
300  StdFace_Hopping(StdI, Cphase * StdI->t1p, isite, jsite, dR);
301  StdFace_Coulomb(StdI, StdI->V1p, isite, jsite);
302  }
303  /*
304  (10) Second nearest neighbor along -H+W+L
305  */
306  StdFace_FindSite(StdI, iW, iL, iH, 1, 1, -1, 0, 0, &isite, &jsite, &Cphase, dR);
307 
308  if (strcmp(StdI->model, "spin") == 0) {
309  StdFace_GeneralJ(StdI, StdI->J2p, StdI->S2, StdI->S2, isite, jsite);
310  }/*if (strcmp(StdI->model, "spin") == 0 )*/
311  else {
312  StdFace_Hopping(StdI, Cphase * StdI->t2p, isite, jsite, dR);
313  StdFace_Coulomb(StdI, StdI->V2p, isite, jsite);
314  }
315  }/*for (kCell = 0; kCell < StdI->NCell; kCell++)*/
316 
317  fclose(fp);
318  StdFace_PrintXSF(StdI);
319  StdFace_PrintGeometry(StdI);
320 }/*StdFace_FCOrtho*/
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_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_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_Hopping(struct StdIntList *StdI, std::complex< double > trans0, int isite, int jsite, double *dR)
Add Hopping for the both spin.
void StdFace_FCOrtho(struct StdIntList *StdI)
Setup a Hamiltonian for the Face-Centered Orthorhombic lattice.
Definition: FCOrtho.cpp:33
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_PrintXSF(struct StdIntList *StdI)
Print lattice.xsf (XCrysDen format)
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).