Skip to content

Commit

Permalink
Merge pull request #4102 from MDAnalysis/prerelease-package-2.4.3
Browse files Browse the repository at this point in the history
Add necessary commits for 2.4.3
  • Loading branch information
IAlibay authored Mar 29, 2023
2 parents 264d6f9 + 353a253 commit 8599e47
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 11 deletions.
2 changes: 1 addition & 1 deletion maintainer/conda/MDAnalysis/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package:
name: mdanalysis
# This has to be changed after a release
version: "2.4.2"
version: "2.4.3"

source:
git_url: https://github.com/MDAnalysis/mdanalysis
Expand Down
10 changes: 10 additions & 0 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ The rules for this file:
* release numbers follow "Semantic Versioning" http://semver.org

------------------------------------------------------------------------------
03/29/23 richardjgowers, IAlibay

* 2.4.3

Fixes
* Fixed DCD reading for large (>2Gb) files (Issue #4039). This was broken
for versions 2.4.0, 2.4.1 and 2.4.2
* Fix element parsing from PSF files tests read via Parmed (Issue #4015)


01/04/23 IAlibay

* 2.4.2
Expand Down
6 changes: 3 additions & 3 deletions package/MDAnalysis/lib/formats/libdcd.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ cdef class DCDFile:
# The current DCD frame
cdef int current_frame
# size of the first DCD frame
cdef readonly int _firstframesize
cdef readonly fio_size_t _firstframesize
# Size of a DCD frame
cdef readonly int _framesize
cdef readonly fio_size_t _framesize
# Size of the DCD header
cdef readonly int _header_size
cdef readonly fio_size_t _header_size
# Is the file open?
cdef int is_open
# Have we reached the end of the file
Expand Down
4 changes: 3 additions & 1 deletion package/MDAnalysis/lib/formats/libdcd.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,9 @@ cdef class DCDFile:
if frame == 0:
offset = self._header_size
else:
offset = self._header_size + self._firstframesize + self._framesize * (frame - 1)
offset = self._header_size
offset += self._firstframesize
offset += self._framesize * (frame - 1)
cdef int ok = fio_fseek(self.fp, offset, _whence_vals['FIO_SEEK_SET'])
if ok != 0:
Expand Down
2 changes: 1 addition & 1 deletion package/MDAnalysis/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@
# e.g. with lib.log

#: Release of MDAnalysis as a string, using `semantic versioning`_.
__version__ = "2.4.2" # NOTE: keep in sync with RELEASE in setup.py
__version__ = "2.4.3" # NOTE: keep in sync with RELEASE in setup.py
2 changes: 1 addition & 1 deletion package/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
from subprocess import getoutput

# NOTE: keep in sync with MDAnalysis.__version__ in version.py
RELEASE = "2.4.2"
RELEASE = "2.4.3"

is_release = 'dev' not in RELEASE

Expand Down
2 changes: 1 addition & 1 deletion testsuite/MDAnalysisTests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
logger = logging.getLogger("MDAnalysisTests.__init__")

# keep in sync with RELEASE in setup.py
__version__ = "2.4.2"
__version__ = "2.4.3"


# Do NOT import MDAnalysis at this level. Tests should do it themselves.
Expand Down
6 changes: 4 additions & 2 deletions testsuite/MDAnalysisTests/converters/test_parmed_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,11 @@ class TestParmedParserPSF(BaseTestParmedParser):
expected_n_dihedrals = 8921
expected_n_impropers = 541
expected_n_cmaps = 212
elems_ranges = ((0, 3342),)
elems_ranges = ((100, 120),)
# No atomic numbers set by parmed == no elements
expected_elems = (np.array(['' for i in range(3341)], dtype=object),)
expected_elems = (np.array(
['N', 'H', 'C', 'H', 'C', 'H', 'H', 'C', 'H', 'C', 'H', 'H', 'H', 'C',
'H', 'H', 'H', 'C', 'O', 'N',], dtype=object),)

def test_bonds_atom_counts(self, universe):
assert len(universe.atoms[[0]].bonds) == 4
Expand Down
36 changes: 36 additions & 0 deletions testsuite/MDAnalysisTests/coordinates/test_dcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations.
# J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787
#
import os
from pathlib import Path
import numpy as np

Expand Down Expand Up @@ -436,3 +437,38 @@ def test_pathlib():
# we really only care that pathlib
# object handling worked
assert u.atoms.n_atoms == 3341


@pytest.fixture
def large_dcdfile(tmpdir):
# creates a >2Gb DCD file
fsize = 3.8 # mb
nreps_reqs = int(2100 // fsize) # times to duplicate traj to hit 2.1Gb

newf = str(tmpdir / "jabba.dcd")

u = mda.Universe(PSF, DCD)

with mda.Writer(newf, n_atoms=len(u.atoms)) as w:
for _ in range(nreps_reqs):
for ts in u.trajectory:
w.write(u.atoms)

yield newf, nreps_reqs


@pytest.mark.skipif(
not os.environ.get("LARGEDCD", False), reason="Skipping large file test"
)
def test_large_dcdfile(large_dcdfile):
DCD_large, nreps = large_dcdfile

u_small = mda.Universe(PSF, DCD)
u = mda.Universe(PSF, DCD_large)

assert len(u.trajectory) == len(u_small.trajectory) * nreps

u_small.trajectory[-1]
u.trajectory[-1]

assert_array_almost_equal(u.atoms.positions, u_small.atoms.positions)
2 changes: 1 addition & 1 deletion testsuite/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def run(self):

if __name__ == '__main__':
# this must be in-sync with MDAnalysis
RELEASE = "2.4.2"
RELEASE = "2.4.3"
with open("README") as summary:
LONG_DESCRIPTION = summary.read()

Expand Down

0 comments on commit 8599e47

Please sign in to comment.