[lammps-users] fix external & pair_coeff

Dear LAMMPS users,

I use the “fix external” command to do MD simulations.

From the dump file of the simulation and by the “rerun” command I want to calculate the bond orientational order of atoms by the “orienorder/atom” command or the “RDF” or the “MSD” of the system!


The problem is that these commands require the pair_style command to be mentioned in advance!

Please do me a favor and let me know how I should deal with this issue!

you can use the pair_style zero (https://docs.lammps.org/pair_zero.html) since you don’t need to reevaluate the potential to compute these three properties.


Στις Δευ 18 Απρ 2022 στις 8:49 π.μ., ο/η Lamm Gro <[email protected]> έγραψε:


I have already tried that but it did not work!
this is the error: ERROR: All pair coeffs are not set (src/pair.cpp:253)

according to the documentation you can use the “pair_coeff * *” command. This will set the coefficients for all pairs.

you should also check your data / restart file whether you indicate pair coefficients there. This can be remedied with the nocoeff keyword.

Στις Δευ 18 Απρ 2022 στις 10:01 π.μ., ο/η Lamm Gro <[email protected]> έγραψε:


Thanks alot for your help.

These two commands removed the problem:
pair_style zero cutoff
pair_coeff * *

I have one more question:
when I use the “fix external” command the “pe ke etotal” of the thermo_style are completely unreasonable amounts!

I tried this:

compute eatm all pe/atom fix
compute sum all reduce sum c_eatm

but the result was zero!

Do you have any example file that shows how to deal with simulations with the “fix external” command?!

What the command “pair_style zero” does is to set all non-bonded interactions equal to zero and use the specified cutoff to build the neighbor lists and acquire ghost atoms
This is fine for computing the msd, rdf and orientation parameters in a post-processing step. These quantities do not need the value of the potential energy.
Also, what you observe for the pe values is absolutely expected and documented: since the non-bonded interactions are zero, the pe/atom is zero and the sum is also zero.

Personally, I do not have any example file to deal with simulations using the “fix external” command in a post-processing step as you now ask for.

Στις Τρί 19 Απρ 2022 στις 8:23 π.μ., ο/η Lamm Gro <[email protected]> έγραψε:

It is difficult to make specific suggestions without having any information about how fix external is used (there are two modes) and whether it is being called from C or from python.

But all its functionality is documented. There are tests in the unittest tree that showcase the use. Please see the discussion here:

I use the pf/callback mode of the “fix external” command:

There is no proof here that there should be any per-atom energy or viral data. This must be computed and set in your python code.