Fixing Issue#550#580
Conversation
Tests for PSA now use tempdir Fixes Issue #557
Fixes Issue #576
…e file. Improved the error message.
…re than 99,999 atoms, in a manner consistent with genbox in GROMACS 4.6.3. Note that it appears that some GROMACS utilities (i.e., trjconv) actually write 00000 instead of 0 for the 100,000th atom. Both formats can be read in by MDAnalysis and VMD, and this is (overall) an improvement that allows us to write large .gro files in a workable manner. Fixes #550.
|
bigbox.gro is 5.7M. Is it possible to test the written values just by calling readlines and then checking that line[100000] is a certain string? |
|
@richardjgowers I thought we discussed that. It might be possible to come up with something more elegant by subclassing Maybe it is! Note that subclassing for test purposes does add a layer of complexity if the |
|
I don't mind creating the large gro file, it's the large reference file that's the problem. The only section of it we're using is this: So we could change |
|
And how are you planning to create a large gro file with those lines if you don't have a large reference file with coordinates to read in? Where is the big universe, that will be used for writing, coming from? This is the same discussion from the issue itself. Either we include a large gro file or we subclass the writer and do some magic so that we can use smaller input or topology manipulation (from a blank universe or whatever) to fake reading in a large coordinate file. |
|
For a start, try bzip2ing the bigbox.gro file. The GRO reader uses |
…which is involved in testing resolution of Issue#550.
|
Ok, compressing the file has reduced its size to Also, would it be of interest to add a flag that allows the user to specify if they want digit-retained truncation (i.e., |
There was a problem hiding this comment.
Do both universe and large_universe need to be created for each test of that class while none of the tests use both? Could large_universe be created only in the relevant test?
|
@jbarnoud If the tests in the class don't really share the same requirements for the As for the other comment, I actually thought that using the same temporary output directory structure (and defining it in the As an aside, my PR adds a third statement of the following form to the try:
os.unlink(self.outfile3)
except OSError:
passDoing the above operation in three separate try/except loops for three different temporary files in the same |
|
@tylerjereddy I haven't read the tests right now. But the def setup():
self.tempdir = tempdir.tempdir()
def tearDown():
del self.tempdir
def test_1():
outfile = self.tempdir + '/name of file'Personally even better for me works class test_xyz:
def __init__(self):
self.tempdir = tempdir.tempdir()
def test_1(self):
outfile = self.tempdir + '/test-1.txt'This way all the tests in this class work in one temp directory which gets cleaned once you are done. |
|
You can check the second example here |
|
I agree these tests would benefit from some cleaning that is out of scope of this PR. Yet, maybe the test introduced here could be move in a new class so a large universe does not get created for each test of the Also, a docstring with a reference to #550 would be nice as it would give the test some context. But this is just nitpicking. |
…ed in the PR thread.
|
I've moved the test for #550 to its own class and made an effort to comply with the suggestions in this PR thread. The original |
|
👍 |
|
Any other suggestions / problems with this PR? |
|
Nope, looks good |
Attempted fix for Issue #550. Although this now enables us to use the
GROWriterto write usable.grofiles with > 99,999 atoms, there are some caveats here:.grodata file, with > 100,000 atoms and generated by genbox 4.6.3, also does this!.grofiles back in. I have to concede that most of my large systems stored in.groformat are actually truncated to keep all the extra zeros / digits, probably because I've used trjconv on them at some point.The reason for this behaviour is because:
returns 0
Of course, I'm sure we could find a way to do the truncation with digit-retention, but I ultimately aimed for a fix that matched the new unit test file, which I had generated in the manner Chris Ing suggested.