50 logical :: oct_exchange = .false.
51 type(states_elec_t),
pointer :: oct_st => null()
52 real(real64),
allocatable :: oct_fxc(:, :, :)
53 real(real64),
allocatable :: oct_pot(:, :)
54 real(real64),
allocatable :: oct_rho(:, :)
61 type(oct_exchange_t),
intent(in) :: this
65 oct_exchange = this%oct_exchange
73 type(oct_exchange_t),
intent(inout) :: this
74 type(states_elec_t),
target,
intent(in) :: st
75 class(mesh_t),
intent(in) :: mesh
85 this%oct_exchange = .
true.
87 nspin = this%oct_st%d%nspin
89 safe_allocate(this%oct_fxc(1:np, 1:nspin, 1:nspin))
90 safe_allocate(this%oct_pot(1:np, 1:nspin))
91 safe_allocate(this%oct_rho(1:np, 1:nspin))
103 type(oct_exchange_t),
intent(inout) :: this
104 type(grid_t),
intent(in) :: gr
105 complex(real64),
intent(in) :: psi(:, :, :, :)
106 type(xc_t),
intent(in) :: xc
107 type(poisson_t),
intent(in) :: psolver
108 type(namespace_t),
intent(in) :: namespace
110 integer :: jst, ip, ik
111 complex(real64),
allocatable :: psi2(:, :)
115 safe_allocate(psi2(1:gr%np, 1:this%oct_st%d%dim))
117 select case (this%oct_st%d%ispin)
119 assert(this%oct_st%nik == 1)
123 do jst = 1, this%oct_st%nst
126 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))
129 call dpoisson_solve(psolver, namespace, this%oct_pot(:, 1), this%oct_rho(:, 1), all_nodes = .false.)
132 assert(this%oct_st%nik == 2)
137 do jst = 1, this%oct_st%nst
140 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))
146 call dpoisson_solve(psolver, namespace, this%oct_pot(:, ik), this%oct_rho(:, ik), all_nodes = .false.)
151 call xc_get_fxc(xc, gr, namespace, this%oct_st%rho, this%oct_st%d%ispin, this%oct_fxc)
153 safe_deallocate_a(psi2)
165 this%oct_exchange = .false.
166 safe_deallocate_a(this%oct_fxc)
167 safe_deallocate_a(this%oct_pot)
168 safe_deallocate_a(this%oct_rho)
177 class(
mesh_t),
intent(in) :: mesh
178 complex(real64),
intent(inout) :: hpsi(:, :)
179 integer,
intent(in) :: ist
180 integer,
intent(in) :: ik
183 complex(real64),
allocatable :: psi(:, :), psi2(:, :)
188 safe_allocate(psi(1:mesh%np, 1:this%oct_st%d%dim))
189 safe_allocate(psi2(1:mesh%np, 1:this%oct_st%d%dim))
191 select case (this%oct_st%d%ispin)
193 assert(this%oct_st%nik == 1)
196 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))
200 assert(this%oct_st%nik == 2)
206 hpsi(ip, 1) = hpsi(ip, 1) +
m_two *
m_zi * this%oct_st%occ(ist, ik) * &
207 psi2(ip, 1) * (this%oct_pot(ip, ik2) + this%oct_fxc(ip, ik, ik2)*this%oct_rho(ip, ik2))
215 safe_deallocate_a(psi)
216 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.