Modelling nanowires : crystals encapsulated in carbon nanotubes.