Table of Contents
|
Description
BuildCstruct is a python script used to build the following allotropes graphite structures:
Those structure can also be build as periodic (TINKER definition), so that infinite surface or CNT can be modeled. Structures generated with the last version (1.1) of BuildCstruct can be saved in different formats:
- TINKER XYZ (slow, due to the determination of the connectivity)
- XYZ
- Gromacs GRO
For the gromacs format, the cell is cubic and the default length of the vectors is 10nm. If periodicity has been used, the proper lengths are used.
Requirements
BuildCstruct requires python and python-numpy installed
Syntax
To run buildCstruct simply type:
buildCstruct [options] outfile
The available options are:
—version
show program's version number and exit.
-h, —help
show this help message and exit.
-c, —credits
display credits.
-s, —structure
specify the kind of structure to build. Valid structures are: armcnt, zigzagcnt and hopg.
-p, —periodicity
build a periodic structure for TINKER.
-g, —geometry
specify the geometry of the structure. For CNTs, use -g index_n cnt_length while for hopg use -g size_x size_y (see examples below). Size_x, size_y and cnt_length are in Å.
—xyz
save structure in XYZ format (version 1.1 only).
—gro
save structure in gromacs GRO format (version 1.1 only).
outfile
is the name of the file where to save the structure.
Examples
Build a non-periodic, armchair, CNT having (n,m)=(10,10) and length 30Å
Syntax
buildCstruct -s armcnt -g 10 30 arm10x30.xyz
This will build a non-periodic, armchair CNT having (n,m)=(10,10) and length 30Å. The program print out some structural information that are worthy to be saved in a file for late. Below the output for this particular CNT:
*******************************
armchair CNT: n= 10 l (ang)= 30.7439018343
periodicity (if apply) (ang)= 31.9736579077
diameter (ang): 13.5600011514
Atoms: 560
saving structure...
*******************************
Since we built a non-periodic CNT, the real length is of 30.7439Å. The output file is in TINKER format (Hs are at the end of the file), but without assignment of the atom types:
560
1 C 6.780001 0.000000 0.000000 0 20 21 521
2 C 6.193839 0.000000 2.757675 0 3 22 522
3 C 5.485136 0.000000 3.985184 0 2 23 523
4 C 3.390000 0.000000 5.871653 0 5 24 524
5 C 2.095135 0.000000 6.448164 0 4 25 525
6 C -0.708703 0.000000 6.742859 0 7 26 526
7 C -2.095135 0.000000 6.448164 0 6 27 527
8 C -4.536706 0.000000 5.038522 0 9 28 528
9 C -5.485136 0.000000 3.985184 0 8 29 529
...
551 H -7.287859 -31.687870 -0.708703 0 511
552 H -5.903164 -31.687870 -2.095135 0 512
553 H -5.583522 -31.687870 -4.536706 0 513
554 H -3.440184 -31.687870 -5.485136 0 514
555 H -1.954641 -31.687870 -6.631841 0 515
556 H 0.545000 -31.687870 -6.780001 0 516
557 H 2.212675 -31.687870 -6.193839 0 517
558 H 4.530184 -31.687870 -5.485136 0 518
559 H 5.326653 -31.687870 -3.390000 0 519
560 H 6.993164 -31.687870 -2.095135 0 520
Atom types can be fixed using the script fixtnkatypes.
The main axis of the CNT is along the cartesian Y-axis and the result is shown in the image below.
Please note that the weird orientation of the Hydrogen atoms is due to the way I build the CNT. You just need to cleanup the geometry by doing a short minimization (steep or cg in Gromacs, minimize in Tinker).
Build a periodic, zigzag, CNT having (n,m)=(10,0) and length 30Å
All the considerations made for the previous example are valid. This time the flag -p is used to build a periodic (infinite) CNT:
buildCstruct -s zigzagcnt -g 10 30 -p p-zz10x30.xyz
The structural informations are:
*******************************
zigzag CNT: n= 10 l (ang)= 32.66
periodicity (if apply) (ang)= 34.08
diameter (ang): 7.82887031499
Atoms: 320
saving structure...
*******************************
Since the nanotube is periodic, this time the length to use to set the size of the periodic box in TINKER (b-axis) is 34.08Å. The result is shown below.
Please note that since the CNT is infinite, no Hydrogen atoms are present in the structure.
Multiwalls CNTs
BuildCstruct can build only single wall nanotubes (SWNT). To create a multiwall CNT, you have to build individually the SWNT and then merge them together using, for example, the TINKER utility xyzedit. This is possible since all the SWNT share the same position and orientation for their main axis. The images below show a periodic, armchair multiwall CNT obtained by merging together a (10,10), a (15,15) and a (20,20) SWNT.
Front view. Three SWNT with index (10,10) (red), (15,15) (yellow) and (20,20) (blue) are used to build a multiwall CNT.
Side view of the multiwall CNT.
Graphite slab
Slabs of HOPG graphite can be built with buildCstruct:
buildCstruct -s hopg -g 30 30 -p p-hopg30x30.xyz
The command above will generate a periodic slab of graphite of about 30Åx30Å in size:
*******************************
HOPG graphite: a= 32.66 b= 30.7439018343
Periodic (if apply) (ang): a= 34.08 b= 31.9736579077
Atoms: 416
saving structure...
*******************************
The result is shown in the picture below:

Periodic slab of HOPG graphite.
CONTACTS
Do you like this program? Do you have suggestions? Drop me a mail at minoiaa_at_gmail.com or leave a comment.
LICENSE and TERMS OF USE
You are free to use, modify and redistribute buildCstruct as far as you keep it free as in beer.
As free(as in beer)ware software, buildCstruct comes with _ABSOLUTE_ _NO_ (as in NOTHING, NADA, NICTHS, NIENTE, RIEN) WARRANTY. The author is _NOT_ responsible if this software will erase your hard disks, empty your bank account, stole your car, seduce your wife, shave your dog or make any kind of mess and damages, including loss of data or worst. By using buildCstruct, you _ACCEPT_ these terms.
CHANGELOG & DOWNLOADS
Changelog
v 1.1 - March 2010:
- improved connectivity search algorithm
- added support XYZ format
- added support gromacs GRO format
v 1.0 - April 2009:
- first release of buildCstruct
Downloads
Rate this page:
I have just corrected a bug related to the building of graphite slabs. Please download the last version of the script or change the graphite subroutine with that posted below.
—
Andrea
A couple of days ago I received a mail about a bug in the 1.1 version of the script: if you save a non periodic CNT in gromacs. gro or cartesian .xyz formats, the hydrogens are labelled as carbon atoms.
If you have this problem, you can either download now the script from here or fix the one you already have:
in lines 555 and 575 just change "C" in line[0]
That will do the trick.
Ok, Marcus from the Universidad Nacional de Cordoba discover another bug:
line 583 should read as
outline=" "+str(float(pbc1)/10.0)+" "+str(float(pbc2)/10.0)+" 1\n"
This because the script builds the structures using Angstrom as unit length, while gromacs uses nanometers. The new line will fix this, using the proper conversion factor. Sorry about that.
The script has been update, so you can also download it to have a bug free version.
Please Give the pdb file guys….
I'm just curious why it doesn't give me a exact *.gro file. I tried to use this code " python buildCstruct -s armcnt -g 20 80 arm20x80.gro"
but vmd couldn't recognize what it is. VMD only could figure out one atom. And also I tried " python buildCstruct -s armcnt -g 20 80 arm20x80.xyz"
and tried to convert the xyz-coordinate file into the *.gro file by using "editconf -f arm20x80.xyz -o arm20x80.gro", but the window only shows that
the result of builtCstruct is irregular file to use for GROMACS. I don't know why I wasn't able to get the exact file just like you showed us.
Do you think you could let me know about that?
Hey, the graphene is pretty easy to build. I did everything explained in here but i still struggle with problems to get GROMACS NPT Simulation step run with a graphit sheet 40 A 40 A solvated in water using the Parinello Rahman Algorithm (first i tried peridiocity in all directions). There I get an error that molecule NNN (the number id of the atom) can not be settled. The NVT Simulation-Step is running. When i switch to berendsen algorithm I get the Warning message for every step. 1 % Scaling of pressure. I think it has something to do with my topology created and the periodicity of molecules maybe I need to specify that only the graphene topology should be periodic but not the water molecules ?
For all who are working with this tutorial you must be aware when creating the pbc topology GROMACS screws up the periodic bonds which has been created in the old "TINKERXYZ" format- When you directly create the GRO using this Python script then the gro format does not include the periodic bonds obviously (since it just contains the coordinates). So you must script it i.e. with a selfmade python script in order to get the correct periodic topology of bonds,angles and dihedrals.
Is there any publication related to this Python script ?
if I remember well, if you have the periodic bonds in the tinker format and you can get them to be visualised with VMD, fire up the tcl console and type:
topo guessangles top
topo guessdihedrals top
topo writegmxtop tmp.top
you are telling vmd to guess the angles and dihedrals from the bonds for the top molecule, and then write a fake topology. Either you adapt this topology or use it to add the missing bonds/angles and dihedrals to your topology.
could you share with us the python script for generating the periodic bonds ?
Regards
Running this with Spyder results in many errors. How did you run the script?
Hi, I wonder if you have ever worked with MWCNT, i'm really struggling with the NPT ensemble, apparently with the NVT ensemble the simulation works. A little help will be wonderful
Post preview:
Close preview