CTPAB is predicted to be a promising photocatalyst/photoelectrocatalyst for overall water splitting. Our investigations demonstrate that lattice topology and component optimization including center atoms and bridge functional groups play an important role in controlling the electronic and optical properties of 2D polymers, which pave a new way in designing promising non-metal photocatalysts for overall water splitting.