Semi-analytical solution for the generalized absorbing boundary condition in molecular dynamics simulations