/pyironFileReader

OVITO Python file reader for the h5 data containers written by pyiron.

Primary LanguagePythonMIT LicenseMIT

pyiron File Reader

OVITO Python file reader for the h5 data containers written by pyiron.

Description

Python file reader for OVITO that reads structural data from the hdf5 containers written by pyiron. After installation, OVITO will auto-detect pyiron files and open them for analysis and visualization. Note that the "status" of the pyiron job needs to be "finished" before its file can be read. The following table gives an overview over all particle properties and attributes currently understood by this parser. Optional properties will be skipped if they are not included in the file and the parser is not in strict mode.

Particle properties

pyiron name OVITO name Components Optional
generic/indices Particle Type 1
generic/unwrapped_positions Position 3 x*
generic/positions Position 3 x*
generic/forces Force 3 x
generic/velocities Velocity 3 x

* One of generic/unwrapped_positions or generic/positions is required.

Attributes

pyiron name OVITO name Components Optional
generic/steps Timestep 1
generic/natoms Number of atoms 1
generic/temperature Temperature 1 x
generic/energy_tot Total energy 1 x

The file reader can be installed either into OVITO Pro or the OVITO Python module Python module using pip.

Parameters

  • roundCell / "Round cell to orthogonal": Round the off-diagonal components of the simulation cell to 0 if they are below a threshold value currently hard-coded to 1e-8 A.
  • strict / "Strict mode": Activate strict mode which requires all optional keys to be present in the pyiron data container. In strict mode, any missing key will raise a KeyError. The default (non-strict) mode silently skips all missing optional keys.

Example

  1. Example 01 loads the lmp.h5 structure file and prints all particle properties and attributes found therein.

The following image shows the same file in the OVITO Pro desktop application. Example 01

Example data generation

The example data was generated using the generate_example_data_01.py script using pyiron. For more information visit their website.

Installation

Technical information / dependencies

  • Tested with OVITO 3.9.1
  • Depends on:
    • numpy
    • h5py
  • Please note, this file reader does currently NOT work on windows.

Adding new properties or attributes

New optional particle properties and attributes can be included in the parser quite easily. To add new particle properties, include them in the particle_props_dict of the PyironFileReader class, which can be found here. Similarly, new attributes need to be added to the attributes_dict. Both dictionaries map pyiron names to OVITO names. If you add new properties consider contacting the author or submitting a pull request to make these changes available to the whole community.

Contact