From: Axel Kohlmeyer (axel.kohlmeyer_at_theochem.ruhr-uni-bochum.de)
Date: Thu Oct 16 2003 - 04:59:29 CDT

>>> "ES" == Erica Smith <ejsmith_at_uh.edu> writes:

ES> Hi,
ES> I am a new user to NAMD and VMD and need some help.
ES> I have generated a dcd trjectory file using NAMD with the DCDUnitcell
ES> option. I have loaded my trajectory into VMD but I can't work out how
ES> to write a tcl script to extract the unit cell lengths for each frame.
ES> I found the molinfo command which gives them to me, I presume, for the
ES> last frame but I want to see the unit cell lengths as a fucntion of
ES> time? Can anyone help me out with some clues on how the scroipt would
ES> go? I have looked at the examples in the script libraries etc but I
ES> don't get it.

hello erica,

i use the following procedure to _set_ the unitcell information
for trajectories that don't have it:

proc set_unitcell {a b c {molid top} {alpha 90.0} {beta 90.0} {gamma 90.0}} {

    if {![string compare $molid top]} {
        set molid [molinfo top]
    }

    set n [molinfo $molid get numframes]

    for {set i 0} {$i < $n} {incr i} {
        molinfo $molid set frame $i
        molinfo $molid set a $a
        molinfo $molid set b $b
        molinfo $molid set c $c
        molinfo $molid set alpha $alpha
        molinfo $molid set beta $beta
        molinfo $molid set gamma $gamma
    }
}

if you change the molinfo set lines into something like:

set a [molinfo $molid get a]
set b [molinfo $molid get b]
...
and add something like (if you have stored the file descriptor
of the output file in $fp):

puts $fp "$i $a $b $c $alpha $beta $gamma"

you should be able to get what you want.

hope this helps,
     axel kohlmeyer.

ES> Thanks,
ES> Erica.

--
=======================================================================
Axel Kohlmeyer       e-mail: axel.kohlmeyer_at_theochem.ruhr-uni-bochum.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/
=======================================================================
If you make something idiot-proof, the universe creates a better idiot.