Collapsing carbon nanotubes and diamond formation under shock waves