def _set_grid_properties(self, grid_points): self._grid_address = self._pp.get_grid_address() self._pp.set_nac_q_direction(nac_q_direction=None) if grid_points is not None: # Specify grid points self._grid_points = reduce_grid_points( self._mesh_divisors, self._grid_address, grid_points, coarse_mesh_shifts=self._coarse_mesh_shifts) (self._ir_grid_points, self._ir_grid_weights) = self._get_ir_grid_points() elif not self._is_kappa_star: # All grid points coarse_grid_address = get_grid_address(self._coarse_mesh) coarse_grid_points = np.arange(np.prod(self._coarse_mesh), dtype='intc') self._grid_points = from_coarse_to_dense_grid_points( self._mesh, self._mesh_divisors, coarse_grid_points, coarse_grid_address, coarse_mesh_shifts=self._coarse_mesh_shifts) self._grid_weights = np.ones(len(self._grid_points), dtype='intc') self._ir_grid_points = self._grid_points self._ir_grid_weights = self._grid_weights else: # Automatic sampling self._grid_points, self._grid_weights = self._get_ir_grid_points() self._ir_grid_points = self._grid_points self._ir_grid_weights = self._grid_weights self._qpoints = np.array(self._grid_address[self._grid_points] / self._mesh.astype('double'), dtype='double', order='C') self._grid_point_count = 0 # set_phonons is unnecessary now because all phonons are calculated in # self._pp.set_dynamical_matrix, though Gamma-point is an exception, # which is treatd at self._pp.set_grid_point. # self._pp.set_phonons(self._grid_points) self._frequencies, self._eigenvectors, _ = self._pp.get_phonons()
def _set_grid_properties(self, grid_points): self._grid_address = self._pp.get_grid_address() self._pp.set_nac_q_direction(nac_q_direction=None) if grid_points is not None: # Specify grid points self._grid_points = reduce_grid_points( self._mesh_divisors, self._grid_address, grid_points, coarse_mesh_shifts=self._coarse_mesh_shifts) (self._ir_grid_points, self._ir_grid_weights) = self._get_ir_grid_points() elif not self._is_kappa_star: # All grid points coarse_grid_address = get_grid_address(self._coarse_mesh) coarse_grid_points = np.arange(np.prod(self._coarse_mesh), dtype='uintp') self._grid_points = from_coarse_to_dense_grid_points( self._mesh, self._mesh_divisors, coarse_grid_points, coarse_grid_address, coarse_mesh_shifts=self._coarse_mesh_shifts) self._grid_weights = np.ones(len(self._grid_points), dtype='intc') self._ir_grid_points = self._grid_points self._ir_grid_weights = self._grid_weights else: # Automatic sampling self._grid_points, self._grid_weights = self._get_ir_grid_points() self._ir_grid_points = self._grid_points self._ir_grid_weights = self._grid_weights self._qpoints = np.array(self._grid_address[self._grid_points] / self._mesh.astype('double'), dtype='double', order='C') self._grid_point_count = 0 self._frequencies, self._eigenvectors, _ = self._pp.get_phonons()