示例#1
0
def get_h_and_s(calc, spin=0, kpt=0):
    calc.atoms.set_calculator(calc)
    if calc.wfs.S_qMM is None:
        calc.wfs.set_positions(calc.spos_ac)
    tkpts_kc, tweights_k, H_skMM, S_kMM = get_lead_lcao_hamiltonian(
        calc, direction='x')
    fermi = calc.get_fermi_level()
    s = S_kMM[kpt]
    h = H_skMM[spin, kpt] - fermi * s
    remove_pbc(calc.atoms, h, s, d=0)
    return h, s
def get_hs(natoms, nkpts):
    calc = GPAW(h=0.25, mode='lcao', basis='sz', width=0.2, kpts=nkpts,
                mixer=Mixer(0.1, 5, weight=80.0), usesymm=False)
    atoms = Atoms('Na', pbc=True, cell=(L, L, L)).repeat(natoms)
    atoms.set_calculator(calc)
    atoms.get_potential_energy()
    fermi = calc.get_fermi_level()
    ibz, w, h, s = get_lead_lcao_hamiltonian(calc, direction=direction)
    h = h[0] - fermi * s
    for h1, s1 in zip(h, s):
        remove_pbc(atoms, h1, s1, d=dir)
    return ibz, w, h, s
def get_hs(natoms, nkpts):
    calc = GPAW(h=0.25,
                mode='lcao',
                basis='sz',
                width=0.2,
                kpts=nkpts,
                mixer=Mixer(0.1, 5, weight=80.0),
                usesymm=False)
    atoms = Atoms('Na', pbc=True, cell=(L, L, L)).repeat(natoms)
    atoms.set_calculator(calc)
    atoms.get_potential_energy()
    fermi = calc.get_fermi_level()
    ibz, w, h, s = get_lead_lcao_hamiltonian(calc, direction=direction)
    h = h[0] - fermi * s
    for h1, s1 in zip(h, s):
        remove_pbc(atoms, h1, s1, d=dir)
    return ibz, w, h, s
示例#4
0
def get_h_and_s(calc, direction='x'):
    '''
        The function below performs
            1. tri2full
            2. *= Hartree
            3. stack [0,0,0],[1,0,0]
    '''
    ibz_t_kc, weight_t_k, h_skmm, s_kmm = get_lead_lcao_hamiltonian(calc)
    '''
        The code below performs
            1. remove_pbc
            2. align_fermi
    '''
    d = 'xyz'.index(direction)
    nspins, nkpts = h_skmm.shape[:2]
    for s in range(nspins):
        for k in range(nkpts):
            if s==0:
                remove_pbc(atoms, h_skmm[s, k], s_kmm[k], d)
            else:
                remove_pbc(atoms, h_skmm[s, k], None, d)
            h_skmm[s, k] -= s_kmm[k] * calc.occupations.get_fermi_level()
    return h_skmm, s_kmm
示例#5
0
dir = 'xyz'.index(direction)
transverse_dirs = np.delete([0, 1, 2], [dir]).astype(int)
cell = [L, L, L]
cell[dir] = n * a

atoms = Atoms('Na'+str(n), pbc=1, cell=cell)
atoms.positions[:n, dir] = [i * a for i in range(len(atoms))]
atoms.positions[:, transverse_dirs] = L / 2.
atoms.set_calculator(calc)
calc.set(kpts=kpts, usesymm=usesymm)
atoms.get_potential_energy()

efermi = calc.get_fermi_level()
ibzk2d_k, weight2d_k, h_skmm, s_kmm\
= get_lead_lcao_hamiltonian(calc, direction=direction)
h_kmm = h_skmm[0] - efermi * s_kmm

T_kpts = np.zeros_like(energies)

i = 0
for h_mm, s_mm, weight in zip(h_kmm, s_kmm, weight2d_k):
    print i
    tc = TC(energies=energies,
            h=h_mm, s=s_mm,
            h1=h_mm, s1=s_mm,
            h2=h_mm, s2=s_mm,
            align_bf=0)
    tc.initialize()
    T_kpts += tc.get_transmission() * weight
    i += 1
示例#6
0
    xc='PBE',
    basis='szp(dzp)',
    occupations=FermiDirac(width=0.1),
    kpts=(4, 1, 1),  # More kpts needed as the x-direction is shorter
    mode='lcao',
    txt='pt_h2_lcao_llead.txt',
    mixer=Mixer(0.1, 5, weight=100.0),
    symmetry={
        'point_group': False,
        'time_reversal': False
    })
atoms.set_calculator(calc)

atoms.get_potential_energy()  # Converge everything!
Ef = atoms.calc.get_fermi_level()

ibz2d_k, weight2d_k, H_skMM, S_kMM = get_lead_lcao_hamiltonian(calc)
# Only use first kpt, spin, as there are no more
H, S = H_skMM[0, 0], S_kMM[0]
H -= Ef * S

# Dump the Hamiltonian and Scattering matrix to a pickle file
pickle.dump((H, S), open('lead1_hs.pickle', 'wb'), 2)

#########################
# Right principal layer #
#########################
# This is identical to the left prinicpal layer so we don't have to do anything
# Just dump the same Hamiltonian and Scattering matrix to a pickle file
pickle.dump((H, S), open('lead2_hs.pickle', 'wb'), 2)
示例#7
0
dir = 'xyz'.index(direction)
transverse_dirs = np.delete([0, 1, 2], [dir]).astype(int)
cell = [L, L, L]
cell[dir] = n * a

atoms = Atoms('Na' + str(n), pbc=1, cell=cell)
atoms.positions[:n, dir] = [i * a for i in range(len(atoms))]
atoms.positions[:, transverse_dirs] = L / 2.
atoms.set_calculator(calc)
calc.set(kpts=kpts, usesymm=usesymm)
atoms.get_potential_energy()

efermi = calc.get_fermi_level()
ibzk2d_k, weight2d_k, h_skmm, s_kmm\
= get_lead_lcao_hamiltonian(calc, direction=direction)
h_kmm = h_skmm[0] - efermi * s_kmm

T_kpts = np.zeros_like(energies)

i = 0
for h_mm, s_mm, weight in zip(h_kmm, s_kmm, weight2d_k):
    print i
    tc = TC(energies=energies,
            h=h_mm,
            s=s_mm,
            h1=h_mm,
            s1=s_mm,
            h2=h_mm,
            s2=s_mm,
            align_bf=0)
# Attach a GPAW calculator
calc = GPAW(h=0.3,
            xc='PBE',
            basis='szp(dzp)',
            occupations=FermiDirac(width=0.1),
            kpts=(4, 1, 1),  # More kpts needed as the x-direction is shorter
            mode='lcao',
            txt='pt_h2_lcao_llead.txt',
            mixer=Mixer(0.1, 5, weight=100.0),
            symmetry={'point_group': False, 'time_reversal': False})
atoms.set_calculator(calc)

atoms.get_potential_energy()  # Converge everything!
Ef = atoms.calc.get_fermi_level()

ibz2d_k, weight2d_k, H_skMM, S_kMM = get_lead_lcao_hamiltonian(calc)
# Only use first kpt, spin, as there are no more
H, S = H_skMM[0, 0], S_kMM[0]
H -= Ef * S

# Dump the Hamiltonian and Scattering matrix to a pickle file
pickle.dump((H, S), open('lead1_hs.pickle', 'wb'), 2)

#########################
# Right principal layer #
#########################
# This is identical to the left prinicpal layer so we don't have to do anything
# Just dump the same Hamiltonian and Scattering matrix to a pickle file
pickle.dump((H, S), open('lead2_hs.pickle', 'wb'), 2)