Confusion about mixing and Pair Coeff section

I am trying to run a simulation that involves mixing LJ pair styles from the TIP4P water model and AMBER force field (lj/cut/tip4p/long and lj/charmm/coul/long, respectively). Despite reading the LAMMPS docs and reviewing many posts here I am unable to make my input work properly, because parameter mixing is not being activated. I’m struggling to understand what is wrong with my input and would appreciate any assistance!

In my input file, I specify a hybrid pair style and arithmetic mixing. According to the LAMMPS manual, both pair styles support mixing (TIP4P) (CHARMM)

pair_style hybrid lj/cut/tip4p/long 2 1 1 1 0.10527 9.0 7.0 lj/charmm/coul/long 7.0 9.0 7.0
pair_modify arithmetic

I-I pair coefficients are specified in the Pair Coeff section of a separate data file:

Pair Coeffs

1  lj/cut/tip4p/long 0.000000  0.000000
2  lj/cut/tip4p/long 0.179080  3.165500
3  lj/cut/tip4p/long 0.013144  2.464226
4  lj/charmm/coul/long 0.086000  3.399670
5  lj/charmm/coul/long 0.109400  3.399670
6  lj/charmm/coul/long 0.061000  3.118146
7  lj/charmm/coul/long 0.210000  2.959922
8  lj/charmm/coul/long 0.250000  3.563595

But my simulation fails with

ERROR on proc 0: All pair coeffs are not set (src/pair_hybrid.cpp:632)

Adding a info coeff command to my input file confirms that no I-J coefficients are being calculated:

Info-Info-Info-Info-Info-Info-Info-Info-Info-Info-Info
Printed on Tue Sep 14 12:50:10 2021


Coeff information:
Pair Coeffs:
  1   1 : is set
  1   2 : is not set
  1   3 : is not set
  1   4 : is not set
  1   5 : is not set
  1   6 : is not set
  1   7 : is not set
  1   8 : is not set
  2   2 : is set
  2   3 : is not set
  2   4 : is not set
  2   5 : is not set
  2   6 : is not set
  2   7 : is not set
  2   8 : is not set
  3   3 : is set
  3   4 : is not set
  3   5 : is not set
  3   6 : is not set
  3   7 : is not set
  3   8 : is not set
  4   4 : is set
  4   5 : is not set
  4   6 : is not set
  4   7 : is not set
  4   8 : is not set
  5   5 : is set
  5   6 : is not set
  5   7 : is not set
  5   8 : is not set
  6   6 : is set
  6   7 : is not set
  6   8 : is not set
  7   7 : is set
  7   8 : is not set
  8   8 : is set

But I don’t understand why the mixing rule is not being applied, since both pair styles support mixing.

The following passage from the pair_hybrid docs may explain it, but I’m confused by its meaning. The first sentence implies that I-J mixing can only be used when both I and J are assigned the same sub-style, but the 2nd to last sentence seems to indicate that this requirement only applies to hybrid/overlay and hybrid/scaled styles.

For atom type pairs I,J and I != J, if the sub-style assigned to I,I and J,J is the same, and if the sub-style allows for mixing, then the coefficients for I,J can be mixed. This means you do not have to specify a pair_coeff command for I,J since the I,J type pair will be assigned automatically to the sub-style defined for both I,I and J,J and its coefficients generated by the mixing rule used by that sub-style. For the hybrid/overlay and hybrid/scaled style, there is an additional requirement that both the I,I and J,J pairs are assigned to a single sub-style. If this requirement is not met, no I,J coeffs will be generated, even if the sub-styles support mixing, and I,J pair coefficients must be explicitly defined.

I suppose my question boils down to this - is it possible to use mixing rules to obtain I-J parameters by mixing I-I and J-J parameters from different force fields, provided they both support mixing? Or must I specify all I-J interactions manually?

Thank you in advance for any assistance.

There is not going to be any mixing between different sub-styles of pair style hybrid. There is no way that pair style hybrid can detect that those pair styles use the (mostly) same functional form.

I see two ways to work around this limitation.

  1. don’t use the CHARMM damping function on the LJ interactions, i.e. don’t use a hybrid pair style, but just lj/cut/tip4p/long for everything.
  2. do what is suggested in 1. but only use it to write out the mixed coefficients with the write_coeff command — LAMMPS documentation
    then you can delete the PairCoeff section and instead modify the pair_coeff commands written to the file as needed for your hybrid pair style. If desired, the also is the option to include a PairIJCoeffs section instead of a PairCoeffs section.

The text explicitly says that this is an additional requirement. With “hybrid” one pair of atom types can only be assigned to a single pair style, with the other two variants, it can be assigned to multiple. E.g. you could have lj/cut for some and lj/charmm for others and then tip4p/long.

Come to think of it. Using coul/long on some pairs of atoms and tip4p/long on others leads to inconsistent coulomb interactions. Within the tip4p pair style, all coulomb interactions for water oxgen atoms are translated to the point M and the forces projected back. for the pairs where coul is applied the oxygen location will be used.

So from the two options I suggested, option 1. (not to use hybrid) is the only meaningful option. The error from the coulomb by not having all coulomb treated with the tip4p/long part is going to be far larger than the error from using lj/cut instead of lj/charmm.

Thank you very much for clarifying and for the recommendation! This is working.

May I suggest the following changes to the documentation to make this clearer to other users?

The pair_hybrid docs refer to “mixing” in two different ways. The first way is the mixing we’re discussing here (generating I-J paramters from I,I, and J,J), but there are examples of another kind of mixing, which I don’t fully understand, that applies when using pair modify special:

Here is an example for mixing CHARMM and AMBER:
Here is an example for mixing Tersoff with OPLS/AA

These headings are partly what led me to believe that LAMMPS could automatically mix (in the first sense) parameters from different sub-styles. Perhaps a different term for “mixing” in the headings of these two examples could be used?

Second, I’d suggest a small addition (in bold) to the following section, which precedes those two examples:

For all of the hybrid, hybrid/overlay, and hybrid/scaled styles, every atom type pair I,J (where I <= J) must be assigned to at least one sub-style via the pair_coeff command as in the examples above, or in the data file read by the read_data, or by mixing as described below. Also all sub-styles must be used at least once in a pair_coeff command. Note that LAMMPS never performs mixing of parameters from different sub-styles. If you wish to do this, you must do so by manually setting I-J parameters via the pair_coeff command.

Feel free to modify of course. I hope this is helpful to others.

Yeah, “combining” is a more accurate term.