# Path: molmod/periodic.py
# class AtomInfo(object):
# class PeriodicData(object):
#     def __init__(self):
#         def append_convertor(word):
#     def _add_atom_info(self, atom_info):
#     def __len__(self):
#     def __getitem__(self, index):
#     def iter_numbers(self):
# 
# Path: molmod/test/test_unit_cells.py
# def get_random_uc(scale=2, num_active=3, min_spacing=0.1):
#     while True:
#         active = np.random.randint(0, 2, 3).astype(bool)
#         if active.sum() == num_active:
#             break
#     while True:
#         try:
#             result = UnitCell(np.random.uniform(-scale, scale, (3, 3)), active)
#             if not active.any() or result.spacings[active].min() >= min_spacing:
#                 return result
#         except ValueError:
#             pass


import unittest
import numpy as np
import pkg_resources
import pytest
from molmod import *
from molmod.io import *
from molmod.periodic import periodic
from molmod.test.test_unit_cells import get_random_uc
            coordinates = unit_cell.to_cartesian(coordinates)*3-unit_cell.matrix.sum(axis=1)
            cutoff = np.random.uniform(1, 6)

            pair_search = PairSearchIntra(coordinates, cutoff, unit_cell)
            self.verify_bins_intra_periodic(pair_search.bins)

            distances = [
                (frozenset([i0, i1]), distance)
                for i0, i1, delta, distance
                in pair_search
            ]
            self.verify_distances_intra(coordinates, cutoff, distances, unit_cell)

    def test_distances_inter_random(self):
        for i in range(10):
            coordinates0 = np.random.uniform(0,5,(20,3))
            coordinates1 = np.random.uniform(0,5,(20,3))
            cutoff = np.random.uniform(1, 6)
            distances = [
                ((i0, i1), distance)
                for i0, i1, delta, distance
                in PairSearchInter(coordinates0, coordinates1, cutoff)
            ]
            self.verify_distances_inter(coordinates0, coordinates1, cutoff, distances)

    @pytest.mark.xfail
    def test_distances_inter_random_periodic(self):
        for i in range(10):
            fractional0 = np.random.uniform(0,1,(20,3))
            fractional1 = np.random.uniform(0,1,(20,3))

# Path: molmod/periodic.py
# class AtomInfo(object):
# class PeriodicData(object):
#     def __init__(self):
#         def append_convertor(word):
#     def _add_atom_info(self, atom_info):
#     def __len__(self):
#     def __getitem__(self, index):
#     def iter_numbers(self):
# 
# Path: molmod/test/test_unit_cells.py
# def get_random_uc(scale=2, num_active=3, min_spacing=0.1):
#     while True:
#         active = np.random.randint(0, 2, 3).astype(bool)
#         if active.sum() == num_active:
#             break
#     while True:
#         try:
#             result = UnitCell(np.random.uniform(-scale, scale, (3, 3)), active)
#             if not active.any() or result.spacings[active].min() >= min_spacing:
#                 return result
#         except ValueError:
#             pass


# Path: molmod/test/test_binning.py
import unittest
import numpy as np
import pkg_resources
import pytest
from molmod import *
from molmod.io import *
from molmod.periodic import periodic
from molmod.test.test_unit_cells import get_random_uc

            coordinates = unit_cell.to_cartesian(coordinates)*3-unit_cell.matrix.sum(axis=1)
            cutoff = np.random.uniform(1, 6)

            pair_search = PairSearchIntra(coordinates, cutoff, unit_cell)
            self.verify_bins_intra_periodic(pair_search.bins)

            distances = [
                (frozenset([i0, i1]), distance)
                for i0, i1, delta, distance
                in pair_search
            ]
            self.verify_distances_intra(coordinates, cutoff, distances, unit_cell)

    def test_distances_inter_random(self):
        for i in range(10):
            coordinates0 = np.random.uniform(0,5,(20,3))
            coordinates1 = np.random.uniform(0,5,(20,3))
            cutoff = np.random.uniform(1, 6)
            distances = [
                ((i0, i1), distance)
                for i0, i1, delta, distance
                in PairSearchInter(coordinates0, coordinates1, cutoff)
            ]
            self.verify_distances_inter(coordinates0, coordinates1, cutoff, distances)

    @pytest.mark.xfail
    def test_distances_inter_random_periodic(self):
        for i in range(10):
            fractional0 = np.random.uniform(0,1,(20,3))
            fractional1 = np.random.uniform(0,1,(20,3))

            unit_cell = get_random_uc(5.0, np.random.randint(0, 4), 0.5)