32 use,
intrinsic :: iso_fortran_env
60 type(poisson_t),
pointer :: psolver
61 type(mesh_t),
pointer :: mesh
62 type(space_t),
pointer :: space
66 type(distributed_t),
pointer,
public :: atoms_dist => null()
67 type(atom_t),
pointer,
public :: atom(:) => null()
68 real(real64),
pointer,
public :: pos(:,:) => null()
69 type(lattice_vectors_t),
pointer :: latt => null()
72 type(namespace_t),
pointer :: namespace
74 logical :: have_density
93 class(interaction_partner_t),
target,
intent(inout) :: partner
94 class(ion_electron_local_potential_t),
pointer :: this
100 this%label =
"ion-electron local"
102 this%partner => partner
109 class(ion_electron_local_potential_t),
intent(inout) :: this
110 class(mesh_t),
target,
intent(in) :: mesh
111 type(poisson_t),
target,
intent(in) :: psolver
112 type(ions_t),
target,
intent(in) :: ions
113 type(namespace_t),
target,
intent(in) :: namespace
120 this%psolver => psolver
122 safe_allocate(this%potential(1:mesh%np, 1))
124 this%have_density = .false.
125 do ia = 1, ions%nspecies
127 this%have_density = .
true.
132 this%atoms_dist => ions%atoms_dist
133 this%atom => ions%atom
134 this%space => ions%space
136 this%latt => ions%latt
138 this%namespace => namespace
147 class(ion_electron_local_potential_t),
intent(inout) :: this
148 type(poisson_t),
target,
intent(in) :: psolver
149 type(ions_t),
target,
intent(in) :: ions
153 this%psolver => psolver
154 this%atoms_dist => ions%atoms_dist
155 this%atom => ions%atom
156 this%space => ions%space
158 this%latt => ions%latt
168 real(real64),
allocatable :: density(:), rho(:), vl(:)
170 type(
ps_t),
pointer :: ps
172 real(real64) :: radius
178 this%potential(:,1) =
m_zero
180 if (this%have_density)
then
181 safe_allocate(density(1:this%mesh%np))
185 do ia = this%atoms_dist%start, this%atoms_dist%end
192 safe_allocate(rho(1:this%mesh%np))
194 this%pos(:, ia), this%mesh, rho, sphere)
196 safe_deallocate_a(rho)
200 safe_allocate(vl(1:this%mesh%np))
201 call species_get_local(this%atom(ia)%species, this%namespace, this%space, this%latt, &
202 this%pos(:, ia), this%mesh, vl)
204 safe_deallocate_a(vl)
209 select type(spec=>this%atom(ia)%species)
215 if ( .not.
submesh_compatible(sphere,radius,this%pos(:,ia), minval(this%mesh%spacing(1:this%space%dim))) )
then
216 call submesh_init(sphere, this%space, this%mesh, this%latt, this%pos(:, ia), radius)
218 safe_allocate(vl(1:sphere%np))
221 if(sphere%r(ip) <= radius)
then
230 safe_deallocate_a(vl)
237 if (this%atoms_dist%parallel)
then
238 call comm_allreduce(this%atoms_dist%mpi_grp, this%potential(:,1), dim = this%mesh%np)
239 if (this%have_density)
then
240 call comm_allreduce(this%atoms_dist%mpi_grp, density, dim = this%mesh%np)
245 if (this%have_density)
then
247 safe_allocate(vl(1:this%mesh%np_part))
250 safe_deallocate_a(vl)
253 safe_deallocate_a(density)
266 safe_deallocate_a(this%potential)
268 nullify(this%psolver)
constant times a vector plus a vector
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_end(this)
subroutine ion_electron_local_potential_init(this, mesh, psolver, ions, namespace)
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.
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)
real(real64) function, public spline_eval(spl, x)
real(real64) pure function, public spline_range_max(this)
subroutine, public submesh_end(this)
logical function, public submesh_compatible(this, radius, center, dx)
subroutine, public submesh_init(this, space, mesh, latt, center, rc)
A type storing the information and data about a pseudopotential.
A submesh is a type of mesh, used for the projectors in the pseudopotentials It contains points on a ...