def find_windows_new(elements,<EOL>coordinates,<EOL>processes=None,<EOL>mol_size=None,<EOL>adjust=<NUM_LIT:1>,<EOL>pore_opt=True,<EOL>increment=<NUM_LIT:1.0>,<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>if pore_opt is True:<EOL><INDENT>com_adjust = initial_com - opt_pore_diameter(elements, coordinates, **<EOL>kwargs)[<NUM_LIT:2>]<EOL>initial_com = initial_com - com_adjust<EOL>coordinates = shift_com(elements, coordinates, com_adjust=com_adjust)<EOL><DEDENT>else:<EOL><INDENT>coordinates = shift_com(elements, coordinates)<EOL><DEDENT>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>if processes:<EOL><INDENT>pool = Pool(processes=processes)<EOL>parallel = [<EOL>pool.apply_async(<EOL>vector_preanalysis,<EOL>args=(<EOL>point,<EOL>coordinates,<EOL>elements_vdw, ),<EOL>kwds={'<STR_LIT>': increment}) for point in points<EOL>]<EOL>results = [p.get() for p in parallel if p.get() is not None]<EOL>pool.terminate()<EOL>dataset = np.array([x[<NUM_LIT:5>:<NUM_LIT:8>] for x in results])<EOL><DEDENT>else:<EOL><INDENT>results = [<EOL>vector_preanalysis(<EOL>point, coordinates, elements_vdw, increment=increment)<EOL>for point in points<EOL>]<EOL>results = [x for x in results if x is not None]<EOL>dataset = np.array([x[<NUM_LIT:5>:<NUM_LIT:8>] for x in results])<EOL><DEDENT>if len(results) == <NUM_LIT:0>:<EOL><INDENT>return None<EOL><DEDENT>else:<EOL><INDENT>db = DBSCAN(eps=eps).fit(dataset)<EOL>core_samples_mask = np.zeros_like(db.labels_, dtype=bool)<EOL>core_samples_mask[db.core_sample_indices_] = True<EOL>labels = set(db.labels_)<EOL>clusters = [[i, j] for i, j in zip(results, db.labels_)]<EOL>clustered_results = {label: [] for label in labels}<EOL>[clustered_results[i[<NUM_LIT:1>]].append(i[<NUM_LIT:0>]) for i in clusters]<EOL>return clustered_results, elements, coordinates, initial_com<EOL><DEDENT>
Return windows diameters and center of masses for a molecule.