From: Salvatore Mario Cosseddu (S.M.Cosseddu_at_warwick.ac.uk)
Date: Wed May 18 2011 - 11:21:35 CDT

my suggestion was that the problem could be a simple bug in the tcl/vmd
script.

If he source the file it works but probably it ends up with some error.
So it can not go back to the stream of the bash calls.

I use everyday tcl/vmd scripts called by bash for loops. There's no
problem. As soon as the script can exit normally from the vmd script.
Otherwise you could find some more sophisticated way to play around, but
it has no sense, since the vmd script is supposed to be without bugs.

I was asking for the full script to help finding bugs.

---------------------------------------------------------

#!/bin/bash

for i in ciao mondo
do
   vmd -dispdev text -e tet.vmd -args $i 100;
   vmd -dispdev text -e tet2.vmd -args $i 200;
   echo "done $i"
done

---------------------------------------------------------

and the vmd script

  ---------------------------------------------------------

lassign $argv filename nf

mol new ${filename}.psf
animate read dcd ${filename}.dcd waitfor all

set frame0 [atomselect top "x<0 and sqr(z)>12" frame 0]
set sel [atomselect top "x<0 and sqr(z)>12"]

if { [ catch {open ${filename}_out w} outfile] } {
    puts stderr "Could not open${filename}_out for writing\n"
    exit 1
}

for { set i 1 } { $i $\leq$ $nf } { incr i } {
  $sel frame $i
  $sel move [measure fit $sel $frame0]
  puts $outfile "[measure rmsd $sel $frame0]"
}

close $outfile

exit 0

---------------------------------------------------------

Looping in a bash script would not give any problem.

(I'm sorry for any error in the script, I did not check it)

On 18/05/11 16:42, Axel Kohlmeyer wrote:
> On Wed, May 18, 2011 at 11:10 AM, Salvatore Mario Cosseddu
> <S.M.Cosseddu_at_warwick.ac.uk> wrote:
>> the script is not full... in this form it could not work. you at least
>>
>> need a "}" at the end of the for loop and setting some variables...
>
> you misread the mail. the script code was meant to illustrate
> the content of the tcl script code, not a wrapper around the
> vmd invocations.
>
> axel.
>
>
>> what do you means by loops thorough it? something like
>>
>> for i in {1..3};
>> do
>> vmd -dispdev text -e tet.vmd ;
>> vmd -dispdev text -e tet2.vmd ;
>> echo $i;
>> done
>>
>> because it should work if there's no bus in the tcl script and it finish
>> with exit. May you post the full script?
>>
>>
>> On 18/05/11 13:04, Jorgen Simonsen wrote:
>>> Hi all
>>>
>>> I have organized my output in different directories and would like to
>>> use some packages within vmd to analyse the output - I have naively
>>> put my script together like this,mrun
>>>
>>> #!/bin/bash
>>> vmd -dispdev text new_myfile.psf new_model.pdb -e tet.scr
>>> vmd -dispdev text new_myfile.psf new_model.pdb -e tet2.scr
>>> vmd -dispdev text new_myfile.psf new_model.pdb -e tet3.scr
>>>
>>> the tet.scr contain the following
>>>
>>> for { set i 1 } { $i $\leq$ $nf } { incr i } {
>>> $sel frame $i
>>> $sel move [measure fit $sel $frame0]
>>> puts $outfile "[measure rmsd $sel $frame0]"
>>>
>>>
>>> quit
>>>
>>> where 2 and 3 are modifications. If I do manually go to a directory and
>>>
>>> source mrun.sh
>>>
>>> it works fine but if I loop thorugh it - it opens and immediately
>>> quits the application.
>>>
>>> Thanks,
>> --
>> Salvatore Cosseddu
>> PhD student
>> --
>> Centre for Scientific Computing and School of Engineering
>> University of Warwick
>> Coventry CV4 7AL
>> United Kingdom
>> --
>> email: S.M.Cosseddu_at_warwick.ac.uk
>>
>>
>>
>
>

-- 
Salvatore Cosseddu
PhD student
--
Centre for Scientific Computing and School of Engineering
University of Warwick
Coventry CV4 7AL
United Kingdom
--
email: S.M.Cosseddu_at_warwick.ac.uk