VMD-L Mailing List
From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Wed Jun 10 2015 - 13:01:03 CDT
- Next message: Mehdi Bagherpour: "problem with output format"
- Previous message: Mehdi Bagherpour: "finding distance of atoms"
- In reply to: Mehdi Bagherpour: "finding distance of atoms"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
you need to advance your selections to the desired trajectory frame
before computing the distances, e.g. via:
$sel1 frame $i
$sel2 frame $i
axel.
On Wed, Jun 10, 2015 at 1:12 PM, Mehdi Bagherpour <mehdi.bpour_at_gmail.com> wrote:
> Dear vmd users,
>
> I am trying to find distance between all atoms.
> My system has 2000 atom with 25000 snapshot.
> I have written an script that and for instant I want to calculate distance
> of first 10 atom (index 0-9) from atom with index 2 for all snapshots.
> When I run this script it takes me just distances for first snapshot.
>
> set output [open "Distance.dat" w]
> for {set x 0} {$x <= 9} {incr x} {
> set sel1 [atomselect top "index $x"]
> set sel2 [atomselect top "index 2"]
>
> set nf [molinfo top get numframes]
>
> for {set i 0} {$i < $nf} {incr i} {
>
> set distance [veclength [vecsub [lindex [$sel1 get {x y z}] 0] [lindex
> [$sel2 get {x y z}] 0] ]]
> puts $output "$x $i $distance"
>
> }
> }
> close $output
>
> output is like :
>
> 0 0 7.053204709957979
> 0 1 7.053204709957979
> 0 2 7.053204709957979
> 0 3 7.053204709957979
> .
>
> .
> .
> 1 0 3.771492867602953
> 1 1 3.771492867602953
> 1 2 3.771492867602953
> 1 3 3.771492867602953
> .
> .
> .
>
> I will be appreciate If you could help me to find the bug of my script.
-- Dr. Axel Kohlmeyer akohlmey_at_gmail.com http://goo.gl/1wk0 College of Science & Technology, Temple University, Philadelphia PA, USA International Centre for Theoretical Physics, Trieste. Italy.
- Next message: Mehdi Bagherpour: "problem with output format"
- Previous message: Mehdi Bagherpour: "finding distance of atoms"
- In reply to: Mehdi Bagherpour: "finding distance of atoms"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]