First-principles simulation of charge injection at metal/polymer interfaces