From: Mohan maruthi sena (
Date: Mon Apr 08 2013 - 06:27:15 CDT

Hi all,
            I have an .xyz where the coordinates xyz are present. I have
loaded a pdb file of protein and every time i want to translate the protein
to the coordinate present in the xyz. For this purpose i use the following
script , to move the geometrical center of protein to desired coordinate

set sel [atomselect 0 all] # load the xyz file
set p [$sel get {x y z}] # get coordinates of it
set s [list $p] # make lists of list
for { set i 0} { $i < 50} { incr i} { # loop over the coordinate file
set s [lindex $p $i] #Get each coordinate every time (xyz)
mol load pdb 1kx5_nwater.pdb # load the pdb
set sel1 [atomselect [expr {$i+1}] all]
set gc [measure center $sel1] # measure geometrical centre
set dist [vecsub $s $gc] # fidn the diff between protein coordinates and
the coordinates in xyz file(list)
$sel1 move [transoffset $dist] Move protein to the desired point
set sel1 [ atomselect [expr {$i+1}] "all" ] # select protein
$sel1 writepdb $i.pdb # write pdb

The script is giving error in the last line. It could not write pdb file .
The error is as follows,

atomsel: writepdb failed.

Please suggest me a way so that i can write all the loaded pdb files in to
one file(concatenate all the pdb files)

Thank you