Water on surfaces from first-principles molecular dynamics