19 type(threefry_rng_t),
target,
allocatable :: state(:)
26 type(h5md_file_t) :: datafile
27 type(h5md_element_t) :: elem
28 type(h5md_element_t) :: e_solvent, e_solvent_v, e_solvent_spec, e_solvent_id
29 type(h5md_element_t) :: e_solvent_image
30 integer(HID_T) :: box_group, solvent_group
32 integer,
parameter :: N = 10240
34 integer :: i, L(3), error, clock, n_threads
36 double precision,
parameter :: tau=0.1d0
37 double precision,
parameter :: T = 1
38 double precision :: v_com(3), wall_v(3,2)
40 n_threads = omp_get_max_threads()
41 allocate(state(n_threads))
42 call threefry_rng_init(state, 2985348049158689438_c_int64_t)
51 solvent% vel(1,i) = threefry_normal(state(1))*sqrt(t)
52 solvent% vel(2,i) = threefry_normal(state(1))*sqrt(t)
53 solvent% vel(3,i) = threefry_normal(state(1))*sqrt(t)
55 v_com = sum(solvent% vel,
dim=2) /
size(solvent% vel,
dim=2)
56 solvent% vel = solvent% vel - spread(v_com,
dim=2, ncopies=
size(solvent% vel,
dim=2))
60 call solvent% random_placement(l*1.d0, state=state(1))
62 call solvent_cells%init(l, 1.d0)
64 call solvent_cells%count_particles(solvent% pos)
66 call datafile% create(
'data_setup_simple_fluid.h5',
'RMPCDMD:setup_simple_fluid',
'0.0 dev',
'Pierre de Buyl')
68 call tz% init(0.d0, solvent_cells% edges(3), l(3))
70 call h5gcreate_f(datafile% particles,
'solvent', solvent_group, error)
71 call h5gcreate_f(solvent_group,
'box', box_group, error)
72 call h5md_write_attribute(box_group,
'dimension', 3)
73 call h5md_write_attribute(box_group,
'boundary', [
'periodic',
'periodic',
'periodic'])
74 call elem% create_fixed(box_group,
'edges', l*1.d0)
75 call h5gclose_f(box_group, error)
77 call e_solvent% create_time(solvent_group,
'position', solvent% pos, ior(h5md_time, h5md_store_time))
78 call e_solvent_v% create_time(solvent_group,
'velocity', solvent% vel, ior(h5md_time, h5md_store_time))
79 call e_solvent_spec% create_time(solvent_group,
'species', solvent% species, ior(h5md_time, h5md_store_time))
80 call e_solvent_id% create_time(solvent_group,
'id', solvent% id, ior(h5md_time, h5md_store_time))
81 call e_solvent_image% create_time(solvent_group,
'image', solvent% image, ior(h5md_time, h5md_store_time))
83 call solvent% sort(solvent_cells)
84 call solvent_cells%count_particles(solvent% pos)
85 solvent_cells% origin(1) = threefry_double(state(1)) - 1
86 solvent_cells% origin(2) = threefry_double(state(1)) - 1
87 solvent_cells% origin(3) = threefry_double(state(1)) - 1
93 solvent_cells% origin(1) = threefry_double(state(1)) - 1
94 solvent_cells% origin(2) = threefry_double(state(1)) - 1
95 solvent_cells% origin(3) = threefry_double(state(1)) - 1
96 call solvent% sort(solvent_cells)
97 call solvent_cells%count_particles(solvent% pos)
99 do i = 1,solvent% Nmax
100 if (solvent% pos(3,i) <= solvent_cells% edges(3)/2)
then 101 solvent% species(i) = 1
103 solvent% species(i) = 2
112 v_com = sum(solvent% vel,
dim=2) /
size(solvent% vel,
dim=2)
116 solvent_cells% origin(1) = threefry_double(state(1)) - 1
117 solvent_cells% origin(2) = threefry_double(state(1)) - 1
118 solvent_cells% origin(3) = threefry_double(state(1)) - 1
119 call solvent% sort(solvent_cells)
120 call solvent_cells%count_particles(solvent% pos)
121 call e_solvent% append(solvent% pos, i, i*tau)
122 call e_solvent_image% append(solvent% image, i, i*tau)
123 call e_solvent_v% append(solvent% vel, i, i*tau)
124 call e_solvent_spec% append(solvent% species, i, i*tau)
125 call e_solvent_id% append(solvent% id, i, i*tau)
130 do i = 1 , solvent_cells% N
131 if ( solvent_cells% cell_count(i) > 0 ) clock = clock + 1
133 write(*,*) clock,
'filled cells' 134 write(*,*) l(1)*l(2)*l(3),
'actual cells' 136 call e_solvent% close()
137 call e_solvent_v% close()
139 call h5gclose_f(solvent_group, error)
142 call elem% create_fixed(datafile% observables,
'tz', tz% data)
143 call elem% create_fixed(datafile% observables,
'tz_count', tz% count)
145 call h5gclose_f(datafile% observables, error)
147 call datafile% close()
149 call h5close_f(error)
subroutine, public wall_mpcd_step(particles, cells, state, wall_temperature, wall_v, wall_n, thermostat, bulk_temperature, alpha, keep_cell_v)
Collisions in partially filled cells at the walls use the rule of Lamura et al (2001) ...
subroutine, public mpcd_stream_periodic(particles, cells, dt)
Stream MPCD particles in a periodic system.
subroutine, public simple_mpcd_step(particles, cells, state, alpha, thermostat, T, hydro)
Perform a collision.
Compute compact Hilbert indices.
Container for a profile, e.g. v(x)
Routines to perform MPCD dynamics.
Lennard-Jones potential definition.