Molecular dynamics with quantum heat baths: Application to nanoribbons and nanotubes