In this article we present methodology for simulating protein dynamics while imposing restraints derived from NMR measurements on partially ordered molecules. Such measurements may include residual dipolar couplings and chemical-shift anisotropies. We define a restraint potential for use in molecular dynamics and energy minimization. The presented potential is consistent with the simultaneously optimized molecular order tensor. Restraining can be performed with time and ensemble averaging. We performed a large number of molecular dynamics simulations of the histidine containing phosphocarrier protein with restraints on backbone N-H vector orientations derived from residual dipolar couplings. From these simulations it is evident that the use of time- or ensemble-averaged restraints is essential to leave the fluctuations of the restrained vectors unaffected. Without averaging the fluctuations of the restrained vectors are reduced significantly. This also has the effect of decreasing the apparent molecular order-parameter tensor.