Bending of atomic monolayers from first principles