Blog

MDAnalysis 2.2 is out

We are happy to release the version 2.2.0 of MDAnalysis!

In line with NEP 29, this version of MDAnalysis drops support for Python 3.7 and raises the minimum NumPy version to 1.19.0. Minimum version support has also been changed for the following packages; networkx>=2.0, scipy>=1.5.0, gsd>=1.9.3. Further details on MDAnalysis future support strategy and NEP29 will be released shortly.

Supported Python versions: 3.8, 3.9, 3.10

Supported Operating Systems:

  • Linux
  • Windows
  • MacOS (on x86_64 and for the first time on Apple M1 ARM architecture. Note that for M1 you can currently only install using pip)

Upgrading to MDAnalysis version 2.2.0

To update with conda from the conda-forge channel run

conda update -c conda-forge mdanalysis

To update from PyPi with pip run

pip install --upgrade MDAnalysis

For more help with installation see the installation instructions in the User Guide.

Notable new additions

  • @rsexton2 implemented a frames argument for AnalysisBase-derived classes (i.e. modern analysis classes) allowing for specific frames to be defined when running an analysis. This new feature allows one to run per-frame analysis on arbitrary subsets of trajectory frames. (PR #3415)
  • Thanks to @IAlibay, Python wheels are now made available through PyPI for x86_64 architectures (Issue #1300, PR #3680)
  • @PicoCentauri implemented a center_of_charge attribute for AtomGroups (PR #3671)
  • Thanks to @BFedder, LinearDensity now works with UpdatingAtomGroups (Issue #2508, PR #3617)
  • @rishu235 implemented a PCA transformation and an associated inverse-PCA transformation in the PCA analysis class (PR #3596, Issue #2703)
  • @cbouy implemented major improvements to the RDKitConverter’s accuracy (PR #3044)
    • accuracy of 99.14% when benchmarked against ChEMBL30
    • AtomGroups containing monatomic ion charges and edge cases with nitrogen, sulfur, phosphorus and conjugated systems should now have correctly assigned bond orders and charges.
  • @ALescoulie implemented a new AnalysisBase-derived Watson-Crick distance analysis class (PR #3611); the new MDAnalysis.analysis.nucleicacids module will eventually replace the old-style MDAnalysis.analysis.nuclinfo module.
  • Thanks to @tylerjereddy, MDAnalysis builds for Apple M1 are now available.

Important fixes

  • Fixed issues where calling the copy method of Readers did not preserve optional arguments (Issue #3664, PR #3685)
  • Fixed several issues where iterating trajectories had undefined behaviour
    • Iterating (not in memory) SingleFrame readers now reset modified trajectory attributes (Issue #3423)
    • Iterating using defined indices did not rewind the trajectory (Issue #3416)
  • Fixed issues with competing processes writing to an XTC offset file leading to offset corruption (Issue #1988, PR #3375)
  • Fixed issue preventing OpenMMTopologyParsers from parsing systems with missing elements (Issue #3317, PR #3511)
  • Fixed issue with encore.covariance.covariance_matrix not working when providing an external reference (Issue #3539, PR #3621)
  • Fixed issue with broken code paths for “residues” and “segment” groupings for LinearDensity (Issue #3571, PR #3572)
  • Improved the flexibility of MOL2 reading, allowing for optional columns (subst_id, subst_name and charge) not to be provided (Issue #3385, PR #3598)
  • Fixed several issues related to converting AtomGroups to RDKit molecules (PR #3044):
    • Atoms are now in the same order
    • atom.GetMonomerInfor().GetName() now follows the guidelines for PDB files
    • Using NoImplicit=False no longer throws a SanitizationError
  • Fixed issues with incorrect reading of triclinic boxes from DUMP files (Issue #3386, PR #3403)
  • Fixed issue with the BAT method modifying input coordinate data (Issue #3501)

For a full list of bugfixes see the CHANGELOG.

Other changes

  • The number of matches allowed when doing a smarts selection has been increased from the default 1000 to max(1000, n_atoms * 10), an additional set of smarts_kwargs can now also be passed to override this behaviour (Issue #3469, PR #3470)
  • The fasteners package is now a core dependency (PR #3375)
  • LinearDensity now saves the histogram bin edges for easier plotting as hist_bin_edges for each dimension in the results dictionary (Issue #2508, PR #3617)
  • ContactAnalysis now accepts AtomGroups (Issue #2666, PR #3565)

Deprecations

  • The following results attribute for LinearDensity are now deprecated: (Issue #2508, PR #3617)
    • pos is now mass_density
    • char is now charge_density
    • std entries are now stddev

Author statistics

This release was the work of 30 contributors, 21 of which are new contributors.

Our new contributors are: @BFedder @inomag @Agorfa @aya9aladdin @shudipto-amin @HenokB @umak1106 @tamandeeps @Mrqeoqqt @megosato @AnirG @rishu235 @manishsaini6421 @Sukeerti1 @robotjellyzone @markvrma @alescoulie @mjtadema @aditi2906 @rsexton2 @rafaelpap

Acknowledgements

Thanks to @mikemhenry for testing the M1 builds locally.

MDAnalysis thanks NumFOCUS for its continued support as our fiscal sponsor and the Chan Zuckerberg Initiative for supporting MDAnalysis under an EOSS4 award.

  • The MDAnalysis Team

Google Summer of Code Students 2022

We are happy to announce that MDAnalysis is hosting two GSoC students this year – @aya9aladdin, and @BFedder. MDAnalysis has been accepted as its own organization with GSoC for the third year running and we are grateful to Google for granting us the opportunity to undertake two very exciting GSoC projects!

Aya Mohamed Alaa: Context-aware guessers

Aya Mohamed Alaa

MDAnalysis supports many molecular dynamics simulation files and force fields, which brings the challenge of tailoring the guessing methods to each type of format. Aya is going to work on building a context-aware guesser API Context-aware guesser (implementing implementing PDB and Martini guessers) that can provide a way for the user to pass the context of his work conveniently through an API so that the guessing of missing attributes would be more accurate and reliable.

Aya is pharmaceutical sciences graduate from Ain-Shams University (Egypt) and a premaster student at Arab Academy for science and technology (Egypt). She is interested in working on the link between computer science and biological sciences as she believes in the importance of finding a way to look at biological questions from the computational and engineering point of view. On the weekends, Aya enjoys outdoor sports, especially football, and tennis, additionally, Aya enjoys swimming as it helps reduce the feeling of stress (Egypt’s sun will force you to spend the whole day at the pool though).

You can find Aya on GitHub, Twitter, and Facebook

This is Aya’s personal blog for documenting her summer with MDAnalysis Blog

Bjarne Feddersen: Adding Energy Readers to MDAnalysis

Bjarne Feddersen

Bjarne is joining us to work on the auxiliary data framework. This framework allows the association of non-trajectory data with the frames of a trajectory in MDAnalysis, which could for example be used for further analyses or to filter frames of a trajectory based on non-trajectory information. The framework is currently limited to working with XVG files due to the fact that no other file readers are implemented. This will change with Bjarne’s project. In particular, he will implement new AuxReaders to read energy files. These files are produced by MD engines during a simulation and contain information on, for example, the system’s kinetic and potential energy, temperature, or pressure. These terms describe important quantitites of the system and as such help with evaluation of simulations. Implementing new AuxReaders for these files in MDAnalysis will make this part of the analysis more convenient and at the same time broaden the scope of the auxiliary data framework. To further aid this second objective, Bjarne will compile the lessons he will learn while writing the new AuxReaders into a comprehensive tutorial to make future additions to the framework easier.

Bjarne is a DPhil student in Phil Biggin’s group at the University of Oxford, where he uses MD simulations and other computational tools to investigate the mechanism of action of voltage-gated sodium channels. To balance his desk job he likes to spend time outdoors, and especially enjoys cycling through the green English countryside.

Bjarne is on GitHub as @BFedder and on LinkedIn. He will be reporting on his project on his blog.

@jbarnoud @hmacdope @ojeda-e @IAlibay @fiona-naughton @orbeckst @lilyminium @richardjgowers (mentors)

MDAnalysis 2.1 is out

We are happy to release the version 2.1.0 of MDAnalysis!

In line with ongoing attempts to keep MDAnalysis closer to NEP 29, this version now only supports Python 3.7 to 3.10, in addition to a minimum NumPy version of 1.18.0.

Further details about MDAnalysis’ support policy, including our release schedule, will be provided in an upcoming blog post.

Upgrading to MDAnalysis version 2.1.0

To install with conda from the conda-forge channel run

conda update -c conda-forge mdanalysis

To install from PyPi with pip run

pip install --upgrade MDAnalysis

For more help with installation see the installation instructions in the User Guide.

Notable new additions

Dielectric constant analysis

Mattia Felice Palermo and Philip Loche contributed a new analysis module to compute average dipole moments. The module can be accessed as MDAnalysis.analysis.dielectric. Here is an example from the documentations:

import MDAnalysis as mda
from MDAnalysis.analysis.dielectric import DielectricConstant
from MDAnalysisTests.datafiles import PSF_TRICLINIC, DCD_TRICLINIC

# Load a pure water system
universe = mda.Universe(PSF_TRICLINIC, DCD_TRICLINIC)

diel = DielectricConstant(universe.atoms)
diel.run()
print(diel.results)
{'M': array([ 1.54082059, -2.03885814,  3.37261771]), 'M2': array([ 5.71970697, 13.45815613, 18.24527209]), 'fluct': array([3.34557887, 9.3012136 , 6.87072189]), 'eps': array([2.47772633, 5.10830197, 4.0347653 ]), 'eps_mean': 3.873597866567474}

R/S chirality is read from RDKit objects

Richard Gowers made the reading of RDKit molecules aware of the R/S chirality when the information is available. The information can be accessed with the AtomGroup.chirality attribute and be used for selections.

import MDAnalysis as mda
from rdkit import Chem

molecule = Chem.MolFromSmiles('CC[[email protected]](C)[[email protected]](C(=O)O)N')
universe = mda.Universe(molecule)

# Read the chirality of each atom
universe.atoms.chiralities

# Select atoms from their chirality
universe.select_atoms('element C and chirality S')

Other enhancements

Thanks to Atharva Kulkarni, MDAnalysis.units.convert knows about milliseconds and microseconds. The function, as the name indicates, converts quantities from one unit to an other.

Edis Jakupovic improved the reading of H5MD files so it can better read files without a topology. For these files, the number of atoms is now read from the positions, velocities, or forces in the trajectory.

Thanks to Richard Gowers, again, one can apply the minimum image convention to a collection of vectors using MDAnalysis.lib.distances.minimize_vectors.

Thanks to Jonathan Barnoud, this version of MDAnalysis is compatible with TPR files produced with Gromacs 2022.

Thanks to Hugo MacDermott-Opeskin, you can now specify additional compiler flags for the C/C++ compiler to customise your installation. This can be used to improve performance by using architecture specific flags. See the detailed instructions in the User Guide for more information.

Other changes

Indexing a group (AtomGroup, ResidueGroup, or SegmentGroup) with None now raises a TypeError.

As announced with the previous release, the TZR reader now defaults to a dt of 1.0 ps, instead of 0.0 ps previously, when the time step cannot be read from the file.

For a full list of bugfixes see the CHANGELOG.

Deprecations

In methods of AtomGroup. ResidueGroup, and SegmentGroup, the argument pbc has been renamed wrap. This name makes the meaning of the argument clearer and mirrors the unwrap argument of these same methods. The use of pbc is still possible, bt it is deprecated and will be removed in version 3.0.

Author statistics

Altogether, this represents the work of 14 authors, 6 of which were new contributors:

MDAnalysis thanks NumFOCUS’s continued support as the organisation’s fiscal sponsor.

  • The MDAnalysis Team