This repo contains exploratory Python/Cython analysis code for LAMMPS H5MD trajectory files.
Main entry points:
src/h5md_analysis/trajectory.pyreads H5MD files and runs one-time or two-time calculations.src/h5md_analysis/analysis_tool.pybacks theh5md-analysisconsole command.src/h5md_analysis/calculations/contains observable functions such as MSD, ISF, RDF, contact maps, and gyration metrics.src/h5md_analysis/_core/*.pyxcontains Cython kernels built throughsetup.py.
This repo is for exploratory data analysis and research code, not production software.
Write code for clarity, directness, and easy debugging.
Prefer:
- simple, linear code
- explicit intermediate variables
- transparent assumptions
- fail-fast behavior
- minimal necessary checks
Avoid unless explicitly requested:
- defensive programming
- broad try/except
- classes or heavy abstraction
- generic utility layers
- handling many hypothetical edge cases
- silent fixes, fallbacks, or auto-cleaning
Do not hide errors.
If assumptions are violated, let the code fail clearly at the relevant step. Use only a few targeted checks for important assumptions, such as required columns, merge keys, or missing IDs.
Solve the specific task described. Do not generalize the code into a reusable framework unless asked.
- Inspect the existing analysis modules before adding a new calculation.
- Prefer a small callable that matches the existing
cal_onetimeorcal_twotimepatterns over adding new orchestration code. - Keep H5MD dataset assumptions explicit, especially paths under
particles/all/.... - Avoid new dependencies unless explicitly requested.
- Keep generated trajectories, large analysis outputs,
.pyc, and__pycache__out of commits. - If changing a Cython kernel or
setup.py, rebuild the extension and run a small import or smoke check for the affected module.
Write code like a careful researcher working in a notebook, not like a backend engineer building a service. Keep it short, inspectable, and easy to modify.
For Markdown documents, use single dollar signs for inline math, such as $R(s)$, and double dollar signs for block equations. Do not use \(...\) for inline math or \[...\] for block equations in new or edited Markdown prose.