Registry /
data / openmm-mdanalysis-reporter
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
muslpy 3.10–3.910 runs
build_error
glibcpy 3.10–3.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
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.