37 use,
intrinsic :: iso_fortran_env
71 integer :: w90_what, w90_mode
72 integer(int64) :: w90_what_default
76 integer :: ii, nik, iter, nst
78 type(restart_t) :: restart
79 type(electrons_t),
pointer :: sys
80 logical :: w90_spinors, scdm_proj, w90_scdm
81 integer :: w90_nntot, w90_num_bands, w90_num_kpts
82 integer,
allocatable :: w90_nnk_list(:,:)
83 character(len=80) :: w90_prefix
84 integer :: w90_num_wann
85 real(real64),
allocatable :: w90_proj_centers(:,:)
86 integer,
allocatable :: w90_proj_lmr(:,:)
88 integer,
allocatable :: w90_spin_proj_component(:)
89 real(real64),
allocatable :: w90_spin_proj_axis(:,:)
90 integer :: w90_num_exclude
91 logical,
allocatable :: exclude_list(:)
92 integer,
allocatable :: band_index(:)
93 logical :: read_td_states
94 integer :: w90_spin_channel
95 logical :: w90_bloch_sums = .false.
98 integer,
allocatable :: jpvt(:)
99 complex(real64),
allocatable :: uk(:,:,:)
100 complex(real64),
allocatable :: psi(:,:)
101 complex(real64),
allocatable :: chi(:,:), chi_diag(:,:),chi2(:,:)
102 real(real64),
allocatable :: chi_eigenval(:), occ_temp(:)
103 real(real64) :: scdm_mu, scdm_sigma, smear, kvec(3), factor(3)
104 integer :: ist, jst, ik, idir, sender
106 integer(int64) :: how
131 if (w90_prefix ==
'w90')
then
132 message(1) =
"oct-wannier90: the prefix is set by default to w90"
162 if (w90_mode == 0)
then
163 message(1) =
"Wannier90Mode must be set to a value different from 0."
185 w90_what_default = option__wannier90files__w90_mmn + option__wannier90files__w90_amn + option__wannier90files__w90_eig
186 if (sys%st%d%ispin ==
spinors) w90_what_default = w90_what_default + option__wannier90files__w90_spn
227 if (sys%kpoints%use_symmetries)
then
228 message(1) =
'oct-wannier90: k-points symmetries are not allowed'
231 if (sys%kpoints%use_time_reversal)
then
232 message(1) =
'oct-wannier90: time-reversal symmetry is not allowed'
235 if (sys%kpoints%reduced%nshifts > 1)
then
236 message(1) =
'oct-wannier90: Wannier90 does not allow for multiple shifts of the k-point grid'
244 w90_spinors = .false.
256 do idir = sys%space%periodic_dim+1, sys%space%dim
257 factor(idir) =
m_two * sys%gr%box%bounding_box_l(idir)
259 call sys%ions%latt%scale(factor)
262 select case (w90_mode)
263 case (option__wannier90mode__w90_setup)
267 case (option__wannier90mode__w90_output)
270 case (option__wannier90mode__w90_wannier)
286 if (read_td_states)
then
288 sys%mc, ierr, sys%gr)
291 sys%mc, ierr, sys%gr)
299 if (dim == sys%st%d%dim .and. nik == sys%kpoints%reduced%npoints .and. nst >= sys%st%nst)
then
301 ierr, iter, label =
": wannier90", skip=exclude_list)
303 write(
message(1),
'(a)')
'Restart structure not commensurate.'
311 message(1) =
"Wannier90Mode is set to an unsupported value."
315 safe_deallocate_a(exclude_list)
316 safe_deallocate_a(band_index)
317 safe_deallocate_a(w90_nnk_list)
318 safe_deallocate_a(w90_proj_centers)
319 safe_deallocate_a(w90_proj_lmr)
321 safe_deallocate_p(sys)
333 type(
ions_t),
intent(in) :: ions
335 class(
space_t),
intent(in) :: space
337 character(len=80) :: filename
338 integer :: w90_win, ia, axis(3), npath
342 assert(space%dim == 3)
345 filename = trim(adjustl(w90_prefix)) //
'.win'
348 write(w90_win,
'(a)')
'# this file has been created by the Octopus wannier90 utility'
349 write(w90_win,
'(a)')
' '
352 write(w90_win,
'(a)')
'begin unit_cell_cart'
353 write(w90_win,
'(a)')
'Ang'
357 write(w90_win,
'(a)')
'end unit_cell_cart'
358 write(w90_win,
'(a)')
' '
360 write(w90_win,
'(a)')
'begin atoms_frac'
361 do ia = 1, ions%natoms
362 write(w90_win,
'(a,2x,f13.8,f13.8,f13.8)') trim(ions%atom(ia)%label), ions%latt%cart_to_red(ions%pos(:, ia))
364 write(w90_win,
'(a)')
'end atoms_frac'
365 write(w90_win,
'(a)')
' '
368 write(w90_win,
'(a)')
'use_bloch_phases = .true.'
369 write(w90_win,
'(a)')
' '
371 write(w90_win,
'(a10,i4)')
'num_bands ', sys%st%nst
372 write(w90_win,
'(a9,i4)')
'num_wann ', sys%st%nst
373 write(w90_win,
'(a)')
' '
375 if (sys%st%d%ispin ==
spinors)
then
376 write(w90_win,
'(a)')
'spinors = .true.'
379 if (w90_spin_channel == 1)
then
380 write(w90_win,
'(a)')
'spin = up'
381 else if (w90_spin_channel == 2)
then
382 write(w90_win,
'(a)')
'spin = down'
384 message(1) =
'Wannier90SpinChannel value is invalid.'
390 write(w90_win,
'(a)')
'write_u_matrices = .true.'
391 write(w90_win,
'(a)')
'write_xyz = .true.'
392 write(w90_win,
'(a)')
' '
394 if (kpoints%reduced%npoints == 1)
then
395 write(w90_win,
'(a)')
'gamma_only = .true.'
396 write(w90_win,
'(a)')
' '
399 message(1) =
'oct-wannier90: need Monkhorst-Pack grid. Please specify %KPointsGrid'
404 npath = kpoints%nkpt_in_path()
406 axis(1:3) = kpoints%nik_axis(1:3)
407 assert(product(kpoints%nik_axis(1:3)) == kpoints%reduced%npoints - npath)
409 write(w90_win,
'(a8,i4,i4,i4)')
'mp_grid =', axis(1:3)
410 write(w90_win,
'(a)')
' '
411 write(w90_win,
'(a)')
'begin kpoints '
414 do ii = 1, kpoints%reduced%npoints-npath
415 write(w90_win,
'(f13.8,f13.8,f13.8)') - kpoints%reduced%red_point(1:3,ii)
417 write(w90_win,
'(a)')
'end kpoints '
436 if (read_td_states)
then
438 sys%mc, ierr, sys%gr)
441 sys%mc, ierr, sys%gr)
449 if (dim == sys%st%d%dim .and. nik == sys%kpoints%reduced%npoints .and. nst >= sys%st%nst)
then
451 ierr, iter, label =
": wannier90", skip=exclude_list)
453 write(
message(1),
'(a)')
'Restart structure not commensurate.'
461 safe_allocate(jpvt(1:sys%gr%np_global*sys%st%d%dim))
462 safe_allocate(psi(1:sys%gr%np, 1:sys%st%d%dim))
463 safe_allocate(occ_temp(1:w90_num_bands))
466 do ist = 1, w90_num_bands
467 occ_temp(ist)= sys%st%occ(ist, 1)
468 sys%st%occ(ist, 1)=
m_half*erfc((sys%st%eigenval(ist, 1)-scdm_mu) / scdm_sigma)
474 do ist = 1, w90_num_bands
475 sys%st%occ(ist, 1) = occ_temp(ist)
478 safe_allocate(uk(1:w90_num_bands, 1:w90_num_bands, 1:nik))
481 safe_allocate(chi(1:w90_num_bands, 1:w90_num_bands))
482 safe_allocate(chi_diag(1:w90_num_bands, 1:w90_num_bands))
483 safe_allocate(chi2(1:w90_num_bands, 1:w90_num_bands))
484 safe_allocate(chi_eigenval(1:w90_num_bands))
486 chi(1:w90_num_bands, 1:w90_num_bands) =
m_zero
489 kvec(:) = sys%kpoints%reduced%point(:, ik)
492 ik_real = (ik-1)*2 + w90_spin_channel
497 do ist = 1, w90_num_bands
501 sender = sys%st%d%kpt%mpi_grp%rank
503 call sys%st%d%kpt%mpi_grp%allreduce_inplace(sender, 1, mpi_integer, mpi_max)
505 call sys%st%d%kpt%mpi_grp%bcast(psi, sys%gr%np*sys%st%d%dim, mpi_double_complex, sender)
506 smear=
m_half * erfc((sys%st%eigenval(ist, ik_real) - scdm_mu) / scdm_sigma)
508 do jst = 1, w90_num_bands
509 chi(ist, jst) = smear * conjg(psi(jpvt(jst), 1)) &
510 *
exp(
m_zi * dot_product(sys%gr%x(1:3, jpvt(jst)), kvec(1:3)))
516 chi_diag = matmul(conjg(transpose(chi)), chi)
518 chi2 = conjg(transpose(chi_diag))
521 if (any(chi_eigenval(:) .lt.
m_zero))
then
522 message(1) =
'SCDM Wannierization failed because chi matrix is'
523 message(2) =
'ill conditioned. Try increasingin scdm_sigma and/or'
528 do ist = 1, w90_num_bands
529 chi_eigenval(ist) =
m_one /
sqrt(chi_eigenval(ist))
530 chi2(ist, 1:w90_num_bands) = chi_eigenval(ist) * chi2(ist, 1:w90_num_bands)
534 uk(:,:,ik) = matmul(chi, matmul(chi_diag,chi2))
538 safe_deallocate_a(chi)
539 safe_deallocate_a(psi)
540 safe_deallocate_a(chi_diag)
541 safe_deallocate_a(chi2)
542 safe_deallocate_a(chi_eigenval)
543 safe_deallocate_a(jpvt)
544 safe_deallocate_a(psi)
545 safe_deallocate_a(occ_temp)
549 if (
bitand(w90_what, option__wannier90files__w90_mmn) /= 0)
then
553 if (
bitand(w90_what, option__wannier90files__w90_unk) /= 0)
then
554 call write_unk(sys%space, sys%gr, sys%st, formatted=.false.)
557 if (
bitand(w90_what, option__wannier90files__w90_amn) /= 0)
then
561 if (
bitand(w90_what, option__wannier90files__w90_eig) /= 0)
then
565 if (
bitand(w90_what, option__wannier90files__w90_spn) /= 0)
then
569 safe_deallocate_a(uk)
570 safe_deallocate_a(w90_spin_proj_component)
571 safe_deallocate_a(w90_spin_proj_axis)
578 integer :: w90_nnkp, itemp, dummyint, io, spin_channel_win
579 character(len=80) :: filename, dummy, dummy1, dummy2, line
580 logical :: exist, parse_is_ok
581 real(real64) :: dummyr(7)
585 w90_num_kpts = product(sys%kpoints%nik_axis(1:3))
586 assert(w90_num_kpts == sys%st%nik)
592 filename = trim(adjustl(w90_prefix)) //
'.nnkp'
594 message(1) =
"oct-wannier90: Parsing "//filename
597 inquire(file=filename,exist=exist)
598 if (.not. exist)
then
599 message(1) =
'oct-wannier90: Cannot find specified Wannier90 nnkp file.'
600 write(
message(2),
'(a)')
'Please run wannier90.x -pp '// trim(adjustl(w90_prefix)) //
' first.'
604 parse_is_ok = .false.
609 read(w90_nnkp, *, iostat=io) dummy, dummy1
610 if (io == iostat_end)
exit
612 if (dummy ==
'begin' .and. dummy1 ==
'kpoints')
then
613 read(w90_nnkp,*) itemp
614 if (itemp /= w90_num_kpts)
then
615 message(1) =
'oct-wannier90: wannier90 setup seems to have been done with a different number of k-points.'
625 if (.not. parse_is_ok)
then
626 message(1) =
'oct-wannier90: Did not find the kpoints block in nnkp file'
629 parse_is_ok = .false.
635 read(w90_nnkp, *, iostat=io) dummy, dummy1
636 if (io == iostat_end)
exit
638 if (dummy ==
'begin' .and. dummy1 ==
'nnkpts')
then
639 read(w90_nnkp,*) w90_nntot
640 safe_allocate(w90_nnk_list(1:5, 1:w90_num_kpts * w90_nntot))
641 do ii = 1, w90_num_kpts * w90_nntot
642 read(w90_nnkp,*) w90_nnk_list(1:5, ii)
645 read(w90_nnkp,*) dummy
646 if (dummy /=
'end')
then
647 message(1) =
'oct-wannier90: There dont seem to be enough k-points in nnkpts file to.'
655 if (.not. parse_is_ok)
then
656 message(1) =
'oct-wannier90: Did not find nnkpts block in nnkp file'
662 safe_allocate(exclude_list(1:sys%st%nst))
664 exclude_list(1:sys%st%nst) = .false.
667 read(w90_nnkp, *, iostat=io) dummy, dummy1
668 if (io == iostat_end)
exit
669 if (dummy ==
'begin' .and. dummy1 ==
'exclude_bands')
then
670 read(w90_nnkp, *) w90_num_exclude
671 do ii = 1, w90_num_exclude
672 read(w90_nnkp, *) itemp
673 if(itemp > sys%st%nst)
then
674 message(1) =
'oct-wannier90: The exclude_bands list contains a state index higher than the number of states.'
677 exclude_list(itemp) = .
true.
680 read(w90_nnkp, *) dummy
681 if (dummy /=
'end')
then
682 message(1) =
'oct-wannier90: There dont seem to be enough bands in exclude_bands list.'
691 w90_num_bands = sys%st%nst - w90_num_exclude
693 safe_allocate(band_index(1:sys%st%nst))
695 do ii = 1, sys%st%nst
696 if (exclude_list(ii)) cycle
698 band_index(ii) = itemp
701 if (
bitand(w90_what, option__wannier90files__w90_amn) /= 0 &
702 .or. w90_mode == option__wannier90mode__w90_wannier )
then
707 read(w90_nnkp, *, iostat=io) dummy, dummy1
708 if (io == iostat_end)
then
709 message(1) =
'oct-wannier90: Did not find projections block in w90.nnkp file'
713 if (dummy ==
'begin' .and. (dummy1 ==
'projections' .or. dummy1 ==
'spinor_projections'))
then
715 if (dummy1 ==
'spinor_projections')
then
717 if (sys%st%d%ispin /=
spinors)
then
718 message(1) =
'oct-wannier90: Spinor = .true. is only valid with spinors wavefunctions.'
722 message(1) =
'oct-wannier90: Spinor interface incomplete. Note there is no quantization axis implemented'
725 if (sys%st%d%ispin ==
spinors)
then
726 message(1) =
'oct-wannier90: Octopus has spinors wavefunctions but spinor_projections is not defined.'
727 message(2) =
'oct-wannier90: Please check the input file for wannier 90.'
732 read(w90_nnkp, *) w90_nproj
735 w90_num_wann = w90_nproj
737 if(w90_nproj == 0) w90_num_wann = w90_num_bands
739 safe_allocate(w90_proj_centers(1:3, 1:w90_nproj))
740 safe_allocate(w90_proj_lmr(1:w90_nproj, 1:3))
741 if (w90_spinors)
then
742 safe_allocate(w90_spin_proj_component(1:w90_nproj))
744 if (w90_spinors)
then
745 safe_allocate(w90_spin_proj_axis(1:w90_nproj, 1:3))
749 read(w90_nnkp, *) w90_proj_centers(1:3, ii), w90_proj_lmr(ii, 1:3)
751 read(w90_nnkp, *) dummyr(1:7)
752 if (w90_spinors)
then
753 read(w90_nnkp, *) w90_spin_proj_component(ii), w90_spin_proj_axis(ii, 1:3)
755 if (w90_spin_proj_component(ii) == -1) w90_spin_proj_component(ii) = 2
759 read(w90_nnkp, *) dummy
760 if (dummy /=
'end')
then
761 message(1) =
'oct-wannier90: There dont seem to be enough projections in nnkpts file to.'
771 read(w90_nnkp, *, iostat=io) dummy, dummy1
772 if (io == iostat_end)
exit
774 if (dummy ==
'begin' .and. dummy1 ==
'auto_projections')
then
776 read(w90_nnkp, *) w90_nproj
777 w90_num_wann = w90_nproj
779 if (.not. w90_scdm)
then
780 message(1) =
'oct-wannier90: Found auto_projections block. Currently the only implemented automatic way'
781 message(2) =
'oct-wannier90: to compute projections is the SCDM method.'
782 message(3) =
'oct-wannier90: Please set Wannier90UseSCDM = yes in the inp file.'
786 if (w90_nproj /= w90_num_bands)
then
787 message(1) =
'oct-wannier90: In auto_projections block first row needs to be equal to num_bands.'
790 read(w90_nnkp, *) dummyint
791 if (dummyint /= 0)
then
792 message(1) =
'oct-wannier90: The second row in auto_projections has to be 0, per Wannier90 documentation.'
801 message(1) =
"oct-wannier90: Finished parsing "//filename
806 filename = trim(adjustl(w90_prefix)) //
'.win'
807 message(1) =
"oct-wannier90: Parsing "//filename
811 read(w90_nnkp, fmt=
'(a)', iostat=io) line
812 if (io == iostat_end)
exit
813 if (index(line,
'=') > 0)
then
814 read(line, *, iostat=io) dummy, dummy2, dummy1
816 read(line, *, iostat=io) dummy, dummy1
820 if (dummy ==
'spin')
then
822 message(1) =
'oct-wannier90: The variable spin is set for a non spin-polarized calculation.'
826 if (dummy1 ==
'up')
then
828 else if (dummy1 ==
'down')
then
831 message(1) =
'oct-wannier90: Error parsing the variable spin.'
834 if (spin_channel_win /= w90_spin_channel)
then
835 message(1) =
'spin polarization input from .win and Wannier90SpinChannel do not agree.'
843 write(
message(1),
'(a,i1)')
'oct-wannier90: Using spin channel ', w90_spin_channel
847 message(1) =
"oct-wannier90: Finished parsing "//filename
856 class(
mesh_t),
intent(in) :: mesh
859 integer :: ist, jst, ik, ip, w90_mmn, iknn, idim, ibind
860 real(real64) :: Gcart(3)
862 character(len=80) :: filename
863 complex(real64),
allocatable :: overlap(:)
864 complex(real64),
allocatable :: psim(:,:), psin(:,:), phase(:)
866 integer :: inode, node_fr, node_to
867 type(mpi_request) :: send_req
873 if (st%parallel_in_states)
then
877 message(1) =
"Info: Computing the overlap matrix"
881 filename =
'./'// trim(adjustl(w90_prefix))//
'.mmn'
885 if (st%system_grp%is_root())
then
886 write(w90_mmn,*)
'Created by oct-wannier90'
887 write(w90_mmn,*) w90_num_bands, w90_num_kpts, w90_nntot
890 safe_allocate(psim(1:mesh%np, 1:st%d%dim))
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))
897 do ii = 1, w90_num_kpts * w90_nntot
898 ik = w90_nnk_list(1, ii)
899 iknn = w90_nnk_list(2, ii)
900 g(1:3) = w90_nnk_list(3:5, ii)
901 if (st%system_grp%is_root())
write(w90_mmn,
'(I10,2x,I10,2x,I3,2x,I3,2x,I3)') ik, iknn, g
904 g(sys%space%periodic_dim+1:sys%space%dim) = 0
908 ik = (ik-1)*2 + w90_spin_channel
909 iknn = (iknn-1)*2 + w90_spin_channel
914 if(ik >= st%d%kpt%start .and. ik <= st%d%kpt%end)
then
923 if (any(g /= 0))
then
926 phase(ip) =
exp(-
m_zi*dot_product(mesh%x(1:3, ip), gcart(1:3)))
935 if (exclude_list(jst)) cycle
938 if ( .not. st%d%kpt%parallel .and. .not. st%parallel_in_states)
then
943 do inode = 0, st%d%kpt%mpi_grp%size-1
944 if(iknn >= st%st_kpt_task(inode,3) .and. iknn <= st%st_kpt_task(inode,4))
then
947 if(ik >= st%st_kpt_task(inode,3) .and. ik <= st%st_kpt_task(inode,4))
then
954 send_req = mpi_request_null
959 if(node_to /= st%d%kpt%mpi_grp%rank)
then
960 call st%d%kpt%mpi_grp%isend(psin, mesh%np*st%d%dim, mpi_double_complex, node_to, send_req)
964 if(node_to == st%d%kpt%mpi_grp%rank .and. node_to /= node_fr)
then
965 call st%d%kpt%mpi_grp%recv(psin, mesh%np*st%d%dim, mpi_double_complex, node_fr)
967 if (send_req /= mpi_request_null)
then
968 call st%d%kpt%mpi_grp%wait(send_req)
974 if(ik >= st%d%kpt%start .and. ik <= st%d%kpt%end)
then
977 if (any(g /= 0))
then
980 do idim = 1, st%d%dim
983 psin(ip, idim) = psin(ip, idim) * phase(ip)
994 if (exclude_list(ist)) cycle
996 batch => st%group%psib(st%group%iblock(ist), ik)
998 select case (batch%status())
1000 overlap(band_index(ist)) =
m_z0
1001 do idim = 1, st%d%dim
1002 ibind = batch%inv_index((/ist, idim/))
1003 overlap(band_index(ist)) = overlap(band_index(ist)) + &
1004 zmf_dotp(mesh, batch%zff_linear(:, ibind), psin(:,idim), reduce = .false.)
1009 overlap(band_index(ist)) =
zmf_dotp(mesh, st%d%dim, psim, psin, reduce = .false.)
1015 call mesh%allreduce(overlap)
1018 if(st%d%kpt%parallel)
then
1023 if (st%system_grp%is_root())
then
1025 if (exclude_list(ist)) cycle
1026 write(w90_mmn,
'(e18.10,2x,e18.10)') overlap(band_index(ist))
1035 safe_deallocate_a(psim)
1036 safe_deallocate_a(psin)
1037 safe_deallocate_a(phase)
1038 safe_deallocate_a(overlap)
1048 integer :: ist, ik, w90_eig
1049 character(len=80) :: filename
1053 if (sys%st%parallel_in_states)
then
1057 if (sys%st%system_grp%is_root())
then
1058 filename =
'./'//trim(adjustl(w90_prefix))//
'.eig'
1060 do ik = 1, w90_num_kpts
1061 do ist = 1, sys%st%nst
1062 if (exclude_list(ist)) cycle
1064 write(w90_eig,
'(I5,2x,I8,2x,e18.10)') band_index(ist), ik, &
1067 write(w90_eig,
'(I5,2x,I8,2x,e18.10)') band_index(ist), ik, &
1080 subroutine write_unk(space, mesh, st, formatted)
1081 class(
space_t),
intent(in) :: space
1082 class(
mesh_t),
intent(in) :: mesh
1084 logical,
intent(in) :: formatted
1086 integer :: ist, ik, unk_file, ispin
1087 integer :: ix, iy, iz
1088 real(real64) :: w_real, w_imag
1089 character(len=80) :: filename
1090 complex(real64),
allocatable :: psi(:)
1096 if (st%d%kpt%parallel)
then
1100 if (sys%gr%parallel_in_domains)
then
1104 if (st%parallel_in_states)
then
1111 safe_allocate(psi(1:mesh%np))
1114 mesh%coord_system, need_partition=.not.mesh%parallel_in_domains)
1119 do ik = 1, w90_num_kpts
1120 do ispin = 1, st%d%dim
1121 if (st%system_grp%is_root())
then
1122 write(filename,
'(a,i5.5,a1,i1)')
'./UNK', ik,
'.', ispin
1126 write(unk_file, *) mesh%idx%ll(1:mesh%idx%dim), ik, w90_num_bands
1129 write(unk_file) mesh%idx%ll(1:mesh%idx%dim), ik, w90_num_bands
1135 if (exclude_list(ist)) cycle
1145 assert(.not. cube%parallel_in_domains)
1148 if (st%system_grp%is_root())
then
1150 do iz=1,cube%rs_n_global(3)
1151 do iy = 1,cube%rs_n_global(2)
1152 do ix = 1,cube%rs_n_global(1)
1153 w_real = real(cf%zrs(ix,iy,iz), real64)
1154 w_imag = aimag(cf%zrs(ix,iy,iz))
1155 write (unk_file, *) w_real, w_imag
1160 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))
1164 if (st%system_grp%is_root())
call io_close(unk_file)
1171 safe_deallocate_a(psi)
1179 class(
space_t),
intent(in) :: space
1180 class(
mesh_t),
intent(in) :: mesh
1185 integer :: ist, ik, w90_amn, idim, iw, ip, ik_real
1186 real(real64) :: center(3), kpoint(3), threshold
1187 character(len=80) :: filename
1188 complex(real64),
allocatable :: psi(:,:), phase(:), projection(:)
1189 real(real64),
allocatable :: ylm(:)
1195 if (st%parallel_in_states)
then
1199 filename =
'./'// trim(adjustl(w90_prefix))//
'.amn'
1203 if (st%system_grp%is_root())
then
1204 write(w90_amn,*)
'Created by oct-wannier90'
1205 write(w90_amn,*) w90_num_bands, w90_num_kpts, w90_num_wann
1210 message(1) =
"Info: Writing projections obtained from SCDM."
1214 do ik = 1, w90_num_kpts
1216 if (exclude_list(ist)) cycle
1217 if (st%system_grp%is_root())
then
1218 do iw = 1, w90_nproj
1219 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)
1227 message(1) =
"Info: Computing the projection matrix"
1233 safe_allocate(orbitals(1:w90_nproj))
1238 orbitals(iw)%norbs = 1
1239 orbitals(iw)%ndim = 1
1240 orbitals(iw)%radius = -
log(threshold)
1241 orbitals(iw)%use_submesh = .false.
1244 center(1:3) = latt%red_to_cart(w90_proj_centers(1:3, iw))
1245 call submesh_init(orbitals(iw)%sphere, space, mesh, latt, center, orbitals(iw)%radius)
1248 safe_allocate(ylm(1:orbitals(iw)%sphere%np))
1250 call ylm_wannier(ylm, w90_proj_lmr(iw,1), w90_proj_lmr(iw,2), &
1251 orbitals(iw)%sphere%r, orbitals(iw)%sphere%rel_x, orbitals(iw)%sphere%np)
1254 if (w90_proj_lmr(iw,3) == 1)
then
1255 do ip = 1,orbitals(iw)%sphere%np
1256 ylm(ip) = ylm(ip)*
m_two*
exp(-orbitals(iw)%sphere%r(ip))
1262 safe_allocate(orbitals(iw)%zorb(1:orbitals(iw)%sphere%np, 1, 1))
1263 orbitals(iw)%zorb(1:orbitals(iw)%sphere%np, 1, 1) = ylm(1:orbitals(iw)%sphere%np)
1264 safe_deallocate_a(ylm)
1266 safe_allocate(orbitals(iw)%phase(1:orbitals(iw)%sphere%np, st%d%kpt%start:st%d%kpt%end))
1267 orbitals(iw)%phase(:,:) =
m_z0
1268 safe_allocate(orbitals(iw)%eorb_mesh(1:mesh%np, 1, 1, st%d%kpt%start:st%d%kpt%end))
1269 orbitals(iw)%eorb_mesh(:,:,:,:) =
m_z0
1272 kpt_max = w90_num_kpts)
1276 safe_allocate(psi(1:mesh%np, 1:st%d%dim))
1277 safe_allocate(phase(1:mesh%np))
1278 safe_allocate(projection(1:w90_nproj))
1280 do ik = 1, w90_num_kpts
1281 kpoint(1:space%dim) = kpoints%get_point(ik)
1284 phase(ip) =
exp(-
m_zi* sum(mesh%x(1:space%dim, ip) * kpoint(1:space%dim)))
1289 ik_real = (ik-1)*2 + w90_spin_channel
1296 if (exclude_list(ist)) cycle
1300 if(ik_real >= st%d%kpt%start .and. ik_real <= st%d%kpt%end)
then
1304 do idim = 1, st%d%dim
1308 psi(ip, idim) = psi(ip, idim)*phase(ip)
1313 do iw = 1, w90_nproj
1315 if (w90_spinors) idim = w90_spin_proj_component(iw)
1319 projection(iw) =
zmf_dotp(mesh, psi(1:mesh%np,idim), &
1320 orbitals(iw)%eorb_mesh(1:mesh%np,1,1,ik_real), reduce = .false.)
1324 call mesh%allreduce(projection)
1328 if(st%d%kpt%parallel)
then
1332 if (st%system_grp%is_root())
then
1333 do iw = 1, w90_nproj
1334 write (w90_amn,
'(I5,2x,I5,2x,I5,2x,e18.10,2x,e18.10)') band_index(ist), iw, ik, projection(iw)
1340 safe_deallocate_a(psi)
1341 safe_deallocate_a(phase)
1342 safe_deallocate_a(projection)
1344 do iw = 1, w90_nproj
1347 safe_deallocate_a(orbitals)
1363 class(mesh_t),
intent(in) :: mesh
1364 type(states_elec_t),
target,
intent(in) :: st
1366 integer :: ist, jst, ik, w90_spn, counter
1367 character(len=80) :: filename
1368 complex(real64),
allocatable :: spin(:,:,:)
1369 complex(real64),
allocatable :: psim(:,:), psin(:,:)
1370 complex(real64) :: dot_upup, dot_updown, dot_downup, dot_downdown
1373 call profiling_in(
"W90_SPN")
1375 assert(st%d%ispin == spinors)
1377 if (st%parallel_in_states)
then
1378 call messages_not_implemented(
"w90_spn output with states parallelization")
1381 message(1) =
"Info: Computing the spin file"
1382 call messages_info(1)
1384 filename =
'./'// trim(adjustl(w90_prefix))//
'.spn'
1385 w90_spn = io_open(trim(filename), global_namespace, action=
'write')
1388 if (st%system_grp%is_root())
then
1389 write(w90_spn,*)
'Created by oct-wannier90'
1390 write(w90_spn,*) w90_num_bands, w90_num_kpts
1393 safe_allocate(psim(1:mesh%np, 1:st%d%dim))
1394 safe_allocate(psin(1:mesh%np, 1:st%d%dim))
1395 safe_allocate(spin(1:3, 1:(w90_num_bands*(w90_num_bands+1))/2, 1:w90_num_kpts))
1399 do ik = st%d%kpt%start, st%d%kpt%end
1402 if (exclude_list(jst)) cycle
1404 call states_elec_get_state(st, mesh, jst, ik, psim)
1406 if (exclude_list(ist)) cycle
1408 counter = counter + 1
1410 call states_elec_get_state(st, mesh, ist, ik, psin)
1412 dot_upup = zmf_dotp(mesh, psin(:, 1), psim(:, 1), reduce = .false.)
1413 dot_downdown = zmf_dotp(mesh, psin(:, 2), psim(:, 2), reduce = .false.)
1414 dot_updown = zmf_dotp(mesh, psin(:, 1), psim(:, 2), reduce = .false.)
1415 dot_downup = zmf_dotp(mesh, psin(:, 2), psim(:, 1), reduce = .false.)
1417 spin(1, counter, ik) = dot_updown + dot_downup
1418 spin(2, counter, ik) = -m_zi * dot_updown + m_zi * dot_downup
1419 spin(3, counter, ik) = dot_upup - dot_downdown
1424 call profiling_in(
"W90_SPN_REDUCE")
1425 call mesh%allreduce(spin)
1427 if(st%d%kpt%parallel)
then
1428 call comm_allreduce(st%d%kpt%mpi_grp, spin)
1430 call profiling_out(
"W90_SPN_REDUCE")
1433 if (st%system_grp%is_root())
then
1434 do ik = 1, w90_num_kpts
1437 if (exclude_list(jst)) cycle
1440 if (exclude_list(ist)) cycle
1442 counter = counter + 1
1443 write(w90_spn,
'(e18.10,2x,e18.10)') spin(1, counter, ik)
1444 write(w90_spn,
'(e18.10,2x,e18.10)') spin(2, counter, ik)
1445 write(w90_spn,
'(e18.10,2x,e18.10)') spin(3, counter, ik)
1451 call io_close(w90_spn)
1453 safe_deallocate_a(psim)
1454 safe_deallocate_a(psin)
1455 safe_deallocate_a(spin)
1457 call profiling_out(
"W90_SPN")
1465 class(space_t),
intent(in) :: space
1466 class(mesh_t),
intent(in) :: mesh
1467 type(ions_t),
intent(in) :: ions
1468 type(states_elec_t),
intent(in) :: st
1469 type(kpoints_t),
intent(in) :: kpoints
1471 integer :: w90_u_mat, w90_xyz, nwann, nik
1472 integer :: ik, iw, iw2, ip, ipmax, rankmax, idmmax
1473 real(real64),
allocatable :: centers(:,:), supercell_centers(:,:), new_centers(:,:)
1474 complex(real64),
allocatable :: Umnk(:,:,:)
1475 complex(real64),
allocatable :: zwn(:,:,:), psi(:,:), phase(:,:), phase_bloch(:), zwn_bloch(:,:,:)
1476 character(len=MAX_PATH_LEN) :: fname
1477 real(real64) :: kpoint(3), wmod, wmodmax, xx(space%dim)
1478 character(len=2) :: dum
1480 type(unit_t) :: fn_unit
1481 complex(real64) :: scal
1482 type(block_t) :: blk
1483 integer :: supercell(space%dim), ii, jj, kk, ncols, Nreplica, irep, irepmax
1484 real(real64) :: min_image_displ(3), offset(space%dim)
1486 integer,
allocatable :: parent(:)
1487 real(real64),
parameter :: tol_cluster = 0.25_real64
1492 message(1) =
"oct-wannier90: Constructing the Wannier states from the U matrix."
1493 call messages_info(1)
1495 inquire(file=trim(trim(adjustl(w90_prefix))//
'_centres.xyz'),exist=exist)
1496 if (.not. exist)
then
1497 message(1) =
'oct-wannier90: Cannot find the Wannier90 file seedname_centres.xyz.'
1498 write(message(2),
'(a)')
'Please run wannier90.x with "write_xyz=.true." in '// trim(adjustl(w90_prefix)) //
'.'
1499 call messages_fatal(2)
1502 w90_xyz = io_open(trim(trim(adjustl(w90_prefix))//
'_centres.xyz'), global_namespace, action=
'read')
1504 safe_allocate(centers(1:3, 1:w90_num_wann))
1508 do iw = 1, w90_num_wann
1509 read(w90_xyz, *) dum, centers(1:3, iw)
1511 centers(1:3, iw) = units_to_atomic(unit_angstrom, centers(1:3, iw))
1513 call io_close(w90_xyz)
1517 safe_allocate(parent(1:w90_num_wann))
1518 do iw = 1, w90_num_wann
1521 min_image_displ(:) = ions%latt%cart_to_red(centers(:, iw) - centers(:, jw))
1522 min_image_displ(1:space%periodic_dim) = min_image_displ(1:space%periodic_dim) - nint(min_image_displ(1:space%periodic_dim))
1523 min_image_displ = ions%latt%red_to_cart(min_image_displ)
1524 if (norm2(min_image_displ) < tol_cluster)
then
1525 parent(iw) = parent(jw)
1531 message(1) =
"Info : Clustering of the Wannier centers"
1532 call messages_info(1)
1534 safe_allocate(new_centers(1:3, 1:w90_num_wann))
1535 do iw = 1, w90_num_wann
1536 write(message(1),
'(a,i0,a,3(f7.3,a))')
'Info : Original Wannier center ', &
1537 iw,
' (', centers(1, iw),
', ', centers(2, iw),
', ', centers(3, iw),
')'
1539 if (parent(iw) == iw)
then
1541 new_centers(1:3, iw) = ions%latt%fold_into_cell(centers(1:3, iw))
1545 min_image_displ(:) = ions%latt%cart_to_red(centers(:, iw) - new_centers(:, parent(iw)))
1546 min_image_displ(1:space%periodic_dim) = real(nint(min_image_displ(1:space%periodic_dim)), real64)
1547 min_image_displ = ions%latt%red_to_cart(min_image_displ)
1548 new_centers(1:3, iw) = centers(1:3, iw) - min_image_displ
1551 write(message(2),
'(a,i0,a,3(f7.3,a))')
'Info : New Wannier center ', &
1552 iw,
' (', new_centers(1, iw),
', ', new_centers(2, iw),
', ', new_centers(3, iw),
')'
1553 write(message(3),
'(a)')
''
1554 call messages_info(3)
1558 centers = new_centers - centers
1559 safe_deallocate_a(parent)
1560 safe_deallocate_a(new_centers)
1562 inquire(file=trim(trim(adjustl(w90_prefix))//
'_u_dis.mat'),exist=exist)
1564 message(1) =
'oct-wannier90: Calculation of Wannier states with disentanglement is not yet supported.'
1565 call messages_fatal(1)
1568 inquire(file=trim(trim(adjustl(w90_prefix))//
'_u.mat'),exist=exist)
1569 if (.not. exist)
then
1570 message(1) =
'oct-wannier90: Cannot find the Wannier90 seedname_u.mat file.'
1571 write(message(2),
'(a)')
'Please run wannier90.x with "write_u_matrices=.true." in '// trim(adjustl(w90_prefix)) //
'.'
1572 call messages_fatal(2)
1574 w90_u_mat = io_open(trim(trim(adjustl(w90_prefix))//
'_u.mat'), global_namespace, action=
'read')
1580 read(w90_u_mat, *) nik, nwann, nwann
1581 if (nik /= w90_num_kpts .or. nwann /= w90_num_wann)
then
1582 message(1) =
"The file contains U matrices is inconsistent with the .win file."
1583 call messages_fatal(1)
1586 safe_allocate(umnk(1:w90_num_wann, 1:w90_num_wann, 1:w90_num_kpts))
1588 do ik = 1, w90_num_kpts
1593 read(w90_u_mat,
'(f15.10,sp,f15.10)') ((umnk(iw, iw2, ik), iw=1, w90_num_wann), iw2=1, w90_num_wann)
1596 call io_close(w90_u_mat)
1599 call parse_variable(global_namespace,
'OutputFormat', 0, how)
1601 message(1) =
"OutputFormat must be specified for outputing Wannier functions."
1602 call messages_fatal(1)
1612 if (parse_is_defined(sys%namespace,
'Wannier90Supercell'))
then
1613 if (parse_block(sys%namespace,
'Wannier90Supercell', blk) == 0)
then
1614 ncols = parse_block_cols(blk, 0)
1615 if (ncols /= space%dim)
then
1616 write(message(1),
'(a,i3,a,i3)')
'Wannier90Supercell has ', ncols,
' columns but must have ', sys%space%dim
1617 call messages_fatal(1, namespace=sys%namespace)
1619 do ii = 1, space%dim
1620 call parse_block_integer(blk, 0, ii - 1, supercell(ii))
1623 call parse_block_end(blk)
1629 nreplica = product(supercell)
1632 safe_allocate(supercell_centers(1:space%dim, 1:nreplica))
1633 offset(1:space%dim) = -
floor((real(supercell(1:space%dim), real64) - m_one) / m_two)
1635 do ii = 0, supercell(1)-1
1636 do jj = 0, supercell(2)-1
1637 do kk = 0, supercell(3)-1
1638 supercell_centers(:, irep) = ions%latt%red_to_cart(offset &
1639 + [real(ii, real64), real(jj, real64), real(kk, real64)])
1647 call io_mkdir(
'wannier', global_namespace)
1650 safe_allocate(zwn(1:mesh%np, 1:nreplica, 1:st%d%dim))
1651 safe_allocate(psi(1:mesh%np, 1:st%d%dim))
1652 safe_allocate(phase(1:mesh%np, 1:nreplica))
1653 safe_allocate(phase_bloch(1:mesh%np))
1654 if (w90_bloch_sums)
then
1655 safe_allocate(zwn_bloch(1:mesh%np, 1:st%d%dim, st%d%kpt%start:st%d%kpt%end))
1658 do iw = 1, w90_num_wann
1662 do ik = 1, w90_num_kpts
1664 if (.not. (ik >= st%d%kpt%start .and. ik <= st%d%kpt%end)) cycle
1666 if (w90_bloch_sums) zwn_bloch(:,:,ik) = m_z0
1668 kpoint(1:space%dim) = kpoints%get_point(ik, absolute_coordinates=.
true.)
1672 do irep = 1, nreplica
1675 xx = mesh%x(1:space%dim, ip)-centers(1:space%dim, iw) + supercell_centers(1:space%dim, irep)
1676 phase(ip, irep) =
exp(-m_zi* sum( xx * kpoint(1:space%dim)))
1679 if (w90_bloch_sums)
then
1681 xx = mesh%x(1:space%dim, ip)
1682 phase_bloch(ip) =
exp(-m_zi* sum( xx * kpoint(1:space%dim)))
1687 if (exclude_list(iw2)) cycle
1689 if (st%d%ispin /= spin_polarized)
then
1690 call states_elec_get_state(st, mesh, iw2, ik, psi)
1692 call states_elec_get_state(st, mesh, iw2, (ik-1)*2+w90_spin_channel, psi)
1696 do idim = 1, st%d%dim
1697 do irep = 1, nreplica
1700 zwn(ip, irep, idim) = zwn(ip, irep, idim) + umnk(band_index(iw2), iw, ik) * psi(ip, idim) * phase(ip, irep)
1707 if (w90_bloch_sums)
then
1709 do idim = 1, st%d%dim
1712 zwn_bloch(ip, idim, ik) = zwn_bloch(ip, idim, ik) &
1713 + umnk(band_index(iw2), iw, ik) * psi(ip, idim) * phase_bloch(ip)
1721 if(st%d%kpt%parallel)
then
1722 call comm_allreduce(st%d%kpt%mpi_grp, zwn)
1727 if (sys%st%d%ispin /= spinors)
then
1731 do irep = 1, nreplica
1733 wmod = real(zwn(ip, irep, 1)*conjg(zwn(ip, irep, 1)), real64)
1734 if (wmod > wmodmax)
then
1741 scal =
sqrt(wmodmax)/zwn(ipmax, irepmax, 1)/w90_num_kpts
1742 call mesh_minmaxloc(mesh, wmodmax, rankmax, mpi_maxloc)
1743 call mesh%mpi_grp%bcast(scal, 1, mpi_double_complex, rankmax)
1744 call lalg_scal(mesh%np, nreplica, scal, zwn(:,:,1))
1746 if (w90_bloch_sums)
then
1747 do ik = st%d%kpt%start, st%d%kpt%end
1751 do idim = 1, st%d%dim
1753 wmod = real(zwn_bloch(ip, idim, ik)*conjg(zwn_bloch(ip, idim, ik)), real64)
1754 if (wmod > wmodmax)
then
1761 scal =
sqrt(wmodmax)/zwn_bloch(ipmax, idmmax, ik)/w90_num_kpts
1762 call mesh_minmaxloc(mesh, wmodmax, rankmax, mpi_maxloc)
1763 call mesh%mpi_grp%bcast(scal, 1, mpi_double_complex, rankmax)
1764 call lalg_scal(mesh%np, st%d%dim, scal, zwn_bloch(:,:,ik))
1770 fn_unit =
sqrt(units_out%length**(-space%dim))
1771 do idim = 1, st%d%dim
1772 if (st%d%ispin == spinors)
then
1773 write(fname,
'(a,i3.3,a4,i1)')
'wannier-', iw,
'-isp', idim
1775 write(fname,
'(a,i3.3,a4,i1)')
'wannier-', iw
1777 if (any(supercell_centers > 1))
then
1778 call io_function_output_supercell(how,
"wannier", trim(fname), mesh, &
1779 space, ions%latt, zwn(:, :, idim), supercell_centers, supercell, fn_unit, ierr, global_namespace, &
1780 pos=ions%pos, atoms=ions%atom, grp = st%dom_st_kpt_mpi_grp)
1783 call zio_function_output(how,
"wannier", trim(fname), global_namespace, space, mesh, &
1784 zwn(:, 1, idim), fn_unit, ierr, pos=ions%pos, atoms=ions%atom, grp = st%dom_st_kpt_mpi_grp)
1789 if (w90_bloch_sums)
then
1790 do ik = st%d%kpt%start, st%d%kpt%end
1791 do idim = 1, st%d%dim
1792 if (st%d%ispin == spinors)
then
1793 write(fname,
'(a,i3.3,a4,i1,a3,i5.5)')
'wannier_bloch-', iw,
'-isp', idim,
'-ik', ik
1795 write(fname,
'(a,i3.3,a4,i1,a3,i5.5)')
'wannier_bloch-', iw,
'-ik', ik
1797 call zio_function_output(how,
"wannier", trim(fname), global_namespace, space, mesh, &
1798 zwn_bloch(:, idim, ik), fn_unit, ierr, pos=ions%pos, atoms=ions%atom)
1804 if (sys%st%d%ispin /= spinors)
then
1806 do irep = 1, nreplica
1808 if(abs(real(zwn(ip, irep, 1), real64)) >= 1e-2_real64)
then
1809 wmodmax = max(wmodmax, abs(aimag(zwn(ip, irep, 1)))/abs(real(zwn(ip, irep, 1), real64)))
1813 call mesh_minmaxloc(mesh, wmodmax, rankmax, mpi_maxloc)
1815 write(message(1),
'(a,i4,a,f11.6)')
'oct-wannier90: Wannier function ', iw,
' Max. Im/Re Ratio = ', wmodmax
1816 call messages_info(1)
1818 write(message(1),
'(a,i4)')
'oct-wannier90: Wannier function done ', iw
1819 call messages_info(1)
1823 safe_deallocate_a(umnk)
1824 safe_deallocate_a(zwn)
1825 safe_deallocate_a(psi)
1826 safe_deallocate_a(phase)
1827 safe_deallocate_a(phase_bloch)
1828 safe_deallocate_a(centers)
1829 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.
integer, parameter, public batch_not_packed
functions are stored in CPU memory, unpacked order
integer, parameter, public batch_device_packed
functions are stored in device memory in packed order
integer, parameter, public batch_packed
functions are stored in CPU memory, in transposed (packed) order
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 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()