示例#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]))
示例#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' )
示例#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 ] ) )  
示例#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')