Exemple #1
0
 def test_reset(self):
     atom = Atom(index=12)
     atom.in_site = 3
     atom._frac_coords = np.array( [0,0, 0.0, 0.0] )
     atom.trajectory = [1,2,3]
     atom.reset()
     self.assertEqual( atom.in_site, None )
     self.assertEqual( atom._frac_coords, None )
     self.assertEqual( atom.trajectory, [] )
Exemple #2
0
 def test_as_dict(self):
     index = 11
     in_site = 4
     c = np.array([0.1, 0.2, 0.3])
     atom = Atom(index=index)
     atom.in_site = in_site
     atom._frac_coords = c
     d = atom.as_dict()
     self.assertEqual(d['index'], index)
     self.assertEqual(d['in_site'], in_site)
     np.testing.assert_array_equal(d['frac_coords'], c)
Exemple #3
0
 def test_frac_coords_getter(self):
     atom = Atom(index=12)
     c = np.array([0.3, 0.4, 0.5])
     atom._frac_coords = c
     np.testing.assert_array_equal(atom.frac_coords, c)
Exemple #4
0
 def test_frac_coords_getter_raises_atttribute_error_if_frac_coords_is_none(self):
     atom = Atom(index=1)
     atom._frac_coords = None
     with self.assertRaises(AttributeError):
         atom.frac_coords