HΦ  3.2.0
CalcSpectrumByFullDiag.c
Go to the documentation of this file.
1 /* HPhi - Quantum Lattice Model Simulator */
2 /* Copyright (C) 2015 Takahiro Misawa, Kazuyoshi Yoshimi, Mitsuaki Kawamura, Youhei Yamaji, Synge Todo, Naoki Kawashima */
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/>. */
20 #include <complex.h>
21 #include "global.h"
22 #include <time.h>
23 #include "struct.h"
24 #include "lapack_diag.h"
25 #include "makeHam.h"
26 #include "CalcTime.h"
27 
28 void zcopy_(int *n, double complex *x, int *incx, double complex *y, int *incy);
29 void zdotc_(double complex *xy, int *n, double complex *x, int *incx, double complex *y, int *incy);
38  struct EDMainCalStruct *X,
39  int Nomega,
40  double complex *dcSpectrum,
41  double complex *dcomega
42 )
43 {
44  int idim, jdim, iomega;
45  int idim_max_int;
46  int incr=1;
52  idim_max_int = (int)X->Bind.Check.idim_max;
53  zcopy_(&idim_max_int, &v0[1], &incr, &vg[0], &incr);
54 
55  StartTimer(6301);
56  makeHam(&(X->Bind));
57  StopTimer(6301);
62  StartTimer(6302);
63  lapack_diag(&(X->Bind));
64  StopTimer(6302);
69  StartTimer(6303);
70 
71  for (idim = 0; idim < idim_max_int; idim++) {
72  v1[idim] = 0.0;
73  for (jdim = 0; jdim < idim_max_int; jdim++) v1[idim] += conj(vg[jdim]) * L_vec[idim][jdim];
74  //zdotc_(&v1[idim], &idim_max_int, &vg[0], &incr, &L_vec[idim][0], &incr);
75  v1[idim] = conj(v1[idim]) * v1[idim];
76  }/*for (idim = 0; idim < idim_max_int; idim++)*/
77  StopTimer(6303);
86  StartTimer(6304);
87  for (iomega = 0; iomega < Nomega; iomega++) {
88  dcSpectrum[iomega] = 0.0;
89  for (idim = 0; idim < idim_max_int; idim++) {
90  dcSpectrum[iomega] += v1[idim] / (dcomega[iomega] - v0[idim]);
91  }/*for (idim = 0; idim < idim_max_int; idim++)*/
92  }/*for (iomega = 0; iomega < Nomega; iomega++)*/
93  StopTimer(6304);
94  return TRUE;
95 }/*CalcSpectrumByFullDiag*/
96 
void StartTimer(int n)
function for initializing elapse time [start]
Definition: time.c:71
unsigned long int idim_max
The dimension of the Hilbert space of this process.
Definition: struct.h:303
int CalcSpectrumByFullDiag(struct EDMainCalStruct *X, int Nomega, double complex *dcSpectrum, double complex *dcomega)
Compute the Green function with the Lehmann representation and FD .
void StopTimer(int n)
function for calculating elapse time [elapse time=StartTimer-StopTimer]
Definition: time.c:83
double complex * v1
Definition: global.h:35
int lapack_diag(struct BindStruct *X)
performing full diagonalization using lapack
Definition: lapack_diag.c:35
int makeHam(struct BindStruct *X)
Making Hamiltonian for the full diagonalization method. The Hamiltonian is stored in the two dimensio...
Definition: makeHam.c:55
#define TRUE
Definition: global.h:26
Bind.
Definition: struct.h:419
Binded struct.
void zdotc_(double complex *xy, int *n, double complex *x, int *incx, double complex *y, int *incy)
double complex ** L_vec
Definition: global.h:74
double complex * vg
Definition: global.h:41
struct EDMainCalStruct X
Definition: struct.h:432
void zcopy_(int *n, double complex *x, int *incx, double complex *y, int *incy)
double complex * v0
Definition: global.h:34
struct CheckList Check
Size of the Hilbert space.
Definition: struct.h:411
struct BindStruct Bind
Binded struct.
Definition: struct.h:420