Setting cutoff in added force

Dear all,

I am trying to add and extra force on all atoms in my system. It is only along x direction and values two times of the atom’s x coordinate. So it is quite straight forward:

variable force_x atom 2*x
fix all f1 addforce v_force_x 0 0

However, right now I expect to set a cutoff to my added force: the force will be zero if x coordinate higher than 1.0 . Otherwise it will still be 2*x. Is there any way to implement such force with a cutoff? I looked into “if” command for help but failed to figure it out…

Thanks.

Uke

you can multiply your atom style variable expression with a conditional. conditionals are supposed evaluate into 1.0 if true and 0.0 if false.

axel.