Re: psf creating for carbon nanotube

From: Jian Liu (
Date: Sun Aug 15 2010 - 07:40:32 CDT

Dear Sara
I've write a script for SWNT'psf generating, it would be helpful for you.

# Tcl Script for Preparing pdb/psf of SWNT
# Programed by bay <bay__gulf618 at sina dot com> on June 22, 2010
# Usage: nanotube2 <l> <n> <m> [<output>] after source this script

package require nanotube
package require psfgen
proc writetop {{op ""}} {
&nbsp; if {$op=="del"} {
&nbsp;&nbsp;&nbsp; file delete
&nbsp; } else {
&nbsp;&nbsp;&nbsp; set fz [open "" w]
&nbsp;&nbsp;&nbsp; puts $fz "* >>> Top File for C Cluster<<< "
&nbsp;&nbsp;&nbsp; puts $fz "0&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "
&nbsp;&nbsp;&nbsp; puts $fz "MASS&nbsp;&nbsp;&nbsp; 21 CA&nbsp;&nbsp;&nbsp; 12.01100 C \n&nbsp; "
&nbsp;&nbsp;&nbsp; puts $fz "RESI CNT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "
&nbsp;&nbsp;&nbsp; puts $fz "GROUP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "
&nbsp;&nbsp;&nbsp; puts $fz "ATOM C&nbsp;&nbsp;&nbsp; CA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.00 \n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "
&nbsp;&nbsp;&nbsp; puts $fz "PRES LINC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "
&nbsp;&nbsp;&nbsp; puts $fz "BOND 1C 2C \n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "
&nbsp;&nbsp;&nbsp; puts $fz "END&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "
&nbsp;&nbsp;&nbsp; close $fz
&nbsp; }

proc nanotube2 {length n m {output nanotube}} {
&nbsp; nanotube -l $length -n $n -m $m
&nbsp; set sel1 [atomselect top all]
&nbsp; $sel1 set resid [$sel1 get index]
&nbsp; $sel1 writepdb tmp1.pdb

&nbsp; writetop
&nbsp; resetpsf
&nbsp; topology
&nbsp; segment CCC {pdb tmp1.pdb}
&nbsp; set xyz [$sel1 get {x y z}]
&nbsp; foreach c1 [$sel1 get resid] {
&nbsp;&nbsp;&nbsp; foreach c2 [$sel1 get resid] {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set dist [vecdist [lindex $xyz $c1] [lindex $xyz $c2]]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if {$c1 < $c2 && $dist < 1.8} {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; patch LINC CCC:$c1 CCC:$c2
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp; }
&nbsp; }
&nbsp; coordpdb tmp1.pdb CCC
&nbsp; regenerate angles dihedrals
&nbsp; writepdb ${output}.pdb
&nbsp; writepsf ${output}.psf
&nbsp; writetop del

Jian Liu
Master-degree Graduate Candidate Majoring in Molecular Modelling
Outstanding Students and PhD. Wanted, CV:

----- Original Message -----
From: sara <>
Subject: namd-l: psf creating for carbon nanotube
Date: 2010-8-15 15:48:36

Hi All
I want to simulate carbon nanotube but I have a problem.
I make it's pdb file but when I want to make the psf file it gives error. it says the topology file is not match to CNT.
please guid me , which topology file I shoud load for this case.
if somebody has this file or the like file, please send for me.


This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:54:25 CST