From: Axel Kohlmeyer (axel.kohlmeyer_at_theochem.ruhr-uni-bochum.de)
Date: Thu Jun 24 2004 - 23:48:36 CDT

On Thu, 24 Jun 2004, Ahmet Bakan wrote:

AB>
AB>
AB> Hi All,
AB>
AB>
AB>
AB> I want to calculate average positions of all atoms in a trajectory. There
AB> are about 4000 atoms and 200 frames. What I think is writing a script that
AB> moves along the trajectory as summing the Coordinate/FrameNumber. This
AB> seems consume a lot of memory. Do you have any better ideas or some script
AB> doing this?

ahmet,

if you can load the full trajectory into vmd you should not need
much more memory to calculate the average positions, and 200 frames
of 4000 atoms should need only a few tens of megabytes.

after you have loaded the trajectory you would want to
do something like (totally untested and i don't even have
that manual at hand to check out the specific syntax):

set mol [molinfo top]
set sel [atomselect $mol {all}]
set n [molinfo 0 get numframes]
for {set i 0} {$i < $n} {incr i} {
    $sel frame $n
    set j 0
    foreach c [$sel get {x y z}] {

        # now $c should contain a vector with
        # the positions of the atom $j
        # and you can do something like
        set avg($j) [vecadd $avg($j) $c]
        incr j
    }
}

most likely in your attempt, you have created many
selections without deleting them. if you don't mind,
please post your script, if the above code template
does not solve your problem.

axel.

AB>
AB> Thanks in advance,
AB>
AB>
AB>
AB> Ahmet
AB>
AB> ==========ABC==========
AB> Ahmet Bakan
AB> Chemistry, Senior
AB> Koc University
AB> <mailto:abakan_at_ku.edu.tr> abakan_at_ku.edu.tr
AB> ICQ #86167698
AB> http://home.ku.edu.tr/~abakan
AB>
AB>
AB>
AB>

-- 
=======================================================================
Dr. Axel Kohlmeyer                        e-mail: axel.kohlmeyer_at_rub.de
Lehrstuhl fuer Theoretische Chemie          Phone: ++49 (0)234/32-26673
Ruhr-Universitaet Bochum - NC 03/53         Fax:   ++49 (0)234/32-14045
D-44780 Bochum  http://www.theochem.ruhr-uni-bochum.de/~axel.kohlmeyer/
=======================================================================