From: Vermaas, Joshua (
Date: Thu Feb 02 2017 - 16:40:25 CST

Hi Benjamin,

Could it be as simple as putting a newline at the end of the write command? I took a gro file that I knew VMD could load and chomped the newline at the end of the file with perl. Then I got a warning like this when I loaded it into VMD: gromacsplugin) Warning, error reading box, unexpected end-of-file reached. When you resave the file after editing it, your text editor is probably putting in a newline to mark the end of file for you, which is why VMD can then load it afterward.


On 02/02/2017 02:40 PM, Benjamin Joseph Coscia wrote:
Hello VMD users,

As stated, I have a strange error that occurs when trying to view a .gro file for an initial configuration I wrote using a python script. When trying to view it directly after running the script, VMD loads it and the main window accurately displays the name of the molecule and the number of atoms, however the display window is empty.

I am able to get around the problem by opening the .gro file, picking any line in it, backspacing once, pressing the space bar (to reset it to the way it was before), then saving and closing. When I open it again, the molecule is displayed as expected!

I really don't know what would cause something like this. One thing that may offer clues is that, in the past, I never ran into this issue using a nearly identical script. The difference was that instead of writing a file with the python script (using something along the lines of f.write() in the script), I would use print statements and redirect the output from the script to a file. For some reason that works.

I've attached the script I used if you want to recreate what I am seeing. (note that it is a work in progress and is a mess, but works. The file writing part is at the end).

If anyone has experienced this or has any ideas of what might be causing this, I would appreciate any advice.


Benjamin Coscia
Graduate Assistant -- Shirts Group
University of Colorado at Boulder