From: Ryan Woltz (rlwoltz_at_ucdavis.edu)
Date: Sat Jan 21 2023 - 04:30:13 CST

Dear community,

         I'm not exactly sure where to go with this question but hopefully
someone can give me some direction. My colleague made multiple python
scripts that open vmd and do a series of analysis that take 1-2 hours. I'd
like to combine them into a single master script and run everything the
full analysis for a continuous 24-48 hours instead of micromanaging 20+
analysis which needs to be restarted at staggered intervals, I do not write
in python and do most scripting in bash.

     The problem is when I use a bash master script that calls multiple
python scripts that open vmd it'll "stopped" on the second opening of vmd.
the error from bash is:
[2]+ Stopped # with 2 being the number of times I've run the
master script

This can be restarted by typing %user:fg 2

this reopens vmd and continues the script to the next vmd analysis.

I have replicated the error with these three scripts that print lines and
call the next script until the tcl scripts quits vmd. It can be saved in
the terminal in the same directory and executing quit.sh. also note that I
get a stopped error is I A)call vmd twice in the python script or B) call
the python script 2 times with the python script only opening vmd 1 time.

quit.sh:
!/bin/bash
echo "line1"
python3 quit.py
echo "line 3"
#python3 quit.py
echo "line 5"

quit.py:
import subprocess as sp

print('line 1.py')
sp.call(['/bin/bash', '-i', '-c', 'vmd -dispdev text -e quit.tcl'],
stdin=sp.PIPE)
print('line 3.py')
sp.call(['/bin/bash', '-i', '-c', 'vmd -dispdev text -e quit.tcl'],
stdin=sp.PIPE)
print('line 5.py')

quit.tcl:
puts "running vmd"
quit

I do not experience this by running these in the terminal and can do that
infinitely. I think the issue is that I'm running a bash script and calling
a bash command to open vmd in python? and since bash is being called twice
in the same instance of running the bash script it stops. That stopping
clears the script and sends it back to the terminal which I can continue by
simply typing "fg 2". is there another way to call vmd not using the
"#!/bin/bash" part in the python script?

sorry if this is not clear enough, still a little novice at development and
python is on my learning todo list if I can ever get a month of no work.

Thanks for any help you can give,

Ryan