12 integer,
parameter :: N = 679
14 type(tester_t) :: test
16 type(threefry_rng_t) :: state(1)
19 double precision :: x(3,n), v(3,n)
21 double precision :: x_old(3,n), v_old(3,n)
22 logical :: will_collide(n)
24 type(cell_system_t) :: cells
25 type(particle_system_t) :: p
28 call system_clock(count=clock)
29 call threefry_rng_init(state, int(clock, c_int64_t))
32 call cells%init(l, 1.d0)
37 cells%bc = [periodic_bc, bounce_back_bc, periodic_bc]
40 call p%random_placement(cells%edges, state=state(1))
44 p%vel(1,:) = (-0.5d0+threefry_double(state(1)))*2*l(1)
45 p%vel(2,:) = (-0.5d0+threefry_double(state(1)))*2*l(2)
46 p%vel(3,:) = (-0.5d0+threefry_double(state(1)))*2*l(3)
52 will_collide = ( (x_old(2,:)+v_old(2,:) < 0) .or. &
53 (x_old(2,:)+v_old(2,:) > l(2)) )
55 call cell_md_pos_ywall(cells, p, 1.d0, md_flag=.false.)
61 call test%assert_close(norm2(v(:,i)), norm2(v_old(:,i)))
62 call test%assert_positive(x(2,i))
63 call test%assert_positive(l(2)-x(2,i))
64 if (will_collide(i))
call test%assert_close(v(:,i), -v_old(:,i))
69 cells%bc = [periodic_bc, specular_bc, periodic_bc]
72 call p%random_placement(cells%edges, state=state(1))
76 p%vel(1,:) = (-0.5d0+threefry_double(state(1)))*2*l(1)
77 p%vel(2,:) = (-0.5d0+threefry_double(state(1)))*2*l(2)
78 p%vel(3,:) = (-0.5d0+threefry_double(state(1)))*2*l(3)
84 will_collide = ( (x_old(2,:)+v_old(2,:) < 0) .or. &
85 (x_old(2,:)+v_old(2,:) > l(2)) )
87 call cell_md_pos_ywall(cells, p, 1.d0, md_flag=.false.)
93 call test%assert_close(norm2(v(:,i)), norm2(v_old(:,i)))
94 call test%assert_positive(x(2,i))
95 call test%assert_positive(l(2)-x(2,i))
96 if (will_collide(i))
then 97 call test%assert_close(v(1,i), v_old(1,i))
98 call test%assert_close(v(2,i), -v_old(2,i))
99 call test%assert_close(v(3,i), v_old(3,i))