Error reading arguments for lj/gromacs pair style

I have the following LAMMPS input file:

units lj
atom_style full
read_data sys.data

bond_style harmonic
angle_style harmonic 
dihedral_style harmonic

bond_coeff 1 1000 0.84
bond_coeff 2 1000 0.37

angle_coeff 1 10 180
angle_coeff 2 300 90

dihedral_coeff 1 3.0 -1 1 

pair_style hybrid lj/gromacs 0.57 0.6 lj/cut 1.0  

dielectric 101.07

pair_modify shift yes
pair_modify tail no
pair_modify mix arithmetic

special_bonds lj 0.0 1.0 1.0

pair_coeff 1 1 lj/cut 1.0 1.0 1.12246

pair_coeff 1 2 lj/cut 1.0 0.65 0.72960 
pair_coeff 1 3 lj/cut 1.0 0.65 0.72960 
pair_coeff 1 4 lj/cut 1.0 0.65 0.72960 
pair_coeff 1 5 lj/cut 1.0 0.65 0.72960 

pair_coeff 4 4 lj/cut 1.0 0.7 0.78572 
pair_coeff 4 2 lj/gromacs 50.0 0.3 0.57 0.6 
pair_coeff 4 3 lj/cut 1.0 0.3 0.33674 
pair_coeff 4 5 lj/cut 1.0 0.3 0.33674 
pair_coeff 2 2 lj/cut 1.0 0.7 0.78572
pair_coeff 2 3 lj/cut 1.0 0.3 0.33674 
pair_coeff 2 5 lj/cut 1.0 0.3 0.33674 
pair_coeff 3 3 lj/cut 1.0 0.7 0.78572 
pair_coeff 3 5 lj/gromacs 61.0 0.3 0.57 0.6
pair_coeff 5 5 lj/cut 1.0 0.7 0.78572

thermo_style custom step press temp pe ke lx
thermo_modify flush yes norm no

neighbor 1.0 bin
neigh_modify every 2 delay 0 check yes one 4000
timestep 0.001  
run_style respa 2 2 bond 1 angle 1 dihedral 1 pair 2 kspace 2

variable step equal step

minimize 1.0e-4 1.0e-6 1000 1000 
reset_timestep 0

velocity all create 3.1 95137 dist gaussian

fix 1 all nve
fix 2 all langevin 3.1 3.1 10 59840 zero yes
fix s1 all shake 0.001 10 0 b 2

run 1500000

dump crds all atom 2000 all.lammpstrj
dump_modify crds sort id
dump_modify crds scale no

run 500000

I can confirm that the simulation runs fine using the prebuilt version of LAMMPS (15 June 2023) available here. However, when I build LAMMPS myself (23 June 2022 Update 4 - to have MPI support) and run the simulation, I get the following error:

ERROR: Incorrect args for pair coefficients (src/pair_lj_gromacs.cpp:251)
Last command: pair_coeff 4 2 lj/gromacs 50.0 0.3 0.57 0.6 # HB donor-HB acceptor interaction 'GROMACS style lj' 'eps' 'sig' 'cutoff1' 'cutoff2'

According to the docs, my arguments should be correct.

Please try reordering your pair_coeff statement so that the first type number is less than or equal to the second type number – i.e. pair_coeff 2 4 lj/gromacs ... instead of what you currently have.

From what I understand all pairs with i > j are ignored (the docs for pair_coeff do state this, but only for the “asterisk form” of inputting numeric types, whereas in the code it looks like it would apply even with single types as you tried).

1 Like

That works, thanks for your help!

FYI – LAMMPS should have swapped them for you (internally) since you didn’t use wildcards (asterisk). Please double-check that you’ve downloaded the LAMMPS code and compiled it correctly and that you haven’t modified the source code.

I was using the latest update (update 4 for 23 June 2022).

The 23 June 2022 stable LAMMPS version requires that in pair_coeff I J commands, I < J.
This has been in LAMMPS since the beginning. It is also documented in the documentation for the stable version: LAMMPS Documentation (23 Jun 2022 version) — LAMMPS documentation

When you read through the documentation at https://docs.lammps.org/ you see the documentation for the latest feature release version (15 June 2023 currently), and - as should be expected - this is a version with changes relative to the stable version. So it is important to look at the documentation that matches the version. The I < J restriction had to be lifted with adding support for typelabels, which were added after the stable release as shown in the documentation of the labelmap command — LAMMPS documentation (which states it was added in version 15 September 2023).

2 Likes