33 use,
intrinsic :: iso_fortran_env
61 type(poisson_t),
pointer :: psolver
62 type(mesh_t),
pointer :: mesh
63 type(space_t),
pointer :: space
67 type(distributed_t),
pointer,
public :: atoms_dist => null()
68 type(atom_t),
pointer,
public :: atom(:) => null()
69 real(real64),
pointer,
public :: pos(:,:) => null()
70 type(lattice_vectors_t),
pointer :: latt => null()
73 type(namespace_t),
pointer :: namespace
75 logical :: have_density
79 type(double_grid_t) :: dgrid
84 type(distributed_t),
pointer :: atoms_dist_plane => null()
103 class(interaction_partner_t),
target,
intent(inout) :: partner
104 class(ion_electron_local_potential_t),
pointer :: this
110 this%label =
"ion-electron local"
112 this%partner => partner
119 class(ion_electron_local_potential_t),
intent(inout) :: this
120 class(mesh_t),
target,
intent(in) :: mesh
121 type(poisson_t),
target,
intent(in) :: psolver
122 type(ions_t),
target,
intent(in) :: ions
123 type(namespace_t),
target,
intent(in) :: namespace
125 type(double_grid_t),
optional,
intent(in) :: dgrid
127 type(distributed_t),
optional,
target,
intent(in) :: atoms_dist_plane
134 this%psolver => psolver
136 if (
present(dgrid)) this%dgrid = dgrid
137 if (
present(atoms_dist_plane)) this%atoms_dist_plane => atoms_dist_plane
139 safe_allocate(this%potential(1:mesh%np, 1))
141 this%have_density = .false.
142 do ia = 1, ions%nspecies
144 this%have_density = .
true.
149 this%atoms_dist => ions%atoms_dist
150 this%atom => ions%atom
151 this%space => ions%space
153 this%latt => ions%latt
155 this%namespace => namespace
165 type(
poisson_t),
target,
intent(in) :: psolver
166 type(
ions_t),
target,
intent(in) :: ions
170 this%psolver => psolver
171 this%atoms_dist => ions%atoms_dist
172 this%atom => ions%atom
173 this%space => ions%space
175 this%latt => ions%latt
185 real(real64),
allocatable :: density(:), rho(:), vl(:)
187 integer :: ia, ia_start, ia_end
193 this%potential(:,1) =
m_zero
195 if (this%have_density)
then
196 safe_allocate(density(1:this%mesh%np))
204 if (
associated(this%atoms_dist_plane))
then
205 ia_start = this%atoms_dist_plane%start
206 ia_end = this%atoms_dist_plane%end
208 ia_start = this%atoms_dist%start
209 ia_end = this%atoms_dist%end
212 do ia = ia_start, ia_end
219 safe_allocate(rho(1:this%mesh%np))
221 this%pos(:, ia), this%mesh, rho, sphere)
223 safe_deallocate_a(rho)
227 safe_allocate(vl(1:this%mesh%np))
228 call species_get_local(this%atom(ia)%species, this%namespace, this%space, this%latt, &
229 this%pos(:, ia), this%mesh, vl)
231 safe_deallocate_a(vl)
238 this%mesh, sphere, this%potential(:,1), this%dgrid)
243 if (
associated(this%atoms_dist_plane))
then
244 if (this%atoms_dist_plane%parallel)
then
245 call comm_allreduce(this%atoms_dist_plane%mpi_grp, this%potential(:,1), dim = this%mesh%np)
246 if (this%have_density)
then
247 call comm_allreduce(this%atoms_dist_plane%mpi_grp, density, dim = this%mesh%np)
250 else if (this%atoms_dist%parallel)
then
251 call comm_allreduce(this%atoms_dist%mpi_grp, this%potential(:,1), dim = this%mesh%np)
252 if (this%have_density)
then
253 call comm_allreduce(this%atoms_dist%mpi_grp, density, dim = this%mesh%np)
258 if (this%have_density)
then
260 safe_allocate(vl(1:this%mesh%np_part))
263 safe_deallocate_a(vl)
266 safe_deallocate_a(density)
279 safe_deallocate_a(this%potential)
281 nullify(this%psolver)
constant times a vector plus a vector
The Ono-Hirose double-grid technique [T. Ono and K. Hirose, Phys. Rev. Lett. 82, 5016 (1999); Phys....
logical pure function, public local_potential_has_density(space, species)
real(real64), parameter, public m_zero
real(real64), parameter, public m_one
This module defines the abstract interaction_t class, and some auxiliary classes for interactions.
subroutine, public interaction_end(this)
This module defines classes and functions for interaction partners.
subroutine ion_electron_local_potential_calculate(this)
subroutine ion_electron_local_potential_finalize(this)
subroutine ion_electron_local_potential_calculate_energy(this)
class(ion_electron_local_potential_t) function, pointer ion_electron_local_potential_constructor(partner)
subroutine ion_electron_local_potential_bind(this, psolver, ions)
Rebind ion-electron local potential helper pointers after a Hamiltonian copy. Ensure the local potent...
subroutine ion_electron_local_potential_init(this, mesh, psolver, ions, namespace, dgrid, atoms_dist_plane)
subroutine ion_electron_local_potential_end(this)
This module defines the meshes, which are used in Octopus.
subroutine, public dpoisson_solve(this, namespace, pot, rho, all_nodes, kernel, reset)
Calculates the Poisson equation. Given the density returns the corresponding potential.
/* To use the profiling module, call profiling_in and profiling_out with the label of the region as a...
subroutine, public profiling_out(label)
Increment out counter and sum up difference between entry and exit time.
subroutine, public profiling_in(label, exclude)
Increment in counter and save entry time.
This module defines the quantity_t class and the IDs for quantities, which can be exposed by a system...
subroutine, public species_get_local(species, namespace, space, latt, pos, mesh, vl)
used when the density is not available, or otherwise the Poisson eqn would be used instead
subroutine, public species_get_long_range_density(species, namespace, space, latt, pos, mesh, rho, sphere_inout, nlr_x)
subroutine, public species_get_local_sr(species, space, latt, pos, mesh, sphere, vpsl, dgrid)
Accumulate the short-range (localized) part of the local pseudopotential of one atom into vpsl,...
subroutine, public submesh_end(this)
A submesh is a type of mesh, used for the projectors in the pseudopotentials It contains points on a ...