At risk of being annoying, I wrote a program called “moltemplate” which might help build this system as well.
I replied to your post in case someone else googling this problem is looking for alternative ways to build these systems. I confess that in your case I’m not sure my “moltemplate” tool is the best choice for you. Moltemplate is currently unable to create bonds between nearby atoms automatically. (Moltemplate currently forces users to supply a file containing a long list of bonds between all pairs of bonded atoms in the system, explicitly. This is often too much trouble for a bonded crystalline system, because there are so many of them. So if you need this feature, I hesitate to recommend moltemplate.)
However if you can live without explicit bonds between carbon atoms in the diamond crystal, then moltemplate might be useful. Take a look at the following two examples:
Both examples demonstrate how to build crystalline systems, and nanotubes, and how to delete atoms manually. Notice the lack of bonds between atoms in the walls. This is okay, because in both examples, the walls of the system (made out of graphene in the first example) are immobilized, so there is no need to define bonds between these atoms to hold them in place.
If you need to allow the diamond lattice to move (for example because you want to simulate vibrations of the carbon atoms in the diamond crystal), then this approach will not work unless you are willing to use a manybody potential such as AIREBO to keep the diamond atoms in place. Alternatively, if you are content to immobilize the diamond atoms, but you need to allow vibrations of the nanotube, then you can either use the AIREBO potential (not included in the example above), or you can use Axel’s nanotube builder tool (mentioned below), which uses bonded interactions to preserve the shape of the nanotube.
To create diamond, you would have to create a diamond unit cell and use moltemplate’s “new” command create a 3-dimensional array of diamond lattice unit cells. (Pages 16-19 and page 39 of the moltemplate manual demonstrate how to build a rectangular lattice out of water molecules and cut holes in it using moltemplate’s “delete” command. Instead of water, you would supply a diamond unit cell. There is an example using a similar approach to build a crystal of Aluminum here.) At that point, whether you want to allow the diamond atoms to move (for example, using the AIREBO potential), or immobilize them would be up to you.
If you do need explicit bonds between the carbon atoms in the nanotube, but are willing to immobilize the diamond atoms (so that they do not need bonds to remain stationary), then you can use Axel’s useful nanotube builder VMD tool to create a nanotube, save the result as a LAMMPS data file, import the data file into moltemplate (using “ltemplifly.py”) and then use moltemplate to build the complete system (including the diamond and the nanotube). This approach is sketched here:
I’m not at all sure that this would be easier than simply using VMD and topotools to build the entire system.
So, by all means, try your current method first.
If you run into difficulty, take a look at the moltemplate examples above.
It’s good to have backup options…
(If I enjoyed programming in TCL any more than I currently do, I probably would have never written moltemplate.)