# 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
        # real check of distances
        missing_pairs = []
        wrong_distances = []
        num_total = 0
        num_correct = 0

        for (id0, coord0), (id1, coord1) in iter_pairs():
            delta = coord1 - coord0
            if unit_cell is not None:
                delta = unit_cell.shortest_vector(delta)
            distance = np.linalg.norm(delta)
            if distance < cutoff:
                num_total += 1
                identifier = idcls([id0, id1])
                fast_distance = distances.get(identifier)
                if fast_distance is None:
                    missing_pairs.append(tuple(identifier) + (distance,))
                elif fast_distance != distance:
                    wrong_distances.append(tuple(identifier) + (fast_distance, distance))
                else:
                    num_correct += 1
                    del distances[identifier]

        message  = "-"*50+"\n"
        message += "CUTOFF %s\n" % cutoff
        message += "MISSING PAIRS: %i\n" % len(missing_pairs)
        for missing_pair in missing_pairs:
            message += "%10s %10s: \t % 10.7f\n" % missing_pair
        message += "WRONG DISTANCES: %i\n" % len(wrong_distances)
        for wrong_distance in wrong_distances:

# 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

        # real check of distances
        missing_pairs = []
        wrong_distances = []
        num_total = 0
        num_correct = 0

        for (id0, coord0), (id1, coord1) in iter_pairs():
            delta = coord1 - coord0
            if unit_cell is not None:
                delta = unit_cell.shortest_vector(delta)
            distance = np.linalg.norm(delta)
            if distance < cutoff:
                num_total += 1
                identifier = idcls([id0, id1])
                fast_distance = distances.get(identifier)
                if fast_distance is None:
                    missing_pairs.append(tuple(identifier) + (distance,))
                elif fast_distance != distance:
                    wrong_distances.append(tuple(identifier) + (fast_distance, distance))
                else:
                    num_correct += 1
                    del distances[identifier]

        message  = "-"*50+"\n"
        message += "CUTOFF %s\n" % cutoff
        message += "MISSING PAIRS: %i\n" % len(missing_pairs)
        for missing_pair in missing_pairs:
            message += "%10s %10s: \t % 10.7f\n" % missing_pair
        message += "WRONG DISTANCES: %i\n" % len(wrong_distances)
        for wrong_distance in wrong_distances:

            message += "%10s %10s: \t % 10.7f != % 10.7f\n" % wrong_distance