From: Morgan, Brittany (Brittany.Morgan_at_umassmed.edu)
Date: Thu Nov 19 2015 - 08:41:14 CST

Try "$allframe writepdb $filename" instead of "$allsel writepdb $filename".

________________________________
From: owner-vmd-l_at_ks.uiuc.edu [owner-vmd-l_at_ks.uiuc.edu] on behalf of Albert [mailmd2011_at_gmail.com]
Sent: Thursday, November 19, 2015 2:46 AM
To: Ryan McGreevy; vmd-l_at_ks.uiuc.edu
Subject: Re: vmd-l: extract certain part of atoms into separate file

Thanks a lot for the advice.

I tried:

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} {
    set allframe [atomselect top "sidechain and resid 390 386 358 361 362 368 200 203 120 121 199 116 117 189 113"]
    $allsel frame $i
    set filename [format "%s/%03d.pdb" $workdir $i]
    file delete $filename
    $allsel writepdb $filename
    mol new $filename

  }

}

It export everything to each .pdb file instead of atoms I selected....

Thanks again

On 11/18/2015 05:26 PM, Ryan McGreevy wrote:
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