62 type(symmetries_t),
pointer :: symm
63 integer(int64),
allocatable :: map(:,:)
64 integer(int64),
allocatable :: map_inv(:,:)
65 type(accel_mem_t) :: map_buff
67 procedure symmetrize_lattice_vectors
74 type(symmetrizer_t),
intent(out) :: this
75 class(mesh_t),
intent(in) :: mesh
76 type(symmetries_t),
target,
intent(in) :: symm
78 integer :: nops, ip, iop, idir, idx(3)
79 real(real64) :: destpoint(3), srcpoint(3), srcpoint_inv(3), lsize(3), offset(3)
83 assert(mesh%box%dim <= 3)
90 safe_allocate(this%map(1:mesh%np, 1:nops))
91 safe_allocate(this%map_inv(1:mesh%np, 1:nops))
95 lsize = real(mesh%idx%ll, real64)
96 offset = real(mesh%idx%nr(1, :) + mesh%idx%enlarge, real64)
100 destpoint = real(idx, real64) - offset
103 assert(all(nint(destpoint) >= 0))
104 assert(all(nint(destpoint) < lsize))
107 destpoint = destpoint + offset
110 destpoint = destpoint/lsize
119 srcpoint = srcpoint*lsize
120 srcpoint_inv = srcpoint_inv*lsize
123 srcpoint = srcpoint - offset
124 srcpoint_inv = srcpoint_inv - offset
126 do idir = 1, symm%periodic_dim
127 if (nint(srcpoint(idir)) < 0 .or. nint(srcpoint(idir)) >= mesh%idx%ll(idir))
then
128 srcpoint(idir) = real(modulo(nint(srcpoint(idir)), mesh%idx%ll(idir)), real64)
130 if (nint(srcpoint_inv(idir)) < 0 .or. nint(srcpoint_inv(idir)) >= mesh%idx%ll(idir))
then
131 srcpoint_inv(idir) = real(modulo(nint(srcpoint_inv(idir)), mesh%idx%ll(idir)), real64)
134 assert(all(nint(srcpoint) >= 0))
135 assert(all(nint(srcpoint) < mesh%idx%ll))
136 srcpoint = srcpoint + offset
138 assert(all(nint(srcpoint_inv) >= 0))
139 assert(all(nint(srcpoint_inv) < mesh%idx%ll))
140 srcpoint_inv = srcpoint_inv + offset
143 assert(this%map(ip, iop) <= mesh%np_global)
145 assert(this%map_inv(ip, iop) <= mesh%np_global)
161 class(
mesh_t),
intent(in) :: mesh
163 integer :: nops, ip, iop
164 integer,
allocatable :: map_tmp(:,:)
168 if (
accel_is_enabled() .and. .not. mesh%parallel_in_domains .and. .not. this%map_buff%allocated)
then
169 assert(
allocated(this%map))
171 safe_allocate(map_tmp(1:mesh%np, 1:nops))
176 map_tmp(ip, iop) = int(this%map(ip, iop) - 1, int32)
181 safe_deallocate_a(map_tmp)
195 safe_deallocate_a(this%map)
196 safe_deallocate_a(this%map_inv)
213 integer,
intent(in) :: size
214 real(real64),
intent(in) :: initial_rlattice(size,size)
215 real(real64),
intent(inout) :: rlattice(size,size)
216 logical,
intent(in) :: symmetrize
218 real(real64) :: strain(size,size), inv_initial_rlattice(size,size)
219 real(real64),
parameter :: tol_small = 1.0e-14_real64
226 inv_initial_rlattice = initial_rlattice
230 strain = matmul(rlattice, inv_initial_rlattice)
236 strain =
m_half * (strain + transpose(strain))
243 rlattice = matmul(strain, initial_rlattice)
254#include "symmetrizer_inc.F90"
257#include "complex.F90"
258#include "symmetrizer_inc.F90"
subroutine, public accel_free_buffer(this, async)
pure logical function, public accel_is_enabled()
integer, parameter, public accel_mem_read_only
This module implements batches of mesh functions.
This module implements common operations on batches of mesh functions.
real(real64), parameter, public m_half
This module implements the index, used for the mesh points.
This module is intended to contain "only mathematical" functions and procedures.
subroutine, public dzero_small_elements_matrix(aa, tol)
This module defines the meshes, which are used in Octopus.
integer(int64) function, public mesh_global_index_from_coords(mesh, ix)
This function returns the true global index of the point for a given vector of integer coordinates.
subroutine, public mesh_local_index_to_coords(mesh, ip, ix)
Given a local point index, this function returns the set of integer coordinates of the point.
Some general things and nomenclature:
subroutine, public profiling_out(label)
Increment out counter and sum up difference between entry and exit time.
subroutine, public profiling_in(label, exclude)
Increment in counter and save entry time.
integer pure function, public symmetries_number(this)
subroutine, public dsymmetrizer_apply(this, mesh, field, field_vector, symmfield, symmfield_vector, suppress_warning, reduced_quantity)
supply field and symmfield, and/or field_vector and symmfield_vector
subroutine, public dsymmetrizer_apply_batch(this, mesh, iop, src, dst)
Symmetrize a whole batch, returning another batch with the same layout.
subroutine, public dsymmetrize_magneto_optics_cart(symm, tensor)
subroutine, public symmetrizer_end(this)
subroutine, public zsymmetrizer_apply_batch(this, mesh, iop, src, dst)
Symmetrize a whole batch, returning another batch with the same layout.
subroutine, public zsymmetrizer_apply_single(this, mesh, iop, field, symmfield)
subroutine, public zsymmetrizer_apply(this, mesh, field, field_vector, symmfield, symmfield_vector, suppress_warning, reduced_quantity)
supply field and symmfield, and/or field_vector and symmfield_vector
subroutine, public dsymmetrizer_apply_single(this, mesh, iop, field, symmfield)
subroutine, public symmetrize_lattice_vectors(this, size, initial_rlattice, rlattice, symmetrize)
Given a symmetric lattice vector, symmetrize another one.
subroutine, public dsymmetrize_tensor_cart(symm, tensor, use_non_symmorphic)
Symmetric a rank-2 tensor defined in Cartesian space.
subroutine, public zsymmetrize_tensor_cart(symm, tensor, use_non_symmorphic)
Symmetric a rank-2 tensor defined in Cartesian space.
subroutine, public zsymmetrize_magneto_optics_cart(symm, tensor)
subroutine, public symmetrizer_init(this, mesh, symm)
subroutine, public symmetrizer_build_map_buffer(this, mesh)
Build the symmetrization map on GPU.
type(type_t), parameter, public type_integer
Describes mesh distribution to nodes.