SMS: Binary population synthesis: Theory and applications