Cyclic density functional theory: A route to the first principles simulation of bending in nanostructures