# pymatgen.io.phonopy module¶

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. 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

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


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_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.