VMD-L Mailing List
From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Wed Mar 09 2011 - 09:41:31 CST
- Next message: John Stone: "Re: VMD beta3 windows installer"
- Previous message: Ajasja LjubetiÄ: "VMD beta3 windows installer"
- In reply to: menica dibenedetto: "tcl script"
- Next in thread: JC Gumbart: "Re: tcl script"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
On Wed, Mar 9, 2011 at 9:32 AM, menica dibenedetto
<domenica.dibenedetto_at_gmail.com> wrote:
> Dear all,
> I try to run this code to calculate same distance:
> cd /Users/domenica/Desktop/01_DOP
> mol load pdb 01_DOP_wat.pdb
> mol addfile new01.dcd type dcd
> set sel1 [atomselect top "resid 136"]
> set sel2 [atomselect top "resname DP0"]
> set fil [open distance_136-DOP_1f.dat w]
> for {set i 1} {$i < 50} {incr i} {
> $sel1 frame $i
> $sel2 frame $i
> set com1 [measure center $sel1 weight mass]
> set com2 [measure center $sel2 weight mass]
> set simdata($i.r) [veclength [vecsub $com1 $com2]]
> puts $fil " $simdata($i.r)"
> }
> set sel3 [atomselect top "resid 125"]
> set sel4 [atomselect top "resname DP0"]
> set fil [open distance_125-DOP_1f.dat w]
> for {set i 1} {$i < 50} {incr i} {
> $sel3 frame $i
> $sel4 frame $i
> set com1 [measure center $sel1 weight mass]
> set com2 [measure center $sel2 weight mass]
> set simdata($i.r) [veclength [vecsub $com1 $com2]]
> puts $fil " $simdata($i.r)"
> }
> quit
> I run this code inside the TKconsole and it work even if it stopped before
> 50 frames.
> The problem is that I need to run it from command line, but from command
> line, the script don't work.
> In the output file it wrote only first three distances, and after is repeted
> until the and the same distance.
> Seems to appen that it don't recognize the different frames.
there are two problems with your script.
a) you don't close your files.
b) in the second loop you refer to $sel1 and $sel2,
but you update the frames for $sel3 and $sel4.
there are also several unneeded operations,
but they should have no impact on the result.
i also recommend to use syntactic indentation,
as that makes code much easier to read.
ciao,
axel.
> Best regards,
> Domenica
-- Dr. Axel Kohlmeyer akohlmey_at_gmail.com http://goo.gl/1wk0 Institute for Computational Molecular Science Temple University, Philadelphia PA, USA.
- Next message: John Stone: "Re: VMD beta3 windows installer"
- Previous message: Ajasja LjubetiÄ: "VMD beta3 windows installer"
- In reply to: menica dibenedetto: "tcl script"
- Next in thread: JC Gumbart: "Re: tcl script"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]