From: John Stone (johns_at_ks.uiuc.edu)
Date: Mon May 07 2018 - 14:47:22 CDT

Hi,
  You didn't indicate whether or not your Jupyter notebook had redirected
the stdin stream to VMD. What happens if you redirect /dev/null into the
stdin input of VMD on your machine? Does your Jupyter wrapper terminate
the subprocess when any output comes to stderr? I ask because I've seen
other people's server-side VMD wrappers run into such problems, where their
outer wrapper closes down the child process if any output goes to stderr.
Neither the "display reposition" nor the "display resize" command should result
in any errors or other unusual behavior, at least none that I'm aware of,
if you're running VMD in text mode.

Best,
  John

On Mon, May 07, 2018 at 04:29:36PM +0000, Goedde, Chris wrote:
> Hi all,
>
> I???ve been dealing with a weird vmd startup problem, and I???m looking for tips on diagnosing these sorts of things going forward.
>
> I???m calling vmd in text mode from python. For testing purposes I was using the following code:
>
> ######
>
> import subprocess
> def vmdtest():
>
> outlogFile = open("./Test-out.log", "w")
> errlogFile = open("./Test-err.log", "w")
>
> VMDin=subprocess.run([ 'vmd', '-dispdev', 'none', '-startup', '/Users/goedde/.vmdrc-test', '-e', 'Test.vmd' ], \
> stdout=outlogFile, stderr=errlogFile)
>
> ######
>
> This runs vmd in text mode with a specific .vmdrc test file and a simple file of tcl commands in Test.vmd, and pipes stdout to Test-out.log and stderr to Test-err.log. For testing, Test.vmd was simply:
>
> puts stdout "Executing Test.vmd"
> exit
>
> The weird thing was, everything worked fine in the python interpreter when started in the terminal, but failed when run in a jupyter notebook. (Using python 3 via anaconda.) The further problem was that vmd did not give any messages when failing. No error messages were written to stdout or stderr. The stderr log was always empty, and the stdout log just had the usual vmd startup message and an ???Exiting normally??? at the end.
>
> I finally traced things down to the following lines in my .vmdrc file:
>
> display reposition 10 800
> display resize 1600 800
>
> Obviously, these aren???t needed when running in text mode, but I don???t understand why they were only a problem when vmd was started from python via a jupyter notebook.
>
> My questions are:
>
> (1) Is there some other log file I should be looking at for error messages from vmd upon startup?
>
> (2) What could be different about the jupyter notebook environment that causes vmd to choke on display setting lines upon startup?
>
> Now that I know what the problem is I can work around it by always using a custom .vmdrc file when starting vmd from python, but I would like to know more about what???s going on and where to look for error messages in the future.
>
> This is on a Mac running 10.12.6 and VMD for MACOSXX86, version 1.9.3a6 (October 9, 2015).
>
> Thanks for any insight!
>
> Chris Goedde

-- 
NIH Center 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/