An algorithm and computer program for calculating composition phase diagrams