Write to file the lattice vectors of the superlattice to be added to R vector in seedname_hr.dat, seedname_rmn.dat, etc. in order to have the second Wannier function inside the WS cell of the first one.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(ws_distance_type), | intent(in) | :: | ws_distance | |||
| integer, | intent(in) | :: | nrpts | |||
| integer, | intent(in) | :: | irvec(3,nrpts) | |||
| integer, | intent(in) | :: | num_wann | |||
| logical, | intent(in) | :: | use_ws_distance | |||
| character(len=50), | intent(in) | :: | seedname | |||
| type(w90_error_type), | intent(out), | allocatable | :: | error | ||
| type(w90_comm_type), | intent(in) | :: | comm |
subroutine ws_write_vec(ws_distance, nrpts, irvec, num_wann, use_ws_distance, seedname, error, & comm) !================================================! !! Write to file the lattice vectors of the superlattice !! to be added to R vector in seedname_hr.dat, seedname_rmn.dat, etc. !! in order to have the second Wannier function inside the WS cell !! of the first one. !================================================! use w90_io, only: io_date use w90_types, only: ws_distance_type implicit none type(ws_distance_type), intent(in) :: ws_distance type(w90_error_type), allocatable, intent(out) :: error integer, intent(in) :: num_wann logical, intent(in) :: use_ws_distance character(len=50), intent(in) :: seedname type(w90_comm_type), intent(in) :: comm integer, intent(in) :: nrpts integer, intent(in) :: irvec(3, nrpts) integer:: irpt, iw, jw, ideg, file_unit, ierr character(len=100) :: header character(len=9) :: cdate, ctime call io_date(cdate, ctime) open (newunit=file_unit, file=trim(seedname)//'_wsvec.dat', form='formatted', & status='unknown', iostat=ierr) if (ierr /= 0) then call set_error_file(error, 'Error: ws_write_vec: problem opening file '//trim(seedname)//'_ws_vec.dat', comm) return end if if (use_ws_distance) then header = '## written on '//cdate//' at '//ctime//' with use_ws_distance=.true.' write (file_unit, '(A)') trim(header) do irpt = 1, nrpts do iw = 1, num_wann do jw = 1, num_wann write (file_unit, '(5I5)') irvec(:, irpt), iw, jw write (file_unit, '(I5)') ws_distance%ndeg(iw, jw, irpt) do ideg = 1, ws_distance%ndeg(iw, jw, irpt) write (file_unit, '(5I5,2F12.6,I5)') ws_distance%irdist(:, ideg, iw, jw, irpt) - & irvec(:, irpt) end do end do end do end do else header = '## written on '//cdate//' at '//ctime//' with use_ws_distance=.false.' write (file_unit, '(A)') trim(header) do irpt = 1, nrpts do iw = 1, num_wann do jw = 1, num_wann write (file_unit, '(5I5)') irvec(:, irpt), & iw, jw write (file_unit, '(I5)') 1 write (file_unit, '(3I5)') 0, 0, 0 end do end do end do end if close (file_unit) !================================================! end subroutine ws_write_vec