def __init__( self, qpoints, frequencies, gruneisenparameters, lattice, eigendisplacements=None, labels_dict=None, coords_are_cartesian=False, structure=None, ): """ Args: qpoints: list of qpoint as numpy arrays, in frac_coords of the given lattice by default frequencies: list of phonon frequencies in THz as a numpy array with shape (3*len(structure), len(qpoints)). The First index of the array refers to the band and the second to the index of the qpoint. gruneisenparameters: list of Grueneisen parameters with the same structure frequencies. lattice: The reciprocal lattice as a pymatgen Lattice object. Pymatgen uses the physics convention of reciprocal lattice vectors WITH a 2*pi coefficient. eigendisplacements: the phonon eigendisplacements associated to the frequencies in cartesian coordinates. A numpy array of complex numbers with shape (3*len(structure), len(qpoints), len(structure), 3). he First index of the array refers to the band, the second to the index of the qpoint, the third to the atom in the structure and the fourth to the cartesian coordinates. labels_dict: (dict) of {} this links a qpoint (in frac coords or cartesian coordinates depending on the coords) to a label. coords_are_cartesian: Whether the qpoint coordinates are cartesian. structure: The crystal structure (as a pymatgen Structure object) associated with the band structure. This is needed if we provide projections to the band structure """ PhononBandStructure.__init__( self, qpoints, frequencies, lattice, nac_frequencies=None, eigendisplacements=eigendisplacements, nac_eigendisplacements=None, labels_dict=labels_dict, coords_are_cartesian=coords_are_cartesian, structure=structure, ) self.gruneisen = gruneisenparameters
def get_phonon_band_structure_from_fc( structure: Structure, supercell_matrix: np.ndarray, force_constants: np.ndarray, mesh_density: float = 100.0, **kwargs, ) -> PhononBandStructure: """ Get a uniform phonon band structure from phonopy force constants. Args: 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. """ structure_phonopy = get_phonopy_structure(structure) phonon = Phonopy(structure_phonopy, supercell_matrix=supercell_matrix, **kwargs) phonon.set_force_constants(force_constants) phonon.run_mesh(mesh_density, is_mesh_symmetry=False, is_gamma_center=True) mesh = phonon.get_mesh_dict() return PhononBandStructure(mesh["qpoints"], mesh["frequencies"], structure.lattice)