From: Ryan McGreevy (ryanmcgreevy_at_ks.uiuc.edu)
Date: Wed Nov 18 2015 - 10:26:45 CST

Your problem is in the line:

$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"]

I assume you are trying to make an atom selection for the current frame
($i). In that case, you need to do the following:

set allframe [atomselect top "resname UNK or sidechain
and resid 390 386 358 361 362 368 200 203 120 121 199 116 117 189 113"]
$allsel frame $i

On Wed, Nov 18, 2015 at 10:16 AM Albert <mailmd2011_at_gmail.com> wrote:

> 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
>
>