Modifying pair_style gran/hooke

Dear Developers of LAMMPS,

Hope you are fine.

I need to make a slight change to the pair_style gran/hooke.

The change is very simple. The Hook force depends on particle overlap delta

F \propto \delta

We need to modify it to

F \propto \delta ^ exponent

and we want to provide the exponent in our lammps input script

It seems we should modify pair_gran_hooke.cpp and pair_gran_hooke.h and give a new name for it let say pair_gran_hooke_exponent

and inside that code probably we should just change this line

ccel = kn*(radsum-r)*rinv - damp;


ccel = kn*pow ( (radsum-r), exponent) * rinv - damp;


Would you mind please help us to do the rest, I guess we should add this new function to some lists and then recompile it.

Yours sincerely,


please help yourself to the documentation about modifying LAMMPS first:
and post to the mailing list again, if you have more specific questions.