Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 49
Add UserGuide documentation for IMDReader#430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base:develop
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -9,3 +9,4 @@ Other | ||
| :maxdepth: 1 | ||
| parmed_sim | ||
| streaming_imd | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,325 @@ | ||||||
| { | ||||||
| ||||||
| "cells": [ | ||||||
| { | ||||||
| "cell_type": "markdown", | ||||||
| "id": "d090b35a", | ||||||
| "metadata": {}, | ||||||
| "source": [ | ||||||
| "# Real-time Streaming Analysis with IMDv3\n", | ||||||
| "\n", | ||||||
| "This tutorial demonstrates how to use MDAnalysis for real-time streaming analysis of molecular dynamics simulations using the Interactive Molecular Dynamics (IMD) v3 protocol. You'll learn how to connect to running simulations and perform live analysis as the simulation progresses.\n", | ||||||
| "\n", | ||||||
| "**Streaming** involves processing data in real-time as it is generated, rather than storing it for later analysis. In molecular dynamics, this means sending simulation data to a client on-the-fly while the simulation is running, without writing large trajectory files to disk.\n", | ||||||
| "\n", | ||||||
| "This is achieved through a TCP/IP socket connection between the simulation engine and receiving client, transmitting coordinates, velocities, forces, energies, and timing information using the IMDv3 protocol.\n", | ||||||
| "\n", | ||||||
| "## What it covers\n", | ||||||
| "\n", | ||||||
| "- How to set up streaming connections to MD engines\n", | ||||||
| "- Real-time monitoring\n", | ||||||
| "- Live analysis workflows\n", | ||||||
| "\n", | ||||||
| "## Prerequisites\n", | ||||||
| "\n", | ||||||
| "Before starting, you'll need:\n", | ||||||
| "- MDAnalysis with IMD support\n", | ||||||
| "- The `imdclient` package (≥ 0.2.2)\n", | ||||||
| "- A running MD simulation with IMD enabled (examples are engine agnostic for the most part)" | ||||||
| ] | ||||||
| }, | ||||||
| { | ||||||
| "cell_type": "markdown", | ||||||
| "id": "e2168297", | ||||||
| "metadata": {}, | ||||||
| "source": [ | ||||||
| "## Installation and Setup\n", | ||||||
| "\n", | ||||||
| "The IMDReader requires the `imdclient` package. Let's check if everything is properly installed:" | ||||||
| ] | ||||||
| }, | ||||||
| { | ||||||
| "cell_type": "code", | ||||||
| "execution_count": null, | ||||||
| "id": "6024bb10", | ||||||
| "metadata": {}, | ||||||
| "outputs": [], | ||||||
| "source": [ | ||||||
| "# Install required packages (uncomment if needed)\n", | ||||||
| "# !pip install imdclient>=0.2.2\n", | ||||||
| "\n", | ||||||
| "import warnings\n", | ||||||
| "warnings.filterwarnings('ignore')\n", | ||||||
| "\n", | ||||||
| "import MDAnalysis as mda\n", | ||||||
| "import numpy as np\n", | ||||||
| "import matplotlib.pyplot as plt\n", | ||||||
| "from datetime import datetime\n", | ||||||
| "import time\n", | ||||||
| "\n", | ||||||
| "# Check if IMD support is available\n", | ||||||
| "try:\n", | ||||||
| " from MDAnalysis.coordinates.IMD import IMDReader, HAS_IMDCLIENT\n", | ||||||
| " print(f\"IMD support available: {HAS_IMDCLIENT}\")\n", | ||||||
| " if HAS_IMDCLIENT:\n", | ||||||
| " import imdclient\n", | ||||||
| " print(f\"imdclient version: {imdclient.__version__}\")\n", | ||||||
| " print(\"✅ Ready for streaming analysis!\")\n", | ||||||
| " else:\n", | ||||||
| " print(\"❌ IMD support not available\")\n", | ||||||
| "except ImportError as e:\n", | ||||||
| " print(f\"❌ IMD support not available: {e}\")\n", | ||||||
| " print(\"Please install imdclient: pip install imdclient>=0.2.2\")" | ||||||
| ] | ||||||
| }, | ||||||
| { | ||||||
| "cell_type": "markdown", | ||||||
| "id": "e698ca2d", | ||||||
| "metadata": {}, | ||||||
| "source": [ | ||||||
| "## Setting Up a Simulation with IMD\n", | ||||||
| "\n", | ||||||
| "Before we can demonstrate streaming analysis, we need a simulation running with IMD enabled. Here are configuration examples for different MD engines:\n", | ||||||
| "\n", | ||||||
| "### GROMACS Setup\n", | ||||||
| "\n", | ||||||
| "Add these comprehensive IMD settings to your `.mdp` file:\n", | ||||||
| "```code\n", | ||||||
CopilotAI | ||||||
| "; IMD settings for v3 protocol\n", | ||||||
| "IMD-group = System ; Group to stream (typically System)\n", | ||||||
| "IMD-version = 3 ; Use IMDv3 protocol (required for MDAnalysis)\n", | ||||||
| "IMD-nst = 1 ; Frequency of data transmission (every step)\n", | ||||||
| "IMD-time = No ; Send time information\n", | ||||||
| "IMD-coords = Yes ; Send atomic coordinates (essential)\n", | ||||||
| "IMD-vels = No ; Send velocities (optional)\n", | ||||||
| "IMD-forces = No ; Send forces (optional)\n", | ||||||
| "IMD-box = No ; Send box dimensions (optional)\n", | ||||||
| "IMD-unwrap = No ; Unwrap coordinates across PBC\n", | ||||||
| "IMD-energies = No ; Send energy information (optional)\n", | ||||||
| "```\n", | ||||||
| "\n", | ||||||
| "Run the simulation:\n", | ||||||
| "```bash\n", | ||||||
| "gmx mdrun -v -nt 4 -imdwait -imdport 8889\n", | ||||||
| "```\n", | ||||||
| "\n", | ||||||
| "### LAMMPS Setup\n", | ||||||
| "\n", | ||||||
| "Use the comprehensive IMD fix in your input script:\n", | ||||||
| "```code\n", | ||||||
CopilotAI | ||||||
| "```code\n", | |
| "```lammps\n", |
CopilotAIOct 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code block language identifier should be a valid language (e.g., 'bash', 'text', or 'tcl') instead of 'code' for proper syntax highlighting in the documentation.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we want people to install with Conda for consistency?
Also, will people be running this notebook, or reading it as a guide? I think this cell can potentially be removed, seems like a bit of overkill
Reply via ReviewNB
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need package installation here. imdclient will always be installed when MDA is installed.imdclient will need to be installed separately. However, I'd mention this fact and then link to installation instructions instead of repeating instructions that may change over time.In general, always link to authoritative instructions; you're the expert on the matter so you should know what the authoritative sources are.