VMD-L Mailing List
From: Ashar Malik (asharjm_at_gmail.com)
Date: Wed Dec 13 2017 - 02:37:16 CST
- Next message: Ashar Malik: "Re: I would like to get a trajectory file in PDB. Can I use like data frame in VMD?"
- Previous message: Ashar Malik: "Re: Nonbond energy between 3 part"
- In reply to: 本村肇: "I would like to get a trajectory file in PDB. Can I use like data frame in VMD?"
- Next in thread: Ashar Malik: "Re: I would like to get a trajectory file in PDB. Can I use like data frame in VMD?"
- Reply: Ashar Malik: "Re: I would like to get a trajectory file in PDB. Can I use like data frame in VMD?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
for {set i 0} {$i < $nf} {incr i} {
[atomselect top all frame $i] writepdb frame$i.pdb
}
In the preceding loop -- $i changes with every loop iteration and hence you
have separate files.
You can use something like this after loading the trajectory.
#########################################################
set nf [molinfo top get numframes]
for {set i 0} {$i < $nf} {incr i} {
[atomselect top all frame $i] writepdb frame$i.pdb # Don't
use with solvated systems. If you have a solvated system change
[atomselect top all frame $i] to [atomselect top "all and not waters"
frame $i]
if {$i == 0} {
exec echo MODEL "\t" [expr $i +1] > foo.txt
exec cat foo.txt frame$i.pdb | sed "/CRYST1/d" > foo1.txt
} else {
exec echo MODEL "\t" [expr $i +1] > foo.txt
exec cat foo1.txt foo.txt > new.txt
exec cat new.txt frame$i.pdb | sed "/CRYST1/d" > new2.txt
exec mv new2.txt foo1.txt
}
exec rm frame$i.pdb
}
exec sed -i "s/END/ENDMDL/g" foo1.txt
exec rm new.txt
exec rm foo.txt
exec mv foo1.txt all_frames.pdb
#########################################################
The final file "all_frames.pdb" will contain the chosen selection between
the words MODEL and ENDMDL
The code should work on linux based machines and macs I think. But I am not
sure about windows.
Hope this helps.
Best,
/A
On Wed, Dec 13, 2017 at 7:41 PM, 本村肇 <h-motomura_at_bioreg.kyushu-u.ac.jp>
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
> …
> 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.
>
>
-- Best, /A
- Next message: Ashar Malik: "Re: I would like to get a trajectory file in PDB. Can I use like data frame in VMD?"
- Previous message: Ashar Malik: "Re: Nonbond energy between 3 part"
- In reply to: 本村肇: "I would like to get a trajectory file in PDB. Can I use like data frame in VMD?"
- Next in thread: Ashar Malik: "Re: I would like to get a trajectory file in PDB. Can I use like data frame in VMD?"
- Reply: Ashar Malik: "Re: I would like to get a trajectory file in PDB. Can I use like data frame in VMD?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]