zerothi / sisl

Electronic structure Python package for post analysis and large scale tight-binding DFT/NEGF calculations
https://zerothi.github.io/sisl
Mozilla Public License 2.0
181 stars 58 forks source link

Problem in retrieving the transmission from a sile #239

Closed Mero62 closed 4 years ago

Mero62 commented 4 years ago

Hi Nick, Hope you're doing alright! I have an occuring issue that never happened before. I'm calculating the transmission of a pristine Nanoribbon. So far so good, however having used Tbtrans to generate some siesta.TBT.nc file, I can retrieve the energy but not the transmission which never happened before. Here is the line of code that shows the issue :

tbt_pristine = sisl.get_sile('siesta.TBT.nc')
print(tbt_pristine.transmission())

I get the following error message :

TypeError                                 Traceback (most recent call last)
<ipython-input-17-de5116be1d52> in <module>
      1 os.chdir('/home/kucukbam/Desktop/PHD/Python/Programs/Machine_learning/Datas_long_thin_zGNR_5imp')
      2 tbt_pristine = sisl.get_sile('siesta.TBT.nc')
----> 3 print(tbt_pristine.transmission())

~/miniconda3/lib/python3.7/site-packages/sisl/io/tbtrans/tbt.py in transmission(self, elec_from, elec_to, kavg)
    218             raise ValueError(self.__class__.__name__ + ".transmission elec_from and elec_to must not be the same.")
    219 
--> 220         return self._value_avg(elec_to + '.T', elec_from, kavg=kavg)
    221 
    222     def reflection(self, elec=0, kavg=True, from_single=False):

TypeError: unsupported operand type(s) for +: 'int' and 'str'
zerothi commented 4 years ago

Hmm, could you give me the output of

ncdump -h siesta.TBT.nc

? Thanks!

Mero62 commented 4 years ago

Of course. Here is the output :

netcdf siesta.TBT {
dimensions:
    no_u = 240 ;
    na_u = 240 ;
    nkpt = 1 ;
    xyz = 3 ;
    one = 1 ;
    na_d = 200 ;
    no_d = 200 ;
    ne = 50 ;
    n_s = 3 ;
variables:
    int lasto(na_u) ;
        lasto:info = "Last orbitals of the equivalent atom" ;
    double cell(xyz, xyz) ;
        cell:unit = "Bohr" ;
        cell:info = "Unit cell" ;
    double xa(na_u, xyz) ;
        xa:unit = "Bohr" ;
        xa:info = "Atomic coordinates" ;
    int isc_off(n_s, xyz) ;
        isc_off:info = "Supercell offsets" ;
    int nsc(xyz) ;
        nsc:info = "Number of supercells in each direction" ;
    int pivot(no_d) ;
        pivot:info = "Device region orbital pivot table" ;
    int a_dev(na_d) ;
        a_dev:info = "Index of device atoms" ;
    double kpt(nkpt, xyz) ;
        kpt:unit = "b" ;
        kpt:info = "k point" ;
    double wkpt(nkpt) ;
        wkpt:info = "k point weights" ;
    double E(ne) ;
        E:unit = "Ry" ;
        E:info = "Energy" ;

// global attributes:
        :source = "TBtrans" ;
        :Gamma = "false" ;
        :date = "2020-07-09" ;

group: Bottom {
  variables:
    double mu(one) ;
        mu:unit = "Ry" ;
        mu:info = "Chemical potential" ;
    double kT(one) ;
        kT:unit = "Ry" ;
        kT:info = "Electronic temperature" ;
    float Top.T(nkpt, ne) ;
        Top.T:info = "Transmission" ;
  } // group Bottom
}

Oh yeah by the way, I don't know how much it has do with the current issue but it seems by the previous error that something went wrong with the electrode configuration so I double checked it without seeing an issue in my fdf file. However when one tries to retrieve information about electrodes through the .elecs method (so when you have something like print (tbt_pristine.elecs), I just get the first electrode in the TBT.elecs block... It might be normal but I thought it was worth pointing it out here.

zerothi commented 4 years ago

Ahh, now I get it. This is because the latest tbtrans will always write out more stuff in the NetCDF files. So I would suggest you to download this and recompile tbtrans :)

Mero62 commented 4 years ago

Dear Nick, Sorry for the delay, I recompiled TBtrans with this version and thank you, it worked as usual ;)

zerothi commented 4 years ago

Great, I'll consider this solved! Thanks for the question!