Registry / data / openmm-mdanalysis-reporter

openmm-mdanalysis-reporter

JSON →
library0.1pypypiunverified

The openmm-mdanalysis-reporter is a Python library that bridges OpenMM simulations with MDAnalysis. It allows users to create MDAnalysis Universe objects directly from OpenMM State objects and write trajectory data to any MDAnalysis-supported format, particularly the Universal Archive Format (UAF). The current version is 0.1, indicating an early development stage with an infrequent release cadence.

pip install openmm-mdanalysis-reporter
INSTALL
IMPORT
SIG · OPENMM-MDANALYSIS-
O
openmm-mdanalysis-reporter
datapythonv0.1
Install
13.0s avg
Import
Disk
375MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
build_error
glibc
py 3.103.910 runs
installs and imports cleanly · install 13.0s · import 0.000s · 363MB
375MB installed
● package 375MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MDAnalysisReporter
from mdareporter import MDAnalysisReporter
from mdareporter import MDAnalysisReporter

This quickstart demonstrates how to set up a minimal OpenMM simulation and attach the `MDAnalysisReporter` to write trajectory data. It uses a simple single-particle system for brevity. For real simulations, you would load a PDB, define forces, and set proper periodic boundary conditions. The example also shows how to optionally load the generated `.uaf` file using MDAnalysis for verification.

import openmm.app as app import openmm as om from openmm_mdanalysis_reporter import MDAnalysisReporter import os # Create a simple system (e.g., single atom, just for demonstration) # In a real scenario, you'd load a PDB/GMX file with app.PDBFile, etc. system = om.System() system.addParticle(1.0) # mass in amu # Create an integrator integrator = om.VerletIntegrator(0.001) # 1 fs timestep # Create a simulation object # Use 'Reference' platform for broad compatibility without GPU platform = om.Platform.getPlatformByName('Reference') simulation = app.Simulation(system, integrator, platform) simulation.context.setPositions([[0, 0, 0]]) # Set initial position simulation.context.setVelocitiesToTemperature(300 * om.unit.kelvin) # Set initial velocities # Define output file path for the trajectory output_file = "trajectory.uaf" # UAF is recommended for MDAnalysisReporter # Add the MDAnalysisReporter # Report every 10 steps, enforce periodic box (set to False for this non-periodic system) # For periodic systems, ensure system.setDefaultPeriodicBoxVectors is called. reporter = MDAnalysisReporter(output_file, 10, enforcePeriodicBox=False) simulation.reporters.append(reporter) print(f"Running simulation and writing to {output_file}...") simulation.step(100) # Run for 100 steps print("Simulation finished.") # Optional: Load and inspect the generated trajectory with MDAnalysis try: import MDAnalysis as mda u = mda.Universe(output_file) print(f"Loaded trajectory with {u.trajectory.n_frames} frames.") # Clean up the generated file os.remove(output_file) print(f"Cleaned up {output_file}.") except ImportError: print("MDAnalysis not installed, skipping trajectory inspection and cleanup.") except Exception as e: print(f"Error loading trajectory with MDAnalysis: {e}. Attempting cleanup.") if os.path.exists(output_file): os.remove(output_file) # Still try to clean up
Debug
Known issues
gotchaThe `enforcePeriodicBox` parameter requires the OpenMM `System` to have periodic box vectors defined. If `enforcePeriodicBox=True` is used for a non-periodic system (e.g., implicit solvent, gas phase without explicit box definition), the reporter will raise a `ValueError` during the report step.
fix
For non-periodic simulations, initialize the reporter with `enforcePeriodicBox=False`. For periodic simulations, ensure periodic box vectors are set on the `System` object (e.g., `system.setDefaultPeriodicBoxVectors(...)` or loaded from a PDB with CRYST1 records).
affects: 0.1
gotchaThe Universal Archive Format (`.uaf`) is the explicitly recommended output format for `MDAnalysisReporter`. While other MDAnalysis-supported formats might work, `.uaf` is designed for direct mapping from OpenMM states, offering better performance and reliability. Using other formats might lead to unexpected behavior, performance overheads, or data integrity issues.
fix
Prioritize using the `.uaf` extension for your trajectory output files. If another format is essential, thoroughly test its compatibility and data integrity with the reporter.
affects: 0.1
gotchaAs a `0.1` release, this library is in an early development stage. While functional, its API may not be entirely stable, and performance might not be fully optimized for all complex scenarios. Future minor or patch releases could introduce breaking changes or significant API adjustments.
fix
Consult the official GitHub repository for the latest documentation and potential updates. Exercise caution and thorough testing when relying on specific API behaviors or upgrading the library.
affects: 0.1
Upgrade
Version history
0.1latest on PyPI · released May 25, 2023
Audit
Dependencies
openmmrequiredCore molecular dynamics simulation engine.
MDAnalysisrequiredCore library for molecular dynamics trajectory analysis.
numpyrequiredNumerical operations, a transitive dependency via OpenMM and MDAnalysis.
Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources
openmm-mdanalysis-reporter — pip install openmm-mdanalysis-reporter · libregistry