42 use,
intrinsic :: iso_fortran_env
101 class(space_t),
intent(in) :: space
102 class(namespace_t),
intent(in) :: namespace
103 type(grid_t),
intent(in) :: gr
104 type(ions_t),
intent(in) :: ions
105 type(hamiltonian_elec_t),
intent(in) :: hm
106 type(states_elec_t),
intent(in) :: st
107 real(real64),
contiguous,
intent(inout) :: x(:)
126 type(grid_t),
intent(in) :: gr
127 type(namespace_t),
intent(in) :: namespace
128 type(ions_t),
intent(inout) :: ions
129 type(hamiltonian_elec_t),
intent(in) :: hm
130 type(states_elec_t),
intent(in) :: psi
131 type(states_elec_t),
intent(in) :: chi
132 real(real64),
contiguous,
intent(inout) :: ff(:, :)
133 real(real64),
intent(in) :: qq(:, :)
135 integer :: jatom, idim, jdim
136 integer,
target :: j, ist, ik, iatom
137 real(real64) :: rr, w2r, w1r, xx(ions%space%dim), dq, pdot3p, pdot3m, pdot3p2, pdot3m2, dforce1, dforce2
138 complex(real64),
allocatable :: zpsi(:, :), derpsi(:, :, :)
139 real(real64),
allocatable :: forceks1p(:), forceks1m(:), forceks1p2(:), forceks1m2(:), dforceks1(:)
147 do iatom = 1, ions%natoms
148 do jatom = 1, ions%natoms
149 if (jatom == iatom) cycle
150 xx(1:ions%space%dim) = ions%pos(:, jatom) - ions%pos(:, iatom)
151 rr = norm2(xx(1:ions%space%dim))
152 w1r = - ions%charge(iatom) * ions%charge(jatom) / rr**2
153 w2r =
m_two * ions%charge(iatom) * ions%charge(jatom) / rr**3
154 do idim = 1, ions%space%dim
155 do jdim = 1, ions%space%dim
156 ff(iatom, idim) = ff(iatom, idim) + (qq(jatom, jdim) - qq(iatom, jdim)) * w2r * (
m_one/rr**2) * xx(idim) * xx(jdim)
157 ff(iatom, idim) = ff(iatom, idim) - (qq(jatom, jdim) - qq(iatom, jdim)) * w1r * (
m_one/rr**3) * xx(idim) * xx(jdim)
158 if (jdim == idim)
then
159 ff(iatom, idim) = ff(iatom, idim) + (qq(jatom, jdim) - qq(iatom, jdim)) * w1r * (
m_one/rr)
166 safe_allocate(derpsi(1:gr%np_part, 1:ions%space%dim, 1:psi%d%dim))
170 safe_allocate(forceks1p(1:ions%space%dim))
171 safe_allocate(forceks1m(1:ions%space%dim))
172 safe_allocate(forceks1p2(1:ions%space%dim))
173 safe_allocate(forceks1m2(1:ions%space%dim))
174 safe_allocate(dforceks1(1:ions%space%dim))
175 safe_allocate(zpsi(1:gr%np_part, 1:psi%d%dim))
182 do iatom = 1, ions%natoms
183 do j = 1, ions%space%dim
184 call force1(ions%pos(j, iatom) + dq, forceks1p, pdot3p)
185 call force1(ions%pos(j, iatom) - dq, forceks1m, pdot3m)
186 call force1(ions%pos(j, iatom) + dq/
m_two, forceks1p2, pdot3p2)
187 call force1(ions%pos(j, iatom) - dq/
m_two, forceks1m2, pdot3m2)
188 dforceks1 = ((
m_four/
m_three) * (forceks1p2 - forceks1m2) - (
m_one / 6.0_real64) * (forceks1p - forceks1m)) / dq
189 dforce1 = sum(qq(iatom, :) * dforceks1(:))
190 dforce2 = ((
m_four/
m_three) * (pdot3p2 - pdot3m2) - (
m_one / 6.0_real64) * (pdot3p - pdot3m)) / dq
191 ff(iatom, j) = ff(iatom, j) -
m_two * psi%occ(ist, ik) * dforce1 +
m_two * dforce2
197 safe_deallocate_a(zpsi)
198 safe_deallocate_a(forceks1p)
199 safe_deallocate_a(forceks1m)
200 safe_deallocate_a(forceks1p2)
201 safe_deallocate_a(forceks1m2)
202 safe_deallocate_a(dforceks1)
203 safe_deallocate_a(derpsi)
210 subroutine force1(qq, res, pdot3)
211 real(real64),
intent(in) :: qq
212 real(real64),
contiguous,
intent(inout) :: res(:)
213 real(real64),
intent(inout) :: pdot3
217 complex(real64),
allocatable :: viapsi(:, :), zpsi(:, :)
219 qold = ions%pos(j, iatom)
220 ions%pos(j, iatom) = qq
221 safe_allocate(viapsi(1:gr%np_part, 1:psi%d%dim))
222 safe_allocate(zpsi(1:gr%np_part, 1:psi%d%dim))
226 ions%pos(:, iatom), iatom, gr, zpsi, viapsi)
229 do m = 1, ubound(res, 1)
230 res(m) = real(
zmf_dotp(gr, viapsi(:, 1), derpsi(:, m, 1), reduce = .false.), real64)
232 call gr%allreduce(res)
235 pdot3 = real(
m_zi *
zmf_dotp(gr, zpsi(:, 1), viapsi(:, 1)), real64)
236 ions%pos(j, iatom) = qold
238 safe_deallocate_a(viapsi)
246 subroutine forces_calculate(gr, namespace, ions, hm, ext_partners, st, ks, vhxc_old, t, dt)
247 type(
grid_t),
intent(in) :: gr
249 type(
ions_t),
intent(inout) :: ions
253 type(
v_ks_t),
intent(in) :: ks
254 real(real64),
contiguous,
optional,
intent(in) :: vhxc_old(:,:)
255 real(real64),
optional,
intent(in) :: t
256 real(real64),
optional,
intent(in) :: dt
258 integer :: j, iatom, idir
259 real(real64) :: xx(ions%space%dim), time, global_force(ions%space%dim)
260 real(real64),
allocatable :: force(:, :), force_loc(:, :), force_nl(:, :), force_u(:, :)
261 real(real64),
allocatable :: force_nlcc(: ,:)
262 real(real64),
allocatable :: force_scf(:, :)
270 if (hm%ep%requires_generalized_overlap .and. hm%ep%reltype ==
spin_orbit)
then
274 if (hm%ep%has_paw)
then
279 if (
present(t)) time = t
282 do iatom = 1, ions%natoms
283 ions%atom(iatom)%f_ii(1:ions%space%dim) =
m_zero
284 ions%atom(iatom)%f_vdw(1:ions%space%dim) =
m_zero
285 ions%atom(iatom)%f_loc(1:ions%space%dim) =
m_zero
286 ions%atom(iatom)%f_nl(1:ions%space%dim) =
m_zero
287 ions%atom(iatom)%f_u(1:ions%space%dim) =
m_zero
288 ions%atom(iatom)%f_fields(1:ions%space%dim) =
m_zero
289 ions%atom(iatom)%f_nlcc(1:ions%space%dim) =
m_zero
290 ions%atom(iatom)%f_scf(1:ions%space%dim) =
m_zero
291 ions%atom(iatom)%f_photons(1:ions%space%dim) =
m_zero
296 if (ks%vdw%vdw_correction == option__vdwcorrection__vdw_ts)
then
300 do iatom = 1, ions%natoms
301 ions%tot_force(:, iatom) = hm%ep%fii(1:ions%space%dim, iatom) + hm%ep%vdw_forces(1:ions%space%dim, iatom)
302 if (ks%v_ks_photons%active())
then
303 ions%tot_force(:, iatom) = ions%tot_force(:, iatom) &
304 -
p_proton_charge*ions%charge(iatom)*hm%ep%photon_forces(1:ions%space%dim)
306 ions%atom(iatom)%f_ii(1:ions%space%dim) = hm%ep%fii(1:ions%space%dim, iatom)
307 ions%atom(iatom)%f_vdw(1:ions%space%dim) = hm%ep%vdw_forces(1:ions%space%dim, iatom)
308 ions%atom(iatom)%f_photons(1:ions%space%dim) = -
p_proton_charge*ions%charge(iatom)*hm%ep%photon_forces(1:ions%space%dim)
312 global_force = ions%global_force(time)
315 do iatom = 1, ions%natoms
316 ions%tot_force(:, iatom) = ions%tot_force(:, iatom) + global_force
317 ions%atom(iatom)%f_ii(1:ions%space%dim) = ions%atom(iatom)%f_ii(1:ions%space%dim) + global_force
321 safe_allocate(force(1:ions%space%dim, 1:ions%natoms))
322 safe_allocate(force_loc(1:ions%space%dim, 1:ions%natoms))
323 safe_allocate(force_nl(1:ions%space%dim, 1:ions%natoms))
324 safe_allocate(force_u(1:ions%space%dim, 1:ions%natoms))
325 safe_allocate(force_scf(1:ions%space%dim, 1:ions%natoms))
326 safe_allocate(force_nlcc(1:ions%space%dim, 1:ions%natoms))
335 .and. ks%theory_level /=
hartree .and. ks%theory_level /=
rdmft)
then
336 call forces_from_nlcc(gr, ions, st%d%spin_channels, hm%ks_pot%vxc, force_nlcc, hm%ep%dgrid)
340 if (
present(vhxc_old))
then
341 call forces_from_scf(gr, ions, st%d%spin_channels, hm%ks_pot%vhxc, vhxc_old, force_scf)
346 if (ions%force_total_enforce)
then
355 do iatom = 1, ions%natoms
356 do idir = 1, ions%space%dim
357 ions%tot_force(idir, iatom) = ions%tot_force(idir, iatom) + force(idir, iatom) &
358 + force_scf(idir, iatom) + force_nlcc(idir, iatom)
359 ions%atom(iatom)%f_loc(idir) = force_loc(idir, iatom)
360 ions%atom(iatom)%f_nl(idir) = force_nl(idir, iatom)
361 ions%atom(iatom)%f_u(idir) = force_u(idir, iatom)
362 ions%atom(iatom)%f_nlcc(idir) = force_nlcc(idir, iatom)
363 ions%atom(iatom)%f_scf(idir) = force_scf(idir, iatom)
367 safe_deallocate_a(force)
368 safe_deallocate_a(force_loc)
369 safe_deallocate_a(force_nl)
370 safe_deallocate_a(force_u)
371 safe_deallocate_a(force_nlcc)
372 safe_deallocate_a(force_scf)
376 if (
present(t) .and.
associated(lasers))
then
377 do j = 1, lasers%no_lasers
382 do iatom = 1, ions%natoms
384 ions%tot_force(:, iatom) = ions%tot_force(:, iatom) + ions%charge(iatom)*xx(:)
385 ions%atom(iatom)%f_fields(1:ions%space%dim) = ions%atom(iatom)%f_fields(1:ions%space%dim) &
386 + ions%charge(iatom)*xx(:)
398 do iatom = 1, ions%natoms
400 ions%tot_force(:, iatom) = ions%tot_force(:, iatom) + ions%charge(iatom)*xx(:)
401 ions%atom(iatom)%f_fields(1:ions%space%dim) = ions%atom(iatom)%f_fields(1:ions%space%dim) &
402 + ions%charge(iatom)*xx(:)
406 write(
message(1),
'(a)')
'The forces are currently not supported for nondipole '
407 write(
message(2),
'(a)')
'strong-field approximation Hamiltonian approach.'
412 write(
message(1),
'(a)')
'The forces are currently not properly calculated if time-dependent'
413 write(
message(2),
'(a)')
'magnetic fields are present.'
419 if (
allocated(hm%ep%e_field))
then
420 do iatom = 1, ions%natoms
422 ions%tot_force(:, iatom) = ions%tot_force(:, iatom) + ions%charge(iatom)*hm%ep%e_field(1:ions%space%dim)
423 ions%atom(iatom)%f_fields(1:ions%space%dim) = ions%atom(iatom)%f_fields(1:ions%space%dim) &
424 + ions%charge(iatom)*hm%ep%e_field(1:ions%space%dim)
428 if (
allocated(hm%ep%b_field) .or.
allocated(hm%ep%a_static))
then
429 write(
message(1),
'(a)')
'The forces are currently not properly calculated if static'
430 write(
message(2),
'(a)')
'magnetic fields or static vector potentials are present.'
435 write(
message(1),
'(a)')
'The forces are currently not properly calculated if gauge-field'
436 write(
message(2),
'(a)')
'is applied.'
445 if (hm%kpoints%use_symmetries .or. st%symmetrize_density)
then
450 if (ions%space%is_periodic())
then
462 type(
ions_t),
intent(in) :: ions
463 real(real64),
contiguous,
intent(inout) :: force(:, :)
465 real(real64),
allocatable :: total_force(:)
470 safe_allocate(total_force(1:ions%space%dim))
472 total_force(1:ions%space%dim) = sum(force, dim=2) / ions%natoms
474 do iatom = 1, ions%natoms
475 force(1:ions%space%dim, iatom) = force(1:ions%space%dim, iatom) - total_force(1:ions%space%dim)
478 safe_deallocate_a(total_force)
485 type(
ions_t),
intent(in) :: ions
486 real(real64),
contiguous,
intent(inout) :: total_torque(:)
488 real(real64) :: center_of_mass(ions%space%dim), rr(3), ff(3)
493 center_of_mass = ions%center_of_mass()
498 do iatom = 1, ions%natoms
499 rr(1:ions%space%dim) = ions%pos(1:ions%space%dim, iatom) - center_of_mass
500 ff(1:ions%space%dim) = ions%tot_force(1:ions%space%dim, iatom)
511 integer,
intent(in) :: iunit
512 type(
ions_t),
intent(in) :: ions
513 character(len=*),
intent(in) :: dir
516 integer :: iatom, idir, ii, iunit2
517 real(real64) :: torque(1:3)
519 if (.not. ions%grp%is_root())
return
524 write(iunit,
'(a,10x,99(14x,a))')
' Ion', (
index2axis(idir), idir = 1, ions%space%dim)
525 do iatom = 1, ions%natoms
526 write(iunit,
'(i4,a10,10es17.8)') iatom, trim(ions%atom(iatom)%species%get_label()), &
529 write(iunit,
'(1x,100a1)') (
"-", ii = 1, 13 + ions%space%dim * 15)
530 write(iunit,
'(a14, 10es17.8)')
" Max abs force", &
532 write(iunit,
'(a14, 10es17.8)')
" Total force", &
535 if ((ions%space%dim == 2 .or. ions%space%dim == 3) .and. .not. ions%space%is_periodic())
then
537 write(iunit,
'(a14, 10es17.8)')
' Total torque', &
543 iunit2 =
io_open(trim(dir)//
'/forces', namespace, action=
'write', position=
'asis')
544 write(iunit2,
'(a)') &
545 ' # Total force (x,y,z) Ion-Ion (x,y,z) VdW (x,y,z) Local (x,y,z) NL (x,y,z)' // &
546 ' Fields (x,y,z) Hubbard(x,y,z) SCF(x,y,z) NLCC(x,y,z) Phot (x,y,z)'
547 do iatom = 1, ions%natoms
548 write(iunit2,
'(i4,a10,30es17.8)') iatom, trim(ions%atom(iatom)%species%get_label()), &
571 subroutine forces_from_nlcc(mesh, ions, spin_channels, vxc, force_nlcc, dgrid)
572 type(
grid_t),
intent(in) :: mesh
573 type(
ions_t),
intent(inout) :: ions
574 integer,
intent(in) :: spin_channels
575 real(real64),
contiguous,
intent(in) :: vxc(:,:)
576 real(real64),
contiguous,
intent(out) :: force_nlcc(:, :)
579 integer :: is, iatom, idir
580 real(real64),
allocatable :: pot(:), grad_vxc(:, :)
586 safe_allocate(pot(1:mesh%np_part))
587 safe_allocate(grad_vxc(1:mesh%np, 1:ions%space%dim))
590 do is = 2, spin_channels
598 do iatom = ions%atoms_dist%start, ions%atoms_dist%end
599 call species_get_nlcc(ions%atom(iatom)%species, ions%space, ions%latt, ions%pos(:, iatom), mesh, pot, &
602 do idir = 1, ions%space%dim
603 force_nlcc(idir, iatom) = force_nlcc(idir, iatom) &
604 -
dmf_dotp(mesh, pot(:), grad_vxc(:, idir), reduce = .false.)
608 safe_deallocate_a(pot)
609 safe_deallocate_a(grad_vxc)
611 if (ions%atoms_dist%parallel)
call dforces_gather(ions, force_nlcc)
614 call mesh%allreduce(force_nlcc)
627 subroutine forces_from_scf(mesh, ions, spin_channels, vhxc, vhxc_old, force_scf)
628 class(
mesh_t),
intent(in) :: mesh
629 type(
ions_t),
intent(inout) :: ions
630 integer,
intent(in) :: spin_channels
631 real(real64),
contiguous,
intent(in) :: vhxc(:,:)
632 real(real64),
contiguous,
intent(in) :: vhxc_old(:,:)
633 real(real64),
contiguous,
intent(out) :: force_scf(:, :)
635 integer :: is, iatom, idir, ip
636 real(real64),
allocatable :: dvhxc(:,:), drho(:,:,:)
642 safe_allocate(dvhxc(1:mesh%np, 1:spin_channels))
643 safe_allocate(drho(1:mesh%np, 1:spin_channels, 1:ions%space%dim))
647 do is = 1, spin_channels
650 dvhxc(ip, is) = vhxc(ip, is) - vhxc_old(ip, is)
657 do iatom = ions%atoms_dist%start, ions%atoms_dist%end
658 select type(spec=>ions%atom(iatom)%species)
664 ions%pos(:, iatom), mesh, spin_channels, drho)
666 do idir = 1, ions%space%dim
667 do is = 1, spin_channels
668 force_scf(idir, iatom) = force_scf(idir, iatom) &
669 -
dmf_dotp(mesh, drho(:,is,idir), dvhxc(:,is), reduce = .false.)
676 safe_deallocate_a(dvhxc)
677 safe_deallocate_a(drho)
679 if (ions%atoms_dist%parallel)
call dforces_gather(ions, force_scf)
682 call mesh%allreduce(force_scf)
692 class(
mesh_t),
intent(in) :: mesh
693 class(
space_t),
intent(in) :: space
694 real(real64),
contiguous,
intent(in) :: vpsl(:)
695 real(real64),
contiguous,
intent(in) :: gdensity(:, :)
696 real(real64),
contiguous,
intent(inout) :: force(:)
699 real(real64) :: force_tmp(1:space%dim)
703 do idir = 1, space%dim
704 force_tmp(idir) =
dmf_dotp(mesh, vpsl(1:mesh%np), gdensity(:, idir), reduce = .false.)
707 call mesh%allreduce(force_tmp)
709 force(1:space%dim) = force(1:space%dim) + force_tmp(1:space%dim)
717 type(
ions_t),
intent(in) :: ions
718 real(real64),
contiguous,
intent(inout) :: force(:,:)
720 integer :: iatom, iop, iatom_symm
721 real(real64) :: symmetrized_force(ions%space%dim), force_tmp(ions%space%dim)
722 real(real64),
allocatable :: force_sym(:,:)
726 safe_allocate(force_sym(1:ions%space%dim,1:ions%natoms))
727 do iatom = 1, ions%natoms
728 symmetrized_force =
m_zero
729 do iop = 1, ions%symm%nops
730 iatom_symm = ions%inv_map_symm_atoms(iatom, iop)
732 symmetrized_force = symmetrized_force + force_tmp
735 do iop = 1, ions%symm%nops_nonsymmorphic
736 iatom_symm = ions%inv_map_symm_atoms(iatom, iop + ions%symm%nops)
738 symmetrized_force = symmetrized_force + force_tmp
741 force_sym(:, iatom) = symmetrized_force / (ions%symm%nops + ions%symm%nops_nonsymmorphic)
745 safe_deallocate_a(force_sym)
756 type(
ions_t),
intent(in) :: ions
757 complex(real64),
contiguous,
intent(inout) :: charge(:, :, :)
759 integer :: iatom, iop, iatom_symm, dim
760 real(real64) :: rot(ions%space%dim, ions%space%dim)
761 complex(real64),
allocatable :: charge_sym(:, :, :)
766 safe_allocate(charge_sym(1:dim, 1:dim, 1:ions%natoms))
768 do iatom = 1, ions%natoms
769 do iop = 1, ions%symm%nops
770 iatom_symm = ions%inv_map_symm_atoms(iatom, iop)
772 charge_sym(:, :, iatom) = charge_sym(:, :, iatom) + &
773 matmul(transpose(rot), matmul(charge(:, :, iatom_symm), rot))
777 do iop = 1, ions%symm%nops_nonsymmorphic
778 iatom_symm = ions%inv_map_symm_atoms(iatom, iop + ions%symm%nops)
780 charge_sym(:, :, iatom) = charge_sym(:, :, iatom) + &
781 matmul(transpose(rot), matmul(charge(:, :, iatom_symm), rot))
784 charge = charge_sym / (ions%symm%nops + ions%symm%nops_nonsymmorphic)
786 safe_deallocate_a(charge_sym)
794#include "forces_inc.F90"
797#include "complex.F90"
798#include "forces_inc.F90"
subroutine force1(qq, res, pdot3)
constant times a vector plus a vector
Copies a vector x, to a vector y.
scales a vector by a constant
This module implements batches of mesh functions.
This module implements common operations on batches of mesh functions.
Module implementing boundary conditions in Octopus.
This module implements a calculator for the density and defines related functions.
This module calculates the derivatives (gradients, Laplacians, etc.) of a function.
subroutine, public dderivatives_grad(der, ff, op_ff, ghost_update, set_bc, to_cartesian)
apply the gradient to a mesh function
subroutine, public zderivatives_grad(der, ff, op_ff, ghost_update, set_bc, to_cartesian)
apply the gradient to a mesh function
The Ono-Hirose double-grid technique [T. Ono and K. Hirose, Phys. Rev. Lett. 82, 5016 (1999); Phys....
integer, parameter, public spin_orbit
logical function, public list_has_gauge_field(partners)
type(lasers_t) function, pointer, public list_get_lasers(partners)
subroutine, public zforces_from_potential(gr, namespace, space, ions, hm, st, force, force_loc, force_nl, force_u)
Ref: Kikuji Hirose, Tomoya Ono, Yoshitaka Fujimoto, and Shigeru Tsukamoto, First-principles calculati...
subroutine, public dforces_derivative(gr, namespace, space, ions, ep, st, kpoints, lr, lr2, force_deriv, lda_u_level, vxc_response)
Computes the derivative of the ionic forces with respect to the strength of an external perturbation...
subroutine, public forces_costate_calculate(gr, namespace, ions, hm, psi, chi, ff, qq)
subroutine, public zforces_derivative(gr, namespace, space, ions, ep, st, kpoints, lr, lr2, force_deriv, lda_u_level, vxc_response)
Computes the derivative of the ionic forces with respect to the strength of an external perturbation...
subroutine, public total_force_calculate(space, namespace, gr, ions, hm, st, x)
This computes the total forces on the ions created by the electrons (it excludes the force due to pos...
subroutine forces_from_scf(mesh, ions, spin_channels, vhxc, vhxc_old, force_scf)
subroutine ztotal_force_from_potential(space, namespace, gr, ions, hm, st, x)
subroutine forces_from_nlcc(mesh, ions, spin_channels, vxc, force_nlcc, dgrid)
subroutine symmetrize_force(ions, force)
Given the forces on all atoms, this symmetrizes them using symmorphic and non-symmorphic operations.
subroutine symmetrize_born_charges(ions, charge)
Symmetrizes the Born charge tensors using symmorphic and non-symmorphic operations.
subroutine forces_compute_total_torque(ions, total_torque)
Computes the total torque acting on the system.
subroutine, public zforces_born_charges(gr, namespace, space, ions, ep, st, kpoints, lr, lr2, born_charges, lda_u_level, vxc_response)
lr, lr2 are wfns from electric perturbation; lr is for +omega, lr2 is for -omega. for each atom,...
subroutine, public forces_write_info(iunit, ions, dir, namespace)
subroutine, public forces_set_total_to_zero(ions, force)
subroutine, public dforces_from_potential(gr, namespace, space, ions, hm, st, force, force_loc, force_nl, force_u)
Ref: Kikuji Hirose, Tomoya Ono, Yoshitaka Fujimoto, and Shigeru Tsukamoto, First-principles calculati...
subroutine, public forces_calculate(gr, namespace, ions, hm, ext_partners, st, ks, vhxc_old, t, dt)
subroutine, public dforces_born_charges(gr, namespace, space, ions, ep, st, kpoints, lr, lr2, born_charges, lda_u_level, vxc_response)
lr, lr2 are wfns from electric perturbation; lr is for +omega, lr2 is for -omega. for each atom,...
subroutine dtotal_force_from_potential(space, namespace, gr, ions, hm, st, x)
subroutine total_force_from_local_potential(mesh, space, vpsl, gdensity, force)
subroutine dforces_gather(ions, force)
real(real64), parameter, public m_two
real(real64), parameter, public p_proton_charge
real(real64), parameter, public m_zero
real(real64), parameter, public m_four
integer, parameter, public rdmft
integer, parameter, public independent_particles
Theory level.
complex(real64), parameter, public m_z0
complex(real64), parameter, public m_zi
real(real64), parameter, public m_one
real(real64), parameter, public m_three
integer, parameter, public hartree
This module implements the underlying real-space grid.
subroutine, public zhamiltonian_elec_apply_atom(hm, namespace, space, latt, species, pos, ia, mesh, psi, vpsi)
This module defines classes and functions for interaction partners.
subroutine, public io_close(iunit, grp)
integer function, public io_open(file, namespace, action, status, form, position, die, recl, grp)
A module to handle KS potential, without the external potential.
logical function, public lasers_with_nondipole_field(lasers)
Check if a nondipole SFA correction should be computed for the given laser.
integer, parameter, public e_field_electric
integer, parameter, public e_field_vector_potential
subroutine, public laser_electric_field(laser, field, time, dt)
Returns a vector with the electric field, no matter whether the laser is described directly as an ele...
integer, parameter, public e_field_scalar_potential
integer pure elemental function, public laser_kind(laser)
subroutine, public laser_field(laser, field, time)
Retrieves the value of either the electric or the magnetic field. If the laser is given by a scalar p...
integer, parameter, public e_field_magnetic
This modules implements the routines for doing constrain DFT for noncollinear magnetism.
integer, parameter, public constrain_none
This module is intended to contain "only mathematical" functions and procedures.
pure real(real64) function, dimension(1:3), public dcross_product(a, b)
This module defines various routines, operating on mesh functions.
This module defines the meshes, which are used in Octopus.
subroutine, public messages_not_implemented(feature, namespace)
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
/* 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.
pure logical function, public ps_has_density(ps)
subroutine, public species_get_nlcc(species, space, latt, pos, mesh, rho_core, accumulate, dgrid)
subroutine, public species_atom_density_grad(species, namespace, space, latt, pos, mesh, spin_channels, drho)
pure logical function, public states_are_real(st)
This module handles spin dimensions of the states and the k-point distribution.
real(real64) function, dimension(1:this%dim, 1:this%dim), public symm_op_rotation_matrix_cart(this)
brief This module defines the class unit_t which is used by the unit_systems_oct_m module.
character(len=20) pure function, public units_abbrev(this)
This module defines the unit system, used for input and output.
type(unit_system_t), public units_out
This module is intended to contain simple general-purpose utility functions and procedures.
character pure function, public index2axis(idir)
Tkatchenko-Scheffler pairwise method for van der Waals (vdW, dispersion) interactions.
subroutine, public vdw_ts_force_calculate(this, force_vdw, ions, mesh, nspin, density)
Description of the grid, containing information on derivatives, stencil, and symmetries.
Describes mesh distribution to nodes.
The states_elec_t class contains all electronic wave functions.