23 use,
intrinsic :: ieee_exceptions
104 type(states_elec_t),
intent(inout) :: st
105 type(namespace_t),
intent(in) :: namespace
106 class(mesh_t),
intent(in) :: mesh
112 do ik = st%d%kpt%start, st%d%kpt%end
127 type(grid_t),
intent(in) :: grid
128 type(kpoints_t),
intent(in) :: kpoints
129 type(states_elec_t),
intent(in) :: st
130 real(real64),
contiguous,
intent(out) :: norm_ks(:, :)
132 integer :: ik_ispin, iblock, minst, maxst
140 do ik_ispin = st%d%kpt%start, st%d%kpt%end
141 do iblock = st%group%block_start, st%group%block_end
145 call mesh_batch_nrm2(grid, st%group%psib(iblock, ik_ispin), norm_ks(minst:maxst, ik_ispin), reduce=.false.)
150 if (grid%parallel_in_domains)
then
152 call grid%allreduce(norm_ks)
153 norm_ks =
sqrt(norm_ks)
171 class(mesh_t),
intent(in) :: mesh
172 type(states_elec_t),
intent(in) :: st
173 type(wfs_elec_t),
intent(in) :: psib1(:, st%d%kpt%start:)
174 type(wfs_elec_t),
intent(in) :: psib2(:, st%d%kpt%start:)
178 integer :: ik, ib, minst, maxst
179 type(wfs_elec_t) :: delta_psi
180 real(real64),
allocatable :: norm_k(:)
184 safe_allocate(norm_k(1:maxval(st%group%block_size)))
187 do ik = st%d%kpt%start, st%d%kpt%end
188 do ib = st%group%block_start, st%group%block_end
191 call psib2(ib, ik)%copy_to(delta_psi, copy_data=.
true.)
194 diff = diff + st%kweights(ik) * sum(st%occ(minst:maxst, ik) * norm_k(1:psib1(ib, ik)%nst)**2)
198 safe_deallocate_a(norm_k)
201 diff =
sqrt(diff / st%qtot)
210#include "states_elec_calc_inc.F90"
213#include "complex.F90"
214#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:
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.
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.
Some general things and nomenclature:
This module contains interfaces for ScaLAPACK routines Interfaces are from http:
pure logical function, public states_are_real(st)
subroutine, public zstates_elec_matrix(st1, st2, mesh, aa)
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 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_matrix(st1, st2, mesh, aa)
subroutine, public zstates_elec_calc_projections(st, gs_st, namespace, mesh, ik, proj, gs_nst)
This routine computes the projection between two 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 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, public states_elec_calc_norms(grid, kpoints, st, norm_ks)
Compute the norms of the Kohn-Sham orbitals.
subroutine, public dstates_elec_calc_projections(st, gs_st, namespace, mesh, ik, proj, gs_nst)
This routine computes the projection between two 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 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 zstates_elec_rotate(st, mesh, uu, ik)
real(real64) function, public dstates_elec_residue(mesh, dim, hf, ee, ff)
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.