st: Constraints in Stata

1)
I'd like to ask whether or not it's possible to impose a non-linear
constraint (with equality) in a maximum likelihood setting in Stata?

More specifically, I'd like to impose that the average of a two mass point
discrete distribution is equal to a constant. Let (v1,v2) denote the two
mass points, and (p1,p2) their associated probabilities. Among other
parameters I am also trying to estimate{v1,v2,p1,p2}, whose identification
comes from variation in other components of the model (this is a mixed
proportional hazard model, where (v1,v2) are assumed to be the mass points
of the frailty distribution). However, if I understood it right, one needs
to explicitly impose as an identification condition that the average of the
frailty distribution is finite: EV = p1*v1 + p2*v2 = constant. But this is a
non-linear restriction in this setting, for {v1,v2,p1,p2} are parameters.

2)
Since I couldn't find any built-in facility to do that in Stata, I did
something that I'd like to check whether is valid. Inside the -ml- program
that I wrote I added EV as an extra parameter. It doesn't enter my LF,
though. Then, I used -constraint define # [EV]_cons = 1- , and called -ml
model d0 (...), constraint(#)-. Is this a correct "trick"?

3) Do you know any econometric software that can handle non-linear
constraints in a ML set up?