def prepare(self): self._comm_points = get_commensurate_points(self._supercell_matrix) self._set_translations() self._set_shifted_index_set() self._solve_phonon() self._weights = np.zeros( (len(self._eigvecs), self._eigvecs[0].shape[0], self._N), dtype='double')
def test_get_commensurate_points(self): smat = np.diag([2, 2, 2]) pmat = np.dot(np.linalg.inv(smat), [[0, 0.5, 0.5], [0.5, 0, 0.5], [0.5, 0.5, 0]]) supercell = get_supercell(self._cell, smat) primitive = get_primitive(supercell, pmat) comm_points = get_commensurate_points(primitive, supercell) for i, p in enumerate(comm_points): print("%d %s" % (i + 1, p))
def test_get_commensurate_points(self): smat = np.diag([2, 2, 2]) pmat = np.dot(np.linalg.inv(smat), [[0, 0.5, 0.5], [0.5, 0, 0.5], [0.5, 0.5, 0]]) supercell = get_supercell(self._cell, smat) primitive = get_primitive(supercell, pmat) supercell_matrix = np.linalg.inv(primitive.get_primitive_matrix()) supercell_matrix = np.rint(supercell_matrix).astype('intc') comm_points = get_commensurate_points(supercell_matrix) # self._write(comm_points) self._compare(comm_points)
def __init__(self, phonon, supercell_matrix, ideal_positions, atom_mapping, qpoints): """ Parameters ---------- phonon : Phonopy Phonopy object made with supercell as the primitive cell. supercell_matrix : array_like Matrix that represents the primitive translation enforced within the supercell. This works like an inverse primitive matrix. shape=(3, 3), dtype='intc' ideal_positions : array_like shape=(3, 3), dtype='intc' atom_mapping : list Atomic index mapping from ideal_positions to supercell atoms in phonon. None is used for Vacancies. qpoints : array_like q-points in reciprocal primitive cell coordinates shape=(num_qpoints, 3), dtype='double' """ self._phonon = phonon self._supercell_matrix = np.array(supercell_matrix, dtype='intc') self._ideal_positions = np.array(ideal_positions, dtype='double') self._qpoints_p = qpoints # in PBZ self._qpoints_s = self._get_qpoints_in_SBZ() # in SBZ self._symprec = self._phonon.symmetry.get_symmetry_tolerance() self._frequencies = None self._eigvecs = None # This may have anormal array shape. self._unfolding_weights = None self._q_count = None # As counter for iterator # Commensurate q-vectors in PBZ self._comm_points = get_commensurate_points(self._supercell_matrix) self._trans_s = None # in SC (see docstring in _set_translations) self._trans_p = None # in PC (see docstring in _set_translations) self._N = None self._set_translations() self._atom_mapping = None self._index_map_inv = None self._set_index_map(atom_mapping)
def __init__(self, phonon, supercell_matrix, ideal_positions, atom_mapping, qpoints): """ Parameters ---------- phonon : Phonopy Phonopy object to be unfolded. supercell_matrix : array_like Matrix that represents the virtual primitive translation enforced inside the supercell. This works like an inverse primitive matrix. shape=(3, 3), dtype='intc' ideal_positions : array_like Positions of atomic sites in supercell. This corresponds to those in a set of virtual primitive cells in the supercell. shape=(3, 3), dtype='intc' atom_mapping : list Atomic index mapping from ``ideal_positions`` to supercell atoms in ``phonon``. The elements of this list are intergers for atoms and None for vacancies. qpoints : array_like q-points in reciprocal virtual-primitive-cell coordinates shape=(num_qpoints, 3), dtype='double' """ self._phonon = self._get_supercell_phonon(phonon) self._supercell_matrix = np.array(supercell_matrix, dtype='intc') self._ideal_positions = np.array(ideal_positions, dtype='double') self._qpoints_p = qpoints # in PBZ self._qpoints_s = self._get_qpoints_in_SBZ() # in SBZ self._symprec = self._phonon.symmetry.get_symmetry_tolerance() self._frequencies = None self._eigvecs = None # This may have anormal array shape. self._unfolding_weights = None self._q_count = None # As counter for iterator # Commensurate q-vectors in PBZ self._comm_points = get_commensurate_points(self._supercell_matrix) self._trans_s = None # in SC (see docstring in _set_translations) self._trans_p = None # in PC (see docstring in _set_translations) self._N = None self._set_translations() self._atom_mapping = None self._index_map_inv = None self._set_index_map(atom_mapping)
def set_commensurate_points(self): supercell_matrix = np.linalg.inv(self._primitive.get_primitive_matrix()) supercell_matrix = np.rint(supercell_matrix).astype('intc') self.set_qpoints(get_commensurate_points(supercell_matrix))
def set_commensurate_points(self): """Set commensurate points.""" supercell_matrix = np.rint( np.linalg.inv(self._primitive.primitive_matrix)).astype("intc") self.set_qpoints(get_commensurate_points(supercell_matrix))
def setUp(self): self._smat = np.dot([[-1, 1, 1], [1, -1, 1], [1, 1, -1]], np.diag([2, 2, 2])) self._comm_points = get_commensurate_points(self._smat)
def _get_comm_points(self, ph): smat = np.dot(np.linalg.inv(ph.primitive.primitive_matrix), ph.supercell_matrix) smat = np.rint(smat).astype(int) comm_points = get_commensurate_points(smat) return comm_points
def set_commensurate_points(self): supercell_matrix = np.linalg.inv(self._primitive.get_primitive_matrix()) supercell_matrix = np.rint(supercell_matrix).astype("intc") self.set_qpoints(get_commensurate_points(supercell_matrix))
def _get_commensurate_points(): smat = np.dot([[-1, 1, 1], [1, -1, 1], [1, 1, -1]], np.diag([2, 2, 2])) return get_commensurate_points(smat), smat