Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ Chronological list of authors
- Yibo Zhang
- Luís Pedro Borges Araújo
- Abhishek A. Kognole
- Rocco Meli

External code
-------------
Expand Down
3 changes: 2 additions & 1 deletion package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The rules for this file:
mm/dd/yy micaela-matta, xiki-tempula, zemanj, mattwthompson, orbeckst, aliehlen,
dpadula85, jbarnoud, manuel.nuno.melo, richardjgowers, mattwthompson,
ayushsuhane, picocentauri, NinadBhat, bieniekmateusz, p-j-smith, Lp0lp,
IAlibay, tyler.je.reddy, aakognole
IAlibay, tyler.je.reddy, aakognole, RMeli

* 0.20.0

Expand Down Expand Up @@ -76,6 +76,7 @@ Changes
Fixes
* fixes ProgressMeter issues with older Jupyter Lab versions (Issue #2078)
* fixes ProgressMeter behaviour for non-AnalysisBase methods (Issue #2084)
* fixed mol2 parser for status bit strings (Issue #2318)
* fixed reading AMBER topologies with negative ATOMIC_NUMBERS (Issue #2306)
* fixed reading bz2 compressed psf files (Issue #2232)
* fixed mol2 comment header handling (Issue #2261)
Expand Down
4 changes: 3 additions & 1 deletion package/MDAnalysis/coordinates/MOL2.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class MOL2Reader(base.ReaderBase):
previously created a new instance of Timestep each frame.
.. versionchanged:: 0.20.0
Allows for comments at top of file.
Ignores status bit strings
"""
format = 'MOL2'
units = {'time': None, 'length': 'Angstrom'}
Expand Down Expand Up @@ -197,7 +198,8 @@ def parse_block(self, block):

coords = np.zeros((self.n_atoms, 3), dtype=np.float32)
for i, a in enumerate(atom_lines):
aid, name, x, y, z, atom_type, resid, resname, charge = a.split()
aid, name, x, y, z, atom_type, resid, resname, charge = a.split()[:9]

#x, y, z = float(x), float(y), float(z)
coords[i, :] = x, y, z

Expand Down
7 changes: 5 additions & 2 deletions package/MDAnalysis/topology/MOL2Parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class MOL2Parser(TopologyReaderBase):
Now subclasses TopologyReaderBase
.. versionchanged:: 0.20.0
Allows for comments at the top of the file
Ignores status bit strings
"""
format = 'MOL2'

Expand Down Expand Up @@ -139,7 +140,8 @@ def parse(self, **kwargs):
charges = []

for a in atom_lines:
aid, name, x, y, z, atom_type, resid, resname, charge = a.split()
aid, name, x, y, z, atom_type, resid, resname, charge = a.split()[:9]

ids.append(aid)
names.append(name)
types.append(atom_type)
Expand Down Expand Up @@ -174,7 +176,8 @@ def parse(self, **kwargs):
bondorder = []
for b in bond_lines:
# bond_type can be: 1, 2, am, ar
bid, a0, a1, bond_type = b.split()
bid, a0, a1, bond_type = b.split()[:4]

a0, a1 = int(a0) - 1, int(a1) - 1
bond = tuple(sorted([a0, a1]))
bondorder.append(bond_type)
Expand Down
7 changes: 6 additions & 1 deletion testsuite/MDAnalysisTests/coordinates/test_mol2.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

from MDAnalysisTests.datafiles import (
mol2_molecules, mol2_molecule, mol2_broken_molecule,
mol2_zinc, mol2_comments_header
mol2_zinc, mol2_comments_header, mol2_ligand
)
from MDAnalysis import Universe
import MDAnalysis as mda
Expand All @@ -56,6 +56,11 @@ def test_read(self):
u.trajectory[199]
assert_array_almost_equal(u.atoms.positions[0], [1.7240, 11.2730, 14.1200])

def test_read_statusbit(self):
u = Universe(mol2_ligand)
assert_equal(len(u.atoms), 297)
assert_equal(u.trajectory.n_frames, 1)

def test_write(self):
ref = Universe(mol2_molecules)
ref.atoms.write(self.outfile)
Expand Down
630 changes: 630 additions & 0 deletions testsuite/MDAnalysisTests/data/mol2/Ligand.mol2

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion testsuite/MDAnalysisTests/datafiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"TRR_multi_frame",
"merge_protein", "merge_ligand", "merge_water",
"mol2_molecules", "mol2_molecule", "mol2_broken_molecule",
"mol2_zinc", "mol2_comments_header",
"mol2_zinc", "mol2_comments_header", "mol2_ligand",
"capping_input", "capping_output", "capping_ace", "capping_nma",
"contacts_villin_folded", "contacts_villin_unfolded", "contacts_file",
"LAMMPSdata", "trz4data", "LAMMPSdata_mini",
Expand Down Expand Up @@ -383,6 +383,7 @@

mol2_molecules = resource_filename(__name__, "data/mol2/Molecules.mol2")
mol2_molecule = resource_filename(__name__, "data/mol2/Molecule.mol2")
mol2_ligand = resource_filename(__name__, "data/mol2/Ligand.mol2")
mol2_broken_molecule = resource_filename(__name__, "data/mol2/BrokenMolecule.mol2")
mol2_comments_header = resource_filename(__name__, "data/mol2/Molecule_comments_header.mol2")
# MOL2 file without substructure field
Expand Down