112 integer,
public,
parameter :: &
117 integer,
public,
parameter :: &
127 integer,
public :: level = dft_u_none
130 real(real64),
allocatable,
public :: dn(:,:,:,:)
131 real(real64),
allocatable :: dV(:,:,:,:)
134 complex(real64),
allocatable,
public :: zn(:,:,:,:)
135 complex(real64),
allocatable :: zV(:,:,:,:)
136 real(real64),
allocatable,
public :: dn_alt(:,:,:,:)
137 complex(real64),
allocatable,
public :: zn_alt(:,:,:,:)
139 real(real64),
allocatable :: renorm_occ(:,:,:,:,:)
142 real(real64),
allocatable,
public :: coulomb(:,:,:,:,:)
144 complex(real64),
allocatable,
public :: zcoulomb(:,:,:,:,:,:,:)
147 type(orbitalbasis_t),
public :: basis
148 type(orbitalset_t),
pointer,
public :: orbsets(:) => null()
149 integer,
public :: norbsets = 0
151 integer,
public :: nspins = 0
152 integer,
public :: spin_channels = 0
153 integer :: nspecies = 0
154 integer,
public :: maxnorbs = 0
155 integer :: max_np = 0
157 logical :: useAllOrbitals = .false.
158 logical :: skipSOrbitals = .
true.
159 logical :: freeze_occ = .false.
160 logical :: freeze_u = .false.
161 logical,
public :: intersite = .false.
162 real(real64) :: intersite_radius =
m_zero
163 logical,
public :: basisfromstates = .false.
164 real(real64) :: acbn0_screening =
m_one
165 integer,
allocatable :: basisstates(:)
166 integer,
allocatable :: basisstates_os(:)
168 logical :: rot_inv = .false.
169 integer :: double_couting = dft_u_fll
171 real(real64),
allocatable :: dc_alpha(:)
173 type(lattice_vectors_t),
pointer :: latt
175 type(distributed_t) :: orbs_dist
176 type(mpi_grp_t) :: grp
179 integer,
public :: maxneighbors = 0
180 real(real64),
allocatable,
public :: dn_ij(:,:,:,:,:), dn_alt_ij(:,:,:,:,:), dn_alt_ii(:,:,:,:,:)
181 complex(real64),
allocatable,
public :: zn_ij(:,:,:,:,:), zn_alt_ij(:,:,:,:,:), zn_alt_ii(:,:,:,:,:)
184 logical :: symmetrize_occ_matrices
185 integer,
allocatable :: inv_map_symm(:,:)
187 real(real64),
allocatable :: symm_weight(:,:,:,:)
193 subroutine lda_u_init(this, namespace, space, level, gr, ions, st, mc, kpoints)
194 type(
lda_u_t),
target,
intent(inout) :: this
196 class(
space_t),
intent(in) :: space
197 integer,
intent(in) :: level
198 type(grid_t),
intent(in) :: gr
209 assert(.not. (level == dft_u_none))
212 if (gr%parallel_in_domains)
call messages_experimental(
"dft+u parallel in domains", namespace=namespace)
215 this%latt => ions%latt
217 this%grp = mc%master_grp
229 call parse_variable(namespace,
'DFTUBasisFromStates', .false., this%basisfromstates)
247 call parse_variable(namespace,
'DFTUDoubleCounting', dft_u_fll, this%double_couting)
249 if (this%double_couting /= dft_u_fll)
call messages_experimental(
"DFTUDoubleCounting /= dft_u_ffl", namespace=namespace)
250 if (st%d%ispin ==
spinors .and. this%double_couting /= dft_u_fll)
then
279 call messages_experimental(
"DFTUPoissonSolver different from dft_u_poisson_direct", namespace=namespace)
283 if (gr%parallel_in_domains)
then
284 call messages_not_implemented(
"DFTUPoissonSolver=dft_u_poisson_isf with domain parallelization", namespace=namespace)
286 if (ions%latt%nonorthogonal)
then
291#if !(defined HAVE_PSOLVER)
292 message(1) =
"The PSolver Poisson solver cannot be used since the code was not compiled with the PSolver library."
295 if (gr%parallel_in_domains)
then
296 call messages_not_implemented(
"DFTUPoissonSolver=dft_u_poisson_psolver with domain parallelization", namespace=namespace)
298 if (ions%latt%nonorthogonal)
then
299 call messages_not_implemented(
"DFTUPoissonSolver=dft_u_poisson_psolver with non-orthogonal cells", namespace=namespace)
313 call parse_variable(namespace,
'UseAllAtomicOrbitals', .false., this%useAllOrbitals)
349 if (this%rot_inv .and. st%d%ispin ==
spinors)
then
362 call parse_variable(namespace,
'ACBN0IntersiteInteraction', .false., this%intersite)
366 if (this%intersite)
then
370 if (kpoints%use_symmetries)
then
382 if (abs(this%intersite_radius) <
m_epsilon)
then
383 call messages_write(
"ACBN0IntersiteCutoff must be greater than 0")
394 if (st%requires_generalized_overlap)
then
395 if (this%intersite)
then
398 if (this%basisfromstates)
then
412 if (.not. this%basisfromstates)
then
417 if (st%requires_generalized_overlap .and. this%basis%orthogonalization)
then
424 this%skipSOrbitals, this%useAllOrbitals)
427 this%skipSOrbitals, this%useAllOrbitals)
429 this%orbsets => this%basis%orbsets
430 this%norbsets = this%basis%norbsets
431 this%maxnorbs = this%basis%maxnorbs
432 this%max_np = this%basis%max_np
433 this%nspins = st%d%nspin
434 this%spin_channels = st%d%spin_channels
435 this%nspecies = ions%nspecies
444 if (gr%parallel_in_domains)
then
463 if (
parse_block(namespace,
'DFTUBasisStates', blk) == 0)
then
466 if (this%maxnorbs <1)
then
467 write(
message(1),
'(a,i3,a,i3)')
'DFTUBasisStates must contains at least one state.'
470 safe_allocate(this%basisstates(1:this%maxnorbs))
471 safe_allocate(this%basisstates_os(1:this%maxnorbs))
472 do is = 1, this%maxnorbs
478 write(
message(1),
'(a,i3,a,i3)')
'DFTUBasisStates must be specified if DFTUBasisFromStates=yes'
489 this%nspins = st%d%nspin
490 this%spin_channels = st%d%spin_channels
493 this%orbsets => this%basis%orbsets
506 message(1) =
"Unable to load DFT+U basis from selected states."
513 this%symmetrize_occ_matrices = st%symmetrize_density .or. kpoints%use_symmetries
514 if (this%basisfromstates) this%symmetrize_occ_matrices = .false.
515 if (this%symmetrize_occ_matrices)
then
519 safe_allocate(this%dc_alpha(this%norbsets))
520 this%dc_alpha =
m_one
530 type(
lda_u_t),
target,
intent(inout) :: this
532 class(
space_t),
intent(in) :: space
533 type(
grid_t),
intent(in) :: gr
537 logical :: complex_coulomb_integrals
543 norbs = this%maxnorbs
545 if (.not. this%basisfromstates)
then
549 complex_coulomb_integrals = .false.
550 do ios = 1, this%norbsets
551 if (this%orbsets(ios)%ndim > 1) complex_coulomb_integrals = .
true.
554 if (.not. complex_coulomb_integrals)
then
555 write(
message(1),
'(a)')
'Computing the Coulomb integrals of the localized basis.'
557 safe_allocate(this%coulomb(1:norbs,1:norbs,1:norbs,1:norbs, 1:this%norbsets))
565 write(
message(1),
'(a)')
'Computing complex Coulomb integrals of the localized basis.'
567 safe_allocate(this%zcoulomb(1:norbs, 1:norbs, 1:norbs, 1:norbs, 1:st%d%dim, 1:st%d%dim, 1:this%norbsets))
573 write(
message(1),
'(a)')
'Computing the Coulomb integrals of the localized basis.'
575 safe_allocate(this%coulomb(1:norbs, 1:norbs, 1:norbs, 1:norbs, 1:this%norbsets))
592 type(
lda_u_t),
intent(inout) :: this
596 this%level = dft_u_none
598 safe_deallocate_a(this%dn)
599 safe_deallocate_a(this%zn)
600 safe_deallocate_a(this%dn_alt)
601 safe_deallocate_a(this%zn_alt)
602 safe_deallocate_a(this%dV)
603 safe_deallocate_a(this%zV)
604 safe_deallocate_a(this%coulomb)
605 safe_deallocate_a(this%zcoulomb)
606 safe_deallocate_a(this%renorm_occ)
607 safe_deallocate_a(this%dn_ij)
608 safe_deallocate_a(this%zn_ij)
609 safe_deallocate_a(this%dn_alt_ij)
610 safe_deallocate_a(this%zn_alt_ij)
611 safe_deallocate_a(this%dn_alt_ii)
612 safe_deallocate_a(this%zn_alt_ii)
613 safe_deallocate_a(this%basisstates)
614 safe_deallocate_a(this%basisstates_os)
615 safe_deallocate_a(this%dc_alpha)
616 safe_deallocate_a(this%inv_map_symm)
617 safe_deallocate_a(this%symm_weight)
619 nullify(this%orbsets)
624 if (.not. this%basisfromstates)
then
637 type(
lda_u_t),
target,
intent(inout) :: this
638 type(
ions_t),
target,
intent(in) :: ions
640 integer :: ios, ispec
644 if (this%level == dft_u_none)
then
649 this%latt => ions%latt
651 if (
allocated(this%basis%orbsets))
then
652 this%orbsets => this%basis%orbsets
654 nullify(this%orbsets)
659 do ios = 1, this%norbsets
660 if (.not.
associated(this%orbsets(ios)%spec)) cycle
662 ispec = this%orbsets(ios)%spec_index
663 if (ispec < 1 .or. ispec > ions%nspecies)
then
666 if (.not.
associated(ions%species(ispec)%s))
then
669 this%orbsets(ios)%spec => ions%species(ispec)%s
682 type(
lda_u_t),
intent(inout) :: this
694 if (this%level == dft_u_none .or. .not.
associated(this%orbsets))
then
699 do ios = 1, this%norbsets
704 if (
allocated(this%orbsets(ios)%buff_eorb))
then
705 do ik = lbound(this%orbsets(ios)%buff_eorb, dim=1), ubound(this%orbsets(ios)%buff_eorb, dim=1)
708 safe_deallocate_a(this%orbsets(ios)%buff_eorb)
711 if (
allocated(this%orbsets(ios)%dorb))
then
713 else if (
allocated(this%orbsets(ios)%zorb))
then
724 subroutine lda_u_update_basis(this, space, gr, ions, st, psolver, namespace, kpoints, has_phase, uspp_overlap)
725 type(
lda_u_t),
target,
intent(inout) :: this
726 class(
space_t),
intent(in) :: space
727 type(
grid_t),
intent(in) :: gr
728 type(
ions_t),
target,
intent(in) :: ions
733 logical,
intent(in) :: has_phase
736 integer :: ios, maxorbs, nspin
738 if(this%level == dft_u_none)
return
742 if(.not. this%basisfromstates)
then
745 nullify(this%orbsets)
750 this%skipSOrbitals, this%useAllOrbitals, verbose = .false.)
753 this%skipSOrbitals, this%useAllOrbitals, verbose = .false.)
755 this%orbsets => this%basis%orbsets
756 this%max_np = this%basis%max_np
760 if (st%requires_generalized_overlap .and. this%basis%normalize)
then
770 if (this%intersite)
then
771 this%maxneighbors = 0
772 do ios = 1, this%norbsets
774 this%orbsets, this%norbsets, this%maxnorbs, this%intersite_radius, st%d%kpt, has_phase, &
775 this%sm_poisson, this%basisfromstates, this%basis%combine_j_orbitals)
776 this%maxneighbors = max(this%maxneighbors, this%orbsets(ios)%nneighbors)
779 maxorbs = this%maxnorbs
783 safe_deallocate_a(this%dn_ij)
784 safe_allocate(this%dn_ij(1:maxorbs,1:maxorbs,1:nspin,1:this%norbsets,1:this%maxneighbors))
785 this%dn_ij(1:maxorbs,1:maxorbs,1:nspin,1:this%norbsets,1:this%maxneighbors) =
m_zero
786 safe_deallocate_a(this%dn_alt_ij)
787 safe_allocate(this%dn_alt_ij(1:maxorbs,1:maxorbs,1:nspin,1:this%norbsets,1:this%maxneighbors))
788 this%dn_alt_ij(1:maxorbs,1:maxorbs,1:nspin,1:this%norbsets,1:this%maxneighbors) =
m_zero
789 safe_deallocate_a(this%dn_alt_ii)
790 safe_allocate(this%dn_alt_ii(1:2,1:maxorbs,1:nspin,1:this%norbsets,1:this%maxneighbors))
791 this%dn_alt_ii(1:2,1:maxorbs,1:nspin,1:this%norbsets,1:this%maxneighbors) =
m_zero
793 safe_deallocate_a(this%zn_ij)
794 safe_allocate(this%zn_ij(1:maxorbs,1:maxorbs,1:nspin,1:this%norbsets,1:this%maxneighbors))
795 this%zn_ij(1:maxorbs,1:maxorbs,1:nspin,1:this%norbsets,1:this%maxneighbors) =
m_z0
796 safe_deallocate_a(this%zn_alt_ij)
797 safe_allocate(this%zn_alt_ij(1:maxorbs,1:maxorbs,1:nspin,1:this%norbsets,1:this%maxneighbors))
798 this%zn_alt_ij(1:maxorbs,1:maxorbs,1:nspin,1:this%norbsets,1:this%maxneighbors) =
m_z0
799 safe_deallocate_a(this%zn_alt_ii)
800 safe_allocate(this%zn_alt_ii(1:2,1:maxorbs,1:nspin,1:this%norbsets,1:this%maxneighbors))
801 this%zn_alt_ii(1:2,1:maxorbs,1:nspin,1:this%norbsets,1:this%maxneighbors) =
m_z0
810 if(.not. this%basisfromstates)
then
812 if(this%basis%orthogonalization)
then
815 if(
debug%info .and. space%is_periodic())
then
823 if (
allocated(this%coulomb))
then
824 safe_deallocate_a(this%coulomb)
826 if (
allocated(this%zcoulomb))
then
827 safe_deallocate_a(this%zcoulomb)
839 type(
lda_u_t),
intent(inout) :: this
841 class(
mesh_t),
intent(in) :: mesh
843 type(
phase_t),
intent(in) :: phase
844 type(
energy_t),
intent(inout) :: energy
847 if (this%level == dft_u_none .or. this%freeze_occ)
return
853 if (phase%is_allocated())
then
866 type(
lda_u_t),
intent(inout) :: this
867 class(
space_t),
intent(in) :: space
872 real(real64),
optional,
allocatable,
intent(in) :: vec_pot(:)
873 real(real64),
optional,
allocatable,
intent(in) :: vec_pot_var(:, :)
882 write(
message(1),
'(a)')
'Debug: Building the phase correction for DFT+U orbitals.'
885 do ios = 1, this%norbsets
892 if (.not. this%basisfromstates)
then
893 if (this%basis%orthogonalization)
then
896 if (
debug%info .and. space%is_periodic())
call zloewdin_info(this%basis, std%kpt, namespace)
906 type(
lda_u_t),
intent(in) :: this
908 real(real64),
contiguous,
intent(out) :: kanamori(:,:)
910 if (this%nspins == 1)
then
929 type(
lda_u_t),
intent(inout) :: this
931 this%freeze_occ = .
true.
936 type(
lda_u_t),
intent(inout) :: this
938 this%freeze_u = .
true.
943 type(
lda_u_t),
intent(inout) :: this
944 real(real64),
contiguous,
intent(in) :: ueff(:)
950 do ios = 1,this%norbsets
951 this%orbsets(ios)%Ueff = ueff(ios)
959 type(
lda_u_t),
intent(in) :: this
960 real(real64),
contiguous,
intent(inout) :: ueff(:)
966 do ios = 1,this%norbsets
967 ueff(ios) = this%orbsets(ios)%Ueff
975 type(
lda_u_t),
intent(inout) :: this
976 real(real64),
contiguous,
intent(in) :: veff(:)
978 integer :: ios, ncount
983 do ios = 1, this%norbsets
984 this%orbsets(ios)%V_ij(1:this%orbsets(ios)%nneighbors,0) = veff(ncount+1:ncount+this%orbsets(ios)%nneighbors)
985 ncount = ncount + this%orbsets(ios)%nneighbors
993 type(
lda_u_t),
intent(in) :: this
994 real(real64),
contiguous,
intent(inout) :: veff(:)
996 integer :: ios, ncount
1001 do ios = 1, this%norbsets
1002 veff(ncount+1:ncount+this%orbsets(ios)%nneighbors) = this%orbsets(ios)%V_ij(1:this%orbsets(ios)%nneighbors,0)
1003 ncount = ncount + this%orbsets(ios)%nneighbors
1011 type(
lda_u_t),
intent(in) :: this
1012 integer,
optional,
intent(in) :: iunit
1013 type(
namespace_t),
optional,
intent(in) :: namespace
1020 write(
message(1),
'(a)')
"Method:"
1021 write(
message(2),
'(a)')
" [1] Dudarev et al., Phys. Rev. B 57, 1505 (1998)"
1024 if (.not. this%intersite)
then
1025 write(
message(1),
'(a)')
"Method:"
1026 write(
message(2),
'(a)')
" [1] Agapito et al., Phys. Rev. X 5, 011006 (2015)"
1028 write(
message(1),
'(a)')
"Method:"
1029 write(
message(2),
'(a)')
" [1] Tancogne-Dejean, and Rubio, Phys. Rev. B 102, 155117 (2020)"
1033 write(
message(1),
'(a)')
"Implementation:"
1034 write(
message(2),
'(a)')
" [1] Tancogne-Dejean, Oliveira, and Rubio, Phys. Rev. B 69, 245133 (2017)"
1043 subroutine lda_u_loadbasis(this, namespace, space, st, mesh, mc, ierr)
1044 type(
lda_u_t),
intent(inout) :: this
1048 class(
mesh_t),
intent(in) :: mesh
1050 integer,
intent(out) :: ierr
1052 integer :: err, wfns_file, is, ist, idim, ik, ios, iorb
1054 character(len=256) :: lines(3)
1055 character(len=256),
allocatable :: restart_file(:, :)
1056 logical,
allocatable :: restart_file_present(:, :)
1057 character(len=12) :: filename
1058 character(len=1) :: char
1059 character(len=50) :: str
1061 integer,
allocatable :: count(:)
1062 real(real64) :: norm, center(space%dim)
1063 real(real64),
allocatable :: dpsi(:,:,:)
1064 complex(real64),
allocatable :: zpsi(:,:,:)
1071 message(1) =
"Debug: Loading DFT+U basis from states."
1080 message(1) =
"Error loading DFT+U basis from states, cannot proceed with the calculation"
1086 if (
restart_gs%file_format_states /= option__restartfileformatstates__obf)
then
1087 message(1) =
"Error: loading DFT+U basis only supported for OBF restart format"
1088 message(2) =
"Please set RestartFileFormatStates = obf and re-run the GS calculation."
1094 call restart_gs%read(wfns_file, lines, 2, err)
1098 read(lines(2),
'(a)') str
1099 if (str(2:8) ==
'Complex')
then
1100 message(1) =
"Cannot read real states from complex wavefunctions."
1102 else if (str(2:5) /=
'Real')
then
1103 message(1) =
"Restart file 'wfns' does not specify real/complex; cannot check compatibility."
1114 message(1) =
"Error loading DFT+U basis from states, cannot proceed with the calculation"
1120 safe_allocate(restart_file(1:st%d%dim, 1:st%nst))
1121 safe_allocate(restart_file_present(1:st%d%dim, 1:st%nst))
1122 restart_file_present = .false.
1128 call restart_gs%read(wfns_file, lines, 1, err)
1130 read(lines(1),
'(a)') char
1131 if (char ==
'%')
then
1135 read(lines(1), *) ik, char, ist, char, idim, char, filename
1139 if (any(this%basisstates==ist) .and. ik == 1)
then
1140 restart_file(idim, ist) = trim(filename)
1141 restart_file_present(idim, ist) = .
true.
1147 safe_allocate(count(1:this%norbsets))
1149 do is = 1, this%maxnorbs
1150 ist = this%basisstates(is)
1151 ios = this%basisstates_os(is)
1152 count(ios) = count(ios)+1
1153 do idim = 1, st%d%dim
1155 if (.not. restart_file_present(idim, ist))
then
1156 write(
message(1),
'(a,i3,a)')
"Cannot read states ", ist,
"from the projection folder"
1161 call restart_gs%read_mesh_function(restart_file(idim, ist), mesh, &
1162 this%orbsets(ios)%dorb(:,idim,count(ios)), err)
1164 call restart_gs%read_mesh_function(restart_file(idim, ist), mesh, &
1165 this%orbsets(ios)%zorb(:,idim,count(ios)), err)
1168 message(1) =
"Error loading mesh function "//trim(restart_file(idim, ist))
1173 safe_deallocate_a(count)
1174 safe_deallocate_a(restart_file)
1175 safe_deallocate_a(restart_file_present)
1179 if(this%basis%normalize)
then
1180 do ios = 1, this%norbsets
1181 do iorb = 1, this%orbsets(ios)%norbs
1183 norm =
dmf_nrm2(mesh, st%d%dim, this%orbsets(ios)%dorb(:,:,iorb))
1184 call lalg_scal(mesh%np, st%d%dim,
m_one/norm, this%orbsets(ios)%dorb(:,:,iorb))
1186 norm =
zmf_nrm2(mesh, st%d%dim, this%orbsets(ios)%zorb(:,:,iorb))
1187 call lalg_scal(mesh%np, st%d%dim,
m_one/norm, this%orbsets(ios)%zorb(:,:,iorb))
1195 do ios = 1, this%norbsets
1196 do iorb = 1, this%orbsets(ios)%norbs
1204 do ios = 1, this%norbsets
1212 message(1) =
"Debug: Converting the Wannier states to submeshes."
1217 do ios = 1, this%norbsets
1218 os => this%orbsets(ios)
1219 center = os%sphere%center
1220 safe_deallocate_a(os%sphere%center)
1222 safe_allocate(dpsi(1:mesh%np, 1:os%ndim, 1:os%norbs))
1223 dpsi(1:mesh%np, 1:os%ndim, 1:os%norbs) = os%dorb(1:mesh%np, 1:os%ndim, 1:os%norbs)
1225 safe_deallocate_a(os%dorb)
1227 call submesh_init(os%sphere, space, mesh, this%latt, center, os%radius)
1228 safe_allocate(os%dorb(1:os%sphere%np, 1:os%ndim, 1:os%norbs))
1229 do iorb = 1, os%norbs
1230 do idim = 1, os%ndim
1234 safe_deallocate_a(dpsi)
1236 safe_allocate(zpsi(1:mesh%np, 1:os%ndim, 1:os%norbs))
1237 zpsi(1:mesh%np, 1:os%ndim, 1:os%norbs) = os%zorb(1:mesh%np, 1:os%ndim, 1:os%norbs)
1238 safe_deallocate_a(os%zorb)
1240 call submesh_init(os%sphere, space, mesh, this%latt, center, os%radius)
1241 safe_allocate(os%zorb(1:os%sphere%np, 1:os%ndim, 1:os%norbs))
1242 do iorb = 1, os%norbs
1243 do idim = 1, os%ndim
1247 safe_deallocate_a(zpsi)
1249 safe_allocate(os%phase(1:os%sphere%np, st%d%kpt%start:st%d%kpt%end))
1250 safe_allocate(os%eorb_submesh(1:os%sphere%np, 1:os%ndim, 1:os%norbs, st%d%kpt%start:st%d%kpt%end))
1252 os%use_submesh = .
true.
1253 os%allocated_on_mesh = .false.
1254 this%max_np = max(this%max_np, os%sphere%np)
1257 this%basis%use_submesh = .
true.
1261 do ios = 1, this%norbsets
1262 os => this%orbsets(ios)
1270 safe_allocate(os%buff_eorb(st%d%kpt%start:st%d%kpt%end))
1272 do ik= st%d%kpt%start, st%d%kpt%end
1280 do iorb = 1, os%norbs
1283 offset = (iorb - 1)*os%ldorbs)
1286 offset = (iorb - 1)*os%ldorbs)
1293 message(1) =
"Debug: Loading DFT+U basis from states done."
1301 type(
lda_u_t),
intent(inout) :: this
1302 type(
ions_t),
intent(in) :: ions
1303 type(
grid_t),
intent(in) :: gr
1305 integer :: nsym, iop, ios, iatom, iatom_sym, ios_sym
1309 nsym = ions%symm%nops
1310 safe_allocate(this%inv_map_symm(1:this%norbsets, 1:nsym))
1311 this%inv_map_symm = -1
1315 do ios = 1, this%norbsets
1316 iatom = this%orbsets(ios)%iatom
1318 iatom_sym = ions%inv_map_symm_atoms(iatom, iop)
1320 do ios_sym = 1, this%norbsets
1321 if (this%orbsets(ios_sym)%iatom == iatom_sym .and. this%orbsets(ios_sym)%norbs == this%orbsets(ios)%norbs &
1322 .and. this%orbsets(ios_sym)%nn == this%orbsets(ios)%nn .and. this%orbsets(ios_sym)%ll == this%orbsets(ios)%ll &
1323 .and.
is_close(this%orbsets(ios_sym)%jj, this%orbsets(ios)%jj))
then
1324 this%inv_map_symm(ios, iop) = ios_sym
1328 assert(this%inv_map_symm(ios, iop) > 0)
1332 safe_allocate(this%symm_weight(1:this%maxnorbs, 1:this%maxnorbs, 1:this%nsym, 1:this%norbsets))
1333 this%symm_weight =
m_zero
1335 do ios = 1, this%norbsets
1337 if (this%orbsets(ios)%norbs == 1)
then
1338 this%symm_weight(1,1, 1:this%nsym, ios) =
m_one
1343 if (this%orbsets(ios)%ndim > 1) cycle
1345 call orbitals_get_symm_weight(this%orbsets(ios), ions%space, ions%latt, gr, ions%symm, this%symm_weight(:,:,:,ios))
1354 type(
space_t),
intent(in) :: space
1356 type(
grid_t),
intent(in) :: gr
1358 real(real64),
contiguous,
intent(inout) :: weight(:,:,:)
1360 integer :: im, imp, iop, mm
1361 real(real64),
allocatable :: orb(:,:), orb_sym(:), ylm(:)
1363 real(real64) :: rc, norm, origin(space%dim)
1367 assert(os%ndim == 1)
1369 safe_allocate(orb_sym(1:gr%np))
1370 safe_allocate(orb(1:gr%np, 1:os%norbs))
1372 assert(2*os%ll+1 == os%norbs)
1380 safe_allocate(ylm(1:sphere%np))
1385 call loct_ylm(sphere%np, sphere%rel_x(1,1), sphere%r(1), os%ll, mm, ylm(1))
1391 safe_deallocate_a(ylm)
1395 do iop = 1, symm%nops
1398 do imp = 1, os%norbs
1399 weight(im, imp, iop) =
dmf_dotp(gr, orb(:,imp), orb_sym, reduce=.false.)
1404 call gr%allreduce(weight)
1406 safe_deallocate_a(orb)
1407 safe_deallocate_a(orb_sym)
1412#include "dft_u_noncollinear_inc.F90"
1416#include "lda_u_inc.F90"
1419#include "complex.F90"
1420#include "lda_u_inc.F90"
scales a vector by a constant
Prints out to iunit a message in the form: ["InputVariable" = value] where "InputVariable" is given b...
subroutine, public accel_detach_buffer(this)
Clear a buffer handle without freeing device memory.
pure logical function, public accel_is_enabled()
integer, parameter, public accel_mem_read_only
This module implements batches of mesh functions.
This module implements common operations on batches of mesh functions.
Module implementing boundary conditions in Octopus.
type(debug_t), save, public debug
This module calculates the derivatives (gradients, Laplacians, etc.) of a function.
subroutine, public distributed_end(this)
subroutine, public distributed_init(this, total, comm, tag, scalapack_compat)
Distribute N instances across M processes of communicator comm
subroutine, public distributed_init_serial(this, total)
Serial initialization of a distributed instance. The calling process is assigned all total instances,...
integer, parameter, public spinors
integer, parameter, public spin_polarized
real(real64), parameter, public m_zero
real(real64), parameter, public m_four
real(real64), parameter, public m_third
real(real64), parameter, public m_pi
some mathematical constants
complex(real64), parameter, public m_z0
real(real64), parameter, public m_epsilon
real(real64), parameter, public m_one
real(real64), parameter, public m_three
This module implements the underlying real-space grid.
subroutine, public dgrid_symmetrize_single(gr, iop, field, symm_field)
integer, parameter, public dft_u_amf
subroutine, public zlda_u_commute_r(this, mesh, space, d, namespace, psib, gpsib)
This routine computes [r,V_lda+u] .
subroutine zlda_u_allocate(this, st)
subroutine, public lda_u_get_effectiveu(this, Ueff)
subroutine, public zlda_u_force(this, namespace, space, mesh, st, iq, psib, grad_psib, force, der, vnl, uspp_overlap)
subroutine compute_complex_coulomb_integrals(this, gr, st, psolver, namespace, space)
subroutine, public lda_u_update_basis(this, space, gr, ions, st, psolver, namespace, kpoints, has_phase, uspp_overlap)
subroutine zupdate_occ_matrices(this, namespace, mesh, st, lda_u_energy, uspp_overlap, phase)
This routine computes the values of the occupation matrices.
subroutine, public dlda_u_force(this, namespace, space, mesh, st, iq, psib, grad_psib, force, der, vnl, uspp_overlap)
subroutine, public lda_u_set_effectiveu(this, Ueff)
subroutine zlda_u_normalize_orbitals_uspp(this, mesh, uspp_overlap)
S-normalize the localized Hubbard orbitals for ultrasoft/PAW.
subroutine build_symmetrization_map(this, ions, gr)
Builds a mapping between the orbital sets based on symmetries.
subroutine dcompute_acbno_u_kanamori_restricted(this, kanamori)
This routine computes the Kanamori U, Up, and J.
subroutine, public lda_u_update_occ_matrices(this, namespace, mesh, st, phase, energy, uspp_overlap)
subroutine, public lda_u_init(this, namespace, space, level, gr, ions, st, mc, kpoints)
subroutine, public dlda_u_get_occupations(this, occ)
subroutine, public dlda_u_rvu(this, mesh, space, d, namespace, psib, gpsib)
This routine computes .
subroutine orbitals_get_symm_weight(os, space, latt, gr, symm, weight)
Computes the weight of each rotated orbitals in the basis of the same localized subspace.
subroutine, public dlda_u_apply(this, d, mesh, psib, hpsib, uspp_overlap)
Apply the +U nonlocal potential to psib and adds the result to hpsib.
subroutine dupdate_occ_matrices(this, namespace, mesh, st, lda_u_energy, uspp_overlap, phase)
This routine computes the values of the occupation matrices.
subroutine, public lda_u_accel_rebuild(this, kpt)
Rebuild DFT+U accelerator buffers after intrinsic assignment.
subroutine, public zcompute_dftu_energy(this, energy, st)
This routine computes the value of the double counting term in the DFT+U energy.
integer, parameter, public dft_u_empirical
subroutine zcompute_acbno_u_kanamori_restricted(this, kanamori)
This routine computes the Kanamori U, Up, and J.
subroutine dcompute_acbno_u_kanamori(this, kanamori)
This routine computes the Kanamori U, Up, and J.
subroutine, public zlda_u_commute_r_single(this, mesh, space, d, namespace, ist, ik, psi, gpsi, has_phase)
subroutine, public lda_u_freeze_occ(this)
integer, parameter, public dft_u_mix
subroutine, public lda_u_rebind_after_copy(this, ions)
Rebind non-owning pointers after intrinsic assignment of lda_u_t.
subroutine, public lda_u_freeze_u(this)
subroutine, public zlda_u_rvu(this, mesh, space, d, namespace, psib, gpsib)
This routine computes .
subroutine dlda_u_allocate(this, st)
subroutine, public compute_acbno_u_kanamori(this, st, kanamori)
subroutine, public zlda_u_update_potential(this, st)
This routine computes the potential that, once multiplied by the projector Pmm' and summed over m and...
subroutine lda_u_init_coulomb_integrals(this, namespace, space, gr, st, psolver)
subroutine, public lda_u_write_info(this, iunit, namespace)
subroutine, public dlda_u_commute_r(this, mesh, space, d, namespace, psib, gpsib)
This routine computes [r,V_lda+u] .
subroutine, public zlda_u_apply(this, d, mesh, psib, hpsib, uspp_overlap)
Apply the +U nonlocal potential to psib and adds the result to hpsib.
subroutine dcompute_coulomb_integrals(this, namespace, space, gr, psolver)
subroutine, public dlda_u_set_occupations(this, occ)
subroutine, public lda_u_get_effectivev(this, Veff)
subroutine lda_u_loadbasis(this, namespace, space, st, mesh, mc, ierr)
subroutine, public dlda_u_commute_r_single(this, mesh, space, d, namespace, ist, ik, psi, gpsi, has_phase)
subroutine, public lda_u_build_phase_correction(this, space, std, boundaries, namespace, kpoints, vec_pot, vec_pot_var)
Build the phase correction to the global phase for all orbitals.
subroutine, public lda_u_end(this)
subroutine, public lda_u_set_effectivev(this, Veff)
integer, parameter, public dft_u_acbn0
subroutine zcompute_acbno_u_kanamori(this, kanamori)
This routine computes the Kanamori U, Up, and J.
subroutine zcompute_coulomb_integrals(this, namespace, space, gr, psolver)
subroutine dlda_u_normalize_orbitals_uspp(this, mesh, uspp_overlap)
S-normalize the localized Hubbard orbitals for ultrasoft/PAW.
subroutine, public zlda_u_get_occupations(this, occ)
subroutine, public dcompute_dftu_energy(this, energy, st)
This routine computes the value of the double counting term in the DFT+U energy.
subroutine, public dlda_u_update_potential(this, st)
This routine computes the potential that, once multiplied by the projector Pmm' and summed over m and...
subroutine, public zlda_u_set_occupations(this, occ)
System information (time, memory, sysname)
subroutine, public dloewdin_orthogonalize(basis, kpt, namespace)
subroutine, public zloewdin_info(basis, kpt, namespace)
subroutine, public zloewdin_orthogonalize(basis, kpt, namespace)
subroutine, public dloewdin_info(basis, kpt, namespace)
This module is intended to contain "only mathematical" functions and procedures.
This module defines various routines, operating on mesh functions.
subroutine, public zmf_fix_phase(mesh, ff)
Fix the phase of complex function.
This module defines the meshes, which are used in Octopus.
subroutine, public messages_print_with_emphasis(msg, iunit, namespace)
subroutine, public messages_not_implemented(feature, namespace)
character(len=512), private msg
subroutine, public messages_warning(no_lines, all_nodes, 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)
subroutine, public messages_experimental(name, namespace)
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
type(mpi_grp_t), public mpi_world
This module handles the communicators for the various parallelization strategies.
subroutine, public orbitalbasis_end(this)
subroutine, public zorbitalbasis_build(this, namespace, ions, mesh, kpt, ndim, skip_s_orb, use_all_orb, verbose)
This routine is an interface for constructing the orbital basis.
subroutine, public dorbitalbasis_build(this, namespace, ions, mesh, kpt, ndim, skip_s_orb, use_all_orb, verbose)
This routine is an interface for constructing the orbital basis.
subroutine, public dorbitalbasis_build_empty(this, mesh, ndim, norbsets, map_os, verbose)
This routine constructd an empty orbital basis.
subroutine, public zorbitalbasis_build_empty(this, mesh, ndim, norbsets, map_os, verbose)
This routine constructd an empty orbital basis.
subroutine, public orbitalbasis_init(this, namespace, periodic_dim)
subroutine, public orbitalset_update_phase_shift(os, dim, kpt, kpoints, spin_polarized, vec_pot, vec_pot_var, kpt_max)
Build the phase shift for the intersite interaction.
subroutine, public dorbitalset_transfer_to_device(os, kpt, use_mesh)
Allocate and transfer the orbitals to the device.
subroutine, public orbitalset_update_phase(os, dim, kpt, kpoints, spin_polarized, vec_pot, vec_pot_var, kpt_max)
Build the phase correction to the global phase in case the orbital crosses the border of the simulato...
subroutine, public zorbitalset_transfer_to_device(os, kpt, use_mesh)
Allocate and transfer the orbitals to the device.
integer, parameter, public sm_poisson_psolver
integer, parameter, public sm_poisson_isf
subroutine, public zorbitalset_get_center_of_mass(os, space, mesh, latt)
integer, parameter, public sm_poisson_direct
subroutine, public dorbitalset_get_center_of_mass(os, space, mesh, latt)
subroutine, public orbitalset_init_intersite(this, namespace, space, grp, ind, ions, der, psolver, os, nos, maxnorbs, rcut, kpt, has_phase, sm_poisson, basis_from_states, combine_j_orbitals)
integer, parameter, public sm_poisson_fft
integer function, public parse_block(namespace, name, blk, check_varinfo_)
/* To use the profiling module, call profiling_in and profiling_out with the label of the region as a...
integer, parameter, public restart_gs
integer, parameter, public restart_proj
integer, parameter, public restart_type_load
pure logical function, public states_are_complex(st)
pure logical function, public states_are_real(st)
This module handles spin dimensions of the states and the k-point distribution.
subroutine, public zsubmesh_copy_from_mesh(this, phi, sphi, conjugate)
subroutine, public dsubmesh_copy_from_mesh(this, phi, sphi, conjugate)
subroutine, public submesh_init(this, space, mesh, latt, center, rc)
type(type_t), parameter, public type_cmplx
type(type_t), parameter, public type_integer
type(type_t), parameter, public type_float
This module defines the unit system, used for input and output.
type(unit_system_t), public units_inp
the units systems for reading and writing
This class contains information about the boundary conditions.
Distribution of N instances over mpi_grpsize processes, for the local rank mpi_grprank....
Description of the grid, containing information on derivatives, stencil, and symmetries.
Class to describe DFT+U parameters.
Describes mesh distribution to nodes.
Stores all communicators and groups.
nonlocal part of the pseudopotential
A container for the phase.
class for organizing spins and k-points
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 ...