Calculating the Electric Field in Nanostructures