pwtools.dcd.read_dcd_data

pwtools.dcd.read_dcd_data(fn, convang=False)[source]

Read dcd file. Fastest version. Calculates nstep from bytes between end-of-header and EOF.

Parameters:
  • fn (str) – filename

  • convang (bool) – convert angles from cosine to degree (only useful for lammps style dcd files)

Returns:

ret – | cryst_const : (nstep,6) float64 array, (a,b,c,alpha,beta,gamma), | Angstrom, degrees | coords : (nstep, natoms, 3) float32 array, cartesian coords Angstrom

Return type:

(cryst_const, coords)

Examples

>>> # default settings read cp2k files
>>> cc,co = read_dcd_data('cp2k.dcd')
>>> cc,co = read_dcd_data('cp2k.dcd', convang=False)
>>> cc,co = read_dcd_data('lammps.dcd', convang=True)