Skip to content

apparent fencepost error in 'pdb traj' reading. #121

@lgsmith

Description

@lgsmith

Describe the bug

I get a:

terminate called after throwing an instance of 'std::out_of_range'
  what():  Bad index for an atom
Aborted (core dumped)

from trying to read to the end of a trajectory defined with the multipose pdb

To Reproduce

I attached an example pdb test-pose.txt (change the extension, obviously). When I try to read it like this:

import loos
from loos import pyloos
m = loos.createSystem('test-pose.pdb')
t = pyloos.Trajectory('test-pose.pdb', m)
print(len(t))
t[len(t) - 1]

I get the segfault. When I delete the last ENDMDL record, the file can be read through the final frame and the iterator exhausts normally. The issues don't arise until trying to reference the 'final' frame.

Expected behavior

Reading all 20 frames, then having the iterator know it's empty instead of thinking there are 21 and segfaulting.

LOOS version and platform

conda install 4.04
linux

Additional context

Alan and I slacked about this. It looks like the ENDMDL record queues the reader to expect another frame, but this PDB (created from a multipose sdf using openbabel) ends with:

ENDMDL
END

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions