Molecular Theory of Magnetism