예제 #1
0
    def __init__(self,
                 force_constants=None,
                 atoms=None,
                 atoms_ideal=None,
                 supercell_matrix=None,
                 is_symmetrized=True):
        """

        Args:
            atoms: The "Atoms" object corresponding to the force constants.
        """
        self.set_force_constants(force_constants)

        if supercell_matrix is None:
            supercell_matrix = np.eye(3)

        print("supercell_matrix:")
        print(supercell_matrix)

        if atoms is not None:
            self.set_atoms(Supercell(atoms, supercell_matrix))
        if atoms_ideal is not None:
            self.set_atoms_ideal(Supercell(atoms_ideal, supercell_matrix))

        if is_symmetrized:
            self.symmetrize_force_constants()

        self._fc_distribution_analyzer = None

        self.check_consistency()
예제 #2
0
    def _generate_enlarged_cell(self):
        """

        If The tag "replacements" is not given, we just copy the original
        structure as the enlarged cell.
        """
        if self._map_s2s is not None:
            self._enlarged_cell_average = Supercell(
                self._primitive_average,
                self._enlargement_matrix,
                symprec=self._symprec)
            self._enlarged_cell = self._disorder_enlarged_cell()
        else:
            enlargement_matrix = np.eye(3, dtype=int)
            self._enlarged_cell_average = self._atoms_average
            self._enlarged_cell = Supercell(
                self._atoms_disordered,
                enlargement_matrix,
                symprec=self._symprec)
        return self
예제 #3
0
    def __init__(self,
                 force_constants=None,
                 atoms=None,
                 atoms_ideal=None,
                 supercell_matrix=None,
                 is_symmetrized=True):
        """

        Parameters
        ----------
        force_constants: (natoms, natoms, 3, 3) array
        atoms: The "Atoms" object
            This is used to extract chemical symbols.
        atoms_ideal: The "Atoms" object
            This is used to judge the expected crystallographic symmetry.
        supercell_matrix: (3, 3) array
        """
        if supercell_matrix is None:
            supercell_matrix = np.eye(3)

        print("supercell_matrix:")
        print(supercell_matrix)

        self.set_force_constants(force_constants)

        if atoms is not None:
            self.set_atoms(Supercell(atoms, supercell_matrix))
        if atoms_ideal is not None:
            self.set_atoms_ideal(Supercell(atoms_ideal, supercell_matrix))

        if is_symmetrized:
            self.symmetrize_force_constants()

        self._fc_distribution_analyzer = None

        self.check_consistency()
예제 #4
0
    def _configure(self, dict_input):
        """

        supercell_disordered: The structure corresponding to the force
            constants.
        """
        self._atoms_disordered = read_vasp(dict_input["structure_disordered"])
        self._atoms_average = read_vasp(dict_input["structure_average"])
        self._symprec = dict_input["symprec"]
        self._map_s2s = dict_input["map_s2s"]

        self._random_seed = dict_input["random_seed"]
        self._num_configurations = dict_input['num_configurations']

        primitive_matrix = parse_3x3_matrix(dict_input["primitive_matrix"])
        self._supercell_matrix = dict_input["supercell_matrix"]
        self._enlargement_matrix = dict_input["enlargement_matrix"]

        self._fc_filename = dict_input["force_constants"]
        self._force_constants = parse_FORCE_CONSTANTS(self._fc_filename)

        self._supercell_disordered = Supercell(
            self._atoms_disordered,
            self._supercell_matrix,
            symprec=self._symprec)

        self._supercell_average = Supercell(
            self._atoms_average,
            self._supercell_matrix,
            symprec=self._symprec)

        # TODO(ikeda): The following part should be separated from this method.
        inv_supercell_matrix = np.linalg.inv(self._supercell_matrix)
        trans_mat = np.dot(inv_supercell_matrix, primitive_matrix)
        self._primitive_average = Primitive(
            self._supercell_average, trans_mat, symprec=self._symprec)
예제 #5
0
def get_lattice_points_from_supercell(lattice: np.array,
                                      dim: np.array) -> np.array:
    """
    Get lattice points from supercell.

    Args:
        lattice: Lattice matrix.
        dim: Dimension with its shape is (3,) or (3,3).

    Returns:
        np.array: Lattice points.
    """
    unitcell = PhonopyAtoms(
        symbols=['H'],
        cell=lattice,
        scaled_positions=np.array([[0., 0., 0]]),
    )
    super_lattice = Supercell(unitcell=unitcell,
                              supercell_matrix=reshape_dimension(dim))
    lattice_points = super_lattice.scaled_positions

    return lattice_points
예제 #6
0
파일: base.py 프로젝트: kei0822kei/twinpy
def get_supercell(cell, supercell_matrix):
    ph_cell = get_phonopy_structure(cell)
    sup_mat = shape_supercell_matrix(supercell_matrix)
    sup = Supercell(ph_cell, supercell_matrix=sup_mat)
    sup_cell = get_cell_from_phonopy_structure(sup)
    return sup_cell