def calculate_pore_shape(elements, coordinates, adjust=<NUM_LIT:1>, increment=<NUM_LIT:0.1>,<EOL>**kwargs):
<EOL>coordinates = deepcopy(coordinates)<EOL>origin = np.array([<NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0>])<EOL>initial_com = center_of_mass(elements, coordinates)<EOL>coordinates = shift_com(elements, coordinates)<EOL>elements_vdw = np.array([[atomic_vdw_radius[x.upper()]] for x in elements])<EOL>shpere_radius = max_dim(elements, coordinates)[<NUM_LIT:2>]/<NUM_LIT:2><EOL>sphere_surface_area = <NUM_LIT:4> * np.pi * shpere_radius**<NUM_LIT:2><EOL>number_of_points = int(np.log10(sphere_surface_area) * <NUM_LIT> * adjust)<EOL>golden_angle = np.pi * (<NUM_LIT:3> - np.sqrt(<NUM_LIT:5>))<EOL>theta = golden_angle * np.arange(number_of_points)<EOL>z = np.linspace(<NUM_LIT:1> - <NUM_LIT:1.0> / number_of_points, <NUM_LIT:1.0> / number_of_points - <NUM_LIT:1.0>,<EOL>number_of_points)<EOL>radius = np.sqrt(<NUM_LIT:1> - z * z)<EOL>points = np.zeros((number_of_points, <NUM_LIT:3>))<EOL>points[:, <NUM_LIT:0>] = radius * np.cos(theta) * shpere_radius<EOL>points[:, <NUM_LIT:1>] = radius * np.sin(theta) * shpere_radius<EOL>points[:, <NUM_LIT:2>] = z * shpere_radius<EOL>values = []<EOL>tree = KDTree(points)<EOL>for i in points:<EOL><INDENT>dist, ind = tree.query(i.reshape(<NUM_LIT:1>, -<NUM_LIT:1>), k=<NUM_LIT:10>)<EOL>values.extend(dist)<EOL><DEDENT>mean_distance = np.mean(values)<EOL>eps = mean_distance + mean_distance**<NUM_LIT:0.5><EOL>results = [<EOL>vector_analysis_pore_shape(point, coordinates, elements_vdw)<EOL>for point in points<EOL>]<EOL>results_cleaned = [x for x in results if x is not None]<EOL>ele = np.array(['<STR_LIT:X>'] * len(results_cleaned))<EOL>coor = np.array(results_cleaned)<EOL>return coor<EOL>
Return average diameter for a molecule.