Pairwise force calculation in EAM potential

Dear LAMMPS users,

I would like to calculate thermodynamic properties, which need the information of interatomic/pairwise force, distance, etc. (not the total force on atoms).

I noticed that in pair_style. cpp, there will be compute() function working on calculation of total force on atoms, and the intermediate results like delx*fpair are what I want for post-processing in other calculations.

I want to impose this calculation into a fix.cpp, but I am not sure about how to replicate the process of calculating pairwise interaction like pair_**.cpp does, more specifically, like pair_eam.cpp does.

I have done this replication for simple pair style, like pair_morse.cpp. I just redefine the parameters, and copy the compute () code whenever I need that part.

But for complicated case like pair_eam. cpp, I found the definition of parameters and pre-processing quite complicated. And I am not sure what is the procedure of each sub-function for defining parameters.

Can I just copy the code in compute into fix.cpp? and then how to access all the parameters defined in pair_eam.cpp?

I appreciate any suggestions on either general procedure/idea or specific solution.

Thanks!

Dear LAMMPS users,

I would like to calculate thermodynamic properties, which need the
information of interatomic/pairwise force, distance, etc. (not the total
force on atoms).

I noticed that in pair_style. cpp, there will be compute() function working
on calculation of total force on atoms, and the intermediate results like
delx*fpair are what I want for post-processing in other calculations.

I want to impose this calculation into a fix.cpp, but I am not sure about
how to replicate the process of calculating pairwise interaction like
pair_**.cpp does, more specifically, like pair_eam.cpp does.

I have done this replication for simple pair style, like pair_morse.cpp. I
just redefine the parameters, and copy the compute () code whenever I need
that part.

But for complicated case like pair_eam. cpp, I found the definition of
parameters and pre-processing quite complicated. And I am not sure what is
the procedure of each sub-function for defining parameters.

Can I just copy the code in compute into fix.cpp? and then how to access all
the parameters defined in pair_eam.cpp?

I appreciate any suggestions on either general procedure/idea or specific
solution.

what you are describing sounds like a bad idea where you are wasting a
lot of programming effort and will create a maintenance nightmare.
why not use the same strategy as in compute group/group? i.e. loop
over a custom neighbor list and call the Pair::single() function for
each pair?

axel.

I assume you’re referring to the pair interaction force Fij in the Irving-Kirkwood formalism; the single method programmed into most pair potentials can be called to deliver this. In the case of those without the single method template you need, like many-body potentials which can have an effectively computed pair interaction force, you can define your own version of a pair interaction method as a virtual function in pair that will then be inherited and implemented in the base pair style class. This way you wont need to copy paste anything about the potential parameters or computation outside of the pair style’s implementation.