[ase-users] The same error always appears

Balaranjan Selvaratnam balaranjan.s at icloud.com
Wed Feb 21 18:20:31 CET 2018


Please delete this if redundant.

I'm using ase 3.15.0

Here is my input script:

from ase import Atoms
from ase.io import read, write
from ase.build import make_supercell, cut
from ase.calculators.dftb import Dftb

a = read('anatase.cif', format='cif')
P = [[5,0,0], [0,5,0], [0,0,5]]
a = make_supercell(a, P)
a = Atoms(a)

b = Atoms(cut(a, a=(1,0,0), b=(0,1,0), c=None, nlayers=10))
print(b.get_pbc())
b.center(vacuum=20, axis=(2))
write('TiO2-in.xyz', b, format='xyz')

calc = Dftb(label='TiO2', atoms=a, kpts=(1,1,1),
            run_manyDftb_steps=True,
            Driver='ConjugateGradient',
            Driver_MaxForceComponent='1E-4',
            Driver_MaxSteps=1000,
            Hamiltonian_MaxAngularMomentum_='',
            Hamiltonian_MaxAngularMomentum_Ti='"d"',
            Hamiltonian_MaxAngularMomentum_O='"p"')

b.set_calculator(calc)
calc.calculate(b)
final = read('geo_end.gen')
write('TiO2.test.final.xyz', final, format='xyz')

First run gives the following error:

Traceback (most recent call last):
  File "dftb_calc.py", line 32, in <module>
    calc.calculate(b)
  File "/home/bala/anaconda2/envs/cmc/lib/python2.7/site-packages/ase/calculators/calculator.py", line 650, in calculate
    self.read_results()
  File "/home/bala/anaconda2/envs/cmc/lib/python2.7/site-packages/ase/calculators/dftb.py", line 206, in read_results
    myfile = open(os.path.join(self.directory, 'results.tag'), 'r')
IOError: [Errno 2] No such file or directory: './results.tag'

And this is due to:
***  Parsing and initializing

ERROR!
-> HSD parser error: File 'dftb_in.hsd', Line    8.
-> Invalid block closing sign.

After adding an open curly bracket in line 8 of dftb_in.hsd and running python script, I get:

Traceback (most recent call last):
  File "dftb_calc.py", line 29, in <module>
    Hamiltonian_MaxAngularMomentum_O='"p"')
  File "/home/bala/anaconda2/envs/cmc/lib/python2.7/site-packages/ase/calculators/dftb.py", line 106, in __init__
    **kwargs)
  File "/home/bala/anaconda2/envs/cmc/lib/python2.7/site-packages/ase/calculators/calculator.py", line 627, in __init__
    atoms, **kwargs)
  File "/home/bala/anaconda2/envs/cmc/lib/python2.7/site-packages/ase/calculators/calculator.py", line 279, in __init__
    self.read(restart)  # read parameters, atoms and results
  File "/home/bala/anaconda2/envs/cmc/lib/python2.7/site-packages/ase/calculators/calculator.py", line 374, in read
    self.set_label(label)
  File "/home/bala/anaconda2/envs/cmc/lib/python2.7/site-packages/ase/calculators/calculator.py", line 329, in set_label
    self.directory, self.prefix = os.path.split(label)
  File "/home/bala/anaconda2/envs/cmc/lib/python2.7/posixpath.py", line 85, in split
    i = p.rfind('/') + 1
AttributeError: 'bool' object has no attribute 'rfind'

And the same error in '.out' file 
(
ERROR!
-> HSD parser error: File 'dftb_in.hsd', Line    8.
-> Invalid block closing sign.
) 

However, after fixing the 'invalid block sign' error, I can run the input file with dftb by calling in manually. i.e. $ dftb+ dftb_in.hsd

FYI: I'm new to dftb+ and python.

Thank you,

Best,
Bala


> On Feb 19, 2018, at 2:54 AM, Jens Jørgen Mortensen <jjmo at dtu.dk> wrote:
> 
> On 02/17/2018 05:23 PM, Balaranjan Selvaratnam via ase-users wrote:
>> I’m getting the same error with DFTB+ in ase. Is there any solution for this issue?
> 
> Good question.  Can you provide a script and input files that demonstrate the problem and please show us the complete error message you get (if any).  Also, what version of ASE are you using?
> 
> Jens Jørgen
> 
>> Thank you
>> Bala
>> _______________________________________________
>> ase-users mailing list
>> ase-users at listserv.fysik.dtu.dk
>> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20180221/63c6058d/attachment.html>


More information about the ase-users mailing list