A Monte Carlo approach to chemical bonding in condensed phases