Modeling semiconductor heterojunctions in equilibrium