40 use w90_library,
only: lib_common_type, &
60 inp_options, w90main, stdout, stderr, ierr)
61 type(namespace_t),
intent(in) :: namespace
62 type(ions_t),
intent(in) :: ions
63 type(kpoints_t),
intent(in) :: kpoints
64 type(states_elec_t),
intent(in) :: st
65 type(wannier_opts_t),
intent(in) :: inp_options
66 type(lib_common_type),
intent(inout) :: w90main
67 integer,
intent(inout) :: stdout, stderr, ierr
70 integer,
allocatable :: distk(:)
81 call w90_set_option(w90main,
'kpoints', -kpoints%reduced%red_point(1:3,:))
82 call w90_set_option(w90main,
'mp_grid', kpoints%nik_axis(1:3))
83 call w90_set_option(w90main,
'num_bands', inp_options%num_bands)
84 call w90_set_option(w90main,
'num_wann', inp_options%num_wann)
88 nk = product(kpoints%nik_axis(1:3))
89 safe_allocate(distk(1:nk))
90 if (st%d%kpt%parallel)
then
92 call w90_set_comm(w90main, st%d%kpt%mpi_grp%comm%MPI_VAL)
98 ik = st%d%get_kpoint_index(iq)
99 if (distk(ik) == -1)
then
100 distk(ik) = st%d%kpt%node(iq)
101 else if (distk(ik) /= st%d%kpt%node(iq))
then
102 message(1) =
'Error: Wannier90 k-point parallelization: same k-point' // &
103 'assigned to different nodes.'
109 call w90_set_comm(w90main, st%system_grp%comm%MPI_VAL)
113 call w90_set_option(w90main,
'distk', distk)
114 safe_deallocate_a(distk)
124 if (inp_options%dump_inputs)
then
125 call w90_set_option(w90main,
"dump_inputs", .
true.)
129 call w90_input_setopt(w90main, inp_options%prefix, stdout, stderr, ierr)
135 call w90_input_reader(w90main, stdout, stderr, ierr)
137 write(
message(1),
'(a,i0)')
'Error in w90_input_reader: ', ierr
151 type(lib_common_type),
intent(inout) :: w90main
152 type(ions_t),
intent(in) :: ions
154 integer :: ia, n_atoms
155 real(real64),
allocatable :: atom_pos_frac(:,:)
156 character(len=2),
allocatable :: atom_labels(:)
160 n_atoms = ions%natoms
163 safe_allocate(atom_pos_frac(1:3, 1:n_atoms))
164 safe_allocate(atom_labels(1:n_atoms))
170 atom_pos_frac(1:3, ia) = ions%latt%cart_to_red(ions%pos(1:3, ia))
172 atom_labels(ia) = trim(ions%atom(ia)%label)
176 call w90_set_option(w90main,
'atoms_frac', atom_pos_frac)
178 call w90_set_option(w90main,
'symbols', atom_labels)
180 safe_deallocate_a(atom_pos_frac)
181 safe_deallocate_a(atom_labels)
192 type(lib_common_type),
intent(inout) :: w90main
195 character(len=80) :: filename, line
196 integer :: w90_win, io
202 filename = trim(adjustl(inp_options%prefix)) //
'.win'
204 message(1) =
"oct-wannier90: Parsing projections from "//filename
207 inquire(file=filename,exist=exist)
208 if (.not. exist)
then
209 message(1) =
'oct-wannier90: Cannot find specified Wannier90 win file.'
214 w90_win =
io_open(trim(filename), action=
'read')
216 read(w90_win,
'(A)', iostat=io) line
217 if (is_iostat_end(io))
exit
219 if (trim(line) ==
'begin projections')
then
221 read(w90_win,
'(A)') line
222 if (trim(line) ==
'end projections')
exit
223 call w90_set_option(w90main,
'projections', trim(line))
240 character(len=80) :: filename, line, dummy, dummy1
241 integer :: w90_win, io
246 filename = trim(adjustl(inp_options%prefix)) //
'.win'
248 message(1) =
"oct-wannier90: Parsing "//filename
251 inquire(file=filename,exist=exist)
252 if (.not. exist)
then
253 message(1) =
'oct-wannier90: Cannot find specified Wannier90 win file.'
258 w90_win =
io_open(trim(filename), action=
'read')
260 read(w90_win,
'(A)', iostat=io) line
261 if (is_iostat_end(io))
exit
263 if (trim(line) ==
'begin kpoints')
then
264 message(1) =
'oct-wannier90: Warning: kpoints specified in .win file' // &
265 ' are ignored. Using kpoints from octopus input instead.'
267 else if (trim(line) ==
'begin atoms_frac')
then
268 message(1) =
'oct-wannier90: Warning: atomic positions specified in .win file' // &
269 ' are ignored. Using positions from octopus input instead.'
271 else if (trim(line) ==
'begin unit_cell_cart')
then
272 message(1) =
'oct-wannier90: Warning: unit cell vectors specified in .win file' // &
273 ' are ignored. Using unit cell vectors from octopus input instead.'
276 if (index(line,
'=') <= 0)
then
277 read(line, *, iostat=io) dummy, dummy1
278 if(dummy ==
'mp_grid')
then
279 message(1) =
'oct-wannier90: Warning: mp_grid specified in .win file' // &
280 ' is ignored. Using k-point mesh from octopus input instead.'
294 band_index, space, mesh, latt, st, kpoints, projection)
295 type(lib_common_type),
intent(in) :: w90main
297 class(
space_t),
intent(in) :: space
298 class(
mesh_t),
intent(in) :: mesh
302 logical,
intent(in) :: exclude_list(:)
303 integer,
intent(in) :: band_index(:)
305 complex(real64),
contiguous,
intent(out) :: projection(:, :, :)
318 safe_allocate(proj_input_oct(1:w90main%num_proj))
319 do iw = 1, w90main%num_proj
320 proj_input_oct(iw)%l = w90main%proj_input(iw)%l
321 proj_input_oct(iw)%m = w90main%proj_input(iw)%m
322 proj_input_oct(iw)%s = w90main%proj_input(iw)%s
323 proj_input_oct(iw)%radial = w90main%proj_input(iw)%radial
324 proj_input_oct(iw)%site = w90main%proj_input(iw)%site
325 proj_input_oct(iw)%s_qaxis = w90main%proj_input(iw)%s_qaxis
326 proj_input_oct(iw)%z = w90main%proj_input(iw)%z
327 proj_input_oct(iw)%x = w90main%proj_input(iw)%x
328 proj_input_oct(iw)%zona = w90main%proj_input(iw)%zona
332 band_index, space, mesh, latt, st, kpoints, &
333 w90main%wvfn_read%spin_channel, w90main%num_proj, &
334 proj_input_oct, projection)
336 safe_deallocate_a(proj_input_oct)
348 type(lib_common_type),
intent(in) :: w90main
349 logical,
intent(in) :: exclude_list(:)
350 integer,
intent(in) :: band_index(:)
351 class(
mesh_t),
intent(in) :: mesh
353 type(
ions_t),
intent(in) :: ions
355 complex(real64),
contiguous,
intent(out) :: overlap(:, :, :, :)
360 mesh, st, ions, w90main%wvfn_read%spin_channel, &
361 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.