We derive a new set of equations of motion in conjunction with proper isothermal-isotension and isoenthalpic-isotension ensembles to be used in molecular dynamics simulations for a system under anisotropic loading. The new equations of motion satisfy the requirement of invariance of physical properties with respect to the simulation cell transformation, and hence are more appropriate for use in studying a system undergoing a structural transformation. We also present the correct expressions for calculating the elastic constants in these ensembles.