23 use,
intrinsic :: ieee_exceptions
106 type(states_elec_t),
intent(inout) :: st
107 type(namespace_t),
intent(in) :: namespace
108 class(mesh_t),
intent(in) :: mesh
114 do ik = st%d%kpt%start, st%d%kpt%end
129 type(grid_t),
intent(in) :: grid
130 type(kpoints_t),
intent(in) :: kpoints
131 type(states_elec_t),
intent(in) :: st
132 real(real64),
contiguous,
intent(out) :: norm_ks(:, :)
133 type(nonlocal_pseudopotential_t),
optional,
intent(in) :: aug_overlap
134 type(phase_t),
optional,
intent(in) :: phase
136 integer :: ik_ispin, iblock, minst, maxst
137 type(wfs_elec_t) :: spsib
138 complex(real64),
allocatable :: sdiag(:)
149 do ik_ispin = st%d%kpt%start, st%d%kpt%end
150 do iblock = st%group%block_start, st%group%block_end
153 if (
present(aug_overlap))
then
155 call st%group%psib(iblock, ik_ispin)%copy_to(spsib)
157 st%group%psib(iblock, ik_ispin), spsib, phase=phase)
158 safe_allocate(sdiag(minst:maxst))
162 norm_ks(minst:maxst, ik_ispin) = real(sdiag, real64)
163 safe_deallocate_a(sdiag)
167 call mesh_batch_nrm2(grid, st%group%psib(iblock, ik_ispin), norm_ks(minst:maxst, ik_ispin), reduce=.false.)
173 if (
present(aug_overlap))
then
175 if (grid%parallel_in_domains)
call grid%allreduce(norm_ks)
177 else if (grid%parallel_in_domains)
then
179 call grid%allreduce(norm_ks)
180 norm_ks =
sqrt(norm_ks)
198 class(
mesh_t),
intent(in) :: mesh
201 type(
wfs_elec_t),
intent(in) :: psib2(:, st%d%kpt%start:)
205 integer :: ik, ib, minst, maxst
207 real(real64),
allocatable :: norm_k(:)
211 safe_allocate(norm_k(1:maxval(st%group%block_size)))
214 do ik = st%d%kpt%start, st%d%kpt%end
215 do ib = st%group%block_start, st%group%block_end
218 call psib2(ib, ik)%copy_to(delta_psi, copy_data=.
true.)
221 diff = diff + st%kweights(ik) * sum(st%occ(minst:maxst, ik) * norm_k(1:psib1(ib, ik)%nst)**2)
225 safe_deallocate_a(norm_k)
228 diff =
sqrt(diff / st%qtot)
237#include "states_elec_calc_inc.F90"
240#include "complex.F90"
241#include "states_elec_calc_inc.F90"
batchified version of the BLAS axpy routine:
double sqrt(double __x) __attribute__((__nothrow__
This module implements batches of mesh functions.
This module implements common operations on batches of mesh functions.
This module contains interfaces for BLACS routines Interfaces are from http://www....
This module contains interfaces for BLAS routines You should not use these routines directly....
This module calculates the derivatives (gradients, Laplacians, etc.) of a function.
real(real64), parameter, public m_zero
real(real64), parameter, public m_one
This module implements the underlying real-space grid.
This module is intended to contain "only mathematical" functions and procedures.
This module defines functions over batches of mesh functions.
subroutine, public mesh_batch_nrm2(mesh, aa, nrm2, reduce)
Calculate the norms (norm2, not the square!) of a batch of mesh functions.
subroutine, public zmesh_batch_dotp_vector(mesh, aa, bb, dot, reduce, cproduct)
A simple switch between specialized kernels and generic kernels.
This module defines various routines, operating on mesh functions.
This module defines the meshes, which are used in Octopus.
This module contains some common usage patterns of MPI routines.
subroutine, public znonlocal_pseudopotential_apply_overlap(this, mesh, std, psib, spsib, phase, spiral_bnd, apply_phase)
Apply the ultrasoft/PAW generalized overlap S = 1 + sum_ij |beta_i> q_ij <beta_j| (or,...
Some general things and nomenclature:
/* To use the profiling module, call profiling_in and profiling_out with the label of the region as a...
This module contains interfaces for ScaLAPACK routines Interfaces are from http://www....
pure logical function, public states_are_real(st)
subroutine, public states_elec_orthogonalize(st, namespace, mesh)
Orthogonalize electronic states.
real(real64) function, public states_elec_calc_orbital_difference(mesh, st, psib1, psib2)
Compute the occupation- and k-point-weighted RMS difference between two sets of orbitals.
subroutine, public dstates_elec_matrix(st1, st2, mesh, aa, aug_overlap, phase)
subroutine, public zstates_elec_orthogonalize_single(st, mesh, nst, iqn, phi, normalize, mask, overlap, norm, Theta_fi, beta_ij, against_all)
ofthogonalize a single wave function against a set of states
subroutine, public dstates_elec_orthogonalization_full(st, namespace, mesh, ik)
Orthonormalizes nst orbitals in mesh (honours state parallelization).
subroutine, public dstates_elec_rrqr_decomposition(st, namespace, mesh, act_bands, ik, jpvt)
Perform RRQR on the transpose states stored in the states object and return the pivot vector.
real(real64) function, public zstates_elec_residue(mesh, dim, hf, ee, ff)
subroutine, public dstates_elec_calc_projections(st, gs_st, namespace, mesh, ik, proj, gs_nst, aug_overlap, phase)
This routine computes the projection between two set of states.
subroutine, public zstates_elec_calc_orth_test(st, namespace, mesh, kpoints)
subroutine, public dstates_elec_orthogonalize_single_batch(st, mesh, nst, iqn, phi, normalize, mask, overlap, norm, Theta_fi, beta_ij, against_all)
orthogonalize a single wave function against a set of states
subroutine dstates_elec_rotate(st, mesh, uu, ik)
subroutine, public zstates_elec_orthogonalization(mesh, nst, dim, psi, phi, normalize, mask, overlap, norm, Theta_fi, beta_ij, gs_scheme)
Orthonormalizes phi to the nst orbitals psi.
subroutine, public zstates_elec_matrix(st1, st2, mesh, aa, aug_overlap, phase)
subroutine, public dstates_elec_calc_orth_test(st, namespace, mesh, kpoints)
subroutine, public zstates_elec_calc_overlap(st, mesh, ik, overlap)
Computes the overlap matrix of the Kohn-Sham states with k-point ik.
subroutine, public dstates_elec_orthogonalization(mesh, nst, dim, psi, phi, normalize, mask, overlap, norm, Theta_fi, beta_ij, gs_scheme)
Orthonormalizes phi to the nst orbitals psi.
subroutine, public dstates_elec_orthogonalize_single(st, mesh, nst, iqn, phi, normalize, mask, overlap, norm, Theta_fi, beta_ij, against_all)
ofthogonalize a single wave function against a set of states
subroutine, public zstates_elec_orthogonalize_single_batch(st, mesh, nst, iqn, phi, normalize, mask, overlap, norm, Theta_fi, beta_ij, against_all)
orthogonalize a single wave function against a set of states
subroutine, public zstates_elec_rrqr_decomposition(st, namespace, mesh, act_bands, ik, jpvt)
Perform RRQR on the transpose states stored in the states object and return the pivot vector.
subroutine, public zstates_elec_orthogonalization_full(st, namespace, mesh, ik)
Orthonormalizes nst orbitals in mesh (honours state parallelization).
subroutine, public states_elec_calc_norms(grid, kpoints, st, norm_ks, aug_overlap, phase)
Compute the norms of the Kohn-Sham orbitals.
subroutine zstates_elec_rotate(st, mesh, uu, ik)
real(real64) function, public dstates_elec_residue(mesh, dim, hf, ee, ff)
subroutine, public zstates_elec_calc_projections(st, gs_st, namespace, mesh, ik, proj, gs_nst, aug_overlap, phase)
This routine computes the projection between two set of states.
subroutine, public dstates_elec_calc_overlap(st, mesh, ik, overlap)
Computes the overlap matrix of the Kohn-Sham states with k-point ik.
This module handles spin dimensions of the states and the k-point distribution.
integer pure function, public states_elec_block_max(st, ib)
return index of last state in block ib
integer pure function, public states_elec_block_min(st, ib)
return index of first state in block ib
This module provides routines for communicating states when using states parallelization.
Describes mesh distribution to nodes.
The states_elec_t class contains all electronic wave functions.
batches of electronic states