Fix addforce: randomly changing the direction of force

Hello,

I am setting up a simulation (in 2d) where I impose an external force field.

Now, I want to randomly change the direction of the applied external force on each atom based on the following rule: d_theta_i = dt*eta_i

As far as I understand, the present setup cannot implement the above framework. Hence, I want to write a custom fix for this, that reads an initial external force field and updates this based on above rule at each timestep. Please let me know if I can do something easier to achieve this.

Thanks,
Vinay

A detailed discussion about how to write fixes for LAMMPS is in the Programmer Guide section of the LAMMPS manual: 4.8.7. Writing a new fix style — LAMMPS documentation