Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possibility to print bvec. #176

Merged
merged 9 commits into from
Jun 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions doc/user_guide/files.tex
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,16 @@ \section{{\tt seedname\_r.dat}}
and $n$, and the real and imaginary parts of the position matrix element
in the WF basis.

\section{{\tt seedname.bvec}}
OUTPUT.
Written if $\verb#write_bvec#=\verb#true#$. This file contains
the matrix elements of bvector and their weights.
The first line gives the date and time at which the file was created.
The second line states the number of k-points and
the total number of neighbours for each k-point {\tt nntot}.
Then all the other lines contain the b-vector (x,y,z) coordinate and weigths
for each k-points and each of its neighbours.

\section{{\tt seedname\_wsvec.dat}}
OUTPUT.
Written if $\verb#write_hr#=\verb#true#$ or $\verb#write_rmn#=\verb#true#$ or $\verb#write_tb#=\verb#true#$. The first line gives the date and
Expand Down
9 changes: 9 additions & 0 deletions doc/user_guide/parameters.tex
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ \section{Keyword List}
\old{\sc hr\_plot} & L & \old{This parameter is not used anymore. Use {\sc write\_hr} instead.} \\
\new{\sc write\_hr} & L & \new{Write the Hamiltonian in the WF basis} \\
\new{\sc write\_rmn } & L & \new{Write the position operator in the WF basis} \\
\new{\sc write\_bvec } & L & \new{Write to file the matrix elements of the bvectors and their weights} \\
\new{\sc write\_tb } & L & \new{Write lattice vectors,
Hamiltonian, and position operator in WF basis} \\
{\sc hr\_cutoff} & P & Cut-off for the absolute value of the Hamiltonian \\
Expand Down Expand Up @@ -1394,6 +1395,14 @@ \section{Post-Processing}

The default value is {\tt false}.

\subsection[write\_bvec]{\tt logical :: write\_bvec}

If $\verb#write_bvec#=\verb#true#$, then the the matrix elements of
bvector and their weights will be written to a file {\tt seedname.bvec}.

The default value is {\tt false}.


\subsection[write\_tb]{\tt logical :: write\_tb}

If $\verb#write_tb#=\verb#true#$, then the lattice vectors, together
Expand Down
2 changes: 1 addition & 1 deletion src/hamiltonian.F90
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ subroutine hamiltonian_write_rmn()
!! Write out the matrix elements of r
!============================================!
use w90_parameters, only : m_matrix, wb, bk, num_wann, num_kpts, kpt_latt,&
nntot
nntot, write_bvec
use w90_constants, only : twopi, cmplx_i
use w90_io, only : io_error, io_file_unit, seedname,io_date

Expand Down
5 changes: 5 additions & 0 deletions src/parameters.F90
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ module w90_parameters
logical, public, save :: wannier_plot_spinor_phase
logical, public, save :: write_u_matrices
logical, public, save :: bands_plot
logical, public, save :: write_bvec
integer, public, save :: bands_num_points
character(len=20), public, save :: bands_plot_format
character(len=20), public, save :: bands_plot_mode
Expand Down Expand Up @@ -871,6 +872,9 @@ subroutine param_read ( )
bands_plot = .false.
call param_get_keyword('bands_plot',found,l_value=bands_plot)

write_bvec = .false.
call param_get_keyword('write_bvec',found,l_value=write_bvec)

bands_num_points = 100
call param_get_keyword('bands_num_points',found,i_value=bands_num_points)

Expand Down Expand Up @@ -5786,6 +5790,7 @@ subroutine param_dist
call comms_bcast(wannier_plot_spinor_mode,len(wannier_plot_spinor_mode))
call comms_bcast(write_u_matrices,1)
call comms_bcast(bands_plot,1)
call comms_bcast(write_bvec,1)
call comms_bcast(bands_num_points,1)
call comms_bcast(bands_plot_format,len(bands_plot_format))
call comms_bcast(bands_plot_mode,len(bands_plot_mode))
Expand Down
45 changes: 44 additions & 1 deletion src/plot.F90
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ subroutine plot_main( )
use w90_io, only : stdout,io_stopwatch
use w90_parameters, only : num_kpts,bands_plot,dos_plot, &
kpt_latt,fermi_surface_plot, &
wannier_plot,timing_level,&
wannier_plot,timing_level, write_bvec, &
write_hr,write_rmn,write_tb,write_u_matrices
use w90_hamiltonian, only : hamiltonian_get_hr,hamiltonian_write_hr, &
hamiltonian_setup,hamiltonian_write_rmn,&
Expand Down Expand Up @@ -88,6 +88,8 @@ subroutine plot_main( )
end if

if(wannier_plot) call plot_wannier

if(write_bvec) call plot_bvec

if(write_u_matrices) call plot_u_matrices

Expand Down Expand Up @@ -1616,5 +1618,46 @@ subroutine plot_u_matrices

end subroutine plot_u_matrices

!============================================!
subroutine plot_bvec()
!!
!! June 2018: RM and SP
!! Write to file the matrix elements of bvector and their weights
!! This is used by EPW to compute the velocity.
!! You need "write_bvec = .true." in your wannier input
!!
!============================================!
use w90_parameters, only : wb, bk, num_kpts, nntot
use w90_io, only : io_error, io_file_unit, seedname, io_date
!
implicit none
!
integer :: nkp, nn, file_unit
character (len=33) :: header
character (len=9) :: cdate, ctime
!
file_unit=io_file_unit()
open(file_unit,file=trim(seedname)//'.bvec',form='formatted',status='unknown',err=101)
call io_date(cdate,ctime)
header='written on '//cdate//' at '//ctime
!
open(file_unit,file=trim(seedname)//'.bvec',form='formatted',status='unknown',err=101)
write(file_unit,*) header ! Date and time
write(file_unit,*) num_kpts, nntot
do nkp = 1, num_kpts
do nn = 1, nntot
write (file_unit,'(4F12.6)') bk(:,nn,nkp), wb(nn)
enddo
enddo
close(file_unit)
!
return
!
101 call io_error('Error: hamiltonian_write_rmn: problem opening file '//trim(seedname)//'.bvec')

end subroutine plot_bvec



end module w90_plot

7 changes: 7 additions & 0 deletions test-suite/tests/jobconfig
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ program = WANNIER90_WOUT_OK
inputs_args = ('LaVO3.win', '')
output = LaVO3.wout

# Lead, 4 lowest states; Fermi surface, print bvec
[testw90_bvec]
program = WANNIER90_BVEC
inputs_args = ('lead.win', '')
output = lead.bvec


# Test of disentanglement in spheres in k-space
[testpostw90_si_geninterp/]
program = POSTW90_GENINTERPDAT_OK
Expand Down
Loading