Exemplo n.º 1
0
    def run_correlation_matrix(self, T):
        """Calculate displacement-displacement correlation matrix."""
        qpoints, eigvals, eigvecs = self._collect_eigensolutions()
        d2f = DynmatToForceConstants(self._dynmat.primitive,
                                     self._dynmat.supercell)
        masses = self._dynmat.supercell.masses
        d2f.commensurate_points = qpoints
        freqs = np.sqrt(np.abs(eigvals)) * self._factor
        conditions = freqs > self._cutoff_frequency
        a = self._get_sigma(eigvals, T)
        a2 = a**2
        _a = np.where(conditions, a, 1)
        a2_inv = np.where(conditions, 1 / _a**2, 0)

        d2f.create_dynamical_matrices(a2_inv, eigvecs)
        d2f.run()
        self._uu_inv = np.array(d2f.force_constants, dtype="double", order="C")

        d2f.create_dynamical_matrices(a2, eigvecs)
        d2f.run()
        matrix = d2f.force_constants
        for i, m_i in enumerate(masses):
            for j, m_j in enumerate(masses):
                matrix[i, j] /= m_i * m_j
        self._uu = np.array(matrix, dtype="double", order="C")
Exemplo n.º 2
0
 def run_d2f(self):
     qpoints, eigvals, eigvecs = self._collect_eigensolutions()
     d2f = DynmatToForceConstants(self._dynmat.primitive,
                                  self._dynmat.supercell)
     d2f.commensurate_points = qpoints
     d2f.create_dynamical_matrices(eigvals, eigvecs)
     d2f.run()
     self._force_constants = d2f.force_constants