#NEWLINE# def orthogonalization_matrix( lengths , angles ) : #NEWLINE# #INDENT# 'Return orthogonalization matrix for crystallographic cell coordinates.\n\n    Angles are expected in degrees.\n\n    The de-orthogonalization matrix is the inverse.\n\n    >>> O = orthogonalization_matrix([10, 10, 10], [90, 90, 90])\n    >>> numpy.allclose(O[:3, :3], numpy.identity(3, float) * 10)\n    True\n    >>> O = orthogonalization_matrix([9.8, 12.0, 15.5], [87.2, 80.7, 69.7])\n    >>> numpy.allclose(numpy.sum(O), 43.063229)\n    True\n\n    ' #NEWLINE# ( a , b , c ) = lengths #NEWLINE# angles = numpy . radians ( angles ) #NEWLINE# ( sina , sinb , _ ) = numpy . sin ( angles ) #NEWLINE# ( cosa , cosb , cosg ) = numpy . cos ( angles ) #NEWLINE# co = ( ( ( cosa * angles ) - cosg ) / ( sina * sinb ) ) #NEWLINE# return numpy . array ( [ [ ( ( a * sinb ) * math . sqrt ( ( 1.0 - ( co * co ) ) ) ) , 0.0 , 0.0 , 0.0 ] , [ ( ( ( - a ) * sinb ) * co ) , ( b * sina ) , 0.0 , 0.0 ] , [ ( a * cosb ) , ( b * cosa ) , c , 0.0 ] , [ 0.0 , 0.0 , 0.0 , 1.0 ] ] )