Bioenergetics and extracellular electron transfer in microbial fuel cells and microbial corrosion