Re: [lammps-users] aminos-modifed CNT

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:

  1. completely rigid, or
  2. flexible using the AIREBO force field (or some other manybody pair-style), or
  3. 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.)


  1. 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.


Dear Andrew,

Could we repeat the procedure with amorphous polymeric nanofiber not nanotube? And instead of amino group I want to graft maleic anhydride groups on surface of nanofiber.

Could we repeat the procedure with amorphous polymeric nanofiber not nanotube?
And instead of amino group I want to graft maleic anhydride groups on surface of nanofiber.

I confess, I work in biology. I’m not familiar with the term “nanofiber”. (Is this a long bundle of many nanotubes, or a long complex polymer, or something else?)

If it helps, for the nanotube example, I am using the “new” command with bracket notation . This allows me to create many copies of a molecule (or unit cell), with a single command. In addition I am using the “new random” feature of moltemplate which selects each array element in the array randomly. This is explained here:
(Also see figure 4 on page 41. Note: The links to these chapters in the manual may change in the future as more content is added.)

However if you want to have more control, you can create a long file containing a list of “new” commands that tells moltemplate exactly what is inside your polymer (or nanotube), and where you want each monomer (or unit-cell) to go (as well as its orientation). For examples, see here:

But this gets tedious if you have long polymers. Unfortunately moltemplate does not yet have for-loops (which are useful for creating polymers).

But you can write your own short script containing a for-loop that generates all the “new” commands as well as the list of bonds connecting them together, as in the examples above, and save them in a file. (Then tell moltemplate to read this file.) This is a useful exercise. If your polymers are not bent, then that’s what I would do. This way, you understand how the polymer is created and you can control exactly what kind of monomers are inside your polymer.

Alternatively, the “” python script generates curved polymers automatically if you provide it with an .LT file containing the definition of one or more monomer types. (That is the script I use most often. You can generate almost any polymer with that script.) There is an example of that script in use here. (However in that example, the polymer is not random. All of the monomers in that example are identical.) You mentioned that you wanted to make random modifications to some of the monomers in a polymer. The script allows you to specify a list of the names of the monomers you want to appear in each polymer using the -sequence argument. The names could represent moltemplate objects which represent different modifications of the same monomer (like “Graphene” and “Graphene_NH2” in the nanotube example) or entirely different monomers. But you must generate a file with this list of names-of-monomers yourself. (The “” python script is useful if you want to modify the bonds in some of the monomers.)

Again, I’m not sure what you are trying to build, but I hope at least some of this is relevant to you.