Ab initio molecular dynamics (MD) can be carried out on the ground and excited state Born–Oppenheimer potential hypersurface. In addition non-adiabatic Tully-type Surface Hopping MD can be performed using TDDFT. At the start of an MD run the user must specify the initial atomic positions and velocities and give some general instructions for the run. This is managed by running the interactive program Mdprep and generating the command file mdmaster. If this is successful, the MD run itself may be started: jobex -md. Time is then advanced in steps. The electronic potential energy and its gradients are calculated quantum mechanically at the required coordinates each timestep (as detailed above, e.g. dscf and grad). The MD program frog uses the Leapfrog Verlet algorithm  to turn the gradients into new atomic positions and velocities. The atoms thus undergo classical Newtonian dynamics on the ab initio potential hypersurface. Trajectory information is recorded in a log file (mdlog). It is possible to instruct frog to heat or cool the system, use a thermostat for canonical dynamics, conserve total energy or read in new positions or velocities: the appropriate keywords are described in Section 21.2.23 below.