From: Giacomo Fiorin (giacomo.fiorin_at_gmail.com)
Date: Sun Feb 27 2022 - 09:11:40 CST

Hi Alessandro, please check this first:
https://www.ks.uiuc.edu/Research/vmd/vmd-1.9.3/ug/node122.html
which explains how "frame" must be used, and the following example shows it
in context:
https://www.ks.uiuc.edu/Research/vmd/vmd-1.9.3/ug/node203.html

Note also that creating a new selection for every frame comes with overhead
that is not needed: better to create it outside the loop, as the example
shows, and only update its frame inside the loop.

Giacomo

On Sun, Feb 27, 2022 at 9:47 AM Alessandro Ruda <alessandro.ruda_at_su.se>
wrote:

> Dear VMD comunity,
>
>
> I am trying to get a simple script to obtain coordinates for each frame
> of a MD trajectory of a specific atom:
>
>
> ----------------------------
>
> set LNB_H1p "XXX_atom1.dat"
>
> set outfile1 [open $XXX_atom1 w]
>
> set nfr [molinfo top get numframes]
>
> ### Write coordinates in the files ###
>
> for {set frame 0} {$frame < $nfr} {incr frame} {
> set atom1 [atomselect top "index 33"]
> set atom1_c [$H1p get {x y z} $frame]
> puts $outfile1 $frame\t$atom1_c
> }
> close $outfile1
> ----------------------------------
>
>
> but I can't get it working because get doesn't accept $frame in the sense
> that it doesn't seem like I can get coordinates for a specific frame using
> the get command.
> Any suggestion?
>
> Thank you in advance!
>
> All the best,
> Alex
>
>
>
>
>
> _____________________________________________________________________
>
> *Alessandro Ruda*
> *PhD Student*
> Department of Organic Chemistry
> Arrhenius Laboratory
> *Stockholm University*
> SE-106 91 Stockholm, Sweden
> <alessadro.ruda_at_su.se>alessandro.ruda_at_su.se <alessadro.ruda_at_su.se>
> +46707900305
> _____________________________________________________________________
>
>