(git:f2099e5)
Loading...
Searching...
No Matches
topology_phasons.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
8! **************************************************************************************************
9!> \brief Native, bounded-memory snapshot/link postprocessor for closed 2D/4D parameter meshes.
10!> \note No SCF solver or external topology package is invoked. Run one process with OpenMP threads.
11! **************************************************************************************************
13 USE iso_fortran_env, ONLY: output_unit
14 USE kinds, ONLY: default_path_length,&
15 dp
23#include "./base/base_uses.f90"
24
25 IMPLICIT NONE
26 CHARACTER(LEN=default_path_length) :: mode, filename, arg, filename_b
27 TYPE(snapshot_type) :: left, right
28 TYPE(phason_result_type) :: coarse, fine
29 COMPLEX(KIND=dp), ALLOCATABLE :: overlap(:, :)
30 INTEGER :: ia, ib, shift(3), i, j, ios, io_unit
31 REAL(kind=dp) :: metric, gap
32
33 io_unit = output_unit
34 CALL get_command_argument(1, mode)
35 SELECT CASE (trim(mode))
36 CASE ('overlap')
37 IF (command_argument_count() /= 8) THEN
38 cpabort('Usage: topology_phasons overlap left point right point gx gy gz')
39 END IF
40 CALL get_command_argument(2, filename)
41 CALL get_command_argument(3, arg)
42 READ (arg, *, iostat=ios) ia
43 cpassert(ios == 0)
44 CALL get_command_argument(4, filename_b)
45 CALL get_command_argument(5, arg)
46 READ (arg, *, iostat=ios) ib
47 cpassert(ios == 0)
48 DO i = 1, 3
49 CALL get_command_argument(5 + i, arg)
50 READ (arg, *, iostat=ios) shift(i)
51 cpassert(ios == 0)
52 END DO
53 CALL read_snapshot(trim(filename), ia, left)
54 CALL read_snapshot(trim(filename_b), ib, right)
55 CALL check_snapshot(left, 1.e-7_dp, 1.e-7_dp, metric, gap)
56 CALL check_snapshot(right, 1.e-7_dp, 1.e-7_dp, metric, gap)
57 ALLOCATE (overlap(left%rank, right%rank))
58 CALL snapshot_overlap(left, right, left%k, right%k + real(shift, dp), overlap)
59 WRITE (io_unit, '(A,I0)') 'OVERLAP ', left%rank
60 DO j = 1, right%rank
61 DO i = 1, left%rank
62 WRITE (io_unit, '(2ES26.17)') real(overlap(i, j), dp), aimag(overlap(i, j))
63 END DO
64 END DO
65 CASE ('mesh', 'links')
66 IF (command_argument_count() /= 2) THEN
67 cpabort('Usage: topology_phasons mesh|links manifest')
68 END IF
69 CALL get_command_argument(2, filename)
70 CALL analyze_mesh(trim(filename), trim(mode) == 'mesh', fine, io_unit)
71 CASE ('converge', 'converge-links')
72 IF (command_argument_count() /= 4) THEN
73 cpabort('Usage: topology_phasons converge coarse fine tolerance')
74 END IF
75 CALL get_command_argument(2, filename)
76 CALL get_command_argument(3, filename_b)
77 CALL get_command_argument(4, arg)
78 READ (arg, *, iostat=ios) metric
79 cpassert(ios == 0)
80 CALL analyze_mesh(trim(filename), trim(mode) == 'converge', coarse, io_unit)
81 CALL analyze_mesh(trim(filename_b), trim(mode) == 'converge', fine, io_unit)
82 CALL compare_refinements(coarse, fine, metric, io_unit)
83 CASE DEFAULT
84 WRITE (io_unit, '(A)') 'Usage: topology_phasons mesh manifest | links file | overlap left point right point gx gy gz'
85 cpabort('Unknown or missing topology_phasons mode')
86 END SELECT
87END PROGRAM topology_phasons
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
integer, parameter, public default_path_length
Definition kinds.F:58
Native streaming mesh analysis with physical endpoint sewing.
subroutine, public analyze_mesh(path, physical, report, io_unit)
Build physical links or read reference links; stream plaquettes through an anonymous file.
subroutine, public compare_refinements(coarse, fine, tolerance, io_unit)
Compare two jointly refined meshes of the same declared family; never round the estimate.
Reader and physical moving-basis links for version-1 topology snapshots.
subroutine, public snapshot_overlap(a, b, ka, kb, overlap)
Apply screened Gaussian cross-geometry operator by atom blocks, without a dense AO matrix.
subroutine, public check_snapshot(a, metric_tol, gap_tol, metric_error, gap)
Check AO-metric normalization and separation at every selected/excluded boundary.
subroutine, public read_snapshot(filename, point, state)
Read a single point, retaining only its states; reject malformed/truncated exports.
program topology_phasons
Native, bounded-memory snapshot/link postprocessor for closed 2D/4D parameter meshes.