43 use,
intrinsic :: iso_fortran_env
93 type(namespace_t),
intent(in) :: namespace
94 type(grid_t),
intent(inout) :: gr
95 type(hamiltonian_elec_t),
intent(inout) :: hm
96 type(states_elec_t),
target,
intent(inout) :: st
97 type(ions_t),
intent(inout) :: ions
98 type(v_ks_t),
intent(in) :: ks
99 type(partner_list_t),
intent(in) :: ext_partners
101 real(real64),
allocatable :: rho_total(:)
102 real(real64) :: stress(3,3)
103 real(real64) :: stress_kin(3,3), stress_Hartree(3,3), stress_xc(3,3), stress_xc_nlcc(3,3)
104 real(real64) :: stress_ps(3,3), stress_ps_nl(3,3), stress_ps_local(3,3), stress_ii(3,3)
105 real(real64) :: stress_hubbard(3,3)
107 real(real64),
allocatable :: vh(:)
108 real(real64),
allocatable :: grad_vh(:,:)
109 real(real64) :: ehartree
110 real(real64),
contiguous,
pointer :: rho(:)
116 write(
message(1),
'(a)')
'The stress tensors for real wavefunctions has not been implemented!'
118 if (hm%kpoints%full%npoints == 1)
then
119 write(
message(2),
'(a)')
'For testing this feature, you can add ForceComplex=yes to the input file'
126 if (ions%space%periodic_dim == 1)
then
130 if (.not. ions%space%is_periodic())
then
131 write(
message(1),
'(a)')
'The stress tensor cannot be computed for isolated systems'
135 if (ks%vdw%vdw_correction /= option__vdwcorrection__none .and. .not. any(ks%vdw%vdw_correction ==
d3_lib_options))
then
136 write(
message(1),
'(a)')
'The stress tensor is currently only implemented with DFT-D3 vdW correction'
140 if (hm%pcm%run_pcm)
then
144 if (
allocated(hm%v_static))
then
148 if (ks%v_ks_photons%active())
then
152 if (.not. hm%vnl%apply_projector_matrices)
then
153 call messages_not_implemented(
'Stress tensor with relativistic Kleinman-Bylander pseudopotential', namespace=namespace)
166 if ( .not.
in_family(hm%xc%family, [xc_family_lda, xc_family_gga, xc_family_mgga]))
then
167 write(
message(1),
'(a)')
'The stress tensor computation is currently only possible at the Kohn-Sham DFT level'
168 write(
message(2),
'(a)')
'with LDA, GGA and mGGA functionals or for independent particles.'
172 if (
in_family(hm%xc%family, [xc_family_gga, xc_family_mgga]) .and. st%d%ispin ==
spinors)
then
186 if (hm%xc%use_gi_ked)
then
199 safe_allocate(rho_total(1:gr%np_part))
201 rho_total(ip) = sum(st%rho(ip, 1:st%d%nspin))
210 safe_allocate(vh(1:gr%np_part))
211 safe_allocate(grad_vh(1:gr%np, 1:gr%der%dim))
213 call lalg_copy(gr%np, hm%ks_pot%vhartree, vh)
215 if (hm%d%spin_channels > 1)
then
216 safe_allocate(rho(1:gr%np_part))
224 if (hm%d%spin_channels > 1)
then
225 safe_deallocate_p(rho)
230 ehartree = hm%energy%hartree
237 call stress_from_kinetic(gr, ions%space, hm, st, gr%symm, ions%latt%rcell_volume, stress_kin)
238 stress = stress + stress_kin
245 call stress_from_hartree(gr, ions%space, ions%latt%rcell_volume, grad_vh, ehartree, stress_hartree)
246 stress = stress + stress_hartree
248 call stress_from_xc(gr, hm, st, ions%space, ions%latt%rcell_volume, stress_xc)
251 if (
allocated(st%rho_core))
then
252 call stress_from_xc_nlcc(ions%latt%rcell_volume, gr, st, ions, hm%ks_pot%vxc, stress_xc_nlcc)
257 stress_xc = stress_xc + ks%stress_xc / ions%latt%rcell_volume
258 stress = stress + stress_xc + stress_xc_nlcc
262 stress_ps = stress_ps_local
263 stress = stress + stress_ps_local
265 safe_deallocate_a(vh)
266 safe_deallocate_a(grad_vh)
269 stress_ps = stress_ps + stress_ps_nl
270 stress = stress + stress_ps_nl
272 call stress_from_hubbard(namespace, gr, st, hm, ions%space, ions%latt%rcell_volume, stress_hubbard)
273 stress = stress + stress_hubbard
275 call ion_interaction_stress(ions%ion_interaction, ions%space, ions%latt, ions%atom, ions%natoms, ions%pos, stress_ii)
276 stress = stress + stress_ii
282 st%stress_tensors%kinetic = -stress_kin
283 st%stress_tensors%Hartree = -stress_hartree
284 st%stress_tensors%xc = -stress_xc
285 st%stress_tensors%xc_nlcc = -stress_xc_nlcc
286 st%stress_tensors%ps_local = -stress_ps_local
287 st%stress_tensors%ps_nl = -stress_ps_nl
288 st%stress_tensors%hubbard = -stress_hubbard
289 st%stress_tensors%ion_ion = -stress_ii
292 if (ks%vdw%vdw_correction /= option__vdwcorrection__none)
then
293 st%stress_tensors%vdw = hm%ep%vdw_stress
295 st%stress_tensors%vdw =
m_zero
297 stress = stress + st%stress_tensors%vdw
300 if (hm%kpoints%use_symmetries)
then
306 st%stress_tensors%total = stress
310 st%stress_tensors%kinetic_sumrule =
m_zero
312 st%stress_tensors%Hartree_sumrule =
m_zero
313 if(ions%space%periodic_dim == 3)
then
314 st%stress_tensors%kinetic_sumrule = (stress_kin(1,1) + stress_kin(2,2) + stress_kin(3,3))*ions%latt%rcell_volume
315 st%stress_tensors%kinetic_sumrule = st%stress_tensors%kinetic_sumrule -
m_two * hm%energy%kinetic
317 st%stress_tensors%hartree_sumrule = (stress_hartree(1,1) + stress_hartree(2,2) + stress_hartree(3,3))*ions%latt%rcell_volume
318 st%stress_tensors%hartree_sumrule = st%stress_tensors%hartree_sumrule - hm%energy%hartree
321 safe_deallocate_a(rho_total)
343 type(
grid_t),
intent(in) :: gr
344 class(
space_t),
intent(in) :: space
348 real(real64),
intent(in) :: rcell_volume
349 real(real64),
intent(out) :: stress_kin(3, 3)
351 integer :: ik, ist, idir, jdir, ib, minst, maxst
352 complex(real64),
allocatable :: stress_l_block(:)
360 safe_allocate(stress_l_block(1:st%block_size))
362 do ik = st%d%kpt%start, st%d%kpt%end
365 do ib = st%group%block_start, st%group%block_end
369 call hm%phase%copy_and_set_phase(gr, st%d%kpt, st%group%psib(ib, ik), psib)
375 do idir = 1, space%periodic_dim
376 do jdir = idir, space%periodic_dim
379 do ist = minst, maxst
380 stress_kin(idir,jdir) = stress_kin(idir,jdir) &
381 + st%kweights(ik) * st%occ(ist, ik) &
382 * real(stress_l_block(ist - minst + 1), real64)
387 do idir = 1, space%dim
388 call gpsib(idir)%end()
395 if (st%parallel_in_states .or. st%d%kpt%parallel)
then
404 if (hm%kpoints%use_symmetries)
then
408 stress_kin = stress_kin / rcell_volume
432 type(
grid_t),
intent(in) :: gr
433 class(
space_t),
intent(in) :: space
434 real(real64),
intent(in) :: volume
435 real(real64),
intent(in) :: grad_vh(:,:)
436 real(real64),
intent(in) :: ehartree
437 real(real64),
intent(out) :: stress_Hartree(3, 3)
439 integer :: idir, jdir
444 stress_hartree(:,:) =
m_zero
446 do idir = 1, space%periodic_dim
447 do jdir = idir, space%periodic_dim
448 stress_hartree(idir, jdir) = -
dmf_dotp(gr, grad_vh(:,idir), grad_vh(:, jdir))/
m_four/
m_pi
450 stress_hartree(idir, idir) = stress_hartree(idir, idir) + ehartree
455 stress_hartree = stress_hartree/volume
490 subroutine stress_from_xc(gr, hm, st, space, rcell_volume, stress_xc)
491 type(
grid_t),
intent(in) :: gr
494 class(
space_t),
intent(in) :: space
495 real(real64),
intent(in) :: rcell_volume
496 real(real64),
intent(out) :: stress_xc(3, 3)
498 integer :: ik, ist, idir, jdir, ib, minst, maxst, ispin
499 real(real64) :: stress_tau(3,3)
500 complex(real64),
allocatable :: stress_l_block(:)
501 type(
wfs_elec_t) :: psib, gpsib(space%dim), vtau_gpsib(space%dim)
508 do idir = 1, space%periodic_dim
509 stress_xc(idir, idir) = - hm%energy%exchange - hm%energy%correlation + hm%energy%intnvxc
520 safe_allocate(stress_l_block(1:st%block_size))
524 do ik = st%d%kpt%start, st%d%kpt%end
527 ispin = st%d%get_spin_index(ik)
529 do ib = st%group%block_start, st%group%block_end
533 call hm%phase%copy_and_set_phase(gr, st%d%kpt, st%group%psib(ib, ik), psib)
539 do idir = 1, space%periodic_dim
540 call psib%copy_to(vtau_gpsib(idir))
542 call hm%ks_pot%zapply_vtau_psi(gr, hm%d, ispin, gpsib(idir), vtau_gpsib(idir))
546 do idir = 1, space%periodic_dim
547 do jdir = idir, space%periodic_dim
550 do ist = minst, maxst
551 stress_tau(idir, jdir) = stress_tau(idir, jdir) &
552 +
m_two * st%kweights(ik) * st%occ(ist, ik) * real(stress_l_block(ist - minst + 1), real64)
557 do idir = 1, space%dim
558 call gpsib(idir)%end()
560 do idir = 1, space%periodic_dim
561 call vtau_gpsib(idir)%end()
568 safe_deallocate_a(stress_l_block)
570 if (st%parallel_in_states .or. st%d%kpt%parallel)
then
578 if (hm%kpoints%use_symmetries)
then
582 stress_xc(:,:) = stress_xc(:,:) + stress_tau(:,:)
586 stress_xc(:,:) = stress_xc(:,:) / rcell_volume
611 real(real64),
intent(in) :: rcell_volume
612 type(
grid_t),
intent(in) :: gr
614 type(
ions_t),
intent(in) :: ions
615 real(real64),
intent(in) :: vxc(:,:)
616 real(real64),
intent(out) :: stress_xc_nlcc(3, 3)
618 integer :: idir, jdir, iat
619 real(real64),
allocatable :: vxc_tot(:), nlcc_grad_x(:,:,:)
624 assert(
allocated(st%rho_core))
628 safe_allocate(vxc_tot(1:gr%np))
629 safe_allocate(nlcc_grad_x(1:gr%np, 1:gr%der%dim, 1:gr%der%dim))
632 call lalg_copy(gr%np, vxc(:, 1), vxc_tot)
633 if(st%d%nspin > 1)
call lalg_axpy(gr%np,
m_one, vxc(:, 2), vxc_tot)
635 do iat = ions%atoms_dist%start, ions%atoms_dist%end
637 ions%pos(:,iat), gr, nlcc_grad_x)
639 do idir = 1, ions%space%periodic_dim
640 do jdir = idir, ions%space%periodic_dim
641 stress_xc_nlcc(idir, jdir) = stress_xc_nlcc(idir, jdir) &
642 -
dmf_dotp(gr, nlcc_grad_x(:, idir, jdir), vxc_tot)
646 safe_deallocate_a(nlcc_grad_x)
647 safe_deallocate_a(vxc_tot)
649 if (ions%atoms_dist%parallel)
then
655 stress_xc_nlcc(:,:) = stress_xc_nlcc(:,:) / rcell_volume
682 type(
grid_t),
target,
intent(in) :: gr
685 type(
ions_t),
intent(in) :: ions
686 real(real64),
intent(out) :: stress_ps_nl(3, 3)
688 integer :: ik, ist, idir, jdir
689 integer :: ib, minst, maxst
690 type(
wfs_elec_t) :: psib, rvnl_psib(3), gpsib(3)
691 complex(real64),
allocatable :: stress_tmp(:)
698 safe_allocate(stress_tmp(1:st%block_size))
702 do ik = st%d%kpt%start, st%d%kpt%end
706 do ib = st%group%block_start, st%group%block_end
710 call hm%phase%copy_and_set_phase(gr, st%d%kpt, st%group%psib(ib, ik), psib)
717 do idir = 1, gr%der%dim
718 call psib%copy_to(rvnl_psib(idir))
721 call hm%vnl%zr_vn_local(gr, st%d, gr%der%boundaries%spiral, psib, rvnl_psib)
723 do idir = 1, ions%space%periodic_dim
724 do jdir = idir, ions%space%periodic_dim
727 do ist = minst, maxst
728 stress_ps_nl(idir, jdir) = stress_ps_nl(idir, jdir) &
729 +
m_two * st%kweights(ik) * st%occ(ist, ik) * real(stress_tmp(ist-minst+1), real64)
735 do idir = 1, gr%der%dim
736 call rvnl_psib(idir)%end()
737 call gpsib(idir)%end()
743 safe_deallocate_a(stress_tmp)
745 if (st%parallel_in_states .or. st%d%kpt%parallel)
then
753 if (hm%kpoints%use_symmetries)
then
758 do idir = 1, ions%space%periodic_dim
759 stress_ps_nl(idir, idir) = stress_ps_nl(idir, idir) + hm%energy%extern_non_local
762 stress_ps_nl = stress_ps_nl/ions%latt%rcell_volume
791 type(
grid_t),
target,
intent(in) :: gr
793 type(
ions_t),
intent(in) :: ions
794 real(real64),
contiguous,
intent(inout) :: rho_total(:)
795 real(real64),
intent(in) :: grad_vh(:,:)
796 real(real64),
intent(out) :: stress_ps_local(3, 3)
799 real(real64) :: stress_SR(3, 3), stress_LR(3, 3)
800 real(real64) :: energy_ps_SR, charge, zi
801 real(real64),
allocatable :: vloc(:), rvloc(:,:), rho_local_lr(:), rho_lr(:)
802 real(real64),
allocatable :: grad_rho(:,:), rho_lr_x(:,:), vlr(:), grad_vlr(:,:)
803 integer :: idir, jdir, iatom
804 type(
ps_t),
pointer :: spec_ps
812 safe_allocate(vloc(1:gr%np))
814 safe_allocate(rvloc(1:gr%np, 1:gr%der%dim))
816 do iatom = 1, ions%natoms
819 safe_deallocate_a(vloc)
821 safe_allocate(grad_rho(1:gr%np,1:gr%der%dim))
824 energy_ps_sr = hm%energy%extern_local
825 do idir = 1, ions%space%periodic_dim
826 do jdir = idir, ions%space%periodic_dim
827 stress_sr(idir, jdir) = stress_sr(idir, jdir) &
828 +
dmf_dotp(gr, rvloc(:, jdir), grad_rho(:, idir))
830 stress_sr(idir,idir) = stress_sr(idir,idir) + energy_ps_sr
835 stress_sr = stress_sr/ions%latt%rcell_volume
837 safe_deallocate_a(rvloc)
838 safe_deallocate_a(grad_rho)
846 safe_allocate(rho_lr(1:gr%np_part))
847 safe_allocate(rho_lr_x(1:gr%np, 1:gr%der%dim))
850 safe_allocate(rho_local_lr(1:gr%np))
851 do iatom = ions%atoms_dist%start, ions%atoms_dist%end
852 assert(ions%atom(iatom)%species%is_ps())
854 ions%pos(:, iatom), gr, rho_local_lr, nlr_x=rho_lr_x)
858 safe_deallocate_a(rho_local_lr)
860 if (ions%atoms_dist%parallel)
then
865 do idir = 1, ions%space%periodic_dim
866 do jdir = idir, ions%space%periodic_dim
867 stress_lr(idir, jdir) = stress_lr(idir, jdir) +
dmf_dotp(gr, rho_lr_x(:,jdir), grad_vh(:, idir))
870 safe_deallocate_a(rho_lr_x)
872 safe_allocate(vlr(1:gr%np_part))
874 safe_deallocate_a(rho_lr)
876 safe_allocate(grad_vlr(1:gr%np, 1:gr%der%dim))
878 safe_deallocate_a(vlr)
880 do idir = 1, ions%space%periodic_dim
881 do jdir = idir, ions%space%periodic_dim
882 stress_lr(idir, jdir) = stress_lr(idir, jdir) -
dmf_dotp(gr, grad_vh(:,idir), grad_vlr(:, jdir))/
m_two/
m_pi
888 safe_deallocate_a(grad_vlr)
892 if (ions%space%periodic_dim == 3)
then
894 do iatom = 1, ions%natoms
895 charge = charge + ions%atom(iatom)%species%get_zval()
898 do iatom = 1, ions%natoms
899 select type(spec => ions%atom(iatom)%species)
904 do idir = 1, ions%space%periodic_dim
905 stress_lr(idir, idir) = stress_lr(idir, idir) &
906 +
m_two*
m_pi*spec_ps%sigma_erf**2*charge*zi /ions%latt%rcell_volume
912 stress_lr = stress_lr/ions%latt%rcell_volume
914 stress_ps_local = stress_sr + stress_lr
923 class(
mesh_t),
intent(in) :: mesh
924 type(
ions_t),
intent(in) :: ions
925 integer,
intent(in) :: iatom
926 real(real64),
intent(inout) :: vpsl(:)
927 real(real64),
intent(inout) :: rvpsl(:,:)
930 real(real64) :: radius, vl_ip
932 type(
ps_t),
pointer :: ps
936 if (.not. ions%atom(iatom)%species%is_ps())
then
943 select type(spec=>ions%atom(iatom)%species)
948 radius = ps%vl%x_threshold*1.05_real64
950 call submesh_init(sphere, ions%space, mesh, ions%latt, ions%pos(:, iatom), radius)
956 vpsl(sphere%map(ip)) = vpsl(sphere%map(ip)) + vl_ip
957 rvpsl(sphere%map(ip), 1:ions%space%periodic_dim) = rvpsl(sphere%map(ip), 1:ions%space%periodic_dim) &
958 + sphere%rel_x(1:ions%space%periodic_dim, ip) * vl_ip
989 type(
grid_t),
target,
intent(in) :: gr
992 type(
space_t),
intent(in) :: space
993 real(real64),
intent(in) :: rcell_volume
994 real(real64),
intent(out) :: stress_hubbard(3, 3)
996 integer :: ik, ist, idir, jdir
997 integer :: ib, minst, maxst
998 type(
wfs_elec_t) :: psib, rvu_psib(3), gpsib(3)
999 complex(real64),
allocatable :: stress_tmp(:)
1010 safe_allocate(stress_tmp(1:st%block_size))
1014 do ik = st%d%kpt%start, st%d%kpt%end
1018 do ib = st%group%block_start, st%group%block_end
1022 call hm%phase%copy_and_set_phase(gr, st%d%kpt, st%group%psib(ib, ik), psib)
1028 do idir = 1, gr%der%dim
1029 call psib%copy_to(rvu_psib(idir))
1033 call zlda_u_rvu(hm%lda_u, gr, space, hm%d, namespace, psib, rvu_psib)
1039 do ist = minst, maxst
1040 stress_hubbard(idir, jdir) = stress_hubbard(idir, jdir) &
1041 +
m_two * st%kweights(ik) * st%occ(ist, ik) * real(stress_tmp(ist-minst+1), real64)
1047 do idir = 1, gr%der%dim
1048 call rvu_psib(idir)%end()
1049 call gpsib(idir)%end()
1055 safe_deallocate_a(stress_tmp)
1057 if (st%parallel_in_states .or. st%d%kpt%parallel)
then
1065 if (hm%kpoints%use_symmetries)
then
1071 stress_hubbard(idir, idir) = stress_hubbard(idir, idir) + hm%energy%int_dft_u
1074 stress_hubbard = stress_hubbard/rcell_volume
1081 subroutine output_stress(iunit, space_dim, stress_tensors, all_terms)
1082 integer,
intent(in) :: iunit
1083 integer,
intent(in) :: space_dim
1084 type(
stress_t),
intent(in) :: stress_tensors
1085 logical,
optional,
intent(in) :: all_terms
1087 logical :: write_all_terms
1088 character(len=16) :: stress_unit
1097 if (write_all_terms)
then
1098 write(iunit,
'(3a)')
'Kinetic stress tensor [', trim(stress_unit),
'] ='
1100 if (space_dim == 3)
then
1101 write(iunit,
'(a, es15.6, 3a)')
'Kinetic pressure sumrule violation: ', &
1108 write(iunit,
'(3a)')
'Hartree stress tensor [', trim(stress_unit),
'] ='
1110 if (space_dim == 3)
then
1111 write(iunit,
'(a, es15.6, 3a)')
'Hartree pressure sumrule violation: ', &
1117 write(iunit,
'(3a)')
'XC stress tensor [', trim(stress_unit),
'] ='
1120 write(iunit,
'(3a)')
'XC NLCC stress tensor [', trim(stress_unit),
'] ='
1123 write(iunit,
'(3a)')
'Local pseudo. stress tensor [', trim(stress_unit),
'] ='
1126 write(iunit,
'(3a)')
'Nonlocal pseudo. stress tensor [', trim(stress_unit),
'] ='
1129 write(iunit,
'(3a)')
'Ion-ion stress tensor [', trim(stress_unit),
'] ='
1132 write(iunit,
'(3a)')
'vdW stress tensor [', trim(stress_unit),
'] ='
1135 write(iunit,
'(3a)')
'Hubbard stress tensor [', trim(stress_unit),
'] ='
1139 write(iunit,
'(3a)')
'Total stress tensor [', trim(stress_unit),
'] ='
1147 integer,
intent(in) :: iunit
1148 integer,
intent(in) :: space_dim
1149 real(real64),
intent(in) :: total_stress_tensor(3,3)
1152 real(real64) :: pressure
1153 character(len=16) :: stress_unit
1159 do idim = 1, space_dim
1160 pressure = pressure - total_stress_tensor(idim, idim) / real(space_dim, real64)
1163 write(iunit,
'(3a,es16.8)', advance=
"no")
'Pressure [', trim(stress_unit),
'] = ', &
1165 if (space_dim == 3)
then
1174 integer,
intent(in) :: ounit
1175 integer,
intent(in) :: space_dim
1176 real(real64),
intent(in) :: tensor(3,3)
1178 real(real64) :: tensor_with_unit(3,3)
1179 integer :: idim, jdim
1183 write(ounit,
'(a9,2x)', advance=
"no")
"T_{ij}"
1184 do jdim = 1, space_dim
1185 write(ounit,
'(i18)', advance=
"no") jdim
1188 do idim = 1, space_dim
1189 write(ounit,
'(i9,2x)', advance=
"no") idim
1190 do jdim = 1, space_dim
1191 write(ounit,
'(es18.9)', advance=
"no") tensor_with_unit(idim, jdim)
constant times a vector plus a vector
Copies a vector x, to a vector y.
This module implements common operations on batches of mesh functions.
subroutine, public batch_set_zero(this, np, async)
fill all mesh functions of the batch with zero
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_batch_grad(der, ffb, opffb, ghost_update, set_bc, to_cartesian, factor)
apply the gradient to a batch of mesh functions
integer, parameter, public spinors
subroutine, public energy_calc_total(namespace, space, hm, gr, st, ext_partners, iunit, full)
This subroutine calculates the total energy of the system. Basically, it adds up the KS eigenvalues,...
integer, parameter, public scalar_relativistic_zora
integer, parameter, public fully_relativistic_zora
real(real64), parameter, public m_two
real(real64), parameter, public m_zero
real(real64), parameter, public m_four
real(real64), parameter, public m_pi
some mathematical constants
integer, parameter, public independent_particles
Theory level.
integer, parameter, public generalized_kohn_sham_dft
integer, parameter, public kohn_sham_dft
real(real64), parameter, public m_epsilon
real(real64), parameter, public m_one
This module implements the underlying real-space grid.
This module defines classes and functions for interaction partners.
subroutine, public ion_interaction_stress(this, space, latt, atom, natoms, pos, stress_ii)
Computes the contribution to the stress tensor the ion-ion energy.
A module to handle KS potential, without the external potential.
integer, parameter, public dft_u_none
subroutine, public zlda_u_rvu(this, mesh, space, d, namespace, psib, gpsib)
This routine computes .
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.
This module defines functions over batches of mesh functions.
subroutine, public zmesh_batch_dotp_vector(mesh, aa, bb, dot, reduce, cproduct)
A simple switch between specialized kernels and generic kernels.
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)
type(mpi_grp_t), public mpi_world
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.
subroutine, public species_get_long_range_density(species, namespace, space, latt, pos, mesh, rho, sphere_inout, nlr_x)
subroutine, public species_get_nlcc_grad(species, space, latt, pos, mesh, rho_core_grad_x)
Returns the (r-R_I)-weighted analytic gradient of the NLCC core density.
real(real64) function, public spline_eval(spl, x)
This module handles spin dimensions of the states and the k-point distribution.
integer pure function, public states_elec_block_max(st, ib)
return index of last state in block ib
integer pure function, public states_elec_block_min(st, ib)
return index of first state in block ib
This module implements the calculation of the stress tensor.
subroutine stress_from_hartree(gr, space, volume, grad_vh, ehartree, stress_Hartree)
Computes the contribution to the stress tensor from the Hartree energy.
subroutine stress_from_kinetic(gr, space, hm, st, symm, rcell_volume, stress_kin)
Computes the contribution to the stress tensor from the kinetic energy.
subroutine stress_from_pseudo_local(gr, hm, ions, rho_total, grad_vh, stress_ps_local)
Computes the contribution from the local part of the pseudopotential.
subroutine print_stress_tensor(ounit, space_dim, tensor)
subroutine, public output_pressure(iunit, space_dim, total_stress_tensor)
subroutine epot_local_pseudopotential_sr(mesh, ions, iatom, vpsl, rvpsl)
subroutine, public stress_calculate(namespace, gr, hm, st, ions, ks, ext_partners)
This computes the total stress on the lattice.
subroutine stress_from_hubbard(namespace, gr, st, hm, space, rcell_volume, stress_hubbard)
Computes the contribution to the stress tensor from the Hubbard energy.
subroutine stress_from_xc(gr, hm, st, space, rcell_volume, stress_xc)
Computes the contribution to the stress tensor from the xc energy.
subroutine stress_from_xc_nlcc(rcell_volume, gr, st, ions, vxc, stress_xc_nlcc)
Computes the NLCC contribution to the stress tensor from the xc energy.
subroutine stress_from_pseudo_nonloc(gr, st, hm, ions, stress_ps_nl)
Computes the contribution to the stress tensor from the nonlocal part of the pseudopotentials.
subroutine, public output_stress(iunit, space_dim, stress_tensors, all_terms)
subroutine, public submesh_end(this)
subroutine, public submesh_init(this, space, mesh, latt, center, rc)
subroutine, public dsymmetrize_tensor_cart(symm, tensor, use_non_symmorphic)
Symmetric a rank-2 tensor defined in Cartesian space.
type(type_t), parameter, public type_cmplx
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
type(unit_t), public unit_gpa
For output pressure in GPa.
logical pure function, public family_is_mgga_with_exc(xcs)
Is the xc function part of the mGGA family with an energy functional.
logical pure function, public xc_is_energy_functional(xcs)
Is one of the x or c functional is not an energy functional.
pure logical function, public in_family(family, xc_families)
A module that takes care of xc contribution from vdW interactions.
integer(int64), dimension(5), parameter, public d3_lib_options
VDWCORRECTION options that correspond to the DFT-D3 library.
Description of the grid, containing information on derivatives, stencil, and symmetries.
Describes mesh distribution to nodes.
A type storing the information and data about a pseudopotential.
The states_elec_t class contains all electronic wave functions.
A submesh is a type of mesh, used for the projectors in the pseudopotentials It contains points on a ...
batches of electronic states