From: Karl Lundquist (
Date: Thu May 15 2014 - 14:13:58 CDT

Hi all,

I am attempting to make an index file to use with catdcd to wrote only
certain atoms to my dcd files. Below is a copy of my script:

package require psfgen

set infile ../2014-5-01-run/ionizedkcl
set seltext "(resname AHEP AGLC AKDO AGAL or (chain L and name N P O11 O12
O13 O14 C11 C12 HN1 HN2 HN3 H11A H11B H12A H12B))"
set newpsf headsonly

readpsf $infile.psf
coordpdb $infile.pdb

mol load psf $infile.psf pdb $infile.pdb

set all [atomselect top "all"]

set sel1 [atomselect top $seltext]

set selnot [atomselect top "not $seltext"]

set indices [$sel1 get index]

set file [open findexfile.ind w]

foreach var $indices {
    puts $file $var

flush $file
close $file

foreach segid [$selnot get segid] resid [$selnot get resid] atomname
[$selnot get name]
    delatom $segid $resid $atomname

writepsf $newpsf.psf


The problem I'm having is that not all of the indices are printed to
findexfile.ind. It gets cut off after the first 6000 or so entries.
However, when I put these commands line by line into the VMD tkconsole, the
command "puts $indices" prints them all without any issue. Anyone have any
insight as to why this might be happening?