2nd Force Constant From Lammps

In one of my project, I need to calculate the force constant between differnet paires of atoms, and there is how I do it.

Methods

group cAtom id 249
displace_atoms cAtom move 0.0 0.001 0.0 units box
dump 1 all custom 1 force_12.txt id fx fy fz
dump_modify 1 sort id format  "%d %10.15g %10.15g %10.15g"