{"id":7400,"library":"mdanalysis","title":"MDAnalysis","description":"MDAnalysis is an open-source, object-oriented toolkit for the analysis of molecular dynamics trajectories and other atomistic simulation data. It provides Python classes to represent and manipulate atomistic data, enabling users to perform various analyses from simple selections to complex calculations. The current version is 2.10.0, and new minor releases are frequent, typically on a monthly or bi-monthly cadence.","status":"active","version":"2.10.0","language":"en","source_language":"en","source_url":"https://github.com/mdanalysis/mdanalysis","tags":["molecular dynamics","simulation","chemistry","physics","bioinformatics","trajectory analysis"],"install":[{"cmd":"pip install MDAnalysis","lang":"bash","label":"Install stable release"}],"dependencies":[{"reason":"Core numerical operations and array handling.","package":"numpy","optional":false},{"reason":"Required for some sequence and structure analysis functionalities.","package":"biopython","optional":true},{"reason":"Optional dependency for reading TNG trajectory files.","package":"pytng","optional":true}],"imports":[{"note":"Universe is the central object for loading and manipulating simulation data.","symbol":"Universe","correct":"import MDAnalysis as mda\nu = mda.Universe(...)"},{"note":"Submodule containing various analysis tools (e.g., distances, contacts).","symbol":"analysis","correct":"from MDAnalysis.analysis import ..."},{"note":"Submodule for modifying trajectories during loading (e.g., centering, unwrapping).","symbol":"transformations","correct":"from MDAnalysis.transformations import ..."}],"quickstart":{"code":"import MDAnalysis as mda\nimport numpy as np\n\n# Create an empty Universe to demonstrate basic operations without requiring files\n# In real applications, you would load structure and trajectory files (e.g., PDB, XTC).\n# u = mda.Universe(\"path/to/structure.pdb\", \"path/to/trajectory.xtc\")\n\nu = mda.Universe.empty(n_atoms=4, trajectory=True)\n\n# Add dummy atom data to the empty Universe\nu.add_atomgroup(mda.AtomGroup([u.select_atoms(\"all\")[0]], universe=u, name='C'))\nu.add_atomgroup(mda.AtomGroup([u.select_atoms(\"all\")[1]], universe=u, name='H'))\nu.add_atomgroup(mda.AtomGroup([u.select_atoms(\"all\")[2]], universe=u, name='O'))\nu.add_atomgroup(mda.AtomGroup([u.select_atoms(\"all\")[3]], universe=u, name='N'))\nu.atoms.types = ['C', 'H', 'O', 'N']\nu.atoms.masses = [12.01, 1.008, 15.999, 14.007]\n\n# Set dummy positions for a single frame\nu.atoms.positions = np.array([\n    [0.0, 0.0, 0.0],\n    [1.0, 0.0, 0.0],\n    [0.0, 1.0, 0.0],\n    [1.0, 1.0, 0.0]\n])\n\nprint(f\"Universe created with {u.atoms.n_atoms} atoms.\")\nprint(f\"First atom: {u.atoms[0].type} at {u.atoms[0].position}\")\n\n# Select atoms based on properties\ncarbon_atoms = u.select_atoms(\"type C\")\nprint(f\"\\nSelected {carbon_atoms.n_atoms} carbon atom(s).\")\nprint(f\"Carbon atom position: {carbon_atoms.positions}\")\n\n# Calculate a simple property, e.g., center of mass\ncenter_of_mass = u.atoms.center_of_mass()\nprint(f\"\\nCenter of mass of all atoms: {center_of_mass}\")","lang":"python","description":"This quickstart demonstrates how to create a simple MDAnalysis Universe object in memory, populate it with dummy atom data, select atoms, and perform a basic calculation. In a typical workflow, you would load data from actual structure (e.g., PDB) and trajectory (e.g., XTC, DCD) files using `mda.Universe('structure.pdb', 'trajectory.xtc')`."},"warnings":[{"fix":"Upgrade MDAnalysis to the latest version (2.8.0 or newer) to ensure full compatibility with NumPy 2.0+. If upgrading MDAnalysis is not possible, try pinning your NumPy version to a compatible range, typically `<2.0.0` for older MDAnalysis releases.","message":"MDAnalysis maintains compatibility with a wide range of NumPy versions (e.g., 1.26.0 up to 2.0+ for MDAnalysis 2.10.0). However, using an MDAnalysis version that is too old with a very new NumPy (especially NumPy 2.0.0+) can lead to `AttributeError` or `TypeError` related to numerical types (e.g., `np.float` not found).","severity":"gotcha","affected_versions":"<2.8.0 with NumPy >= 2.0.0"},{"fix":"Ensure your Python environment meets or exceeds the minimum requirement for the desired MDAnalysis version. Check the official MDAnalysis documentation or PyPI page for the exact `requires_python` specification.","message":"The minimum supported Python version for MDAnalysis has steadily increased across major releases. For instance, MDAnalysis 2.5.0 required Python >=3.9, while MDAnalysis 2.10.0 requires Python >=3.11. Installing on an older Python environment will fail.","severity":"breaking","affected_versions":"All versions, as minimum Python requirement changes frequently."},{"fix":"Review the LGPLv3+ license terms if you are developing software that links to MDAnalysis or redistributing MDAnalysis. Previous versions remain under GPLv3+.","message":"Starting with MDAnalysis 2.8.0, the core library license transitioned from GPLv3+ to LGPLv3+. While this primarily affects developers and projects linking against MDAnalysis, it's a significant change for users considering redistribution or integration into proprietary software.","severity":"breaking","affected_versions":">=2.8.0"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Upgrade MDAnalysis to version 2.8.0 or newer, which includes explicit support for NumPy 2.0+. Alternatively, downgrade NumPy to a version compatible with your MDAnalysis installation, typically `pip install numpy<2.0.0`.","cause":"This error often occurs when an older version of MDAnalysis (or its dependencies) attempts to use deprecated NumPy type aliases (like `np.float`, `np.int`) with a newer NumPy version (specifically NumPy 2.0+), which removed these aliases.","error":"AttributeError: module 'numpy' has no attribute 'float'"},{"fix":"Ensure you have installed MDAnalysis correctly via `pip install MDAnalysis`. Verify that the Python interpreter you are running (`python` or `python3`) corresponds to the environment where MDAnalysis was installed.","cause":"The MDAnalysis package was not correctly installed or the Python environment where it was installed is not the one being used.","error":"ModuleNotFoundError: No module named 'MDAnalysis'"},{"fix":"Upgrade MDAnalysis to version 2.4.3 or newer. This bug was explicitly fixed in MDAnalysis 2.4.3.","cause":"Specific bug in MDAnalysis versions 2.4.0, 2.4.1, and 2.4.2 that prevented correct reading of DCD trajectory files larger than 2 gigabytes.","error":"RuntimeError: DCD reading for large (>2Gb) files is broken"}]}