108 integer,
public,
parameter :: &
113 integer,
public,
parameter :: &
123 integer,
public :: level = dft_u_none
126 real(real64),
allocatable,
public :: dn(:,:,:,:)
127 real(real64),
allocatable :: dV(:,:,:,:)
130 complex(real64),
allocatable,
public :: zn(:,:,:,:)
131 complex(real64),
allocatable :: zV(:,:,:,:)
132 real(real64),
allocatable,
public :: dn_alt(:,:,:,:)
133 complex(real64),
allocatable,
public :: zn_alt(:,:,:,:)
135 real(real64),
allocatable :: renorm_occ(:,:,:,:,:)
138 real(real64),
allocatable,
public :: coulomb(:,:,:,:,:)
140 complex(real64),
allocatable,
public :: zcoulomb(:,:,:,:,:,:,:)
143 type(orbitalbasis_t),
public :: basis
144 type(orbitalset_t),
pointer,
public :: orbsets(:) => null()
145 integer,
public :: norbsets = 0
147 integer,
public :: nspins = 0
148 integer,
public :: spin_channels = 0
149 integer :: nspecies = 0
150 integer,
public :: maxnorbs = 0
151 integer :: max_np = 0
153 logical :: useAllOrbitals = .false.
154 logical :: skipSOrbitals = .
true.
155 logical :: freeze_occ = .false.
156 logical :: freeze_u = .false.
157 logical,
public :: intersite = .false.
158 real(real64) :: intersite_radius =
m_zero
159 logical,
public :: basisfromstates = .false.
160 real(real64) :: acbn0_screening =
m_one
161 integer,
allocatable :: basisstates(:)
162 integer,
allocatable :: basisstates_os(:)
163 logical :: rot_inv = .false.
164 integer :: double_couting = dft_u_fll
166 real(real64),
allocatable :: dc_alpha(:)
168 type(lattice_vectors_t),
pointer :: latt
170 type(distributed_t) :: orbs_dist
173 integer,
public :: maxneighbors = 0
174 real(real64),
allocatable,
public :: dn_ij(:,:,:,:,:), dn_alt_ij(:,:,:,:,:), dn_alt_ii(:,:,:,:,:)
175 complex(real64),
allocatable,
public :: zn_ij(:,:,:,:,:), zn_alt_ij(:,:,:,:,:), zn_alt_ii(:,:,:,:,:)
178 logical :: symmetrize_occ_matrices
179 integer,
allocatable :: inv_map_symm(:,:)
181 real(real64),
allocatable :: symm_weight(:,:,:,:)
187 subroutine lda_u_init(this, namespace, space, level, gr, ions, st, mc, kpoints, has_phase)
188 type(lda_u_t),
target,
intent(inout) :: this
189 type(namespace_t),
intent(in) :: namespace
190 class(space_t),
intent(in) :: space
191 integer,
intent(in) :: level
192 type(grid_t),
intent(in) :: gr
193 type(ions_t),
target,
intent(in) :: ions
194 type(states_elec_t),
intent(in) :: st
195 type(multicomm_t),
intent(in) :: mc
196 type(kpoints_t),
intent(in) :: kpoints
197 logical,
intent(in) :: has_phase
204 assert(.not. (level == dft_u_none))
207 if (gr%parallel_in_domains)
call messages_experimental(
"dft+u parallel in domains", namespace=namespace)
210 this%latt => ions%latt
222 call parse_variable(namespace,
'DFTUBasisFromStates', .false., this%basisfromstates)
240 call parse_variable(namespace,
'DFTUDoubleCounting', dft_u_fll, this%double_couting)
242 if (this%double_couting /= dft_u_fll)
call messages_experimental(
"DFTUDoubleCounting /= dft_u_ffl", namespace=namespace)
243 if (st%d%ispin ==
spinors .and. this%double_couting /= dft_u_fll)
then
276 if (gr%parallel_in_domains)
then
277 call messages_not_implemented(
"DFTUPoissonSolver=dft_u_poisson_isf with domain parallelization", namespace=namespace)
279 if (ions%latt%nonorthogonal)
then
284#if !(defined HAVE_PSOLVER)
285 message(1) =
"The PSolver Poisson solver cannot be used since the code was not compiled with the PSolver library."
288 if (gr%parallel_in_domains)
then
289 call messages_not_implemented(
"DFTUPoissonSolver=dft_u_poisson_psolver with domain parallelization", namespace=namespace)
291 if (ions%latt%nonorthogonal)
then
292 call messages_not_implemented(
"DFTUPoissonSolver=dft_u_poisson_psolver with non-orthogonal cells", namespace=namespace)
306 call parse_variable(namespace,
'UseAllAtomicOrbitals', .false., this%useAllOrbitals)
342 if (this%rot_inv .and. st%d%ispin ==
spinors)
then
355 call parse_variable(namespace,
'ACBN0IntersiteInteraction', .false., this%intersite)
359 if (this%intersite)
then
363 if (kpoints%use_symmetries)
then
375 if (abs(this%intersite_radius) <
m_epsilon)
then
376 call messages_write(
"ACBN0IntersiteCutoff must be greater than 0")
386 if (.not. this%basisfromstates)
then
392 this%skipSOrbitals, this%useAllOrbitals)
395 this%skipSOrbitals, this%useAllOrbitals)
397 this%orbsets => this%basis%orbsets
398 this%norbsets = this%basis%norbsets
399 this%maxnorbs = this%basis%maxnorbs
400 this%max_np = this%basis%max_np
401 this%nspins = st%d%nspin
402 this%spin_channels = st%d%spin_channels
403 this%nspecies = ions%nspecies
414 if (.not. gr%parallel_in_domains)
then
415 call distributed_init(this%orbs_dist, this%norbsets, mpi_comm_world,
"orbsets")
432 if (
parse_block(namespace,
'DFTUBasisStates', blk) == 0)
then
435 if (this%maxnorbs <1)
then
436 write(
message(1),
'(a,i3,a,i3)')
'DFTUBasisStates must contains at least one state.'
439 safe_allocate(this%basisstates(1:this%maxnorbs))
440 safe_allocate(this%basisstates_os(1:this%maxnorbs))
441 do is = 1, this%maxnorbs
447 write(
message(1),
'(a,i3,a,i3)')
'DFTUBasisStates must be specified if DFTUBasisFromStates=yes'
458 this%nspins = st%d%nspin
459 this%spin_channels = st%d%spin_channels
462 this%orbsets => this%basis%orbsets
475 message(1) =
"Unable to load DFT+U basis from selected states."
482 this%symmetrize_occ_matrices = st%symmetrize_density .or. kpoints%use_symmetries
483 if (this%basisfromstates) this%symmetrize_occ_matrices = .false.
484 if (this%symmetrize_occ_matrices)
then
488 safe_allocate(this%dc_alpha(this%norbsets))
489 this%dc_alpha =
m_one
499 type(
lda_u_t),
target,
intent(inout) :: this
501 class(
space_t),
intent(in) :: space
502 type(
grid_t),
intent(in) :: gr
505 logical,
intent(in) :: has_phase
507 logical :: complex_coulomb_integrals
513 norbs = this%maxnorbs
515 if (.not. this%basisfromstates)
then
519 complex_coulomb_integrals = .false.
520 do ios = 1, this%norbsets
521 if (this%orbsets(ios)%ndim > 1) complex_coulomb_integrals = .
true.
524 if (.not. complex_coulomb_integrals)
then
525 write(
message(1),
'(a)')
'Computing the Coulomb integrals of the localized basis.'
527 safe_allocate(this%coulomb(1:norbs,1:norbs,1:norbs,1:norbs, 1:this%norbsets))
535 write(
message(1),
'(a)')
'Computing complex Coulomb integrals of the localized basis.'
537 safe_allocate(this%zcoulomb(1:norbs, 1:norbs, 1:norbs, 1:norbs, 1:st%d%dim, 1:st%d%dim, 1:this%norbsets))
543 write(
message(1),
'(a)')
'Computing the Coulomb integrals of the localized basis.'
545 safe_allocate(this%coulomb(1:norbs, 1:norbs, 1:norbs, 1:norbs, 1:this%norbsets))
562 type(
lda_u_t),
intent(inout) :: this
566 this%level = dft_u_none
568 safe_deallocate_a(this%dn)
569 safe_deallocate_a(this%zn)
570 safe_deallocate_a(this%dn_alt)
571 safe_deallocate_a(this%zn_alt)
572 safe_deallocate_a(this%dV)
573 safe_deallocate_a(this%zV)
574 safe_deallocate_a(this%coulomb)
575 safe_deallocate_a(this%zcoulomb)
576 safe_deallocate_a(this%renorm_occ)
577 safe_deallocate_a(this%dn_ij)
578 safe_deallocate_a(this%zn_ij)
579 safe_deallocate_a(this%dn_alt_ij)
580 safe_deallocate_a(this%zn_alt_ij)
581 safe_deallocate_a(this%dn_alt_ii)
582 safe_deallocate_a(this%zn_alt_ii)
583 safe_deallocate_a(this%basisstates)
584 safe_deallocate_a(this%basisstates_os)
585 safe_deallocate_a(this%dc_alpha)
586 safe_deallocate_a(this%inv_map_symm)
587 safe_deallocate_a(this%symm_weight)
589 nullify(this%orbsets)
594 if (.not. this%basisfromstates)
then
602 subroutine lda_u_update_basis(this, space, gr, ions, st, psolver, namespace, kpoints, has_phase)
603 type(
lda_u_t),
target,
intent(inout) :: this
604 class(
space_t),
intent(in) :: space
605 type(
grid_t),
intent(in) :: gr
606 type(
ions_t),
target,
intent(in) :: ions
611 logical,
intent(in) :: has_phase
613 integer :: ios, maxorbs, nspin
615 if(this%level == dft_u_none)
return
619 if(.not. this%basisfromstates)
then
622 nullify(this%orbsets)
627 this%skipSOrbitals, this%useAllOrbitals, verbose = .false.)
630 this%skipSOrbitals, this%useAllOrbitals, verbose = .false.)
632 this%orbsets => this%basis%orbsets
633 this%max_np = this%basis%max_np
637 if (this%intersite)
then
638 this%maxneighbors = 0
639 do ios = 1, this%norbsets
641 this%orbsets, this%norbsets, this%maxnorbs, this%intersite_radius, st%d%kpt, has_phase, &
642 this%sm_poisson, this%basisfromstates, this%basis%combine_j_orbitals)
643 this%maxneighbors = max(this%maxneighbors, this%orbsets(ios)%nneighbors)
646 maxorbs = this%maxnorbs
650 safe_deallocate_a(this%dn_ij)
651 safe_allocate(this%dn_ij(1:maxorbs,1:maxorbs,1:nspin,1:this%norbsets,1:this%maxneighbors))
652 this%dn_ij(1:maxorbs,1:maxorbs,1:nspin,1:this%norbsets,1:this%maxneighbors) =
m_zero
653 safe_deallocate_a(this%dn_alt_ij)
654 safe_allocate(this%dn_alt_ij(1:maxorbs,1:maxorbs,1:nspin,1:this%norbsets,1:this%maxneighbors))
655 this%dn_alt_ij(1:maxorbs,1:maxorbs,1:nspin,1:this%norbsets,1:this%maxneighbors) =
m_zero
656 safe_deallocate_a(this%dn_alt_ii)
657 safe_allocate(this%dn_alt_ii(1:2,1:maxorbs,1:nspin,1:this%norbsets,1:this%maxneighbors))
658 this%dn_alt_ii(1:2,1:maxorbs,1:nspin,1:this%norbsets,1:this%maxneighbors) =
m_zero
660 safe_deallocate_a(this%zn_ij)
661 safe_allocate(this%zn_ij(1:maxorbs,1:maxorbs,1:nspin,1:this%norbsets,1:this%maxneighbors))
662 this%zn_ij(1:maxorbs,1:maxorbs,1:nspin,1:this%norbsets,1:this%maxneighbors) =
m_z0
663 safe_deallocate_a(this%zn_alt_ij)
664 safe_allocate(this%zn_alt_ij(1:maxorbs,1:maxorbs,1:nspin,1:this%norbsets,1:this%maxneighbors))
665 this%zn_alt_ij(1:maxorbs,1:maxorbs,1:nspin,1:this%norbsets,1:this%maxneighbors) =
m_z0
666 safe_deallocate_a(this%zn_alt_ii)
667 safe_allocate(this%zn_alt_ii(1:2,1:maxorbs,1:nspin,1:this%norbsets,1:this%maxneighbors))
668 this%zn_alt_ii(1:2,1:maxorbs,1:nspin,1:this%norbsets,1:this%maxneighbors) =
m_z0
677 if(.not. this%basisfromstates)
then
679 if(this%basis%orthogonalization)
then
682 if(
debug%info .and. space%is_periodic())
then
690 if (
allocated(this%coulomb))
then
691 safe_deallocate_a(this%coulomb)
693 if (
allocated(this%zcoulomb))
then
694 safe_deallocate_a(this%zcoulomb)
704 type(
lda_u_t),
intent(inout) :: this
706 class(
mesh_t),
intent(in) :: mesh
709 type(
phase_t),
intent(in) :: phase
710 type(
energy_t),
intent(inout) :: energy
712 if (this%level == dft_u_none .or. this%freeze_occ)
return
718 if (phase%is_allocated())
then
731 type(
lda_u_t),
intent(inout) :: this
732 class(
space_t),
intent(in) :: space
737 real(real64),
optional,
allocatable,
intent(in) :: vec_pot(:)
738 real(real64),
optional,
allocatable,
intent(in) :: vec_pot_var(:, :)
747 write(
message(1),
'(a)')
'Debug: Building the phase correction for DFT+U orbitals.'
750 do ios = 1, this%norbsets
757 if (.not. this%basisfromstates)
then
758 if (this%basis%orthogonalization)
then
761 if (
debug%info .and. space%is_periodic())
call zloewdin_info(this%basis, std%kpt, namespace)
771 type(
lda_u_t),
intent(in) :: this
773 real(real64),
intent(out) :: kanamori(:,:)
775 if (this%nspins == 1)
then
794 type(
lda_u_t),
intent(inout) :: this
801 type(
lda_u_t),
intent(inout) :: this
803 this%freeze_u = .
true.
808 type(
lda_u_t),
intent(inout) :: this
809 real(real64),
intent(in) :: ueff(:)
815 do ios = 1,this%norbsets
816 this%orbsets(ios)%Ueff = ueff(ios)
824 type(
lda_u_t),
intent(in) :: this
825 real(real64),
intent(inout) :: ueff(:)
831 do ios = 1,this%norbsets
832 ueff(ios) = this%orbsets(ios)%Ueff
840 type(
lda_u_t),
intent(inout) :: this
841 real(real64),
intent(in) :: veff(:)
843 integer :: ios, ncount
848 do ios = 1, this%norbsets
849 this%orbsets(ios)%V_ij(1:this%orbsets(ios)%nneighbors,0) = veff(ncount+1:ncount+this%orbsets(ios)%nneighbors)
850 ncount = ncount + this%orbsets(ios)%nneighbors
858 type(
lda_u_t),
intent(in) :: this
859 real(real64),
intent(inout) :: veff(:)
861 integer :: ios, ncount
866 do ios = 1, this%norbsets
867 veff(ncount+1:ncount+this%orbsets(ios)%nneighbors) = this%orbsets(ios)%V_ij(1:this%orbsets(ios)%nneighbors,0)
868 ncount = ncount + this%orbsets(ios)%nneighbors
876 type(
lda_u_t),
intent(in) :: this
877 integer,
optional,
intent(in) :: iunit
878 type(
namespace_t),
optional,
intent(in) :: namespace
885 write(
message(1),
'(a)')
"Method:"
886 write(
message(2),
'(a)')
" [1] Dudarev et al., Phys. Rev. B 57, 1505 (1998)"
889 if (.not. this%intersite)
then
890 write(
message(1),
'(a)')
"Method:"
891 write(
message(2),
'(a)')
" [1] Agapito et al., Phys. Rev. X 5, 011006 (2015)"
894 write(
message(2),
'(a)')
" [1] Tancogne-Dejean, and Rubio, Phys. Rev. B 102, 155117 (2020)"
898 write(
message(1),
'(a)')
"Implementation:"
899 write(
message(2),
'(a)')
" [1] Tancogne-Dejean, Oliveira, and Rubio, Phys. Rev. B 69, 245133 (2017)"
909 type(
lda_u_t),
intent(inout) :: this
911 class(
space_t),
intent(in) :: space
913 class(
mesh_t),
intent(in) :: mesh
915 integer,
intent(out) :: ierr
917 integer :: err, wfns_file, is, ist, idim, ik, ios, iorb
919 character(len=256) :: lines(3)
920 character(len=256),
allocatable :: restart_file(:, :)
921 logical,
allocatable :: restart_file_present(:, :)
922 character(len=12) :: filename
923 character(len=1) :: char
924 character(len=50) :: str
926 integer,
allocatable :: count(:)
927 real(real64) :: norm, center(space%dim)
928 real(real64),
allocatable :: dpsi(:,:,:)
929 complex(real64),
allocatable :: zpsi(:,:,:)
936 message(1) =
"Debug: Loading DFT+U basis from states."
945 message(1) =
"Error loading DFT+U basis from states, cannot proceed with the calculation"
957 read(lines(2),
'(a)') str
958 if (str(2:8) ==
'Complex')
then
959 message(1) =
"Cannot read real states from complex wavefunctions."
961 else if (str(2:5) /=
'Real')
then
962 message(1) =
"Restart file 'wfns' does not specify real/complex; cannot check compatibility."
973 message(1) =
"Error loading DFT+U basis from states, cannot proceed with the calculation"
979 safe_allocate(restart_file(1:st%d%dim, 1:st%nst))
980 safe_allocate(restart_file_present(1:st%d%dim, 1:st%nst))
981 restart_file_present = .false.
989 read(lines(1),
'(a)') char
990 if (char ==
'%')
then
994 read(lines(1), *) ik, char, ist, char, idim, char, filename
998 if (any(this%basisstates==ist) .and. ik == 1)
then
999 restart_file(idim, ist) = trim(filename)
1000 restart_file_present(idim, ist) = .
true.
1006 safe_allocate(count(1:this%norbsets))
1008 do is = 1, this%maxnorbs
1009 ist = this%basisstates(is)
1010 ios = this%basisstates_os(is)
1011 count(ios) = count(ios)+1
1012 do idim = 1, st%d%dim
1014 if (.not. restart_file_present(idim, ist))
then
1015 write(
message(1),
'(a,i3,a)')
"Cannot read states ", ist,
"from the projection folder"
1021 this%orbsets(ios)%dorb(:,idim,count(ios)), err)
1024 this%orbsets(ios)%zorb(:,idim,count(ios)), err)
1029 safe_deallocate_a(count)
1030 safe_deallocate_a(restart_file)
1031 safe_deallocate_a(restart_file_present)
1035 if(this%basis%normalize)
then
1036 do ios = 1, this%norbsets
1037 do iorb = 1, this%orbsets(ios)%norbs
1039 norm =
dmf_nrm2(mesh, st%d%dim, this%orbsets(ios)%dorb(:,:,iorb))
1040 call lalg_scal(mesh%np, st%d%dim,
m_one/norm, this%orbsets(ios)%dorb(:,:,iorb))
1042 norm =
zmf_nrm2(mesh, st%d%dim, this%orbsets(ios)%zorb(:,:,iorb))
1043 call lalg_scal(mesh%np, st%d%dim,
m_one/norm, this%orbsets(ios)%zorb(:,:,iorb))
1051 do ios = 1, this%norbsets
1052 do iorb = 1, this%orbsets(ios)%norbs
1060 do ios = 1, this%norbsets
1068 message(1) =
"Debug: Converting the Wannier states to submeshes."
1073 do ios = 1, this%norbsets
1074 os => this%orbsets(ios)
1075 center = os%sphere%center
1076 safe_deallocate_a(os%sphere%center)
1078 safe_allocate(dpsi(1:mesh%np, 1:os%ndim, 1:os%norbs))
1079 dpsi(1:mesh%np, 1:os%ndim, 1:os%norbs) = os%dorb(1:mesh%np, 1:os%ndim, 1:os%norbs)
1081 safe_deallocate_a(os%dorb)
1083 call submesh_init(os%sphere, space, mesh, this%latt, center, os%radius)
1084 safe_allocate(os%dorb(1:os%sphere%np, 1:os%ndim, 1:os%norbs))
1085 do iorb = 1, os%norbs
1086 do idim = 1, os%ndim
1090 safe_deallocate_a(dpsi)
1092 safe_allocate(zpsi(1:mesh%np, 1:os%ndim, 1:os%norbs))
1093 zpsi(1:mesh%np, 1:os%ndim, 1:os%norbs) = os%zorb(1:mesh%np, 1:os%ndim, 1:os%norbs)
1094 safe_deallocate_a(os%zorb)
1096 call submesh_init(os%sphere, space, mesh, this%latt, center, os%radius)
1097 safe_allocate(os%zorb(1:os%sphere%np, 1:os%ndim, 1:os%norbs))
1098 do iorb = 1, os%norbs
1099 do idim = 1, os%ndim
1103 safe_deallocate_a(zpsi)
1105 safe_allocate(os%phase(1:os%sphere%np, st%d%kpt%start:st%d%kpt%end))
1106 safe_allocate(os%eorb_submesh(1:os%sphere%np, 1:os%ndim, 1:os%norbs, st%d%kpt%start:st%d%kpt%end))
1108 os%use_submesh = .
true.
1109 this%max_np = max(this%max_np, os%sphere%np)
1112 this%basis%use_submesh = .
true.
1116 do ios = 1, this%norbsets
1117 os => this%orbsets(ios)
1124 safe_allocate(os%buff_eorb(st%d%kpt%start:st%d%kpt%end))
1126 do ik= st%d%kpt%start, st%d%kpt%end
1134 do iorb = 1, os%norbs
1137 offset = (iorb - 1)*os%ldorbs)
1140 offset = (iorb - 1)*os%ldorbs)
1147 message(1) =
"Debug: Loading DFT+U basis from states done."
1155 type(
lda_u_t),
intent(inout) :: this
1156 type(
ions_t),
intent(in) :: ions
1157 type(
grid_t),
intent(in) :: gr
1160 integer :: nsym, iop, ios, iatom, iatom_sym, ios_sym
1164 nsym = ions%symm%nops
1165 safe_allocate(this%inv_map_symm(1:this%norbsets, 1:nsym))
1166 this%inv_map_symm = -1
1170 do ios = 1, this%norbsets
1171 iatom = this%orbsets(ios)%iatom
1173 iatom_sym = ions%inv_map_symm_atoms(iatom, iop)
1175 do ios_sym = 1, this%norbsets
1176 if (this%orbsets(ios_sym)%iatom == iatom_sym .and. this%orbsets(ios_sym)%norbs == this%orbsets(ios)%norbs &
1177 .and. this%orbsets(ios_sym)%nn == this%orbsets(ios)%nn .and. this%orbsets(ios_sym)%ll == this%orbsets(ios)%ll &
1178 .and.
is_close(this%orbsets(ios_sym)%jj, this%orbsets(ios)%jj))
then
1179 this%inv_map_symm(ios, iop) = ios_sym
1183 assert(this%inv_map_symm(ios, iop) > 0)
1187 safe_allocate(this%symm_weight(1:this%maxnorbs, 1:this%maxnorbs, 1:this%nsym, 1:this%norbsets))
1188 this%symm_weight =
m_zero
1190 do ios = 1, this%norbsets
1192 if (this%orbsets(ios)%norbs == 1)
then
1193 this%symm_weight(1,1, 1:this%nsym, ios) =
m_one
1198 if (this%orbsets(ios)%ndim > 1) cycle
1200 call orbitals_get_symm_weight(this%orbsets(ios), ions%space, ions%latt, gr, ions%symm, this%symm_weight(:,:,:,ios))
1209 type(
space_t),
intent(in) :: space
1211 type(
grid_t),
intent(in) :: gr
1213 real(real64),
intent(inout) :: weight(:,:,:)
1215 integer :: im, imp, iop, mm
1216 real(real64),
allocatable :: orb(:,:), orb_sym(:), ylm(:)
1218 real(real64) :: rc, norm, origin(space%dim)
1222 assert(os%ndim == 1)
1224 safe_allocate(orb_sym(1:gr%np))
1225 safe_allocate(orb(1:gr%np, 1:os%norbs))
1227 assert(2*os%ll+1 == os%norbs)
1235 safe_allocate(ylm(1:sphere%np))
1240 call loct_ylm(sphere%np, sphere%rel_x(1,1), sphere%r(1), os%ll, mm, ylm(1))
1246 safe_deallocate_a(ylm)
1250 do iop = 1, symm%nops
1253 do imp = 1, os%norbs
1254 weight(im, imp, iop) =
dmf_dotp(gr, orb(:,imp), orb_sym, reduce=.false.)
1259 if(gr%parallel_in_domains)
then
1260 call gr%allreduce(weight)
1263 safe_deallocate_a(orb)
1264 safe_deallocate_a(orb_sym)
1269#include "dft_u_noncollinear_inc.F90"
1273#include "lda_u_inc.F90"
1276#include "complex.F90"
1277#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...
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_nullify(this, total)
subroutine, public distributed_init(this, total, comm, tag, scalapack_compat)
Distribute N instances across M processes of communicator comm
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, suppress_warning)
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 compute_complex_coulomb_integrals(this, gr, st, psolver, namespace, space)
subroutine, public dlda_u_apply(this, d, mesh, psib, hpsib)
subroutine, public lda_u_set_effectiveu(this, Ueff)
subroutine dcompute_acbno_u_kanamori_restricted(this, kanamori)
This routine computes the Kanamori U, Up, and J.
subroutine, public dlda_u_get_occupations(this, occ)
subroutine, public dlda_u_rvu(this, mesh, space, d, namespace, psib, gpsib)
This routine computes .
subroutine, public lda_u_update_basis(this, space, gr, ions, st, psolver, namespace, kpoints, has_phase)
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 dupdate_occ_matrices(this, namespace, mesh, st, lda_u_energy, phase)
This routine computes the values of the occupation matrices.
subroutine, public zlda_u_apply(this, d, mesh, psib, hpsib)
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 lda_u_init_coulomb_integrals(this, namespace, space, gr, st, psolver, has_phase)
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 dlda_u_force(this, namespace, space, mesh, st, iq, psib, grad_psib, force, phase)
subroutine, public lda_u_freeze_occ(this)
integer, parameter, public dft_u_mix
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, 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 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, public zlda_u_force(this, namespace, space, mesh, st, iq, psib, grad_psib, force, phase)
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)
subroutine, public lda_u_init(this, namespace, space, level, gr, ions, st, mc, kpoints, has_phase)
integer, parameter, public dft_u_acbn0
subroutine zcompute_acbno_u_kanamori(this, kanamori)
This routine computes the Kanamori U, Up, and J.
subroutine, public lda_u_update_occ_matrices(this, namespace, mesh, st, hm_base, phase, energy)
subroutine zcompute_coulomb_integrals(this, namespace, space, gr, psolver)
subroutine, public zlda_u_get_occupations(this, occ)
subroutine zupdate_occ_matrices(this, namespace, mesh, st, lda_u_energy, phase)
This routine computes the values of the occupation matrices.
subroutine build_symmetrization_map(this, ions, gr, st)
Builds a mapping between the orbital sets based on symmetries.
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)
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)
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 zorbitalbasis_build_empty(this, mesh, kpt, ndim, norbsets, map_os, verbose)
This routine constructd an empty orbital basis.
subroutine, public dorbitalbasis_build_empty(this, mesh, kpt, 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 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...
integer, parameter, public sm_poisson_psolver
integer, parameter, public sm_poisson_isf
subroutine, public zorbitalset_get_center_of_mass(os, space, mesh, latt)
subroutine, public orbitalset_init_intersite(this, namespace, space, ind, ions, der, psolver, os, nos, maxnorbs, rcut, kpt, has_phase, sm_poisson, basis_from_states, combine_j_orbitals)
integer, parameter, public sm_poisson_direct
subroutine, public dorbitalset_get_center_of_mass(os, space, mesh, latt)
integer, parameter, public sm_poisson_fft
integer function, public parse_block(namespace, name, blk, check_varinfo_)
subroutine, public restart_read(restart, iunit, lines, nlines, ierr)
subroutine, public restart_close(restart, iunit)
Close a file previously opened with restart_open.
integer, parameter, public restart_gs
subroutine, public restart_init(restart, namespace, data_type, type, mc, ierr, mesh, dir, exact)
Initializes a restart object.
integer, parameter, public restart_proj
integer function, public restart_open(restart, filename, status, position, silent)
Open file "filename" found inside the current restart directory. Depending on the type of restart,...
integer, parameter, public restart_type_load
subroutine, public restart_end(restart)
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), public type_float
type(type_t), public type_cmplx
type(type_t), public type_integer
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.
Description of the grid, containing information on derivatives, stencil, and symmetries.
The basic Hamiltonian for electronic system.
Class to describe DFT+U parameters.
Describes mesh distribution to nodes.
Stores all communicators and groups.
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 ...