Exemplo n.º 1
0
T_e = tcalc.get_transmission()
pylab.plot(tcalc.energies, T_e)
pylab.title('Transmission function')
pylab.show()

tcalc.set(pdos=[2, 3])
pdos_ne = tcalc.get_pdos()
pylab.plot(tcalc.energies, pdos_ne[0], ':')
pylab.plot(tcalc.energies, pdos_ne[1], '--')
pylab.title('Projected density of states')
pylab.show()

h_rot, s_rot, eps_n, vec_nn = tcalc.subdiagonalize_bfs([2, 3])
tcalc.set(h=h_rot, s=s_rot)  # Set the rotated matrices
for n in range(2):
    print("eigenvalue, eigenvector:", eps_n[n], ',', vec_nn[:, n])

pdos_rot_ne = tcalc.get_pdos()
pylab.plot(tcalc.energies, pdos_rot_ne[0], ':')
pylab.plot(tcalc.energies, pdos_rot_ne[1], '--')
pylab.title('Projected density of states (rotated)')
pylab.show()

h_cut, s_cut = tcalc.cutcoupling_bfs([2])
tcalc.set(h=h_cut, s=s_cut)
T_cut_bonding_e = tcalc.get_transmission()
pylab.plot(tcalc.energies, T_cut_bonding_e)
pylab.title('Transmission (bonding orbital cut)')
pylab.show()
Exemplo n.º 2
0
def test_transport_calculator():
    H_lead = np.zeros([4, 4])

    # On-site energies are zero
    for i in range(4):
        H_lead[i, i] = 0.0

    # Nearest neighbor hopping is -1.0
    for i in range(3):
        H_lead[i, i + 1] = -1.0
        H_lead[i + 1, i] = -1.0

    # Next-nearest neighbor hopping is 0.2
    for i in range(2):
        H_lead[i, i + 2] = 0.2
        H_lead[i + 2, i] = 0.2

    H_scat = np.zeros([6, 6])
    # Principal layers on either side of S
    H_scat[:2, :2] = H_lead[:2, :2]
    H_scat[-2:, -2:] = H_lead[:2, :2]

    # Scattering region
    H_scat[2, 2] = 0.0
    H_scat[3, 3] = 0.0
    H_scat[2, 3] = -0.8
    H_scat[3, 2] = -0.8

    # External coupling
    H_scat[1, 2] = 0.2
    H_scat[2, 1] = 0.2
    H_scat[3, 4] = 0.2
    H_scat[4, 3] = 0.2

    energies = np.arange(-3, 3, 0.02)
    tcalc = TransportCalculator(h=H_scat,
                                h1=H_lead,
                                eta=0.02,
                                energies=energies)

    T = tcalc.get_transmission()
    tcalc.set(pdos=[2, 3])
    pdos = tcalc.get_pdos()

    tcalc.set(dos=True)
    dos = tcalc.get_dos()

    write('T.dat', tcalc.energies, T)
    write('pdos0.dat', tcalc.energies, pdos[0])
    write('pdos1.dat', tcalc.energies, pdos[1])

    #subdiagonalize
    h_rot, s_rot, eps, u = tcalc.subdiagonalize_bfs([2, 3], apply=True)
    T_rot = tcalc.get_transmission()
    dos_rot = tcalc.get_dos()
    pdos_rot = tcalc.get_pdos()

    write('T_rot.dat', tcalc.energies, T_rot)
    write('pdos0_rot.dat', tcalc.energies, pdos_rot[0])
    write('pdos1_rot.dat', tcalc.energies, pdos_rot[1])

    print('Subspace eigenvalues:', eps)
    assert sum(abs(eps - (-0.8, 0.8))) < 2.0e-15, 'Subdiagonalization. error'
    print('Max deviation of T after the rotation:', np.abs(T - T_rot).max())
    assert max(abs(T - T_rot)) < 2.0e-15, 'Subdiagonalization. error'

    #remove coupling
    h_cut, s_cut = tcalc.cutcoupling_bfs([2], apply=True)
    T_cut = tcalc.get_transmission()
    dos_cut = tcalc.get_dos()
    pdos_cut = tcalc.get_pdos()

    write('T_cut.dat', tcalc.energies, T_cut)
    write('pdos0_cut.dat', tcalc.energies, pdos_cut[0])
    write('pdos1_cut.dat', tcalc.energies, pdos_cut[1])
Exemplo n.º 3
0
dos = tcalc.get_dos()

write('T.dat', tcalc.energies, T)
write('pdos0.dat', tcalc.energies, pdos[0])
write('pdos1.dat', tcalc.energies, pdos[1])

#subdiagonalize
h_rot, s_rot, eps, u = tcalc.subdiagonalize_bfs([2, 3], apply=True)
T_rot = tcalc.get_transmission()
dos_rot = tcalc.get_dos()
pdos_rot = tcalc.get_pdos()

write('T_rot.dat', tcalc.energies, T_rot)
write('pdos0_rot.dat', tcalc.energies, pdos_rot[0])
write('pdos1_rot.dat', tcalc.energies, pdos_rot[1])

print('Subspace eigenvalues:', eps)
assert sum(abs(eps - (-0.8, 0.8))) < 2.0e-15, 'Subdiagonalization. error'
print('Max deviation of T after the rotation:', np.abs(T - T_rot).max())
assert max(abs(T - T_rot)) < 2.0e-15, 'Subdiagonalization. error'

#remove coupling
h_cut, s_cut = tcalc.cutcoupling_bfs([2], apply=True)
T_cut = tcalc.get_transmission()
dos_cut = tcalc.get_dos()
pdos_cut = tcalc.get_pdos()

write('T_cut.dat', tcalc.energies, T_cut)
write('pdos0_cut.dat', tcalc.energies, pdos_cut[0])
write('pdos1_cut.dat', tcalc.energies, pdos_cut[1])
Exemplo n.º 4
0
pylab.title('Transmission function')
pylab.show()

# ... and the projected density of states (pdos) of the H2 molecular orbitals
tcalc.set(pdos=bfs)
pdos_ne = tcalc.get_pdos()
pylab.plot(tcalc.energies, pdos_ne[0], label='bonding')
pylab.plot(tcalc.energies, pdos_ne[1], label='anti-bonding')
pylab.title('Projected density of states')
pylab.legend()
pylab.show()

# Cut the coupling to the anti-bonding orbital.
print('Cutting the coupling to the renormalized molecular state at %.2f eV' %
      (eps_n[1]))
h_rot_cut, s_rot_cut = tcalc.cutcoupling_bfs([bfs[1]])
tcalc.set(h=h_rot_cut, s=s_rot_cut)
pylab.plot(tcalc.energies, tcalc.get_transmission())
pylab.title('Transmission without anti-bonding orbital')
pylab.show()

# Cut the coupling to the bonding-orbital.
print('Cutting the coupling to the renormalized molecular state at %.2f eV' %
      (eps_n[0]))
tcalc.set(h=h_rot, s=s_rot)
h_rot_cut, s_rot_cut = tcalc.cutcoupling_bfs([bfs[0]])
tcalc.set(h=h_rot_cut, s=s_rot_cut)
pylab.plot(tcalc.energies, tcalc.get_transmission())
pylab.title('Transmission without bonding orbital')
pylab.show()
T_e = tcalc.get_transmission()
pylab.plot(tcalc.energies, T_e)
pylab.title('Transmission function')
pylab.show()

tcalc.set(pdos=[2, 3])
pdos_ne = tcalc.get_pdos()
pylab.plot(tcalc.energies, pdos_ne[0], ':')
pylab.plot(tcalc.energies, pdos_ne[1], '--')
pylab.title('Projected density of states')
pylab.show()

h_rot, s_rot, eps_n, vec_nn = tcalc.subdiagonalize_bfs([2, 3])
tcalc.set(h=h_rot, s=s_rot)  # Set the rotated matrices
for n in range(2):
    print("eigenvalue, eigenvector:", eps_n[n], ',', vec_nn[:, n])

pdos_rot_ne = tcalc.get_pdos()
pylab.plot(tcalc.energies, pdos_rot_ne[0], ':')
pylab.plot(tcalc.energies, pdos_rot_ne[1], '--')
pylab.title('Projected density of states (rotated)')
pylab.show()

h_cut, s_cut = tcalc.cutcoupling_bfs([2])
tcalc.set(h=h_cut, s=s_cut)
T_cut_bonding_e = tcalc.get_transmission()
pylab.plot(tcalc.energies, T_cut_bonding_e)
pylab.title('Transmission (bonding orbital cut)')
pylab.show()
write('T.dat',tcalc.energies,T)
write('pdos0.dat', tcalc.energies,pdos[0])
write('pdos1.dat', tcalc.energies,pdos[1])

#subdiagonalize
h_rot, s_rot, eps, u = tcalc.subdiagonalize_bfs([2, 3], apply=True)
T_rot = tcalc.get_transmission()
dos_rot = tcalc.get_dos()
pdos_rot = tcalc.get_pdos()

write('T_rot.dat', tcalc.energies,T_rot)
write('pdos0_rot.dat', tcalc.energies, pdos_rot[0])
write('pdos1_rot.dat', tcalc.energies, pdos_rot[1])

print 'Subspace eigenvalues:', eps
assert sum(abs(eps-(-0.8, 0.8))) < 2.0e-15, 'Subdiagonalization. error'
print 'Max deviation of T after the rotation:', np.abs(T-T_rot).max()
assert max(abs(T-T_rot)) < 2.0e-15, 'Subdiagonalization. error'

#remove coupling
h_cut, s_cut = tcalc.cutcoupling_bfs([2], apply=True)
T_cut = tcalc.get_transmission()
dos_cut = tcalc.get_dos()
pdos_cut = tcalc.get_pdos()

write('T_cut.dat', tcalc.energies, T_cut)
write('pdos0_cut.dat', tcalc.energies,pdos_cut[0])
write('pdos1_cut.dat', tcalc.energies,pdos_cut[1])

pylab.title('Transmission function')
pylab.show()

# ... and the projected density of states (pdos) of the H2 molecular orbitals
tcalc.set(pdos=bfs)
pdos_ne = tcalc.get_pdos()
pylab.plot(tcalc.energies, pdos_ne[0], label='bonding')
pylab.plot(tcalc.energies, pdos_ne[1], label='anti-bonding')
pylab.title('Projected density of states')
pylab.legend()
pylab.show()

# Cut the coupling to the anti-bonding orbital.
print('Cutting the coupling to the renormalized molecular state at %.2f eV' % (
    eps_n[1]))
h_rot_cut, s_rot_cut = tcalc.cutcoupling_bfs([bfs[1]])
tcalc.set(h=h_rot_cut, s=s_rot_cut)
pylab.plot(tcalc.energies, tcalc.get_transmission())
pylab.title('Transmission without anti-bonding orbital')
pylab.show()

# Cut the coupling to the bonding-orbital.
print('Cutting the coupling to the renormalized molecular state at %.2f eV' % (
    eps_n[0]))
tcalc.set(h=h_rot, s=s_rot)
h_rot_cut, s_rot_cut = tcalc.cutcoupling_bfs([bfs[0]])
tcalc.set(h=h_rot_cut, s=s_rot_cut)
pylab.plot(tcalc.energies, tcalc.get_transmission())
pylab.title('Transmission without bonding orbital')
pylab.show()