First-principles and classical molecular dynamics simulation of shocked polymers