Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pdebuyl/pyh5md
Read and write H5MD files
https://github.com/pdebuyl/pyh5md
hdf5 molecular-dynamics
Last synced: 4 months ago
JSON representation
Read and write H5MD files
- Host: GitHub
- URL: https://github.com/pdebuyl/pyh5md
- Owner: pdebuyl
- Created: 2012-12-28T12:45:13.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2017-12-19T15:21:57.000Z (about 7 years ago)
- Last Synced: 2024-09-22T08:47:30.034Z (5 months ago)
- Topics: hdf5, molecular-dynamics
- Language: Python
- Size: 92.8 KB
- Stars: 12
- Watchers: 5
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
pyh5md : Read and write H5MD files
==================================Copyright 2012-2017 Pierre de Buyl and contributors
*License:* BSDpyh5md is a library to read and write easily H5MD files. [H5MD][] is a file
format specification based on [HDF5][] to store molecular data. pyh5md is built
on top of [h5py][], the HDF5 for Python library by Andrew Colette.[H5MD]: http://nongnu.org/h5md/
[HDF5]: http://www.hdfgroup.org/HDF5/
[h5py]: http://h5py.org/pyh5md used to define a complex class structure. Since version 1.0.0.dev1, a light
subclassing of h5py's classes is used instead.Install
-------python setup.py install --user
or
pip install --user .
installs pyh5md for the current user
Examples
--------Once pyh5md is installed:
cd examples
python random_walk_1d.pyexecutes an example program that generates the H5MD file `walk_1d.h5`.
Usage
-----To write data to a particles group named "atoms", with a fixed set of positions:
from pyh5md import File, element
kwargs = {'creator': 'pyh5md README example',
'author': 'Pierre de Buyl',
}
with File('new_file.h5', 'w', **kwargs) as f:
g = f.particles_group('atoms')
g.create_box(dimension=3, boundary=['none']*3)
element(g, 'position', store='fixed', data=np.random.random(size=(32, 3)))To read data from a H5MD file created with, for instance, LAMMPS:
from pyh5md import File, element
with File('dump_3d.h5', 'r') as f:
g = f.particles_group('all')
box_edges = element(g, 'box/edges').value[0]
position = element(g, 'position').value[:]