![]() |
Octopus
|
This module implements a calculator for the density and defines related functions. More...
This module implements a calculator for the density and defines related functions.
It takes care of accumulating the orbital densities from all occupied states and performs the summation over k-points, if necessary. It also encapsulates the GPU operations.
Data Types | |
| type | density_calc_t |
| The calculator object. More... | |
Functions/Subroutines | |
| subroutine, public | density_calc_init (this, st, gr, density, ep, vnl, phase) |
| initialize the density calculator More... | |
| subroutine | density_calc_pack (this, async) |
| prepare the density calculator for GPU use More... | |
| subroutine | density_calc_state (this, psib, istin) |
| Calculate contribution to the density from state istin. More... | |
| subroutine, public | density_calc_accumulate (this, psib, async) |
| Accumulate weighted orbital densities for a batch psib. More... | |
| subroutine | density_calc_accumulate_aug (this, psib, ispin, weight) |
| Accumulate the real-space USPP augmentation density for one wavefunction batch. More... | |
| subroutine, public | density_calc_end (this, allreduce, symmetrize, buff_density) |
| Finalize the density calculation. More... | |
| subroutine, public | density_calc (st, gr, density, istin, ep, vnl, phase) |
| Computes the density from the orbitals in st. More... | |
| subroutine, public | states_elec_freeze_orbitals (st, namespace, space, gr, mc, kpoints, n, family_is_mgga) |
| Calculate partial density for frozen orbitals. More... | |
| subroutine, public | states_elec_freeze_redistribute_states (st, namespace, mesh, mc, nn) |
| subroutine, public | states_elec_freeze_adjust_qtot (st) |
| subroutine, public | states_elec_total_density (st, mesh, total_rho) |
| This routine calculates the total electronic density. More... | |
| subroutine, public | states_elec_sync_buff_density (st, mesh) |
| Synchronize the GPU density buffer with the host density strho. More... | |
| subroutine, public | ddensity_accumulate_grad (space, mesh, st, psib, grad_psib, grad_rho) |
| Accumulate \( \sum_i \psi_i^{*} \nabla \psi_i \) within a batch. More... | |
| subroutine, public | zdensity_accumulate_grad (space, mesh, st, psib, grad_psib, grad_rho) |
| Accumulate \( \sum_i \psi_i^{*} \nabla \psi_i \) within a batch. More... | |
| subroutine, public density_oct_m::density_calc_init | ( | type(density_calc_t), intent(out) | this, |
| type(states_elec_t), intent(in), target | st, | ||
| type(grid_t), intent(in), target | gr, | ||
| real(real64), dimension(:, :), intent(out), target, contiguous | density, | ||
| type(epot_t), intent(in), optional, target | ep, | ||
| type(nonlocal_pseudopotential_t), intent(inout), optional, target | vnl, | ||
| type(phase_t), intent(in), optional, target | phase | ||
| ) |
initialize the density calculator
Store pointers to the density, states and grid, initialize the density to zero and check that the array sizes are consistant.
Definition at line 178 of file density.F90.
|
private |
prepare the density calculator for GPU use
Definition at line 233 of file density.F90.
|
private |
Calculate contribution to the density from state istin.
The orbital density is already multiplied by the weight and occupation
Definition at line 254 of file density.F90.
| subroutine, public density_oct_m::density_calc_accumulate | ( | type(density_calc_t), intent(inout) | this, |
| type(wfs_elec_t), intent(in) | psib, | ||
| logical, intent(in), optional | async | ||
| ) |
Accumulate weighted orbital densities for a batch psib.
Definition at line 409 of file density.F90.
|
private |
Accumulate the real-space USPP augmentation density for one wavefunction batch.
Definition at line 581 of file density.F90.
| subroutine, public density_oct_m::density_calc_end | ( | type(density_calc_t), intent(inout) | this, |
| logical, intent(in), optional | allreduce, | ||
| logical, intent(in), optional | symmetrize, | ||
| type(accel_mem_t), intent(inout), optional | buff_density | ||
| ) |
Finalize the density calculation.
If GPU was used, copy the density back to CPU memory. In case of states or k-point parallelization, perform the reduction (unless specified otherwise), If requested, symmetrize the density If GPU was used, and an optional buffer is provided, save the density in it.
Definition at line 742 of file density.F90.
| subroutine, public density_oct_m::density_calc | ( | type(states_elec_t), intent(inout) | st, |
| type(grid_t), intent(in) | gr, | ||
| real(real64), dimension(:, :), intent(out), contiguous | density, | ||
| integer, intent(in), optional | istin, | ||
| type(epot_t), intent(in), optional, target | ep, | ||
| type(nonlocal_pseudopotential_t), intent(inout), optional, target | vnl, | ||
| type(phase_t), intent(in), optional, target | phase | ||
| ) |
Computes the density from the orbitals in st.
This routine handles the sum over states, and if present state or k-point parallelization. Optionally, a state resolved density can be calculated.
| [in,out] | st | the states for which the density is calculated |
| [in] | gr | the underlying grid |
| [out] | density | the resulting density |
| [in] | istin | optional state index for orbital densities |
| [in] | phase | Bloch phase, required for USPP augmentation at k /= 0 |
Definition at line 838 of file density.F90.
| subroutine, public density_oct_m::states_elec_freeze_orbitals | ( | type(states_elec_t), intent(inout) | st, |
| type(namespace_t), intent(in) | namespace, | ||
| class(space_t), intent(in) | space, | ||
| type(grid_t), intent(in) | gr, | ||
| type(multicomm_t), intent(in) | mc, | ||
| type(kpoints_t), intent(in) | kpoints, | ||
| integer, intent(in) | n, | ||
| logical, intent(in) | family_is_mgga | ||
| ) |
Calculate partial density for frozen orbitals.
Definition at line 886 of file density.F90.
| subroutine, public density_oct_m::states_elec_freeze_redistribute_states | ( | type(states_elec_t), intent(inout) | st, |
| type(namespace_t), intent(in) | namespace, | ||
| class(mesh_t), intent(in) | mesh, | ||
| type(multicomm_t), intent(in) | mc, | ||
| integer, intent(in) | nn | ||
| ) |
Definition at line 1021 of file density.F90.
| subroutine, public density_oct_m::states_elec_freeze_adjust_qtot | ( | type(states_elec_t), intent(inout) | st | ) |
Definition at line 1049 of file density.F90.
| subroutine, public density_oct_m::states_elec_total_density | ( | type(states_elec_t), intent(in) | st, |
| class(mesh_t), intent(in) | mesh, | ||
| real(real64), dimension(:,:), intent(out), contiguous | total_rho | ||
| ) |
This routine calculates the total electronic density.
This is the sum of the part coming from the orbitals, the non-linear core corrections and the frozen orbitals.
Definition at line 1088 of file density.F90.
| subroutine, public density_oct_m::states_elec_sync_buff_density | ( | type(states_elec_t), intent(inout) | st, |
| class(mesh_t), intent(in) | mesh | ||
| ) |
Synchronize the GPU density buffer with the host density strho.
Definition at line 1116 of file density.F90.
| subroutine, public density_oct_m::ddensity_accumulate_grad | ( | class(space_t), intent(in) | space, |
| class(mesh_t), intent(in) | mesh, | ||
| type(states_elec_t), intent(in) | st, | ||
| type(wfs_elec_t), intent(in) | psib, | ||
| type(wfs_elec_t), dimension(:), intent(in), contiguous | grad_psib, | ||
| real(real64), dimension(:, :), intent(inout), contiguous | grad_rho | ||
| ) |
Accumulate \( \sum_i \psi_i^{*} \nabla \psi_i \) within a batch.
Definition at line 1206 of file density.F90.
| subroutine, public density_oct_m::zdensity_accumulate_grad | ( | class(space_t), intent(in) | space, |
| class(mesh_t), intent(in) | mesh, | ||
| type(states_elec_t), intent(in) | st, | ||
| type(wfs_elec_t), intent(in) | psib, | ||
| type(wfs_elec_t), dimension(:), intent(in), contiguous | grad_psib, | ||
| real(real64), dimension(:, :), intent(inout), contiguous | grad_rho | ||
| ) |
Accumulate \( \sum_i \psi_i^{*} \nabla \psi_i \) within a batch.
Definition at line 1396 of file density.F90.