File: parms.py

package info (click to toggle)
gpaw 21.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 14,492 kB
  • sloc: python: 121,997; ansic: 14,138; sh: 1,125; csh: 139; makefile: 43
file content (54 lines) | stat: -rw-r--r-- 1,217 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
import numpy as np

pos = np.asarray([1.450 * a for a in range(6)])
n = len(pos)
d2_ii = np.zeros((n, n))
for i1, i2 in np.ndindex(n, n):
    d2_ii[i1, i2] = ((pos[i1] - pos[i2])**2).sum()

d_ii = np.sqrt(d2_ii)
U = 11.26
t_m = -2.4
t_lm = -1.0
# Two particle interaction
V = U / np.sqrt(1.0 + 0.6117 * d2_ii)
V[0, -1] = V[-1, 0] = 0.0
V[0, 0] = V[-1, -1] = 0.0
# One particle part
mask_c = d_ii < 1.5
mask_c *= d_ii > 0.0
mask_c = mask_c.astype(int)
nbf = len(d_ii)
h = t_m * np.ones((nbf, nbf)) * mask_c
h[0, 1] = h[1, 0] = t_lm
h[-2, -1] = h[-1, -2] = t_lm

# H_lead
h1 = np.zeros((2, 2), complex)
t_l = -20.0
h1[0, 1] = t_l
h1[1, 0] = t_l
nbf = len(h)

# H_scat
H = np.zeros((nbf + 2, nbf + 2), complex)
H[0, 1] = H[1, 0] = t_l
H[-2, -1] = H[-1, -2] = t_l
H[1:-1, 1:-1] = h

# Hartree potential of the ions (Z=1)
ion_shift = np.zeros((n, n))
for i in range(n):
    ion_shift[i, i] += -0.5 * V[i, i]
    for k in range(n):
        if k != i:
            ion_shift[i, i] += -1.0 * V[i, k]

H = H.astype(complex)
V = V.astype(complex)
ion_shift = ion_shift.astype(complex)

if __name__ == '__main__':
    print(np.around(H.real, 2))
    print(np.around(V.real, 2))
    print(np.around(ion_shift.diagonal().real, 2))