Skip to main content

High Performance Interface for H5MD Trajectories

Project description

zincware Coverage Status PyPI version Binder

ZnH5MD - High Performance Interface for H5MD Trajectories

ZnH5MD allows easy access to simulation results from H5MD trajectories.

Example

In the following example we investigate an H5MD dump from LAMMPS with 1000 atoms and 201 configurations:

import znh5md

traj = znh5md.DaskH5MD("file.h5", time_chunk_size=500, species_chunk_size=100)

print(traj.file.time_dependent_groups)
# ['edges', 'force', 'image', 'position', 'species', 'velocity']

print(traj.force)
# DaskDataSet(value=dask.array<array, shape=(201, 1000, 3), ...)

print(traj.velocity.slice_by_species(species=1))
# DaskDataSet(value=dask.array<reshape, shape=(201, 500, 3), ...)

print(traj.position.value)
# dask.array<array, shape=(201, 1000, 3), dtype=float64, chunksize=(100, 500, 3), ...>

# You can iterate through the data
for item in traj.position.batch(size=27, axis=0):
    for x in item.batch(size=17, axis=1):
        print(x.value.compute())

ASE Atoms

You can use ZnH5MD to store ASE Atoms objects in the H5MD format.

ZnH5MD does not support all features of ASE Atoms objects. It s important to note that unsupported parts are silently ignored and no error is raised.

The ASEH5MD interface will not provide any time and step information.

import znh5md
import ase

atoms: list[ase.Atoms]

db = znh5md.io.DataWriter(filename="db.h5")
db.initialize_database_groups()

db.add(znh5md.io.AtomsReader(atoms))

data = znh5md.ASEH5MD("db.h5")
data.get_atoms_list() == atoms

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

znh5md-0.1.2.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

znh5md-0.1.2-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file znh5md-0.1.2.tar.gz.

File metadata

  • Download URL: znh5md-0.1.2.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.10.8 Linux/5.19.0-35-generic

File hashes

Hashes for znh5md-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e663cebffb9be680cc4dec5a567dc85a19cec6d5c63d496e056df09686282ba1
MD5 fb4c86711a355d40cabb17a973600333
BLAKE2b-256 5fab426c76225ac66fd34d665b7073da2a2b60d748d0f6011925ae04f6bcaa50

See more details on using hashes here.

File details

Details for the file znh5md-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: znh5md-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.10.8 Linux/5.19.0-35-generic

File hashes

Hashes for znh5md-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 faff6ac583f1f2680592aa01a29975323ebd353730dc98afb3240eb1b210f6ba
MD5 4cc468d7d477bfec66ee0073b8fc55d6
BLAKE2b-256 fc07dcb5ca16de77315777eb8e79b1f1c7ad554aebc1a49121cce4db4596b39e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page