Closed lucasem1 closed 7 months ago
The KeyError
tells me that you haven't calculated the bond/orbital current, please see in the tbtrans manual for the appropriate flag and recalculate again.
Thank you for your help. Best Regards. Luca
Closed via #670
Dear Developers
I am trying to calculate the atom_current by using the class tbtavncSileTBtrans . I have a database TBT.nc generated by Siesta+Tbtrans for a system under a bias of 1Volt.
When I run the code:
db='myfile.TBT.nc' tbt = sisl.io.tbtrans.tbtncSileTBtrans(db) Jb = tbt.atom_current(elec=0, elec_other=1, activity=True, kavg=True, isc=None, orbitals=None)
I get the error :
Traceback (most recent call last): File "/home/luca/Codes/Python/anaconda3/envs/sisl_env/lib/python3.9/site-packages/sisl/io/tbtrans/tbt.py", line 216, in _value_E v = self._variable(name, tree=tree) File "/home/luca/Codes/Python/anaconda3/envs/sisl_env/lib/python3.9/site-packages/sisl/io/sile.py", line 1287, in _variable return self._variables(self, name, tree=tree) File "/home/luca/Codes/Python/anaconda3/envs/sisl_env/lib/python3.9/site-packages/sisl/io/sile.py", line 1309, in _variables return g.variables[name] KeyError: 'J'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/media/sf_Vubuntu_share/IPCF-2014/Noureddine/NEGF/17Mar2023-CBN/DATA/SISLANALYSIS/bc.py", line 11, in
Jb = tbt.atom_current(elec=0, elec_other=1, activity=True, kavg=True, isc=None, orbitals=None)
File "/home/luca/Codes/Python/anaconda3/envs/sisl_env/lib/python3.9/site-packages/sisl/io/tbtrans/tbt.py", line 2096, in atom_current
Jij = self.orbital_current(
File "/home/luca/Codes/Python/anaconda3/envs/sisl_env/lib/python3.9/site-packages/sisl/messages.py", line 106, in wrapped
return func(*args, **kwargs)
File "/home/luca/Codes/Python/anaconda3/envs/sisl_env/lib/python3.9/site-packages/sisl/io/tbtrans/tbt.py", line 1631, in orbital_current
J = reduce(getdata, enumerate(integrator(self.E)), 0.0)
File "/home/luca/Codes/Python/anaconda3/envs/sisl_env/lib/python3.9/site-packages/sisl/io/tbtrans/tbt.py", line 1608, in func_all
D = self._sparse_data("J", elec, i, kavg=kavg)
File "/home/luca/Codes/Python/anaconda3/envs/sisl_env/lib/python3.9/site-packages/sisl/io/tbtrans/tbt.py", line 1086, in _sparse_data
return self._value_E(name, elec, kavg, E)
File "/home/luca/Codes/Python/anaconda3/envs/sisl_env/lib/python3.9/site-packages/sisl/io/tbtrans/tbt.py", line 224, in _value_E
raise KeyError(
KeyError: "tbtncSileTBtrans could not retrieve key 'Left.J' due to missing flags in the input file."
Could you please help overcome this issue?
Best Regards. Luca