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

consistently indicate absence of box information `Timestep.dimensions` #1738

Open
orbeckst opened this Issue Dec 13, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@orbeckst
Member

orbeckst commented Dec 13, 2017

Expected behaviour

When a trajectory does not contain a unit cell, then u.trajectory.ts.dimensions should have one value that always indicates the absence of box information, for example None or [0, 0, 0, 0, 0, 0]

Actual behaviour

Readers decide for themselves how they handle missing box information. For example:

  • XYZReader: array([ 0., 0., 0., 0., 0., 0.], dtype=float32)
  • DCDReader: array([ 0., 0., 0., 90., 90., 90.], dtype=float32)

See discussion #1733 (comment)

Code to reproduce the behaviour

import MDAnalysis as mda
from MDAnalysis.tests.datafiles import XYZ, PSF, DCD

xyz = mda.Universe(XYZ)
print(xyz.trajectory.ts.dimensions)

dcd = mda.Universe(PSF, DCD)
print(dcd.trajectory.ts.dimensions)

Currently version of MDAnalysis:

(run python -c "import MDAnalysis as mda; print(mda.__version__)")

0.17.0-dev

@orbeckst

This comment has been minimized.

Show comment
Hide comment
@orbeckst

orbeckst Dec 13, 2017

Member

Having dimensions = None will require quite a bit of extra work in the readers (e.g., when converting units). I'd probably just go with [0, 0, 0, 0, 0, 0] because that's already the default coming from base.Timestep. Then we only need to look at the readers that rely on specialized code.

Member

orbeckst commented Dec 13, 2017

Having dimensions = None will require quite a bit of extra work in the readers (e.g., when converting units). I'd probably just go with [0, 0, 0, 0, 0, 0] because that's already the default coming from base.Timestep. Then we only need to look at the readers that rely on specialized code.

@richardjgowers

This comment has been minimized.

Show comment
Hide comment
@richardjgowers

richardjgowers Dec 13, 2017

Member

I'd rather have None. Most (all?) "box=" keywords use None to signify no pbc, so if we used None then we could blindly pass dimensions.

That said, there's also the issue of dealing with periodicity in only a few dimensions (eg bilayer you don't want pbc normal to lipid plane). If we did allow length=0 to mean no pbc, then semi periodic is a lot easier to deal with.

So maybe we should allow length=0

Member

richardjgowers commented Dec 13, 2017

I'd rather have None. Most (all?) "box=" keywords use None to signify no pbc, so if we used None then we could blindly pass dimensions.

That said, there's also the issue of dealing with periodicity in only a few dimensions (eg bilayer you don't want pbc normal to lipid plane). If we did allow length=0 to mean no pbc, then semi periodic is a lot easier to deal with.

So maybe we should allow length=0

@jmborr

This comment has been minimized.

Show comment
Hide comment
@jmborr

jmborr Dec 13, 2017

Contributor

@orbeckst Can you also write a utility function that will return False if the system is non-periodic in order to hide the particular definition of non-periodic dimensions that you will settle for?

Contributor

jmborr commented Dec 13, 2017

@orbeckst Can you also write a utility function that will return False if the system is non-periodic in order to hide the particular definition of non-periodic dimensions that you will settle for?

@orbeckst

This comment has been minimized.

Show comment
Hide comment
@orbeckst

orbeckst Dec 13, 2017

Member
Member

orbeckst commented Dec 13, 2017

@orbeckst orbeckst added the PBC label Jan 24, 2018

@orbeckst orbeckst added this to the 1.0 milestone Jan 26, 2018

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