molecule alignment

Does anyone have an example of how to rotate a molecule about it's principle axes to make the minimum dimensions be in the Z direction of a simulation box?