Octopus
|
A container for the phase. More...
A container for the phase.
Octopus stores in memory only the perioc part of the Bloch state. For some operations, like derivatives , we need the full Bloch state and we need to apply its phase. This does
\[ \psi \to \psi e^{\mp i(\mathbf{k}+\mathbf{A})\cdot\mathbf{r}} \]
where the sign is a minus if conjugate is false, \( \mathbf{k} \) is the k-point associated with the block of states \(\psi\), and \( \mathbf{A}\) is the dipole part of the vector potential present in the Hamiltonian.
The phase is updated by Hamiltonian_elec_update. The wfs_elec_oct_m::wfs_elec_t also stores the fact that the phase was added (wfs_elec_oct_m::wfs_elec_t::has_phase) and knows its k-point index (wfs_elec_oct_m::wfs_elec_t::ik), such that it can finds the phase to apply from the array stored in hamiltonian_elec_t::kpoints.
The phase must be set (phase_t::apply_phase() with conjugate=false) for np_part point after applying the boundary conditions such that the boundary points have the right phase \( e^{- i(\mathbf{k}+\mathbf{A})\cdot(\mathbf{r}+\mathbf{R})} \).
This is an optimisation technique. This is intended to be applied before the boundary conditions. Then boundary points are copied with the phase, but the code applies the phase correction at the time of copy. This allows in particular to not set and unset the phase when applying the Hamiltonian several time to some batch, like in eigensolver and exponential operators.
Public Attributes | |
complex(real64), dimension(:,:), allocatable, public | phase_corr |
phase correction: (grnp+1:grnp_part, hmdkptstart:hmdkptend); set in hamiltonian_elec_oct_m::hamiltonian_elec_init() More... | |
type(accel_mem_t), public | buff_phase_corr |
real(real64), dimension(:,:,:), pointer, public | spin => null() |
Private Member Functions | |
procedure | init => phase_init_phases |
Initiliaze the phase arrays and copy to GPU the data. More... | |
procedure | update => phase_update_phases |
Update the phases. More... | |
procedure | end => phase_end |
Releases the memory of the phase object. More... | |
procedure | set_phase_corr => phase_set_phase_corr |
set the phase correction (if necessary) More... | |
procedure | unset_phase_corr => phase_unset_phase_corr |
unset the phase correction (if necessary) More... | |
procedure | apply_to => phase_apply_batch |
apply (remove) the phase to the wave functions before (after) applying the Hamiltonian More... | |
procedure | apply_to_single => phase_apply_mf |
apply (or remove) the phase to a wave function psi More... | |
procedure | apply_phase_spiral => phase_phase_spiral |
apply spiral phase More... | |
procedure | is_allocated => phase_is_allocated |
Private Attributes | |
complex(real64), dimension(:, :), allocatable | phase |
phase factor: (1:grnp_part, hmdkptstart:hmdkptend); set in hamiltonian_elec_oct_m::hamiltonian_elec_init() More... | |
complex(real64), dimension(:,:), allocatable | phase_spiral |
phase for spiral boundaruy conditions: (1:grnp_part-sp, 1:2); set in hamiltonian_elec_oct_m::hamiltonian_elec_init() More... | |
type(accel_mem_t) | buff_phase |
type(accel_mem_t) | buff_phase_spiral |
integer | buff_phase_qn_start |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
apply (or remove) the phase to a wave function psi
States are usually stored without the phase. Due to the phase convention (exp(-i phase())), the phase is applied by multiplying with the complex conjugate of the phase() function, and removed by multiplying with phase().
[in,out] | psi | the complex wave function |
[in] | np | number of points |
[in] | conjugate | if .false.: apply the phase, if .true.: remove the phase |
|
private |
|
private |
phase factor: (1:grnp_part, hmdkptstart:hmdkptend); set in hamiltonian_elec_oct_m::hamiltonian_elec_init()
complex(real64), dimension(:,:), allocatable, public phase_oct_m::phase_t::phase_corr |
phase correction: (grnp+1:grnp_part, hmdkptstart:hmdkptend); set in hamiltonian_elec_oct_m::hamiltonian_elec_init()
|
private |
phase for spiral boundaruy conditions: (1:grnp_part-sp, 1:2); set in hamiltonian_elec_oct_m::hamiltonian_elec_init()
|
private |
|
private |
type(accel_mem_t), public phase_oct_m::phase_t::buff_phase_corr |
real(real64), dimension(:,:,:), pointer, public phase_oct_m::phase_t::spin => null() |