Tuesday, April 28, 2009

multiwall carbon nanotube & GROMACS

Force constants:

Bonds 47890 KJ/mol/nm^2
Angle 400 KJ/mol/rad^2
Dihedral 167.36 KJ/mol/rad^2

more swnts in GROMACS (back to large image files)

The tubes look a lot better when simulated without the caps. There is none of that weird buckling as before. It is interesting to note that the buckling occurred along a line containing a pentagon defect in the lattice.

Tuesday, April 21, 2009

Single Wall Carbon Nanotubes in 4.0.3 GROMACS and Windows Vista Part 1

Okay, I am starting to get results that are at least approximating what I would expect, by that I mean stays together and jiggles around. I'll get down to brass tacks and lay out how I did it and then later on talk about why I went about it this way, lessons learned, what's next, all that.

1. I used the oplsaa force field for this. This force field is not included in older versions of gmx. It already contains carbon in the atom types, so we don't have to add that. However we do have to add some cnt parameters to a couple of files. These files are all located in gromacs/top. The first file to change is ffoplsaa.n2t . We need to add a couple of carbon atoms bonded to two and three other carbon atoms. Open up the file in a text editor and add them to the bottom:

C opls_240 0 12.011 3 C 0.142 C 0.142 C 0.142

C opls_239 0 12.011 2 C 0.142 C 0.142

You can probably guess what's going on here: atom type, charge, mass, # of bonds, what they're bonded to and bond length in nm.

Here is my copy of the file: ffoplsaa.n2t

2. Next we are going to add some bond parameters to ffoplsaabon.itp. I just dropped these in at the bottom of the file where I saw other people had made some prior modifications:

; Added by TEM for CNTs

[ bondtypes ]

C C 1 0.14210 478900

[ angletypes ]

C C C 1 120.000 397.480

[ dihedraltypes ]

C C 1 0.000 167.360 1

Note there is some weirdness happening on the one side of the above tube. I'm not quite sure the dihedraltypes are correct, may need to revise that. Again here is my file: ffoplsaabon.itp

Okay, those were the changes. If you had read my previous post, don't worry about messing with the .rtp file. That was a messy fix and not necessary.

Next fire up cygwin and cd your directory to where you have you cnt pdb file. If you want a copy of my nano-capsule, here it is: swnt_capped.pdb

in cygwin, type: editconf -f swnt_capped.pdb -o swnt_capped.gro -d 2.0

This will create your .gro file with a 2.0 nm box around the tube.

next type: x2top -f swnt_capped.gro -o swnt_capped.top

This will create the topology file. The documentation says you can use a pdb file as input however I never got it to work with anything but the .gro file.

Next you need a simulation parameter file, md.mdp. Here is the one I used to get you started:

Put this file in your directory with your pdb, .gro and .top files. If you copy the text into a text file and save it as a text file, it usually doesn't work; copy an actual .mdp file and change the contents. So far the only thing I feel comfortable messing around with in this file is the simulation length and time step, lot going on here.

Now type: grompp -f md.mdp -c swnt_capped.gro -p swnt_capped.top -maxwarn 3

The experienced user may be interested to know that I used to have to set the maximum number of warnings to 150 to get past this...

And now: mdrun -s topol.tpr

The sim takes a couple of minutes to run through. You can then load the .gro and . trr file into VMD to view the results, make movies, whatever.

There is still more to go, need to figure out what is causing that buckling, a very knowledgeable professor has told me the potentials look too soft, bunch of stuff. If you have something to add to this, let me know.

Special thanks to Brian and Damian for putting up with the play-by-play emails, hope I'm not on the spam list now guys.

Monday, April 20, 2009

step closer to GROMACS and Carbon nanotubes, or some ramblings

Okay I figured out why I was getting all the short bond errors when I ran pdb2gmx (see previous post). I came across this paragraph in the gmx wiki:

"One point that is not made clearly in the manual is how to specify the connectivity between residues. This mechanism is protein-specific, and relies on the existence in each residue of atoms with the same names, i.e. the protein backbone atoms. The [ bonds ] section in the example in section 5.6.1 of the manual defines a bond between -C and N. This refers to the C atom in the previous residue. Similarly, one might use a +N prefix to refer to the N atom in the following residue."


This meant I never defined how the residues were connected together in my .rtp file. This explains why I got a bunch of short bond warnings and my topology file never had pairs, angles or dihedrals.

I've changed the [bonds] section of the .rtp from the cnt carbons to:

NT1 ]
C C 0 0

C C 0 0

[ bonds ]
C +C 0.14210 478900

However I can't be certain that adding a +C to the second C in all the bonds makes sense for all of them. I guess I need to know how you put together a large protein and then figure out how you assemble a carbon nanotube using the same basic steps...

Wednesday, April 15, 2009

I am trying to use GROMACS (gmx) to do some molecular dynamics simulations on carbon nanotubes. Since this is not what gmx is built for, I need to do a bunch of things to get it to simulate them. This is also, pretty much, my first time using gmx. Please note that there are a few missing pieces with the following, in that it WON'T allow you to simulate carbon nanotubes but instead create a pretty tube that dissociates/was never together in the first place/blows up. I will write a full, accurate, tutorial once all the kinks have been worked out. I am posting this here in the hope of finding some help working out those kinks, or maybe giving a couple of chuckles to those that have this down cold <-I don't think there are many though.


1. got a pdb file of a small carbon nanotube and made each atom a residue with a unique name, for example:
ATOM 4 C NT1 1 2.624 3.131 -6.155 1.00 0.00
ATOM 5 C NT2 1 2.043 3.538 -7.386 1.00 0.00
ATOM 6 C NT3 1 0.707 4.023 -7.386 1.00 0.00

Here is the pdb file of the test specimen. This is something I will automate if it turns out there's no better way. I'll post the script too.

2. added carbon to encadv's atom type file, ffencadv.ATP

C 12.011 ; cnt carbon

3. added the following to encadv's include topology file, ffencadvbon.ITP I got this information from Christopher Stiles' site. It is rare to find such good instructions for something like this. However these are for a previous version of gmx, and you quickly run into problems when trying to follow it for 4.0. This is what set me on my own course to trying to solve this problem; without Christopher's site though, I would not have even known where to begin with tubes.

[ bondtypes ]
; i j func b0 kb
C C 1 0.14210 478900

[ angletypes ]
; i j k func th0 cth
C C C 1 120.000 397.480

[dihedraltypes ]
; Encad proper dihedrals. Note that there is a difference pf
; sign in the cosine definition between Gromacs and Encad. All angle values
; here are thus offset 180 degrees.
; i l func q0 cq
C C C C 1 0.000 167.360 1

4. I added carbon to ffencadvnb.ITP. Right now I don't have a reason why I added it, and if these are non-bonded parameters, then I'm thinking it shouldn't be there?

name at.num mass charge ptype sigma epsilon
C 6 12.011 0.0 A 3.84423e-01 3.08863e-01

5. Created ffencadv.N2T using information from Christopher Stiles' site

6. Updated encadv's residue topology database by adding a residue for each atom in the tube. This will be a problem for large tubes, but I can automate the process too unless better ways are to be found. Here is an example for the first residue:

[ NT1 ]
C C 0 0

C C 0 0

[ bonds ]
C C 0.14210 478900

C C C 120.000 397.480

Here is the file ffencadv.RTP

Ok I think that is all the changes to gmx files I made.


1. fired up gmx in cygwin and from the prompt:

pdb2gmx -f swnt.pdb -o swnt.gro -p swnt.top

The console print can be seen here. Notice all the warnings about the short bonds? I originally thought these were from shifting the columns in the pdb file when I renamed the residues, but I realigned them with a PDB spec and still get the warnings. I think whatever is causing this could be a major problem.

swnt.gro swnt.top posre.itp

It looks like whatever is wrong is most likely in the above. I'm going to leave it there for now until I know all that's correct.

Saturday, April 11, 2009

GROMACS basics: running through the demo

I need to update my previous post on how to install gromacs (gmx). There is one more package you need to install with cygwin: tcsh

Apparently this is required to run csh scripts, which you need to do. If you have already installed cygwin, you can add the package to it by running the setup again and selecting the package. If you want to know what packages you have installed, you can use: cygcheck -cd

Now, there is a built in demonstration script that comes with gmx. It is located in:

[your path]/gromacs/tutor/gmxdemo (as you are about to see my path is rather redicioulous)

1. fire up cygwin
2 change your directory to gmxdemo:
cd c:cygwin/usr/local/gromacs/share/gromacs/tutor/gmxdemo

3. after you have the tcsh package installed, all you have to do is type:


This should start the demo and you'll get:



Welcome to the GROMACS demo.

This is a script that takes about 10 min to run.

In this demo we will demonstrate how to simulate Molecular

Dynamics (MD) using the GROMACS software package.

The demo will perform a complete molecular dynamics (MD) simulation

of a small peptide in water. The only input file we need to do this

is a pdb file of a small peptide.

If you have any problems or remarks with respect to this demonstration,

please mail to: gromacs@gromacs.org , or check the resources on

our website http://www.gromacs.org .




Then just follow the instructions, press enter when it says, pull on your beard every couple of seconds, hoping it doesn't choke again.

When the demo is finished, it'll ask you to start another program to view the results. I didn't. I used VMD to look at and make the above animation. And as you can tell there was a little help from videomach. There are lots of other programs to do this, just trying some thing new.

Once you have VMD installed:

1. From the main console: file>new molecule

2. load cpeptide_after_md.gro

3. in the main console, select cpeptide_after_md and file>load data into molecule

4. load cpeptide_md.trr this is the gmx trajectory file

5. use the play bar at the bottom of main to view the results.


Wednesday, April 8, 2009

How to install GROMACS on windows vista 64

1. Download cygwin from http://www.cygwin.com/
a. click on the link to "install from internet" and run the installer
b. when you get the dialog that asks you what packages to install expand and select "gdn" "gdb" and "make"
c. follow the rest of the installation instructions

EDIT: this website has a pictorial guide to install the packages with cygwin. I forgot to mention they are all under Developer, so expand that first.

EDIT: also install the tcsh package


2. Next you are going to need the GROMACS source code. You can get it here.
a. download and save the file someplace handy

3. Next you need FFTW. There are pre-compiled dlls for Windows, but I would recommend not using them unless you know how to set the path variables. The easiest way is to grab fftw-3.2.1.tar.gz . Again, save this someplace handy.

4. create a folder someplace (C:\FFTW) and extract FFTW to it.

5. start cygwin and change the directory to your FFTW folder: cd c:\fftw

6. type: ./configure --enable-threads --enable-sse --enable-float

7. then: make

8. then: make install

9. now create a folder for gromacs (C:\gromacs) and extract the distribution there. There should be a few folders like admin, src, etc.

10. in the cygwin console, change your directory to the gromacs folder: cd c:\gromacs

11. type: ./configure --enable-shared LDFLAGS='-L/usr/local/lib'

12. then: make (this took a couple of hours to run through)

13. then: make install

14. make links

15. make clean

when you get your prompt back in cygwin (or from a fresh session change your directory to c:\gromacs) type: luck

to test if you have access to gromacs. You should get something like:

gcq#93: "Pretend That You're Hercule Poirot" (TeX)

Also note I really haven't tested anything else yet, so this could all end up to be bogus. However if you're not really a computer guy, all bringing your ibook to dinner "in case you need to compile something" like me, then you may find this a good start. I'll update as necessary.

P.S. I like 7-zip for all my extracting needs. Let me know of any problems or mistakes with the above.