In this work, we develop a new algorithm for nonequilibrium molecular dynamics of fluids under planar mixed flow, a linear combination of planar elongational flow and planar Couette flow. To date, the only way of simulating mixed flow using nonequilibrium molecular dynamics techniques was to impose onto the simulation box irreversible transformations. This would bring the simulation to an end as soon as the minimum lattice space requirements were violated. In practical terms, this meant repeating the short simulations to improve statistics and extending the box dimensions to increase the total simulation time. Our method, similar to what has already been done for pure elongational flow, allows a cuboid box to deform in time following the streamlines of the mixed flow and, after a period of time determined by the elongational field, to be mapped back and recover its initial shape. No discontinuity in physical properties is present during the mapping and the simulation can, in this way, be extended indefinitely. We also show that the most general form of mixed flow, in which the angle between the expanding (or contracting) direction and the velocity gradient axis varies, can be cast in a so-called canonical form, in which the angle assumes values that are multiples of π (when a mixed flow exists), by an appropriate choice of the field parameters.