Skip to content

Slightly wrong energy written to TBTGF by sisl? #827

@AleksBL

Description

@AleksBL

When writing a custom tbtgf file using the write_header of "sisl.io.tbtgfSileTBtrans" the energies in read by TBtrans will differ by x1.00000785 from the input value given inside python.

The calculation of the greens function is going on in the python code below:
image
There doesnt seem to be any descrepancy when iterating over the f:
image
The fail happens in TBtrans, in the output:
image

sisl v. 0.15
tbtrans from siesta-rel-5.0, but also happens with tbtrans from siesta v.4.1.5

The script below shows that it seems to be consistent across python, but something it seems to be some intermediate step

import sisl
import numpy as np
import tqdm

g      = sisl.geom.graphene()
H_elec = sisl.Hamiltonian(g)
H_elec.construct([[0.1,1.5], [0.0, -2.7]])
gamma = sisl.MonkhorstPack(H_elec, [1] * 3)
E    = np.linspace(-1,1)
eta  = 0.001
mu   = None

with sisl.io.tbtgfSileTBtrans('Test.TBTGF') as f:
    val = E + 1j * eta
    # print(val[0])
    # print(val.dtype)
    if mu is not None:f.write_header(gamma, E + 1j * eta, mu = mu)
    else:             f.write_header(gamma, E + 1j * eta)
    
    for ispin, new_k, k, e in tqdm.tqdm(f):
        if new_k:
            f.write_hamiltonian(H_elec.Hk(format='array', dtype=np.complex128),
                                H_elec.Sk(format='array', dtype=np.complex128))
        
        # else:          SeHSE = SRSSE.self_energy(e + 1j*eta, bulk=True, coupling=True)
        rand_mat  = np.random.random((H_elec.no, H_elec.no))
        rand_mat += rand_mat.T
        
        f.write_self_energy(rand_mat)

gf = sisl.get_sile('Test.TBTGF')

Version details
Run the below code and add to bug-report:

import sisl._debug_info as sd
sd.print_debug_info()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions