# Supported File Formats¶

## edr: GROMACS energy file¶

Extension: .edr
class chemlab.io.handlers.EdrIO(filename)

EDR files store per-frame information for gromacs trajectories. Examples of properties obtainable from EDR files are:

- temperature
- pressure
- density
- potential energy
- total energy
- etc.

To know which quantities are available in a certain edr file you can access the feature ‘avail quantity’:

>>> datafile('ener.edr').read('avail quantities')
['Temperature', 'Pressure', 'Potential', ...]


To get the frame information for a certain quantity you may use the “quantity” property passing the quantity as additional argument, this will return two arrays, the first is an array of times in ps and the second are the corrisponding quantities:

>>> time, temp = datafile('ener.edr').read('quantity', 'Temperature')


Features

Return an array of times in ps and the corresponding quantities at that times.

Return the available quantities in the file.

Return a dictionary where the keys are the quantities and the value are the units in which that quantity is expressed.

Return a dictionary where the keys are the quantities and the value are the units in which that quantity is expressed.

## gro: GROMACS coordinate files¶

Extension: .gro
class chemlab.io.handlers.GromacsIO(filename)

Handler for .gro file format. Example at http://manual.gromacs.org/online/gro.html.

Features

Read the gro file and return a System instance. It also add the following exporting informations:

groname: The molecule names indicated in the gro file. This is
added to each entry of System.mol_export.
grotype: The atom names as indicated in the gro file. This is
added to each entry of System.atom_export_array.
write("system", syst)

Write the syst System instance to disk. The export arrays should have the groname and grotype entries as specified in the read("system") method.

Example

Export informations for water SPC:

Molecule([
Atom('O', [0.0, 0.0, 0.0], export={'grotype': 'OW'}),
Atom('H', [0.1, 0.0, 0.0], export={'grotype': 'HW1'}),
Atom('H', [-0.033, 0.094, 0.0],export={'grotype':'HW2'})],
export={'groname': 'SOL'})


## pdb: Protein Data Bank format¶

Extension: .pdb
class chemlab.io.handlers.PdbIO(filename)

Starting implementation of a PDB file parser.

Note

This handler was developed as an example. If you like to contribute by implementing it you can write an email to the mailing list.

Features

Read the pdb file as a huge Molecule.

Read the pdb file as a System, where each residue is a molecule.

## xtc: GROMACS compressed trajectory file¶

Extension: .xtc
class chemlab.io.handlers.XtcIO(filename)

Features

Read the frames from the file and returns the trajectory as an array of times and an array of atomic positions:

>>> times, positions = datafile('traj.xtc').read('trajectory')
[t1, t2, t3], [pos1, pos2, ...]


positions is a list of np.ndarray(n_atoms, 3).

## xyz: XYZ coordinate format¶

Extension: .xyz
class chemlab.io.handlers.XyzIO(filename)

The XYZ format is described in this wikipedia article http://en.wikipedia.org/wiki/XYZ_file_format.

Features

Read the coordinates in a Molecule instance.

write("molecule", mol)

Writes a Molecule instance in the XYZ format.