[lammps-users] bug? input parsing for pair_coeff not picking up syntax problem

Hi.

I just wanted to pass along a bug that I tripped on the other day:

I was originally building a simulation up with pair_style hybrid lj/cut 10.0 eam, but then modified the script to just be pair_style lj/cut 10.0. However, in going through all the modifications necessary in the script I forgot to modify the existing pair_coeff commands which remained in the format required by pair_style hybrid (i.e. pair_coeff 1 1 lj/cut 10.0 0.005 instead of pair_coeff 1 1 10.0 0.005).

Unfortunately the LAMMPS parser didn't pick up the syntax problem and the result was that it didn't create any pairwise interaction in the script. I would have hoped that LAMMPS would have rejected my syntax rather than allowing it to go through as it turned out to be tricky to track down.

Just thought I would pass it along.

Dan

This happens b/c the pair_coeff command for lj/cut (and other styles)
has an optional number of params - e.g. zero or one or two cutoffs
at the end. So your version with lj/cut still matched what it expected
and it probably read "lj/cut" for epsilon and set it to 0.0.

LAMMPS could check that when it expects a number it gets it and
not characters, but that check would have to be put in a lot of places.
In hindsight, it would have been a good check to always do.

Steve

The Aug 9 patch should fix this.

Steve