12 type(tester_t) :: test
14 integer,
parameter :: N = 1000000
15 double precision,
target,
allocatable :: pos1(:, :), pos2(:, :)
16 double precision,
pointer :: pos(:,:), pos_old(:,:), pos_pointer(:,:)
18 integer :: i, L(3), seed_size, clock
19 integer,
allocatable :: seed(:)
20 integer :: h, c1(3), c2(3)
27 call random_seed(
size = seed_size)
28 allocate(seed(seed_size))
29 call system_clock(count=clock)
30 seed = clock + 37 * [ (i - 1, i = 1, seed_size) ]
31 call random_seed(put = seed)
39 call random_number(pos)
41 pos(i, :) = pos(i, :)*l(i)
44 call solvent_cells%init(l, 1.d0)
46 call solvent_cells%count_particles(pos)
48 call solvent_cells%sort_particles(pos, pos_old)
52 pos_old => pos_pointer
54 call solvent_cells%count_particles(pos)
56 call test% assert_equal(solvent_cells%cell_start(1), 1)
57 call test% assert_equal(solvent_cells%cell_start(solvent_cells%N), n+1)
58 call test% assert_equal(sum(solvent_cells%cell_count), n)
62 if (i .ge. solvent_cells% cell_start(h) + solvent_cells% cell_count(h)) h = h + 1
63 do while (solvent_cells% cell_count(h) .eq. 0)
66 c1 = solvent_cells%cartesian_indices(pos(:,i))
68 call test% assert_equal(c1, c2)
pure integer function, dimension(dim), public compact_h_to_p(h, m)
Compute compact Hilbert indices.