Changing spring constant in each time step

Dear lammps-users

I want to simulate Langevin dynamics of a dumbbell where the two particles are connected by a harmonic spring with spring constant K. However, I have a set of K values and I want to vary the K in each time step of the simulation. How can I do that?

have you looked at fix adapt?
you have to be more specific about how you want to change K if you want more specific advice.

…and technically speaking, if you would change K in every step, it is no longer a harmonic spring. :wink:


Dear Axel,

Actually, I want to simulate the Langevin dynamics of a dumbbell system where the dumbbell will experience an additional random force along the bond-vector. How can I implement this?

you already have random forces in that direction from the general per-atom forces that do not know about the bond.
if you want an additional random force just in the direction of the bond, you will have to write a new pair style (either from scratch or as a derived class from an existing pair style that just adds the random force).