Reporter Behavior

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
Gideon Simpson
Posts: 28
Joined: Tue Sep 26, 2017 11:15 pm

Reporter Behavior

Post by Gideon Simpson » Wed Oct 30, 2019 1:54 pm

I was working with a custom reporter from within iPython, and I noticed something that I'd like to clarify. My reporter just makes measurements of the system and writes them to a text file at the specified interval. I observed that, in iPython, if I did

Code: Select all

[1] %run openmm_script.py
I would find that my text file would sometimes be empty or not have recorded every step. If I quit iPython, it wrote as expected, and if I instead just did

Code: Select all

$ python openmm_script.py
at the command line, it behaved as expected. It seems like the reporters (or at least my custom one) only flush when a particular event is triggered. I was wondering if someone could clarify how this is controlled (assuming this is normal behavior).

User avatar
Peter Eastman
Posts: 2593
Joined: Thu Aug 09, 2007 1:25 pm

Re: Reporter Behavior

Post by Peter Eastman » Wed Oct 30, 2019 2:00 pm

That's entirely up to the reporter. If it opens a file for writing, it has complete control of what gets written to the file. It sounds like you want to add a call to flush() at the end of report()?

POST REPLY