2003-01-20 05:58:50 +08:00
|
|
|
!
|
2009-08-02 01:48:59 +08:00
|
|
|
! Copyright (C) 2001-2006 Quantum ESPRESSO group
|
2003-01-20 05:58:50 +08:00
|
|
|
! This file is distributed under the terms of the
|
|
|
|
! GNU General Public License. See the file `License'
|
|
|
|
! in the root directory of the present distribution,
|
|
|
|
! or http://www.gnu.org/copyleft/gpl.txt .
|
|
|
|
!
|
2004-08-23 14:51:19 +08:00
|
|
|
!----------------------------------------------------------------------------
|
2003-12-10 22:57:07 +08:00
|
|
|
SUBROUTINE init_run()
|
2004-08-23 14:51:19 +08:00
|
|
|
!----------------------------------------------------------------------------
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2007-09-21 20:10:25 +08:00
|
|
|
USE klist, ONLY : nkstot
|
2009-12-23 01:01:28 +08:00
|
|
|
USE symme, ONLY : sym_rho_init
|
2007-09-21 20:10:25 +08:00
|
|
|
USE wvfct, ONLY : nbnd, et, wg, btype
|
2011-01-05 02:45:48 +08:00
|
|
|
USE control_flags, ONLY : lmd, gamma_only
|
2011-01-06 00:04:54 +08:00
|
|
|
USE cell_base, ONLY : at, bg
|
2011-01-05 02:45:48 +08:00
|
|
|
USE cellmd, ONLY : lmovecell
|
2007-09-21 20:10:25 +08:00
|
|
|
USE dynamics_module, ONLY : allocate_dyn_vars
|
2007-11-12 22:49:09 +08:00
|
|
|
USE paw_variables, ONLY : okpaw
|
|
|
|
USE paw_init, ONLY : paw_init_onecenter, allocate_paw_internals
|
2007-11-13 23:15:28 +08:00
|
|
|
#ifdef __PARA
|
|
|
|
USE paw_init, ONLY : paw_post_init
|
|
|
|
#endif
|
2007-10-18 03:12:51 +08:00
|
|
|
USE bp, ONLY : lberry, lelfield
|
2011-04-22 00:12:36 +08:00
|
|
|
#ifdef __SOLVENT
|
|
|
|
USE grid_dimensions, ONLY : nrxx
|
|
|
|
USE solvent_base, ONLY : do_solvent
|
|
|
|
#endif
|
2011-01-06 00:04:54 +08:00
|
|
|
USE recvec_subs, ONLY : ggen
|
2008-06-11 18:47:40 +08:00
|
|
|
! DCC
|
2010-11-18 23:49:00 +08:00
|
|
|
! USE grid_dimensions, ONLY : nr1x, nr2x, nr3x, nr1, nr2, nr3
|
|
|
|
! USE gvect, ONLY : ecutwfc
|
|
|
|
! USE ee_mod, ONLY : do_comp, do_coarse
|
2009-02-12 16:07:11 +08:00
|
|
|
! Wannier_ac
|
|
|
|
USE wannier_new, ONLY : use_wannier
|
2010-01-28 02:50:07 +08:00
|
|
|
USE dfunct, only : newd
|
2003-04-22 04:42:34 +08:00
|
|
|
!
|
2003-10-17 00:30:12 +08:00
|
|
|
IMPLICIT NONE
|
2003-04-22 04:42:34 +08:00
|
|
|
!
|
|
|
|
!
|
2003-10-17 00:30:12 +08:00
|
|
|
CALL start_clock( 'init_run' )
|
2003-04-22 04:42:34 +08:00
|
|
|
!
|
2008-08-09 04:40:08 +08:00
|
|
|
! ... calculate limits of some indices, used in subsequent allocations
|
2003-10-17 00:30:12 +08:00
|
|
|
!
|
2008-01-25 01:02:01 +08:00
|
|
|
CALL pre_init()
|
|
|
|
!
|
2003-10-17 00:30:12 +08:00
|
|
|
! ... allocate memory for G- and R-space fft arrays
|
|
|
|
!
|
2003-12-10 22:57:07 +08:00
|
|
|
CALL allocate_fft()
|
2003-10-17 00:30:12 +08:00
|
|
|
!
|
|
|
|
! ... generate reciprocal-lattice vectors and fft indices
|
|
|
|
!
|
2011-01-06 00:04:54 +08:00
|
|
|
CALL ggen ( gamma_only, at, bg )
|
2011-01-05 02:45:48 +08:00
|
|
|
CALL gshells ( lmovecell )
|
2006-01-31 00:17:30 +08:00
|
|
|
!
|
2009-12-23 01:01:28 +08:00
|
|
|
! ... variable initialization for parallel symmetrization
|
|
|
|
!
|
2010-01-07 00:54:57 +08:00
|
|
|
CALL sym_rho_init (gamma_only )
|
2009-12-23 01:01:28 +08:00
|
|
|
!
|
2003-12-10 22:57:07 +08:00
|
|
|
CALL summary()
|
2006-01-31 00:17:30 +08:00
|
|
|
!
|
|
|
|
! ... allocate memory for all other arrays (potentials, wavefunctions etc)
|
|
|
|
!
|
2003-12-10 22:57:07 +08:00
|
|
|
CALL allocate_nlpot()
|
2007-11-13 23:15:28 +08:00
|
|
|
IF (okpaw) THEN
|
|
|
|
CALL allocate_paw_internals()
|
|
|
|
CALL paw_init_onecenter()
|
|
|
|
ENDIF
|
2003-12-10 22:57:07 +08:00
|
|
|
CALL allocate_locpot()
|
|
|
|
CALL allocate_wfc()
|
2007-10-18 03:12:51 +08:00
|
|
|
CALL allocate_bp_efield()
|
|
|
|
IF( lberry .or. lelfield) call bp_global_map()
|
2011-04-22 00:12:36 +08:00
|
|
|
#ifdef __SOLVENT
|
|
|
|
IF ( do_solvent ) CALL solvent_initbase( nrxx )
|
|
|
|
#endif
|
2008-06-11 18:47:40 +08:00
|
|
|
! DCC
|
|
|
|
! ... Initializes EE variables
|
|
|
|
!
|
2010-11-18 23:49:00 +08:00
|
|
|
! IF ( do_comp ) CALL init_ee(nr1x,nr2x,nr3x)
|
2008-06-11 18:47:40 +08:00
|
|
|
!
|
2010-11-18 23:49:00 +08:00
|
|
|
! IF ( do_coarse ) THEN
|
|
|
|
! CALL ggen_coarse()
|
|
|
|
! CALL data_structure_coarse( gamma_only, nr1,nr2,nr3, ecutwfc )
|
|
|
|
! END IF
|
2008-06-11 18:47:40 +08:00
|
|
|
|
2007-07-10 19:15:31 +08:00
|
|
|
CALL memory_report()
|
2003-10-17 00:30:12 +08:00
|
|
|
!
|
2006-04-25 01:32:08 +08:00
|
|
|
ALLOCATE( et( nbnd, nkstot ) , wg( nbnd, nkstot ), btype( nbnd, nkstot ) )
|
2006-03-14 01:21:46 +08:00
|
|
|
!
|
2006-01-31 00:17:30 +08:00
|
|
|
et(:,:) = 0.D0
|
2006-04-19 23:49:58 +08:00
|
|
|
wg(:,:) = 0.D0
|
2006-01-31 00:17:30 +08:00
|
|
|
!
|
2006-04-25 01:32:08 +08:00
|
|
|
btype(:,:) = 1
|
|
|
|
!
|
2003-12-10 22:57:07 +08:00
|
|
|
CALL openfil()
|
2003-10-17 00:30:12 +08:00
|
|
|
!
|
2008-02-11 21:46:29 +08:00
|
|
|
CALL hinit0()
|
|
|
|
!
|
|
|
|
CALL potinit()
|
|
|
|
!
|
|
|
|
CALL newd()
|
|
|
|
!
|
|
|
|
CALL wfcinit()
|
|
|
|
!
|
2009-02-12 16:07:11 +08:00
|
|
|
IF(use_wannier) CALL wannier_init()
|
|
|
|
!
|
2007-11-13 23:15:28 +08:00
|
|
|
#ifdef __PARA
|
2008-02-07 21:48:46 +08:00
|
|
|
! Cleanup PAW arrays that are only used for init
|
|
|
|
IF (okpaw) CALL paw_post_init() ! only parallel!
|
2007-11-13 23:15:28 +08:00
|
|
|
#endif
|
2003-10-17 00:30:12 +08:00
|
|
|
!
|
2006-01-14 01:25:42 +08:00
|
|
|
IF ( lmd ) CALL allocate_dyn_vars()
|
|
|
|
!
|
2006-04-25 01:32:08 +08:00
|
|
|
CALL stop_clock( 'init_run' )
|
2003-10-17 00:30:12 +08:00
|
|
|
!
|
This is a quite complex check-in, but actually not very much is done. Changelog follows.
LP
UPF file format updated completely, UPFv2 introduced:
* ld1.x can still produce old format, with the switch upf_v1_format=.true. in inputp
this is disabled by default, but we can discuss if it should be the opposite.
* pw.x cp.x and all utilities should notice no difference
* some utilities in upftools still need to be updated, anyway conversion UPFv1 to UPFv2
is very easy, so this should be no big issue
* starting from now to produce an UPF file you need to fill the pseudo_upf derivedd type
and feed it to write_upf woutine in upf_module (Modules/upf.f90)
* extensive use of iotk
I have tried to make the new format as self contained as possible, e.g. there should be
minimal need for post-processing after the data is read, no more reconstruction of known
quantities, and no more odd syntax to save negligible quantity of space. Also the human
readable section is a bit richer, all the rest is more machine readable.
I hope this will not cause any throuble, and tried really hard to, all examples and all
tests works as fine as before and gives (what really looks like) the same results.
Other changes that I needed to make:
* radial grids are now allocatable, they management is a bit less of a hack too
* paw and uspp augmentation are stored in the same place
* paw print total all-electron energy if all atoms are paw, not very useful, but nice
* most of the pseudopotential-writing reading files have been renamed to some more
logical name, I spare you the list. E.g. read_oldpseudo -> read_pseudo_rrkj3
* paw_t derived type was only used in atomic, so I have put it there (as the pseudo_type
module take ages to recompile it was awkward to leave it there).
PAW tests inserted in test/ there are 6 of them, as a consequence I have also put 5 paw
pseudopotentials in the pseudo/ directory.
I will update the PAW scf examples soon, by deleting them (as running a pw with a PAW
pseudopotential requires no option at all). PAW generation examples should be updated.
A lot of small bugfixes here & there mostly uninitialized variables or unallocated
pointers used as subrotuine arguments.
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@4769 c92efa57-630b-4861-b058-cf58834340f0
2008-04-03 23:50:43 +08:00
|
|
|
|
2003-10-17 00:30:12 +08:00
|
|
|
RETURN
|
|
|
|
!
|
|
|
|
END SUBROUTINE init_run
|
2006-08-09 05:25:26 +08:00
|
|
|
!
|
2008-01-25 01:02:01 +08:00
|
|
|
!----------------------------------------------------------------------------
|
|
|
|
SUBROUTINE pre_init()
|
|
|
|
!----------------------------------------------------------------------------
|
|
|
|
!
|
|
|
|
USE ions_base, ONLY : nat, nsp, ityp
|
|
|
|
USE uspp_param, ONLY : upf, lmaxkb, nh, nhm, nbetam
|
|
|
|
USE uspp, ONLY : nkb, nkbus
|
|
|
|
IMPLICIT NONE
|
|
|
|
INTEGER :: na, nt, nb
|
|
|
|
!
|
|
|
|
! calculate the number of beta functions for each atomic type
|
|
|
|
!
|
|
|
|
lmaxkb = - 1
|
2009-09-14 00:48:24 +08:00
|
|
|
DO nt = 1, nsp
|
|
|
|
!
|
2008-01-25 01:02:01 +08:00
|
|
|
nh (nt) = 0
|
2009-09-14 00:48:24 +08:00
|
|
|
!
|
|
|
|
! do not add any beta projector if pseudo in 1/r fmt (AF)
|
|
|
|
IF ( upf(nt)%tcoulombp ) CYCLE
|
|
|
|
!
|
|
|
|
DO nb = 1, upf(nt)%nbeta
|
2008-01-25 01:02:01 +08:00
|
|
|
nh (nt) = nh (nt) + 2 * upf(nt)%lll(nb) + 1
|
2009-09-14 00:48:24 +08:00
|
|
|
lmaxkb = MAX (lmaxkb, upf(nt)%lll(nb) )
|
|
|
|
ENDDO
|
|
|
|
!
|
|
|
|
ENDDO
|
2008-01-25 01:02:01 +08:00
|
|
|
!
|
|
|
|
! calculate the maximum number of beta functions
|
|
|
|
!
|
|
|
|
nhm = MAXVAL (nh (1:nsp))
|
|
|
|
nbetam = MAXVAL (upf(:)%nbeta)
|
|
|
|
!
|
|
|
|
! calculate the number of beta functions of the solid
|
|
|
|
!
|
|
|
|
nkb = 0
|
|
|
|
nkbus = 0
|
|
|
|
do na = 1, nat
|
|
|
|
nt = ityp(na)
|
|
|
|
nkb = nkb + nh (nt)
|
|
|
|
if (upf(nt)%tvanp) nkbus = nkbus + nh (nt)
|
|
|
|
enddo
|
|
|
|
|
|
|
|
|
|
|
|
END SUBROUTINE pre_init
|