Ab initio electronic structure calculations of metal-vacuum-metal junctions in nonequilibrium situations