26 type(h5md_file_t) :: datafile
27 integer(HID_T) :: fields_group
28 type(h5md_element_t) :: elem
29 type(h5md_element_t) :: e_solvent, e_solvent_v
30 type(h5md_element_t) :: elem_tz, elem_tz_count
31 type(h5md_element_t) :: elem_rhoz
32 type(h5md_element_t) :: elem_T
33 integer(HID_T) :: box_group, solvent_group
35 integer,
parameter :: N = 10800
37 integer :: i, L(3), clock, error
39 double precision :: v_com(3), wall_v(3,2)
42 double precision,
parameter :: tau = 0.1d0
43 type(threefry_rng_t),
allocatable :: state(:)
46 n_threads = omp_get_max_threads()
47 allocate(state(n_threads))
48 call threefry_rng_init(state,-8053552729396308626_c_int64_t)
57 solvent%vel(1,i) = threefry_normal(state(1))
58 solvent%vel(2,i) = threefry_normal(state(1))
59 solvent%vel(3,i) = threefry_normal(state(1))
61 v_com = sum(solvent% vel,
dim=2) /
size(solvent% vel,
dim=2)
62 solvent% vel = solvent% vel - spread(v_com,
dim=2, ncopies=
size(solvent% vel,
dim=2))
66 call solvent% random_placement(l*1.d0, state=state(1))
68 call solvent_cells%init(l, 1.d0, has_walls=.true.)
69 solvent_cells% origin(3) = -0.5d0
71 call solvent_cells%count_particles(solvent% pos)
73 call datafile% create(
'data_setup_thermal_fluid.h5',
'RMPCDMD:setup_thermal_fluid',
'0.0 dev',
'Pierre de Buyl')
75 call tz% init(0.d0, solvent_cells% edges(3), l(3))
76 call rhoz% init(0.d0, solvent_cells% edges(3), l(3))
78 call h5gcreate_f(datafile% particles,
'solvent', solvent_group, error)
79 call h5gcreate_f(solvent_group,
'box', box_group, error)
80 call h5md_write_attribute(box_group,
'dimension', 3)
81 call h5md_write_attribute(box_group,
'boundary', [
'periodic',
'periodic',
'periodic'])
82 call elem% create_fixed(box_group,
'edges', l*1.d0)
83 call h5gclose_f(box_group, error)
85 call e_solvent% create_time(solvent_group,
'position', solvent% pos, ior(h5md_time, h5md_store_time))
86 call e_solvent_v% create_time(solvent_group,
'velocity', solvent% vel, ior(h5md_time, h5md_store_time))
88 call h5gcreate_f(datafile%id,
'fields', fields_group, error)
89 call elem_tz% create_time(fields_group,
'tz', tz% data, &
90 ior(h5md_time, h5md_store_time))
91 call elem_tz_count% create_time(fields_group,
'tz_count', &
92 tz% count, ior(h5md_time, h5md_store_time))
93 call elem_rhoz% create_time(fields_group,
'rhoz', rhoz% data, &
94 ior(h5md_time, h5md_store_time))
95 call h5gclose_f(fields_group, error)
97 call elem_t% create_time(datafile% observables,
'temperature', t, &
98 ior(h5md_time, h5md_store_time))
100 call solvent% sort(solvent_cells)
101 call solvent_cells%count_particles(solvent% pos)
108 call random_number(solvent_cells% origin)
109 solvent_cells% origin = solvent_cells% origin - 1
110 call apply_pbc(solvent, solvent_cells%edges)
111 call solvent% sort(solvent_cells)
113 wall_temperature=[0.9d0, 1.1d0], wall_v=wall_v, wall_n=[10, 10])
120 call random_number(solvent_cells% origin)
121 solvent_cells% origin = solvent_cells% origin - 1
122 call apply_pbc(solvent, solvent_cells%edges)
123 call solvent% sort(solvent_cells)
125 wall_temperature=[0.9d0, 1.1d0], wall_v=wall_v, wall_n=[10, 10])
126 v_com = sum(solvent% vel,
dim=2) /
size(solvent% vel,
dim=2)
129 write(13,*) t, sum(solvent% vel**2)/(3*solvent% Nmax), v_com
130 call elem_t% append(t, i, i*tau)
134 if (modulo(i, 50) == 0)
then 136 call elem_tz% append(tz% data, i, i*tau)
137 call elem_tz_count% append(tz% count, i, i*tau)
139 rhoz% data = rhoz% data / (50.d0 * rhoz% dx)
140 call elem_rhoz% append(rhoz% data, i, i*tau)
146 call e_solvent% append(solvent% pos, i, i*tau)
147 call e_solvent_v% append(solvent% vel, i, i*tau)
150 do i = 1 , solvent_cells% N
151 if ( solvent_cells% cell_count(i) > 0 ) clock = clock + 1
153 write(*,*) clock,
'filled cells' 154 write(*,*) l(1)*l(2)*(l(3)+1),
'actual cells' 156 call e_solvent% close()
157 call e_solvent_v% close()
158 call elem_tz% close()
159 call elem_rhoz% close()
162 call h5gclose_f(solvent_group, error)
164 call h5gclose_f(datafile% observables, error)
166 call datafile% close()
168 call h5close_f(error)
subroutine, public md_vel(particles, dt)
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 compute_rho(particles, rhoz)
Compute density profile along z.
double precision function, public compute_temperature(particles, cells, tz)
Compute the temperature of a mpcd solvent.
subroutine, public apply_pbc(particles, edges)
Compute compact Hilbert indices.
Container for a profile, e.g. v(x)
subroutine, public mpcd_stream_nogravity_zwall(particles, cells, dt)
Routines to perform MPCD dynamics.
Routines to perform Molecular Dynamics integration.
Container for a histogram, e.g. p(x)
Lennard-Jones potential definition.