The directed flow of charged hadron and identified particles has been studied in the framework of a multiphase transport (AMPT) model for Au197+Au197 collisions at sNN=200,130,62.4,39,17.2, and 9.2 GeV. The rapidity, centrality, and energy dependence of directed flow for charged particles over a wide rapidity range are presented. The AMPT model gives the correct v1(y) slope, as well as its trend as a function of energy, while it underestimates the magnitude. Within the AMPT model, the proton v1 slope is found to change its sign when the energy ...