Correlation energies of diatomics obtained with a nonlocal density functional