BraWl
Loading...
Searching...
No Matches
metropolis_output.f90
Go to the documentation of this file.
1
9
10 use kinds
11 use shared_data
12 use analytics
13
14 implicit none
15
16 private
17
20
21 contains
22
34 subroutine energy_trajectory_writer(filename, step_number, energy)
35
36 character(len=*), intent(in) :: filename
37 integer :: step_number
38 real(real64) :: energy
39 logical :: exist
40
41 inquire(file=filename, exist=exist)
42 if (exist) then
43 open(7, file=filename, status="old", position="append", action="write")
44 else
45 open(7, file=filename, status="new", action="write")
46 write(7, *) '# step_number E'
47 end if
48
49 write(7,"(I13,x,f20.10,x)") step_number, energy
50
51 close(7)
52
53 end subroutine energy_trajectory_writer
54
66 subroutine asro_trajectory_writer(filename, step_number, asro)
67
68 character(len=*), intent(in) :: filename
69 integer :: step_number, i, j, k
70 integer, dimension(3) :: asro_size
71 real(real64), dimension(:,:,:) :: asro
72 logical :: exist
73
74 asro_size = shape(asro)
75
76 inquire(file=filename, exist=exist)
77 if (exist) then
78 open(7, file=filename, status="old", position="append", action="write")
79 else
80 open(7, file=filename, status="new", action="write")
81 write(7, *) '# step_number ASRO'
82 end if
83
84 write(7,"(I13,x,f20.10,x)", advance='no') step_number
85
86 do k=1, asro_size(3)
87 do j=1, asro_size(2)
88 do i=1, asro_size(1)
89 write(7,"(f8.5,x)", advance='no') asro(i,j,k)
90 end do
91 end do
92 end do
93
94 write(7,"(x)", advance='yes')
95
96 close(7)
97
98 end subroutine asro_trajectory_writer
99
113 subroutine diagnostics_writer(filename, temps, energies, C, acceptance)
114
115 ! Filename to which to write
116 character(len=*), intent(in) :: filename
117
118 real(real64), allocatable, dimension(:), intent(in) :: &
119 temps, energies, c, acceptance
120
121 integer :: i, n_steps
122
123 n_steps = size(energies)
124
125 open(unit=7, file=filename)
126
127 write(7, *) '# T E C acceptance_rate'
128
129 do i=1, n_steps
130 write(7,'(F8.1,2X,F24.15,2X,F24.15,2X,F6.4)') temps(i), energies(i), c(i), acceptance(i)
131 end do
132
133 close(7)
134
135 end subroutine diagnostics_writer
136
137end module metropolis_output
integer, parameter real64
Longer "double" (64 bit, approx -1.8e308 to 1.8e308 and covering values down to about 2e-308 magnitud...
Definition kinds.f90:59
subroutine, public diagnostics_writer(filename, temps, energies, c, acceptance)
Subroutine to write outputs of a Metropolis simulation to plain text file.
subroutine, public energy_trajectory_writer(filename, step_number, energy)
Subroutine to write energy of a Metropolis simulation trajectory to a plain text file.
subroutine, public asro_trajectory_writer(filename, step_number, asro)
Subroutine to write ASRO of a Metropolis simulation trajectory to a plain text file.