Geometric algorithms for modeling protein structures