From: Norman Geist (norman.geist_at_uni-greifswald.de)
Date: Mon Jul 06 2015 - 04:58:16 CDT

You forgot to delete the frame again to save memory.

You have to include the $frm within the pdb filename and merge the pdbs afterwards.

 

Do you get any error?

How do you call the proc?

 

Norman Geist.

 

From: Monika Madhavi [mailto:monikamadhavi_at_gmail.com]
Sent: Monday, July 06, 2015 11:02 AM
To: Norman Geist
Cc: VMD Mailing List
Subject: Re: vmd-l: How to write coordinates to a pdb without replacing existing entries

 

Thank you for your suggestion.

I loaded the initial frame using mol new and mol addfile and extracted the indexes of the atoms needed. I write their indexes into a separate dat file called "myout.dat"
Then I wrote another script as shown below.
However, the pdb does not generate. Can you please suggest where I am going wrong?

proc trace1 {n} {
set numfr $n
set input [open "myout.dat" r]
set atomid [read $input]
set mol [mol new ../setup/wat_spce.psf type psf waitfor all]
for {set frm 0} {$frm < $n} {incr frm} {
mol addfile ../run01/wat_run01.dcd type dcd first $frm last $frm waitfor all molid $mol
set select [atomselect $mol "index $atomid"]
$select frame $frm
animate write pdb traced.pdb 0 end [expr $n-1] waitfor all sel $select $mol
$select update
}
$select delete
}

Regards,

Monika

 

On Mon, Jul 6, 2015 at 12:58 PM, Norman Geist <norman.geist_at_uni-greifswald.de> wrote:

You could write a small TCL script which loads the trajectory frame per frame. Most of the required commands can be obtained using VMD Main->Log tcl commands to console and doing them by hand so:

1. load initial structure and parameters

2. as long as there are frames

a. load 1 frame

b. save your structure to a individual pdb file with a increasing number like: mypdb1.pdb

c. remove the frame from vmd

d. goto a.

Of course you need to have some counters to control which frame you are loading from the trajectory file.

Afterwards you could do something like:

cat $(ls -t mypdb*.pdb) > merged.pdb

to combine all the pdb to a single file.

Norman Geist.

From: owner-vmd-l_at_ks.uiuc.edu [mailto:owner-vmd-l_at_ks.uiuc.edu] On Behalf Of Monika Madhavi
Sent: Monday, July 06, 2015 6:55 AM
To: Josh Vermaas
Cc: Norman Geist; VMD Mailing List
Subject: Re: vmd-l: How to write coordinates to a pdb without replacing existing entries

Dear Norman,

So far the script I used worked fine. Now I want to analyze a very large trajectory (dcd) using the same script. For small trajectories the script worked fine since I could load the whole trajectory at once. Now because my trajectory is very large (36 GB) my RAM (4 GB) cannot process it at once. I tried using bigdcd but, I could not get it done. Any suggestion is greatly appreciated.

I need to select the molecules from the initial frame and then save their coordinates in all frames.

Thank you.

Regards,

Monika

On Thu, Mar 12, 2015 at 2:21 PM, Monika Madhavi <monikamadhavi_at_gmail.com> wrote:

Thanks Norman, it works perfectly!!!

Monika

On Mon, Mar 9, 2015 at 7:00 PM, Josh Vermaas <vermaas2_at_illinois.edu> wrote:

Hi Monika,

It is possible to write out a "trajectory pdb". I think, based on the documentation for the animate command (http://www.ks.uiuc.edu/Research/vmd/current/ug/node121.html), that it would be something like this:

animate write pdb output.pdb beg 0 end 0 sel $sel

The $sel writepdb version of file writing I believe can only handle one frame at a time. Also, does it need to be a pdb output? A binary format is going to be much smaller.

-Josh Vermaas

On 03/09/2015 05:26 AM, Monika Madhavi wrote:

Thanks Norman, your answer is exactly what I wanted. Is it possible to loop
this around each frame also. Can I write the pdb entries for my
atomselection ($sel here) for each frame in the same pdb?

Regards,
Monika

On Mon, Mar 9, 2015 at 3:12 PM, Norman Geist <norman.geist_at_uni-greifswald.de

wrote:
  This is not the way it should be done. It is much easier and faster to
just collect the resids you need 1st and write out the coordinates
afterwards. You can easily collect the list of resids with “lappend”.

example:

set myresids {}

for {whatever} {

                 if {whatever} {

                                lappend myresids $resid

                 }

}

set residlist [lrange $myresids 0 end]

set sel [atomselect top “resid $residlist”]

$sel writepdb my.pdb

$sel delete

Norman Geist.

*From:* owner-vmd-l_at_ks.uiuc.edu [mailto:owner-vmd-l_at_ks.uiuc.edu] *On
Behalf Of *Monika Madhavi
*Sent:* Monday, March 09, 2015 7:24 AM
*To:* Joaquim Rui de Castro Rodrigues
*Cc:* vmd-l_at_ks.uiuc.edu
*Subject:* Re: vmd-l: How to write coordinates to a pdb without replacing

existing entries

Thanks Rui,
Actually I can select the residue ids I want to select but they are
selected in a random manner and the number is large. Therefore I am
wondering whether I can write coordinates of the selected molecule at the
time it is selected without giving the whole list of ids at the end.

Regards,
Monika

Monika Madhavi
Department of Physics
University of Colombo

On Mar 8, 2015 11:03 PM, "Monika Madhavi" <monikamadhavi_at_gmail.com> wrote:

I want to achieve the result I would get if I write this command while
looping around without writing line 2 as it is.

set residlist {1 2 3 4 5}

set sel [atomselect top "resid 1 2 3 4 5"]

$sel writepdb out.pdb

$sel delete

Regards,

Monik

On Sun, Mar 8, 2015 at 10:47 PM, Monika Madhavi <monikamadhavi_at_gmail.com>
wrote:

Thanks Joaquim. Actually i set N outside the loop. What i want is to write
all the coordinates in a single pdb file. As an example, something like

If my molecule is water,

Resid atomname coordinates
1 H1 .........
1 H2 ........
1 OH .........
2 H1 .........
2 H1 ..........
2 OH .........

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