From: Albert (mailmd2011_at_gmail.com)
Date: Wed Nov 18 2015 - 09:49:53 CST

Hello:

I would like to extract certain part of the protein from MD trajectory
into separate file. I've prepared the following script as split.tcl:

-------------------------------------------------------------------------------------------------------------
proc split_multi_frame_structure { whichmol workdir } {
   set allsel [atomselect $whichmol "all"]
   set numframes [molinfo $whichmol get numframes]
   for {set i 0} {$i < $numframes} {incr i} {
     $allsel frame $i and get [atomselect top "resname UNK or sidechain
and resid 390 386 358 361 362 368 200 203 120 121 199 116 117 189 113"]
     set filename [format "%s/%03d.pdb" $workdir $i]
     file delete $filename
     $allsel writemol2 $filename
     mol new $filename

   }

}
-------------------------------------------------------------------------------------------------------------

Then I load the trajectory into VMD and run the following command from
TCL console:
source split.tcl
split_multi_frame_structure top sp

However, VMD complained the following:

-------------------------------------------------------------------------------------------------------------
atomselection: improper method: frame
usage: <atomselection> <command> [args...]

Commands for manipulating atomselection metadata:
   frame [new frame value] -- get/set frame
   molid|molindex -- get selection's molecule id
   text -- get selection's text
   delete -- delete atomselection (to free memory)
   global -- move atomselection to global scope
   update -- recalculate selection

Commands for getting/setting attributes:
   num -- number of atoms
   list -- get atom indices
   get <list of attributes> -- for attributes use 'atomselect keywords'
   set <list of attributes> <nested list of values>
   getbonds -- get list of bonded atoms
   setbonds <bondlists>
   getbondorders -- get list of bond orders
   setbondorders <bondlists>
   getbondtypes -- get list of bond types
   setbondtypes <bondlists>
   moveto|moveby <3 vector> -- change atomic coordinates
   lmoveto|lmoveby <x> <y> <z>
   move <4x4 transforamtion matrix>

Commands for writing to a file:
   writepdb <filename> -- write sel to PDB file
   writeXXX <filename> -- write sel to XXX file (if XXX is a
known format)
-------------------------------------------------------------------------------------------------------------

Does anybody has any idea where is the problem?

thx a lot

Albert