A new treatment for calculating activities from phase diagrams involving intermediate compounds