def orthogonalization_matrix(lengths, angles):
 (a, b, c) = lengths
 angles = numpy.radians(angles)
 (sina, sinb, _) = numpy.sin(angles)
 (cosa, cosb, cosg) = numpy.cos(angles)
 co = (((cosa * cosb) - cosg) / (sina * sinb))
 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]])

def orthogonalization_matrix ( lengths , angles ) : ( a , b , c ) = lengths angles = numpy . radians ( angles ) ( sina , sinb , _ ) = numpy . sin ( angles ) ( cosa , cosb , cosg ) = numpy . cos ( angles ) co = ( ( ( cosa * cosb ) - cosg ) / ( sina * sinb ) ) 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 ] ] )
return orthogonalization matrix for crystallographic cell coordinates .