What does the Neighbor command do in LAMMPS?

Matter Modeling Asked on December 22, 2021

I frequently see LAMMPS codes, and almost all of them have the neighbor 0.5 bin command. I completely studied the LAMMPS manual for the neighbour command and did not understand anything regarding this command.
Could anyone help with these questions below?

  • What is the basic purpose of this command?
  • What is a Neighbor list and why is it important?

One Answer

Neighbour lists are not just a feature of LAMMPS, but of just about any MD engine out there. When you are evaluating your energy function, it is extremely common to have some sort of cutoff for the short-range forces, so that you reduce the complexity of their evaluation from e.g. $O(N^2)$ to $O(N)$. However, simply checking whether two atoms are within a cutoff distance is also an $O(N^2)$ operation, so it's not something you want to do at each timestep. Here's where neighbour lists come to the rescue: you build a list containing each particle's neighbours within a cutoff $r_n$, which means that as long as you are sure the particles haven't moved a distance greater than $r_n-r_{cut}$ ($r_{cut}$ is the force evaluation cutoff), you only need to check the force interactions in that neighbour list, which is a massive upgrade from having to check all interactions!

And here's the catch: if your $r_n-r_{cut}$ (also called a "skin" region, your first argument) is large, you will need to build the neighbour list less frequently, but you will need to check more force interactions within each neighbour list. This means that there will be an optimal value of the skin region for achieving maximum computational efficiency but it will unfortunately be system-specific and in some systems even coordinate-specific (e.g. if some parts of your system diffuse faster, they will require faster updates). This is difficult to know a priori, so you either have to guess a good value beforehand, or even spend some time optimising it by hand for a typical system of yours, so that you use that hand-tuned value for all subsequent simulations.

The second argument is, as far as I understand, related to the building of the neighbour list itself. Naively building a neighbour list from scratch is also an $O(N^2)$ operation (Verlet list), but you can do a similar trick and create something like a "neighbour list of neighbour lists", i.e. you partition your box into regions, each roughly as big as one neighbour list region, and bin each particle (an $O(N)$ operation) to each cell region. After a neighbour list update is triggered, you only need to consider particles from the cell regions immediately surrounding your current one in order to do this, so this is also an $O(N)$ operation. This whole method is called a cell list and is usually the preferred way to update a neighbour list. This is what I think the second parameter ("style") does $-$ I imagine "bin" value stands for a cell list update, while the "nsq" value stands for a naive $O(N^2)$ update.

Answered by Godzilla on December 22, 2021

Add your own answers!

Related Questions

Molden installation on macOS?

1  Asked on August 19, 2021 by dmitry-eremin



1  Asked on August 19, 2021


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP