Esempio n. 1
0
 def test_operate_on(self):
     matrix = np.array([[0, 1, 0], [0, 0, 1], [1, 0, 0]])
     so = SymmetryOperation(matrix)
     configuration = Configuration([1, 2, 3])
     so.operate_on(configuration)
     np.testing.assert_array_equal(
         so.operate_on(configuration).vector, np.array([2, 3, 1]))
Esempio n. 2
0
 def test_operate_on_raises_TypeError_with_invalid_type( self ):
     matrix = np.array( [ [ 0, 1, 0 ], [ 0, 0, 1 ], [ 1, 0, 0 ] ] )
     so = SymmetryOperation( matrix )
     with self.assertRaises( TypeError ):
         so.operate_on( 'foo' )
Esempio n. 3
0
 def test_operate_on( self ):
     matrix = np.array( [ [ 0, 1, 0 ], [ 0, 0, 1 ], [ 1, 0, 0 ] ] )
     so = SymmetryOperation( matrix )
     configuration = Configuration( [ 1, 2, 3 ] )
     so.operate_on( configuration )
     np.testing.assert_array_equal( so.operate_on( configuration ).vector, np.array( [ 2, 3, 1 ] ) )  
Esempio n. 4
0
 def test_operate_on_raises_TypeError_with_invalid_type(self):
     matrix = np.array([[0, 1, 0], [0, 0, 1], [1, 0, 0]])
     so = SymmetryOperation(matrix)
     with self.assertRaises(TypeError):
         so.operate_on('foo')