From: John Stone (johns_at_ks.uiuc.edu)
Date: Fri Jun 10 2011 - 09:27:05 CDT

Hi,
  The input redirection causes VMD to get an end-of-file when it reaches
the end of the script. The EOF is what is telling it to exit at the end
of your script. Without the input redirection and EOF, even if you put in a
"quit" command at the end of your script, there are scenarios where depending
on what is in your .vmdrc, it might sit waiting for console input.
The input redirection causes the Tcl interpreter to behave differently,
making it impossible for any Tcl command (or any spawned shell command
for that matter) to wait for terminal input, which would otherwise
hang your script.

Cheers,
  John Stone
  vmd_at_ks.uiuc.edu

On Fri, Jun 10, 2011 at 11:36:02AM +0200, maria goranovic wrote:
> PS: but if I redirect the output and error using : vmd -dispdev text
> -eofexit < temp.tcl > temp.out 2> temp-error.out
> then the extra return key is not needed. Although this works, I cannot see
> why redirection sorts out the problem.
> On Fri, Jun 10, 2011 at 11:26 AM, maria goranovic
> <mariagoranovic_at_gmail.com> wrote:
>
> I made my version of bigdcd long ago to fix something, cannot even
> remember.
> However, I still have to press an enter key after vmd is finished the
> script with the bigdcd below .. ?
> Maria
>
> On Thu, Jun 9, 2011 at 11:02 PM, John Stone <johns_at_ks.uiuc.edu> wrote:
>
> Hi,
> I see that you're using a different version of the bigdcd script
> than the one that's posted on the web. Most likely that's where the
> problem is:
> http://www.ks.uiuc.edu/Research/vmd/script_library/scripts/bigdcd/
>
> Cheers,
> John Stone
> vmd_at_ks.uiuc.edu
> On Wed, Jun 08, 2011 at 10:33:23AM +0200, maria goranovic wrote:
> > Ajasja, Using -eofexit or using an exit statement at the end of
> file do
> > not work in this case.A
> >
> > On Tue, Jun 7, 2011 at 4:07 PM, Ajasja LjubetiA:*
> > <ajasja.ljubetic_at_gmail.com> wrote:
> >
> > Sorry, it should be:
> > A vmd -dispdev text -eofexit < input.tcl > output.log
> > Regards,
> > Ajasja
> > On Tue, Jun 7, 2011 at 16:02, Ajasja LjubetiA:*
> > <ajasja.ljubetic_at_gmail.com> wrote:
> >
> > Hi,
> > it depends on how you call it. If you use vmdA -eofexitA -e "
> " then
> > it should exit. You can also just put an exit statement at
> the end.
> > Regards,
> > Ajasja
> > On Tue, Jun 7, 2011 at 11:01, maria goranovic
> > <mariagoranovic_at_gmail.com> wrote:
> >
> > Dear All,
> > I have a vmd script (copied below) which I would expect to
> exit
> > after finishing, but it does not. Any ideas why? version
> 1.9, linux,
> > amd64
> > mol load gro all.gro
> > source mybigdcd2.tcl
> > # closewater.tcl
> > # Justin Gullingsrud
> > # jgulling_at_mccammon.ucsd.edu
> > # 8 November 2004
> > # This script processes a trajectory to create a new file
> containing
> > just
> > # a selection of atoms and the N closest water to that
> selection.
> > A The N
> > # waters are recomputed for each timestep, and need not be
> the same
> > waters
> > # in each timestep (in fact, they probably will not be);
> thus it is
> > in general
> > # meaningless to analyze the dynamics of individual waters.
> > A However, it
> > # may be useful for analyzing the distribution of waters
> around a
> > relatively
> > # static protein or DNA chain.
> > # usage: closewater <molid> <selection text> <# waters>
> <filename
> > prefix>
> > proc closewater A {i} {
> > A set molid 0
> > A set seltext "protein"
> > A set nwat 2500
> > A set prefix "close"
> > A puts "now working in frame $i"
> > A set numinner 0
> > A set inner [list]
> > A set cut 1
> > A while {1} {
> > A A A set sel [atomselect $molid "name OW and within
> $cut of
> > ($seltext)"]
> > A A A set outer [$sel list]
> > A A A $sel delete
> > A A A set numouter [llength $outer]
> > A A A if { $numouter < $nwat } {
> > A A A A set inner $outer
> > A A A A set numinner $numouter
> > A A A A incr cut
> > A A A A continue
> > A A A }
> > A A A break
> > A A }
> > A puts "Found $numouter waters at cutoff $cut"
> > A catch { unset ohash }
> > A foreach ind $outer { set ohash($ind) 1 }
> > A foreach ind $inner { unset ohash($ind) }
> > A set outer [lrange [array names ohash] 0 [expr $nwat -
> $numinner -
> > 1]]
> > A set watind [concat $inner $outer]
> > A set sel [atomselect $molid "($seltext) or same residue
> as (index
> > $watind)"]
> > A set j [format %06d $i]
> > A $sel writepdb [format $prefix-$j.pdb]
> > A exec editconf -f $prefix-$j.pdb -o $prefix-$j.gro -resnr
> 1 &
> > A }
> > bigdcd closewater temp.xtc
> > bigdcd_wait_till_done
> > --
> > Maria G.
> > Technical University of Denmark
> > Copenhagen
> >
> > --
> > Maria G.
> > Technical University of Denmark
> > Copenhagen
>
> --
> NIH Resource for Macromolecular Modeling and Bioinformatics
> Beckman Institute for Advanced Science and Technology
> University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
> http://www.ks.uiuc.edu/~johns/ Phone: 217-244-3349
> http://www.ks.uiuc.edu/Research/vmd/ Fax: 217-244-6078
>
> --
> Maria G.
> Technical University of Denmark
> Copenhagen
>
> --
> Maria G.
> Technical University of Denmark
> Copenhagen

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
http://www.ks.uiuc.edu/~johns/           Phone: 217-244-3349
http://www.ks.uiuc.edu/Research/vmd/       Fax: 217-244-6078