## 1 Introduction  
Nanotubes (NTs) are a family of compounds having properties as conducting or semiconducting materials with good heat conductivity and a large surface area. They have potential use, for instance, in the field of materials science, nanotechnology [1], molecular electronics [2, 3], and medicine [4].  
The properties of nanotube depend upon several factors including chemical constitution [5], configuration [6, 7], diameter [8], and length [9].  
Carbon NTs (CNT) when are doped with nitrogen increase their conductivity. Theoretical systematic studies [5] have been carried out to analyze this effect on the properties, of some particular zigzag and armchair CNT structure modifications, or defects, such as a number of vacancies, and replacement of carbon atoms by one to four nitrogen atoms.  
Methods of NT structure generation by computers are known. For instance [PERSON] et al. [10] generate Cartesian coordinates of regular nanotubes starting with a program that requires a specified (n, m) chirality, while [PERSON] and [PERSON] [11] determine coordinates of a heterojunction between two arbitrary carbon nanotubes; both group of researchers start from a graphene sheet. Their aim is to create, by software, nanotubes with hexagonal cyclic carbon structures, generating some specific \"defects\". Particularly, [PERSON] and [PERSON] introduce only one pentagon and one heptagon for their heterojunctions. Their software CoNTub [11] is a nanotube generation algorithm that connects both tubes based on a topological algebra that takes into account a number of combinations and relative orientations between the considered defects by means of a continuous strip of hexagons containing pentagon and heptagon cycles as defects. However, this software does not generate zipper nanotubes neither it takes into consideration the exchange of carbon atoms by other atoms in order to form doped nanotubes.  
The most important \"defects\" or variation requirements in the nanotube structures however belong to another sequence of cycles that give rise for instance to zipper nanotubes which include cycles of 5, 7 and 8 members [3, 12].  
[PERSON] et al. [3] using computer simulation tools, have inserted molecular moieties of two carbons into a single-walled carbon nanotube; however this design is not just a generation software for carbon nanotubes, in the sense that they apply modifications to an already created NT structure. They find that a good method of design is by inserting, horizontally, a two carbon moiety at the mid-point of two opposite sides of a hexagon thus creating two condensed pentagons surrounded by heptagons. If insertion is done in different positions located at a same distance from the end of the NT a bumping nanotube is formed, but when insertion is done along the longitudinal axis of the NT a zipper NT is obtained. If insertion is repeated along the longitudinal axis from one end to the other, is also possible to get multiple zipper nanotubes.  
This means that in order to get a wide molecular structure diversity of nanotubes a general algorithm for NT generation with a common and simple software package is necessary.  
In this paper a general nanostructure generation method based on a flat graphene sheet constituted by hexagons of carbon atoms is described. On this generated graphene sheet several modifications are done to finally obtain a nanotube which can have variable composition, configuration, shape, and size, including cycles of different sizes as in zipper NTs. Our algorithm generates zipper NTs and allows for changing NT carbon atoms for other atoms.