Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EDR reader fails when only one step is present #3999

Closed
bosonie opened this issue Jan 19, 2023 · 2 comments · Fixed by #4030
Closed

EDR reader fails when only one step is present #3999

bosonie opened this issue Jan 19, 2023 · 2 comments · Fixed by #4030

Comments

@bosonie
Copy link

bosonie commented Jan 19, 2023

Expected behavior

It does not fail, reads the EDR without problems

Actual behavior

The following error:

StopIteration                             Traceback (most recent call last)
Cell In [2], line 1
----> 1 a=EDRReader('/home/ebosoni/Downloads/system_npt-skPu.edr', convert_units=False)

File /shared/envs/base_nextmol_func/lib/python3.10/site-packages/MDAnalysis/auxiliary/EDR.py:324, in EDRReader.__init__(self, filename, convert_units, **kwargs)
    322 # attribute to communicate found energy terms to user
    323 self.terms = list(self.data_dict.keys())
--> 324 super(EDRReader, self).__init__(**kwargs)

File /shared/envs/base_nextmol_func/lib/python3.10/site-packages/MDAnalysis/auxiliary/base.py:321, in AuxReader.__init__(self, represent_ts_as, auxname, cutoff, **kwargs)
    319 if self.time_selector is not None and self.constant_dt:
    320     self.auxstep._initial_time = self.time
--> 321     self._read_next_step()
    322     self.auxstep._dt = self.time - self.initial_time
    323     self.rewind()

File /shared/envs/base_nextmol_func/lib/python3.10/site-packages/MDAnalysis/auxiliary/EDR.py:374, in EDRReader._read_next_step(self)
    372 else:
    373     self.rewind()
--> 374     raise StopIteration

StopIteration: 

Code to reproduce the behavior

Unfortunately I can not upload here an .edr, if you need it I can send it through other menas.

WORKAROUND

The crash actually happens in the if self.time_selector is not None and self.constant_dt, therefore I found that setting constant_dt=False avoids the error. However I'm not sure you want to recommend this as a solution...also because I struggled quite a bit to understand the meaning of constant_dt from the documentation and I'm still failing to understand the implications of this parameter. For instance, for the EDR reader we have the time_selector set, isn't it enough to catch possible cases of not constant dt?

Current version of MDAnalysis

  • Which version are you using? Version '2.4.1'
  • Which version of Python? 3.10.6
  • Which operating system? Ubuntu
@orbeckst
Copy link
Member

@BFedder could you please have a look at this issue?

@BFedder
Copy link
Contributor

BFedder commented Feb 13, 2023

Thanks for raising this issue, bosonie (and thanks for pointing it out to me orbeckst, I completely missed this). I'll have a look later this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants