Bug fix of AbinitBandStructureMaker.py
Posted: 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:
After:
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".
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".