Is it possible to apply mixing rules after all pair coeffs are set?

Hi all,

From what I read in the documentation of pair_coeff, I think it’s not possible, but I’m still wondering if there is an elegant way to do the following things in order:

  1. Use a pair style that has a mixing rule (say lj/cut), assign pair coeff for only I = J pairs; the mixing rule automatically determine the unspecified parameters for I != J pairs
  2. Run simulations for several steps
  3. Use pair_coeff to re-specify coefficients for pair I = J, and use the mixing rule to update for the pairs I != J

I knew specifying pair_coeffs explicitly for all these I != J should always work (and is preferred?), but I’m wondering if there is any simpler way to achieve this?

Many thanks in advance,
Tianpu

LAMMPS will take note for which pairs of atom types settings were made a for which not and then re-mix at the beginning of a run. Please run the following example input and see for yourself:

region box block 0 1 0 1 0 1
create_box 2 box
mass * 1.0
pair_style lj/cut 1.0
pair_coeff 1 1 1.0 1.0
pair_coeff 2 2 2.0 1.0
run 0 post no
write_coeff mixed.coeffs
shell head -5 mixed.coeffs
pair_coeff 1 1 2.0 1.0
pair_coeff 2 2 2.0 1.0
run 0 post no
write_coeff mixed.coeffs
shell head -5 mixed.coeffs
pair_coeff 1 1 1.0 1.0
pair_coeff 2 2 2.0 1.0
run 0 post no
write_coeff mixed.coeffs
shell head -5 mixed.coeffs

Many thanks Axel for the answer and the example script! I will test it and see. Just out of curious, which part of the source code notes down the pairs with coefficients determined by mixing rules? I recall when I read the individual pair style source codes, I saw for those pair with coefficients unspecified, a “mixing rule function” is called, does it also mark down that I J pair?

Tianpu

The Pair::setflag array stores this information. It is set to 1 for pairs of atom types in the Pair::coeffs() function of the individual pair style. Mixing is done in Pair::init_style() for pairs with setflag equal to zero.

Understood. Thanks for answering about my confusions, this is very helpful!