Pair_style hybrid - Numeric index is out of bounds

This post comes as I am in the process of implementing pair_style hybrid/overlay lj/smooth coul/long with the OPLS forcefield using the OPLS file distributed with moltemplate.

Taking advice received from a recent post, I generated all of the cross-wise coefficients for the lj potential using the write_coeff command while specifying in the in.init file only a lj/cut/coul/long potential. I then modified my in.settings file by removing the list of pair_coeffs (which only consisted of like-interactions) and adding the explicit like and unlike coefficients obtained from the write_coeff command. I then ran lammps again, this time with pair_style hybrid/overlay lj/smooth coul/long and received the “numeric index is out of bounds” error which, from a survey of this forum, is quite common.

The error came at the first line in the in.settings file, which was the very beginning of the pair coefficients. As best I could tell from reading other posts in the forum, this was due to a mismatch between the data file and the settings file (i.e. the number of coefficients lammps had been told to expect in the system from the data file and the number of coefficients lammps saw in the settings file). So, I rebuilt the system in moltemplate using the hybrid/overlay pair style, hoping that this would build the data file to be compatible with the coefficients for the hybrid potential.

However, moltemplate did what it was supposed to and produced a settings file with just the like-interaction coefficients, which I replaced with the output from write_coeff. Running lammps again with this newly-built system from moltemplate, which was built with the hybrid/overlay pair style and updated with the coefficients list from write_coeff, also yielded the numeric index out of bound error.

So, I am trying to track down the cause of lammps not seeing the number of coefficients it’s expecting to see. Any suggestions would be appreciated. The settings file is large (19 MB) due to containing the cross-coeffs for all 906 atom types in the OPLS file. I have pasted the first few lines below (showing up as a table, don’t want to change the formatting - it’s just text in the file). The in.init and log file are attached.

pair_coeff lj/smooth 1 1 0.061 2.94 12 15
pair_coeff lj/smooth 1 2 0.084841 3.38832 12 15
pair_coeff lj/smooth 1 3 0.0800312 3.32039 12 15
pair_coeff lj/smooth 1 4 0.113181 2.94998 12 15
pair_coeff lj/smooth 1 5 0.101833 2.96985 12 15
pair_coeff lj/smooth 1 6 0.0987927 3.39049 12 15

log.lammps (1.6 KB)
polysystemNEW.in.init (338 Bytes)

Kind regards,
Sean

Please see: pair_coeff command — LAMMPS documentation

Thank you. Trivial. I put the pair_style name before the atom type index. It should be

pair_coeff 1 1 lj/smooth 0.061 2.94 12 15

Running the simulation with this correction does indeed get me past the reading of the coefficients. Good to know that this error “numeric index is out of bounds” can refer to not only the index being out of bounds but the index being a data type other than an integer (in this case, a string).

The error message indicates that you are using an outdated LAMMPS version. If you would be using a current version of LAMMPS, the error message would be more specific:

ERROR: Invalid range string: lj/smooth (src/pair_hybrid.cpp:476)

Also good to know. Thank you!