From: Arneh Babakhani (
Date: Mon Aug 13 2007 - 19:05:20 CDT


I have a script that runs just fine in the tcl console gui, by the
command: play measureHBonds.tcl
(it writes to a file, I get the output that I expect).

But when I try to run the script from the command line and put the job
in the background, by:
vmd -dispdev text -e measureHBonds.tcl >& myjob.job &

it doesn't run properly (nothing is written to the output file). Any
idea why this works in the tcl console gui but not from the command line?

Script is pasted below if you want to look at it,



rm HBondData.txt
set outfile [open "HBondData.txt" w]

foreach f [find Pdbfiles/ -name "*.pdb"] {
mol load pdb $f
set receptor [atomselect top "all not resname UNK"]
set ligand [atomselect top "resname UNK"]
set HBONDS [measure hbonds 3.0 75 $ligand $receptor]
set TrueHBONDS [llength $HBONDS]

if {$TrueHBONDS > 2} {
set Donor [lindex $HBONDS 0]
if {$Donor >= 1} {
set Acceptor [lindex $HBONDS 1]

set DonorSelection [atomselect top "index $Donor"]
set DonorIndex [$DonorSelection get index]
set DonorName [$DonorSelection get name]

set AcceptorSelection [atomselect top "index $Acceptor"]
set AcceptorIndex [$AcceptorSelection get index]
set AcceptorName [$AcceptorSelection get name]
set AcceptorResID [$AcceptorSelection get resid]
set AcceptorResName [$AcceptorSelection get resname]

set NumberofHBonds [llength $DonorIndex]

puts $outfile "--STARTHERE--"
puts $outfile "$f"
puts $outfile " DonorIndex: $DonorIndex"
puts $outfile " DonorName: $DonorName"
puts $outfile " AcceptorIndex: $AcceptorIndex"
puts $outfile " AcceptorName: $AcceptorName"
puts $outfile " AcceptorResID: $AcceptorResID"
puts $outfile "AcceptorResName: $AcceptorResName"
puts $outfile " NumberofHBonds: $NumberofHBonds"
mol delete all

close $outfile