Electronic structure and magnetism of modulated structures