Nonlocal density scheme for electronic-structure calculations