HΦ  3.2.0
CalcSpectrumByFullDiag.c File Reference

Functions to perform spectrum calculations with the full-diagonalization method. More...

#include <complex.h>
#include "global.h"
#include <time.h>
#include "struct.h"
#include "lapack_diag.h"
#include "makeHam.h"
#include "CalcTime.h"
+ Include dependency graph for CalcSpectrumByFullDiag.c:

Go to the source code of this file.

Functions

void zcopy_ (int *n, double complex *x, int *incx, double complex *y, int *incy)
 
void zdotc_ (double complex *xy, int *n, double complex *x, int *incx, double complex *y, int *incy)
 
int CalcSpectrumByFullDiag (struct EDMainCalStruct *X, int Nomega, double complex *dcSpectrum, double complex *dcomega)
 Compute the Green function with the Lehmann representation and FD

\[ G(z) = \sum_n \frac{|\langle n|c|0\rangle|^2}{z - E_n} \]

. More...

 

Detailed Description

Functions to perform spectrum calculations with the full-diagonalization method.

Definition in file CalcSpectrumByFullDiag.c.

Function Documentation

◆ CalcSpectrumByFullDiag()

int CalcSpectrumByFullDiag ( struct EDMainCalStruct X,
int  Nomega,
double complex *  dcSpectrum,
double complex *  dcomega 
)

Compute the Green function with the Lehmann representation and FD

\[ G(z) = \sum_n \frac{|\langle n|c|0\rangle|^2}{z - E_n} \]

.

Author
Mitsuaki Kawamura (The University of Tokyo)
  • Generate fully stored Hamiltonian. Because v0 & v1 are overwritten, copy v0 into vg.

  • v0 becomes eigenvalues in lapack_diag(), and L_vec becomes eigenvectors

  • Compute \(|\langle n|c|0\rangle|^2\) for all \(n\) and store them into v1, where \(c|0\rangle\) is vg.

  • Compute spectrum

    \[ \sum_n \frac{|\langle n|c|0\rangle|^2}{z - E_n} \]

Parameters
[in,out]X
[in]NomegaNumber of frequencies
[out]dcSpectrum[Nomega] Spectrum
[in]dcomega[Nomega] Frequency

Definition at line 37 of file CalcSpectrumByFullDiag.c.

References EDMainCalStruct::Bind, BindStruct::Check, CheckList::idim_max, L_vec, lapack_diag(), makeHam(), StartTimer(), StopTimer(), TRUE, v0, v1, vg, and zcopy_().

Referenced by CalcSpectrum().

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*/
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
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
double complex ** L_vec
Definition: global.h:74
double complex * vg
Definition: global.h:41
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
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ zcopy_()

void zcopy_ ( int *  n,
double complex *  x,
int *  incx,
double complex *  y,
int *  incy 
)

Referenced by CalcSpectrumByFullDiag().

+ Here is the caller graph for this function:

◆ zdotc_()

void zdotc_ ( double complex *  xy,
int *  n,
double complex *  x,
int *  incx,
double complex *  y,
int *  incy 
)