Nanofluidic osmotic diodes: Theory and molecular dynamics simulations