ValueError: invalid literal for int() with base 10

155 views
Skip to first unread message

Imran Ahamed

unread,
Mar 30, 2023, 8:12:43 AM3/30/23
to TB2J
Hi, I am trying to calculate the anisotropic exchange of Cr in CrTe. When running wann2J.py I am getting this error
-------------------------------------------------------------------
Reading Wannier90 hamiltonian: non-colinear spin.
Traceback (most recent call last):
  File "/home/wajid/anaconda3/lib/python3.8/site-packages/ase/io/extxyz.py", line 743, in read_xyz
    natoms = int(line)
ValueError: invalid literal for int() with base 10: 'Cr         0.00000000       0.00000000                                                                                                                   0.08949000\n'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wajid/anaconda3/bin/wann2J.py", line 4, in <module>
    __import__('pkg_resources').run_script('TB2J==0.3.8', 'wann2J.py')
  File "/home/wajid/anaconda3/lib/python3.8/site-packages/pkg_resources/__init__.py", line 651, in                                                                                                             run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/home/wajid/anaconda3/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1455, i                                                                                                            n run_script
    exec(script_code, namespace, namespace)
  File "/home/wajid/anaconda3/lib/python3.8/site-packages/TB2J-0.3.8-py3.8.egg/EGG-INFO/scripts/wa                                                                                                            nn2J.py", line 163, in <module>
  File "/home/wajid/anaconda3/lib/python3.8/site-packages/TB2J-0.3.8-py3.8.egg/EGG-INFO/scripts/wa                                                                                                            nn2J.py", line 138, in run_wann2J
  File "/home/wajid/anaconda3/lib/python3.8/site-packages/TB2J-0.3.8-py3.8.egg/TB2J/manager.py", l                                                                                                            ine 132, in gen_exchange
  File "/home/wajid/anaconda3/lib/python3.8/site-packages/TB2J-0.3.8-py3.8.egg/TB2J/myTB.py", line                                                                                                             183, in read_from_wannier_dir
  File "/home/wajid/anaconda3/lib/python3.8/site-packages/TB2J-0.3.8-py3.8.egg/TB2J/wannier/w90_pa                                                                                                            rser.py", line 8, in parse_xyz
  File "/home/wajid/anaconda3/lib/python3.8/site-packages/ase/io/formats.py", line 736, in read
    return next(_iread(filename, slice(index, None), format, io,
  File "/home/wajid/anaconda3/lib/python3.8/site-packages/ase/parallel.py", line 275, in new_gener                                                                                                            ator
    for result in generator(*args, **kwargs):
  File "/home/wajid/anaconda3/lib/python3.8/site-packages/ase/io/formats.py", line 803, in _iread
    for dct in io.read(fd, *args, **kwargs):
  File "/home/wajid/anaconda3/lib/python3.8/site-packages/ase/io/formats.py", line 559, in wrap_re                                                                                                            ad_function
    for atoms in read(filename, index, **kwargs):
  File "/home/wajid/anaconda3/lib/python3.8/site-packages/ase/io/extxyz.py", line 745, in read_xyz
    raise XYZError('ase.io.extxyz: Expected xyz header but got: {}'
ase.io.extxyz.XYZError: ase.io.extxyz: Expected xyz header but got: invalid literal for int() with                                                                                                             base 10: 'Cr         0.00000000       0.00000000       0.08949000\n'
-------------------------------
Can you please suggest what needs to be done?

Thanks
Imran

Xu He

unread,
Apr 11, 2023, 5:52:50 AM4/11/23
to TB2J
Hi, 
This is because the .xyz file generated is not a standard xyz file, or is damaged. Can you send the file, and send how this file is generated (with which DFT code/Wannier90 version/input variables). 
Best regards,
HeXu

Imran Ahamed

unread,
Apr 11, 2023, 7:03:30 AM4/11/23
to TB2J
Thanks for the reply.

I have attached the .xyz file. It was generated with wannier90-1.2 version with VASP-5.4.1 with the tag "write_xyz = true" in the wannier90.win input file.

Thanks
wannier90_centres.xyz

Xu He

unread,
Apr 11, 2023, 8:53:31 AM4/11/23
to TB2J
Hi, 
It seems the problem is the number of positions in the first line of the xyz file is problematic. 
It should be 18 (number of Wannier centers + number of atoms), instead of the number of Wannier functions 16. 
You can change the number to see if it works. 
I would suggest upgrade to Wannier 3.1. Many improvements and bug fixes are made over the years. Of course, you need to recompile VASP to adapt to the new interface. Note that a patch is needed for vasp5.4.4 (https://github.com/Chengcheng-Xiao/VASP2WAN90_v2_fix). 
Best wishes,
HeXu

--
You received this message because you are subscribed to the Google Groups "TB2J" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tb2j+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tb2j/6e6c9621-d253-4198-be36-28f36c71e400n%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Message has been deleted
Message has been deleted

Xu He

unread,
Apr 13, 2023, 8:08:59 AM4/13/23
to Imran Ahamed, TB2J
Hi,
The error message is often because the Wannier functions are not well localized. 
I see that you're using TB2J 0.3.8, which is quite some time ago. Many improvements and bug fixes are in the new version.
Please consider upgrading to the most recent version 0.7.4 , in which the error message has been improved so that it will more detailed information on what the problem is and what can be done to fix it. 

Best regards,
HeXu

On Wed, Apr 12, 2023 at 7:31 PM Imran Ahamed <iaha...@gmail.com> wrote:
Thanks for the reply. I edited the xyz file and the calculation proceeded but then this error occurred
---------------------
Green's function Calculation started.
Traceback (most recent call last):                                                                                                                                                         | (ETA:  --:--:--)

  File "/home/wajid/anaconda3/bin/wann2J.py", line 4, in <module>
    __import__('pkg_resources').run_script('TB2J==0.3.8', 'wann2J.py')
  File "/home/wajid/anaconda3/lib/python3.8/site-packages/pkg_resources/__init__.py", line 651, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/home/wajid/anaconda3/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1455, in run_script
    exec(script_code, namespace, namespace)
  File "/home/wajid/anaconda3/lib/python3.8/site-packages/TB2J-0.3.8-py3.8.egg/EGG-INFO/scripts/wann2J.py", line 163, in <module>
  File "/home/wajid/anaconda3/lib/python3.8/site-packages/TB2J-0.3.8-py3.8.egg/EGG-INFO/scripts/wann2J.py", line 138, in run_wann2J
  File "/home/wajid/anaconda3/lib/python3.8/site-packages/TB2J-0.3.8-py3.8.egg/TB2J/manager.py", line 171, in gen_exchange
  File "/home/wajid/anaconda3/lib/python3.8/site-packages/TB2J-0.3.8-py3.8.egg/TB2J/exchange.py", line 581, in run
  File "/home/wajid/anaconda3/lib/python3.8/site-packages/TB2J-0.3.8-py3.8.egg/TB2J/exchange.py", line 532, in calculate_all
  File "/home/wajid/anaconda3/lib/python3.8/site-packages/TB2J-0.3.8-py3.8.egg/TB2J/exchange.py", line 324, in get_all_A
  File "/home/wajid/anaconda3/lib/python3.8/site-packages/TB2J-0.3.8-py3.8.egg/TB2J/exchange.py", line 295, in get_A_ijR
  File "/home/wajid/anaconda3/lib/python3.8/site-packages/TB2J-0.3.8-py3.8.egg/TB2J/pauli.py", line 133, in pauli_block_all
ValueError: operands could not be broadcast together with shapes (4,4) (5,5)
 --------------
I don't know if this is due to the older version of wannier90 or something with the TB2J code compilation.
Your help is much appreciated.

Thanks
Imran
Reply all
Reply to author
Forward
0 new messages