File: TRAN_Calc_CentGreen.c

package info (click to toggle)
openmx 3.2.4.dfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: lenny, squeeze
  • size: 62,572 kB
  • ctags: 2,684
  • sloc: ansic: 130,666; python: 876; makefile: 560; xml: 63; perl: 18; sh: 4
file content (85 lines) | stat: -rw-r--r-- 1,980 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#ifdef nompi
#include "mimic_mpi.h"
#else
#include <mpi.h>
#endif


#include "tran_prototypes.h"

void TRAN_Calc_CentGreen(
                      dcomplex w,
                      int nc,
                      dcomplex *sigmaL,
                      dcomplex *sigmaR,
                      dcomplex *HCC,
                      dcomplex *SCC,
                      dcomplex *GC /* output */
                      )
;

/* interface from fortran */
void tran_calc_centgreen( dcomplex *w, int *nc, dcomplex *sigmaL, dcomplex *sigmaR,
                          dcomplex *HCC, dcomplex *SCC, dcomplex *GC)
{
  TRAN_Calc_CentGreen( *w, *nc, sigmaL, sigmaR, HCC, SCC, GC); 
}


/*
 *  calculate G(w) = ( w SCC - HCC - SigmaL -SigmaR ) ^-1 
 *
 * charge is calculated as 
 *     -1/PI int dw Im G(w+id) 
 *        -1/PI *dw is included in w_weight[]
 *
 *  no implicit variables 
 */
void TRAN_Calc_CentGreen(
			 /* input */
			 dcomplex w,
			 int nc, 
			 dcomplex *sigmaL,
			 dcomplex *sigmaR, 
			 dcomplex *HCC,
			 dcomplex *SCC,
			 dcomplex *GC /* output */
			 )
#define HCC_ref(i,j) HCC[nc*((j)-1)+(i)-1]
#define SCC_ref(i,j) SCC[nc*((j)-1)+(i)-1]

#define GC_ref(i,j)  GC[nc*((j)-1)+(i)-1]
#define sigmaL_ref(i,j) sigmaL[nc*((j)-1)+(i)-1]
#define sigmaR_ref(i,j) sigmaR[nc*((j)-1)+(i)-1]

{
  int i,j;
  int pos;

  /* w SCC - HCC - SigmaL -SigmaR */
    
  for (i=1;i<=nc;i++) {
    for (j=1;j<=nc;j++) {

#if 0
      GC_ref(i,j).r = w.r*SCC_ref(i,j).r - w.i*SCC_ref(i,j).i - HCC_ref(i,j).r ;
      GC_ref(i,j).i = w.r*SCC_ref(i,j).i + w.i*SCC_ref(i,j).r - HCC_ref(i,j).i ;
#else
      GC_ref(i,j).r = w.r*SCC_ref(i,j).r - w.i*SCC_ref(i,j).i - HCC_ref(i,j).r
                     - sigmaL_ref(i,j).r - sigmaR_ref(i,j).r;
      GC_ref(i,j).i = w.r*SCC_ref(i,j).i + w.i*SCC_ref(i,j).r - HCC_ref(i,j).i
                     - sigmaL_ref(i,j).i - sigmaR_ref(i,j).i;
#endif

    }
  }

  Lapack_LU_Zinverse(nc,GC);
}