Skip to content

Improper ordering in MDAnalysis #2386

@lilyminium

Description

@lilyminium

Expected behavior

Impropers, where the central atom is typically located in the third index located in varying non-symmetric places (see below), are faithfully represented in MDAnalysis.

Actual behavior

MDAnalysis shows a representation where Improper.values[0] < Improper.values[-1].

>>> top.atoms[[31,34,43,35]].impropers.indices
array([[31, 34, 43, 35],  # <--- this one
       [34, 37, 35, 36],
       [34, 41, 43, 44],
       [35, 39, 37, 38],
       [39, 43, 41, 42]], dtype=int32)

Looking at the topology impropers:

>>> top._topology.impropers.values
[(4, 12, 10, 11), (14, 27, 25, 26), (19, 23, 22, 24), (29, 47, 45, 46), (35, 43, 34, 31),
...]

(35, 43, 34, 31) is now (31, 34, 43, 35).

Code to reproduce the behavior

Show us how to reproduce the failiure. If you can, use trajectory files from the test data.

import MDAnalysis as mda
from MDAnalysis.tests.datafiles import PRM

u = mda.Universe(PRM)
print(u.atoms[[31,34,43,35]].impropers.indices)
print(u._topology.impropers.values)

Currently version of MDAnalysis

  • Which version are you using? (run python -c "import MDAnalysis as mda; print(mda.__version__)") 0.20.1
  • Which version of Python (python -V)? 3.7.3
  • Which operating system? MacOS

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions