Relationship between Energy and Force form the compute group/group pair command

Dear Lammps users,

My simulation model is made up with two slabs A and B. The bottom of A is fixed to the space and the rigid B slab is lifted upwards away from Slab A 0.1Å every 4000 time steps. To calculate the interaction force and energy between Group A and Group B, I used the compute group/group command, which is as follows.

compute adh_pair A group/group B pair yes

The results are as shown below, where c_adh_pair represents the interaction (pair) energy, and c_adh_pair[1] c_adh_pair[2] c_adh_pair[3] stand for the interaction force along x, y and z-axes which are the output of Lammps software, respectively. F_adh_pair is the interaction force which is calculated via dividing the interaction (pair) energy difference Dc_adh_pair by displacement 0.1Å,

I notice that F_adh_pair is not consistent with c_adh_pair[3],which conflicts with common sense. Could you please help figure out why the inconsistence takes place here and let me if it is reasonable? Many thanks in advance.



# Time-averaged data for fix adhesion_pair

Can you try a smaller displacement to see if agreement is better? Computing the force from energy difference divided by displacement is only valid for an infinitesimal displacement…