VMD-L Mailing List
From: Bjørnar Jensen (bje076_at_ift.uib.no)
Date: Mon Nov 19 2012 - 07:05:21 CST
- Next message: Thomas Evangelidis: "Re: how to measure the distance of two atoms in 1000 conformations?"
- Previous message: John Stone: "Re: MD very slow on a 8400M GS laptop (but not on a GT230M one) after NVidia driver update to 304.64 or 310.14"
- In reply to: Ф¸»¹ó: "how to measure the distance of two atoms in 1000 conformations?"
- Next in thread: Thomas Evangelidis: "Re: how to measure the distance of two atoms in 1000 conformations?"
- Reply: Thomas Evangelidis: "Re: how to measure the distance of two atoms in 1000 conformations?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Hello,
a quick untested script:
---------------------------------------------------------------------------
//Selection for the two atoms of choice
set A [atomselect top "index xxx"]
set B [atomselect top "index yyy"]
//Get number of frames loaded into top molecule
set numframes [molinfo top get numframes]
//Open file for writing output
set output [open "Distance.dat" w]
//Write a short header to the file
puts $output "Frame\tDistance"
//Loop over all frames
for {set i 0} {$i < $numframes} {incr i} {
//Advance to frame $i
animate goto $i
//Get the positions, find the vector from B to A, calculate the
length of vector
set distance [veclength [vecsub [lindex [$A get {x y z}] 0] [lindex
[$B get {x y z}] 0] ]
//Write the frame number and distance to file. Separated by a
'tabulator'
puts $output "$i\t$distance"
}
//Close and clean up everything
$output close
$A delete
$B delete
unset numframes
unset output
--------------------------------------------------------------------------
This is likely to contain a bug or two and may be inefficient.
It should, at least, get you started.
The whole "how do I write a script" is found in the user guide and in
several tutorials. If you are using VMD on a day to day basis learning
to write scripts for VMD should be mandatory.
Best regards,
Bjørnar Jensen
On 2012-11-17 14:33, 肖富贵 wrote:
> Hi guys,
> I have 1000 conformations of a protein, and i want to measure the
> distance between two atoms in this protein.
> I know the "measure bond" command can measure the disance of two
> atoms. However, i have 1000 conformations, and i cannot measure each
> one by one, so can anyone tell me how to write a script?
> Best wishes
> Xiao Fugui
>
>
- Next message: Thomas Evangelidis: "Re: how to measure the distance of two atoms in 1000 conformations?"
- Previous message: John Stone: "Re: MD very slow on a 8400M GS laptop (but not on a GT230M one) after NVidia driver update to 304.64 or 310.14"
- In reply to: Ф¸»¹ó: "how to measure the distance of two atoms in 1000 conformations?"
- Next in thread: Thomas Evangelidis: "Re: how to measure the distance of two atoms in 1000 conformations?"
- Reply: Thomas Evangelidis: "Re: how to measure the distance of two atoms in 1000 conformations?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]