示例#1
0
    def produce_fc3(self,
                    forces_fc3,
                    displacement_dataset=None,
                    cutoff_distance=None, # set fc3 zero
                    is_translational_symmetry=False,
                    is_permutation_symmetry=False,
                    is_permutation_symmetry_fc2=False,
                    translational_symmetry_type=None,
                    use_alm=False):
        if displacement_dataset is None:
            disp_dataset = self._displacement_dataset
        else:
            disp_dataset = displacement_dataset

        if use_alm:
            from phono3py.other.alm_wrapper  import get_fc3 as get_fc3_alm
            fc2, fc3 = get_fc3_alm(self._supercell,
                                   forces_fc3,
                                   disp_dataset,
                                   self._symmetry)
        else:
            fc2, fc3 = self._get_fc3(forces_fc3,
                                     disp_dataset,
                                     cutoff_distance,
                                     is_translational_symmetry,
                                     is_permutation_symmetry,
                                     is_permutation_symmetry_fc2,
                                     translational_symmetry_type)

        # Set fc2 and fc3
        self._fc3 = fc3
        if self._fc2 is None:
            self._fc2 = fc2
示例#2
0
    def produce_fc3(
            self,
            forces_fc3,
            displacement_dataset=None,
            cutoff_distance=None,  # set fc3 zero
            symmetrize_fc3r=False,
            is_compact_fc=False,
            use_alm=False,
            alm_options=None):
        if displacement_dataset is None:
            disp_dataset = self._displacement_dataset
        else:
            disp_dataset = displacement_dataset

        if use_alm:
            from phono3py.other.alm_wrapper import get_fc3 as get_fc3_alm
            fc2, fc3 = get_fc3_alm(self._supercell,
                                   self._primitive,
                                   forces_fc3,
                                   disp_dataset,
                                   self._symmetry,
                                   alm_options=alm_options,
                                   is_compact_fc=is_compact_fc,
                                   log_level=self._log_level)
        else:
            fc2, fc3 = self._get_fc3(forces_fc3,
                                     disp_dataset,
                                     is_compact_fc=is_compact_fc)
            if symmetrize_fc3r:
                if is_compact_fc:
                    set_translational_invariance_compact_fc3(
                        fc3, self._primitive)
                    set_permutation_symmetry_compact_fc3(fc3, self._primitive)
                    if self._fc2 is None:
                        symmetrize_compact_force_constants(
                            fc2, self._primitive)
                else:
                    set_translational_invariance_fc3(fc3)
                    set_permutation_symmetry_fc3(fc3)
                    if self._fc2 is None:
                        symmetrize_force_constants(fc2)

        # Set fc2 and fc3
        self._fc3 = fc3

        # Normally self._fc2 is overwritten in produce_fc2
        if self._fc2 is None:
            self._fc2 = fc2