Versatile Geometry Optimization With Hard Constraints