def window_analysis(window,<EOL>elements,<EOL>coordinates,<EOL>elements_vdw,<EOL>increment2=<NUM_LIT:0.1>,<EOL>z_bounds=[None, None],<EOL>lb_z=True,<EOL>z_second_mini=False,<EOL>**kwargs):
<EOL>coordinates = deepcopy(coordinates)<EOL>vector_ = window[window.argmax(axis=<NUM_LIT:0>)[<NUM_LIT:1>]][<NUM_LIT:5>:<NUM_LIT:8>]<EOL>vector_analysed = vector_analysis(<EOL>vector_, coordinates, elements_vdw, increment=increment2)<EOL>if vector_analysed is not None:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT>vector = vector_analysed[<NUM_LIT:5>:<NUM_LIT:8>]<EOL>vec_a = [<NUM_LIT:1>, <NUM_LIT:0>, <NUM_LIT:0>]<EOL>vec_b = [<NUM_LIT:0>, <NUM_LIT:1>, <NUM_LIT:0>]<EOL>vec_c = [<NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:1>]<EOL>angle_1 = angle_between_vectors(np.array([vector[<NUM_LIT:0>], vector[<NUM_LIT:1>], <NUM_LIT:0>]), vec_a)<EOL>angle_2 = angle_between_vectors(vector, vec_c)<EOL>if vector[<NUM_LIT:0>] >= <NUM_LIT:0> and vector[<NUM_LIT:1>] >= <NUM_LIT:0> and vector[<NUM_LIT:2>] >= <NUM_LIT:0>:<EOL><INDENT>angle_1 = -angle_1<EOL>angle_2 = -angle_2<EOL><DEDENT>if vector[<NUM_LIT:0>] < <NUM_LIT:0> and vector[<NUM_LIT:1>] >= <NUM_LIT:0> and vector[<NUM_LIT:2>] >= <NUM_LIT:0>:<EOL><INDENT>angle_1 = np.pi * <NUM_LIT:2> + angle_1<EOL>angle_2 = angle_2<EOL><DEDENT>if vector[<NUM_LIT:0>] >= <NUM_LIT:0> and vector[<NUM_LIT:1>] < <NUM_LIT:0> and vector[<NUM_LIT:2>] >= <NUM_LIT:0>:<EOL><INDENT>angle_1 = angle_1<EOL>angle_2 = -angle_2<EOL><DEDENT>if vector[<NUM_LIT:0>] < <NUM_LIT:0> and vector[<NUM_LIT:1>] < <NUM_LIT:0> and vector[<NUM_LIT:2>] >= <NUM_LIT:0>:<EOL><INDENT>angle_1 = np.pi * <NUM_LIT:2> - angle_1<EOL><DEDENT>if vector[<NUM_LIT:0>] >= <NUM_LIT:0> and vector[<NUM_LIT:1>] >= <NUM_LIT:0> and vector[<NUM_LIT:2>] < <NUM_LIT:0>:<EOL><INDENT>angle_1 = -angle_1<EOL>angle_2 = np.pi + angle_2<EOL><DEDENT>if vector[<NUM_LIT:0>] < <NUM_LIT:0> and vector[<NUM_LIT:1>] >= <NUM_LIT:0> and vector[<NUM_LIT:2>] < <NUM_LIT:0>:<EOL><INDENT>angle_2 = np.pi - angle_2<EOL><DEDENT>if vector[<NUM_LIT:0>] >= <NUM_LIT:0> and vector[<NUM_LIT:1>] < <NUM_LIT:0> and vector[<NUM_LIT:2>] < <NUM_LIT:0>:<EOL><INDENT>angle_2 = angle_2 + np.pi<EOL><DEDENT>if vector[<NUM_LIT:0>] < <NUM_LIT:0> and vector[<NUM_LIT:1>] < <NUM_LIT:0> and vector[<NUM_LIT:2>] < <NUM_LIT:0>:<EOL><INDENT>angle_1 = -angle_1<EOL>angle_2 = np.pi - angle_2<EOL><DEDENT>rotation_around_z = np.array([[np.cos(angle_1), -np.sin(angle_1), <NUM_LIT:0>],<EOL>[np.sin(angle_1), np.cos(angle_1), <NUM_LIT:0>],<EOL>[<NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:1>]])<EOL>coordinates = np.array([np.dot(rotation_around_z, i) for i in coordinates])<EOL>rotation_around_y = np.array([[np.cos(angle_2), <NUM_LIT:0>, np.sin(angle_2)],<EOL>[<NUM_LIT:0>, <NUM_LIT:1>, <NUM_LIT:0>],<EOL>[-np.sin(angle_2), <NUM_LIT:0>, np.cos(angle_2)]])<EOL>coordinates = np.array([np.dot(rotation_around_y, i) for i in coordinates])<EOL>new_z = vector_analysed[<NUM_LIT:0>]<EOL>coordinates = coordinates - np.array([[<NUM_LIT:0>, <NUM_LIT:0>, new_z]] *<EOL>coordinates.shape[<NUM_LIT:0>])<EOL>window_com = np.array([<NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0>], dtype=float)<EOL>if lb_z:<EOL><INDENT>z_bounds[<NUM_LIT:0>] = -new_z<EOL><DEDENT>window_diameter, _ = pore_diameter(elements, coordinates, com=window_com)<EOL>z_args = (window_com[<NUM_LIT:0>], window_com[<NUM_LIT:1>], elements, coordinates)<EOL>z_optimisation = minimize(<EOL>optimise_z, x0=window_com[<NUM_LIT:2>], args=z_args, bounds=[z_bounds])<EOL>window_com[<NUM_LIT:2>] = z_optimisation.x[<NUM_LIT:0>]<EOL>xy_args = (window_com[<NUM_LIT:2>], elements, coordinates)<EOL>xy_bounds = ((-window_diameter / <NUM_LIT:2>, window_diameter / <NUM_LIT:2>),<EOL>(-window_diameter / <NUM_LIT:2>, window_diameter / <NUM_LIT:2>))<EOL>xy_optimisation = brute(<EOL>optimise_xy, xy_bounds, args=xy_args, full_output=True, finish=fmin)<EOL>window_com[<NUM_LIT:0>] = xy_optimisation[<NUM_LIT:0>][<NUM_LIT:0>]<EOL>window_com[<NUM_LIT:1>] = xy_optimisation[<NUM_LIT:0>][<NUM_LIT:1>]<EOL>if z_second_mini is not False:<EOL><INDENT>z_args = (window_com[<NUM_LIT:0>], window_com[<NUM_LIT:1>], elements, coordinates)<EOL>z_optimisation = minimize(<EOL>optimise_z, x0=window_com[<NUM_LIT:2>], args=z_args, bounds=[z_bounds])<EOL>window_com[<NUM_LIT:2>] = z_optimisation.x[<NUM_LIT:0>]<EOL><DEDENT>window_diameter, _ = pore_diameter(elements, coordinates, com=window_com)<EOL>window_com[<NUM_LIT:2>] = window_com[<NUM_LIT:2>] + new_z<EOL>angle_2_1 = -angle_2<EOL>reverse_around_y = np.array([[np.cos(angle_2_1), <NUM_LIT:0>, np.sin(angle_2_1)],<EOL>[<NUM_LIT:0>, <NUM_LIT:1>, <NUM_LIT:0>],<EOL>[-np.sin(angle_2_1), <NUM_LIT:0>, np.cos(angle_2_1)]])<EOL>window_com = np.dot(reverse_around_y, window_com)<EOL>angle_1_1 = -angle_1<EOL>reverse_around_z = np.array([[np.cos(angle_1_1), -np.sin(angle_1_1), <NUM_LIT:0>],<EOL>[np.sin(angle_1_1), np.cos(angle_1_1), <NUM_LIT:0>],<EOL>[<NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:1>]])<EOL>window_com = np.dot(reverse_around_z, window_com)<EOL>return (window_diameter, window_com)<EOL>
Return window diameter and window's centre.

Parameters
----------
widnow: list

elements: numpy.array

coordinates: numpy.array

elements_vdw: numpy.array

step: float