[ase-users] vasp6 and neighbor list ...

Jens Jørgen Mortensen jensj at fysik.dtu.dk
Thu Sep 25 18:21:42 CEST 2008


On Sun, 2008-09-21 at 12:36 +0200, Chaitanya Krishna wrote:
> Hi all,
> 
> I want to find out the nearest neighbors of my atoms using the
> neighborlist in ase/calculators. This is the code I have.
> 
> chaitanya at vaayu:~/tmp/asetest/ag01> cat read_force.py
> from ase import *
> from ase.calculators.vasp6 import Vasp
> from ase.calculators.neighborlist import NeighborList
> 
> calc = Vasp(restart=True)
> atoms = read('CONTCAR', format='vasp')
> calc.get_atoms()
> 
> nl = NeighborList(5.0)
> 
> indices, offsets = nl.get_neighbors(8)
> print indices, offsets

There is some documentation on the use of the NeighborList class here:

https://wiki.fysik.dtu.dk/ase/ase/calculators/calculators.html#building-neighbor-lists
https://wiki.fysik.dtu.dk/ase/epydoc/ase.calculators.neighborlist.NeighborList-class.html
https://trac.fysik.dtu.dk/projects/ase/browser/trunk/ase/calculators/neighborlist.py

You should replace the "nl = NeighborList(5.0)" line with something like
this:

cutoffs = [5.0 for atom in atoms]
nl = NeighborList(cutoffs, skin=0.0)
nl.update(atoms)

Hope that helps,
Jens Jørgen

> The error that I get is,
> 
> chaitanya at vaayu:~/tmp/asetest/ag01> python read_force.py
> Traceback (most recent call last):
>   File "read_force.py", line 11, in <module>
>     indices, offsets = nl.get_neighbors(8)
>   File "/Library/Frameworks/Python.framework/Versions/2.5.2001/lib/python2.5/site-packages/ase/calculators/neighborlist.py",
> line 103, in get_neighbors
>     return self.neighbors[a], self.displacements[a]
> AttributeError: NeighborList instance has no attribute 'neighbors'
> 
> I guess I still do not have enough knowledge in Python to understand the error.
> 
> Can someone help me finding what I am doing wrong.
> 
> Regards,
> Chaitanya.
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users




More information about the ase-users mailing list