71 inp_options, w90main, stdout, stderr, ierr)
72 type(namespace_t),
intent(in) :: namespace
73 type(ions_t),
intent(in) :: ions
74 type(lattice_vectors_t),
intent(in) :: latt
75 type(kpoints_t),
intent(in) :: kpoints
76 type(states_elec_t),
intent(in) :: st
77 type(wannier_opts_t),
intent(in) :: inp_options
78 type(lib_common_type),
intent(inout) :: w90main
79 integer,
intent(inout) :: stdout, stderr, ierr
81 integer,
allocatable :: distk(:)
91 call w90_set_option(w90main,
'kpoints', -kpoints%reduced%red_point(1:3,:))
92 call w90_set_option(w90main,
'mp_grid', kpoints%nik_axis(1:3))
93 call w90_set_option(w90main,
'num_bands', inp_options%num_bands)
94 call w90_set_option(w90main,
'num_wann', inp_options%num_wann)
97 nk = kpoints%full%npoints
98 safe_allocate(distk(1:nk))
99 if (st%d%kpt%parallel)
then
101 call w90_set_comm(w90main, st%d%kpt%mpi_grp%comm%MPI_VAL)
107 ik = st%d%get_kpoint_index(iq)
108 if (distk(ik) == -1)
then
109 distk(ik) = st%d%kpt%process(iq)
110 else if (distk(ik) /= st%d%kpt%process(iq))
then
111 message(1) =
'Error: Wannier90 k-point parallelization: same k-point' // &
112 'assigned to different nodes.'
118 call w90_set_comm(w90main, st%system_grp%comm%MPI_VAL)
122 call w90_set_option(w90main,
'distk', distk)
123 safe_deallocate_a(distk)
132 if (inp_options%dump_inputs)
then
133 call w90_set_option(w90main,
"dump_inputs", .
true.)
137 call w90_input_setopt(w90main, inp_options%prefix, stdout, stderr, ierr)
143 call w90_input_reader(w90main, stdout, stderr, ierr)
145 write(
message(1),
'(a,i0)')
'Error in w90_input_reader: ', ierr
159 type(lib_common_type),
intent(inout) :: w90main
160 type(ions_t),
intent(in) :: ions
161 type(lattice_vectors_t),
intent(in) :: latt
163 integer :: ia, n_atoms
164 real(real64),
allocatable :: atom_pos_frac(:,:)
165 character(len=2),
allocatable :: atom_labels(:)
169 n_atoms = ions%natoms
172 safe_allocate(atom_pos_frac(1:3, 1:n_atoms))
173 safe_allocate(atom_labels(1:n_atoms))
179 atom_pos_frac(1:3, ia) = latt%cart_to_red(ions%pos(1:3, ia))
181 atom_labels(ia) = trim(ions%atom(ia)%label)
185 call w90_set_option(w90main,
'atoms_frac', atom_pos_frac)
187 call w90_set_option(w90main,
'symbols', atom_labels)
189 safe_deallocate_a(atom_pos_frac)
190 safe_deallocate_a(atom_labels)
201 type(lib_common_type),
intent(inout) :: w90main
204 character(len=80) :: filename, line
205 integer :: w90_win, io
211 filename = trim(adjustl(inp_options%prefix)) //
'.win'
213 message(1) =
"oct-wannier90: Parsing projections from "//filename
216 inquire(file=filename,exist=exist)
217 if (.not. exist)
then
218 message(1) =
'oct-wannier90: Cannot find specified Wannier90 win file.'
223 w90_win =
io_open(trim(filename), action=
'read')
225 read(w90_win,
'(A)', iostat=io) line
226 if (is_iostat_end(io))
exit
228 if (trim(line) ==
'begin projections')
then
230 read(w90_win,
'(A)') line
231 if (trim(line) ==
'end projections')
exit
232 call w90_set_option(w90main,
'projections', trim(line))
246 u_dis_matrix, m_matrix, centers)
247 type(lib_common_type),
intent(inout) :: w90main
248 complex(real64),
contiguous,
intent(inout) :: u_matrix(:, :, :)
249 complex(real64),
contiguous,
intent(inout) :: u_dis_matrix(:, :, :)
250 complex(real64),
contiguous,
intent(inout) :: m_matrix(:, :, :, :)
251 real(real64),
contiguous,
intent(in) :: centers(:, :)
255 call w90_set_u_matrix(w90main, u_matrix)
256 call w90_set_u_opt(w90main, u_dis_matrix)
257 call w90_set_m_local(w90main, m_matrix)
258 w90main%wannier_data%centres = centers
272 character(len=80) :: filename, line, dummy, dummy1
273 integer :: w90_win, io
278 filename = trim(adjustl(inp_options%prefix)) //
'.win'
280 message(1) =
"oct-wannier90: Parsing "//filename
283 inquire(file=filename,exist=exist)
284 if (.not. exist)
then
285 message(1) =
'oct-wannier90: Cannot find specified Wannier90 win file.'
290 w90_win =
io_open(trim(filename), action=
'read')
292 read(w90_win,
'(A)', iostat=io) line
293 if (is_iostat_end(io))
exit
295 if (trim(line) ==
'begin kpoints')
then
296 message(1) =
'oct-wannier90: Warning: kpoints specified in .win file' // &
297 ' are ignored. Using kpoints from octopus input instead.'
299 else if (trim(line) ==
'begin atoms_frac')
then
300 message(1) =
'oct-wannier90: Warning: atomic positions specified in .win file' // &
301 ' are ignored. Using positions from octopus input instead.'
303 else if (trim(line) ==
'begin unit_cell_cart')
then
304 message(1) =
'oct-wannier90: Warning: unit cell vectors specified in .win file' // &
305 ' are ignored. Using unit cell vectors from octopus input instead.'
308 if (index(line,
'=') <= 0)
then
309 read(line, *, iostat=io) dummy, dummy1
310 if(dummy ==
'mp_grid')
then
311 message(1) =
'oct-wannier90: Warning: mp_grid specified in .win file' // &
312 ' is ignored. Using k-point mesh from octopus input instead.'
326 band_index, space, mesh, latt, st, kpoints, projection)
327 type(lib_common_type),
intent(in) :: w90main
329 class(
space_t),
intent(in) :: space
330 class(
mesh_t),
intent(in) :: mesh
334 integer,
contiguous,
intent(in) :: band_index(:)
336 complex(real64),
contiguous,
intent(out) :: projection(:, :, :)
349 safe_allocate(proj_input_oct(1:w90main%num_proj))
350 do iw = 1, w90main%num_proj
351 proj_input_oct(iw)%l = w90main%proj_input(iw)%l
352 proj_input_oct(iw)%m = w90main%proj_input(iw)%m
353 proj_input_oct(iw)%s = w90main%proj_input(iw)%s
354 proj_input_oct(iw)%radial = w90main%proj_input(iw)%radial
355 proj_input_oct(iw)%site = w90main%proj_input(iw)%site
356 proj_input_oct(iw)%s_qaxis = w90main%proj_input(iw)%s_qaxis
357 proj_input_oct(iw)%z = w90main%proj_input(iw)%z
358 proj_input_oct(iw)%x = w90main%proj_input(iw)%x
359 proj_input_oct(iw)%zona = w90main%proj_input(iw)%zona
363 band_index, space, mesh, latt, st, kpoints, &
364 w90main%wvfn_read%spin_channel, w90main%num_proj, &
365 proj_input_oct, projection)
367 safe_deallocate_a(proj_input_oct)
379 type(lib_common_type),
intent(in) :: w90main
380 integer,
contiguous,
intent(in) :: band_index(:)
381 class(
mesh_t),
intent(in) :: mesh
385 complex(real64),
contiguous,
intent(out) :: overlap(:, :, :, :)
390 mesh, st, latt, w90main%wvfn_read%spin_channel, &
391 w90main%kmesh_info%nnlist, w90main%kmesh_info%nncell, &
403 m_matrix, u_matrix_opt, last_u_matrix, warm_start)
404 type(lib_common_type),
intent(inout) :: w90main
405 class(
mesh_t),
intent(in) :: gr
406 class(
space_t),
intent(in) :: space
411 integer,
contiguous,
intent(in) :: band_index(:)
412 complex(real64),
contiguous,
intent(inout) :: m_matrix(:, :, :, :)
413 complex(real64),
contiguous,
intent(inout) :: u_matrix_opt(:, :, :)
414 complex(real64),
contiguous,
intent(in) :: last_u_matrix(:, :, :)
415 logical,
optional,
intent(in) :: warm_start
418 integer :: null_stdout
419 logical :: warm_start_
424 if (
present(warm_start)) warm_start_ = warm_start
427 null_stdout =
io_open(
'/dev/null', action=
'write', die=.false.)
434 if (.not. warm_start_)
then
437 gr, latt, st, kpoints, u_matrix_opt)
440 u_matrix_opt(:, :, :) = last_u_matrix(:, :, :)
448 call w90_project_overlap(w90main, null_stdout, stderr, ierr)
450 write(
message(1),
'(a,i0)')
'Error in w90_project_overlap: ', ierr
453 call w90_wannierise(w90main, null_stdout, stderr, ierr)
455 write(
message(1),
'(a,i0)')
'Error in w90_wannierise: ', ierr
integer, parameter, public spin_polarized
subroutine, public io_close(iunit, grp)
integer function, public io_open(file, namespace, action, status, form, position, die, recl, grp)
This module defines the meshes, which are used in Octopus.
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_info(no_lines, iunit, debug_only, stress, all_nodes, 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.
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.
type(unit_t), public unit_ev
For output energies in eV.
Interface module to Wannier 90 library.
subroutine, public wannier90lib_create_wannier90_mmn(w90main, band_index, mesh, st, latt, overlap)
Kohn-Sham State Overlap Matrix.
subroutine, public wannier90lib_create_wannier90_amn(w90main, inp_options, band_index, space, mesh, latt, st, kpoints, projection)
Calculate wannier90 Projection Matrix.
subroutine wannier90lib_set_atom_data(w90main, ions, latt)
Set atom data in wannier90 library.
subroutine, public wannier90lib_wannierization(w90main, gr, space, st, latt, kpoints, options, band_index, m_matrix, u_matrix_opt, last_u_matrix, warm_start)
Full wannierization.
subroutine, public wannier90lib_initialize_matrix_data(w90main, u_matrix, u_dis_matrix, m_matrix, centers)
Associate w90main object with matrix data.
subroutine wannier90lib_set_projections(w90main, inp_options)
Parse projections.
subroutine wannier90lib_warn_inputs(inp_options)
Check for options in .win file.
subroutine, public wannier90lib_init_w90main(namespace, ions, latt, kpoints, st, inp_options, w90main, stdout, stderr, ierr)
Initialize wannier90 library data.
Wannier90 related calculations.
subroutine, public wannier_calc_create_amn(wan_opts, band_index, space, mesh, latt, st, kpoints, spin_channel, num_proj, proj_input, projection)
Calculation of Wannier90 Projection Matrix.
subroutine, public wannier_calc_create_mmn(band_index, mesh, st, latt, spin_channel, nnlist, nncell, overlap)
Kohn-Sham State Overlap Matrix.
Describes mesh distribution to nodes.
The states_elec_t class contains all electronic wave functions.
Mocks the projection type from wannier90.