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 Extracting PDOS from .nc file #386

Closed yusufw15 closed 2 years ago

yusufw15 commented 2 years ago

Dear SISL Developer,

I would like to ask your kind opinion and help regarding the following error.

I run using Transiesta+TBTrans and the calculation was completed without any problem.

The transmission probability file and DOS output were also come out.

Then, I was going to extract PDOS by using the following command:

import numpy as np
from sisl import *

sdata apc.scat2.TBT_UP.nc --atom 55-70 --dos --ados apc.scat2.TBT_UP.ADOS_Left --out dos_55-70.dat

However, I got the following error instead:

Traceback (most recent call last):
  File "/home/usr1/p70561a/miniconda3/envs/torch/lib/python3.9/site-packages/sisl/io/tbtrans/tbt.py", line 102, in _value_avg
    v = self._variable(name, tree=tree)
  File "/home/usr1/p70561a/miniconda3/envs/torch/lib/python3.9/site-packages/sisl/io/sile.py", line 794, in _variable
    return self._variables(self, name, tree=tree)
  File "/home/usr1/p70561a/miniconda3/envs/torch/lib/python3.9/site-packages/sisl/io/sile.py", line 807, in _variables
    return n.variables[name]
KeyError: 'DOS'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/usr1/p70561a/miniconda3/envs/torch/bin/sdata", line 33, in <module>
    sys.exit(load_entry_point('sisl==0.11.0', 'console_scripts', 'sdata')())
  File "/home/usr1/p70561a/miniconda3/envs/torch/lib/python3.9/site-packages/sisl/utils/_sisl_cmd.py", line 123, in sisl_cmd
    p.parse_args(argv, namespace=ns)
  File "/home/usr1/p70561a/miniconda3/envs/torch/lib/python3.9/argparse.py", line 1820, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "/home/usr1/p70561a/miniconda3/envs/torch/lib/python3.9/argparse.py", line 1853, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/home/usr1/p70561a/miniconda3/envs/torch/lib/python3.9/argparse.py", line 2062, in _parse_known_args
    start_index = consume_optional(start_index)
  File "/home/usr1/p70561a/miniconda3/envs/torch/lib/python3.9/argparse.py", line 2002, in consume_optional
    take_action(action, args, option_string)
  File "/home/usr1/p70561a/miniconda3/envs/torch/lib/python3.9/argparse.py", line 1930, in take_action
    action(self, namespace, argument_values, option_string)
  File "/home/usr1/p70561a/miniconda3/envs/torch/lib/python3.9/site-packages/sisl/utils/cmd.py", line 242, in run
    A(*Aargs, **Akwargs)
  File "/home/usr1/p70561a/miniconda3/envs/torch/lib/python3.9/site-packages/sisl/utils/cmd.py", line 209, in collect
    return func(self, *args, **kwargs)
  File "/home/usr1/p70561a/miniconda3/envs/torch/lib/python3.9/site-packages/sisl/io/tbtrans/tbt.py", line 2178, in assign_E
    return func(self, *args, **kwargs)
  File "/home/usr1/p70561a/miniconda3/envs/torch/lib/python3.9/site-packages/sisl/io/tbtrans/tbt.py", line 2429, in __call__
    data = ns._tbt.DOS(kavg=ns._krng, orbitals=ns._Orng, norm=ns._norm)
  File "/home/usr1/p70561a/miniconda3/envs/torch/lib/python3.9/site-packages/sisl/io/tbtrans/tbt.py", line 539, in DOS
    return self._DOS(self._value_E('DOS', kavg=kavg, E=E), atoms, orbitals, sum, norm) * eV2Ry
  File "/home/usr1/p70561a/miniconda3/envs/torch/lib/python3.9/site-packages/sisl/io/tbtrans/tbt.py", line 142, in _value_E
    return self._value_avg(name, tree, kavg)
  File "/home/usr1/p70561a/miniconda3/envs/torch/lib/python3.9/site-packages/sisl/io/tbtrans/tbt.py", line 111, in _value_avg
    raise KeyError(f"{self.__class__.__name__} could not retrieve key '{name}' due to missing flags in the input file.")
KeyError: "tbtncSileTBtrans could not retrieve key 'DOS' due to missing flags in the input file."

I found a similar case in another forum, it was said that the ADOS file should be available. However, for my case, I already have the ADOS file and still, get this error.

Could you kindly help me to solve this problem?

Thank you very much for your kind help.

Yours Sincerely,

Yusuf Wicaksono Ph.D. Candidate Graduate School of Engineering Science Osaka University

zerothi commented 2 years ago

Hi,

As it it states, KeyError: "tbtncSileTBtrans could not retrieve key 'DOS' due to missing flags in the input file.". The DOS comes from the Green function, so you should have a flag TBT.DOS.Gf in the input file to get this.

yusufw15 commented 2 years ago

Dear Dr. Nick Papior,

Thank you very much for your kind help. Now it is working fine.