Skip to content
Open
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
4 changes: 4 additions & 0 deletions package/MDAnalysis/coordinates/MOL2.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ def _read_frame(self, frame):

sections, coords = self.parse_block(block)

if "crysin" in sections:
dims = sections["crysin"][0].split()[:6]
self.ts.dimensions = np.array(dims, dtype=np.float32)

for sect in ["molecule", "substructure"]:
try:
self.ts.data[sect] = sections[sect]
Expand Down
10 changes: 10 additions & 0 deletions testsuite/MDAnalysisTests/coordinates/test_mol2.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787
#
import pytest
import numpy as np

import os
from numpy.testing import (
Expand All @@ -39,6 +40,7 @@
mol2_comments_header,
mol2_ligand,
mol2_sodium_ion,
mol2_crysin,
)
from MDAnalysis import Universe
import MDAnalysis as mda
Expand Down Expand Up @@ -232,3 +234,11 @@ def test_mol2_universe_write(tmpdir):
assert_almost_equal(u.atoms.positions, u2.atoms.positions)
# MDA does not current implement @<TRIPOS>CRYSIN reading
assert u2.dimensions is None


def test_mol2_crysin_dimensions():
# test that crysin records are read as dimensions
u = mda.Universe(mol2_crysin)

expected = np.array([40.0, 50.0, 60.0, 90.0, 90.0, 90.0], dtype=np.float32)
assert_array_almost_equal(u.dimensions, expected, decimal=3)
10 changes: 10 additions & 0 deletions testsuite/MDAnalysisTests/data/mol2/test_crysin.mol2
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@<TRIPOS>MOLECULE
test_structure
1 0 0 0 0
SMALL
USER_CHARGES
@<TRIPOS>ATOM
1 C 0.0000 0.0000 0.0000 C.3 1 ALA 0.0000
@<TRIPOS>CRYSIN
40.0000 50.0000 60.0000 90.0000 90.0000 90.0000 1 1
@<TRIPOS>END
2 changes: 2 additions & 0 deletions testsuite/MDAnalysisTests/datafiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@
"mol2_comments_header",
"mol2_ligand",
"mol2_sodium_ion",
"mol2_crysin",
"capping_input",
"capping_output",
"capping_ace",
Expand Down Expand Up @@ -735,6 +736,7 @@
mol2_zinc = (_data_ref / "mol2/zinc_856218.mol2").as_posix()
# MOL2 file without bonds
mol2_sodium_ion = (_data_ref / "mol2/sodium_ion.mol2").as_posix()
mol2_crysin = (_data_ref / "mol2/test_crysin.mol2").as_posix()

capping_input = (_data_ref / "capping/aaqaa.gro").as_posix()
capping_output = (_data_ref / "capping/maestro_aaqaa_capped.pdb").as_posix()
Expand Down
Loading