示例#1
0
 def test_get_orbital_resolved_dos(self):
     for es in self.es_list:
         dos = Dos(es_obj=es, n_bins=100)
         if es.grand_dos_matrix is not None:
             self.assertIsInstance(es.grand_dos_matrix, np.ndarray)
             _, _, _, _, n_orbitals = np.shape(dos.es_obj.grand_dos_matrix)
             total_rdos = np.zeros_like(dos.t_dos)
             for i in range(n_orbitals):
                 r_dos = dos.get_orbital_resolved_dos([i])
                 total_rdos += r_dos
             self.assertTrue(np.allclose(dos.t_dos, total_rdos))
示例#2
0
 def test_get_spatial_orbital_resolved_dos(self):
     for es in self.es_list:
         dos = Dos(es_obj=es, n_bins=100)
         if es.grand_dos_matrix is not None:
             self.assertIsInstance(es.grand_dos_matrix, np.ndarray)
             _, _, _, n_atoms, n_orbitals = np.shape(
                 dos.es_obj.grand_dos_matrix)
             atom_indices = np.arange(n_atoms)
             orbital_indices = np.arange(n_orbitals)
             r_dos = dos.get_spatial_orbital_resolved_dos(
                 atom_indices=atom_indices, orbital_indices=orbital_indices)
             self.assertTrue(np.allclose(dos.t_dos, r_dos))
示例#3
0
 def test_init_from_es(self):
     for es in self.es_list:
         if es.grand_dos_matrix is not None:
             self.assertIsInstance(es.grand_dos_matrix, np.ndarray)
         dos = Dos(es_obj=es, n_bins=100)
         self.assertIsInstance(dos.energies, np.ndarray)
         self.assertIsInstance(dos.t_dos, np.ndarray)
         self.assertIsInstance(dos.orbital_dict, dict)
         self.assertIsInstance(dos.n_bins, int)
         self.assertEqual(len(dos.energies), len(dos.t_dos))
         if es.grand_dos_matrix is None:
             self.assertRaises(NoResolvedDosError,
                               dos.get_spatially_resolved_dos,
                               atom_indices=[0])
             self.assertRaises(
                 NoResolvedDosError,
                 dos.get_orbital_resolved_dos,
                 orbital_indices=[0],
             )
             self.assertRaises(
                 NoResolvedDosError,
                 dos.get_spatial_orbital_resolved_dos,
                 atom_indices=[0],
                 orbital_indices=[0],
             )
         else:
             self.assertIsInstance(dos.es_obj.grand_dos_matrix, np.ndarray)
示例#4
0
    def get_dos(self, n_bins=100):
        """
        Gives a pyiron.objects.waves.dos.Dos instance

        Args:
            n_bins (int): Number of histogram bins for the dos

        Returns:
            pyiron.objects.waves.dos.Dos: Dos instance

        """
        dos_obj = Dos(n_bins=n_bins, es_obj=self)
        return dos_obj