dimchris / mdanalysis

Automatically exported from code.google.com/p/mdanalysis
0 stars 0 forks source link

Bug in prmtop parser #74

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
****************
import MDAnalysis.topology.TOPParser as top
top.parse("protCryst.prmtop") 

What is the expected output? What do you see instead?
*****************
parse prmtop files, but got
+++++++
  File "/Library/Python/2.6/site-packages/MDAnalysis-0.7.3-py2.6-macosx-10.6-universal.egg/MDAnalysis/topology/TOPParser.py", line 118, in parse
    parse_sec(info)
  File "/Library/Python/2.6/site-packages/MDAnalysis-0.7.3-py2.6-macosx-10.6-universal.egg/MDAnalysis/topology/TOPParser.py", line 89, in parse_sec
    parsefunc(next_line, atoms_per, data_struc, structure, numlines)
  File "/Library/Python/2.6/site-packages/MDAnalysis-0.7.3-py2.6-macosx-10.6-universal.egg/MDAnalysis/topology/TOPParser.py", line 195, in __parsesection_
    x = util.FORTRANReader(y)
  File "/Library/Python/2.6/site-packages/MDAnalysis-0.7.3-py2.6-macosx-10.6-universal.egg/MDAnalysis/core/util.py", line 268, in __init__
    descriptors = [self.parse_FORTRAN_format(descriptor) for descriptor in self.fmt]
  File "/Library/Python/2.6/site-packages/MDAnalysis-0.7.3-py2.6-macosx-10.6-universal.egg/MDAnalysis/core/util.py", line 324, in parse_FORTRAN_format
    d = m.groupdict()
AttributeError: 'NoneType' object has no attribute 'groupdict'
++++++++++++++++

What version of the product are you using? On what operating system?

MDAnalysis0.7.3, Mac Os X 10.6

Please provide any additional information below.

in file TOPParser.py line 83
        numlines = int((float(num)/per_line))
if “num" is divisible by "per_line", the parse will read one more line and 
thus skip the FORMAT line
simply add
if(num % per_line == 0): numlines -= 1
fix the problem

Original issue reported on code.google.com by htao...@gmail.com on 2 Jun 2011 at 6:24

GoogleCodeExporter commented 9 years ago
should be fixed in r816; please check with your test case.

Many thanks for reporting it and identifying the bug!

Original comment by orbeckst on 2 Jun 2011 at 4:50