From: Vermaas, Joshua (Joshua.Vermaas_at_nrel.gov)
Date: Wed Dec 13 2017 - 12:24:47 CST

Take a look at the animate command. Since each atomselection has a frame
associated with it, it will only write one frame. animate
(http://www.ks.uiuc.edu/Research/vmd/current/ug/node121.html) can write
a whole trajectory.

I think you'll want something like this:

animate write pdb trajectory.pdb beg 0 end [expr {[molinfo top get
numframes] -1}]

Be warned though, pdb files are just about the WORST way of storing
trajectory data, since coordinates are stored as text, and there is a
ton of redundant data that bloats the file sizes. If you just want to
look at it in PyMol, I'd be surprised if you couldn't just load your dcd
directly.

-Josh

On 12/13/2017 12:30 AM, $BK\B<H%(B wrote:
> I want to convert a trajectory from dcd file to pdb file. I want to generate a text file as below and view it on Pymol.
>
> MODEL 1
> ATOM 1
> ATOM 2
> $B!D(B
> ATOM 99
> ATOM 100
> ENDMDL
> MODEL 2
> ATOM 1
> ATOM 2
> $B!D(B
> ATOM 99
> ATOM 100
> ENDMDL
> MODEL 3
> ATOM 1
> ATOM 2
> $B!D(B
> ATOM 99
> ATOM 100
>
> I got the following code, but it saved the pdb files separately.
> for {set i 0} {$i < $nf} {incr i} {[atomselect top all frame $i] writepdb frame$i.pdb}
>
> I have an idea and it has following steps:
> 1. make a data frame
> 2. append $B!H(BMODEL (n)" to a data frame
> 3. append n-th trajectory data to a data frame
> 4. append $B!H(BENDMDL" to a data frame
> 5. (Go back to 2)
> 6. append $B!H(BEND$B!I(B to a data frame
>
> I am sorry that I did not understand the VMD$B!G(Bs scripts.
>
>