First-principles and classical molecular dynamics study of threshold displacement energy in beryllium