BraWl
Loading...
Searching...
No Matches
io Module Reference

Functions/Subroutines

subroutine, public write_info (point)
 Subroutine to print software version, date, and time.
 
subroutine, public make_data_directories (my_rank)
 Subroutine to make directories for storing data.
 
subroutine, public read_control_file (filename, parameters, my_rank)
 Subroutine to read the input file defining the simulation.
 
subroutine, public echo_control_file (parameters)
 Subroutine to echo the contents of the input file to the screen.
 
subroutine, public read_exchange (setup, my_rank)
 Subroutine to read the atom-atom effective pair interactions (EPIs) from file.
 
subroutine, public parse_inputs (setup, my_rank)
 Subroutine to parse command line arguments.
 
subroutine, public parse_metropolis_inputs (metropolis, my_rank)
 Subroutine to parse the Metropolis MC input file.
 
subroutine, public read_metropolis_file (filename, metropolis, my_rank)
 Subroutine to parse the Metropolis MC input file.
 
subroutine, public echo_metropolis_file (metropolis)
 Subroutine to echo the contents of the Metropolis input file to the screen.
 
subroutine, public read_ns_file (filename, parameters)
 Subroutine to read and parse nested sampling control file.
 
subroutine, public read_tmmc_file (filename, parameters, my_rank)
 Subroutine to read and parse transition matrix Monte Carlo (TMMC) input file.
 
subroutine, public read_wl_file (filename, parameters, my_rank)
 Subroutine to read and parse Wang-Landau sampling input file.
 

Variables

real(real64t_start
 
real(real64t_stop
 

Function/Subroutine Documentation

◆ echo_control_file()

subroutine, public io::echo_control_file ( type(run_params) parameters)

Subroutine to echo the contents of the input file to the screen.

Author
C. D. Woodgate
Date
2020-2025
Parameters
parametersDerived type containing simulation parameters
Returns
None

Definition at line 341 of file io.f90.

342
343 type(run_params) :: parameters
344 integer :: i
345
346 print*, ' Read mode = ', parameters%mode
347 print*, ' Read n_1 = ', parameters%n_1
348 print*, ' Read n_2 = ', parameters%n_2
349 print*, ' Read n_3 = ', parameters%n_3
350 print*, ' Read n_basis = ', parameters%n_basis
351 print*, ' Read n_species = ', parameters%n_species
352 print*, ' Read lattice parameter = ', parameters%lattice_parameter
353 print*, ' Read lattice = ', parameters%lattice
354 print*, ' Read interaction_file = ', parameters%interaction_file
355 print*, ' Read wc_range = ', parameters%wc_range
356
357 ! Print specified concentrations/numbers of atoms
358 if (abs(sum(parameters%species_concentrations)-1.0_real64) &
359 .lt. 0.001) then
360 do i=1, parameters%n_species
361 print*, ' Read species ', i, ' = ', parameters%species_names(i), &
362 ' at concentration ', parameters%species_concentrations(i)
363 enddo
364 else
365 do i=1, parameters%n_species
366 print*, ' Read species ', i, ' = ', parameters%species_names(i), &
367 ' at ', parameters%species_numbers(i), ' atoms'
368 enddo
369 end if
370
Here is the caller graph for this function:

◆ echo_metropolis_file()

subroutine, public io::echo_metropolis_file ( type(metropolis_params) metropolis)

Subroutine to echo the contents of the Metropolis input file to the screen.

Author
C. D. Woodgate
Date
2025
Parameters
metropolisDerived type containing Metroplis parameters
Returns
None

Definition at line 697 of file io.f90.

698
699 type(metropolis_params) :: metropolis
700
701 print*, ' mode = ', metropolis%mode
702 print*, ' n_mc_steps = ', metropolis%n_mc_steps
703 print*, ' burn_in_start = ', metropolis%burn_in_start
704 print*, ' burn_in = ', metropolis%burn_in
705 print*, ' n_burn_in_steps = ', metropolis%n_burn_in_steps
706 print*, ' n_sample_steps = ', metropolis%n_sample_steps
707 print*, ' calculate_energies = ', metropolis%calculate_energies
708 print*, ' write_trajectory_energy = ', metropolis%write_trajectory_energy
709 print*, ' write_trajectory_asro = ', metropolis%write_trajectory_asro
710 print*, ' calculate_asro = ', metropolis%calculate_asro
711 print*, ' n_sample_steps_asro = ', metropolis%n_sample_steps_asro
712 print*, ' calculate_alro = ', metropolis%calculate_alro
713 print*, ' n_sample_steps_alro = ', metropolis%n_sample_steps_alro
714 print*, ' write_trajectory_xyz = ', metropolis%write_trajectory_xyz
715 print*, ' n_sample_steps_trajectory = ', metropolis%n_sample_steps_trajectory
716 print*, ' write_final_config_xyz = ', metropolis%write_final_config_xyz
717 print*, ' write_final_config_nc = ', metropolis%write_final_config_nc
718 print*, ' read_start_config_nc = ', metropolis%read_start_config_nc
719 if (metropolis%read_start_config_nc) then
720 print*, ' starting configuration file ', metropolis%start_config_file
721 end if
722 print*, ' T = ', metropolis%T
723 print*, ' T_steps = ', metropolis%T_steps
724 print*, ' delta_T = ', metropolis%delta_T
725 print*, ' nbr_swap = ', metropolis%nbr_swap
726
Here is the caller graph for this function:

◆ make_data_directories()

subroutine, public io::make_data_directories ( integer my_rank)

Subroutine to make directories for storing data.

Author
C. D. Woodgate
Date
2021-2025
Parameters
pointCharacter string (either 's' or 'f') telling us whether we are at the start or finish of simulation
Returns
None

Definition at line 109 of file io.f90.

110
111 integer :: my_rank
112
113 ! make a directory for the grid states, diagnostics,
114 ! and radial_densities for each thread
115 if(my_rank == 0) call execute_command_line('mkdir -p configs')
116 if(my_rank == 0) call execute_command_line('mkdir -p energies')
117 if(my_rank == 0) call execute_command_line('mkdir -p asro')
118
Here is the caller graph for this function:

◆ parse_inputs()

subroutine, public io::parse_inputs ( type(run_params) setup,
integer my_rank )

Subroutine to parse command line arguments.

For routines which actually parse the command line arguments, see command_line.f90

Author
C. D. Woodgate
Date
2020-2025
Parameters
setupDerived type containing simulation parameters
my_rankRank of current MPI process
Returns
None

Definition at line 429 of file io.f90.

430
431 type(run_params) :: setup
432 integer :: my_rank
433 character(len=30) :: control = ' '
434
435 ! Parse the name of the input file
436 if(my_rank == 0) then
437 write(6,'(22("-"),x,"Parsing name of input file",x,22("-"),/)')
438 end if
439 if(.not. get_arg('input', control)) then
440 if (my_rank == 0) then
441 print*, 'Input file not specified with "input=<name>"'
442 print*, 'Defaulting to searching for "brawl.inp"'
443 print*, ' '
444 end if
445 control = 'brawl.inp'
446 else
447 if (my_rank == 0) then
448 print*, 'Input file name is: ', control
449 print*, ' '
450 end if
451 end if
452
453 ! Read the input file
454 call read_control_file(control, setup, my_rank)
455
456 if(my_rank == 0) then
457 call echo_control_file(setup)
458 write(6,'(/,20("-"),x,"Parsed input file successfully",x,20("-"),/)')
459 end if
460
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_metropolis_inputs()

subroutine, public io::parse_metropolis_inputs ( type(metropolis_params) metropolis,
integer my_rank )

Subroutine to parse the Metropolis MC input file.

Author
C. D. Woodgate
Date
2020-2025
Parameters
metropolisDerived type containing Metropolis MC parameters
my_rankRank of current MPI process
Returns
None

Definition at line 472 of file io.f90.

473
474 type(metropolis_params) :: metropolis
475 integer :: my_rank
476 character(len=30) :: control = ' '
477
478 ! Parse the name of the input file
479 if(my_rank == 0) then
480 write(6,'(/,17("-"),x,"Parsing name of Metropolis input file",x,16("-"),/)')
481 end if
482 if(.not. get_arg('metropolis', control)) then
483 if (my_rank == 0) then
484 print*, ' Metropolis input file not specified with "metropolis=<name>"'
485 print*, ' '
486 print*, ' Defaulting to searching for "metropolis.inp"'
487 end if
488 control = 'metropolis.inp'
489 else
490 if (my_rank == 0) then
491 print*, 'Input file name is: ', control
492 print*, ' '
493 end if
494 end if
495
496 ! Read the input file
497 call read_metropolis_file(control, metropolis, my_rank)
498
499 if(my_rank == 0) then
500 write(6,'(x,"Parameters to be used are as follows",/)')
501 end if
502
503 if(my_rank == 0) then
504 call echo_metropolis_file(metropolis)
505 write(6,'(/,15("-"),x,"Parsed Metropolis input file successfully",x,14("-"),/)')
506 end if
507
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_control_file()

subroutine, public io::read_control_file ( character(len=*), intent(in) filename,
type(run_params) parameters,
integer my_rank )

Subroutine to read the input file defining the simulation.

As of v0.4.0, need to read this file AND a separate input file relevant to Metropolis, Nested Sampling, Wang-Landau algorithms.

Author
C. D. Woodgate
Date
2020-2025
Parameters
filenameName of file to read
parametersDerived type containing simulation parameters
my_rankRank of current MPI process
Returns
None

Definition at line 135 of file io.f90.

136
137 character(len=*), intent(in) :: filename
138 logical, dimension(11) :: check
139 logical, dimension(2) :: cs_or_counts
140 type(run_params) :: parameters
141 character(len=144) :: buffer, label, first_char
142 integer :: line, pos, ios, my_rank
143 logical :: exists
144
145 ! Set my checking_array to be false initially
146 check = .false.
147 cs_or_counts = .false.
148
149 ios=0; line=0
150
151 ! Initialise to default values---this means Valgrid will be happy
152 parameters%mode = 301
153 parameters%lattice = 'fcc'
154 parameters%lattice_parameter = 3.57
155 parameters%n_1 = 4
156 parameters%n_2 = 4
157 parameters%n_3 = 4
158 parameters%n_basis = 1
159 parameters%n_species = 4
160 parameters%interaction_file = 'V_ijs.txt'
161 parameters%wc_range = 2
162 parameters%static_seed = .false.
163
164 ! See if the relevant file exists
165 inquire(file=trim(filename), exist=exists)
166
167 ! Exit cleanly if we can't find it
168 if (.not. exists) then
169 call comms_finalise()
170 stop 'Could not find input file ' // trim(filename)
171 end if
172
173 ! If we can find it, output that we are reading it
174 if(my_rank == 0) then
175 write(6,'(26("-"),x,"Parsing input file",x,26("-"),/)')
176 end if
177
178 ! Open it for reading
179 open(15, file=filename, iostat=ios)
180
181 ! Read line by line from the buffer until we hit the end of the file
182 do while (ios==0)
183
184 read(15, "(A)", iostat=ios) buffer
185
186 if(ios==0) then
187 line=line+1
188
189 ! Check if the first non-whitespace character is a hash.
190 ! If so, this is a comment line---ignore it.
191 first_char = trim(buffer)
192 if (first_char(1:1) .eq. '#') then
193 continue
194 end if
195
196 pos = scan(buffer, '=')
197 label=buffer(1:pos-1)
198 buffer = buffer(pos+1:)
199
200 select case (label)
201 case ('mode')
202 read(buffer, *, iostat=ios) parameters%mode
203 check(1) = .true.
204 case ('lattice')
205 read(buffer, *, iostat=ios) parameters%lattice
206 check(2) = .true.
207 case ('lattice_parameter')
208 read(buffer, *, iostat=ios) parameters%lattice_parameter
209 check(3) = .true.
210 case ('n_1')
211 read(buffer, *, iostat=ios) parameters%n_1
212 check(4) = .true.
213 case ('n_2')
214 read(buffer, *, iostat=ios) parameters%n_2
215 check(5) = .true.
216 case ('n_3')
217 read(buffer, *, iostat=ios) parameters%n_3
218 check(6) = .true.
219 case ('n_species')
220 read(buffer, *, iostat=ios) parameters%n_species
221 check(7) = .true.
222 case ('interaction_file')
223 read(buffer, *, iostat=ios) parameters%interaction_file
224 check(8) = .true.
225 case ('interaction_range')
226 read(buffer, *, iostat=ios) parameters%interaction_range
227 check(9) = .true.
228 case ('wc_range')
229 read(buffer, *, iostat=ios) parameters%wc_range
230 case ('static_seed')
231 read(buffer, *, iostat=ios) parameters%static_seed
232 case default
233 end select
234 end if
235 end do
236
237 close(15)
238
239 ! Now we know how many species there are, we can go back and read
240 ! the concentrations/n_atoms of each species, and their labels
241 allocate(parameters%species_names(parameters%n_species))
242 allocate(parameters%species_concentrations(0:parameters%n_species))
243 allocate(parameters%species_numbers(parameters%n_species))
244
245 ! Set these arrays to be zero initially
246 parameters%species_concentrations = 0.0_real64
247 parameters%species_numbers = 0
248
249 line=0
250
251 open(15, file=filename, iostat=ios)
252
253 ! Read line by line from the buffer until we hit the end of the file
254 do while (ios==0)
255
256 read(15, "(A)", iostat=ios) buffer
257
258 if(ios==0) then
259 line=line+1
260
261 ! Check if the first non-whitespace character is a hash.
262 ! If so, this is a comment line---ignore it.
263 first_char = trim(buffer)
264 if (first_char(1:1) .eq. '#') then
265 continue
266 end if
267
268 pos = scan(buffer, '=')
269 label=buffer(1:pos-1)
270 buffer = buffer(pos+1:)
271
272 select case (label)
273 case ('species_names')
274 read(buffer, *, iostat=ios) parameters%species_names
275 check(10) = .true.
276 case ('species_concentrations')
277 read(buffer, *, iostat=ios) parameters%species_concentrations(1:)
278 cs_or_counts(1) = .true.
279 check(11) = .true.
280 case ('species_numbers')
281 read(buffer, *, iostat=ios) parameters%species_numbers(:)
282 cs_or_counts(2) = .true.
283 check(11) = .true.
284 case default
285 end select
286 end if
287 end do
288
289 close(15)
290
291 ! Check that the user has specified either the concentrations of each species
292 ! or the number of atoms of each species, but not both.
293 if (cs_or_counts(1) .and. cs_or_counts(2)) then
294 call comms_finalise()
295 stop 'You cannot specify both chemical concentrations and numbers of atoms!'
296 else if ((.not. cs_or_counts(1)) .and. (.not. cs_or_counts(2))) then
297 call comms_finalise()
298 stop 'You must specify either chemical concentrations or numbers of atoms.'
299 end if
300
301 ! Check that the user has provided all the necessary inputs
302 ! Exit and tell them which is missing if needed
303 if (.not. all(check)) then
304 call comms_finalise()
305 if (.not. check(1)) then
306 stop "Missing 'mode' in system file"
307 else if (.not. check(2)) then
308 stop "Missing 'lattice' in system file"
309 else if (.not. check(3)) then
310 stop "Missing 'lattice_parameter' in system file"
311 else if (.not. check(4)) then
312 stop "Missing 'n_1' in system file"
313 else if (.not. check(5)) then
314 stop "Missing 'n_2' in system file"
315 else if (.not. check(6)) then
316 stop "Missing 'n_3' in system file"
317 else if (.not. check(7)) then
318 stop "Missing 'n_species' in system file"
319 else if (.not. check(8)) then
320 stop "Missing 'interaction_file' in system file"
321 else if (.not. check(9)) then
322 stop "Missing 'interaction_range' in system file"
323 else if (.not. check(10)) then
324 stop "Missing 'species_names' in system file"
325 else
326 stop 'Missing parameter in system file'
327 end if
328 end if
329
Here is the caller graph for this function:

◆ read_exchange()

subroutine, public io::read_exchange ( type(run_params), intent(in) setup,
integer my_rank )

Subroutine to read the atom-atom effective pair interactions (EPIs) from file.

The file should represent the EPIs on each coordination shell as an sxs matrix, with a blank line between the set of EPIs for one coordination shell and those for the next. They should be given in order from nearest to furthest coordination shell.

Author
C. D. Woodgate
Date
2020-2025
Parameters
setupDerived type containing simulation parameters
my_rankRank of current MPI process
Returns
None

Definition at line 389 of file io.f90.

390
391 type(run_params) , intent(in) :: setup
392 integer :: my_rank
393
394 if(my_rank == 0) then
395 !write(6,'(72("-"),/)', advance='no')
396 write(6,'(8("-"),x,"Reading atom-atom effective pair interaction parameters",x, 7("-"),/)')
397 end if
398
399 v_ex = 0.0_real64
400 open(16, file=setup%interaction_file)
401 read(16,*) v_ex
402 close(16)
403
404 if (my_rank .eq. 0) then
405 ! Print it out as a sanity check for user
406 call pretty_print_exchange(setup)
407 end if
408
409 if(my_rank == 0) then
410 write(6,'(3("-"),x,"Read atom-atom effective pair interaction parameters successfully",x, &
411 &2("-"),/)')!, advance='no')
412 !write(6,'(72("-"),/)')
413 end if
414
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_metropolis_file()

subroutine, public io::read_metropolis_file ( character(len=*), intent(in) filename,
type(metropolis_params) metropolis,
integer my_rank )

Subroutine to parse the Metropolis MC input file.

Author
C. D. Woodgate
Date
2025
Parameters
metropolisDerived type containing Metropolis MC parameters
my_rankRank of current MPI process
Returns
None

Definition at line 519 of file io.f90.

520
521 character(len=*), intent(in) :: filename
522 logical, dimension(4) :: check
523 type(metropolis_params) :: metropolis
524 character(len=144) :: buffer, label, first_char
525 integer :: line, pos, ios, my_rank
526 logical :: exists
527
528 ! Set my checking_array to be false initially
529 check = .false.
530
531 ios=0; line=0
532
533 ! Defaults if these are not specified.
534 metropolis%burn_in_start = .false.
535 metropolis%burn_in = .false.
536 metropolis%n_burn_in_steps = 0
537 metropolis%calculate_energies = .true.
538 metropolis%write_trajectory_energy = .false.
539 metropolis%calculate_asro = .true.
540 metropolis%calculate_alro = .false.
541 metropolis%n_sample_steps_asro = 0
542 metropolis%n_sample_steps_alro = 0
543 metropolis%write_trajectory_xyz = .false.
544 metropolis%write_trajectory_energy = .false.
545 metropolis%write_trajectory_asro = .false.
546 metropolis%n_sample_steps_trajectory = 0
547 metropolis%write_initial_config_xyz = .false.
548 metropolis%write_initial_config_nc = .false.
549 metropolis%write_final_config_xyz = .false.
550 metropolis%write_final_config_nc = .false.
551 metropolis%read_start_config_nc = .false.
552 metropolis%T_steps = 1
553 metropolis%delta_T = 1
554 metropolis%nbr_swap = .false.
555
556 ! See if the relevant file exists
557 inquire(file=trim(filename), exist=exists)
558
559 ! Exit cleanly if we can't find it
560 if (.not. exists) then
561 call comms_finalise()
562 stop 'Could not find Metropolis control file: ' // trim(filename)
563 end if
564
565 ! If we can find it, output that we are reading it
566 if(my_rank == 0) then
567 write(6,'(/,19("-"),x,"Parsing Metropolis control file",x,20("-"),/)')
568 end if
569
570 ! Open it for reading
571 open(15, file=filename, iostat=ios)
572
573 ! Read line by line from the buffer until we hit the end of the file
574 do while (ios==0)
575
576 read(15, "(A)", iostat=ios) buffer
577
578 if(ios==0) then
579 line=line+1
580
581 ! Check if the first non-whitespace character is a hash.
582 ! If so, this is a comment line---ignore it.
583 first_char = trim(buffer)
584 if (first_char(1:1) .eq. '#') then
585 continue
586 end if
587
588 pos = scan(buffer, '=')
589 label=buffer(1:pos-1)
590 buffer = buffer(pos+1:)
591
592 select case (label)
593 case ('mode')
594 read(buffer, *, iostat=ios) metropolis%mode
595 check(1) = .true.
596 case ('n_mc_steps')
597 read(buffer, *, iostat=ios) metropolis%n_mc_steps
598 check(2) = .true.
599 case ('burn_in_start')
600 read(buffer, *, iostat=ios) metropolis%burn_in_start
601 case ('burn_in')
602 read(buffer, *, iostat=ios) metropolis%burn_in
603 case ('n_burn_in_steps')
604 read(buffer, *, iostat=ios) metropolis%n_burn_in_steps
605 case ('calculate_energies')
606 read(buffer, *, iostat=ios) metropolis%calculate_energies
607 case ('n_sample_steps')
608 read(buffer, *, iostat=ios) metropolis%n_sample_steps
609 check(3) = .true.
610 case ('calculate_asro')
611 read(buffer, *, iostat=ios) metropolis%calculate_asro
612 case ('n_sample_steps_asro')
613 read(buffer, *, iostat=ios) metropolis%n_sample_steps_asro
614 case ('calculate_alro')
615 read(buffer, *, iostat=ios) metropolis%calculate_alro
616 case ('n_sample_steps_alro')
617 read(buffer, *, iostat=ios) metropolis%n_sample_steps_alro
618 case ('n_sample_steps_trajectory')
619 read(buffer, *, iostat=ios) metropolis%n_sample_steps_trajectory
620 case ('write_trajectory_xyz')
621 read(buffer, *, iostat=ios) metropolis%write_trajectory_xyz
622 case ('write_trajectory_energy')
623 read(buffer, *, iostat=ios) metropolis%write_trajectory_energy
624 case ('write_trajectory_asro')
625 read(buffer, *, iostat=ios) metropolis%write_trajectory_asro
626 case ('write_initial_config_xyz')
627 read(buffer, *, iostat=ios) metropolis%write_initial_config_xyz
628 case ('write_initial_config_nc')
629 read(buffer, *, iostat=ios) metropolis%write_initial_config_nc
630 case ('write_final_config_xyz')
631 read(buffer, *, iostat=ios) metropolis%write_final_config_xyz
632 case ('write_final_config_nc')
633 read(buffer, *, iostat=ios) metropolis%write_final_config_nc
634 case ('read_start_config_nc')
635 read(buffer, *, iostat=ios) metropolis%read_start_config_nc
636 case ('start_config_file')
637 read(buffer, *, iostat=ios) metropolis%start_config_file
638 case ('T')
639 read(buffer, *, iostat=ios) metropolis%T
640 check(4) = .true.
641 case ('T_steps')
642 read(buffer, *, iostat=ios) metropolis%T_steps
643 case ('delta_T')
644 read(buffer, *, iostat=ios) metropolis%delta_T
645 case ('nbr_swap')
646 read(buffer, *, iostat=ios) metropolis%nbr_swap
647 case default
648 end select
649 end if
650 end do
651
652 close(15)
653
654 if (metropolis%n_sample_steps_alro .eq. 0) then
655 metropolis%n_sample_steps_asro = metropolis%n_sample_steps
656 endif
657 if (metropolis%n_sample_steps_alro .eq. 0) then
658 metropolis%n_sample_steps_alro = metropolis%n_sample_steps
659 endif
660 if (metropolis%n_sample_steps_trajectory .eq. 0) then
661 metropolis%n_sample_steps_trajectory = metropolis%n_sample_steps
662 endif
663
664 ! Check that the user has provided all the necessary inputs
665 ! Exit and tell them which is missing if needed
666 if (.not. all(check)) then
667 call comms_finalise()
668 if (.not. check(1)) then
669 stop "Missing 'mode' in Metropolis input file"
670 else if (.not. check(2)) then
671 stop "Missing 'n_mc_steps' in Metropolis input file"
672 else if (.not. check(3)) then
673 stop "Missing 'n_sample_steps' in Metropolis input file"
674 else if (.not. check(4)) then
675 stop "Missing 'T' in Metropolis input file"
676 else
677 stop "Missing something in Metropolis input file"
678 end if
679 end if
680
681 ! If burning in at all temperatures, we should do the first, too
682 if(metropolis%burn_in) then
683 metropolis%burn_in_start = .true.
684 end if
685
Here is the caller graph for this function:

◆ read_ns_file()

subroutine, public io::read_ns_file ( character(len=*), intent(in) filename,
type(ns_params) parameters )

Subroutine to read and parse nested sampling control file.

Author
L. B. Partay
Date
2024
Parameters
filenameName of the nested sampling input file (expected to be "ns_input.txt")
parametersDerived type of ns_params, containing nested sampling parameters
Returns
None

Definition at line 740 of file io.f90.

741
742 character(len=*), intent(in) :: filename
743 logical, dimension(8) :: check
744 type(ns_params) :: parameters
745 character(len=144) :: buffer, label, first_char
746 integer :: line, pos, ios
747
748 check = .false.
749
750 ios=0; line=0
751
752 ! Print to screen that we are looking for the NS input file
753 if(my_rank == 0) then
754 write(6,'(/,18("-"),x,"Parsing Nested Sampling input file",x,18("-"),/)')
755 end if
756
757 print*, ' Looking for Nested Sampling input file named: ', filename, new_line('a')
758
759 open(25, file=filename, iostat=ios)
760
761 ! Exit cleanly if we cannot find it
762 if (ios .ne. 0) then
763 call comms_finalise()
764 stop 'Could not parse input file. Aborting...'
765 end if
766
767 ! Otherwise, read it
768 do while (ios==0)
769
770 read(25, "(A)", iostat=ios) buffer
771
772 if(ios==0) then
773 line=line+1
774
775 ! Check if the first non-whitespace character is a hash.
776 ! If so, this is a comment line---ignore it.
777 first_char = trim(buffer)
778 if (first_char(1:1) .eq. '#') then
779 continue
780 end if
781
782 pos = scan(buffer, '=')
783 label=buffer(1:pos-1)
784 buffer = buffer(pos+1:)
785
786 select case (label)
787 case ('n_walkers')
788 read(buffer, *, iostat=ios) parameters%n_walkers
789 print*, ' Read n_walkers = ', parameters%n_walkers
790 case ('n_steps')
791 read(buffer, *, iostat=ios) parameters%n_steps
792 print*, ' Read n_steps = ', parameters%n_steps
793 case ('n_iter')
794 read(buffer, *, iostat=ios) parameters%n_iter
795 print*, ' Read n_iter = ', parameters%n_iter
796 case ('outfile_ener')
797 read(buffer, *, iostat=ios) parameters%outfile_ener
798 print*, ' Read outfile_ener = ', parameters%outfile_ener
799 case ('outfile_traj')
800 read(buffer, *, iostat=ios) parameters%outfile_traj
801 print*, ' Read outfile_traj = ', parameters%outfile_traj
802 case ('traj_freq')
803 read(buffer, *, iostat=ios) parameters%traj_freq
804 print*, ' Write configuration every n-th NS iteration = ', parameters%traj_freq
805 case default
806 end select
807 end if
808 end do
809
810 ! If all has gone to plan, print that we have read this file
811 if(my_rank == 0) then
812 write(6,'(/,12("-"),x,"Successfully parsed Nested Sampling input file",x,12("-"),/)')
813 end if
814
815 close(25)
816
Here is the caller graph for this function:

◆ read_tmmc_file()

subroutine, public io::read_tmmc_file ( character(len=*), intent(in) filename,
type(tmmc_params) parameters,
integer my_rank )

Subroutine to read and parse transition matrix Monte Carlo (TMMC) input file.

Author
H. J. Naguszewski
Date
2024
Parameters
filenameName of the TMMC input file
parametersDerived type of tmmc_params, containing TMMC parameters
Returns
None

Definition at line 830 of file io.f90.

831
832 integer :: my_rank
833 character(len=*), intent(in) :: filename
834 logical, dimension(8) :: check
835 type(tmmc_params) :: parameters
836 character(len=100) :: buffer, label
837 integer :: line, pos, ios
838
839 check = .false.
840
841 ios=0; line=0
842
843 open(25, file=filename, iostat=ios)
844
845 if (ios .ne. 0) then
846 call comms_finalise()
847 stop 'Could not parse tmmc input file. Aborting...'
848 end if
849
850 if (my_rank == 0) then
851 write(*,'(a)', advance='no') new_line('a')
852 print*, '###############################'
853 print*, '# Parsing tmmc input file #'
854 print*, '###############################'
855
856 print*, '# tmmc input file name: ', filename
857 end if
858
859 do while (ios==0)
860
861 read(25, "(A)", iostat=ios) buffer
862
863 if(ios==0) then
864 line=line+1
865
866 pos = scan(buffer, '=')
867 label=buffer(1:pos-1)
868 buffer = buffer(pos+1:)
869
870 select case (label)
871 case ('mc_sweeps')
872 read(buffer, *, iostat=ios) parameters%mc_sweeps
873 if (my_rank == 0) then
874 print*, '# Read mc_sweeps = ', parameters%mc_sweeps
875 end if
876 check(1) = .true.
877 case ('bins')
878 read(buffer, *, iostat=ios) parameters%bins
879 if (my_rank == 0) then
880 print*, '# Read bins = ', parameters%bins
881 end if
882 check(2) = .true.
883 case ('num_windows')
884 read(buffer, *, iostat=ios) parameters%num_windows
885 if (my_rank == 0) then
886 print*, '# Read num_windows = ', parameters%num_windows
887 end if
888 check(3) = .true.
889 case ('bin_overlap')
890 read(buffer, *, iostat=ios) parameters%bin_overlap
891 if (my_rank == 0) then
892 print*, '# Read bin_overlap = ', parameters%bin_overlap
893 end if
894 check(4) = .true.
895 case ('weight_update')
896 read(buffer, *, iostat=ios) parameters%weight_update
897 if (my_rank == 0) then
898 print*, '# Read weight_update = ', parameters%weight_update
899 end if
900 check(5) = .true.
901 case ('energy_min')
902 read(buffer, *, iostat=ios) parameters%energy_min
903 if (my_rank == 0) then
904 print*, '# Read energy_min = ', parameters%energy_min
905 end if
906 check(6) = .true.
907 case ('energy_max')
908 read(buffer, *, iostat=ios) parameters%energy_max
909 if (my_rank == 0) then
910 print*, '# Read energy_max = ', parameters%energy_max
911 end if
912 check(7) = .true.
913 case ('T')
914 read(buffer, *, iostat=ios) parameters%T
915 if (my_rank == 0) then
916 print*, '# Read T = ', parameters%T
917 end if
918 check(8) = .true.
919 case default
920 if (my_rank == 0) then
921 print*, '# Skipping invalid label'
922 end if
923 end select
924 end if
925 end do
926
927 if (my_rank == 0) then
928 print*, '# Finished parsing tmmc input file #'
929 print*, '####################################', new_line('a')
930 end if
931 close(25)
932
933 if (.not. all(check)) then
934 call comms_finalise()
935 stop 'Missing parameter in tmmc input file'
936 end if
937

◆ read_wl_file()

subroutine, public io::read_wl_file ( character(len=*), intent(in) filename,
type(wl_params) parameters,
integer my_rank )

Subroutine to read and parse Wang-Landau sampling input file.

Author
H. J. Naguszewski
Date
2024
Parameters
filenameName of the Wang-Landau input file
parametersDerived type of wl_params, containing Wang-Landau parameters
Returns
None

Definition at line 951 of file io.f90.

952
953 integer :: my_rank
954 character(len=*), intent(in) :: filename
955 logical, dimension(10) :: check
956 type(wl_params) :: parameters
957 character(len=100) :: buffer, label
958 integer :: line, pos, ios
959
960 check = .false.
961
962 ios=0; line=0
963
964 open(25, file=filename, iostat=ios)
965
966 if (ios .ne. 0) then
967 call comms_finalise()
968 stop 'Could not parse wang landau input file. Aborting...'
969 end if
970
971 if (my_rank == 0) then
972 write(*,'(a)', advance='no') new_line('a')
973 print*, '##################################'
974 print*, '# Parsing wang landau input file #'
975 print*, '##################################'
976
977 print*, '# wang landau input file name: ', filename
978 end if
979
980 do while (ios==0)
981
982 read(25, "(A)", iostat=ios) buffer
983
984 if(ios==0) then
985 line=line+1
986
987 pos = scan(buffer, '=')
988 label=buffer(1:pos-1)
989 buffer = buffer(pos+1:)
990
991 select case (label)
992 case ('mc_sweeps')
993 read(buffer, *, iostat=ios) parameters%mc_sweeps
994 if (my_rank == 0) then
995 print*, '# Read mc_sweeps = ', parameters%mc_sweeps
996 end if
997 check(1) = .true.
998 case ('bins')
999 read(buffer, *, iostat=ios) parameters%bins
1000 if (my_rank == 0) then
1001 print*, '# Read bins = ', parameters%bins
1002 end if
1003 check(2) = .true.
1004 case ('num_windows')
1005 read(buffer, *, iostat=ios) parameters%num_windows
1006 if (my_rank == 0) then
1007 print*, '# Read num_windows = ', parameters%num_windows
1008 end if
1009 check(3) = .true.
1010 case ('bin_overlap')
1011 read(buffer, *, iostat=ios) parameters%bin_overlap
1012 if (my_rank == 0) then
1013 print*, '# Read bin_overlap = ', parameters%bin_overlap
1014 end if
1015 check(4) = .true.
1016 case ('tolerance')
1017 read(buffer, *, iostat=ios) parameters%tolerance
1018 if (my_rank == 0) then
1019 print*, '# Read tolerance = ', parameters%tolerance
1020 end if
1021 check(5) = .true.
1022 case ('flatness')
1023 read(buffer, *, iostat=ios) parameters%flatness
1024 if (my_rank == 0) then
1025 print*, '# Read flatness = ', parameters%flatness
1026 end if
1027 check(6) = .true.
1028 case ('wl_f')
1029 read(buffer, *, iostat=ios) parameters%wl_f
1030 if (my_rank == 0) then
1031 print*, '# Read wl_f = ', parameters%wl_f
1032 end if
1033 check(7) = .true.
1034 case ('energy_min')
1035 read(buffer, *, iostat=ios) parameters%energy_min
1036 if (my_rank == 0) then
1037 print*, '# Read energy_min = ', parameters%energy_min
1038 end if
1039 check(8) = .true.
1040 case ('energy_max')
1041 read(buffer, *, iostat=ios) parameters%energy_max
1042 if (my_rank == 0) then
1043 print*, '# Read energy_max = ', parameters%energy_max
1044 end if
1045 check(9) = .true.
1046 case ('radial_samples')
1047 read(buffer, *, iostat=ios) parameters%radial_samples
1048 if (my_rank == 0) then
1049 print*, '# Read radial_samples = ', parameters%radial_samples
1050 end if
1051 check(10) = .true.
1052
1053 case default
1054 if (my_rank == 0) then
1055 print*, '# Skipping invalid label'
1056 end if
1057 end select
1058 end if
1059 end do
1060
1061 if (my_rank == 0) then
1062 print*, '# Finished parsing wang landau input file #'
1063 print*, '###########################################', new_line('a')
1064 end if
1065 close(25)
1066
1067 if (.not. all(check)) then
1068 call comms_finalise()
1069 stop 'Missing parameter in wang landau input file'
1070 end if
1071

◆ write_info()

subroutine, public io::write_info ( character (len=1) point)

Subroutine to print software version, date, and time.

Some ASCII-art, names of developers/contributors, and date/time when execution of the program started and finished.

Author
C. D. Woodgate
Date
2024-2025
Parameters
pointCharacter string (either 's' or 'f') telling us whether we are at the start or finish of simulation
Returns
None

Definition at line 50 of file io.f90.

51
52 character (len=1) point
53 character (len=10) date,time
54
55 ! Get date and time
56 call date_and_time(date=date,time=time)
57
58 write(6,'(/,72("="))')
59 write(6,'(22x,"BraWl Version 1.0.0, 09.05.25")')
60 write(6,'(72("-"))')
61
62 if (point .eq. 's') then
63
64 ! Start the clock
65 call cpu_time(t_start)
66
67 ! Print relevant info to screen
68 write(6, '(20x," ____ _ ____")')
69 write(6, '(20x," / __ )_________ | | / / /")')
70 write(6, '(20x," / __ / ___/ __ `/ | /| / / / ")')
71 write(6, '(20x," / /_/ / / / /_/ /| |/ |/ / / ")')
72 write(6, '(20x,"/_____/_/ \__,_/ |__/|__/_/ ")')
73 write(6, '(20x," ")')
74 write(6,'(72("-"))')
75 write(6, '(" Authors: Hubert J. Naguszewski, ")')
76 write(6, '(" Livia B. Partay, ")')
77 write(6, '(" Christopher D. Woodgate")')
78 write(6,'(72("-"))')
79 write(6, '(" Contributors: Heather Ratcliffe")')
80 write(6, '(" David Quigley ")')
81 write(6, '(" Adam M. Krajewski")')
82 write(6,'(72("-"))')
83 write(6,'(15x,"This run started at",1x,a," on",1x,a)') &
84 time(1:2)//":"//time(3:4)//":"//time(5:6), &
85 date(7:8)//"."//date(5:6)//"."//date(1:4)
86 else if(point .eq. 'f') then
87 write(6,'(15x,"This run finished at",1x,a," on",1x,a)') &
88 time(1:2)//":"//time(3:4)//":"//time(5:6), &
89 date(7:8)//"."//date(5:6)//"."//date(1:4)
90 write(6,'(72("-"))')
91 ! Start the clock
92 call cpu_time(t_stop)
93 write(6,'(20x,"Execution time",1x,f9.1,1x," seconds")') t_stop-t_start
94 endif
95
96 write(6,'(72("="),/)' )
97
Here is the caller graph for this function:

Variable Documentation

◆ t_start

real(real64) io::t_start
private

Definition at line 33 of file io.f90.

33 real(real64) :: t_start, t_stop

◆ t_stop

real(real64) io::t_stop
private

Definition at line 33 of file io.f90.