First-principles studies of the dynamics of [2]rotaxane molecular switches.