Octopus
phase_oct_m::phase_t Type Reference

A container for the phase. More...

Detailed Description

A container for the phase.

the phase of the wave function:

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})} \).

The phase correction

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.

Definition at line 177 of file phase.F90.

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_tbuff_phase
 
type(accel_mem_tbuff_phase_spiral
 
integer buff_phase_qn_start
 

Member Function/Subroutine Documentation

◆ init()

procedure phase_oct_m::phase_t::init
private

Initiliaze the phase arrays and copy to GPU the data.

Definition at line 194 of file phase.F90.

◆ update()

procedure phase_oct_m::phase_t::update
private

Update the phases.

Definition at line 196 of file phase.F90.

◆ end()

procedure phase_oct_m::phase_t::end
private

Releases the memory of the phase object.

Definition at line 198 of file phase.F90.

◆ set_phase_corr()

procedure phase_oct_m::phase_t::set_phase_corr
private

set the phase correction (if necessary)

Definition at line 200 of file phase.F90.

◆ unset_phase_corr()

procedure phase_oct_m::phase_t::unset_phase_corr
private

unset the phase correction (if necessary)

Definition at line 202 of file phase.F90.

◆ apply_to()

procedure phase_oct_m::phase_t::apply_to
private

apply (remove) the phase to the wave functions before (after) applying the Hamiltonian

Definition at line 204 of file phase.F90.

◆ apply_to_single()

procedure phase_oct_m::phase_t::apply_to_single
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().

Parameters
[in,out]psithe complex wave function
[in]npnumber of points
[in]conjugateif .false.: apply the phase, if .true.: remove the phase

Definition at line 206 of file phase.F90.

◆ apply_phase_spiral()

procedure phase_oct_m::phase_t::apply_phase_spiral
private

apply spiral phase

Definition at line 208 of file phase.F90.

◆ is_allocated()

procedure phase_oct_m::phase_t::is_allocated
private

Definition at line 210 of file phase.F90.

Member Data Documentation

◆ phase

complex(real64), dimension(:, :), allocatable phase_oct_m::phase_t::phase
private

phase factor: (1:grnp_part, hmdkptstart:hmdkptend); set in hamiltonian_elec_oct_m::hamiltonian_elec_init()

Definition at line 179 of file phase.F90.

◆ phase_corr

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()

Definition at line 182 of file phase.F90.

◆ phase_spiral

complex(real64), dimension(:,:), allocatable phase_oct_m::phase_t::phase_spiral
private

phase for spiral boundaruy conditions: (1:grnp_part-sp, 1:2); set in hamiltonian_elec_oct_m::hamiltonian_elec_init()

Definition at line 185 of file phase.F90.

◆ buff_phase

type(accel_mem_t) phase_oct_m::phase_t::buff_phase
private

Definition at line 188 of file phase.F90.

◆ buff_phase_spiral

type(accel_mem_t) phase_oct_m::phase_t::buff_phase_spiral
private

Definition at line 189 of file phase.F90.

◆ buff_phase_corr

type(accel_mem_t), public phase_oct_m::phase_t::buff_phase_corr

Definition at line 190 of file phase.F90.

◆ buff_phase_qn_start

integer phase_oct_m::phase_t::buff_phase_qn_start
private

Definition at line 191 of file phase.F90.

◆ spin

real(real64), dimension(:,:,:), pointer, public phase_oct_m::phase_t::spin => null()

Definition at line 192 of file phase.F90.


The documentation for this type was generated from the following file: