pwtools.pwscf.read_matdyn_modes

pwtools.pwscf.read_matdyn_modes(filename, natoms=None)[source]

Parse modes file produced by QE’s matdyn.x.

Parameters:
  • filename (str) – File to parse (usually “matdyn.modes”)

  • natoms (int) – Number of atoms.

Returns:

  • qpoints, freqs, vecs

  • qpoints (2d array (nqpoints, 3)) – All qpoints on the grid.

  • freqs (2d array, (nqpoints, nmodes) where nmodes = 3*natoms) – Each row: 3*natoms phonon frequencies in [cm^-1] at each q-point.

  • vecs (4d complex array (nqpoints, nmodes, natoms, 3)) – Complex eigenvectors of the dynamical matrix for each q-point.

Examples

>>> qpoints,freqs,vecs=read_matdyn_modes('matdyn.modes',natoms=27)
# how many q-points? -> 8
>>> qpoints.shape
(8,3)
# 1st q-point in file, mode #3 (out of 3*27) -> vectors on all 27 atoms
>>> vecs[0,2,...].shape
(27,3)
# 1st q-point in file, mode #3, vector on atom #15
>>> vecs[0,2,14,:].real
array([-0.010832,  0.026063, -0.089511])
>>> vecs[0,2,14,:].imag
array([ 0.,  0.,  0.])

Notes

The file to be parsed looks like this:

     diagonalizing the dynamical matrix ...

 q =       0.0000      0.0000      0.0000
 **************************************************************************
     omega( 1) =     -26.663631 [THz] =    -889.402992 [cm-1]
 ( -0.218314   0.000000    -0.025643   0.000000    -0.116601   0.000000   )
 ( -0.086633   0.000000     0.108966   0.000000    -0.066513   0.000000   )
[... natoms lines: x_real x_imag y_real y_imag z_real z_imag ... until
 next omega ...]
     omega( 2) =     -16.330246 [THz] =    -544.718372 [cm-1]
 (  0.172149   0.000000     0.008336   0.000000    -0.121991   0.000000   )
 ( -0.061497   0.000000     0.003782   0.000000    -0.018304   0.000000   )
[... until omega(3*natoms) ...]
 **************************************************************************
     diagonalizing the dynamical matrix ...

[... until next q-point ...]
 q =       0.0000      0.0000     -0.5000
 **************************************************************************
     omega( 1) =     -24.881828 [THz] =    -829.968443 [cm-1]
 ( -0.225020   0.000464    -0.031584   0.000061    -0.130217   0.000202   )
 ( -0.085499   0.000180     0.107383  -0.000238    -0.086854   0.000096   )
[...]
 **************************************************************************