A statistical mechanical approach to restricted integer partition functions. (17th May 2018)