HPhi++  3.1.0
HPhiTrans.cpp File Reference

Check the inputted transfer integrals. More...

#include "Common.hpp"
#include "HPhiTrans.hpp"
#include "FileIO.hpp"
#include "wrapperMPI.hpp"

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.cpp.

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.cpp.

References childfopenMPI(), 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, "WarningOnTransfer.dat");
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, "WarningOnTransfer.dat");
69  childfopenMPI(sdt_err, "a", &fp_err);
70  fprintf(fp_err, "double conuntings in transfers: i=%d j=%d spni %d spnj %d \n",
71  X->Def.EDGeneralTransfer[k][0], X->Def.EDGeneralTransfer[k][2],
72  X->Def.EDGeneralTransfer[k][1], X->Def.EDGeneralTransfer[k][3]);
73  fclose(fp_err);
74  }
75  }
76  }
77  cnt_trans += 1;
78  }
79 
80  return 0;
81 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
int ** EDGeneralTransfer
Index of transfer integrals for calculation. malloc in setmem_def(). Data Format [DefineList::NTransf...
Definition: struct.hpp:110
int EDNTransfer
Number of transfer integrals for calculation.
Definition: struct.hpp:105
int childfopenMPI(const char *_cPathChild, const char *_cmode, FILE **_fp)
Only the root process open file in output/ directory.
Definition: FileIO.cpp:27

◆ 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 175 of file HPhiTrans.cpp.

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

175  {
176  int i;
177  int ri_x, rj_x;
178  int ri_y, rj_y;
179  const int Mode = (int) (X->Def.ParaLaser[0]);
180  const double Avp = X->Def.ParaLaser[1];
181  const double time_d = X->Def.ParaLaser[3];
182  const double time_c = X->Def.ParaLaser[4];
183  const int Lx = (int) (X->Def.ParaLaser[5]);
184  const int Ly = (int) (X->Def.ParaLaser[6]);
185  const double dt = time - time_c;
186  double Bessel;
187 
188  //printf("Make Trasfer with Pierles factor");
189 
190  if (Mode == 0) {//Gaussian Wave
191  if (dt <= 0.0) {
192  Bessel = 0.0;
193  } else if (dt < time_d) {
194  Bessel = j0(Avp * dt / time_d);
195  } else {
196  Bessel = j0(Avp);
197  }
198  }
199 
200  for (i = 0; i < X->Def.EDNTransfer; i++) {
201  ri_x = X->Def.EDGeneralTransfer[i][0] % Lx;
202  rj_x = X->Def.EDGeneralTransfer[i][2] % Lx;
203  ri_y = X->Def.EDGeneralTransfer[i][0] / Lx;
204  rj_y = X->Def.EDGeneralTransfer[i][2] / Lx;
205  if (ri_x - rj_x > 1) {
206  rj_x += Lx;
207  } else if (ri_x - rj_x < -1) {
208  rj_x -= Lx;
209  }
210  if (ri_y - rj_y > 1) {
211  rj_y += Ly;
212  } else if (ri_y - rj_y < -1) {
213  rj_y -= Ly;
214  }
215 
216  X->Def.EDParaGeneralTransfer[i] = X->Def.ParaGeneralTransfer[i] * Bessel;
217  }
218 
219  return 0;
220 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
std::complex< double > * EDParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
Definition: struct.hpp:116
int ** EDGeneralTransfer
Index of transfer integrals for calculation. malloc in setmem_def(). Data Format [DefineList::NTransf...
Definition: struct.hpp:110
double * ParaLaser
Definition: struct.hpp:253
int EDNTransfer
Number of transfer integrals for calculation.
Definition: struct.hpp:105
std::complex< double > * ParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
Definition: struct.hpp:113

◆ 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 93 of file HPhiTrans.cpp.

References BindStruct::Def, DefineList::EDGeneralTransfer, DefineList::EDNTransfer, DefineList::EDParaGeneralTransfer, I(), DefineList::ParaGeneralTransfer, and DefineList::ParaLaser.

Referenced by CalcByTEM().

93  {
94  int i;
95  int ri_x, rj_x;
96  int ri_y, rj_y;
97  std::complex<double> dir;
98  const int Mode = (int) (X->Def.ParaLaser[0]);
99  const double Avp = X->Def.ParaLaser[1];
100  const double omega = X->Def.ParaLaser[2];
101  const double time_d = X->Def.ParaLaser[3];
102  const double time_c = X->Def.ParaLaser[4];
103  const int Lx = (int) (X->Def.ParaLaser[5]);
104  const int Ly = (int) (X->Def.ParaLaser[6]);
105  const double dirX = X->Def.ParaLaser[7];
106  const double dirY = X->Def.ParaLaser[8];
107  const double dt = time - time_c;
108  const double dt2 = time - (time_c + time_d);
109  const double td = time_c / 3.0;
110  double VecPot;
111 
112  //printf("Make Trasfer with Pierles factor");
113 
114  if (Mode == 0) {//Gaussian Wave
115  VecPot = Avp * cos(omega * dt) * exp(-dt * dt / (2.0 * time_d * time_d));
116  } else if (Mode == 1) {//Cosine Wave
117  VecPot = Avp * sin(omega * dt);
118  } else if (Mode == 2) {//DC Limit
119  VecPot = Avp * dt;
120  } else if (Mode == 3) {//Pulse
121  VecPot = Avp * exp(-time_d * dt);
122  } else if (Mode == 4) {//Linear
123  if (dt <= 0.0) {
124  VecPot = 0.0;
125  } else if (dt < time_d) {
126  VecPot = Avp * cos(omega * dt) * (dt / time_d);
127  } else {
128  VecPot = Avp * cos(omega * dt);
129  }
130  } else if (Mode == 5) {//Linear
131  if (time <= 0.0) {
132  VecPot = 0.0;
133  } else if (time < time_c) {
134  VecPot = Avp * cos(omega * dt) * exp(-dt * dt / (2.0 * td * td));
135  } else if (time < time_c + time_d) {
136  VecPot = Avp * cos(omega * dt);
137  } else {
138  VecPot = Avp * cos(omega * dt) * exp(-dt2 * dt2 / (2.0 * td * td));
139  }
140  }
141 
142  for (i = 0; i < X->Def.EDNTransfer; i++) {
143  ri_x = X->Def.EDGeneralTransfer[i][0] % Lx;
144  rj_x = X->Def.EDGeneralTransfer[i][2] % Lx;
145  ri_y = X->Def.EDGeneralTransfer[i][0] / Lx;
146  rj_y = X->Def.EDGeneralTransfer[i][2] / Lx;
147  if (ri_x - rj_x > 1) {
148  rj_x += Lx;
149  } else if (ri_x - rj_x < -1) {
150  rj_x -= Lx;
151  }
152  if (ri_y - rj_y > 1) {
153  rj_y += Ly;
154  } else if (ri_y - rj_y < -1) {
155  rj_y -= Ly;
156  }
157  dir = dirX * (ri_x - rj_x) + dirY * (ri_y - rj_y);
158 
159  X->Def.EDParaGeneralTransfer[i] = X->Def.ParaGeneralTransfer[i] * std::exp(-I * VecPot * dir);
160  }
161 
162  return 0;
163 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
std::complex< double > * EDParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
Definition: struct.hpp:116
std::complex< double > I(0.0, 1.0)
int ** EDGeneralTransfer
Index of transfer integrals for calculation. malloc in setmem_def(). Data Format [DefineList::NTransf...
Definition: struct.hpp:110
double * ParaLaser
Definition: struct.hpp:253
int EDNTransfer
Number of transfer integrals for calculation.
Definition: struct.hpp:105
std::complex< double > * ParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
Definition: struct.hpp:113