Ferromagnetism and antiferromagnetism of rare-earth metals