Branch data Line data Source code
1 : : !!****m* ABINIT/m_tdep_supercell
2 : : !! NAME
3 : : !! m_tdep_supercell
4 : : !!
5 : : !! FUNCTION
6 : : !! Module for defining a supercell for the purpose of aTDEP
7 : : !!
8 : : !! COPYRIGHT
9 : : !! Copyright (C) 2026-2026 ABINIT group (GA)
10 : : !! This file is distributed under the terms of the
11 : : !! GNU General Public Licence, see ~abinit/COPYING
12 : : !! or http://www.gnu.org/copyleft/gpl.txt .
13 : : !! For the initials of contributors, see ~abinit/doc/developers/contributors.txt .
14 : : !!
15 : : !! SOURCE
16 : :
17 : :
18 : : #if defined HAVE_CONFIG_H
19 : : #include "config.h"
20 : : #endif
21 : :
22 : : #include "abi_common.h"
23 : :
24 : : module m_tdep_supercell
25 : :
26 : : use defs_basis
27 : : use m_io_tools
28 : : use m_abicore
29 : : use m_errors
30 : : use m_xmpi
31 : :
32 : : use m_matrix, only : matr3inv, mati3det, mati3HNF
33 : : use m_atomdata, only : znucl2symbol
34 : : use m_crystal, only : crystal_t
35 : : use m_ifc_supercell, only : ifc_supercell_type
36 : :
37 : :
38 : : implicit none
39 : : !!***
40 : :
41 : : !----------------------------------------------------------------------
42 : :
43 : : !!****t* m_tdep_supercell/tdep_Supercell_type
44 : : !! NAME
45 : : !! tdep_Supercell_type
46 : : !!
47 : : !! FUNCTION
48 : : !! Supercell defined by an integer matrix (S).
49 : : !!
50 : : !! A supercell holds N unitcell and N lattice vectors R, with
51 : : !! N = det(S).
52 : : !! Different supercell matrices are equivalent if they have the same Hermite normal form (H).
53 : : !!
54 : : !! The Hermite normal form allows to enumerate a set of canonical lattice vectors (Rcan),
55 : : !! which form a compact box, in reduced coordinates.
56 : : !!
57 : : !! Any lattice vector R can be decomposed as
58 : : !! R = (H * t) + Rcan
59 : : !! where t(3) is an integer vector. This decomposition defines the modulo operation
60 : : !! with respect to H (modH) as
61 : : !! Rcan = modH(R)
62 : : !! Two R vectors are equivalent if they correspond to the same canonical vector.
63 : : !!
64 : : !! A supercell shift (R_sh) is a lattice vector whose canonical coordinates are zero.
65 : : !!
66 : : !! Since the canonical lattice vectors form a compact box,
67 : : !! there exist a natural order to enumerate the lattice vectors,
68 : : !! and therefore there is a natural ordering for the atoms of the supercell.
69 : : !!
70 : : !! Note that the Canonical coordinates of the R vectors in this context
71 : : !! are not the same as the canonical coordinates read by the IFC,
72 : : !! which correspond here to the reduced coordinates of R vectors.
73 : : !!
74 : : !! The supercell defines three different coordinate systems within a supercell:
75 : : !! cartesian coordinates, unitcell reduced coordinates, supercell reduced coordinates.
76 : : !!
77 : : !! GA: Should eventually replace m_dynmat/make_bigbox and m_supercell
78 : : !!
79 : : !! SOURCE
80 : :
81 : :
82 : : ! Subclass (Child)
83 : : type, extends(ifc_supercell_type) :: tdep_Supercell_type
84 : :
85 : : contains
86 : :
87 : : procedure :: calc_dij => tdep_supercell_calc_dij
88 : : ! Compute the distance and cartesian vector between all pairs of atoms
89 : : ! in the supercell, and store the result in SC%dij. Optional: call this
90 : : ! only if SC%dij is actually needed.
91 : :
92 : :
93 : : end type tdep_Supercell_type
94 : : !!***
95 : :
96 : : contains
97 : : !!***
98 : :
99 : : !----------------------------------------------------------------------
100 : :
101 : : !!****f* m_tdep_supercell/supercell_calc_dij
102 : : !! NAME
103 : : !! supercell_calc_dij
104 : : !!
105 : : !! FUNCTION
106 : : !! Compute the cartesian vector and distance between all pairs of atoms
107 : : !! in the supercell, using the minimum image convention, and store the
108 : : !! result in SC%dij. This array is not needed by all callers, so it is
109 : : !! not computed as part of supercell_init: call this routine explicitly
110 : : !! whenever SC%dij is required.
111 : : !!
112 : : !! SIDE EFFECTS
113 : : !! SC=supercell object, dij is allocated (if needed) and filled on output
114 : : !!
115 : : !! SOURCE
116 : :
117 : 46 : subroutine tdep_supercell_calc_dij(SC)
118 : :
119 : : class(tdep_Supercell_type),intent(inout) :: SC
120 : :
121 : : integer :: iatom,jatom
122 : : real(dp) :: xij(3)
123 : : real(dp) :: dist
124 : :
125 [ + - ]: 46 : if (.not. allocated(SC%dij)) then
126 [ - + + - : 230 : ABI_MALLOC(SC%dij, (SC%natom,SC%natom,4))
- + + - +
- + - + -
- + - + -
+ ]
127 : : end if
128 : :
129 [ + + ]: 7324 : do iatom=1,SC%natom
130 [ + + ]: 1558688 : do jatom=1,SC%natom
131 : 1551364 : call SC%atoms_distance(iatom, jatom, xij, dist)
132 : 1551364 : SC%dij(iatom,jatom,1) = dist
133 [ + + ]: 6212734 : SC%dij(iatom,jatom,2:4) = xij(1:3)
134 : : end do
135 : : end do
136 : :
137 : 46 : end subroutine tdep_supercell_calc_dij
138 : : !!***
139 : :
140 : : !----------------------------------------------------------------------
141 : :
142 : : ! Find the list of R vectors belonging to the shell of lattice vector R.
143 : :
144 : : ! subroutine supercell_find_R_shell(SC, RR, N_shell, R_shell, dist)
145 : : ! class(tdep_Supercell_type),intent(in) :: SC
146 : : ! integer, intent(in) :: RR(3)
147 : : ! real(dp), intent(out) :: dist
148 : : ! integer, intent(out) :: N_shell
149 : : ! integer, allocatable, intent(out) :: R_shell(:,:) ! R_shell(N_shell, 3)
150 : : !
151 : : ! end subroutine supercell_find_R_shell
152 : :
153 : : ! Find the list of R vectors belonging to the shell of lattice vector R.
154 : : !subroutine supercell_find_atom_shell(SC, iat, N_shell, R_shell, dist)
155 : : ! class(tdep_Supercell_type),intent(in) :: SC
156 : : ! integer, intent(in) :: iat
157 : : ! real(dp), intent(out) :: dist
158 : : ! integer, intent(out) :: N_shell
159 : : ! integer, allocatable, intent(out) :: R_shell(:,:)
160 : : !
161 : : !end subroutine supercell_find_atom_shell
162 : :
163 : : !----------------------------------------------------------------------
164 : :
165 [ # # # # : 0 : end module m_tdep_supercell
# # # # #
# # # # #
# # ]
|