5. yaff.conversion – Conversion of external trajectory data

5.1. yaff.conversion.common – Tools for writing trajectory data

Tools for writing trajectory data

yaff.conversion.common.get_trajectory_group(f)

Create or return an existing trajectory group

Arguments:

f
An open HDF5 File or Group object.
yaff.conversion.common.get_trajectory_datasets(tgrp, *fields)

Return a list of new/existing datasets corresponding to the given fields

Arguments:

tgrp
The trajectory group
fields
A list of fields, i.e. pairs of name and row_shape.
yaff.conversion.common.get_last_trajectory_row(dss)

Find the first row to write new trajectory data.

Arguments:

dss
A list of datasets or the trajectory group.
yaff.conversion.common.write_to_dataset(ds, value, row)

Write a result at a given row in a trajectory. If needed, the dataset is extended.

Arguments:

ds
The dataset
value
The data to be written
row
The row index.
yaff.conversion.common.check_trajectory_rows(tgrp, dss, row)

Check if the datasets with the new trajectory data have consistent sizes.

Arguments:

tgrp
The trajectory group.
dss
The list of datasets that was filled with data.
row
The last row.

5.2. yaff.conversion.cp2k – CP2K Files

CP2K Files

yaff.conversion.cp2k.cp2k_ener_to_hdf5(f, fn_ener, sub=slice(None, None, None))

Convert a CP2K energy trajectory file to Yaff HDF5 format.

Arguments:

f
An open and writable HDF5 file.
fn_ener
The filename of the CP2K energy trajectory file.

Optional arguments:

sub
This must be a slice object that defines the sub-sampling of the CP2K energy file. By default all time steps are read.

This routine will also test the consistency of the row attribute of the trajectory group. If some trajectory data is already present, it will be replaced by the new data. Furthermore, this routine also checks the header of the CP2K energy file to make sure the values are interpreted correctly.

It is highly recommended to first initialize the HDF5 file with the to_hdf5 method of the System class.

5.3. yaff.conversion.dlpoly – DLPOLY Files

DLPOLY Files

yaff.conversion.dlpoly.dlpoly_history_to_hdf5(f, fn_history, sub=slice(None, None, None), pos_unit=1.889726133921252, vel_unit=4.5710289267195566e-05, frc_unit=2.015529715950126e-06, time_unit=41341.37333664682, mass_unit=1822.8886273532887)

Convert DLPolay History trajectory file to Yaff HDF5 format.

Arguments:

f
An open and writable HDF5 file.
fn_history
The filename of the DLPOLY history file.

Optional arguments:

sub
The sub argument for the DLPolyHistoryReader. This must be a slice object that defines the subsampling of the samples from the history file. By default all frames are read.
pos_unit, vel_unit, frc_unit, time_unit and mass_unit
The units used in the dlpoly history file. The default values correspond to the defaults used in DLPOLY.

This routine will also test the consistency of the row attribute of the trajectory group. If some trajectory data is already present, it will be replaced by the new data. It is highly recommended to first initialize the HDF5 file with the to_hdf5 method of the System class.

5.4. yaff.conversion.gaussian – Gaussian09 BOMD log Files

Gaussian09 BOMD log Files

yaff.conversion.gaussian.g09log_to_hdf5(f, fn_log)

Convert Gaussian09 BOMD log file to Yaff HDF5 format.

Arguments:

f
An open and writable HDF5 file.
fn_log
The name of the Gaussian log file.

5.5. yaff.conversion.xyz – XYZ Files

XYZ Files

yaff.conversion.xyz.xyz_to_hdf5(f, fn_xyz, sub=slice(None, None, None), file_unit=1.889726133921252, name='pos')

Convert XYZ trajectory file to Yaff HDF5 format.

Arguments:

f
An open and writable HDF5 file.
fn_xyz
The filename of the XYZ trajectory file.

Optional arguments:

sub
The sub argument for the XYZReader. This must be a slice object that defines the subsampling of the XYZ file reader. By default all frames are read.
file_unit
The unit of the data in the XYZ file. [default=angstrom]
name
The name of the HDF5 dataset where the trajectory is stored. This array is stored in the ‘trajectory’ group.

This routine will also test the consistency of the row attribute of the trajectory group. If some trajectory data is already present, it will be replaced by the new data. It is highly recommended to first initialize the HDF5 file with the to_hdf5 method of the System class.