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

Functions/Subroutines

subroutine, public pretty_print_exchange (setup, units)
 Subroutine to print atom-atom effective pair interactions to the screen in a human-readable format.
 
subroutine, public display_grid (grid, show_borders, title)
 Subroutine to print the current state of the grid to the screen, layer by layer.
 
subroutine, public print_centered_message (message, fill_char, newline)
 Centered printing routine

 

Function/Subroutine Documentation

◆ display_grid()

subroutine, public display::display_grid ( integer(kind=array_int), dimension(:,:,:,:), intent(in) grid,
logical, intent(in), optional show_borders,
character(len=*), optional title )

Subroutine to print the current state of the grid to the screen, layer by layer.

Currently supports the cubic representation of the fcc and

Author
C. D. Woodgate
Date
2020-2023
Parameters
gridCurrent simulation configuration
show_bordersOptional argument controlling display of borders
titleOptional argument specifying the title to display
Returns
None

Definition at line 108 of file display.f90.

109
110 integer(kind=array_int), intent(in), dimension(:,:,:,:) :: grid
111 logical, intent(in), optional :: show_borders
112 character(len=*), optional :: title
113 logical :: borders
114 integer, dimension(4) :: sizes
115 integer :: ix, iy, iz
116 character(len=1) :: c
117 character(len=4), parameter :: clrstr = char(27)//'[2j'
118
119 borders = .true.
120
121 if (present(show_borders)) borders = show_borders
122
123 write(*,'(a)') clrstr
124
125 sizes = shape(grid)
126 if (present(title)) then
127 write(*, '(a)') title
128 end if
129
130 do iz = sizes(4), 1, -1
131
132 write(*, '(a, I2)') 'Layer for z = ', iz
133
134 if (borders) write(*, '(a)') repeat('=', sizes(2)+2)
135
136 do iy = sizes(3), 1, -1
137 if (borders) write(*, '(a)', advance='no') '|'
138 do ix = 1, sizes(2)
139 if (grid(1,ix,iy,iz) .ne. 0) then
140 write(c, '(I1)') grid(1,ix, iy, iz)
141 else
142 c = ' '
143 end if
144 write(*, '(a)', advance='no') c
145 end do
146 if (borders) write(*, '(a)', advance='no') '|'
147 write(*, '(a)') ''
148 end do
149 if (borders) write(*, '(a)') repeat('=', sizes(2)+2)
150 end do
151
Here is the caller graph for this function:

◆ pretty_print_exchange()

subroutine, public display::pretty_print_exchange ( type(run_params), intent(in) setup,
character(len=*), optional units )

Subroutine to print atom-atom effective pair interactions to the screen in a human-readable format.

User has choice of units to use. Default is meV, but also support mRy.

Author
C. D. Woodgate
Date
2020-2023
Parameters
setupDerived type containing simulation parameters
unitsOptional argument specifying the units to use
Returns
None

Definition at line 36 of file display.f90.

37 integer :: i,j,k
38 character(len=*), optional :: units
39 character(len=10) :: aunits
40 type(run_params), intent(in) :: setup
41
42 ! Can do mRy or meV, but default is meV
43 if (present(units)) then
44 aunits = units
45 else
46 aunits = 'meV'
47 end if
48
49 ! Case mRy
50 if (trim(aunits) .eq. 'mRy') then
51 write(*,"(x,'V_ij to be used in calculation (mRy):',/)")
52 do i=1, setup%interaction_range
53 write(*,'(a, I2, a, a)') ' Interchange interaction on shell: ', i, new_line('a')
54 write(*, '(A)', advance='no') ' '
55 do j=1, setup%n_species
56 write(*, '(A, A)', advance='no') ' ', setup%species_names(j)
57 end do
58 write(*, '(A)', advance='yes') ''
59 do j=1, setup%n_species
60 write(*, '(A, A)', advance='no') ' ', setup%species_names(j)
61 do k=1, setup%n_species
62 write(*, '(A, F8.3, A)', advance='no') ' ', 1000*v_ex(k,j,i), ' '
63 if (k .eq. setup%n_species) write(*,'(a)') ''
64 end do
65 if (j .eq. setup%n_species) write(*,'(a)') ''
66 end do
67 end do
68 write(*,'(a)') ''
69 ! Case meV
70 else if (trim(aunits) .eq. 'meV') then
71 write(*,"(x,'V_ij to be used in calculation (meV):',/)")
72 do i=1, setup%interaction_range
73 write(*,'(a, I2, a, a)') ' Interchange interaction on shell: ', i, new_line('a')
74 write(*, '(A)', advance='no') ' '
75 do j=1, setup%n_species
76 write(*, '(A, A)', advance='no') ' ', setup%species_names(j)
77 end do
78 write(*, '(A)', advance='yes') ''
79 do j=1, setup%n_species
80 write(*, '(A, A)', advance='no') ' ', setup%species_names(j)
81 do k=1, setup%n_species
82 write(*, '(A, F8.3, A)', advance='no') ' ', 1000*ry_to_ev*v_ex(k,j,i), ' '
83 if (k .eq. setup%n_species) write(*,'(a)') ''
84 end do
85 if (j .eq. setup%n_species) write(*,'(a)') ''
86 end do
87 end do
88 write(*,'(a)') ''
89 end if
90
Here is the caller graph for this function:

◆ print_centered_message()

subroutine, public display::print_centered_message ( character(len=*), intent(in) message,
character(len=*), intent(in) fill_char,
logical, optional newline )

Centered printing routine

This routine prints centered text with user specified filler either side of printed message. e.g. "----- Output -----". Optional argument controls whether a newline is inserted.

Parameters
messageString to be printed
fill_charString to be used to fill message (can be " ")
newlineIf True, a newline is printed after the message. If False, not.
Returns
None
Author
H. J. Naguszewski
C. D. Woodgate
Date
2025

Definition at line 168 of file display.f90.

169 implicit none
170 character(len=*), intent(in) :: message, fill_char
171 logical, optional :: newline
172 character(len=72) :: output_str
173 logical :: anewline
174 integer :: num_fill_chars
175
176 if (present(newline)) then
177 anewline = newline
178 else
179 anewline = .false.
180 end if
181
182 ! Calculate the number of fill characters needed on each side
183 num_fill_chars = (72 - len_trim(message) - 2) / 2
184
185 ! Construct the formatted string with fill characters on both sides
186 output_str = repeat(fill_char, num_fill_chars) // " " // message // " " // repeat(fill_char, num_fill_chars)
187
188 ! If there's an odd number of fill characters, we need to add one more to the right side
189 if (mod(72 - len_trim(message) - 2, 2) /= 0) then
190 output_str = output_str // fill_char
191 end if
192
193 ! Write formatted output
194 if (anewline) then
195 write(6, '(A,/)') output_str
196 else
197 write(6, '(A)') output_str
198 end if
199