Change the evolution equations to
dx/dt = v;
Then, define a function to return correct force for different (x,v) values.
If you need to take care for short time event, e.g. collision , then you can use event in EJS.
What is left is your physics model to model the case you want. ;)