Electronic structure and magnetic properties of metallic systems based on rare earths and d transition elements