From: Filip Persson (filip.persson_at_gmail.com)
Date: Fri Jul 01 2011 - 08:03:26 CDT

Dear all,
I have a number of trajectory files (dcd-files) of a solvated protein in a
cubic box (mae-file). Since I am interested in water contacts, I want to
measure distances between water molecules and certain residues in the
protein. However, due to the periodic boundary conditions, this is not
possible as the protein jumps out of the box partially. I have used PBCwrap
to fix this with the following commands:

pbc set [pbc get -all] -all
pbc wrap -center bb -centersel protein -compound res –all

and the result * *I get is a “jumping box” with the protein centered. To
stop this jumping I used the fitframes script available at the VMD script
library, which gives me a centered protein with the box rotating around it.
I guess the coordinates achieved in this way will be satisfactory for
calculating water distances to my protein residues.

Now to the problem. I want to make these PBCwrap-and- fitframes fixes to
several dcd-files – to many to do it manually file by file. Since I have
just started to learn Tcl scripting, I wonder if anyone can help me in
writing a Tcl script for VMD which does the following:

1) reads a dcd-file (named as protein-0000.dcd); 2) does the desired
transformations of coordinates as stated above; 3) saves transformed
trajectories to a new file and 4) repeat steps for next file (named
protein-0001) and so on.

This is what I have come up with so far:

mol new {C:/Users/Filip/Documents/protein.mae} type {mae} first 0 last -1
step 1 waitfor 1

animate style Loop

set dir "C:/Users/Filip/Documents/"

set filelist [glob -directory $dir *.dcd]

set auto_path [concat "C:/Users/Filip/Documents/fitframes.tcl" $auto_path]

# fitframes parameters

set ref [atomselect $molid $seltext frame 1]

# Begin loop

foreach file $filelist {

mol addfile $file type {dcd} first 0 last -1 step 1 waitfor all

# Use PBCwrap tool in VMD

pbc wrap -center bb -centersel protein -compound res -all

#fitframes

set n [molinfo $molid get numframes]

set sel [atomselect $molid $seltext]

set all [atomselect $molid all]

for { set i 1 } { $i < $n } { incr i } {

$sel frame $i

$all frame $i

$all move [measure fit $sel $ref]

}

        # Save result to new file

#animate write dcd {C:/Users/Filip/Documents/}

}

I assume that my RAM will become full at some point, and VMD will not be
able to visualize the total trajectory for the transformed files as they are
added consecutively during the loop. How do I solve this? Basically, what I
want is just the transformed dcd-files, not the visualization of the total
trajectory in VMD during this process.

I would be very grateful for any kind of help.

Best regards,

Filip Persson

MSc student in biophysical chemistry