63 type(ions_t),
pointer :: ions => null()
70 integer :: atom1, atom2
71 real(real64),
allocatable :: mix1(:,:)
72 real(real64),
allocatable :: mix2(:,:)
76 generic ::
assignment(=) => copy_to
89 procedure perturbation_ionic_constructor
100 class(perturbation_ionic_t),
pointer :: pert
101 type(namespace_t),
intent(in) :: namespace
102 type(ions_t),
target,
intent(in) :: ions
116 type(perturbation_ionic_t),
intent(out) :: this
117 type(namespace_t),
intent(in) :: namespace
118 type(ions_t),
target,
intent(in) :: ions
129 this%pure_dir = .false.
131 safe_allocate(this%mix1(1:ions%natoms, 1:ions%space%dim))
132 safe_allocate(this%mix2(1:ions%natoms, 1:ions%space%dim))
139 class(perturbation_ionic_t),
intent(out) :: this
140 class(perturbation_ionic_t),
intent(in) :: source
145 this%atom1 = source%atom1
146 this%atom2 = source%atom2
147 this%ions => source%ions
149 this%pure_dir = source%pure_dir
151 safe_allocate(this%mix1(1:source%ions%natoms, 1:source%ions%space%dim))
152 safe_allocate(this%mix2(1:source%ions%natoms, 1:source%ions%space%dim))
153 this%mix1 = source%mix1
154 this%mix2 = source%mix2
166 safe_deallocate_a(this%mix1)
167 safe_deallocate_a(this%mix2)
184 integer,
intent(in) :: dir
185 integer,
optional,
intent(in) :: dir2
190 if (
present(dir2)) this%dir2 = dir2
197 if (this%dir > 0 .and. this%atom1 > 0) this%mix1(this%atom1, this%dir ) =
m_one
198 if (this%dir2 > 0 .and. this%atom2 > 0) this%mix2(this%atom2, this%dir2) =
m_one
206 integer,
intent(in) :: iatom
207 integer,
optional,
intent(in) :: iatom2
212 if (
present(iatom2)) this%atom2 = iatom2
214 this%pure_dir = .
true.
219 if (this%dir > 0 .and. this%atom1 > 0) this%mix1(this%atom1, this%dir ) =
m_one
220 if (this%dir2 > 0 .and. this%atom2 > 0) this%mix2(this%atom2, this%dir2) =
m_one
228 integer,
intent(in) :: iatom
229 integer,
intent(in) :: idir
230 real(real64),
intent(in) :: val
231 integer,
optional,
intent(in) :: jatom
232 integer,
optional,
intent(in) :: jdir
233 real(real64),
optional,
intent(in) :: valuej
235 logical :: have_dir_2
239 this%pure_dir = .false.
241 this%mix1(iatom, idir) = val
243 have_dir_2 =
present(jatom) .and.
present(jdir) .and.
present(jatom)
246 this%mix1(jatom, jdir) = valuej
248 assert(.not.
present(jatom) .and. .not.
present(jdir) .and. .not.
present(jatom))
258#include "perturbation_ionic_inc.F90"
261#include "complex.F90"
262#include "perturbation_ionic_inc.F90"
This module implements common operations on batches of mesh functions.
Module implementing boundary conditions in Octopus.
This module calculates the derivatives (gradients, Laplacians, etc.) of a function.
real(real64), parameter, public m_zero
real(real64), parameter, public m_one
This module implements the underlying real-space grid.
This module is intended to contain "only mathematical" functions and procedures.
This module defines functions over batches of mesh functions.
This module defines various routines, operating on mesh functions.
This module defines the meshes, which are used in Octopus.
subroutine perturbation_ionic_setup_mixed_dir(this, iatom, idir, val, jatom, jdir, valuej)
subroutine, public zionic_pert_matrix_elements_2(gr, namespace, space, ions, hm, ik, st, vib, matrix)
Computes the second order term.
subroutine perturbation_ionic_setup_atom(this, iatom, iatom2)
subroutine perturbation_ionic_init(this, namespace, ions)
subroutine perturbation_ionic_copy(this, source)
subroutine dperturbation_ionic_apply(this, namespace, space, gr, hm, ik, f_in, f_out, set_bc)
Returns f_out = H' f_in, where H' is perturbation Hamiltonian Note that e^ikr phase is applied to f_i...
subroutine, public dionic_pert_matrix_elements_2(gr, namespace, space, ions, hm, ik, st, vib, matrix)
Computes the second order term.
subroutine perturbation_ionic_info(this)
subroutine zperturbation_ionic_apply_order_2(this, namespace, space, gr, hm, ik, f_in, f_out)
subroutine zperturbation_ionic_apply(this, namespace, space, gr, hm, ik, f_in, f_out, set_bc)
Returns f_out = H' f_in, where H' is perturbation Hamiltonian Note that e^ikr phase is applied to f_i...
subroutine perturbation_ionic_finalize(this)
subroutine perturbation_ionic_setup_dir(this, dir, dir2)
class(perturbation_ionic_t) function, pointer perturbation_ionic_constructor(namespace, ions)
The factory routine (or constructor) allocates a pointer of the corresponding type and then calls the...
subroutine dperturbation_ionic_apply_order_2(this, namespace, space, gr, hm, ik, f_in, f_out)
subroutine, public perturbation_copy(this, source)
This module handles spin dimensions of the states and the k-point distribution.