Patch by Leopold Talirz fixing problem with empty &inputpp section

git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@13230 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
giannozz 2017-01-08 15:14:39 +00:00
parent 1695899967
commit 8c617be20a
3 changed files with 91 additions and 45 deletions

View File

@ -91,7 +91,7 @@ input_description -distribution {Quantum Espresso} -package PWscf -program pp.x
8 = electron localization function (ELF)
9 = charge density minus superposition of atomic densities
9 = charge density minus superposition of atomic densities
10 = integrated local density of states (ILDOS)
from @ref emin to @ref emax (emin, emax in eV)
@ -107,15 +107,15 @@ input_description -distribution {Quantum Espresso} -package PWscf -program pp.x
can be performed for PAW calculations only
requires a very dense real-space grid!
18 = The exchange and correlation magnetic field in
18 = The exchange and correlation magnetic field in
the noncollinear case
19 = Reduced density gradient
19 = Reduced density gradient
(J. Chem. Theory Comput. 7, 625 (2011))
Set the isosurface between 0.3 and 0.6 to plot the
non-covalent interactions (see also plot_num = 20)
20 = Product of the electron density (charge) and the second
20 = Product of the electron density (charge) and the second
eigenvalue of the electron-density Hessian matrix;
used to colorize the RDG plot (plot_num = 19)
@ -159,8 +159,8 @@ input_description -distribution {Quantum Espresso} -package PWscf -program pp.x
elsewhen -test "plot_num=3" {
label {
Options for LDOS (plot_num=3):
LDOS is plotted on grid [emin, emax] with spacing delta_e.
Options for LDOS (plot_num=3):
LDOS is plotted on grid [emin, emax] with spacing delta_e.
}
var emin -type REAL {
@ -186,7 +186,6 @@ input_description -distribution {Quantum Espresso} -package PWscf -program pp.x
status OPTIONAL
info {
spacing of energy grid (in eV).
i.e. compute ILDOS from @ref emin to @ref emax
}
}
@ -196,8 +195,8 @@ input_description -distribution {Quantum Espresso} -package PWscf -program pp.x
info {
broadening of energy levels for LDOS (in eV).
Defaults to broadening specified for electronic smearing
of the calculation.
Defaults to broadening degauss specified for electronic smearing
in pw.x calculation.
}
}
}
@ -220,20 +219,22 @@ input_description -distribution {Quantum Espresso} -package PWscf -program pp.x
Options for |psi|^2 (plot_num=7):
}
dimension kpoint -start 1 -end 2 -type INTEGER {
info {
Unpolarized and noncollinear case: k-point to be plotted
LSDA: k-point and spin polarization to be plotted
(spin-up and spin-down correspond to different k-points!)
When both kpoint(1) and kpoint(2) are specified, all
kpoints in the range [kpoint(1),kpoint(2)] are plotted.
}
dimension kpoint -start 1 -end 2 -type INTEGER {
info {
Unpolarized and noncollinear case:
k-point to be plotted
LSDA:
k-point and spin polarization to be plotted
(spin-up and spin-down correspond to different k-points!)
When both kpoint(1) and kpoint(2) are specified, all
kpoints in the range [kpoint(1),kpoint(2)] are plotted.
}
}
dimension kband -start 1 -end 2 -type INTEGER {
info {
band to be plotted .
band to be plotted.
When both kband(1) and kband(2) are specified, all
bands in the range [kband(1),kband(2)] are plotted.
}
@ -246,23 +247,23 @@ input_description -distribution {Quantum Espresso} -package PWscf -program pp.x
}
dimension spin_component -start 1 -end 2 -type INTEGER {
default 0
status OPTIONAL
info {
default 0
status OPTIONAL
info {
Noncollinear case only:
plot the contribution of the given state to the charge
or to the magnetization along the direction indicated
by spin_component:
0 = charge (default),
1 = x,
2 = y,
3 = z.
0 = charge (default),
1 = x,
2 = y,
3 = z.
Ignored in unpolarized or LSDA case
When both spin_component(1) and spin_component(2) are specified, all
components in the range [spin_component(1),spin_component(2)] are
plotted.
When both spin_component(1) and spin_component(2) are specified,
all components in the range [spin_component(1),spin_component(2)]
are plotted.
}
}
}
@ -345,7 +346,7 @@ input_description -distribution {Quantum Espresso} -package PWscf -program pp.x
default 1
status OPTIONAL
info {
the number of data files
the number of data files to read
}
}

View File

@ -16,6 +16,12 @@ SUBROUTINE chdens (plot_files,plot_num)
! into a file format suitable for plotting
!-----------------------------------------------------------------------
!
! If plot_files (the list of intermediate quantities) isn't empty, one
! output file is written per entry.
!
! If plot_files is empty, files are read from the filepp input variable
! and one output file is written.
!
! DESCRIPTION of the INPUT: see file INPUT_PP in Doc/
!
USE kinds, ONLY : dp
@ -43,7 +49,6 @@ SUBROUTINE chdens (plot_files,plot_num)
USE wavefunctions_module, ONLY: psic
IMPLICIT NONE
!CHARACTER (len=256), INTENT(in) :: filplot
CHARACTER (len=256), DIMENSION(:), ALLOCATABLE, INTENT(in) :: plot_files
!
! If plot_num=-1 the dimensions and structural data are read from the charge
@ -63,7 +68,9 @@ SUBROUTINE chdens (plot_files,plot_num)
real(DP), ALLOCATABLE :: aux(:)
CHARACTER (len=256) :: fileout, fileout_tmp
CHARACTER (len=256) :: fileout
CHARACTER (len=256), ALLOCATABLE :: output_files(:)
LOGICAL :: luse_filepp
CHARACTER (len=13), DIMENSION(0:7) :: formatname = &
(/ 'gnuplot ', &
'contour.x ', &
@ -93,6 +100,7 @@ SUBROUTINE chdens (plot_files,plot_num)
! rho or polarization in G space
LOGICAL :: fast3d, isostm_flag
NAMELIST /plot/ &
nfile, filepp, weight, iflag, e1, e2, e3, nx, ny, nz, x0, &
radius, output_format, fileout, interpolation, &
@ -102,7 +110,7 @@ SUBROUTINE chdens (plot_files,plot_num)
! set the DEFAULT values
!
nfile = 1
filepp(1) = plot_files(1)
filepp(1) = ' '
weight(1) = 1.0d0
iflag = 0
radius = 1.0d0
@ -167,6 +175,8 @@ SUBROUTINE chdens (plot_files,plot_num)
CALL infomsg ('chdens', 'output format not set, exiting' )
RETURN
ENDIF
!
! check for number of files
!
@ -175,9 +185,40 @@ SUBROUTINE chdens (plot_files,plot_num)
IF (nfile > 1 .AND. SIZE(plot_files) > 1) THEN
CALL errore ('chdens ', &
"can't mix nfile > 1 with specifying multiple plots", 1)
"can't mix nfile > 1 with multiple output files", 1)
ENDIF
!
! prepare input and output files to read
!
IF (SIZE(plot_files) == 0) THEN
! if no intermediate quantities have been produced by pp.x,
! we use filepp
luse_filepp = .TRUE.
ALLOCATE(output_files(1))
output_files(1) = fileout
ELSEIF (SIZE(plot_Files) == 1) THEN
! if one intermediate quantity was produced by pp.x,
! we use it as input
filepp(1) = plot_files(1)
luse_filepp = .TRUE.
ALLOCATE(output_files(1))
output_files(1) = fileout
ELSE
! if several intermediate quantities were produced by pp.x,
! we use them as input and adapt the output filenames accordingly
luse_filepp = .FALSE.
ALLOCATE(output_files(SIZE(plot_files)))
DO iplot=1,SIZE(plot_files)
WRITE(output_files(iplot),"(A,A)") TRIM(plot_files(iplot)), TRIM(fileout)
ENDDO
ENDIF
! check for iflag
IF (iflag <= 1) THEN
@ -289,14 +330,12 @@ SUBROUTINE chdens (plot_files,plot_num)
CALL fft_type_allocate ( dffts, at, bg, gcutms, intra_bgrp_comm)
ENDIF
fileout_tmp = fileout
! Plotting all files in plot_files
DO iplot=1, SIZE(plot_files)
IF (SIZE(plot_files) > 1) THEN
filepp(1) = plot_files(iplot)
WRITE(fileout,"(A,A)") TRIM(plot_files(iplot)), TRIM(fileout_tmp)
ENDIF
! Looping over output files to be written
DO iplot=1, SIZE(output_files)
fileout = output_files(iplot)
IF (.NOT. luse_filepp) filepp(1) = plot_files(iplot)
ALLOCATE (rhor(dfftp%nr1x*dfftp%nr2x*dfftp%nr3x))
ALLOCATE (rhos(dfftp%nr1x*dfftp%nr2x*dfftp%nr3x))
@ -567,6 +606,7 @@ SUBROUTINE chdens (plot_files,plot_num)
DEALLOCATE(tau)
DEALLOCATE(ityp)
IF (ALLOCATED(output_files)) DEALLOCATE(output_files)
END SUBROUTINE chdens
!

View File

@ -13,9 +13,11 @@ CONTAINS
SUBROUTINE extract (plot_files,plot_num)
!-----------------------------------------------------------------------
!
! This subroutine reads the data for the output file produced by pw.x
! extracts and calculates the desired quantity (rho, V, ...)
! writes it to a file for further processing or plotting
! Reads data produced by pw.x, computes the desired quantity (rho, V, ...)
! and writes it to a file (or multiple files) for further processing or
! plotting
!
! On return, plot_files contains a list of all written files.
!
! DESCRIPTION of the INPUT: see file Doc/INPUT_PP
!
@ -123,7 +125,10 @@ SUBROUTINE extract (plot_files,plot_num)
!
! no task specified: do nothing and return
!
IF (plot_num == -1) RETURN
IF (plot_num == -1) THEN
ALLOCATE( plot_files(0) )
RETURN
ENDIF
!
IF (plot_num < 0 .or. plot_num > 21) CALL errore ('postproc', &
'Wrong plot_num', abs (plot_num) )