HΦ  3.2.0
HPhiTrans.c
Go to the documentation of this file.
1 /* HPhi - Quantum Lattice Model Simulator */
2 /* Copyright (C) 2015 The University of Tokyo */
3 
4 /* This program is free software: you can redistribute it and/or modify */
5 /* it under the terms of the GNU General Public License as published by */
6 /* the Free Software Foundation, either version 3 of the License, or */
7 /* (at your option) any later version. */
8 
9 /* This program is distributed in the hope that it will be useful, */
10 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
11 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
12 /* GNU General Public License for more details. */
13 
14 /* You should have received a copy of the GNU General Public License */
15 /* along with this program. If not, see <http://www.gnu.org/licenses/>. */
16 
17 #include "Common.h"
18 #include "HPhiTrans.h"
19 #include "FileIO.h"
20 #include "wrapperMPI.h"
21 
45 int HPhiTrans(struct BindStruct *X) {
46  FILE *fp_err;
47  char sdt_err[D_FileNameMax];
48 
49  int i, k;
50  int cnt_trans;
51 
52  strcpy(sdt_err, cFileNameWarningOnTransfer);
53  if (childfopenMPI(sdt_err, "w", &fp_err) != 0) {
54  return -1;
55  }
56  fclose(fp_err);
57 
58  //Transefer
59  cnt_trans = 0;
60 
61  for (i = 0; i < X->Def.EDNTransfer; i++) {
62  // eliminate double counting
63  for (k = 0; k < cnt_trans; k++) {
64  if (X->Def.EDGeneralTransfer[i][1] == X->Def.EDGeneralTransfer[k][1]
65  && X->Def.EDGeneralTransfer[i][3] == X->Def.EDGeneralTransfer[k][3]) {
66  if (X->Def.EDGeneralTransfer[i][0] == X->Def.EDGeneralTransfer[k][0]
67  && X->Def.EDGeneralTransfer[i][2] == X->Def.EDGeneralTransfer[k][2]) {
68  sprintf(sdt_err, "%s", cErrTransfer);
69  childfopenMPI(sdt_err, "a", &fp_err);
70  fprintf(fp_err, cErrDoubleCounting, X->Def.EDGeneralTransfer[k][0], X->Def.EDGeneralTransfer[k][2],
71  X->Def.EDGeneralTransfer[k][1], X->Def.EDGeneralTransfer[k][3]);
72  fclose(fp_err);
73  }
74  }
75  }
76  cnt_trans += 1;
77  }
78 
79  return 0;
80 }
81 
92 int TransferWithPeierls(struct BindStruct *X, const double time) {
93  FILE *fp_err;
94  char sdt_err[D_FileNameMax];
95 
96  int i, k;
97  int cnt_trans;
98 
99  int ri_x, rj_x;
100  int ri_y, rj_y;
101  int isite1, isite2;
102  int isigma1, isigma2;
103  double complex dir;
104  const int Mode = (int) (X->Def.ParaLaser[0]);
105  const double Avp = X->Def.ParaLaser[1];
106  const double omega = X->Def.ParaLaser[2];
107  const double time_d = X->Def.ParaLaser[3];
108  const double time_c = X->Def.ParaLaser[4];
109  const int Lx = (int) (X->Def.ParaLaser[5]);
110  const int Ly = (int) (X->Def.ParaLaser[6]);
111  const double dirX = X->Def.ParaLaser[7];
112  const double dirY = X->Def.ParaLaser[8];
113  const double dt = time - time_c;
114  const double dt2 = time - (time_c + time_d);
115  const double td = time_c / 3.0;
116  double VecPot;
117 
118  //printf("Make Trasfer with Pierles factor");
119 
120  if (Mode == 0) {//Gaussian Wave
121  VecPot = Avp * cos(omega * dt) * exp(-dt * dt / (2.0 * time_d * time_d));
122  } else if (Mode == 1) {//Cosine Wave
123  VecPot = Avp * sin(omega * dt);
124  } else if (Mode == 2) {//DC Limit
125  VecPot = Avp * dt;
126  } else if (Mode == 3) {//Pulse
127  VecPot = Avp * exp(-time_d * dt);
128  } else if (Mode == 4) {//Linear
129  if (dt <= 0.0) {
130  VecPot = 0.0;
131  } else if (dt < time_d) {
132  VecPot = Avp * cos(omega * dt) * (dt / time_d);
133  } else {
134  VecPot = Avp * cos(omega * dt);
135  }
136  } else if (Mode == 5) {//Linear
137  if (time <= 0.0) {
138  VecPot = 0.0;
139  } else if (time < time_c) {
140  VecPot = Avp * cos(omega * dt) * exp(-dt * dt / (2.0 * td * td));
141  } else if (time < time_c + time_d) {
142  VecPot = Avp * cos(omega * dt);
143  } else {
144  VecPot = Avp * cos(omega * dt) * exp(-dt2 * dt2 / (2.0 * td * td));
145  }
146  }
147 
148  for (i = 0; i < X->Def.EDNTransfer; i++) {
149  ri_x = X->Def.EDGeneralTransfer[i][0] % Lx;
150  rj_x = X->Def.EDGeneralTransfer[i][2] % Lx;
151  ri_y = X->Def.EDGeneralTransfer[i][0] / Lx;
152  rj_y = X->Def.EDGeneralTransfer[i][2] / Lx;
153  if (ri_x - rj_x > 1) {
154  rj_x += Lx;
155  } else if (ri_x - rj_x < -1) {
156  rj_x -= Lx;
157  }
158  if (ri_y - rj_y > 1) {
159  rj_y += Ly;
160  } else if (ri_y - rj_y < -1) {
161  rj_y -= Ly;
162  }
163  dir = dirX * (ri_x - rj_x) + dirY * (ri_y - rj_y);
164 
165  X->Def.EDParaGeneralTransfer[i] = X->Def.ParaGeneralTransfer[i] * cexp(-I * VecPot * dir);
166  }
167 
168  return 0;
169 }
170 
181 int TransferForQuench(struct BindStruct *X, const double time) {
182  FILE *fp_err;
183  char sdt_err[D_FileNameMax];
184 
185  int i, k;
186  int cnt_trans;
187 
188  int ri_x, rj_x;
189  int ri_y, rj_y;
190  int isite1, isite2;
191  int isigma1, isigma2;
192  double complex dir;
193  const int Mode = (int) (X->Def.ParaLaser[0]);
194  const double Avp = X->Def.ParaLaser[1];
195  const double omega = X->Def.ParaLaser[2];
196  const double time_d = X->Def.ParaLaser[3];
197  const double time_c = X->Def.ParaLaser[4];
198  const int Lx = (int) (X->Def.ParaLaser[5]);
199  const int Ly = (int) (X->Def.ParaLaser[6]);
200  const double dirX = X->Def.ParaLaser[7];
201  const double dirY = X->Def.ParaLaser[8];
202  const double dt = time - time_c;
203  double Bessel;
204 
205  //printf("Make Trasfer with Pierles factor");
206 
207  if (Mode == 0) {//Gaussian Wave
208  if (dt <= 0.0) {
209  Bessel = 0.0;
210  } else if (dt < time_d) {
211  Bessel = j0(Avp * dt / time_d);
212  } else {
213  Bessel = j0(Avp);
214  }
215  }
216 
217  for (i = 0; i < X->Def.EDNTransfer; i++) {
218  ri_x = X->Def.EDGeneralTransfer[i][0] % Lx;
219  rj_x = X->Def.EDGeneralTransfer[i][2] % Lx;
220  ri_y = X->Def.EDGeneralTransfer[i][0] / Lx;
221  rj_y = X->Def.EDGeneralTransfer[i][2] / Lx;
222  if (ri_x - rj_x > 1) {
223  rj_x += Lx;
224  } else if (ri_x - rj_x < -1) {
225  rj_x -= Lx;
226  }
227  if (ri_y - rj_y > 1) {
228  rj_y += Ly;
229  } else if (ri_y - rj_y < -1) {
230  rj_y -= Ly;
231  }
232  dir = dirX * (ri_x - rj_x) + dirY * (ri_y - rj_y);
233 
234  X->Def.EDParaGeneralTransfer[i] = X->Def.ParaGeneralTransfer[i] * Bessel;
235  }
236 
237  return 0;
238 }
239 
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
char * cErrTransfer
Error Message in HPhiTrans.c.
Definition: ErrorMessage.c:32
int TransferWithPeierls(struct BindStruct *X, const double time)
Function of getting transfer with peierls.
Definition: HPhiTrans.c:92
#define D_FileNameMax
Definition: global.h:23
int childfopenMPI(const char *_cPathChild, const char *_cmode, FILE **_fp)
Only the root process open file in output/ directory.
Definition: FileIO.c:27
int ** EDGeneralTransfer
Index of transfer integrals for calculation. malloc in setmem_def(). Data Format [DefineList::NTransf...
Definition: struct.h:110
double * ParaLaser
Definition: struct.h:251
char * cErrDoubleCounting
Definition: ErrorMessage.c:33
double complex * ParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
Definition: struct.h:113
Bind.
Definition: struct.h:409
double complex * EDParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
Definition: struct.h:116
int TransferForQuench(struct BindStruct *X, const double time)
Function of getting transfer for quench.
Definition: HPhiTrans.c:181
unsigned int EDNTransfer
Number of transfer integrals for calculation.
Definition: struct.h:105
struct EDMainCalStruct X
Definition: struct.h:432
const char * cFileNameWarningOnTransfer
Definition: global.c:36
int HPhiTrans(struct BindStruct *X)
Function of checking transfers not to count the same type of operators. .
Definition: HPhiTrans.c:45