If you wish to use lammps for this task, and are willing to try out beta software, bond/react can do this using the branch currently available here:
New atoms are positioned using the optimal translation/rotation of a pre-reaction molecule template, and bonds/angles etc. between new and existing atoms are added. This code has been tested by several users so far.
Thanks Jacob for posting a link to this code! I see you included documentation for this new functionality too (“modify_create”). This is awesome. I’m looking forward to trying it out. With regard to Musa’s question, the only concern I have using fix bond/reaction is that there is a danger this fix might modify both the inside and outside of the carbon nanotube. (However, since the surface is curved, it should be possible to distinguish between the inside and outside orientation of the carbons on the nanotube surface by using the “rmsd” constraint with a very small allowed “RMSDmax” deviation. Small “RMSDmax” requirements will be less forgiving.)
Otherwise, I would certainly check out the many tools for pre/postprocessing as Axel suggested.
I might be able to help you out here. But first I need to know more about how you want to represent your carbon nanotube. Is the carbon nanotube:
- completely rigid, or
- flexible using the AIREBO force field (or some other manybody pair-style), or
- flexible and connected with explicit bonds, angles, and improper interactions?
1-2) In the first two cases, it is not necessary to connect the carbon atoms together using bonds. In that case, I have created moltemplate files to build a nanotube with Amine groups attached to random carbon atoms. The carbon nanotubes are rigid but are allowed to move. The amine groups use the OPLSAA force field.
Moltemplate users can download the example here. (The link may change in the future, but it is in the “all_atom/force_field_OPLSAA” directory distributed with the moltemplate examples.)
- If you need explicit bonds connecting the carbon atoms together, I have been (finally) working on code that can create bonds between nearby atoms automatically. I’m not sure it’s ready to post on the moltemplate github page (Hopefully this will change soon), but for now, I can email it to people who need it.