I'm trying to write a program to calculate the neighbor lists of crystal systems. I found a few codes that are able to calculate it for orthogonal systems. How can I do it for non-orthogonal cells ?

The first link mentions a transformation from non-orthogonal to orthogonal representation. If I do this transformation how can I get back to the original lattice with the corresponding distances ?

Some examples that I found interesting are:

Some theory and parts of codes

An example of a simplistic neighbor list

A more elaborated version using linked list


1 Answer 1


I understand that you are trying to implement cell lists. For orthogonal unit cell (or even better - cubic) the cells that subdivide the unit cell are nicely aligned with the unit cell. Wikipedia has this illustration:

cubic cell lists

For a non-orthogonal unit cell the calculations are more complex, but you can still use a rectangular box divided into cells. Here is an illustration from the Gromacs manual:

non-orthogonal cell lists

Alternatively, you could subdivide the unit cell into cells that have the same angles as the unit cell. It would make some calculations simpler, but the cells would need to be larger to assure that the search radius doesn't go beyond neighboring cells. So it'd probably be slower overall.

I'm aware that some math or pseudo-code would be more helpful, but skipped it for the same reason it is skipped in books – these things are tedious and are better left as an exercise for the reader. :-)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .