(git:3d5d2e5)
Loading...
Searching...
No Matches
pw_unittest.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
9 USE cp_files, ONLY: close_file,&
13 USE kinds, ONLY: dp
14 USE libcp2k, ONLY: cp2k_finalize,&
16 USE mathconstants, ONLY: fourpi,&
17 pi
18 USE message_passing, ONLY: mp_comm_type,&
22 USE pw_copy_all, ONLY: pw_copy_match
23 USE pw_grid_types, ONLY: fullspace,&
24 halfspace,&
26 USE pw_grids, ONLY: pw_grid_create,&
28 USE pw_methods, ONLY: do_accurate_sum,&
37 USE pw_types, ONLY: pw_c1d_gs_type,&
42
43 IMPLICIT NONE
44
45 INTEGER :: mode
46 REAL(dp) :: max_error
47 TYPE(cp_logger_type), POINTER :: logger
48 TYPE(mp_para_env_type), POINTER :: para_env
49
50 CALL cp2k_init()
51 logger => cp_get_default_logger()
52 para_env => logger%para_env
53 CALL check_cube_values()
54 DO mode = 0, 8
55 CALL check_copy(mode)
56 END DO
57 max_error = 0.0_dp
59 CALL check_pw_integral_and_poisson()
60 CALL check_mt2d_kernel()
61 print '(A,ES16.7)', 'PW integral and MT2D kernel maximum scaled error: ', max_error
62 CALL cp2k_finalize()
63
64CONTAINS
65
66! **************************************************************************************************
67!> \brief Preserve independent reflection symmetry on even real-grid Fourier boundaries.
68! **************************************************************************************************
70 COMPLEX(dp) :: phase
71 INTEGER :: alias, axis, ig, nalias
72 LOGICAL :: boundary(3)
73 REAL(dp) :: cell(3, 3), point(3), vectors(3, 8)
74 TYPE(mp_comm_type) :: comm
75 TYPE(pw_grid_type), POINTER :: grid
76
77 CALL comm%set_handle(mp_comm_world%get_handle())
78 cell = 0.0_dp
79 DO axis = 1, 3
80 cell(axis, axis) = 6.0_dp
81 END DO
82 NULLIFY (grid)
83 CALL pw_grid_create(grid, comm, cell, grid_span=fullspace, npts=[6, 6, 6], odd=.false., fft_usage=.false.)
84 point = matmul(grid%dh, real([1, 2, -1], dp))
85 DO ig = 1, SIZE(grid%g, 2)
86 CALL pw_real_fourier_aliases(grid, ig, vectors, nalias)
87 boundary = abs(grid%g_hat(:, ig)) == 3
88 IF (nalias /= 2**count(boundary)) error stop "Missing real Fourier boundary aliases."
89 phase = 0.0_dp
90 DO alias = 1, nalias
91 phase = phase + exp(cmplx(0.0_dp, dot_product(vectors(:, alias), point), dp))/real(nalias, dp)
92 END DO
93 IF (abs(phase - exp(cmplx(0.0_dp, dot_product(grid%g(:, ig), point), dp))) > 3.e-14_dp) THEN
94 error stop "Fourier boundary aliases changed the native grid phase."
95 END IF
96 IF (boundary(1) .AND. boundary(2)) THEN
97 IF (abs(sum(vectors(1, :nalias)*vectors(2, :nalias))/real(nalias, dp)) > 3.e-14_dp) THEN
98 error stop "A mixed odd kernel survived independent Nyquist reflection."
99 END IF
100 END IF
101 END DO
102 CALL pw_grid_release(grid)
103 END SUBROUTINE check_real_fourier_aliases
104
105! **************************************************************************************************
106!> \brief Check cube precision and read data with variable field widths and line wrapping.
107! **************************************************************************************************
108 SUBROUTINE check_cube_values()
109 CHARACTER(LEN=*), PARAMETER :: fixture = "pw_unittest_free_format.cube"
110 INTEGER, PARAMETER :: n = 5
111
112 INTEGER :: first, i, j, unit_nr
113 REAL(KIND=dp) :: cell(3, 3), reference(n**3)
114 TYPE(pw_grid_type), POINTER :: grid
115 TYPE(pw_r3d_rs_type) :: pw
116
117 reference = [(real(i, dp), i=1, SIZE(reference))]
118 reference(:2) = [-3.33004e-101_dp, -1.32487e-103_dp]
119 IF (para_env%is_source()) THEN
120 CALL open_file(fixture, unit_nr, file_status="REPLACE", file_action="WRITE")
121 WRITE (unit_nr, '(A)') "pw_unittest", "", "0 0 0 0", "5 1 0 0", "5 0 1 0", "5 0 0 1"
122 WRITE (unit_nr, cube_values_format) reference(:2)
123 WRITE (unit_nr, '(A)') ""
124 WRITE (unit_nr, '(A,*(I0,A1))') "3.0D0 ", (i, achar(9), i=4, SIZE(reference))
125 CALL close_file(unit_nr)
126 END IF
127 CALL para_env%sync()
128
129 NULLIFY (grid)
130 cell = 0.0_dp
131 DO i = 1, 3
132 cell(i, i) = real(n, dp)
133 END DO
134 CALL pw_grid_create(grid, para_env, cell, npts=[n, n, n], fft_usage=.false.)
135 CALL pw%create(grid)
136 CALL cube_to_pw(pw, fixture, 1.0_dp, para_env%num_pe > 1, silent=.true.)
137 DO i = grid%bounds_local(1, 1), grid%bounds_local(2, 1)
138 DO j = grid%bounds_local(1, 2), grid%bounds_local(2, 2)
139 first = ((i - grid%bounds(1, 1))*n + j - grid%bounds(1, 2))*n + 1
140 IF (.NOT. all(abs(pw%array(i, j, :)/reference(first:first + n - 1) - 1.0_dp) <= 4*epsilon(1.0_dp))) THEN
141 error stop "Incorrect cube values."
142 END IF
143 END DO
144 END DO
145 CALL pw%release()
146 CALL pw_grid_release(grid)
147 IF (para_env%is_source()) THEN
148 CALL open_file(fixture, unit_nr, file_status="OLD")
149 CALL close_file(unit_nr, file_status="DELETE")
150 END IF
151 END SUBROUTINE check_cube_values
152
153! **************************************************************************************************
154!> \brief Compare identical, permuted, redistributed, partial and empty PW grids.
155!> \param mode Layout variant; mode two changes only one rank's ordering.
156!> \author Thomas D. Kuehne (tkuehne@cp2k.org)
157! **************************************************************************************************
158 SUBROUTINE check_copy(mode)
159 INTEGER, INTENT(IN) :: mode
160
161 COMPLEX(dp), PARAMETER :: untouched = (-999.0_dp, 17.0_dp)
162
163 COMPLEX(dp) :: expected
164 INTEGER :: dimensions(1), i, j, nsource, ntarget, &
165 owner, rank
166 TYPE(pw_c1d_gs_type) :: destination, source
167 TYPE(pw_grid_type), TARGET :: source_grid, target_grid
168
169 rank = para_env%mepos
170 nsource = 7
171 IF (mode == 6 .OR. (mode >= 7 .AND. rank == 0)) nsource = 0
172 owner = rank
173 IF (mode == 3 .OR. mode == 8) owner = mod(rank + 1, para_env%num_pe)
174 ntarget = nsource
175 IF (mode == 4) ntarget = nsource - 1
176 IF (mode == 5) ntarget = nsource + 1
177 IF (mode == 8) ntarget = merge(0, 7, owner == 0)
178 ALLOCATE (source_grid%g_hat(3, nsource), target_grid%g_hat(3, ntarget))
179 ALLOCATE (source%array(nsource), destination%array(ntarget))
180 source%pw_grid => source_grid
181 destination%pw_grid => target_grid
182 dimensions = [para_env%num_pe]
183 CALL source_grid%para%group%create(para_env, 1, dimensions)
184 target_grid%para%group = source_grid%para%group
185 source_grid%ngpts_cut_local = nsource
186 target_grid%ngpts_cut_local = ntarget
187 DO i = 1, nsource
188 source_grid%g_hat(:, i) = [i, rank, 0]
189 source%array(i) = cmplx(i + 11*rank, -i - 3*rank, dp)
190 END DO
191 DO i = 1, ntarget
192 j = i
193 IF (mode == 1 .OR. (mode == 2 .AND. rank == 0)) j = ntarget + 1 - i
194 target_grid%g_hat(:, i) = [j, owner, 0]
195 END DO
196 destination%array(:) = untouched
197 CALL pw_copy_match(source, destination)
198 DO i = 1, ntarget
199 j = target_grid%g_hat(1, i)
200 expected = cmplx(j + 11*owner, -j - 3*owner, dp)
201 IF (mode == 5 .AND. j > nsource) expected = untouched
202 IF (abs(destination%array(i) - expected) > 1.e-14_dp) error stop 'Incorrect PW copy'
203 END DO
204 DEALLOCATE (source%array, destination%array)
205 CALL source_grid%para%group%free()
206 END SUBROUTINE check_copy
207
208! **************************************************************************************************
209!> \brief Check PW multiplicity and volume normalization, and auxiliary-density Poisson routes.
210! **************************************************************************************************
211 SUBROUTINE check_pw_integral_and_poisson()
212 REAL(dp), PARAMETER :: step = 5.e-4_dp, &
213 strain_steps(4) = [step, -step, 2.0_dp*step, -2.0_dp*step]
214
215 COMPLEX(dp) :: a_mode, b_mode
216 INTEGER :: axis, ig, sign_step, span, sumtype, test
217 REAL(dp) :: cell(3, 3), derivative, energy, energy_dv, energy_v, energy_v_dv, expected, &
218 expected_real, kernel, reference, shifted_g(3), strain_energy(4), stress(3, 3), &
219 stress_dv(3, 3), stress_only(3, 3), stress_v(3, 3), stress_v_dv(3, 3)
220 TYPE(mp_comm_type) :: comm
221 TYPE(pw_c1d_gs_type) :: a, b, gradient(3), gradient_v_dv(3), &
222 potential, potential_v_dv
223 TYPE(pw_grid_type), POINTER :: grid
224 TYPE(pw_poisson_type) :: poisson
225 TYPE(pw_r1d_gs_type) :: a_real, b_real
226
227 CALL comm%set_handle(mp_comm_world%get_handle())
228 ! Nonunit volume and an appreciable truncation factor exp(-pi).
229 cell = 0.0_dp
230 DO axis = 1, 3
231 cell(axis, axis) = 7.0_dp**(1.0_dp/3.0_dp)
232 END DO
233 a_mode = cmplx(0.4_dp, -0.2_dp, dp)
234 b_mode = cmplx(-0.7_dp, 0.9_dp, dp)
235 NULLIFY (grid)
236 DO span = fullspace, halfspace, -1
237 ! Reciprocal inputs and outputs need no FFT. The production grid still
238 ! supplies the distributed G0 ownership and half/full-space mappings.
239 CALL pw_grid_create(grid, comm, cell, grid_span=span, npts=[5, 5, 5], odd=.true., fft_usage=.false.)
240 CALL a%create(grid)
241 CALL b%create(grid)
242 CALL a_real%create(grid)
243 CALL b_real%create(grid)
244 CALL potential%create(grid)
245 CALL potential_v_dv%create(grid)
246 DO axis = 1, 3
247 CALL gradient(axis)%create(grid)
248 CALL gradient_v_dv(axis)%create(grid)
249 END DO
250 ALLOCATE (poisson%pw_pools(1))
251 CALL pw_pool_create(poisson%pw_pools(1)%pool, grid)
252 poisson%pw_level = 1
253 poisson%parameters%solver = pw_poisson_mt
254 poisson%parameters%periodic = [1, 1, 0]
255 poisson%parameters%mt_alpha = 1.0_dp
256 CALL pw_poisson_set(poisson, cell_hmat=cell, use_level=1)
257 DO test = 1, 2
258 ! Constant G0 only and G0 plus a Hermitian mode pair.
259 a%array = 0.0_dp
260 b%array = 0.0_dp
261 expected = 0.0_dp
262 expected_real = 0.0_dp
263 reference = 0.0_dp
264 IF (grid%have_g0) THEN
265 a%array(1) = 2.0_dp
266 b%array(1) = 3.0_dp
267 END IF
268 expected = 6.0_dp
269 expected_real = 6.0_dp
270 reference = 6.0_dp*mt2d_kernel_reference([0.0_dp, 0.0_dp, 0.0_dp], 3, cell(3, 3))
271 IF (test /= 1) THEN
272 DO ig = 1, grid%ngpts_cut_local
273 IF (any(grid%g_hat(2:3, ig) /= 0)) cycle
274 IF (grid%g_hat(1, ig) == 1) THEN
275 a%array(ig) = a_mode
276 b%array(ig) = b_mode
277 ELSE IF (grid%g_hat(1, ig) == -1) THEN
278 a%array(ig) = conjg(a_mode)
279 b%array(ig) = conjg(b_mode)
280 END IF
281 END DO
282 expected = expected + 2.0_dp*real(conjg(a_mode)*b_mode, dp)
283 expected_real = expected_real + 2.0_dp*real(a_mode, dp)*real(b_mode, dp)
284 kernel = mt2d_kernel_reference([2.0_dp*pi/cell(1, 1), 0.0_dp, 0.0_dp], 3, cell(3, 3))
285 reference = reference + 2.0_dp*real(conjg(a_mode)*b_mode, dp)*kernel
286 END IF
287 a_real%array = real(a%array, dp)
288 b_real%array = real(b%array, dp)
289 ! G0 must have weight one, the mode pair weight two, and both must
290 ! receive V=7 for an integral. just_sum retains the unscaled oracle.
291 DO sumtype = do_accurate_sum, do_standard_sum
292 CALL check_error(pw_integral_ab(a, b, sumtype=sumtype), 7.0_dp*expected, 3.e-14_dp)
293 CALL check_error(pw_integral_ab(a, b, sumtype=sumtype, just_sum=.true.), expected, 3.e-14_dp)
294 CALL check_error(pw_integral_ab(a_real, b_real, sumtype=sumtype), 7.0_dp*expected_real, 3.e-14_dp)
295 CALL check_error(pw_integral_ab(a_real, b_real, sumtype=sumtype, just_sum=.true.), &
296 expected_real, 3.e-14_dp)
297 CALL check_error(pw_integral_ab(a, b_real, sumtype=sumtype), 7.0_dp*expected_real, 3.e-14_dp)
298 CALL check_error(pw_integral_ab(a_real, b, sumtype=sumtype), 7.0_dp*expected_real, 3.e-14_dp)
299 END DO
300 CALL pw_poisson_solve(poisson, a, energy, h_stress=stress, aux_density=b)
301 CALL pw_poisson_solve(poisson, a, energy_dv, dvhartree=gradient, h_stress=stress_dv, aux_density=b)
302 CALL pw_poisson_solve(poisson, a, energy_v, potential, h_stress=stress_v, aux_density=b)
303 CALL pw_poisson_solve(poisson, a, energy_v_dv, potential_v_dv, dvhartree=gradient_v_dv, &
304 h_stress=stress_v_dv, aux_density=b)
305 CALL pw_poisson_solve(poisson, a, h_stress=stress_only, aux_density=b)
306 CALL check_error(energy, 0.5_dp*7.0_dp*reference, 3.e-13_dp)
307 CALL check_error(energy_dv, energy, 3.e-13_dp)
308 CALL check_error(energy_v, energy, 3.e-13_dp)
309 CALL check_error(energy_v_dv, energy, 3.e-13_dp)
310 CALL check_error(maxval(abs(stress_dv - stress)), 0.0_dp, 3.e-11_dp)
311 CALL check_error(maxval(abs(stress_v - stress)), 0.0_dp, 3.e-11_dp)
312 CALL check_error(maxval(abs(stress_v_dv - stress)), 0.0_dp, 3.e-11_dp)
313 CALL check_error(maxval(abs(stress_only - stress)), 0.0_dp, 3.e-11_dp)
314 IF (test == 2) THEN
315 ! Fixed Fourier charges Q=V*rho give E(epsilon)=V/2/(1+epsilon)
316 ! times the strained kernel sum. This absolute production-virial
317 ! oracle includes both G0/volume and the nonzero-mode kernel term.
318 DO sign_step = 1, 4
319 shifted_g = [2.0_dp*pi/cell(1, 1)/(1.0_dp + strain_steps(sign_step)), 0.0_dp, 0.0_dp]
320 reference = 6.0_dp*mt2d_kernel_reference([0.0_dp, 0.0_dp, 0.0_dp], 3, cell(3, 3)) &
321 + 2.0_dp*real(conjg(a_mode)*b_mode, dp)*mt2d_kernel_reference(shifted_g, 3, cell(3, 3))
322 strain_energy(sign_step) = 0.5_dp*7.0_dp*reference/(1.0_dp + strain_steps(sign_step))
323 END DO
324 derivative = (8.0_dp*(strain_energy(1) - strain_energy(2)) &
325 - strain_energy(3) + strain_energy(4))/(12.0_dp*step)
326 CALL check_error(stress(1, 1) + derivative, 0.0_dp, 3.e-9_dp)
327 END IF
328 DO ig = 1, grid%ngpts_cut_local
329 kernel = mt2d_kernel_reference(grid%g(:, ig), 3, cell(3, 3))
330 CALL check_error(abs(potential%array(ig) - kernel*a%array(ig)), 0.0_dp, 3.e-13_dp)
331 CALL check_error(abs(potential_v_dv%array(ig) - kernel*a%array(ig)), 0.0_dp, 3.e-13_dp)
332 DO axis = 1, 3
333 CALL check_error(abs(gradient(axis)%array(ig) &
334 - cmplx(0.0_dp, grid%g(axis, ig), dp)*kernel*a%array(ig)), 0.0_dp, 3.e-13_dp)
335 CALL check_error(abs(gradient_v_dv(axis)%array(ig) &
336 - cmplx(0.0_dp, grid%g(axis, ig), dp)*kernel*a%array(ig)), 0.0_dp, 3.e-13_dp)
337 END DO
338 END DO
339 END DO
340 CALL poisson%release()
341 CALL a%release()
342 CALL b%release()
343 CALL a_real%release()
344 CALL b_real%release()
345 CALL potential%release()
346 CALL potential_v_dv%release()
347 DO axis = 1, 3
348 CALL gradient(axis)%release()
349 CALL gradient_v_dv(axis)%release()
350 END DO
351 CALL pw_grid_release(grid)
352 END DO
353 END SUBROUTINE check_pw_integral_and_poisson
354
355! **************************************************************************************************
356!> \brief Compare the MT2D kernel and in-plane virial with independent strained-cell energies.
357! **************************************************************************************************
358 SUBROUTINE check_mt2d_kernel()
359 REAL(dp), PARAMETER :: step = 3.e-4_dp, shifts(4) = [step, -step, 2.0_dp*step, -2.0_dp*step]
360
361 INTEGER :: alpha, beta, ip, iz, jp, miller(3), &
362 mode, modes(3, 5), sign_step
363 REAL(dp) :: derivative, g(3), h_inv(3, 3), kernel, &
364 lengths(3), shifted_g(3), &
365 shifted_kernel(4), strain(3, 3)
366
367 ! Rotate the Cartesian vacuum axis. A shear within the periodic plane is
368 ! permitted; only normal/periodic mixing is excluded by the MT2D kernel.
369 DO iz = 1, 3
370 ip = mod(iz, 3) + 1
371 jp = mod(iz + 1, 3) + 1
372 lengths = [9.0_dp, 13.0_dp, 17.0_dp]
373 h_inv = 0.0_dp
374 DO alpha = 1, 3
375 h_inv(alpha, alpha) = 1.0_dp/lengths(alpha)
376 END DO
377 h_inv(ip, jp) = -1.4_dp/(lengths(ip)*lengths(jp))
378 modes = 0
379 ! G=0, both odd and even normal-only modes, and several modes with
380 ! appreciable exponential truncation reject the periodic K**2 formula.
381 modes(iz, 2:3) = [1, 2]
382 modes(ip, 4) = 1
383 modes(:, 5) = [1, 2, 1]
384 DO mode = 1, SIZE(modes, 2)
385 miller = modes(:, mode)
386 g = 2.0_dp*pi*matmul(transpose(h_inv), real(miller, dp))
387 CALL mt2d_kernel_strain(g, iz, lengths(iz), kernel, strain)
388 CALL check_error(kernel, mt2d_kernel_reference(g, iz, lengths(iz)), 3.e-14_dp)
389 CALL check_error(maxval(abs(strain(iz, :))), 0.0_dp, 0.0_dp)
390 CALL check_error(maxval(abs(strain(:, iz))), 0.0_dp, 0.0_dp)
391 IF (mode <= 3) CALL check_error(maxval(abs(strain)), 0.0_dp, 0.0_dp)
392 DO alpha = 1, 3
393 IF (alpha == iz) cycle
394 DO beta = 1, 3
395 IF (beta == iz) cycle
396 DO sign_step = 1, 4
397 ! g'=(I+epsilon_ab)^(-T) g, evaluated independently of dK.
398 shifted_g = g
399 IF (alpha == beta) THEN
400 shifted_g(beta) = g(beta)/(1.0_dp + shifts(sign_step))
401 ELSE
402 shifted_g(beta) = g(beta) - shifts(sign_step)*g(alpha)
403 END IF
404 shifted_kernel(sign_step) = mt2d_kernel_reference(shifted_g, iz, lengths(iz))
405 END DO
406 derivative = (8.0_dp*(shifted_kernel(1) - shifted_kernel(2)) &
407 - shifted_kernel(3) + shifted_kernel(4))/(12.0_dp*step)
408 CALL check_error(strain(alpha, beta), derivative, 3.e-9_dp)
409 END DO
410 END DO
411 END DO
412 END DO
413 END SUBROUTINE check_mt2d_kernel
414
415! **************************************************************************************************
416!> \brief Evaluate the original MT2D influence kernel independently of its strain derivative.
417!> \param g ...
418!> \param iz ...
419!> \param slab_size ...
420!> \return ...
421! **************************************************************************************************
422 FUNCTION mt2d_kernel_reference(g, iz, slab_size) RESULT(kernel)
423 REAL(dp), INTENT(IN) :: g(3)
424 INTEGER, INTENT(IN) :: iz
425 REAL(dp), INTENT(IN) :: slab_size
426 REAL(dp) :: kernel
427
428 REAL(dp) :: g2, g_parallel(3), radius
429
430 g2 = sum(g**2)
431 IF (g2 == 0.0_dp) THEN
432 kernel = pi*slab_size**2/2.0_dp
433 ELSE
434 g_parallel = g
435 g_parallel(iz) = 0.0_dp
436 radius = slab_size/2.0_dp
437 kernel = fourpi/g2 - fourpi/g2*cos(g(iz)*radius)*exp(-norm2(g_parallel)*radius)
438 END IF
439 END FUNCTION mt2d_kernel_reference
440
441! **************************************************************************************************
442!> \brief Require the scaled error to be finite and within the supplied tolerance.
443!> \param value ...
444!> \param reference ...
445!> \param tolerance ...
446! **************************************************************************************************
447 SUBROUTINE check_error(value, reference, tolerance)
448 REAL(dp), INTENT(IN) :: value, reference, tolerance
449
450 REAL(dp) :: error
451
452 error = abs(value - reference)/max(1.0_dp, abs(reference))
453 max_error = max(max_error, error)
454 IF (.NOT. (error <= tolerance)) THEN
455 print *, 'Coulomb check: value, reference, error, tolerance:', value, reference, error, tolerance
456 error stop 'PW integral or MT2D kernel check failed'
457 END IF
458 END SUBROUTINE check_error
459
460END PROGRAM pw_unittest
Utility routines to open and close files.
Definition cp_files.F:22
subroutine, public open_file(file_name, unit_number, file_status, file_form, file_action, file_position, file_pad, file_access, debug)
Opens a file and returns its logical unit number.
Definition cp_files.F:197
subroutine, public close_file(unit_number, file_status)
Closes an open file given by its logical unit number.
Definition cp_files.F:64
various routines to log and control the output. The idea is that decisions about where to log should ...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
CP2K C/C++ interface.
Definition libcp2k.F:20
subroutine, public cp2k_finalize()
...
Definition libcp2k.F:139
subroutine, public cp2k_init()
...
Definition libcp2k.F:104
Definition of mathematical constants and functions.
real(kind=dp), parameter, public pi
real(kind=dp), parameter, public fourpi
Interface to the message passing library MPI.
type(mp_comm_type), parameter, public mp_comm_world
subroutine, public mt2d_kernel_strain(g, special_dimension, slab_size, kernel, strain)
MT2D Coulomb kernel and its affine strain derivative in the periodic plane.
Definition mt_util.F:50
subroutine, public pw_copy_match(pw1, pw2)
copy a pw type variable
Definition pw_copy_all.F:43
integer, parameter, public halfspace
integer, parameter, public fullspace
This module defines the grid data type and some basic operations on it.
Definition pw_grids.F:36
subroutine, public pw_grid_release(pw_grid)
releases the given pw grid
Definition pw_grids.F:2197
subroutine, public pw_real_fourier_aliases(grid, index, vectors, count)
Physical wave vectors represented by one real full-box Fourier coefficient. Each even-grid boundary r...
Definition pw_methods.F:351
integer, parameter, public do_accurate_sum
Definition pw_methods.F:79
integer, parameter, public do_standard_sum
Definition pw_methods.F:79
subroutine, public pw_poisson_set(poisson_env, cell_hmat, parameters, pw_pools, use_level, mt_super_ref_pw_grid, dct_pw_grid, force_rebuild)
sets cell, grids and parameters used by the poisson solver You should call this at least once (and se...
functions related to the poisson solver on regular grids
integer, parameter, public pw_poisson_mt
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
subroutine, public pw_pool_create(pool, pw_grid, max_cache)
creates a pool for pw
Generate Gaussian cube files.
subroutine, public cube_to_pw(grid, filename, scaling, parallel_read, silent)
Computes the external density on the grid hacked from external_read_density.
character(len= *), parameter, public cube_values_format
subroutine check_real_fourier_aliases()
Preserve independent reflection symmetry on even real-grid Fourier boundaries.
Definition pw_unittest.F:70
program pw_unittest
Definition pw_unittest.F:8
type of a logger, at the moment it contains just a print level starting at which level it should be l...
stores all the informations relevant to an mpi environment
environment for the poisson solver