all_planes_point_indices.extend(algo.other_plane_points)

            # Loop on the planes
            explicit_permutations_per_plane = []
            for iplane, plane_point_indices in enumerate(all_planes_point_indices):
                prt1(string='In plane {:d} ({})'.format(iplane, '-'.join(str(pp) for pp in plane_point_indices)),
                     printing_volume=printing_volume)

                points_combination = [lgf.local_geometry._coords[ii] for ii in plane_point_indices]
                local_plane = Plane.from_npoints(points_combination, best_fit='least_square_distance')

                # Actual test of the permutations
                csms, perms, algos, sep_perms = lgf._cg_csm_separation_plane(coordination_geometry=cg,
                                                                             sepplane=algo,
                                                                             local_plane=local_plane,
                                                                             plane_separations=[],
                                                                             dist_tolerances=[0.05, 0.1,
                                                                                              0.2, 0.3],
                                                                             testing=True,
                                                                             points_perfect=points_perfect)

                prt1(string='Continuous symmetry measures', printing_volume=printing_volume)
                prt1(string=csms, printing_volume=printing_volume)
                csms_with_recorded_permutation = []
                explicit_permutations = []
                for icsm, csm in enumerate(csms):
                    found = False
                    for csm2 in csms_with_recorded_permutation:
                        if np.isclose(csm, csm2, rtol=0.0):
                            found = True
                            break
                    if not found:
Ejemplo n.º 2
0
                    found = True
                    break
                elif npoints > 3:
                    local_plane = Plane.from_npoints(points_combination, best_fit="least_square_distance")
                    found = True
                    break
                else:
                    raise ValueError("Wrong number of points to initialize separation plane")

        points_perfect = lgf.perfect_geometry.points_wocs_ctwocc()
        # Actual test of the permutations
        cgsm = lgf._cg_csm_separation_plane(
            coordination_geometry=cg,
            sepplane=sepplanealgo,
            local_plane=local_plane,
            plane_separations=[],
            dist_tolerances=[0.05, 0.1, 0.2, 0.3],
            testing=True,
            points_perfect=points_perfect,
        )

        print(cgsm)
        if cgsm[0] is None:
            print("IS NONE !")
            input()
            continue

        csms, perms, algos, sep_perms = cgsm[0], cgsm[1], cgsm[2], cgsm[3]

        print("Continuous symmetry measures")
        print(csms)
                all_planes_point_indices.extend(algo.other_plane_points)

            # Loop on the facets
            explicit_permutations_per_plane = []
            for iplane, plane_point_indices in enumerate(all_planes_point_indices):
                prt1(string='In plane {:d} ({})'.format(iplane, '-'.join(str(pp) for pp in plane_point_indices)),
                     printing_volume=printing_volume)

                points_combination = [lgf.local_geometry._coords[ii] for ii in plane_point_indices]
                local_plane = Plane.from_npoints(points_combination, best_fit='least_square_distance')

                # Actual test of the permutations
                csms, perms, algos, sep_perms = lgf._cg_csm_separation_plane(coordination_geometry=cg,
                                                                             sepplane=algo,
                                                                             local_plane=local_plane,
                                                                             plane_separations=[],
                                                                             dist_tolerances=[0.05, 0.1,
                                                                                              0.2, 0.3, 0.5],
                                                                             testing=True,
                                                                             points_perfect=points_perfect)

                mycsms = [c['symmetry_measure'] for c in csms]
                prt1(string='Continuous symmetry measures', printing_volume=printing_volume)
                prt1(string=mycsms, printing_volume=printing_volume)
                csms_with_recorded_permutation = []
                explicit_permutations = []
                for icsm, csm in enumerate(csms):
                    found = False
                    for csm2 in csms_with_recorded_permutation:
                        if np.isclose(csm['symmetry_measure'], csm2['symmetry_measure'], rtol=0.0):
                            found = True
                            break