49 logical :: oct_exchange = .false.
50 type(states_elec_t),
pointer :: oct_st => null()
51 real(real64),
allocatable :: oct_fxc(:, :, :)
52 real(real64),
allocatable :: oct_pot(:, :)
53 real(real64),
allocatable :: oct_rho(:, :)
60 type(oct_exchange_t),
intent(in) :: this
64 oct_exchange = this%oct_exchange
72 type(oct_exchange_t),
intent(inout) :: this
73 type(states_elec_t),
target,
intent(in) :: st
74 class(mesh_t),
intent(in) :: mesh
84 this%oct_exchange = .
true.
86 nspin = this%oct_st%d%nspin
88 safe_allocate(this%oct_fxc(1:np, 1:nspin, 1:nspin))
89 safe_allocate(this%oct_pot(1:np, 1:nspin))
90 safe_allocate(this%oct_rho(1:np, 1:nspin))
102 type(oct_exchange_t),
intent(inout) :: this
103 type(grid_t),
intent(in) :: gr
104 complex(real64),
intent(in) :: psi(:, :, :, :)
105 type(xc_t),
intent(in) :: xc
106 type(poisson_t),
intent(in) :: psolver
107 type(namespace_t),
intent(in) :: namespace
109 integer :: jst, ip, ik
110 complex(real64),
allocatable :: psi2(:, :)
114 safe_allocate(psi2(1:gr%np, 1:this%oct_st%d%dim))
116 select case (this%oct_st%d%ispin)
118 assert(this%oct_st%nik == 1)
122 do jst = 1, this%oct_st%nst
125 this%oct_rho(ip, 1) = this%oct_rho(ip, 1) + this%oct_st%occ(jst, 1)*aimag(conjg(psi2(ip, 1))*psi(ip, 1, jst, 1))
128 call dpoisson_solve(psolver, namespace, this%oct_pot(:, 1), this%oct_rho(:, 1), all_nodes = .false.)
131 assert(this%oct_st%nik == 2)
136 do jst = 1, this%oct_st%nst
139 this%oct_rho(ip, ik) = this%oct_rho(ip, ik) + this%oct_st%occ(jst, ik) * aimag(conjg(psi2(ip, 1))*psi(ip, 1, jst, ik))
145 call dpoisson_solve(psolver, namespace, this%oct_pot(:, ik), this%oct_rho(:, ik), all_nodes = .false.)
150 call xc_get_fxc(xc, gr, namespace, this%oct_st%rho, this%oct_st%d%ispin, this%oct_fxc)
152 safe_deallocate_a(psi2)
164 this%oct_exchange = .false.
165 safe_deallocate_a(this%oct_fxc)
166 safe_deallocate_a(this%oct_pot)
167 safe_deallocate_a(this%oct_rho)
176 class(
mesh_t),
intent(in) :: mesh
177 complex(real64),
intent(inout) :: hpsi(:, :)
178 integer,
intent(in) :: ist
179 integer,
intent(in) :: ik
182 complex(real64),
allocatable :: psi(:, :), psi2(:, :)
187 safe_allocate(psi(1:mesh%np, 1:this%oct_st%d%dim))
188 safe_allocate(psi2(1:mesh%np, 1:this%oct_st%d%dim))
190 select case (this%oct_st%d%ispin)
192 assert(this%oct_st%nik == 1)
195 hpsi(ip, 1) = hpsi(ip, 1) +
m_two*
m_zi*psi2(ip, 1)*(this%oct_pot(ip, 1) + this%oct_fxc(ip, 1, 1)*this%oct_rho(ip, 1))
199 assert(this%oct_st%nik == 2)
205 hpsi(ip, 1) = hpsi(ip, 1) +
m_two *
m_zi * this%oct_st%occ(ist, ik) * &
206 psi2(ip, 1) * (this%oct_pot(ip, ik2) + this%oct_fxc(ip, ik, ik2)*this%oct_rho(ip, ik2))
214 safe_deallocate_a(psi)
215 safe_deallocate_a(psi2)
This module calculates the derivatives (gradients, Laplacians, etc.) of a function.
integer, parameter, public unpolarized
Parameters...
integer, parameter, public spinors
integer, parameter, public spin_polarized
real(real64), parameter, public m_two
real(real64), parameter, public m_zero
complex(real64), parameter, public m_zi
This module implements the underlying real-space grid.
This module defines the meshes, which are used in Octopus.
subroutine, public messages_not_implemented(feature, namespace)
subroutine, public oct_exchange_prepare(this, gr, psi, xc, psolver, namespace)
logical function, public oct_exchange_enabled(this)
subroutine, public oct_exchange_remove(this)
subroutine, public oct_exchange_set(this, st, mesh)
subroutine, public oct_exchange_operator(this, namespace, mesh, hpsi, ist, ik)
subroutine, public dpoisson_solve(this, namespace, pot, rho, all_nodes, kernel, reset)
Calculates the Poisson equation. Given the density returns the corresponding potential.
This module handles spin dimensions of the states and the k-point distribution.
subroutine, public xc_get_fxc(xcs, gr, namespace, rho, ispin, fxc, fxc_grad, fxc_grad_spin)
Returns the exchange-correlation kernel.
Describes mesh distribution to nodes.