Casimir force on real materials—the slab and cavity geometry