Pair hybrid and neighbour lists

Dear all,

At the last workshop, Steve mentioned that using the pair_style hybrid is not computationally efficient, as LAMMPS builds multiple neighbour lists for every pair style. Suppose I want to use the same cutoff for all the pair styles, what is the best strategy to modify LAMMPS in order to build the neighbour list just once and use it for every pair style?

This question is of course related to the MOLC force field, which uses an overlay of gayberne and (modified) coul/long pair potentials.

Thank you so much!

It is not worth trying to optimize that unless you want to implement both/all pair styles as a single pair style. If you use hybrid, then LAMMPS will create just one neighbor list and then generate skip lists for the atom type pairs of the substyles from that. This is rather fast.

In more general terms. There is something that can be referred to as “premature optimization” which translates into: do not try to optimize something unless you have measured exactly how much time you spend on it. There are many different things that can have a surprisingly large performance impact like avoiding calls to the pow() function for integer exponents, e.g. when evaluating polynomials.

This is a good tip, thanks for sharing Axel!