Esempio n. 1
0
 def test_summed_dr2(self):
     mock = Mock(spec=Atom)
     mock.summed_dr2 = 5.0
     n_atoms = 3
     atoms = [mock] * n_atoms
     species = Species(atoms)
     self.assertEqual(species.summed_dr2(), mock.summed_dr2 * n_atoms)
Esempio n. 2
0
 def test_collective_dr_squared(self):
     mock = Mock(spec=Atom)
     mock.dr = np.array([2.0, 1.0, 1.0])
     atoms = [mock] * 3
     species = Species(atoms)
     self.assertEqual(species.collective_dr_squared(),
                      54.0)  # (2+2+2)**2 + (1+1+1)**2 + (1+1+1)**2
Esempio n. 3
0
 def test_species_is_initialised(self):
     mock = Mock(spec=Atom)
     atoms = [mock] * 3
     species = Species(atoms)
     self.assertEqual(species.atoms, atoms)
Esempio n. 4
0
 def test_collective_correlation(self):
     species = Species(atoms=[1, 2, 3])
     species.collective_dr_squared = Mock(return_value=10.0)
     species.summed_dr2 = Mock(return_value=5.0)
     self.assertEqual(species.collective_correlation(), 2.0)
Esempio n. 5
0
 def test_occupation(self):
     mock = Mock(spec=Atom)
     mock.site.label = 'L'
     atoms = [mock] * 3
     species = Species(atoms)
     self.assertEqual(species.occupations('L'), 3)
Esempio n. 6
0
 def test_sum_dr_squared(self):
     mock = Mock(spec=Atom)
     mock.dr_squared.return_value = 2.0
     atoms = [mock] * 3
     species = Species(atoms)
     self.assertEqual(species.sum_dr_squared(), 6.0)
Esempio n. 7
0
 def test_sites_occupied(self):
     mock = Mock(spec=Atom)
     mock.site.number = 3
     atoms = [mock] * 3
     species = Species(atoms)
     self.assertEqual(species.sites_occupied(), [3, 3, 3])