From: 本村肇 (h-motomura_at_bioreg.kyushu-u.ac.jp)
Date: Wed Dec 13 2017 - 00:41:56 CST

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

ATOM 99
ATOM 100
ENDMDL
MODEL 2
ATOM 1
ATOM 2

ATOM 99
ATOM 100
ENDMDL
MODEL 3
ATOM 1
ATOM 2

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 “MODEL (n)" to a data frame
3. append n-th trajectory data to a data frame
4. append “ENDMDL" to a data frame
5. (Go back to 2)
6. append “END” to a data frame

I am sorry that I did not understand the VMD’s scripts.