43 real(real64),
pointer,
contiguous :: dprojectors(:, :) => null()
44 complex(real64),
pointer,
contiguous :: zprojectors(:, :) => null()
45 real(real64),
allocatable :: scal(:)
49 integer,
allocatable :: regions(:)
54 real(real64),
allocatable :: dmix(:, :, :)
55 complex(real64),
allocatable :: zmix(:, :, :)
59 real(real64),
allocatable :: qmix(:, :)
64 complex(real64),
allocatable :: zqmix(:, :, :)
65 integer,
allocatable :: l(:)
66 integer,
allocatable :: m(:)
67 integer,
allocatable :: channel(:)
68 integer,
allocatable :: beta_index(:)
69 logical :: is_cmplx = .false.
71 integer,
pointer,
contiguous :: map(:)
72 real(real64),
pointer,
contiguous :: position(:, :)
75 real(real64),
allocatable :: sphere_weights(:)
81 real(real64),
pointer,
contiguous :: aug_ylm(:, :) => null()
88 type(projector_matrix_t),
intent(out) :: this
89 integer,
intent(in) :: nprojs
90 type(submesh_t),
intent(in) :: sphere
91 logical,
intent(in) :: has_mix_matrix
92 logical,
optional,
intent(in) :: is_cmplx
93 logical,
optional,
intent(in) :: complex_mix
94 integer,
optional,
intent(in) :: nspin_channels
96 logical :: complex_mix_
97 integer :: nspin_channels_
101 this%npoints = sphere%np
103 this%nregions = sphere%num_regions
105 nullify(this%position)
110 safe_allocate(this%regions(1:this%nregions+1))
111 if (this%is_cmplx)
then
112 safe_allocate(this%zprojectors(1:this%npoints, 1:nprojs))
114 safe_allocate(this%dprojectors(1:this%npoints, 1:nprojs))
116 safe_allocate(this%scal(1:nprojs))
117 safe_allocate(this%l(1:nprojs))
118 safe_allocate(this%m(1:nprojs))
119 safe_allocate(this%channel(1:nprojs))
120 safe_allocate(this%beta_index(1:nprojs))
127 assert(nspin_channels_ == 1 .or. nspin_channels_ == 2)
129 if (has_mix_matrix)
then
130 if (complex_mix_)
then
131 safe_allocate(this%zmix(1:nprojs, 1:nprojs, 1:4))
133 safe_allocate(this%dmix(1:nprojs, 1:nprojs, 1:nspin_channels_))
146 logical,
optional,
intent(in) :: owns_data
150 safe_deallocate_a(this%regions)
152 safe_deallocate_p(this%dprojectors)
153 safe_deallocate_p(this%zprojectors)
155 nullify(this%dprojectors)
156 nullify(this%zprojectors)
158 safe_deallocate_p(this%aug_ylm)
159 nullify(this%aug_ylm)
160 safe_deallocate_a(this%scal)
161 safe_deallocate_a(this%sphere_weights)
162 safe_deallocate_a(this%dmix)
163 safe_deallocate_a(this%zmix)
164 safe_deallocate_a(this%qmix)
165 safe_deallocate_a(this%zqmix)
166 safe_deallocate_a(this%l)
167 safe_deallocate_a(this%m)
168 safe_deallocate_a(this%channel)
169 safe_deallocate_a(this%beta_index)
171 nullify(this%position)
176 this%is_cmplx = .false.
191 integer,
intent(in) :: lmaxq
193 integer :: ltot, mtot, lm, is
195 if (
associated(this%aug_ylm))
return
199 safe_allocate(this%aug_ylm(1:this%npoints, 1:(lmaxq + 1)**2))
201 do mtot = -ltot, ltot
202 lm = ltot*(ltot + 1) + mtot + 1
203 do is = 1, this%npoints
204 call ylmr_real(this%position(1:3, is), ltot, mtot, this%aug_ylm(is, lm))
This module is intended to contain "only mathematical" functions and procedures.
subroutine, public ylmr_real(xx, li, mi, ylm)
This is a Numerical Recipes-based subroutine computes real spherical harmonics ylm at position (x,...
/* To use the profiling module, call profiling_in and profiling_out with the label of the region as a...
subroutine, public projector_matrix_deallocate(this, owns_data)
subroutine, public projector_matrix_allocate(this, nprojs, sphere, has_mix_matrix, is_cmplx, complex_mix, nspin_channels)
subroutine, public projector_matrix_build_aug_ylm(this, lmaxq)
Build (once, lazily) the cached real spherical harmonics Y_LM at the sphere points.
A set of projectors defined on a submesh.