Feature request

Instead of lists of neighbors, is it possible to get some equivalent of edge_src, edge_dst, edge_shift = ase.neighborlist.neighbor_list("ijS", a=crystal, cutoff=radial_cutoff, self_interaction=True) in OVITO (with C backend), hopefully OVITO will be faster than anything else.

I am not sure if this is exactly what you are asking for, but perhaps OVITO’s CutoffNeighborFinder.find_all() method can solve your problem.

Thannks for the reply @stukowski ,

Well, I am expecting (i,j) format where (i) is the index of central atom (id) and (j) were neighboring atoms (id). If I used find_all method I will get [N-total_atoms, M_Neighbors] format. It wouldn’t be hard to convert it into (i,j) format but for large system size of 1M atoms for loops certainly painful. However, native C backed implementation certainly makes a difference.

e.g.

[2, 3, 4]
[6, 3, 2 ]
[4, 9, 1]

to

[0,0,0,1,1,1,2,2,2] --- i
[2,3,4,6,3,2,4,9,1] --- j

This looks easy if you have same number of neighbors (here is 3) but gets tricker when number of neighbors were unequal for certain atoms.

I think the CutoffNeighborFinder.find_all() method already does return the information in the format you want it. According to the documentation, the function returns:

Array of shape (M, 2) containing pairs of indices of neighboring particles, with M equal to the total number of neighbors in the system.

That means M is equal to the sum (not the maximum!) of the number of neighbors of the first atom, the second atom, the third atom in the system, and so on. In other words, you will get a concatenation of all neighbor lists. The pair-wise indices, i-j, form the two columns of the array.

1 Like

Sorry, but this was not in available in the earlier versions. Also the logs for the latest version changes not updated Version history – ovito

I was using ovito.data — OVITO Python Reference 3.9.4 documentation.

Yes, 3.9.4 is the current version.
Just in case you haven’t seen this yet, we integrated the changelogs into the manual a while ago. Please always refer to this page: Changelog — OVITO User Manual 3.9.4 documentation

1 Like

Thanks!!