Constraint-based methods for phasing in crystallography