Toward a first-principles description of structures and processes in electrochemical energy conversion and storage