Skip to content

AtomGroup.unwrap confused about bound sub-groups #3352

@mnmelo

Description

@mnmelo

Expected behavior

ag.unwrap should make the group's fragments whole. It does in version 1.1.1.

Actual behavior

In 2.0.0-dev0 an exception sometimes is raised that the group is not contiguous from bonds.

Code to reproduce the behavior

This was first reported by @hejamu in Discord. He has provided me with a LAMMPS example structure for which this occurs, but I have since been able to reproduce the error with 1hvr.pdb, which is already in the tests (with the CONECT datafile reference).

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

u = mda.Universe(CONECT)
u.atoms.unwrap()

## ValueError: AtomGroup was not contiguous from bonds, process failed

Current version of MDAnalysis

2.0.0-dev0

Cause

A first inspection seems to indicate that unwrap is selecting the wrong set of atoms as a fragment to unwrap (in the 1hvr example only parts of the molecule have CONECT records). This is maybe related to the changes introduced in #3005, which touched this aspect of the code.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions