43 use w90_library,
only: lib_common_type, &
63 inp_options, w90main, stdout, stderr, ierr)
64 type(namespace_t),
intent(in) :: namespace
65 type(ions_t),
intent(in) :: ions
66 type(kpoints_t),
intent(in) :: kpoints
67 type(states_elec_t),
intent(in) :: st
68 type(wannier_opts_t),
intent(in) :: inp_options
69 type(lib_common_type),
intent(inout) :: w90main
70 integer,
intent(inout) :: stdout, stderr, ierr
73 integer,
allocatable :: distk(:)
84 call w90_set_option(w90main,
'kpoints', -kpoints%reduced%red_point(1:3,:))
85 call w90_set_option(w90main,
'mp_grid', kpoints%nik_axis(1:3))
86 call w90_set_option(w90main,
'num_bands', inp_options%num_bands)
87 call w90_set_option(w90main,
'num_wann', inp_options%num_wann)
91 nk = product(kpoints%nik_axis(1:3))
92 safe_allocate(distk(1:nk))
93 if (st%d%kpt%parallel)
then
95 call w90_set_comm(w90main, st%d%kpt%mpi_grp%comm%MPI_VAL)
101 ik = st%d%get_kpoint_index(iq)
102 if (distk(ik) == -1)
then
103 distk(ik) = st%d%kpt%node(iq)
104 else if (distk(ik) /= st%d%kpt%node(iq))
then
105 message(1) =
'Error: Wannier90 k-point parallelization: same k-point' // &
106 'assigned to different nodes.'
112 call w90_set_comm(w90main, st%system_grp%comm%MPI_VAL)
116 call w90_set_option(w90main,
'distk', distk)
117 safe_deallocate_a(distk)
127 if (inp_options%dump_inputs)
then
128 call w90_set_option(w90main,
"dump_inputs", .
true.)
132 call w90_input_setopt(w90main, inp_options%prefix, stdout, stderr, ierr)
138 call w90_input_reader(w90main, stdout, stderr, ierr)
140 write(
message(1),
'(a,i0)')
'Error in w90_input_reader: ', ierr
154 type(lib_common_type),
intent(inout) :: w90main
155 type(ions_t),
intent(in) :: ions
157 integer :: ia, n_atoms
158 real(real64),
allocatable :: atom_pos_frac(:,:)
159 character(len=2),
allocatable :: atom_labels(:)
163 n_atoms = ions%natoms
166 safe_allocate(atom_pos_frac(1:3, 1:n_atoms))
167 safe_allocate(atom_labels(1:n_atoms))
173 atom_pos_frac(1:3, ia) = ions%latt%cart_to_red(ions%pos(1:3, ia))
175 atom_labels(ia) = trim(ions%atom(ia)%label)
179 call w90_set_option(w90main,
'atoms_frac', atom_pos_frac)
181 call w90_set_option(w90main,
'symbols', atom_labels)
183 safe_deallocate_a(atom_pos_frac)
184 safe_deallocate_a(atom_labels)
195 type(lib_common_type),
intent(inout) :: w90main
198 character(len=80) :: filename, line
199 integer :: w90_win, io
205 filename = trim(adjustl(inp_options%prefix)) //
'.win'
207 message(1) =
"oct-wannier90: Parsing projections from "//filename
210 inquire(file=filename,exist=exist)
211 if (.not. exist)
then
212 message(1) =
'oct-wannier90: Cannot find specified Wannier90 win file.'
217 w90_win =
io_open(trim(filename), action=
'read')
219 read(w90_win,
'(A)', iostat=io) line
220 if (is_iostat_end(io))
exit
222 if (trim(line) ==
'begin projections')
then
224 read(w90_win,
'(A)') line
225 if (trim(line) ==
'end projections')
exit
226 call w90_set_option(w90main,
'projections', trim(line))
243 character(len=80) :: filename, line, dummy, dummy1
244 integer :: w90_win, io
249 filename = trim(adjustl(inp_options%prefix)) //
'.win'
251 message(1) =
"oct-wannier90: Parsing "//filename
254 inquire(file=filename,exist=exist)
255 if (.not. exist)
then
256 message(1) =
'oct-wannier90: Cannot find specified Wannier90 win file.'
261 w90_win =
io_open(trim(filename), action=
'read')
263 read(w90_win,
'(A)', iostat=io) line
264 if (is_iostat_end(io))
exit
266 if (trim(line) ==
'begin kpoints')
then
267 message(1) =
'oct-wannier90: Warning: kpoints specified in .win file' // &
268 ' are ignored. Using kpoints from octopus input instead.'
270 else if (trim(line) ==
'begin atoms_frac')
then
271 message(1) =
'oct-wannier90: Warning: atomic positions specified in .win file' // &
272 ' are ignored. Using positions from octopus input instead.'
274 else if (trim(line) ==
'begin unit_cell_cart')
then
275 message(1) =
'oct-wannier90: Warning: unit cell vectors specified in .win file' // &
276 ' are ignored. Using unit cell vectors from octopus input instead.'
279 if (index(line,
'=') <= 0)
then
280 read(line, *, iostat=io) dummy, dummy1
281 if(dummy ==
'mp_grid')
then
282 message(1) =
'oct-wannier90: Warning: mp_grid specified in .win file' // &
283 ' is ignored. Using k-point mesh from octopus input instead.'
297 band_index, space, mesh, latt, st, kpoints, projection)
298 type(lib_common_type),
intent(in) :: w90main
300 class(
space_t),
intent(in) :: space
301 class(
mesh_t),
intent(in) :: mesh
305 logical,
intent(in) :: exclude_list(:)
306 integer,
intent(in) :: band_index(:)
308 complex(real64),
contiguous,
intent(out) :: projection(:, :, :)
321 safe_allocate(proj_input_oct(1:w90main%num_proj))
322 do iw = 1, w90main%num_proj
323 proj_input_oct(iw)%l = w90main%proj_input(iw)%l
324 proj_input_oct(iw)%m = w90main%proj_input(iw)%m
325 proj_input_oct(iw)%s = w90main%proj_input(iw)%s
326 proj_input_oct(iw)%radial = w90main%proj_input(iw)%radial
327 proj_input_oct(iw)%site = w90main%proj_input(iw)%site
328 proj_input_oct(iw)%s_qaxis = w90main%proj_input(iw)%s_qaxis
329 proj_input_oct(iw)%z = w90main%proj_input(iw)%z
330 proj_input_oct(iw)%x = w90main%proj_input(iw)%x
331 proj_input_oct(iw)%zona = w90main%proj_input(iw)%zona
335 band_index, space, mesh, latt, st, kpoints, &
336 w90main%wvfn_read%spin_channel, w90main%num_proj, &
337 proj_input_oct, projection)
339 safe_deallocate_a(proj_input_oct)
351 type(lib_common_type),
intent(in) :: w90main
352 logical,
intent(in) :: exclude_list(:)
353 integer,
intent(in) :: band_index(:)
354 class(
mesh_t),
intent(in) :: mesh
356 type(
ions_t),
intent(in) :: ions
358 complex(real64),
contiguous,
intent(out) :: overlap(:, :, :, :)
363 mesh, st, ions, w90main%wvfn_read%spin_channel, &
364 w90main%kmesh_info%nnlist, w90main%kmesh_info%nncell, &
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.
Interface module to Wannier 90 library.
subroutine, public wannier90lib_create_wannier90_amn(w90main, inp_options, exclude_list, band_index, space, mesh, latt, st, kpoints, projection)
Calculate wannier90 Projection Matrix.
subroutine wannier90lib_set_atom_data(w90main, ions)
Set atom data in wannier90 library.
subroutine, public wannier90lib_create_wannier90_mmn(w90main, exclude_list, band_index, mesh, st, ions, overlap)
Kohn-Sham State Overlap Matrix.
subroutine, public wannier90lib_init_w90main(namespace, ions, kpoints, st, inp_options, w90main, stdout, stderr, ierr)
Initialize wannier90 library data.
subroutine wannier90lib_set_projections(w90main, inp_options)
Parse projections.
subroutine wannier90lib_warn_inputs(inp_options)
Check for options in .win file.
Wannier90 related calculations.
subroutine, public wannier_calc_create_amn(wan_opts, exclude_list, 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(exclude_list, band_index, mesh, st, ions, 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.
batches of electronic states