Rolling nanotubes with c2x
From version 2.31, c2x can roll sheets into nanotubes. The input structure must be in the plane defined by the a and b axes, with c, the non-periodic direction, being perpendicular to this plane. Slight deviation from the plane is permitted, so sheets of metal dichalcogenides, such as MoS2, can also be rolled up. In such cases relaxing the geometry is particularly important, as c2x cannot predict how the curvature will affect bond-lengths.
On being given a vector to make the circumference, which must be an integer combination of the a and b lattice vectors, c2x will attempt to create a nanotube.
Note that this notation is not equivalent to the (n,m) notation used to describe carbon nanotubes, and is not independent of the choice of initial cell. However, if the initial cell is a primitive hexagonal cell with γ=60°, as it is in the example below, then the two notations are equivalent.
C2x can also process the output of many DFT codes so that radial plots can be produced readily.
As an example, consider a sheet of graphene, given here as a .cell file:
%block LATTICE_CART 2.4577810 0.0000000 0.0 1.2288905 2.1285008 0.0 0.0000000 0.0000000 24.0 %endblock LATTICE_CART %block POSITIONS_FRAC C 0.3333333333 0.3333333333 0.500000000 C 0.6666666667 0.6666666667 0.500000000 %endblock POSITIONS_FRAC
This can be converted to a nanotube with commands such as
$ c2x -y=10,0 graphene.cell tube1.xsf
and
$ c2x -y=6,6 graphene.cell tube2.xsf
The two nanotubes thus formed are quite different - one has bonds parallel to the circumference (an "armchair" form), the other parallel to its length (a "zig-zag" form). The images below show three units of the nanotube along their lengths.

When creating nanotubes, c2x will make a small adjustment to the
radius in an attempt to preserve bond-lengths. This can only
possibly work if the input sheet is truly two dimensional, and can
be turned off with the -R flag. Attempts to roll
sheets which are not strictly 2D will inevitably compress the
inside and stretch the outside.
If one wishes to control the size of the cell perpendicular to the tube's length, and optional third parameter may be specified:
$ c2x -y=6,6:20 graphene.cell tube2.xsf $ c2x -y=6,6:2nm graphene.cell tube2.xsf $ c2x -y=6,6:35B graphene.cell tube2.xsf
for 20A, 2nm (the same), and 35 Bohr respectively.
Alternatively, one can use c2x to adjust vacuum regions in a post-hoc fashion:
$ c2x -Xab=20 tube2.xsf new.xsf
Finally, there are some example calculations on nanotubes.