Ab initio calculations of van der Waals interactions in one‐ and two‐dimensional infinite periodic systems