HΦ  3.2.0
HPhiTrans.c File Reference

Check the inputted transfer integrals. More...

#include "Common.h"
#include "HPhiTrans.h"
#include "FileIO.h"
#include "wrapperMPI.h"
+ Include dependency graph for HPhiTrans.c:

Go to the source code of this file.

Functions

int HPhiTrans (struct BindStruct *X)
 Function of checking transfers not to count the same type of operators.
. More...
 
int TransferWithPeierls (struct BindStruct *X, const double time)
 Function of getting transfer with peierls. More...
 
int TransferForQuench (struct BindStruct *X, const double time)
 Function of getting transfer for quench. More...
 

Detailed Description

Check the inputted transfer integrals.

Version
0.1
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Definition in file HPhiTrans.c.

Function Documentation

◆ HPhiTrans()

int HPhiTrans ( struct BindStruct X)

Function of checking transfers not to count the same type of operators.
.

Note
The same type transfer integrals such as \( t^{(1)}_{ij}c_i a_j + t^{(2)}_{ij}c_i a_j \) should be summarized as \( t_{ij} c_i a_j \) before calling this function.
Parameters
X[in] Struct to get the information of the operators of transfer integrals.
Return values
0normally finished
-1unnormally finished
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Definition at line 45 of file HPhiTrans.c.

References cErrDoubleCounting, cErrTransfer, cFileNameWarningOnTransfer, childfopenMPI(), D_FileNameMax, BindStruct::Def, DefineList::EDGeneralTransfer, and DefineList::EDNTransfer.

Referenced by main().

45  {
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 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
char * cErrTransfer
Error Message in HPhiTrans.c.
Definition: ErrorMessage.c:32
#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
char * cErrDoubleCounting
Definition: ErrorMessage.c:33
unsigned int EDNTransfer
Number of transfer integrals for calculation.
Definition: struct.h:105
const char * cFileNameWarningOnTransfer
Definition: global.c:36
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TransferForQuench()

int TransferForQuench ( struct BindStruct X,
const double  time 
)

Function of getting transfer for quench.

Note
Not used now and should be delete in ver.2.1.
Parameters
Xdata list for calculation
timetime
Return values
0normally finished
-1unnormally finished
Author
Kota Ido (The University of Tokyo)

Definition at line 181 of file HPhiTrans.c.

References D_FileNameMax, BindStruct::Def, DefineList::EDGeneralTransfer, DefineList::EDNTransfer, DefineList::EDParaGeneralTransfer, DefineList::ParaGeneralTransfer, and DefineList::ParaLaser.

181  {
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 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
#define D_FileNameMax
Definition: global.h:23
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
double complex * ParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
Definition: struct.h:113
double complex * EDParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
Definition: struct.h:116
unsigned int EDNTransfer
Number of transfer integrals for calculation.
Definition: struct.h:105

◆ TransferWithPeierls()

int TransferWithPeierls ( struct BindStruct X,
const double  time 
)

Function of getting transfer with peierls.

Note
Not used now and should be delete in ver.2.1.
Parameters
Xdata list for calculation
timetime
Return values
0normally finished
-1unnormally finished
Author
Kota Ido (The University of Tokyo)

Definition at line 92 of file HPhiTrans.c.

References D_FileNameMax, BindStruct::Def, DefineList::EDGeneralTransfer, DefineList::EDNTransfer, DefineList::EDParaGeneralTransfer, DefineList::ParaGeneralTransfer, and DefineList::ParaLaser.

Referenced by CalcByTEM().

92  {
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 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
#define D_FileNameMax
Definition: global.h:23
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
double complex * ParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
Definition: struct.h:113
double complex * EDParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
Definition: struct.h:116
unsigned int EDNTransfer
Number of transfer integrals for calculation.
Definition: struct.h:105
+ Here is the caller graph for this function: