From: Monika Madhavi (monikamadhavi_at_gmail.com)
Date: Mon Feb 01 2016 - 22:15:55 CST

Thanks Peter,

Yes I think that would be the solution to my problem. But, can't we use
something like the "update selection every frame" option in graphical
representations? Can we make the selections in the same way without the
graphical representations?

Regards,
Monika

On Tue, Feb 2, 2016 at 1:21 PM, Peter Freddolino <petefred_at_umich.edu> wrote:

> Hi Monika,
> That really depends on what you’re trying to do. If you really must have a
> single pdb file with separate entries for each frame, you should probably
> have your script write them one by one to a temporary file, and then have a
> line inside the loop that concatenates the temporary file onto the end of a
> single, growing pdb file. But vmd (and likely other readers) may not
> respond well to READING such a file, since there may be an assumption that
> the number of atoms is invariant between frames.
> Best,
> Peter
>
> > On Feb 1, 2016, at 10:12 PM, Monika Madhavi <monikamadhavi_at_gmail.com>
> wrote:
> >
> > Thanks Peter!
> >
> > What you are telling is true but then I will be generating enormous
> amount of pdb files which I also don't want to do. Isn't there any other
> method ?
> >
> > Best,
> > Monika
> >
> > Monika Madhavi
> > Department of Physics
> > University of Colombo
> >
> > On Feb 2, 2016 12:51 PM, "Peter Freddolino" <petefred_at_umich.edu> wrote:
> > Dear Monika,
> > The atom selections are not constructed on a frame by frame basis. You
> can update them with $sel update, but at the time that the animate write
> command is issued, only their current state will be considered. You can
> solve this easily enough just by looping over frames and writing a separate
> pdb file for each of them.
> > Best,
> > Peter
> >
> > > On Feb 1, 2016, at 7:01 PM, Monika Madhavi <monikamadhavi_at_gmail.com>
> wrote:
> > >
> > > Dear all,
> > >
> > > I want to create some atomselections, update them every frame and
> write the coordinates to a pdb file. I need to create a pdb file for each
> atom selection (which includes updated coordinates for all frames). Below
> is the code I wrote. The code works but, the selections are not updated. In
> the pdb files, there are coordinates of the same atom selection. Can you
> please suggest a way to correct this.
> > >
> > > Thank you.
> > > Best regards,
> > > Monika
> > >
> > > proc intermol1 {n} {
> > > #reading tracer atoms from a file
> > > set input [open "myout.dat" r]
> > > set atomlist [read $input]
> > > set len [llength $atomlist]
> > > #
> > > #select tracer atoms one by one
> > > for {set i 0} {$i < $len} {incr i} {
> > > set fname [format "interout%03d" $i]
> > > set ind1 [lindex $atomlist $i]
> > > set ind2 [expr $ind1+1]
> > > #
> > > #load trajectory frame by frame
> > > set mol [mol new my.psf type psf waitfor all]
> > > for {set frm 0} {$frm < $n} {incr frm} {
> > > mol addfile ../my.dcd type dcd first $frm last $frm waitfor all molid
> $mol
> > > #
> > > set centH1 [atomselect $mol "index $ind1" frame $frm]
> > > set coorH1 [lindex [$centH1 get {x y z }] 0]
> > > set x0 [lindex $coorH1 0]
> > > set y0 [lindex $coorH1 1]
> > > set z0 [lindex $coorH1 2]
> > > $centH1 delete
> > > #select H in a 5A sphere
> > > set sel1 [atomselect $mol "name H1 H2 and
> sqrt(sqr(x-x0)+sqr(y-y0)+sqr(z-z0))<5 and not index $ind2" frame $frm]
> > > $sel1 update
> > > }
> > > animate write pdb $fname.pdb beg 0 end [expr $n-1] waitfor all sel
> $sel1 $mol
> > > animate delete beg 0 $mol
> > > $sel1 delete
> > > }
> > > }
> > >
> > > --
> > > W.A.Monika Madhavi
> > > Lecturer (Probation),
> > > Department of Physics,
> > > University of Colombo.
> >
>
>

-- 
W.A.Monika Madhavi
Lecturer (Probation),
Department of Physics,
University of Colombo.