You can’t integrate through the singularity – the solution makes no sense because the derivative, q’'[phi] goes to -Infinity at that point. You need to understand what you are trying to solve and determine why the equations blow up. Maybe you set poor initial conditions, maybe you have the wrong equations.
I like your approach of symmetrically jumping over the singularity (fix the q’[x] to the absolute value and restart from there). Its clever.
I’m curious, What would be the physical meaning of that solution? Is it connected to the first solution in any way? Or is it just a reflection across the singularity?
Marius, this is a good way of resolving the singularities in the numerical solution. The parametric plot of the solution almost makes an orbit. Is there a way to extend the solution even further for every singularity?