37 use,
intrinsic :: iso_fortran_env
72 integer :: w90_what, w90_mode
73 integer(int64) :: w90_what_default
77 integer :: ii, nik, iter, nst
79 type(restart_t) :: restart
80 type(electrons_t),
pointer :: sys
81 logical :: w90_spinors, scdm_proj, w90_scdm
82 integer :: w90_nntot, w90_num_bands, w90_num_kpts
83 integer,
allocatable :: w90_nnk_list(:,:)
84 character(len=80) :: w90_prefix
85 integer :: w90_num_wann
86 real(real64),
allocatable :: w90_proj_centers(:,:)
87 integer,
allocatable :: w90_proj_lmr(:,:)
89 integer,
allocatable :: w90_spin_proj_component(:)
90 real(real64),
allocatable :: w90_spin_proj_axis(:,:)
91 integer :: w90_num_exclude
92 logical,
allocatable :: exclude_list(:)
93 integer,
allocatable :: band_index(:)
94 logical :: read_td_states
95 integer :: w90_spin_channel
96 logical :: w90_bloch_sums = .false.
99 integer,
allocatable :: jpvt(:)
100 complex(real64),
allocatable :: uk(:,:,:)
101 complex(real64),
allocatable :: psi(:,:)
102 complex(real64),
allocatable :: chi(:,:), chi_diag(:,:),chi2(:,:)
103 real(real64),
allocatable :: chi_eigenval(:), occ_temp(:)
104 real(real64) :: scdm_mu, scdm_sigma, smear, kvec(3), factor(3)
105 integer :: ist, jst, ik, idir, sender
107 integer(int64) :: how
132 if (w90_prefix ==
'w90')
then
133 message(1) =
"oct-wannier90: the prefix is set by default to w90"
163 if (w90_mode == 0)
then
164 message(1) =
"Wannier90Mode must be set to a value different from 0."
186 w90_what_default = option__wannier90files__w90_mmn + option__wannier90files__w90_amn + option__wannier90files__w90_eig
187 if (sys%st%d%ispin ==
spinors) w90_what_default = w90_what_default + option__wannier90files__w90_spn
228 if (sys%kpoints%use_symmetries)
then
229 message(1) =
'oct-wannier90: k-points symmetries are not allowed'
232 if (sys%kpoints%use_time_reversal)
then
233 message(1) =
'oct-wannier90: time-reversal symmetry is not allowed'
236 if (sys%kpoints%reduced%nshifts > 1)
then
237 message(1) =
'oct-wannier90: Wannier90 does not allow for multiple shifts of the k-point grid'
245 w90_spinors = .false.
257 do idir = sys%space%periodic_dim+1, sys%space%dim
258 factor(idir) =
m_two * sys%gr%box%bounding_box_l(idir)
260 call sys%ions%latt%scale(factor)
263 select case (w90_mode)
264 case (option__wannier90mode__w90_setup)
268 case (option__wannier90mode__w90_output)
271 case (option__wannier90mode__w90_wannier)
287 if (read_td_states)
then
289 sys%mc, ierr, sys%gr)
292 sys%mc, ierr, sys%gr)
300 if (dim == sys%st%d%dim .and. nik == sys%kpoints%reduced%npoints .and. nst >= sys%st%nst)
then
302 ierr, iter, label =
": wannier90", skip=exclude_list)
304 write(
message(1),
'(a)')
'Restart structure not commensurate.'
312 message(1) =
"Wannier90Mode is set to an unsupported value."
316 safe_deallocate_a(exclude_list)
317 safe_deallocate_a(band_index)
318 safe_deallocate_a(w90_nnk_list)
319 safe_deallocate_a(w90_proj_centers)
320 safe_deallocate_a(w90_proj_lmr)
322 safe_deallocate_p(sys)
334 type(
ions_t),
intent(in) :: ions
336 class(
space_t),
intent(in) :: space
338 character(len=80) :: filename
339 integer :: w90_win, ia, axis(3), npath
343 assert(space%dim == 3)
346 filename = trim(adjustl(w90_prefix)) //
'.win'
349 write(w90_win,
'(a)')
'# this file has been created by the Octopus wannier90 utility'
350 write(w90_win,
'(a)')
' '
353 write(w90_win,
'(a)')
'begin unit_cell_cart'
354 write(w90_win,
'(a)')
'Ang'
358 write(w90_win,
'(a)')
'end unit_cell_cart'
359 write(w90_win,
'(a)')
' '
361 write(w90_win,
'(a)')
'begin atoms_frac'
362 do ia = 1, ions%natoms
363 write(w90_win,
'(a,2x,f13.8,f13.8,f13.8)') trim(ions%atom(ia)%label), ions%latt%cart_to_red(ions%pos(:, ia))
365 write(w90_win,
'(a)')
'end atoms_frac'
366 write(w90_win,
'(a)')
' '
369 write(w90_win,
'(a)')
'use_bloch_phases = .true.'
370 write(w90_win,
'(a)')
' '
372 write(w90_win,
'(a10,i4)')
'num_bands ', sys%st%nst
373 write(w90_win,
'(a9,i4)')
'num_wann ', sys%st%nst
374 write(w90_win,
'(a)')
' '
376 if (sys%st%d%ispin ==
spinors)
then
377 write(w90_win,
'(a)')
'spinors = .true.'
380 if (w90_spin_channel == 1)
then
381 write(w90_win,
'(a)')
'spin = up'
382 else if (w90_spin_channel == 2)
then
383 write(w90_win,
'(a)')
'spin = down'
385 message(1) =
'Wannier90SpinChannel value is invalid.'
391 write(w90_win,
'(a)')
'write_u_matrices = .true.'
392 write(w90_win,
'(a)')
'write_xyz = .true.'
393 write(w90_win,
'(a)')
' '
395 if (kpoints%reduced%npoints == 1)
then
396 write(w90_win,
'(a)')
'gamma_only = .true.'
397 write(w90_win,
'(a)')
' '
400 message(1) =
'oct-wannier90: need Monkhorst-Pack grid. Please specify %KPointsGrid'
405 npath = kpoints%nkpt_in_path()
407 axis(1:3) = kpoints%nik_axis(1:3)
408 assert(product(kpoints%nik_axis(1:3)) == kpoints%reduced%npoints - npath)
410 write(w90_win,
'(a8,i4,i4,i4)')
'mp_grid =', axis(1:3)
411 write(w90_win,
'(a)')
' '
412 write(w90_win,
'(a)')
'begin kpoints '
415 do ii = 1, kpoints%reduced%npoints-npath
416 write(w90_win,
'(f13.8,f13.8,f13.8)') - kpoints%reduced%red_point(1:3,ii)
418 write(w90_win,
'(a)')
'end kpoints '
437 if (read_td_states)
then
439 sys%mc, ierr, sys%gr)
442 sys%mc, ierr, sys%gr)
450 if (dim == sys%st%d%dim .and. nik == sys%kpoints%reduced%npoints .and. nst >= sys%st%nst)
then
452 ierr, iter, label =
": wannier90", skip=exclude_list)
454 write(
message(1),
'(a)')
'Restart structure not commensurate.'
462 safe_allocate(jpvt(1:sys%gr%np_global*sys%st%d%dim))
463 safe_allocate(psi(1:sys%gr%np, 1:sys%st%d%dim))
464 safe_allocate(occ_temp(1:w90_num_bands))
467 do ist = 1, w90_num_bands
468 occ_temp(ist)= sys%st%occ(ist, 1)
469 sys%st%occ(ist, 1)=
m_half*erfc((sys%st%eigenval(ist, 1)-scdm_mu) / scdm_sigma)
475 do ist = 1, w90_num_bands
476 sys%st%occ(ist, 1) = occ_temp(ist)
479 safe_allocate(uk(1:w90_num_bands, 1:w90_num_bands, 1:nik))
482 safe_allocate(chi(1:w90_num_bands, 1:w90_num_bands))
483 safe_allocate(chi_diag(1:w90_num_bands, 1:w90_num_bands))
484 safe_allocate(chi2(1:w90_num_bands, 1:w90_num_bands))
485 safe_allocate(chi_eigenval(1:w90_num_bands))
487 chi(1:w90_num_bands, 1:w90_num_bands) =
m_zero
490 kvec(:) = sys%kpoints%reduced%point(:, ik)
493 ik_real = (ik-1)*2 + w90_spin_channel
498 do ist = 1, w90_num_bands
502 sender = sys%st%d%kpt%mpi_grp%rank
504 call sys%st%d%kpt%mpi_grp%allreduce_inplace(sender, 1, mpi_integer, mpi_max)
506 call sys%st%d%kpt%mpi_grp%bcast(psi, sys%gr%np*sys%st%d%dim, mpi_double_complex, sender)
507 smear=
m_half * erfc((sys%st%eigenval(ist, ik_real) - scdm_mu) / scdm_sigma)
509 do jst = 1, w90_num_bands
510 chi(ist, jst) = smear * conjg(psi(jpvt(jst), 1)) &
511 *
exp(
m_zi * dot_product(sys%gr%x(1:3, jpvt(jst)), kvec(1:3)))
517 chi_diag = matmul(conjg(transpose(chi)), chi)
519 chi2 = conjg(transpose(chi_diag))
522 if (any(chi_eigenval(:) .lt.
m_zero))
then
523 message(1) =
'SCDM Wannierization failed because chi matrix is'
524 message(2) =
'ill conditioned. Try increasingin scdm_sigma and/or'
529 do ist = 1, w90_num_bands
530 chi_eigenval(ist) =
m_one /
sqrt(chi_eigenval(ist))
531 chi2(ist, 1:w90_num_bands) = chi_eigenval(ist) * chi2(ist, 1:w90_num_bands)
535 uk(:,:,ik) = matmul(chi, matmul(chi_diag,chi2))
539 safe_deallocate_a(chi)
540 safe_deallocate_a(psi)
541 safe_deallocate_a(chi_diag)
542 safe_deallocate_a(chi2)
543 safe_deallocate_a(chi_eigenval)
544 safe_deallocate_a(jpvt)
545 safe_deallocate_a(psi)
546 safe_deallocate_a(occ_temp)
550 if (
bitand(w90_what, option__wannier90files__w90_mmn) /= 0)
then
554 if (
bitand(w90_what, option__wannier90files__w90_unk) /= 0)
then
555 call write_unk(sys%space, sys%gr, sys%st, formatted=.false.)
558 if (
bitand(w90_what, option__wannier90files__w90_amn) /= 0)
then
562 if (
bitand(w90_what, option__wannier90files__w90_eig) /= 0)
then
566 if (
bitand(w90_what, option__wannier90files__w90_spn) /= 0)
then
570 safe_deallocate_a(uk)
571 safe_deallocate_a(w90_spin_proj_component)
572 safe_deallocate_a(w90_spin_proj_axis)
579 integer :: w90_nnkp, itemp, dummyint, io, spin_channel_win
580 character(len=80) :: filename, dummy, dummy1, dummy2, line
581 logical :: exist, parse_is_ok
582 real(real64) :: dummyr(7)
586 w90_num_kpts = product(sys%kpoints%nik_axis(1:3))
587 assert(w90_num_kpts == sys%st%nik)
593 filename = trim(adjustl(w90_prefix)) //
'.nnkp'
595 message(1) =
"oct-wannier90: Parsing "//filename
598 inquire(file=filename,exist=exist)
599 if (.not. exist)
then
600 message(1) =
'oct-wannier90: Cannot find specified Wannier90 nnkp file.'
601 write(
message(2),
'(a)')
'Please run wannier90.x -pp '// trim(adjustl(w90_prefix)) //
' first.'
605 parse_is_ok = .false.
610 read(w90_nnkp, *, iostat=io) dummy, dummy1
611 if (io == iostat_end)
exit
613 if (dummy ==
'begin' .and. dummy1 ==
'kpoints')
then
614 read(w90_nnkp,*) itemp
615 if (itemp /= w90_num_kpts)
then
616 message(1) =
'oct-wannier90: wannier90 setup seems to have been done with a different number of k-points.'
626 if (.not. parse_is_ok)
then
627 message(1) =
'oct-wannier90: Did not find the kpoints block in nnkp file'
630 parse_is_ok = .false.
636 read(w90_nnkp, *, iostat=io) dummy, dummy1
637 if (io == iostat_end)
exit
639 if (dummy ==
'begin' .and. dummy1 ==
'nnkpts')
then
640 read(w90_nnkp,*) w90_nntot
641 safe_allocate(w90_nnk_list(1:5, 1:w90_num_kpts * w90_nntot))
642 do ii = 1, w90_num_kpts * w90_nntot
643 read(w90_nnkp,*) w90_nnk_list(1:5, ii)
646 read(w90_nnkp,*) dummy
647 if (dummy /=
'end')
then
648 message(1) =
'oct-wannier90: There dont seem to be enough k-points in nnkpts file to.'
656 if (.not. parse_is_ok)
then
657 message(1) =
'oct-wannier90: Did not find nnkpts block in nnkp file'
663 safe_allocate(exclude_list(1:sys%st%nst))
665 exclude_list(1:sys%st%nst) = .false.
668 read(w90_nnkp, *, iostat=io) dummy, dummy1
669 if (io == iostat_end)
exit
670 if (dummy ==
'begin' .and. dummy1 ==
'exclude_bands')
then
671 read(w90_nnkp, *) w90_num_exclude
672 do ii = 1, w90_num_exclude
673 read(w90_nnkp, *) itemp
674 if(itemp > sys%st%nst)
then
675 message(1) =
'oct-wannier90: The exclude_bands list contains a state index higher than the number of states.'
678 exclude_list(itemp) = .
true.
681 read(w90_nnkp, *) dummy
682 if (dummy /=
'end')
then
683 message(1) =
'oct-wannier90: There dont seem to be enough bands in exclude_bands list.'
692 w90_num_bands = sys%st%nst - w90_num_exclude
694 safe_allocate(band_index(1:sys%st%nst))
696 do ii = 1, sys%st%nst
697 if (exclude_list(ii)) cycle
699 band_index(ii) = itemp
702 if (
bitand(w90_what, option__wannier90files__w90_amn) /= 0 &
703 .or. w90_mode == option__wannier90mode__w90_wannier )
then
708 read(w90_nnkp, *, iostat=io) dummy, dummy1
709 if (io == iostat_end)
then
710 message(1) =
'oct-wannier90: Did not find projections block in w90.nnkp file'
714 if (dummy ==
'begin' .and. (dummy1 ==
'projections' .or. dummy1 ==
'spinor_projections'))
then
716 if (dummy1 ==
'spinor_projections')
then
718 if (sys%st%d%ispin /=
spinors)
then
719 message(1) =
'oct-wannier90: Spinor = .true. is only valid with spinors wavefunctions.'
723 message(1) =
'oct-wannier90: Spinor interface incomplete. Note there is no quantization axis implemented'
726 if (sys%st%d%ispin ==
spinors)
then
727 message(1) =
'oct-wannier90: Octopus has spinors wavefunctions but spinor_projections is not defined.'
728 message(2) =
'oct-wannier90: Please check the input file for wannier 90.'
733 read(w90_nnkp, *) w90_nproj
736 w90_num_wann = w90_nproj
738 if(w90_nproj == 0) w90_num_wann = w90_num_bands
740 safe_allocate(w90_proj_centers(1:3, 1:w90_nproj))
741 safe_allocate(w90_proj_lmr(1:w90_nproj, 1:3))
742 if (w90_spinors)
then
743 safe_allocate(w90_spin_proj_component(1:w90_nproj))
745 if (w90_spinors)
then
746 safe_allocate(w90_spin_proj_axis(1:w90_nproj, 1:3))
750 read(w90_nnkp, *) w90_proj_centers(1:3, ii), w90_proj_lmr(ii, 1:3)
752 read(w90_nnkp, *) dummyr(1:7)
753 if (w90_spinors)
then
754 read(w90_nnkp, *) w90_spin_proj_component(ii), w90_spin_proj_axis(ii, 1:3)
756 if (w90_spin_proj_component(ii) == -1) w90_spin_proj_component(ii) = 2
760 read(w90_nnkp, *) dummy
761 if (dummy /=
'end')
then
762 message(1) =
'oct-wannier90: There dont seem to be enough projections in nnkpts file to.'
772 read(w90_nnkp, *, iostat=io) dummy, dummy1
773 if (io == iostat_end)
exit
775 if (dummy ==
'begin' .and. dummy1 ==
'auto_projections')
then
777 read(w90_nnkp, *) w90_nproj
778 w90_num_wann = w90_nproj
780 if (.not. w90_scdm)
then
781 message(1) =
'oct-wannier90: Found auto_projections block. Currently the only implemented automatic way'
782 message(2) =
'oct-wannier90: to compute projections is the SCDM method.'
783 message(3) =
'oct-wannier90: Please set Wannier90UseSCDM = yes in the inp file.'
787 if (w90_nproj /= w90_num_bands)
then
788 message(1) =
'oct-wannier90: In auto_projections block first row needs to be equal to num_bands.'
791 read(w90_nnkp, *) dummyint
792 if (dummyint /= 0)
then
793 message(1) =
'oct-wannier90: The second row in auto_projections has to be 0, per Wannier90 documentation.'
802 message(1) =
"oct-wannier90: Finished parsing "//filename
807 filename = trim(adjustl(w90_prefix)) //
'.win'
808 message(1) =
"oct-wannier90: Parsing "//filename
812 read(w90_nnkp, fmt=
'(a)', iostat=io) line
813 if (io == iostat_end)
exit
814 if (index(line,
'=') > 0)
then
815 read(line, *, iostat=io) dummy, dummy2, dummy1
817 read(line, *, iostat=io) dummy, dummy1
821 if (dummy ==
'spin')
then
823 message(1) =
'oct-wannier90: The variable spin is set for a non spin-polarized calculation.'
827 if (dummy1 ==
'up')
then
829 else if (dummy1 ==
'down')
then
832 message(1) =
'oct-wannier90: Error parsing the variable spin.'
835 if (spin_channel_win /= w90_spin_channel)
then
836 message(1) =
'spin polarization input from .win and Wannier90SpinChannel do not agree.'
844 write(
message(1),
'(a,i1)')
'oct-wannier90: Using spin channel ', w90_spin_channel
848 message(1) =
"oct-wannier90: Finished parsing "//filename
857 class(
mesh_t),
intent(in) :: mesh
860 integer :: ist, jst, ik, ip, w90_mmn, iknn, ib
861 real(real64) :: Gcart(3)
863 character(len=80) :: filename
864 complex(real64),
allocatable :: overlap(:), ss(:)
865 complex(real64),
allocatable :: psin(:,:), phase(:)
867 integer :: inode, node_fr, node_to
868 type(mpi_request) :: send_req
874 if (st%parallel_in_states)
then
878 message(1) =
"Info: Computing the overlap matrix"
882 filename =
'./'// trim(adjustl(w90_prefix))//
'.mmn'
886 if (st%system_grp%is_root())
then
887 write(w90_mmn,*)
'Created by oct-wannier90'
888 write(w90_mmn,*) w90_num_bands, w90_num_kpts, w90_nntot
891 safe_allocate(psin(1:mesh%np, 1:st%d%dim))
892 safe_allocate(phase(1:mesh%np))
893 safe_allocate(overlap(1:w90_num_bands))
894 safe_allocate(ss(1:st%nst))
898 do ii = 1, w90_num_kpts * w90_nntot
899 ik = w90_nnk_list(1, ii)
900 iknn = w90_nnk_list(2, ii)
901 g(1:3) = w90_nnk_list(3:5, ii)
902 if (st%system_grp%is_root())
write(w90_mmn,
'(I10,2x,I10,2x,I3,2x,I3,2x,I3)') ik, iknn, g
905 g(sys%space%periodic_dim+1:sys%space%dim) = 0
909 ik = (ik-1)*2 + w90_spin_channel
910 iknn = (iknn-1)*2 + w90_spin_channel
915 if(ik >= st%d%kpt%start .and. ik <= st%d%kpt%end)
then
924 if (any(g /= 0))
then
927 phase(ip) =
exp(-
m_zi*dot_product(mesh%x(1:3, ip), gcart(1:3)))
936 if (exclude_list(jst)) cycle
939 if ( .not. st%d%kpt%parallel .and. .not. st%parallel_in_states)
then
944 do inode = 0, st%d%kpt%mpi_grp%size-1
945 if(iknn >= st%st_kpt_task(inode,3) .and. iknn <= st%st_kpt_task(inode,4))
then
948 if(ik >= st%st_kpt_task(inode,3) .and. ik <= st%st_kpt_task(inode,4))
then
955 send_req = mpi_request_null
960 if(node_to /= st%d%kpt%mpi_grp%rank)
then
961 call st%d%kpt%mpi_grp%isend(psin, mesh%np*st%d%dim, mpi_double_complex, node_to, send_req)
965 if(node_to == st%d%kpt%mpi_grp%rank .and. node_to /= node_fr)
then
966 call st%d%kpt%mpi_grp%recv(psin, mesh%np*st%d%dim, mpi_double_complex, node_fr)
968 if (send_req /= mpi_request_null)
then
969 call st%d%kpt%mpi_grp%wait(send_req)
975 if(ik >= st%d%kpt%start .and. ik <= st%d%kpt%end)
then
978 if (any(g /= 0))
then
981 do idim = 1, st%d%dim
984 psin(ip, idim) = psin(ip, idim) * phase(ip)
993 do ib = st%group%block_start, st%group%block_end
994 batch => st%group%psib(ib, ik)
995 if (all(exclude_list(batch%ist(1:batch%nst)))) cycle
997 do ist = 1, batch%nst
998 if (exclude_list(batch%ist(ist))) cycle
999 overlap(band_index(batch%ist(ist))) = ss(ist)
1005 call mesh%allreduce(overlap)
1008 if(st%d%kpt%parallel)
then
1013 if (st%system_grp%is_root())
then
1015 if (exclude_list(ist)) cycle
1016 write(w90_mmn,
'(e18.10,2x,e18.10)') overlap(band_index(ist))
1025 safe_deallocate_a(psin)
1026 safe_deallocate_a(phase)
1027 safe_deallocate_a(overlap)
1028 safe_deallocate_a(ss)
1038 integer :: ist, ik, w90_eig
1039 character(len=80) :: filename
1043 if (sys%st%parallel_in_states)
then
1047 if (sys%st%system_grp%is_root())
then
1048 filename =
'./'//trim(adjustl(w90_prefix))//
'.eig'
1050 do ik = 1, w90_num_kpts
1051 do ist = 1, sys%st%nst
1052 if (exclude_list(ist)) cycle
1054 write(w90_eig,
'(I5,2x,I8,2x,e18.10)') band_index(ist), ik, &
1057 write(w90_eig,
'(I5,2x,I8,2x,e18.10)') band_index(ist), ik, &
1070 subroutine write_unk(space, mesh, st, formatted)
1071 class(
space_t),
intent(in) :: space
1072 class(
mesh_t),
intent(in) :: mesh
1074 logical,
intent(in) :: formatted
1076 integer :: ist, ik, unk_file, ispin
1077 integer :: ix, iy, iz
1078 real(real64) :: w_real, w_imag
1079 character(len=80) :: filename
1080 complex(real64),
allocatable :: psi(:)
1086 if (st%d%kpt%parallel)
then
1090 if (sys%gr%parallel_in_domains)
then
1094 if (st%parallel_in_states)
then
1101 safe_allocate(psi(1:mesh%np))
1104 mesh%coord_system, need_partition=.not.mesh%parallel_in_domains)
1109 do ik = 1, w90_num_kpts
1110 do ispin = 1, st%d%dim
1111 if (st%system_grp%is_root())
then
1112 write(filename,
'(a,i5.5,a1,i1)')
'./UNK', ik,
'.', ispin
1116 write(unk_file, *) mesh%idx%ll(1:mesh%idx%dim), ik, w90_num_bands
1119 write(unk_file) mesh%idx%ll(1:mesh%idx%dim), ik, w90_num_bands
1125 if (exclude_list(ist)) cycle
1135 assert(.not. cube%parallel_in_domains)
1138 if (st%system_grp%is_root())
then
1140 do iz=1,cube%rs_n_global(3)
1141 do iy = 1,cube%rs_n_global(2)
1142 do ix = 1,cube%rs_n_global(1)
1143 w_real = real(cf%zrs(ix,iy,iz), real64)
1144 w_imag = aimag(cf%zrs(ix,iy,iz))
1145 write (unk_file, *) w_real, w_imag
1150 write(unk_file) (((cf%zrs(ix,iy,iz), ix=1,cube%rs_n_global(1)), iy=1,cube%rs_n_global(2)), iz=1,cube%rs_n_global(3))
1154 if (st%system_grp%is_root())
call io_close(unk_file)
1161 safe_deallocate_a(psi)
1169 class(
space_t),
intent(in) :: space
1170 class(
mesh_t),
intent(in) :: mesh
1175 integer :: ist, ik, w90_amn, idim, iw, ip, ik_real
1176 real(real64) :: center(3), kpoint(3), threshold
1177 character(len=80) :: filename
1178 complex(real64),
allocatable :: psi(:,:), phase(:), projection(:)
1179 real(real64),
allocatable :: ylm(:)
1185 if (st%parallel_in_states)
then
1189 filename =
'./'// trim(adjustl(w90_prefix))//
'.amn'
1193 if (st%system_grp%is_root())
then
1194 write(w90_amn,*)
'Created by oct-wannier90'
1195 write(w90_amn,*) w90_num_bands, w90_num_kpts, w90_num_wann
1200 message(1) =
"Info: Writing projections obtained from SCDM."
1204 do ik = 1, w90_num_kpts
1206 if (exclude_list(ist)) cycle
1207 if (st%system_grp%is_root())
then
1208 do iw = 1, w90_nproj
1209 write (w90_amn,
'(I5,2x,I5,2x,I5,2x,e18.10,2x,e18.10)') band_index(ist), iw, ik, uk(band_index(ist),iw,ik)
1217 message(1) =
"Info: Computing the projection matrix"
1223 safe_allocate(orbitals(1:w90_nproj))
1228 orbitals(iw)%norbs = 1
1229 orbitals(iw)%ndim = 1
1230 orbitals(iw)%radius = -
log(threshold)
1231 orbitals(iw)%use_submesh = .false.
1234 center(1:3) = latt%red_to_cart(w90_proj_centers(1:3, iw))
1235 call submesh_init(orbitals(iw)%sphere, space, mesh, latt, center, orbitals(iw)%radius)
1238 safe_allocate(ylm(1:orbitals(iw)%sphere%np))
1240 call ylm_wannier(ylm, w90_proj_lmr(iw,1), w90_proj_lmr(iw,2), &
1241 orbitals(iw)%sphere%r, orbitals(iw)%sphere%rel_x, orbitals(iw)%sphere%np)
1244 if (w90_proj_lmr(iw,3) == 1)
then
1245 do ip = 1,orbitals(iw)%sphere%np
1246 ylm(ip) = ylm(ip)*
m_two*
exp(-orbitals(iw)%sphere%r(ip))
1252 safe_allocate(orbitals(iw)%zorb(1:orbitals(iw)%sphere%np, 1, 1))
1253 orbitals(iw)%zorb(1:orbitals(iw)%sphere%np, 1, 1) = ylm(1:orbitals(iw)%sphere%np)
1254 safe_deallocate_a(ylm)
1256 safe_allocate(orbitals(iw)%phase(1:orbitals(iw)%sphere%np, st%d%kpt%start:st%d%kpt%end))
1257 orbitals(iw)%phase(:,:) =
m_z0
1258 safe_allocate(orbitals(iw)%eorb_mesh(1:mesh%np, 1, 1, st%d%kpt%start:st%d%kpt%end))
1259 orbitals(iw)%eorb_mesh(:,:,:,:) =
m_z0
1262 kpt_max = w90_num_kpts)
1266 safe_allocate(psi(1:mesh%np, 1:st%d%dim))
1267 safe_allocate(phase(1:mesh%np))
1268 safe_allocate(projection(1:w90_nproj))
1270 do ik = 1, w90_num_kpts
1271 kpoint(1:space%dim) = kpoints%get_point(ik)
1274 phase(ip) =
exp(-
m_zi* sum(mesh%x(1:space%dim, ip) * kpoint(1:space%dim)))
1279 ik_real = (ik-1)*2 + w90_spin_channel
1286 if (exclude_list(ist)) cycle
1290 if(ik_real >= st%d%kpt%start .and. ik_real <= st%d%kpt%end)
then
1294 do idim = 1, st%d%dim
1298 psi(ip, idim) = psi(ip, idim)*phase(ip)
1303 do iw = 1, w90_nproj
1305 if (w90_spinors) idim = w90_spin_proj_component(iw)
1309 projection(iw) =
zmf_dotp(mesh, psi(1:mesh%np,idim), &
1310 orbitals(iw)%eorb_mesh(1:mesh%np,1,1,ik_real), reduce = .false.)
1314 call mesh%allreduce(projection)
1318 if(st%d%kpt%parallel)
then
1322 if (st%system_grp%is_root())
then
1323 do iw = 1, w90_nproj
1324 write (w90_amn,
'(I5,2x,I5,2x,I5,2x,e18.10,2x,e18.10)') band_index(ist), iw, ik, projection(iw)
1330 safe_deallocate_a(psi)
1331 safe_deallocate_a(phase)
1332 safe_deallocate_a(projection)
1334 do iw = 1, w90_nproj
1337 safe_deallocate_a(orbitals)
1353 class(mesh_t),
intent(in) :: mesh
1354 type(states_elec_t),
target,
intent(in) :: st
1356 integer :: ist, jst, ik, w90_spn, counter
1357 character(len=80) :: filename
1358 complex(real64),
allocatable :: spin(:,:,:)
1359 complex(real64),
allocatable :: psim(:,:), psin(:,:)
1360 complex(real64) :: dot_upup, dot_updown, dot_downup, dot_downdown
1363 call profiling_in(
"W90_SPN")
1365 assert(st%d%ispin == spinors)
1367 if (st%parallel_in_states)
then
1368 call messages_not_implemented(
"w90_spn output with states parallelization")
1371 message(1) =
"Info: Computing the spin file"
1372 call messages_info(1)
1374 filename =
'./'// trim(adjustl(w90_prefix))//
'.spn'
1375 w90_spn = io_open(trim(filename), global_namespace, action=
'write')
1378 if (st%system_grp%is_root())
then
1379 write(w90_spn,*)
'Created by oct-wannier90'
1380 write(w90_spn,*) w90_num_bands, w90_num_kpts
1383 safe_allocate(psim(1:mesh%np, 1:st%d%dim))
1384 safe_allocate(psin(1:mesh%np, 1:st%d%dim))
1385 safe_allocate(spin(1:3, 1:(w90_num_bands*(w90_num_bands+1))/2, 1:w90_num_kpts))
1389 do ik = st%d%kpt%start, st%d%kpt%end
1392 if (exclude_list(jst)) cycle
1394 call states_elec_get_state(st, mesh, jst, ik, psim)
1396 if (exclude_list(ist)) cycle
1398 counter = counter + 1
1400 call states_elec_get_state(st, mesh, ist, ik, psin)
1402 dot_upup = zmf_dotp(mesh, psin(:, 1), psim(:, 1), reduce = .false.)
1403 dot_downdown = zmf_dotp(mesh, psin(:, 2), psim(:, 2), reduce = .false.)
1404 dot_updown = zmf_dotp(mesh, psin(:, 1), psim(:, 2), reduce = .false.)
1405 dot_downup = zmf_dotp(mesh, psin(:, 2), psim(:, 1), reduce = .false.)
1407 spin(1, counter, ik) = dot_updown + dot_downup
1408 spin(2, counter, ik) = -m_zi * dot_updown + m_zi * dot_downup
1409 spin(3, counter, ik) = dot_upup - dot_downdown
1414 call profiling_in(
"W90_SPN_REDUCE")
1415 call mesh%allreduce(spin)
1417 if(st%d%kpt%parallel)
then
1418 call comm_allreduce(st%d%kpt%mpi_grp, spin)
1420 call profiling_out(
"W90_SPN_REDUCE")
1423 if (st%system_grp%is_root())
then
1424 do ik = 1, w90_num_kpts
1427 if (exclude_list(jst)) cycle
1430 if (exclude_list(ist)) cycle
1432 counter = counter + 1
1433 write(w90_spn,
'(e18.10,2x,e18.10)') spin(1, counter, ik)
1434 write(w90_spn,
'(e18.10,2x,e18.10)') spin(2, counter, ik)
1435 write(w90_spn,
'(e18.10,2x,e18.10)') spin(3, counter, ik)
1441 call io_close(w90_spn)
1443 safe_deallocate_a(psim)
1444 safe_deallocate_a(psin)
1445 safe_deallocate_a(spin)
1447 call profiling_out(
"W90_SPN")
1455 class(space_t),
intent(in) :: space
1456 class(mesh_t),
intent(in) :: mesh
1457 type(ions_t),
intent(in) :: ions
1458 type(states_elec_t),
intent(in) :: st
1459 type(kpoints_t),
intent(in) :: kpoints
1461 integer :: w90_u_mat, w90_xyz, nwann, nik
1462 integer :: ik, iw, iw2, ip, ipmax, rankmax, idmmax
1463 real(real64),
allocatable :: centers(:,:), supercell_centers(:,:), new_centers(:,:)
1464 complex(real64),
allocatable :: Umnk(:,:,:)
1465 complex(real64),
allocatable :: zwn(:,:,:), psi(:,:), phase(:,:), phase_bloch(:), zwn_bloch(:,:,:)
1466 character(len=MAX_PATH_LEN) :: fname
1467 real(real64) :: kpoint(3), wmod, wmodmax, xx(space%dim)
1468 character(len=2) :: dum
1470 type(unit_t) :: fn_unit
1471 complex(real64) :: scal
1472 type(block_t) :: blk
1473 integer :: supercell(space%dim), ii, jj, kk, ncols, Nreplica, irep, irepmax
1474 real(real64) :: min_image_displ(3), offset(space%dim)
1476 integer,
allocatable :: parent(:)
1477 real(real64),
parameter :: tol_cluster = 0.25_real64
1482 message(1) =
"oct-wannier90: Constructing the Wannier states from the U matrix."
1483 call messages_info(1)
1485 inquire(file=trim(trim(adjustl(w90_prefix))//
'_centres.xyz'),exist=exist)
1486 if (.not. exist)
then
1487 message(1) =
'oct-wannier90: Cannot find the Wannier90 file seedname_centres.xyz.'
1488 write(message(2),
'(a)')
'Please run wannier90.x with "write_xyz=.true." in '// trim(adjustl(w90_prefix)) //
'.'
1489 call messages_fatal(2)
1492 w90_xyz = io_open(trim(trim(adjustl(w90_prefix))//
'_centres.xyz'), global_namespace, action=
'read')
1494 safe_allocate(centers(1:3, 1:w90_num_wann))
1498 do iw = 1, w90_num_wann
1499 read(w90_xyz, *) dum, centers(1:3, iw)
1501 centers(1:3, iw) = units_to_atomic(unit_angstrom, centers(1:3, iw))
1503 call io_close(w90_xyz)
1507 safe_allocate(parent(1:w90_num_wann))
1508 do iw = 1, w90_num_wann
1511 min_image_displ(:) = ions%latt%cart_to_red(centers(:, iw) - centers(:, jw))
1512 min_image_displ(1:space%periodic_dim) = min_image_displ(1:space%periodic_dim) - nint(min_image_displ(1:space%periodic_dim))
1513 min_image_displ = ions%latt%red_to_cart(min_image_displ)
1514 if (norm2(min_image_displ) < tol_cluster)
then
1515 parent(iw) = parent(jw)
1521 message(1) =
"Info : Clustering of the Wannier centers"
1522 call messages_info(1)
1524 safe_allocate(new_centers(1:3, 1:w90_num_wann))
1525 do iw = 1, w90_num_wann
1526 write(message(1),
'(a,i0,a,3(f7.3,a))')
'Info : Original Wannier center ', &
1527 iw,
' (', centers(1, iw),
', ', centers(2, iw),
', ', centers(3, iw),
')'
1529 if (parent(iw) == iw)
then
1531 new_centers(1:3, iw) = ions%latt%fold_into_cell(centers(1:3, iw))
1535 min_image_displ(:) = ions%latt%cart_to_red(centers(:, iw) - new_centers(:, parent(iw)))
1536 min_image_displ(1:space%periodic_dim) = real(nint(min_image_displ(1:space%periodic_dim)), real64)
1537 min_image_displ = ions%latt%red_to_cart(min_image_displ)
1538 new_centers(1:3, iw) = centers(1:3, iw) - min_image_displ
1541 write(message(2),
'(a,i0,a,3(f7.3,a))')
'Info : New Wannier center ', &
1542 iw,
' (', new_centers(1, iw),
', ', new_centers(2, iw),
', ', new_centers(3, iw),
')'
1543 write(message(3),
'(a)')
''
1544 call messages_info(3)
1548 centers = new_centers - centers
1549 safe_deallocate_a(parent)
1550 safe_deallocate_a(new_centers)
1552 inquire(file=trim(trim(adjustl(w90_prefix))//
'_u_dis.mat'),exist=exist)
1554 message(1) =
'oct-wannier90: Calculation of Wannier states with disentanglement is not yet supported.'
1555 call messages_fatal(1)
1558 inquire(file=trim(trim(adjustl(w90_prefix))//
'_u.mat'),exist=exist)
1559 if (.not. exist)
then
1560 message(1) =
'oct-wannier90: Cannot find the Wannier90 seedname_u.mat file.'
1561 write(message(2),
'(a)')
'Please run wannier90.x with "write_u_matrices=.true." in '// trim(adjustl(w90_prefix)) //
'.'
1562 call messages_fatal(2)
1564 w90_u_mat = io_open(trim(trim(adjustl(w90_prefix))//
'_u.mat'), global_namespace, action=
'read')
1570 read(w90_u_mat, *) nik, nwann, nwann
1571 if (nik /= w90_num_kpts .or. nwann /= w90_num_wann)
then
1572 message(1) =
"The file contains U matrices is inconsistent with the .win file."
1573 call messages_fatal(1)
1576 safe_allocate(umnk(1:w90_num_wann, 1:w90_num_wann, 1:w90_num_kpts))
1578 do ik = 1, w90_num_kpts
1583 read(w90_u_mat,
'(f15.10,sp,f15.10)') ((umnk(iw, iw2, ik), iw=1, w90_num_wann), iw2=1, w90_num_wann)
1586 call io_close(w90_u_mat)
1589 call parse_variable(global_namespace,
'OutputFormat', 0, how)
1591 message(1) =
"OutputFormat must be specified for outputing Wannier functions."
1592 call messages_fatal(1)
1602 if (parse_is_defined(sys%namespace,
'Wannier90Supercell'))
then
1603 if (parse_block(sys%namespace,
'Wannier90Supercell', blk) == 0)
then
1604 ncols = parse_block_cols(blk, 0)
1605 if (ncols /= space%dim)
then
1606 write(message(1),
'(a,i3,a,i3)')
'Wannier90Supercell has ', ncols,
' columns but must have ', sys%space%dim
1607 call messages_fatal(1, namespace=sys%namespace)
1609 do ii = 1, space%dim
1610 call parse_block_integer(blk, 0, ii - 1, supercell(ii))
1613 call parse_block_end(blk)
1619 nreplica = product(supercell)
1622 safe_allocate(supercell_centers(1:space%dim, 1:nreplica))
1623 offset(1:space%dim) = -
floor((real(supercell(1:space%dim), real64) - m_one) / m_two)
1625 do ii = 0, supercell(1)-1
1626 do jj = 0, supercell(2)-1
1627 do kk = 0, supercell(3)-1
1628 supercell_centers(:, irep) = ions%latt%red_to_cart(offset &
1629 + [real(ii, real64), real(jj, real64), real(kk, real64)])
1637 call io_mkdir(
'wannier', global_namespace)
1640 safe_allocate(zwn(1:mesh%np, 1:nreplica, 1:st%d%dim))
1641 safe_allocate(psi(1:mesh%np, 1:st%d%dim))
1642 safe_allocate(phase(1:mesh%np, 1:nreplica))
1643 safe_allocate(phase_bloch(1:mesh%np))
1644 if (w90_bloch_sums)
then
1645 safe_allocate(zwn_bloch(1:mesh%np, 1:st%d%dim, st%d%kpt%start:st%d%kpt%end))
1648 do iw = 1, w90_num_wann
1652 do ik = 1, w90_num_kpts
1654 if (.not. (ik >= st%d%kpt%start .and. ik <= st%d%kpt%end)) cycle
1656 if (w90_bloch_sums) zwn_bloch(:,:,ik) = m_z0
1658 kpoint(1:space%dim) = kpoints%get_point(ik, absolute_coordinates=.
true.)
1662 do irep = 1, nreplica
1665 xx = mesh%x(1:space%dim, ip)-centers(1:space%dim, iw) + supercell_centers(1:space%dim, irep)
1666 phase(ip, irep) =
exp(-m_zi* sum( xx * kpoint(1:space%dim)))
1669 if (w90_bloch_sums)
then
1671 xx = mesh%x(1:space%dim, ip)
1672 phase_bloch(ip) =
exp(-m_zi* sum( xx * kpoint(1:space%dim)))
1677 if (exclude_list(iw2)) cycle
1679 if (st%d%ispin /= spin_polarized)
then
1680 call states_elec_get_state(st, mesh, iw2, ik, psi)
1682 call states_elec_get_state(st, mesh, iw2, (ik-1)*2+w90_spin_channel, psi)
1686 do idim = 1, st%d%dim
1687 do irep = 1, nreplica
1690 zwn(ip, irep, idim) = zwn(ip, irep, idim) + umnk(band_index(iw2), iw, ik) * psi(ip, idim) * phase(ip, irep)
1697 if (w90_bloch_sums)
then
1699 do idim = 1, st%d%dim
1702 zwn_bloch(ip, idim, ik) = zwn_bloch(ip, idim, ik) &
1703 + umnk(band_index(iw2), iw, ik) * psi(ip, idim) * phase_bloch(ip)
1711 if(st%d%kpt%parallel)
then
1712 call comm_allreduce(st%d%kpt%mpi_grp, zwn)
1717 if (sys%st%d%ispin /= spinors)
then
1721 do irep = 1, nreplica
1723 wmod = real(zwn(ip, irep, 1)*conjg(zwn(ip, irep, 1)), real64)
1724 if (wmod > wmodmax)
then
1731 scal =
sqrt(wmodmax)/zwn(ipmax, irepmax, 1)/w90_num_kpts
1732 call mesh_minmaxloc(mesh, wmodmax, rankmax, mpi_maxloc)
1733 call mesh%mpi_grp%bcast(scal, 1, mpi_double_complex, rankmax)
1734 call lalg_scal(mesh%np, nreplica, scal, zwn(:,:,1))
1736 if (w90_bloch_sums)
then
1737 do ik = st%d%kpt%start, st%d%kpt%end
1741 do idim = 1, st%d%dim
1743 wmod = real(zwn_bloch(ip, idim, ik)*conjg(zwn_bloch(ip, idim, ik)), real64)
1744 if (wmod > wmodmax)
then
1751 scal =
sqrt(wmodmax)/zwn_bloch(ipmax, idmmax, ik)/w90_num_kpts
1752 call mesh_minmaxloc(mesh, wmodmax, rankmax, mpi_maxloc)
1753 call mesh%mpi_grp%bcast(scal, 1, mpi_double_complex, rankmax)
1754 call lalg_scal(mesh%np, st%d%dim, scal, zwn_bloch(:,:,ik))
1760 fn_unit =
sqrt(units_out%length**(-space%dim))
1761 do idim = 1, st%d%dim
1762 if (st%d%ispin == spinors)
then
1763 write(fname,
'(a,i3.3,a4,i1)')
'wannier-', iw,
'-isp', idim
1765 write(fname,
'(a,i3.3,a4,i1)')
'wannier-', iw
1767 if (any(supercell_centers > 1))
then
1768 call io_function_output_supercell(how,
"wannier", trim(fname), mesh, &
1769 space, ions%latt, zwn(:, :, idim), supercell_centers, supercell, fn_unit, ierr, global_namespace, &
1770 pos=ions%pos, atoms=ions%atom, grp = st%dom_st_kpt_mpi_grp)
1773 call zio_function_output(how,
"wannier", trim(fname), global_namespace, space, mesh, &
1774 zwn(:, 1, idim), fn_unit, ierr, pos=ions%pos, atoms=ions%atom, grp = st%dom_st_kpt_mpi_grp)
1779 if (w90_bloch_sums)
then
1780 do ik = st%d%kpt%start, st%d%kpt%end
1781 do idim = 1, st%d%dim
1782 if (st%d%ispin == spinors)
then
1783 write(fname,
'(a,i3.3,a4,i1,a3,i5.5)')
'wannier_bloch-', iw,
'-isp', idim,
'-ik', ik
1785 write(fname,
'(a,i3.3,a4,i1,a3,i5.5)')
'wannier_bloch-', iw,
'-ik', ik
1787 call zio_function_output(how,
"wannier", trim(fname), global_namespace, space, mesh, &
1788 zwn_bloch(:, idim, ik), fn_unit, ierr, pos=ions%pos, atoms=ions%atom)
1794 if (sys%st%d%ispin /= spinors)
then
1796 do irep = 1, nreplica
1798 if(abs(real(zwn(ip, irep, 1), real64)) >= 1e-2_real64)
then
1799 wmodmax = max(wmodmax, abs(aimag(zwn(ip, irep, 1)))/abs(real(zwn(ip, irep, 1), real64)))
1803 call mesh_minmaxloc(mesh, wmodmax, rankmax, mpi_maxloc)
1805 write(message(1),
'(a,i4,a,f11.6)')
'oct-wannier90: Wannier function ', iw,
' Max. Im/Re Ratio = ', wmodmax
1806 call messages_info(1)
1808 write(message(1),
'(a,i4)')
'oct-wannier90: Wannier function done ', iw
1809 call messages_info(1)
1813 safe_deallocate_a(umnk)
1814 safe_deallocate_a(zwn)
1815 safe_deallocate_a(psi)
1816 safe_deallocate_a(phase)
1817 safe_deallocate_a(phase_bloch)
1818 safe_deallocate_a(centers)
1819 safe_deallocate_a(supercell_centers)
double log(double __x) __attribute__((__nothrow__
double exp(double __x) __attribute__((__nothrow__
double sqrt(double __x) __attribute__((__nothrow__
double floor(double __x) __attribute__((__nothrow__
This module implements batches of mesh functions.
This module handles the calculation mode.
type(calc_mode_par_t), public calc_mode_par
Singleton instance of parallel calculation mode.
integer, parameter, public p_strategy_states
parallelization in states
subroutine, public zmesh_to_cube(mesh, mf, cube, cf)
Convert a function from the mesh to the cube.
subroutine, public zcube_function_free_rs(cube, cf)
Deallocates the real space grid.
subroutine, public zcube_function_alloc_rs(cube, cf, in_device, force_alloc)
Allocates locally the real space grid, if PFFT library is not used. Otherwise, it assigns the PFFT re...
subroutine, public cube_init(cube, nn, namespace, space, spacing, coord_system, fft_type, fft_library, dont_optimize, nn_out, mpi_grp, need_partition, tp_enlarge, blocksize)
subroutine, public cube_end(cube)
subroutine, public cube_init_cube_map(cube, mesh)
integer, parameter, public unpolarized
Parameters...
integer, parameter, public spinors
integer, parameter, public spin_polarized
Fast Fourier Transform module. This module provides a single interface that works with different FFT ...
subroutine, public fft_all_init(namespace)
initialize the table
subroutine, public fft_all_end()
delete all plans
real(real64), parameter, public m_two
subroutine, public global_end()
Finalise parser varinfo file, and MPI.
real(real64), parameter, public m_huge
real(real64), parameter, public m_zero
complex(real64), parameter, public m_z0
complex(real64), parameter, public m_zi
subroutine, public global_init(communicator)
Initialise Octopus.
real(real64), parameter, public m_half
real(real64), parameter, public m_one
This module implements the underlying real-space grid.
subroutine, public io_init(defaults)
If the argument defaults is present and set to true, then the routine will not try to read anything f...
subroutine, public io_close(iunit, grp)
subroutine, public io_end()
integer function, public io_open(file, namespace, action, status, form, position, die, recl, grp)
subroutine, public kpoints_to_absolute(latt, kin, kout)
System information (time, memory, sysname)
This module defines functions over batches of mesh functions.
subroutine, public zmesh_batch_mf_dotp(mesh, aa, psi, dot, reduce, nst)
calculate the dot products between a batch and a vector of mesh functions
This module defines various routines, operating on mesh functions.
This module defines the meshes, which are used in Octopus.
subroutine, public messages_end()
subroutine, public messages_not_implemented(feature, namespace)
subroutine, public messages_init(output_dir)
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.
type(namespace_t), public global_namespace
subroutine, public orbitalset_init(this)
subroutine, public orbitalset_end(this)
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...
logical function, public parse_is_defined(namespace, name)
subroutine, public parser_init()
Initialise the Octopus parser.
subroutine, public parser_end()
End the Octopus parser.
subroutine, public profiling_end(namespace)
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 profiling_init(namespace)
Create profiling subdirectory.
integer, parameter, public restart_gs
integer, parameter, public restart_td
integer, parameter, public restart_type_load
subroutine, public zstates_elec_rrqr_decomposition(st, namespace, mesh, nst, root, ik, jpvt)
Perform RRQR on the transpose states stored in the states object and return the pivot vector.
This module defines routines to write information about states.
logical function, public state_kpt_is_local(st, ist, ik)
check whether a given state (ist, ik) is on the local node
subroutine, public states_elec_allocate_wfns(st, mesh, wfs_type, skip, packed)
Allocates the KS wavefunctions defined within a states_elec_t structure.
subroutine, public states_elec_look(restart, nik, dim, nst, ierr)
Reads the 'states' file in the restart directory, and finds out the nik, dim, and nst contained in it...
This module handles reading and writing restart information for the states_elec_t.
subroutine, public states_elec_load(restart, namespace, space, st, mesh, kpoints, ierr, iter, lr, lowest_missing, label, verbose, skip)
returns in ierr: <0 => Fatal error, or nothing read =0 => read all wavefunctions >0 => could only rea...
subroutine, public submesh_init(this, space, mesh, latt, center, rc)
type(type_t), public type_cmplx
brief This module defines the class unit_t which is used by the unit_systems_oct_m module.
This module defines the unit system, used for input and output.
type(unit_t), public unit_angstrom
For XYZ files.
subroutine, public unit_system_init(namespace)
type(unit_t), public unit_ev
For output energies in eV.
This module is intended to contain simple general-purpose utility functions and procedures.
subroutine, public ylm_wannier(ylm, l, mr, rr, xx, nr)
Class describing the electron system.
Describes mesh distribution to nodes.
The states_elec_t class contains all electronic wave functions.
batches of electronic states
subroutine create_wannier90_spn(mesh, st)
Write the spn file containing .
subroutine create_wannier90_eig()
subroutine read_wannier90_files()
subroutine write_unk(space, mesh, st, formatted)
subroutine create_wannier90_mmn(mesh, st)
subroutine wannier90_setup(ions, kpoints, space)
subroutine generate_wannier_states(space, mesh, ions, st, kpoints)
program wannier90_interface
subroutine create_wannier90_amn(space, mesh, latt, st, kpoints)
subroutine wannier90_output()