Bug fix of AbinitBandStructureMaker.py

MULTIBINIT, aTDEP, ANADDB, optics, cut3d, mrg* postprocessors

Moderators: MMNSchmitt, gonze

Locked
qnclqq
Posts: 4
Joined: Tue Jan 10, 2017 9:49 am

Bug fix of AbinitBandStructureMaker.py

Post by qnclqq » Sat Mar 18, 2017 5:02 pm

Hi everyone,

I do not know if someone else have posted a same topic. If so, tell me and I will delete this one.

Recently, when I use AbinitBandStructureMaker.py (Version 1.3, coded 2010), phthon goes wrong with the message "line 841 *** ValueError: could not convert string to float: =".

Then I check the code to know what happens to cause this failed. Finally, I find when the code try to find the value of "natom", it appear as "natom = **" and "atom **" in different lines.

So I add a if to fix this bug,

Before:

Code: Select all

            if starter[i].split()[0] == 'natom%s' %n or starter[i].split()[0] == 'natom':
                 datasetkey[-1].append(float(starter[i].split()[1]))

After:

Code: Select all

            if starter[i].split()[0] == 'natom%s' %n or starter[i].split()[0] == 'natom':
                if starter[i].split()[1] == '=':
                   datasetkey[-1].append(float(starter[i].split()[2]))
                else:
                   datasetkey[-1].append(float(starter[i].split()[1]))


The following code according to "nband" and "occopt" should also be changed.

As *.py is not allowed as an attachment, I upload the fixed one with extension "in".
Attachments
AbinitBandStructureMaker.in
change the file extension "in" to "py", so the code can be used by python. If you worry about the safty, change the py from abinit package by yourself.
(62.62 KiB) Downloaded 328 times

mverstra
Posts: 655
Joined: Wed Aug 19, 2009 12:01 pm

Re: Bug fix of AbinitBandStructureMaker.py

Post by mverstra » Fri May 12, 2017 12:20 am

Hello "q",

thanks - I have added this to the latest developer branch. Should be out in the next-next release 8.6 in a few months.
Matthieu Verstraete
University of Liege, Belgium

Locked