pymatgen.io.phonopy module

Module for interfacing with phonopy, see https://atztogo.github.io/phonopy/

eigvec_to_eigdispl(v, q, frac_coords, mass)[source]

Converts a single eigenvector to an eigendisplacement in the primitive cell according to the formula:

exp(2*pi*i*(frac_coords \\dot q) / sqrt(mass) * v

Compared to the modulation option in phonopy, here all the additional multiplicative and phase factors are set to 1.

Parameters
  • v – the vector that should be converted. A 3D complex numpy array.

  • q – the q point in fractional coordinates

  • frac_coords – the fractional coordinates of the atom

  • mass – the mass of the atom

get_complete_ph_dos(partial_dos_path, phonopy_yaml_path)[source]

Creates a pymatgen CompletePhononDos from a partial_dos.dat and phonopy.yaml files. The second is produced when generating a Dos and is needed to extract the structure.

Parameters
  • partial_dos_path – path to the partial_dos.dat file.

  • phonopy_yaml_path – path to the phonopy.yaml file.

get_displaced_structures(pmg_structure, atom_disp=0.01, supercell_matrix=None, yaml_fname=None, **kwargs)[source]

Generate a set of symmetrically inequivalent displaced structures for phonon calculations.

Parameters
  • pmg_structure (Structure) – A pymatgen structure object.

  • atom_disp (float) – Atomic displacement. Default is 0.01 $\AA$.

  • supercell_matrix (3x3 array) – Scaling matrix for supercell.

  • yaml_fname (string) – If not None, it represents the full path to the outputting displacement yaml file, e.g. disp.yaml.

  • **kwargs – Parameters used in Phonopy.generate_displacement method.

Returns

A list of symmetrically inequivalent structures with displacements, in which the first element is the perfect supercell structure.

get_ph_bs_symm_line(bands_path, has_nac=False, labels_dict=None)[source]

Creates a pymatgen PhononBandStructure from a band.yaml file. The labels will be extracted from the dictionary, if present. If the ‘eigenvector’ key is found the eigendisplacements will be calculated according to the formula: \exp(2*pi*i*(frac_coords \dot q) / sqrt(mass) * v

and added to the object.

Parameters
  • bands_path – path to the band.yaml file

  • has_nac – True if the data have been obtained with the option –nac option. Default False.

  • labels_dict – dict that links a qpoint in frac coords to a label.

get_ph_bs_symm_line_from_dict(bands_dict, has_nac=False, labels_dict=None)[source]

Creates a pymatgen PhononBandStructure object from the dictionary extracted by the band.yaml file produced by phonopy. The labels will be extracted from the dictionary, if present. If the ‘eigenvector’ key is found the eigendisplacements will be calculated according to the formula:

exp(2*pi*i*(frac_coords \\dot q) / sqrt(mass) * v

and added to the object.

Parameters
  • bands_dict – the dictionary extracted from the band.yaml file

  • has_nac – True if the data have been obtained with the option –nac option. Default False.

  • labels_dict – dict that links a qpoint in frac coords to a label. Its value will replace the data contained in the band.yaml.

get_ph_dos(total_dos_path)[source]

Creates a pymatgen PhononDos from a total_dos.dat file.

Parameters

total_dos_path – path to the total_dos.dat file.

get_phonon_band_structure_from_fc(structure: pymatgen.core.structure.Structure, supercell_matrix: numpy.ndarray, force_constants: numpy.ndarray, mesh_density: float = 100.0, **kwargs)pymatgen.phonon.bandstructure.PhononBandStructure[source]

Get a uniform phonon band structure from phonopy force constants.

Parameters
  • structure – A structure.

  • supercell_matrix – The supercell matrix used to generate the force constants.

  • force_constants – The force constants in phonopy format.

  • mesh_density – The density of the q-point mesh. See the docstring for the mesh argument in Phonopy.init_mesh() for more details.

  • **kwargs – Additional kwargs passed to the Phonopy constructor.

Returns

The uniform phonon band structure.

get_phonon_band_structure_symm_line_from_fc(structure: pymatgen.core.structure.Structure, supercell_matrix: numpy.ndarray, force_constants: numpy.ndarray, line_density: float = 20.0, symprec: float = 0.01, **kwargs)pymatgen.phonon.bandstructure.PhononBandStructureSymmLine[source]

Get a phonon band structure along a high symmetry path from phonopy force constants.

Parameters
  • structure – A structure.

  • supercell_matrix – The supercell matrix used to generate the force constants.

  • force_constants – The force constants in phonopy format.

  • line_density – The density along the high symmetry path.

  • symprec – Symmetry precision passed to phonopy and used for determining the band structure path.

  • **kwargs – Additional kwargs passed to the Phonopy constructor.

Returns

The line mode band structure.

get_phonon_dos_from_fc(structure: pymatgen.core.structure.Structure, supercell_matrix: numpy.ndarray, force_constants: numpy.ndarray, mesh_density: float = 100.0, num_dos_steps: int = 200, **kwargs)pymatgen.phonon.dos.CompletePhononDos[source]

Get a projected phonon density of states from phonopy force constants.

Parameters
  • structure – A structure.

  • supercell_matrix – The supercell matrix used to generate the force constants.

  • force_constants – The force constants in phonopy format.

  • mesh_density – The density of the q-point mesh. See the docstring for the mesh argument in Phonopy.init_mesh() for more details.

  • num_dos_steps – Number of frequency steps in the energy grid.

  • **kwargs – Additional kwargs passed to the Phonopy constructor.

Returns

The density of states.

get_phonopy_structure(pmg_structure)[source]

Convert a pymatgen Structure object to a PhonopyAtoms object.

Parameters

pmg_structure (pymatgen Structure) – A Pymatgen structure object.

get_pmg_structure(phonopy_structure)[source]

Convert a PhonopyAtoms object to pymatgen Structure object.

Parameters

phonopy_structure (PhonopyAtoms) – A phonopy structure object.

get_structure_from_dict(d)[source]

Extracts a structure from the dictionary extracted from the output files of phonopy like phonopy.yaml or band.yaml. Adds “phonopy_masses” in the site_properties of the structures. Compatible with older phonopy versions.