if True:
    # Test also hubbard.negf in the WBL approximation for gamma=0.
    # We will compare with the density and Etot obtained from diagonalization
    # at kT=0.025 (temperature of the CC)
    H.kT = 0.025
    H.random_density()
    mixer.clear()
    dn = H.converge(density.calc_n, tol=1e-10, steps=10, mixer=mixer)
    Etot0 = H.Etot
    n = 1 * H.n

    # Obtain DOS for the finite molecule with Lorentzian distribution
    egrid = np.linspace(-1, 1, 50)
    import hubbard.plot as plot
    H.H.shift(-H.fermi_level())
    p = plot.DOS(H, egrid, eta=1e-2, spin=0)

    # Now compute same molecule with the WBL approximation with gamma=0
    from hubbard.negf import NEGF
    elec = sisl.WideBandSE(2, 0.)
    negf = NEGF(H, [elec], [[0, 1]])
    # This is to use a better guess for the device potential
    negf.Ef = H.find_midgap()
    negf.eta = 1e-2
    mixer.clear()
    dn = H.converge(negf.calc_n_open,
                    mixer=mixer,
                    tol=1e-10,
                    func_args={'qtol': 1e-4},
                    steps=1,
Exemple #2
0
success = MFH_elec.read_density('elec_density.nc')
if not success:
    # If no densities saved, start with random densities with maximized polarization at the edges
    MFH_elec.random_density()
    MFH_elec.set_polarization([0], dn=[9])

# Converge Electrode Hamiltonians
dn = MFH_elec.converge(density.calc_n, mixer=mixer)
# Write also densities for future calculations
MFH_elec.write_density('elec_density.nc')
# Plot spin polarization of electrodes
p = plot.SpinPolarization(MFH_elec, colorbar=True)
p.savefig('spin_elecs.pdf')

# Find Fermi level of reservoirs and write to netcdf file
Ef_elecs = MFH_elec.fermi_level(q=MFH_elec.q)
MFH_elec.H.shift(-Ef_elecs)
MFH_elec.H.write('MFH_elec.nc')

# Build central region TB Hamiltonian
HC = H_elec.tile(16, axis=0)
HC = HC.remove([67, 68, 69, 72, 73, 74, 77, 78, 79, 82, 83, 84, 87, 88, 89])
HC.set_nsc([1, 1, 1])
HC.geometry.write('device.xyz')

# Map electrodes in the device region
elec_indx = [range(len(H_elec)), range(len(HC.H) - len(H_elec), len(HC.H))]

# MFH object of the device
MFH_HC = HubbardHamiltonian(HC.H, U=U, kT=kT)
# Initial densities