VMD scripting

From: Shirley Li (li19104_at_yahoo.com)
Date: Thu Oct 06 2005 - 14:33:21 CDT

# Split a file containing protein and water into separate segments.
# Creates files named myfile_water.pdb, myfile_frag0.pdb, myfile_frag1.pdb,...
# Requires VMD.
mol load pdb myfile.pdb
set water [atomselect top water]
$water writepdb myfile_water.pdb
set protein [atomselect top protein]
set chains [lsort -unique [$protein get pfrag]]
foreach chain $chains {
set sel [atomselect top "pfrag $chain"]
$sel writepdb myfile_frag${chain}.pdb
}
# Split a file containing protein and water into separate segments.
# Creates files named myfile_water.pdb, myfile_frag0.pdb, myfile_frag1.pdb,...
# Requires VMD.
mol load pdb myfile.pdb
set water [atomselect top water]
$water writepdb myfile_water.pdb
set protein [atomselect top protein]
set chains [lsort -unique [$protein get pfrag]]
foreach chain $chains {
set sel [atomselect top "pfrag $chain"]
$sel writepdb myfile_frag${chain}.pdb

Dear all,

 

I have a question about VMD scripting.

 

I have created the script file using a text editor such as "vi", and save it, such as the one attached below. How can I execute it? I tried "vmdtext -e split.s" but got a error message "vmdtext: command not found". Do I need to lounch VMD in order to run this script?

 

Your help/information will be greatly appreciated.

 

Shirley

 

 

-------------------------------------- split.s --------------------------------------------

 

# Split a file containing protein and water into separate segments.

# Creates files named myfile_water.pdb, myfile_frag0.pdb, myfile_frag1.pdb,...

# Requires VMD.

mol load pdb myfile.pdb

set water [atomselect top water]

$water writepdb myfile_water.pdb

set protein [atomselect top protein]

set chains [lsort -unique [$protein get pfrag]]

foreach chain $chains {

  set sel [atomselect top "pfrag $chain"]

  $sel writepdb myfile_frag${chain}.pdb

}

                
---------------------------------
Yahoo! for Good
 Click here to donate to the Hurricane Katrina relief effort.

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:41:12 CST