Exemple #1
0
    def set_thermal_displacement_matrices(self,
                                           t_step=10,
                                           t_max=1000,
                                           t_min=0,
                                           cutoff_frequency=None):
        """
        cutoff_frequency:
          phonon modes that have frequencies below cutoff_frequency
          are ignored.

        direction:
          Projection direction in reduced coordinates
        """
        self._thermal_displacement_matrices = None

        if self._mesh is None:
            print("\'set_mesh\' has to finish correctly "
                  "before \'set_thermal_displacement_matrices\'.")
            return False

        eigvecs = self._mesh.get_eigenvectors()
        frequencies = self._mesh.get_frequencies()
        mesh_nums = self._mesh.get_mesh_numbers() 

        if self._mesh.get_eigenvectors() is None:
            print("Warning: Eigenvectors have to be calculated.")
            return False
            
        if np.prod(mesh_nums) != len(eigvecs):
            print("Warning: Sampling mesh must not be symmetrized.")
            return False

        tdm = ThermalDisplacementMatrices(frequencies,
                                           eigvecs,
                                           self._primitive.get_masses(),
                                           cutoff_frequency=cutoff_frequency)
        tdm.set_temperature_range(t_min, t_max, t_step)
        tdm.run()
        
        self._thermal_displacement_matrices = tdm
        return True
Exemple #2
0
    def set_thermal_displacement_matrices(self,
                                          t_step=10,
                                          t_max=1000,
                                          t_min=0,
                                          freq_min=None,
                                          freq_max=None,
                                          t_cif=None):
        """Prepare thermal displacement matrices

        Args:
            direction:
                Projection direction in reduced coordinates.
            freq_min: Phonons having frequency larger than this are included.
            freq_max: Phonons having frequency smaller than this are included.

        """
        self._thermal_displacement_matrices = None

        if self._mesh is not None:
            eigvecs = self._mesh.get_eigenvectors()
            if eigvecs is None:
                print("Warning: Eigenvectors have to be calculated.")
                return False
            if np.prod(self._mesh.get_mesh_numbers()) != len(eigvecs):
                print("Warning: Sampling mesh must not be symmetrized.")
                return False

            iter_phonons = self._mesh
        else:
            if self._iter_mesh is not None:
                iter_phonons = self._iter_mesh
            else:
                print("Warning: \'set_mesh\' has to finish correctly "
                      "before \'set_thermal_displacement_matrices\'.")
                return False

        tdm = ThermalDisplacementMatrices(iter_phonons,
                                          self._primitive.get_masses(),
                                          freq_min=freq_min,
                                          freq_max=freq_max,
                                          lattice=self._primitive.get_cell().T)

        if t_cif is None:
            tdm.set_temperature_range(t_min, t_max, t_step)
        else:
            tdm.set_temperatures([t_cif])
        tdm.run()

        self._thermal_displacement_matrices = tdm
        return True
Exemple #3
0
    def set_thermal_displacement_matrices(self,
                                           t_step=10,
                                           t_max=1000,
                                           t_min=0,
                                           cutoff_eigenvalue=None):
        """
        cutoff_eigenvalue:
          phonon modes that have frequencies below cutoff_eigenvalue
          are ignored.
          e.g. 0.1 (THz^2)

        direction:
          Projection direction in reduced coordinates
        """
        if self._mesh==None:
            print "set_mesh has to be done before set_thermal_properties"
            sys.exit(1)

        eigvecs = self._mesh.get_eigenvectors()
        frequencies = self._mesh.get_frequencies()
        mesh_nums = self._mesh.get_mesh_numbers() 

        if self._mesh.get_eigenvectors() is None:
            print "Eigenvectors have to be calculated."
            sys.exit(1)
            
        if np.prod(mesh_nums) != len(eigvecs):
            print "Sampling mesh must not be symmetrized."
            sys.exit(1)

        tdm = ThermalDisplacementMatrices(frequencies,
                                           eigvecs,
                                           self._primitive.get_masses(),
                                           cutoff_eigenvalue=cutoff_eigenvalue)
        tdm.set_temperature_range(t_min, t_max, t_step)
        # tdm.run()
        tdm.run_mesh()

        self._thermal_displacement_matrices = tdm
Exemple #4
0
    def set_thermal_displacement_matrices(self,
                                          t_step=10,
                                          t_max=1000,
                                          t_min=0,
                                          cutoff_frequency=None,
                                          t_cif=None):
        """
        cutoff_frequency:
          phonon modes that have frequencies below cutoff_frequency
          are ignored.

        direction:
          Projection direction in reduced coordinates
        """
        self._thermal_displacement_matrices = None

        if self._mesh is not None:
            eigvecs = self._mesh.get_eigenvectors() 
            if eigvecs is None:
                print("Warning: Eigenvectors have to be calculated.")
                return False
            if np.prod(self._mesh.get_mesh_numbers()) != len(eigvecs):
                print("Warning: Sampling mesh must not be symmetrized.")
                return False

            iter_phonons = self._mesh
        else:
            if self._iter_mesh is not None:
                iter_phonons = self._iter_mesh
            else:
                print("Warning: \'set_mesh\' has to finish correctly "
                      "before \'set_thermal_displacement_matrices\'.")
                return False

        tdm = ThermalDisplacementMatrices(
            iter_phonons,
            self._primitive.get_masses(),
            cutoff_frequency=cutoff_frequency,
            lattice=self._primitive.get_cell().T)

        if t_cif is None:
            tdm.set_temperature_range(t_min, t_max, t_step)
        else:
            tdm.set_temperatures([t_cif])
        tdm.run()

        self._thermal_displacement_matrices = tdm
        return True
Exemple #5
0
    def set_thermal_displacement_matrices(self,
                                          t_step=10,
                                          t_max=1000,
                                          t_min=0,
                                          cutoff_eigenvalue=None):
        """
        cutoff_eigenvalue:
          phonon modes that have frequencies below cutoff_eigenvalue
          are ignored.
          e.g. 0.1 (THz^2)

        direction:
          Projection direction in reduced coordinates
        """
        if self._mesh == None:
            print "set_mesh has to be done before set_thermal_properties"
            sys.exit(1)

        eigvecs = self._mesh.get_eigenvectors()
        frequencies = self._mesh.get_frequencies()
        mesh_nums = self._mesh.get_mesh_numbers()

        if self._mesh.get_eigenvectors() is None:
            print "Eigenvectors have to be calculated."
            sys.exit(1)

        if np.prod(mesh_nums) != len(eigvecs):
            print "Sampling mesh must not be symmetrized."
            sys.exit(1)

        tdm = ThermalDisplacementMatrices(frequencies,
                                          eigvecs,
                                          self._primitive.get_masses(),
                                          cutoff_eigenvalue=cutoff_eigenvalue)
        tdm.set_temperature_range(t_min, t_max, t_step)
        # tdm.run()
        tdm.run_mesh()

        self._thermal_displacement_matrices = tdm