[ase-users] neighborlist: two atoms with distance larger than cutoff identified as neighbors

Chunguang Tang chunguang.tang at anu.edu.au
Sat Dec 12 02:58:08 CET 2020


Dear ASE developers,

The below code identifies two atoms with distance of 2.5 angstroms as 
neighbors although I set the cutoff (radius) as 1 angstrom. I thought 
they are neighbors only when their distance =< 2 angstroms. Could you 
help? Many thanks.

Chunguang

------------------------------------------------

from ase import Atoms, neighborlist
lcell=10

p=[[0, 0, 0],[2.5, 0, 0]]

natom=len(p)
symbol=['H' for i in range(natom)]
atoms=Atoms(symbols=symbol,positions=p,cell=[lcell,lcell,lcell],pbc=True)
# two atoms with radius r1 and r2 are defined as neighbors if they 
overlap. That is, if their distance<r1+r2

cutoff=[1. for i in range(natom)] #here we assume two points with 
distance<2 angstrom are connected or neighbors
nl=neighborlist.NeighborList(cutoff,self_interaction=False,bothways=True)
nl.update(atoms)

for i in range(natom):
     indices, offsets = nl.get_neighbors(i) # according ASE, offsets 
seems to be the vector from atom i to its neighbor atom, but its output 
is zero.
     print(indices)


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


More information about the ase-users mailing list