Modeling ferrous–ferric iron chemistry with application to martian surface geochemistry