I just installed OpenMM 6.0 and the tests all passed fine.
Then I tried importing a GRO file in a Python script and got this error:
Code: Select all
Traceback (most recent call last):
File "omm_test.py", line 6, in <module>
gro = GromacsGroFile(sys.argv[1])
File "/Library/Python/2.7/site-packages/simtk/openmm/app/gromacsgrofile.py", line 149, in __init__
raise Exception("Unexpected line in .gro file: "+line)
Exception: Unexpected line in .gro file: 1 THR N 1 6.503 7.301 12.753
When looking into the Python code of gromacsgrofile.py I found the following method to recognize atom lines in a GRO file:
Code: Select all
def _is_gro_coord(line):
""" Determines whether a line contains GROMACS data or not
@param[in] line The line to be tested
"""
sline = line.split()
if len(sline) == 6 or len(sline) == 9:
return all([_isint(sline[2]), _isfloat(sline[3]), _isfloat(sline[4]), _isfloat(sline[5])])
elif len(sline) == 5 or len(sline) == 8:
return all([_isint(line[15:20]), _isfloat(sline[2]), _isfloat(sline[3]), _isfloat(sline[4])])
else:
return 0
The Gromacs manual says: (http://manual.gromacs.org/online/gro.html)
Since velocities are not present in my file, 7 columns seems to be ok.Columns contain the following information (from left to right):
residue number (5 positions, integer)
residue name (5 characters)
atom name (5 characters)
atom number (5 positions, integer)
position (in nm, x y z in 3 columns, each 8 positions with 3 decimal places)
velocity (in nm/ps (or km/s), x y z in 3 columns, each 8 positions with 4 decimal places)
Is there there something I'm missing or is this a bug?
Cheers!
Tobias