@classmethod<EOL><INDENT>def from_parameters3(cls, lengths, angles):<DEDENT>
for length in lengths:<EOL><INDENT>if length <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>for angle in angles:<EOL><INDENT>if angle <= <NUM_LIT:0> or angle >= np.pi:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>del length<EOL>del angle<EOL>matrix = np.zeros((<NUM_LIT:3>, <NUM_LIT:3>), float)<EOL>matrix[<NUM_LIT:0>, <NUM_LIT:0>] = lengths[<NUM_LIT:0>]<EOL>matrix[<NUM_LIT:0>, <NUM_LIT:1>] = np.cos(angles[<NUM_LIT:2>])*lengths[<NUM_LIT:1>]<EOL>matrix[<NUM_LIT:1>, <NUM_LIT:1>] = np.sin(angles[<NUM_LIT:2>])*lengths[<NUM_LIT:1>]<EOL>u_a = lengths[<NUM_LIT:0>]*lengths[<NUM_LIT:2>]*np.cos(angles[<NUM_LIT:1>])<EOL>u_b = lengths[<NUM_LIT:1>]*lengths[<NUM_LIT:2>]*np.cos(angles[<NUM_LIT:0>])<EOL>matrix[<NUM_LIT:0>, <NUM_LIT:2>] = u_a/matrix[<NUM_LIT:0>, <NUM_LIT:0>]<EOL>matrix[<NUM_LIT:1>, <NUM_LIT:2>] = (u_b - matrix[<NUM_LIT:0>, <NUM_LIT:1>]*matrix[<NUM_LIT:0>, <NUM_LIT:2>])/matrix[<NUM_LIT:1>, <NUM_LIT:1>]<EOL>u_c = lengths[<NUM_LIT:2>]**<NUM_LIT:2> - matrix[<NUM_LIT:0>, <NUM_LIT:2>]**<NUM_LIT:2> - matrix[<NUM_LIT:1>, <NUM_LIT:2>]**<NUM_LIT:2><EOL>if u_c < <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>matrix[<NUM_LIT:2>, <NUM_LIT:2>] = np.sqrt(u_c)<EOL>active = np.ones(<NUM_LIT:3>, bool)<EOL>return cls(matrix, active)<EOL>
Construct a 3D unit cell with the given parameters

           The a vector is always parallel with the x-axis and they point in the
           same direction. The b vector is always in the xy plane and points
           towards the positive y-direction. The c vector points towards the
           positive z-direction.