package require pbctools

mol new ../../../system/glpt.psf

mol addfile initial.dcd type dcd first 0 last -1 step 1 waitfor all

set all [atomselect top all]
set num_frames [molinfo 0 get numframes]

for {set i 0} {$i < $num_frames} {incr i} {

    $all frame $i
    $all writenamdbin ../input/init.$i.coor

    pbc writexst ../input/init.$i.xsc -first $i -last $i
}

quit
