You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you try to read any .gro file in which columns are not separated by blanks,
for instance with a line like this:
12875SOL HW151606 9.098 4.794 2.060-16.9931 -3.6174 -9.4839
the program crashes:
Traceback (most recent call last):
...
File ".../MDAnalysis/core/AtomGroup.py", line 1800, in __init__
self.load_new(coordinatefile, **kwargs)
File ".../MDAnalysis/core/AtomGroup.py", line 1862, in load_new
self.trajectory = TRJReader(filename, **kwargs) # unified trajectory API
File ".../MDAnalysis/coordinates/GRO.py", line 94, in __init__
coords_list.append( numpy.array( map( float , line[20:].split()[0:3] ) ) )
ValueError: invalid literal for float(): 2.060-16.9931
data in .gro files is disposed in fixed width columns, a reader method should
not rely on blank line splitting as currently does the implementation found in
MDAnalysis/coordinates/GRO.py
MDAnalysis-0.7.6, python implementation error, platform independent
Original issue reported on code.google.com by pedro...@gmail.com on 10 Jul 2012 at 4:15
The text was updated successfully, but these errors were encountered:
Thanks. Could you attach a small GRO file for testing? (We will include the
file with the MDAnalysis test suite so you by sending it you licence it under
the GPL and you should not send anything confidential)
Original comment by orbeckst on 10 Jul 2012 at 6:00
Here it is. According to the specification,
http://manual.gromacs.org/online/gro.html
things can become even more complicated. For parsing fixed column fields in
python the module struct might be useful
Original comment by pedro...@gmail.com on 11 Jul 2012 at 9:00
Thanks for the example.
We also have MDAnalysis.core.util.FORTRANReader (see
http://packages.python.org/MDAnalysis/documentation_pages/core/util.html#MDAnaly
sis.core.util.FORTRANReader ) to parse fixed columns with FORTRAN editstrings
(3F8.3 1X 3A ...) but that came after the GRO reader :-).
Original comment by orbeckst on 11 Jul 2012 at 10:50
Fixed - should work with any precision now.
Also, I didn't attach the column_test.gro - I just modified
sample_velocity_file.gro so that it tests for the same problem.
Original comment by Danny.Pa...@gmail.com on 12 Jul 2012 at 4:21
Original issue reported on code.google.com by
pedro...@gmail.com
on 10 Jul 2012 at 4:15The text was updated successfully, but these errors were encountered: