Octopus
forces_oct_m Module Reference

Functions/Subroutines

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 possible time-dependent external fields). More...
 
subroutine, public forces_costate_calculate (gr, namespace, ions, hm, psi, chi, ff, qq)
 
subroutine, public forces_calculate (gr, namespace, ions, hm, ext_partners, st, ks, vhxc_old, t, dt)
 
subroutine, public forces_set_total_to_zero (ions, force)
 
subroutine forces_compute_total_torque (ions, total_torque)
 Computes the total torque acting on the system. More...
 
subroutine, public forces_write_info (iunit, ions, dir, namespace)
 
subroutine forces_from_nlcc (mesh, ions, spin_channels, vxc, force_nlcc)
 
subroutine forces_from_scf (mesh, ions, spin_channels, vhxc, vhxc_old, force_scf)
 
subroutine total_force_from_local_potential (mesh, space, vpsl, gdensity, force)
 
subroutine symmetrize_force (ions, force)
 Given the forces on all atoms, this symmetrizes them using symmorphic and non-symmorphic operations. More...
 
subroutine dforces_gather (ions, force)
 
subroutine dforces_from_local_potential (mesh, namespace, ions, ep, gdensity, 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 calculations in real-space formalism: Electronic configurations and transport properties of nanostructures, Imperial College Press (2005) Section 1.6, page 12. More...
 
subroutine dforces_from_nonlocal_potential (gr, namespace, space, ions, hm, st, force_nl, force_u, grad_rho)
 
subroutine dtotal_force_from_potential (space, namespace, gr, ions, hm, st, x)
 
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 \(\lambda\) of an external perturbation, from the linear response of the orbitals. More...
 
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, Z*(i,j) = dF(j)/dE(i) More...
 
subroutine zforces_gather (ions, force)
 
subroutine zforces_from_local_potential (mesh, namespace, ions, ep, gdensity, force)
 
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 calculations in real-space formalism: Electronic configurations and transport properties of nanostructures, Imperial College Press (2005) Section 1.6, page 12. More...
 
subroutine zforces_from_nonlocal_potential (gr, namespace, space, ions, hm, st, force_nl, force_u, grad_rho)
 
subroutine ztotal_force_from_potential (space, namespace, gr, ions, hm, st, x)
 
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 \(\lambda\) of an external perturbation, from the linear response of the orbitals. More...
 
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, Z*(i,j) = dF(j)/dE(i) More...
 

Function/Subroutine Documentation

◆ total_force_calculate()

subroutine, public forces_oct_m::total_force_calculate ( class(space_t), intent(in)  space,
class(namespace_t), intent(in)  namespace,
type(grid_t), intent(in)  gr,
type(ions_t), intent(in)  ions,
type(hamiltonian_elec_t), intent(in)  hm,
type(states_elec_t), intent(in)  st,
real(real64), dimension(:), intent(inout)  x 
)

This computes the total forces on the ions created by the electrons (it excludes the force due to possible time-dependent external fields).

Definition at line 194 of file forces.F90.

◆ forces_costate_calculate()

subroutine, public forces_oct_m::forces_costate_calculate ( type(grid_t), intent(in)  gr,
type(namespace_t), intent(in)  namespace,
type(ions_t), intent(inout)  ions,
type(hamiltonian_elec_t), intent(in)  hm,
type(states_elec_t), intent(in)  psi,
type(states_elec_t), intent(in)  chi,
real(real64), dimension(:, :), intent(inout)  ff,
real(real64), dimension(:, :), intent(in)  qq 
)

Definition at line 219 of file forces.F90.

◆ forces_calculate()

subroutine, public forces_oct_m::forces_calculate ( type(grid_t), intent(in)  gr,
type(namespace_t), intent(in)  namespace,
type(ions_t), intent(inout)  ions,
type(hamiltonian_elec_t), intent(inout)  hm,
type(partner_list_t), intent(in)  ext_partners,
type(states_elec_t), intent(inout)  st,
type(v_ks_t), intent(in)  ks,
real(real64), dimension(:,:), intent(in), optional  vhxc_old,
real(real64), intent(in), optional  t,
real(real64), intent(in), optional  dt 
)

Definition at line 340 of file forces.F90.

◆ forces_set_total_to_zero()

subroutine, public forces_oct_m::forces_set_total_to_zero ( type(ions_t), intent(in)  ions,
real(real64), dimension(:, :), intent(inout)  force 
)

Definition at line 545 of file forces.F90.

◆ forces_compute_total_torque()

subroutine forces_oct_m::forces_compute_total_torque ( type(ions_t), intent(in)  ions,
real(real64), dimension(:), intent(inout)  total_torque 
)
private

Computes the total torque acting on the system.

Definition at line 568 of file forces.F90.

◆ forces_write_info()

subroutine, public forces_oct_m::forces_write_info ( integer, intent(in)  iunit,
type(ions_t), intent(in)  ions,
character(len=*), intent(in)  dir,
type(namespace_t), intent(in)  namespace 
)

Definition at line 594 of file forces.F90.

◆ forces_from_nlcc()

subroutine forces_oct_m::forces_from_nlcc ( type(grid_t), intent(in)  mesh,
type(ions_t), intent(inout)  ions,
integer, intent(in)  spin_channels,
real(real64), dimension(:,:), intent(in)  vxc,
real(real64), dimension(:, :), intent(out), contiguous  force_nlcc 
)
private

Definition at line 655 of file forces.F90.

◆ forces_from_scf()

subroutine forces_oct_m::forces_from_scf ( class(mesh_t), intent(in)  mesh,
type(ions_t), intent(inout)  ions,
integer, intent(in)  spin_channels,
real(real64), dimension(:,:), intent(in)  vhxc,
real(real64), dimension(:,:), intent(in)  vhxc_old,
real(real64), dimension(:, :), intent(out), contiguous  force_scf 
)
private

Definition at line 709 of file forces.F90.

◆ total_force_from_local_potential()

subroutine forces_oct_m::total_force_from_local_potential ( class(mesh_t), intent(in)  mesh,
class(space_t), intent(in)  space,
real(real64), dimension(:), intent(in)  vpsl,
real(real64), dimension(:, :), intent(in)  gdensity,
real(real64), dimension(:), intent(inout)  force 
)
private

Definition at line 773 of file forces.F90.

◆ symmetrize_force()

subroutine forces_oct_m::symmetrize_force ( type(ions_t), intent(in)  ions,
real(real64), dimension(:,:), intent(inout)  force 
)
private

Given the forces on all atoms, this symmetrizes them using symmorphic and non-symmorphic operations.

Definition at line 798 of file forces.F90.

◆ dforces_gather()

subroutine forces_oct_m::dforces_gather ( type(ions_t), intent(in)  ions,
real(real64), dimension(:, :), intent(inout), contiguous  force 
)
private

Definition at line 900 of file forces.F90.

◆ dforces_from_local_potential()

subroutine forces_oct_m::dforces_from_local_potential ( class(mesh_t), intent(in)  mesh,
type(namespace_t), intent(in)  namespace,
type(ions_t), intent(in)  ions,
type(epot_t), intent(in)  ep,
real(real64), dimension(:, :), intent(in)  gdensity,
real(real64), dimension(:, :), intent(inout)  force 
)
private

Definition at line 941 of file forces.F90.

◆ dforces_from_potential()

subroutine, public forces_oct_m::dforces_from_potential ( type(grid_t), intent(in)  gr,
type(namespace_t), intent(in)  namespace,
class(space_t), intent(in)  space,
type(ions_t), intent(in)  ions,
type(hamiltonian_elec_t), intent(in)  hm,
type(states_elec_t), intent(in)  st,
real(real64), dimension(:, :), intent(out)  force,
real(real64), dimension(:, :), intent(out)  force_loc,
real(real64), dimension(:, :), intent(out)  force_nl,
real(real64), dimension(:, :), intent(out)  force_u 
)

Ref: Kikuji Hirose, Tomoya Ono, Yoshitaka Fujimoto, and Shigeru Tsukamoto, First-principles calculations in real-space formalism: Electronic configurations and transport properties of nanostructures, Imperial College Press (2005) Section 1.6, page 12.

Definition at line 1000 of file forces.F90.

◆ dforces_from_nonlocal_potential()

subroutine forces_oct_m::dforces_from_nonlocal_potential ( type(grid_t), intent(in)  gr,
type(namespace_t), intent(in)  namespace,
class(space_t), intent(in)  space,
type(ions_t), intent(in)  ions,
type(hamiltonian_elec_t), intent(in)  hm,
type(states_elec_t), intent(in)  st,
real(real64), dimension(:, :), intent(inout)  force_nl,
real(real64), dimension(:, :), intent(inout)  force_u,
real(real64), dimension(:, :), intent(inout), contiguous  grad_rho 
)
private

Definition at line 1056 of file forces.F90.

◆ dtotal_force_from_potential()

subroutine forces_oct_m::dtotal_force_from_potential ( class(space_t), intent(in)  space,
class(namespace_t), intent(in)  namespace,
type(grid_t), intent(in)  gr,
type(ions_t), intent(in)  ions,
type(hamiltonian_elec_t), intent(in)  hm,
type(states_elec_t), intent(in)  st,
real(real64), dimension(:), intent(inout)  x 
)
private

Definition at line 1185 of file forces.F90.

◆ dforces_derivative()

subroutine, public forces_oct_m::dforces_derivative ( type(grid_t), intent(in)  gr,
type(namespace_t), intent(in)  namespace,
class(space_t), intent(in)  space,
type(ions_t), intent(in)  ions,
type(epot_t), intent(in)  ep,
type(states_elec_t), intent(in)  st,
type(kpoints_t), intent(in)  kpoints,
type(lr_t), intent(in)  lr,
type(lr_t), intent(in)  lr2,
complex(real64), dimension(:,:), intent(out)  force_deriv,
integer, intent(in)  lda_u_level,
real(real64), dimension(:,:), intent(in), optional  vxc_response 
)

Computes the derivative of the ionic forces with respect to the strength \(\lambda\) of an external perturbation, from the linear response of the orbitals.

Given the response orbitals \(\delta\psi^{+}\) (lr, frequency \(+\omega\)) and \(\delta\psi^{-}\) (lr2, frequency \(-\omega\)), and the corresponding first-order density

\[ \delta n(\vec{r}) = \sum_{nk} w_k f_{nk} \left[ \psi^{*}_{nk}\,\delta\psi^{+}_{nk} + \left(\delta\psi^{-}_{nk}\right)^{*} \psi_{nk} \right]\,, \]

this routine computes, for each ion \(I\) and direction \(\alpha\),

\[ \frac{dF_{I\alpha}}{d\lambda} = -\sum_{nk} w_k f_{nk} \left[ \langle \delta\psi^{-}_{nk} | \partial_{R_{I\alpha}} \hat{V}^{\rm nl}_I | \psi_{nk} \rangle + \langle \psi_{nk} | \partial_{R_{I\alpha}} \hat{V}^{\rm nl}_I | \delta\psi^{+}_{nk} \rangle \right] - \int d^3r\, v^{\rm loc}_I(\vec{r})\, \partial_\alpha \delta n(\vec{r}) - \int d^3r\, \rho^{\rm core}_I(\vec{r})\, \partial_\alpha \delta\bar{v}_{\rm xc}(\vec{r})\,. \]

The nonlocal term is evaluated by moving \(\partial_{R_{I\alpha}}\) onto the orbitals as \(-\partial_\alpha\). The local term uses integration by parts, so that the gradient acts on \(\delta n\) instead of the singular local potential. The last term is the non-linear core correction (NLCC): \(\delta\bar{v}_{\rm xc}\) is the spin-channel average of the xc response potential \(\delta v_{\rm xc} = f_{\rm xc}\,\delta n\), which must be provided by the caller as vxc_response (computed e.g. by dsternheimer_calc_vxc_response; for ionic perturbations \(\delta n\) must include the core-density response). As in forces_from_nlcc (Eq. 9 of Kronik et al., J. Chem. Phys. 115, 4322 (2001)), integration by parts puts the gradient on \(\delta v_{\rm xc}\), avoiding the ill-defined gradient of \(\rho^{\rm core}\) at the nucleus. Only the xc response belongs in vxc_response: the core density enters \(E_{\rm xc}[n+\rho^{\rm core}]\) but not the Hartree energy, so passing the full \(\delta v_{\rm Hxc}\) (as returned by sternheimer_calc_hvar) would add a spurious term.

Note: the occupations \(f_{nk}\) used here differ from the weights of lr_build_dl_rho for metallic smearing.

Parameters
[out]force_deriv(spacedim, ionsnatoms)
[in]vxc_response(grnp, stdnspin) xc response potential fxc*dn

Definition at line 1275 of file forces.F90.

◆ dforces_born_charges()

subroutine, public forces_oct_m::dforces_born_charges ( type(grid_t), intent(in)  gr,
type(namespace_t), intent(in)  namespace,
class(space_t), intent(in)  space,
type(ions_t), intent(in)  ions,
type(epot_t), intent(in)  ep,
type(states_elec_t), intent(in)  st,
type(kpoints_t), intent(in)  kpoints,
type(lr_t), dimension(:), intent(in)  lr,
type(lr_t), dimension(:), intent(in)  lr2,
type(born_charges_t), intent(inout)  born_charges,
integer, intent(in)  lda_u_level,
real(real64), dimension(:,:,:), intent(in), optional  vxc_response 
)

lr, lr2 are wfns from electric perturbation; lr is for +omega, lr2 is for -omega. for each atom, Z*(i,j) = dF(j)/dE(i)

Parameters
[in]lr(spacedim)
[in]lr2(spacedim)
[in]vxc_response(grnp, stdnspin, spacedim) per field direction

Definition at line 1460 of file forces.F90.

◆ zforces_gather()

subroutine forces_oct_m::zforces_gather ( type(ions_t), intent(in)  ions,
complex(real64), dimension(:, :), intent(inout), contiguous  force 
)
private

Definition at line 1578 of file forces.F90.

◆ zforces_from_local_potential()

subroutine forces_oct_m::zforces_from_local_potential ( class(mesh_t), intent(in)  mesh,
type(namespace_t), intent(in)  namespace,
type(ions_t), intent(in)  ions,
type(epot_t), intent(in)  ep,
complex(real64), dimension(:, :), intent(in)  gdensity,
complex(real64), dimension(:, :), intent(inout)  force 
)
private

Definition at line 1619 of file forces.F90.

◆ zforces_from_potential()

subroutine, public forces_oct_m::zforces_from_potential ( type(grid_t), intent(in)  gr,
type(namespace_t), intent(in)  namespace,
class(space_t), intent(in)  space,
type(ions_t), intent(in)  ions,
type(hamiltonian_elec_t), intent(in)  hm,
type(states_elec_t), intent(in)  st,
real(real64), dimension(:, :), intent(out)  force,
real(real64), dimension(:, :), intent(out)  force_loc,
real(real64), dimension(:, :), intent(out)  force_nl,
real(real64), dimension(:, :), intent(out)  force_u 
)

Ref: Kikuji Hirose, Tomoya Ono, Yoshitaka Fujimoto, and Shigeru Tsukamoto, First-principles calculations in real-space formalism: Electronic configurations and transport properties of nanostructures, Imperial College Press (2005) Section 1.6, page 12.

Definition at line 1678 of file forces.F90.

◆ zforces_from_nonlocal_potential()

subroutine forces_oct_m::zforces_from_nonlocal_potential ( type(grid_t), intent(in)  gr,
type(namespace_t), intent(in)  namespace,
class(space_t), intent(in)  space,
type(ions_t), intent(in)  ions,
type(hamiltonian_elec_t), intent(in)  hm,
type(states_elec_t), intent(in)  st,
real(real64), dimension(:, :), intent(inout)  force_nl,
real(real64), dimension(:, :), intent(inout)  force_u,
real(real64), dimension(:, :), intent(inout), contiguous  grad_rho 
)
private

Definition at line 1734 of file forces.F90.

◆ ztotal_force_from_potential()

subroutine forces_oct_m::ztotal_force_from_potential ( class(space_t), intent(in)  space,
class(namespace_t), intent(in)  namespace,
type(grid_t), intent(in)  gr,
type(ions_t), intent(in)  ions,
type(hamiltonian_elec_t), intent(in)  hm,
type(states_elec_t), intent(in)  st,
real(real64), dimension(:), intent(inout)  x 
)
private

Definition at line 1863 of file forces.F90.

◆ zforces_derivative()

subroutine, public forces_oct_m::zforces_derivative ( type(grid_t), intent(in)  gr,
type(namespace_t), intent(in)  namespace,
class(space_t), intent(in)  space,
type(ions_t), intent(in)  ions,
type(epot_t), intent(in)  ep,
type(states_elec_t), intent(in)  st,
type(kpoints_t), intent(in)  kpoints,
type(lr_t), intent(in)  lr,
type(lr_t), intent(in)  lr2,
complex(real64), dimension(:,:), intent(out)  force_deriv,
integer, intent(in)  lda_u_level,
complex(real64), dimension(:,:), intent(in), optional  vxc_response 
)

Computes the derivative of the ionic forces with respect to the strength \(\lambda\) of an external perturbation, from the linear response of the orbitals.

Given the response orbitals \(\delta\psi^{+}\) (lr, frequency \(+\omega\)) and \(\delta\psi^{-}\) (lr2, frequency \(-\omega\)), and the corresponding first-order density

\[ \delta n(\vec{r}) = \sum_{nk} w_k f_{nk} \left[ \psi^{*}_{nk}\,\delta\psi^{+}_{nk} + \left(\delta\psi^{-}_{nk}\right)^{*} \psi_{nk} \right]\,, \]

this routine computes, for each ion \(I\) and direction \(\alpha\),

\[ \frac{dF_{I\alpha}}{d\lambda} = -\sum_{nk} w_k f_{nk} \left[ \langle \delta\psi^{-}_{nk} | \partial_{R_{I\alpha}} \hat{V}^{\rm nl}_I | \psi_{nk} \rangle + \langle \psi_{nk} | \partial_{R_{I\alpha}} \hat{V}^{\rm nl}_I | \delta\psi^{+}_{nk} \rangle \right] - \int d^3r\, v^{\rm loc}_I(\vec{r})\, \partial_\alpha \delta n(\vec{r}) - \int d^3r\, \rho^{\rm core}_I(\vec{r})\, \partial_\alpha \delta\bar{v}_{\rm xc}(\vec{r})\,. \]

The nonlocal term is evaluated by moving \(\partial_{R_{I\alpha}}\) onto the orbitals as \(-\partial_\alpha\). The local term uses integration by parts, so that the gradient acts on \(\delta n\) instead of the singular local potential. The last term is the non-linear core correction (NLCC): \(\delta\bar{v}_{\rm xc}\) is the spin-channel average of the xc response potential \(\delta v_{\rm xc} = f_{\rm xc}\,\delta n\), which must be provided by the caller as vxc_response (computed e.g. by zsternheimer_calc_vxc_response; for ionic perturbations \(\delta n\) must include the core-density response). As in forces_from_nlcc (Eq. 9 of Kronik et al., J. Chem. Phys. 115, 4322 (2001)), integration by parts puts the gradient on \(\delta v_{\rm xc}\), avoiding the ill-defined gradient of \(\rho^{\rm core}\) at the nucleus. Only the xc response belongs in vxc_response: the core density enters \(E_{\rm xc}[n+\rho^{\rm core}]\) but not the Hartree energy, so passing the full \(\delta v_{\rm Hxc}\) (as returned by sternheimer_calc_hvar) would add a spurious term.

Note: the occupations \(f_{nk}\) used here differ from the weights of lr_build_dl_rho for metallic smearing.

Parameters
[out]force_deriv(spacedim, ionsnatoms)
[in]vxc_response(grnp, stdnspin) xc response potential fxc*dn

Definition at line 1953 of file forces.F90.

◆ zforces_born_charges()

subroutine, public forces_oct_m::zforces_born_charges ( type(grid_t), intent(in)  gr,
type(namespace_t), intent(in)  namespace,
class(space_t), intent(in)  space,
type(ions_t), intent(in)  ions,
type(epot_t), intent(in)  ep,
type(states_elec_t), intent(in)  st,
type(kpoints_t), intent(in)  kpoints,
type(lr_t), dimension(:), intent(in)  lr,
type(lr_t), dimension(:), intent(in)  lr2,
type(born_charges_t), intent(inout)  born_charges,
integer, intent(in)  lda_u_level,
complex(real64), dimension(:,:,:), intent(in), optional  vxc_response 
)

lr, lr2 are wfns from electric perturbation; lr is for +omega, lr2 is for -omega. for each atom, Z*(i,j) = dF(j)/dE(i)

Parameters
[in]lr(spacedim)
[in]lr2(spacedim)
[in]vxc_response(grnp, stdnspin, spacedim) per field direction

Definition at line 2145 of file forces.F90.