Esempio n. 1
0
print('   dn, Etot: ', dn, etot, '\n')

print('3. Run one iteration with calc_n')
d = H.iterate(density.calc_n, mixer=sisl.mixing.LinearMixer())
e = H.Etot
print('   dn, dEtot: ', d - dn, e - etot, '\n')

# Write fdf-block
print('\n4. Write initspin to fdf-block')
H.write_initspin('test.fdf', mode='w')

import random
print('5. Run one iteration for spin-degenerate calculation')
Hsp2 = sp2(molecule, spin='unpolarized')
H = HubbardHamiltonian(Hsp2, U=3.5, kT=0.025)
n = random.seed(10)
dn = H.iterate(density.calc_n)
print('   dn, Etot: ', dn, H.Etot, '\n')

print('6. Run one iteration for spin-degenerate calculation with NEGF')
Hsp2 = sp2(molecule, spin='unpolarized')
H = HubbardHamiltonian(Hsp2, U=3.5, kT=0.025)
n = random.seed(10)
negf = NEGF(H, [],[])
dn = H.iterate(negf.calc_n_open, qtol=1e-7)
print('   dn, Etot: ', dn, H.Etot, '\n')

# Write new data structure
print('7. Write data in ncfile')
H.write_density('mol-ref/test.nc', mode='w')
Esempio n. 2
0
MFH_elec.random_density()
# Converge Electrode Hamiltonians
dn = MFH_elec.converge(density.calc_n, mixer=sisl.mixing.PulayMixer(weight=.7, history=7), tol=1e-10)

# Central region is a repetition of the electrodes without PBC
HC = H_elec.tile(3, axis=0)
HC.set_nsc([1, 1, 1])

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

# MFH object
MFH_HC = HubbardHamiltonian(HC.H, n=np.tile(MFH_elec.n, 3), U=U, kT=kT)

# First create NEGF object
negf = NEGF(MFH_HC, [(MFH_elec, '-A'), (MFH_elec, '+A')], elec_indx)
# Converge using Green's function method to obtain the densities
dn = MFH_HC.converge(negf.calc_n_open, steps=1, mixer=sisl.mixing.PulayMixer(weight=.1), tol=0.1)
dn = MFH_HC.converge(negf.calc_n_open, steps=1, mixer=sisl.mixing.PulayMixer(weight=1., history=7), tol=1e-6, print_info=True)

assert abs(MFH_HC.n[0].sum() - MFH_HC.q[0]) < 1e-5
assert abs(MFH_HC.n[1].sum() - MFH_HC.q[1]) < 1e-5
print('MFH-NEGF Etot = {:10.5f}'.format(MFH_HC.Etot))

# Reference test for total energy
HC_periodic = H_elec.tile(3, axis=0)
MFH_HC_periodic = HubbardHamiltonian(HC_periodic.H, n=np.tile(MFH_elec.n, 3), U=U, nkpt=[int(102/3), 1, 1], kT=kT)
dn = MFH_HC_periodic.converge(density.calc_n)

assert abs(MFH_HC_periodic.n[0].sum() - MFH_HC_periodic.q[0]) < 1e-7
assert abs(MFH_HC_periodic.n[1].sum() - MFH_HC_periodic.q[1]) < 1e-7