47 double precision,
parameter ::
pi = 4*atan(1.d0)
67 double precision,
allocatable :: data(:)
68 integer,
allocatable :: count(:)
69 double precision :: xmin
70 double precision :: dx
74 procedure,
private :: profile_init
76 procedure,
private :: profile_bin
78 procedure,
private :: profile_reset
80 procedure,
private :: profile_norm
87 double precision,
allocatable :: data(:,:)
88 double precision :: xmin
89 double precision :: dx
94 procedure,
private :: histogram_init
96 procedure,
private :: histogram_bin
100 double precision :: tic_time
101 double precision :: total
102 character(len=32) :: name
105 procedure,
private :: timer_init
116 integer :: current_idx
119 procedure,
private :: timer_list_init
121 procedure,
private :: timer_list_append
123 procedure,
private :: timer_list_write
134 character(len=max_path_length) :: input_file
135 character(len=max_path_length) :: output_file
136 integer(c_int64_t) :: seed
141 double precision,
allocatable :: data(:)
142 integer :: current_idx
143 integer :: block_size
146 procedure,
private :: alist_init
148 procedure,
private :: alist_append
162 pure function rel_pos(x, y, L)
result(r)
163 double precision,
intent(in) :: x(3), y(3), L(3)
165 double precision :: r(3)
171 if ( r(dim) < -0.5d0*l(dim) )
then 172 r(dim) = r(dim) + l(dim)
173 else if ( r(dim) > 0.5d0*l(dim) )
then 174 r(dim) = r(dim) - l(dim)
182 double precision,
intent(in) :: xmin, xmax
183 integer,
intent(in) :: n
187 this% dx = (xmax - xmin) / n
188 if (this% dx <= 0) error stop
'negative step in profile_init' 189 allocate(this% data(n))
191 allocate(this% count(n))
198 double precision,
intent(in) :: x, value
202 idx = floor( (x - this% xmin) / this% dx ) + 1
203 if ( ( idx > 0 ) .and. ( idx <= this% n ) )
then 204 this% data(idx) = this% data(idx) +
value 205 this% count(idx) = this% count(idx) + 1
221 where (this% count > 0)
222 this% data = this% data / this% count
229 double precision,
intent(in) :: xmin, xmax
230 integer,
intent(in) :: n
231 integer,
optional,
intent(in) :: n_species
233 if (
present(n_species))
then 234 this%n_species = n_species
241 this% dx = (xmax - xmin) / n
242 if (this% dx <= 0) error stop
'negative step in histogram_init' 243 allocate(this% data(this%n_species, n))
250 double precision,
intent(in) :: x
251 integer,
optional,
intent(in) :: s
253 integer :: idx, s_var
261 idx = floor( (x - this% xmin) / this% dx ) + 1
262 if ( ( idx > 0 ) .and. ( idx <= this% n ) )
then 263 this% data(s_var, idx) = this% data(s_var, idx) + 1
269 double precision,
pointer,
dimension(:,:),
intent(inout) :: p1, p2
270 double precision,
pointer,
dimension(:,:) :: p
279 integer,
pointer,
dimension(:),
intent(inout) :: p1, p2
280 integer,
pointer,
dimension(:) :: p
289 integer,
pointer,
dimension(:,:),
intent(inout) :: p1, p2
290 integer,
pointer,
dimension(:,:) :: p
300 if (command_argument_count() < 1)
then 301 error stop
'missing argument for parameter file' 304 call get_command_argument(1, r)
308 type(
args_t) function get_input_args() result(args)
311 character(max_path_length) :: r
313 if (command_argument_count() /= 3)
then 314 write(*,*)
'Welcome to RMPCMD http://lab.pdebuyl.be/rmpcdmd/' 316 write(*,*)
' rmpcdmd run program_name input output seed' 318 ' where input is the filename of the parameters file, output is the name' 320 ' of the H5MD output file and seed is a signed 64-bit integer' 324 call get_command_argument(1, args%input_file)
325 call get_command_argument(2, args%output_file)
326 call get_command_argument(3, r)
327 read(r, *, iostat=iostat) args%seed
328 if (iostat /= 0)
then 329 write(*,*)
'Error when reading the seed value (third command-line argument)' 335 subroutine timer_init(this, name, system_name)
337 character(len=*),
intent(in) :: name
338 character(len=*),
optional,
intent(in) :: system_name
340 if (
present(system_name))
then 341 if (len(system_name) > 0)
then 342 this%name = system_name//
' '//name
355 class(
timer_t),
intent(inout) :: this
356 this%tic_time = omp_get_wtime()
361 class(
timer_t),
intent(inout) :: this
362 this%total = this%total + omp_get_wtime() - this%tic_time
367 integer,
intent(in) :: n
369 allocate(this%timers(n))
376 type(
timer_t),
target,
intent(in) :: timer_target
378 this%current_idx = this%current_idx + 1
379 if (this%current_idx >
size(this%timers)) error stop
'exceeded timer_list_t size' 380 this%timers(this%current_idx)%p => timer_target
385 use hdf5
, only: hid_t
386 use h5md_module
, only: h5md_write_dataset
389 integer(HID_T),
intent(inout) :: group
390 double precision,
optional,
intent(out) :: total_out
395 do i = 1,
size(this%timers)
396 if (
associated(this%timers(i)%p))
then 397 call h5md_write_dataset(group, this%timers(i)%p%name, this%timers(i)%p%total)
398 total_out = total_out + this%timers(i)%p%total
404 pure function cross(x1, x2)
result(r)
405 double precision,
intent(in) :: x1(3), x2(3)
406 double precision :: r(3)
408 r(1) = x1(2)*x2(3) - x1(3)*x2(2)
409 r(2) = x1(3)*x2(1) - x1(1)*x2(3)
410 r(3) = x1(1)*x2(2) - x1(2)*x2(1)
416 integer,
intent(in) :: block_size
418 allocate(this%data(block_size))
420 this%block_size = block_size
426 double precision,
intent(in) :: value
429 double precision,
allocatable :: tmp_data(:)
431 idx = this%current_idx
432 len =
size(this%data)
435 call move_alloc(this%data, tmp_data)
436 allocate(this%data(len+this%block_size))
437 this%data(1:len) = tmp_data
442 this%data(idx) =
value 443 this%current_idx = idx
448 character(len=*),
intent(in) :: base_string
449 integer,
intent(in) :: index
450 integer,
intent(in) :: length
451 character(len=:),
allocatable :: s
453 character(len=12) format_string
455 allocate(
character(len=len(trim(base_string))+length) :: s)
457 s(1:len(trim(base_string))) = base_string
459 write(format_string,
'(a,i3.3,a,i3.3,a)')
'(a,i', length,
'.', length,
')' 460 write(s, format_string) trim(base_string), index
integer, parameter, public enzyme_region_bit
subroutine timer_init(this, name, system_name)
Appendable lists of double precision data.
subroutine switch_d2(p1, p2)
integer, parameter, public catalyzed_mask
character(len=max_path_length) function, public get_input_filename()
subroutine alist_init(this, block_size)
integer, parameter max_path_length
integer, parameter, public md_mask
subroutine histogram_init(this, xmin, xmax, n, n_species)
subroutine histogram_bin(this, x, s)
integer, parameter, public md_bit
integer, parameter, public enzyme_region_mask
subroutine profile_norm(this)
integer, parameter, public outbound_bit
character(len=:) function, allocatable, public numbered_string(base_string, index, length)
integer, parameter, public reac_mask
type(args_t) function, public get_input_args()
pure double precision function, dimension(3), public cross(x1, x2)
subroutine profile_bin(this, x, value)
subroutine switch_i1(p1, p2)
subroutine timer_list_append(this, timer_target)
integer, parameter, public wall_bit
integer, parameter, public reac_bit
integer, parameter, public past_md_bit
Container for a profile, e.g. v(x)
pure double precision function, dimension(3), public rel_pos(x, y, L)
Return x-y distance with minimum image convention.
Container for a histogram, e.g. p(x)
Container for the standard command-line arguments to RMPCDMD.
subroutine switch_i2(p1, p2)
subroutine profile_reset(this)
subroutine timer_list_write(this, group, total_out)
subroutine alist_append(this, value)
subroutine timer_list_init(this, n)
subroutine profile_init(this, xmin, xmax, n)
integer, parameter, public catalyzed_bit
Container for the list of times for enzymatic kinetics.
double precision, parameter, public pi
integer, parameter, public wall_mask