There are many other states of mind that impair someones ability to control themselves. Certain typres of epilepsy for one.
The people who commit the most heinous crimes - the ones that inspire the clamours for vengeance the most - are generally suffering from conditions which impair their ability to make clear choices. If there is any deterrent that can make any difference here it is clearly around the certainty of being caught, not the punishment. Even then it is likely that this effect would be marginal as one of the underlying characteristics of these conditions is an inability to assess the consequences of ones actions.