Skip to content

MOL2 writer does not work on universes #2717

@IAlibay

Description

@IAlibay

Expected behavior

This is related to: #2110 (comment)

As per its docstring, the MOL2Writer should take in either an atomgroup or a universe.

Actual behavior

Passing a universe causes a failure in encode_block when calling bondgroup = obj.bonds.atomgroup_intersection(obj, strict=True).

Code to reproduce the behavior

import MDAnalysis as mda
from MDAnalysis.tests.datafiles import mol2_comments_header
from MDAnalysis.coordinates.MOL2 import MOL2Writer

u = mda.Universe(mol2_comments_header)

with MOL2Writer("test.mol2", n_atoms=9) as w:
    for i, ts in enumerate(u.trajectory):
        w.write(u)

Current version of MDAnalysis

  • Which version are you using? (run python -c "import MDAnalysis as mda; print(mda.__version__)") 0.20.2-dev0
  • Which version of Python (python -V)? 3.7.7
  • Which operating system? Ubuntu 20.04 LTS

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