From b9e7f2a6c5876036c7515e44f7cda5a7c01cab7e Mon Sep 17 00:00:00 2001
From: Paolo Giannozzi
Date: Sun, 21 Apr 2019 21:03:32 +0200
Subject: [PATCH] Removal of unused variables and options, make.depend updated
Release-notes updated with recent PPACF fixes by Yang Jiao (Chalmers)
---
Doc/release-notes | 2 +
EPW/src/make.depend | 7 +++
PP/src/make.depend | 1 +
PP/src/sum_band_kin.f90 | 2 +-
PP/src/sym_band.f90 | 1 -
PP/src/vasp_xml_module.f90 | 1 -
PW/src/make.depend | 2 -
PW/src/newd.f90 | 1 -
PW/src/paw_onecenter.f90 | 1 -
PW/src/pw_restart_new.f90 | 9 +--
PW/src/read_file_new.f90 | 118 +++++++++++++++++--------------------
PW/src/scf_mod.f90 | 1 -
PW/src/us_exx.f90 | 2 -
PW/src/v_of_rho.f90 | 1 -
PW/tools/make.depend | 1 +
15 files changed, 70 insertions(+), 80 deletions(-)
diff --git a/Doc/release-notes b/Doc/release-notes
index 1ad2a1dfb..45f64f6f1 100644
--- a/Doc/release-notes
+++ b/Doc/release-notes
@@ -1,4 +1,6 @@
Problems fixed in development branch :
+ * PPACF wasn't working any longer in v.6.4 and 6.4.1 for nspin=2 and
+ for hybrid functionals (fixed by Yang Jiao, Chalmers)
* option "write_unkg" of pw2wannier90.f90 wasn't working as expected
Incompatible changes in development branch :
diff --git a/EPW/src/make.depend b/EPW/src/make.depend
index e993ab393..08e536c2e 100644
--- a/EPW/src/make.depend
+++ b/EPW/src/make.depend
@@ -17,6 +17,7 @@ adddvscf2.o : ../../Modules/uspp.o
adddvscf2.o : ../../PW/src/pwcom.o
adddvscf2.o : constants_epw.o
adddvscf2.o : elph2.o
+adddvscf2.o : epwcom.o
allocate_epwq.o : ../../LR_Modules/lrcom.o
allocate_epwq.o : ../../Modules/becmod.o
allocate_epwq.o : ../../Modules/fft_base.o
@@ -124,6 +125,7 @@ dvqpsi_us3.o : ../../PW/src/pwcom.o
dvqpsi_us3.o : ../../PW/src/scf_mod.o
dvqpsi_us3.o : constants_epw.o
dvqpsi_us3.o : elph2.o
+dvqpsi_us3.o : epwcom.o
dvqpsi_us_only3.o : ../../LR_Modules/lrcom.o
dvqpsi_us_only3.o : ../../Modules/cell_base.o
dvqpsi_us_only3.o : ../../Modules/ions_base.o
@@ -135,6 +137,7 @@ dvqpsi_us_only3.o : ../../PHonon/PH/phcom.o
dvqpsi_us_only3.o : ../../PW/src/pwcom.o
dvqpsi_us_only3.o : constants_epw.o
dvqpsi_us_only3.o : elph2.o
+dvqpsi_us_only3.o : epwcom.o
eliashberg.o : ../../Modules/io_global.o
eliashberg.o : eliashbergcom.o
eliashberg.o : epwcom.o
@@ -164,6 +167,7 @@ elphel2_shuffle.o : ../../UtilXlib/mp.o
elphel2_shuffle.o : constants_epw.o
elphel2_shuffle.o : division.o
elphel2_shuffle.o : elph2.o
+elphel2_shuffle.o : epwcom.o
elphon_shuffle.o : ../../FFTXlib/fft_interfaces.o
elphon_shuffle.o : ../../LR_Modules/lrcom.o
elphon_shuffle.o : ../../Modules/fft_base.o
@@ -288,7 +292,9 @@ epw_init.o : ../../PW/src/pwcom.o
epw_init.o : ../../UtilXlib/mp.o
epw_init.o : constants_epw.o
epw_init.o : elph2.o
+epw_init.o : epwcom.o
epw_readin.o : ../../LR_Modules/lrcom.o
+epw_readin.o : ../../Modules/cell_base.o
epw_readin.o : ../../Modules/constants.o
epw_readin.o : ../../Modules/control_flags.o
epw_readin.o : ../../Modules/io_files.o
@@ -659,6 +665,7 @@ setphases.o : ../../PHonon/PH/phcom.o
setphases.o : ../../PW/src/pwcom.o
setphases.o : ../../UtilXlib/mp.o
setphases.o : constants_epw.o
+setphases.o : epwcom.o
setphases_wrap.o : ../../Modules/io_global.o
setphases_wrap.o : ../../Modules/kind.o
setphases_wrap.o : ../../Modules/mp_global.o
diff --git a/PP/src/make.depend b/PP/src/make.depend
index 93a0586e8..02517c178 100644
--- a/PP/src/make.depend
+++ b/PP/src/make.depend
@@ -481,6 +481,7 @@ ppacf.o : ../../PW/src/exx.o
ppacf.o : ../../PW/src/exx_base.o
ppacf.o : ../../PW/src/pwcom.o
ppacf.o : ../../PW/src/scf_mod.o
+ppacf.o : ../../PW/src/symm_base.o
ppacf.o : ../../UtilXlib/mp.o
ppacf.o : vasp_xml_module.o
ppacf.o : xc_vdW_scale_mod.o
diff --git a/PP/src/sum_band_kin.f90 b/PP/src/sum_band_kin.f90
index 293fc8d48..a8720c6ed 100644
--- a/PP/src/sum_band_kin.f90
+++ b/PP/src/sum_band_kin.f90
@@ -29,7 +29,7 @@ SUBROUTINE sum_band_kin(kin_r)
USE uspp_param, ONLY : upf, nh, nhm
USE wavefunctions, ONLY : evc, psic, psic_nc
USE noncollin_module, ONLY : noncolin, npol, nspin_mag
- USE spin_orb, ONLY : lspinorb, domag, fcoef
+ USE spin_orb, ONLY : lspinorb, fcoef
USE wvfct, ONLY : nbnd, npwx, wg, et
USE mp_pools, ONLY : inter_pool_comm
USE mp_bands, ONLY : inter_bgrp_comm, intra_bgrp_comm, nbgrp
diff --git a/PP/src/sym_band.f90 b/PP/src/sym_band.f90
index aea8e2c95..4ecf7f6cd 100644
--- a/PP/src/sym_band.f90
+++ b/PP/src/sym_band.f90
@@ -694,7 +694,6 @@ SUBROUTINE find_band_sym_so (ik,evc,et,nsym,s,ft,d_spin,gk, &
USE gvect, ONLY : ngm
USE wvfct, ONLY : nbnd, npwx
USE klist, ONLY : ngk
- USE spin_orb, ONLY : domag
USE uspp, ONLY : vkb, nkb, okvan
USE noncollin_module, ONLY : npol
USE becmod, ONLY : bec_type, becp, calbec, allocate_bec_type, deallocate_bec_type
diff --git a/PP/src/vasp_xml_module.f90 b/PP/src/vasp_xml_module.f90
index e71929aee..59e01a5fc 100644
--- a/PP/src/vasp_xml_module.f90
+++ b/PP/src/vasp_xml_module.f90
@@ -113,7 +113,6 @@ SUBROUTINE readxmlfile_vasp(iexch,icorr,igcx,igcc,inlc,ierr)
eigts1, eigts2, eigts3, gstart, gshells
USE fft_base, ONLY : dfftp, dffts
USE gvecs, ONLY : ngms, gcutms
- USE spin_orb, ONLY : lspinorb, domag
USE scf, ONLY : rho, rho_core, rhog_core, v
USE wavefunctions, ONLY : psic
USE vlocal, ONLY : strf
diff --git a/PW/src/make.depend b/PW/src/make.depend
index c554b67e9..ebef96a6d 100644
--- a/PW/src/make.depend
+++ b/PW/src/make.depend
@@ -792,7 +792,6 @@ h_epsi_her_set.o : buffers.o
h_epsi_her_set.o : ldaU.o
h_epsi_her_set.o : pwcom.o
h_epsi_her_set.o : scf_mod.o
-h_psi.o : ../../FFTXlib/fft_helper_subroutines.o
h_psi.o : ../../Modules/becmod.o
h_psi.o : ../../Modules/control_flags.o
h_psi.o : ../../Modules/fft_base.o
@@ -1562,7 +1561,6 @@ pw_restart_new.o : esm.o
pw_restart_new.o : extfield.o
pw_restart_new.o : exx.o
pw_restart_new.o : exx_base.o
-pw_restart_new.o : io_rho_xml.o
pw_restart_new.o : ldaU.o
pw_restart_new.o : martyna_tuckerman.o
pw_restart_new.o : pwcom.o
diff --git a/PW/src/newd.f90 b/PW/src/newd.f90
index cd1ec5f36..629a5fbea 100644
--- a/PW/src/newd.f90
+++ b/PW/src/newd.f90
@@ -28,7 +28,6 @@ SUBROUTINE newq(vr,deeq,skip_vltot)
USE uspp_param, ONLY : upf, lmaxq, nh, nhm
USE control_flags, ONLY : gamma_only
USE wavefunctions, ONLY : psic
- USE spin_orb, ONLY : lspinorb, domag
USE noncollin_module, ONLY : nspin_mag
USE mp_bands, ONLY : intra_bgrp_comm
USE mp_pools, ONLY : inter_pool_comm
diff --git a/PW/src/paw_onecenter.f90 b/PW/src/paw_onecenter.f90
index 4f03dcac2..f80b0f4fa 100644
--- a/PW/src/paw_onecenter.f90
+++ b/PW/src/paw_onecenter.f90
@@ -1549,7 +1549,6 @@ SUBROUTINE PAW_dxc_potential(i, drho_lm, rho_lm, rho_core, v_lm)
! potential in the spherical basis. It receives as input the charge
! density and its variation.
!
- USE spin_orb, ONLY : domag
USE noncollin_module, ONLY : nspin_mag
USE lsda_mod, ONLY : nspin
USE atom, ONLY : g => rgrid
diff --git a/PW/src/pw_restart_new.f90 b/PW/src/pw_restart_new.f90
index f35691ff0..d8c37f67f 100644
--- a/PW/src/pw_restart_new.f90
+++ b/PW/src/pw_restart_new.f90
@@ -1019,7 +1019,7 @@ MODULE pw_restart_new
!
CHARACTER(LEN=256) :: dirname
LOGICAL :: lcell, lpw, lions, lspin, linit_mag, &
- lxc, locc, lbz, lbs, lheader, &
+ lxc, locc, lbz, lbs, &
lsymm, lefield, ldim, lvalid_input, &
lef, lexx, lesm, lpbc, lalgo
!
@@ -1053,7 +1053,6 @@ MODULE pw_restart_new
lef = .FALSE.
lexx = .FALSE.
lesm = .FALSE.
- lheader = .FALSE.
lpbc = .FALSE.
lalgo = .FALSE.
!
@@ -1097,10 +1096,6 @@ MODULE pw_restart_new
!
END SELECT
!
- !
- IF ( lheader ) THEN
- CALL readschema_header( gen_info )
- END IF
IF ( ldim ) THEN
!
CALL readschema_dim(par_info, output_obj%atomic_species, &
@@ -1220,6 +1215,8 @@ MODULE pw_restart_new
TYPE ( band_structure_type ),INTENT(IN) :: band_structure
!
INTEGER :: npwx_
+ !
+ !
CALL readschema_cell ( atomic_structure )
!
!---------------------------------------------------------------------
diff --git a/PW/src/read_file_new.f90 b/PW/src/read_file_new.f90
index f7819bf9a..dc644debe 100644
--- a/PW/src/read_file_new.f90
+++ b/PW/src/read_file_new.f90
@@ -105,7 +105,8 @@ SUBROUTINE read_xml_file ( wfc_is_collected )
set_h_ainv
USE force_mod, ONLY : force
USE klist, ONLY : nkstot, nks, xk, wk
- USE lsda_mod, ONLY : lsda, nspin, current_spin, isk
+ USE lsda_mod, ONLY : nspin, isk
+ USE noncollin_module, ONLY : noncolin
USE wvfct, ONLY : nbnd, nbndx, et, wg
USE symm_base, ONLY : irt, d1, d2, d3, checkallsym, nsym
USE extfield, ONLY : forcefield, tefield, gate, forcegate
@@ -118,11 +119,10 @@ SUBROUTINE read_xml_file ( wfc_is_collected )
eigts1, eigts2, eigts3, gstart, gshells
USE fft_base, ONLY : dfftp, dffts
USE gvecs, ONLY : ngms, gcutms
- USE spin_orb, ONLY : lspinorb, domag
+ USE spin_orb, ONLY : lspinorb
USE scf, ONLY : rho, rho_core, rhog_core, v
USE vlocal, ONLY : strf
USE io_files, ONLY : tmp_dir, prefix, iunpun, nwordwfc, iunwfc
- USE noncollin_module, ONLY : noncolin, npol, nspin_lsda, nspin_mag, nspin_gga
USE pw_restart_new, ONLY : pw_readschema_file, init_vars_from_schema
USE qes_types_module, ONLY : output_type, parallel_info_type, &
general_info_type, input_type
@@ -178,54 +178,32 @@ SUBROUTINE read_xml_file ( wfc_is_collected )
!
! ... here we read the variables that dimension the system
!
- CALL init_vars_from_schema( 'dim', ierr , output_obj, parinfo_obj, geninfo_obj )
+ CALL init_vars_from_schema( 'dim', ierr, output_obj, parinfo_obj, geninfo_obj )
CALL errore( 'read_xml_file ', 'problem reading file ' // &
& TRIM( tmp_dir ) // TRIM( prefix ) // '.save', ierr )
!
- ! ... allocate space for atomic positions, symmetries, forces
+ ! ... allocate space for arrays to be read in init_vars_from_schema
+ !
+ ! ... atomic positions, forces, symmetries
!
IF ( nat < 0 ) CALL errore( 'read_xml_file', 'wrong number of atoms', 1 )
- !
- ! ... allocation
- !
ALLOCATE( ityp( nat ) )
- ALLOCATE( tau( 3, nat ) )
- ALLOCATE( force( 3, nat ) )
- ALLOCATE( extfor( 3, nat ) )
- !
+ ALLOCATE( tau( 3, nat ) )
+ ALLOCATE( force ( 3, nat ) )
+ ALLOCATE( extfor( 3, nat ) )
IF ( tefield ) ALLOCATE( forcefield( 3, nat ) )
- IF ( gate ) ALLOCATE( forcegate( 3, nat ) ) ! TB
- !
+ IF ( gate ) ALLOCATE( forcegate( 3, nat ) )
ALLOCATE( irt( 48, nat ) )
!
- CALL set_dimensions()
+ ! ... FFT-related arrays (FIXME: is this needed here?)
+ !
+ CALL set_gcut()
CALL fft_type_allocate ( dfftp, at, bg, gcutm, intra_bgrp_comm, nyfft=nyfft )
CALL fft_type_allocate ( dffts, at, bg, gcutms, intra_bgrp_comm, nyfft=nyfft )
!
- ! ... check whether LSDA
+ if (cell_factor == 0.d0) cell_factor = 1.D0 ! FIXME: is this needed here?
!
- IF ( lsda ) THEN
- !
- nspin = 2
- npol = 1
- !
- ELSE IF ( noncolin ) THEN
- !
- nspin = 4
- npol = 2
- current_spin = 1
- !
- ELSE
- !
- nspin = 1
- npol = 1
- current_spin = 1
- !
- END IF
- !
- if (cell_factor == 0.d0) cell_factor = 1.D0
- !
- ! ... allocate memory for eigenvalues and weights (read from file)
+ ! ... eigenvalues, weights
!
nbndx = nbnd
ALLOCATE( et( nbnd, nkstot ) , wg( nbnd, nkstot ) )
@@ -247,7 +225,6 @@ SUBROUTINE read_xml_file ( wfc_is_collected )
! ... of k-points in the current pool
!
CALL divide_et_impera( nkstot, xk, wk, isk, nks )
- !
CALL poolscatter( nbnd, nkstot, et, nks, et )
CALL poolscatter( nbnd, nkstot, wg, nks, wg )
!
@@ -255,24 +232,13 @@ SUBROUTINE read_xml_file ( wfc_is_collected )
!
IF (nat > 0) CALL checkallsym( nat, tau, ityp)
!
- ! Set the different spin indices
+ ! ... set various spin-related variables
!
- nspin_mag = nspin
- nspin_lsda = nspin
- nspin_gga = nspin
- IF (nspin==4) THEN
- nspin_lsda=1
- IF (domag) THEN
- nspin_gga=2
- ELSE
- nspin_gga=1
- nspin_mag=1
- ENDIF
- ENDIF
+ CALL set_spin_vars ( )
!
- ! ... read pseudopotentials
+ ! ... read pseudopotentials (does not set dft from PP files)
!
- dft_name = get_dft_name () ! already set, should not be set again
+ dft_name = get_dft_name ()
CALL readpp ( dft_name )
!
! ... read the vdw kernel table if needed
@@ -314,7 +280,7 @@ SUBROUTINE read_xml_file ( wfc_is_collected )
CALL init_at_1()
ENDIF
!
- CALL allocate_wfc()
+ CALL allocate_wfc() ! FIXME: why is this here?
!
! ... read the charge density in G-space
!
@@ -324,15 +290,14 @@ SUBROUTINE read_xml_file ( wfc_is_collected )
!
CALL rho_g2r ( dfftp, rho%of_g, rho%of_r )
!
- ! ... re-calculate the local part of the pseudopotential vltot
- ! ... and the core correction charge (if any) - This is done here
- ! ... for compatibility with the previous version of read_file
+ ! ... re-compute the local part of the pseudopotential vltot and
+ ! ... the core correction charge (if any). For 2D calculations
+ ! ... re-initialize cutoff_fact before calculating potentials
!
- !2D calculations: re-initialize cutoff fact before calculating potentials
- IF(do_cutoff_2D) CALL cutoff_fact()
+ IF (do_cutoff_2D) CALL cutoff_fact()
!
CALL init_vloc()
- CALL struc_fact( nat, tau, nsp, ityp, ngm, g, bg, dfftp%nr1, dfftp%nr2, &
+ CALL struc_fact( nat, tau, nsp, ityp, ngm, g, bg, dfftp%nr1, dfftp%nr2,&
dfftp%nr3, strf, eigts1, eigts2, eigts3 )
CALL setlocal()
CALL set_rhoc()
@@ -353,7 +318,7 @@ SUBROUTINE read_xml_file ( wfc_is_collected )
CONTAINS
!
!------------------------------------------------------------------------
- SUBROUTINE set_dimensions()
+ SUBROUTINE set_gcut()
!------------------------------------------------------------------------
!
USE constants, ONLY : pi, eps8
@@ -381,6 +346,33 @@ SUBROUTINE read_xml_file ( wfc_is_collected )
gcutms = gcutm
END IF
!
- END SUBROUTINE set_dimensions
+ END SUBROUTINE set_gcut
+ !
+ !------------------------------------------------------------------------
+ SUBROUTINE set_spin_vars( )
+ !------------------------------------------------------------------------
+ !
+ ! Set various spin-related variables
+ !
+ USE noncollin_module, ONLY : nspin_lsda, nspin_mag, nspin_gga
+ USE spin_orb, ONLY : domag
+ USE lsda_mod, ONLY : nspin, current_spin
+ !
+ IF (nspin /= 2) current_spin = 1
+ !
+ nspin_mag = nspin
+ nspin_lsda = nspin
+ nspin_gga = nspin
+ IF (nspin==4) THEN
+ nspin_lsda=1
+ IF (domag) THEN
+ nspin_gga=2
+ ELSE
+ nspin_gga=1
+ nspin_mag=1
+ ENDIF
+ ENDIF
+ !
+ END SUBROUTINE set_spin_vars
!
END SUBROUTINE read_xml_file
diff --git a/PW/src/scf_mod.f90 b/PW/src/scf_mod.f90
index 451711f83..7f785a7f1 100644
--- a/PW/src/scf_mod.f90
+++ b/PW/src/scf_mod.f90
@@ -435,7 +435,6 @@ CONTAINS
USE constants, ONLY : e2, tpi, fpi
USE cell_base, ONLY : omega, tpiba2
USE gvect, ONLY : gg, gstart
- USE spin_orb, ONLY : domag
USE control_flags, ONLY : gamma_only
USE paw_onecenter, ONLY : paw_ddot
USE mp_bands, ONLY : intra_bgrp_comm
diff --git a/PW/src/us_exx.f90 b/PW/src/us_exx.f90
index db8e78fe6..7f93c2bdc 100644
--- a/PW/src/us_exx.f90
+++ b/PW/src/us_exx.f90
@@ -555,8 +555,6 @@ MODULE us_exx
USE cell_base, ONLY : omega
USE uspp, ONLY : okvan, nkb, ijtoh, indv_ijkb0
USE uspp_param, ONLY : upf, nh
- USE spin_orb, ONLY : domag
- !
USE realus, ONLY : tabxx
!
IMPLICIT NONE
diff --git a/PW/src/v_of_rho.f90 b/PW/src/v_of_rho.f90
index 7782924f1..9ae1d2d46 100644
--- a/PW/src/v_of_rho.f90
+++ b/PW/src/v_of_rho.f90
@@ -112,7 +112,6 @@ SUBROUTINE v_xc_meta( rho, rho_core, rhog_core, etxc, vtxc, v, kedtaur )
USE gvect, ONLY : g, ngm
USE lsda_mod, ONLY : nspin
USE cell_base, ONLY : omega
- USE spin_orb, ONLY : domag
USE funct, ONLY : xc, xc_spin, tau_xc, tau_xc_spin, get_meta, dft_is_nonlocc, nlc
USE scf, ONLY : scf_type
USE mp, ONLY : mp_sum
diff --git a/PW/tools/make.depend b/PW/tools/make.depend
index 0ad12542b..d74fa95c3 100644
--- a/PW/tools/make.depend
+++ b/PW/tools/make.depend
@@ -6,6 +6,7 @@ ev.o : ../../Modules/mp_global.o
ev.o : ../../Modules/mp_world.o
ev.o : ../../Modules/random_numbers.o
ev.o : ../../UtilXlib/mp.o
+ibrav2cell.o : ../../Modules/constants.o
ibrav2cell.o : ../../Modules/kind.o
kpoints.o : ../../Modules/cell_base.o
kpoints.o : ../../Modules/kind.o