Пример #1
0
        try:
            nperms = int(test)
        except Exception:
            raise ValueError('Could not turn {} into integer ...'.format(test))
        perms_iterator = []
        for ii in range(nperms):
            shuffle(myindices)
            perms_iterator.append(list(myindices))

    iperm = 1
    t1 = time.clock()
    for indices_perm in perms_iterator:

        lgf.setup_test_perfect_environment(cg_symbol, indices=indices_perm)

        lgf.perfect_geometry = AbstractGeometry.from_cg(cg=cg)
        points_perfect = lgf.perfect_geometry.points_wocs_ctwocc()

        print('Perm # {:d}/{:d} : '.format(iperm, nperms), indices_perm)

        algos_results = []
        for algo in cg.algorithms:
            print(algo)
            if algo.algorithm_type == 'EXPLICIT_PERMUTATIONS':
                raise ValueError(
                    'Do something for the explicit ones ... (these should anyway be by far ok!)'
                )

            results = lgf.coordination_geometry_symmetry_measures_separation_plane(
                coordination_geometry=cg,
                separation_plane_algo=algo,
        if cg_symbol not in sepplane_cgs:
            print('Wrong geometry, try again ...')
            continue

        cg = allcg[cg_symbol]

        print('Getting explicit permutations for geometry "{}" (symbol : "{}")\n'.format(cg.name, cg_symbol))

        # Setup of the local geometry finder
        lgf = LocalGeometryFinder()
        lgf.setup_parameters(structure_refinement=lgf.STRUCTURE_REFINEMENT_NONE)

        # Setup the random environment
        lgf.setup_test_perfect_environment(cg_symbol, randomness=True, indices=range(cg.coordination_number),
                                           max_random_dist=0.05)
        lgf.perfect_geometry = AbstractGeometry.from_cg(cg=cg)
        points_perfect = lgf.perfect_geometry.points_wocs_ctwocc()

        # 1. Check the algorithms defined for this coordination geometry and get the explicit permutations
        original_nexplicit_perms = []
        original_nexplicit_optimized_perms = []
        for ialgo, algo in enumerate(cg.algorithms):
            algo._permutations = algo.explicit_permutations
            if algo.algorithm_type == 'EXPLICIT_PERMUTATIONS':
                raise ValueError('Do something for the explicit ones ... (these should anyway be by far ok!)')
            if algo.explicit_optimized_permutations is None:
                eop = 'no'
            else:
                eop = str(len(algo.explicit_optimized_permutations))
            print('For ialgo {:d}, plane_points are {}, '
                  'side_0 is {} and '