Production of electricity by direct energy conversion