mirror of https://gitlab.com/QEF/q-e.git
- important bug fix, core correction in CP was not properly set,
the bug was introduced with the reorganization of the fft. - NEB working with CP/FPMD (new calculation fpmd-neb added to check all the scf engines) - Clean-ups git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@2993 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
parent
897475cc13
commit
de345b52c3
|
@ -142,7 +142,7 @@ SUBROUTINE compute_fes_grads( N_in, N_fin, stat )
|
|||
!
|
||||
IF ( .NOT. frozen(image) ) THEN
|
||||
!
|
||||
tcpu = get_clock( program_name )
|
||||
tcpu = get_clock( 'CP' )
|
||||
!
|
||||
IF ( nimage > 1 ) THEN
|
||||
!
|
||||
|
|
|
@ -71,7 +71,7 @@ SUBROUTINE compute_scf( N_in, N_fin, stat )
|
|||
!
|
||||
scradir = outdir
|
||||
!
|
||||
tcpu = get_clock( program_name )
|
||||
tcpu = get_clock( 'CP' )
|
||||
!
|
||||
WRITE( UNIT = iunpath, FMT = scf_fmt ) tcpu, image
|
||||
!
|
||||
|
|
|
@ -2814,7 +2814,7 @@
|
|||
! ===================================================================
|
||||
! calculation exchange and correlation energy and potential
|
||||
! -------------------------------------------------------------------
|
||||
IF (nlcc_any) CALL add_cc(rhoc,rhog,rhor)
|
||||
IF ( nlcc_any ) CALL add_cc( rhoc, rhog, rhor )
|
||||
!
|
||||
CALL exch_corr_h( nspin, rhog, rhor, rhoc, sfac, exc, dxc, self_sxc )
|
||||
|
||||
|
|
|
@ -831,7 +831,8 @@ SUBROUTINE terminate_run()
|
|||
USE kinds, ONLY : DP
|
||||
USE io_global, ONLY : stdout, ionode
|
||||
USE cp_main_variables, ONLY : acc
|
||||
USE cg_module, ONLY : tcg, print_clock_tcg
|
||||
USE cg_module, ONLY : tcg, print_clock_tcg
|
||||
USE mp, ONLY : mp_report
|
||||
!
|
||||
IMPLICIT NONE
|
||||
!
|
||||
|
@ -852,6 +853,7 @@ SUBROUTINE terminate_run()
|
|||
!
|
||||
CALL print_clock( 'initialize' )
|
||||
CALL print_clock( 'total_time' )
|
||||
CALL print_clock( 'main_loop' )
|
||||
CALL print_clock( 'formf' )
|
||||
CALL print_clock( 'rhoofr' )
|
||||
CALL print_clock( 'vofrho' )
|
||||
|
@ -878,6 +880,8 @@ SUBROUTINE terminate_run()
|
|||
CALL print_clock( 'rsg' )
|
||||
if (tcg) call print_clock_tcg()
|
||||
!
|
||||
CALL mp_report()
|
||||
!
|
||||
1974 FORMAT( 1X,2I5,3F10.4,2X,3F10.4 )
|
||||
1975 FORMAT( /1X,'Scaled coordinates '/1X,'species',' atom #' )
|
||||
1976 FORMAT( 1X,2I5,3F10.4 )
|
||||
|
|
|
@ -133,15 +133,7 @@ PROGRAM main
|
|||
!
|
||||
ELSE
|
||||
!
|
||||
IF( program_name == 'CP90' ) THEN
|
||||
!
|
||||
CALL cpr_loop( 1 )
|
||||
!
|
||||
ELSE IF( program_name == 'FPMD' ) THEN
|
||||
!
|
||||
CALL fpmd_loop( 0 )
|
||||
!
|
||||
END IF
|
||||
CALL cpr_loop( 1 )
|
||||
!
|
||||
END IF
|
||||
!
|
||||
|
|
|
@ -58,6 +58,10 @@ SUBROUTINE deallocate_modules_var()
|
|||
USE pseudo_projector, ONLY : fnl, projector, deallocate_projector
|
||||
USE groups_module, ONLY : deallocate_groups
|
||||
USE ions_positions, ONLY : deallocate_ions_positions
|
||||
USE reciprocal_space_mesh, ONLY: deallocate_gkvec
|
||||
USE optical_properties, ONLY : optical_closeup
|
||||
USE guess, ONLY : guess_closeup
|
||||
USE kohn_sham_states, ONLY : ks_states_closeup
|
||||
!
|
||||
IMPLICIT NONE
|
||||
!
|
||||
|
@ -121,6 +125,10 @@ SUBROUTINE deallocate_modules_var()
|
|||
CALL deallocate_sic()
|
||||
CALL deallocate_metagga()
|
||||
CALL ions_nose_deallocate()
|
||||
CALL deallocate_gkvec()
|
||||
CALL optical_closeup()
|
||||
CALL guess_closeup()
|
||||
CALL ks_states_closeup()
|
||||
!
|
||||
RETURN
|
||||
!
|
||||
|
|
|
@ -433,6 +433,12 @@ CONTAINS
|
|||
|
||||
adum = 0.D0
|
||||
!
|
||||
END IF
|
||||
|
||||
IF( iprsta > 1 ) THEN
|
||||
!
|
||||
! Printout values at step 0, useful for debugging
|
||||
!
|
||||
CALL printout( nfi, atoms, 0.0d0, 0.0d0, ttprint, ht, adum, adum, edft )
|
||||
!
|
||||
END IF
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
|
||||
PRIVATE
|
||||
|
||||
PUBLIC :: recvecs_units, newgk, gindex_closeup
|
||||
PUBLIC :: recvecs_units, newgk, deallocate_gkvec
|
||||
PUBLIC :: gkmask_l, gkcutz_l, gkx_l, gk_l
|
||||
|
||||
! ... end of module-scope declarations
|
||||
|
@ -195,13 +195,15 @@
|
|||
RETURN
|
||||
END SUBROUTINE newgk
|
||||
|
||||
!=----------------------------------------------------------------------------=!
|
||||
|
||||
SUBROUTINE gindex_closeup
|
||||
IMPLICIT NONE
|
||||
|
||||
SUBROUTINE deallocate_gkvec
|
||||
IF( ALLOCATED( gk_l ) ) DEALLOCATE( gk_l )
|
||||
IF( ALLOCATED( gkx_l ) ) DEALLOCATE( gkx_l )
|
||||
IF( ALLOCATED( gkcutz_l ) ) DEALLOCATE( gkcutz_l )
|
||||
IF( ALLOCATED( gkmask_l ) ) DEALLOCATE( gkmask_l )
|
||||
RETURN
|
||||
END SUBROUTINE gindex_closeup
|
||||
|
||||
END SUBROUTINE deallocate_gkvec
|
||||
|
||||
|
||||
!=----------------------------------------------------------------------------=!
|
||||
END MODULE reciprocal_space_mesh
|
||||
|
|
|
@ -57,7 +57,16 @@ MODULE input
|
|||
!
|
||||
IF( TRIM( calculation ) == 'fpmd' ) program_name = 'FPMD'
|
||||
!
|
||||
lneb = ( TRIM( calculation ) == 'neb' )
|
||||
IF( TRIM( calculation ) == 'fpmd-neb' ) THEN
|
||||
!
|
||||
program_name = 'FPMD'
|
||||
lneb = .TRUE.
|
||||
!
|
||||
ELSE
|
||||
!
|
||||
lneb = ( TRIM( calculation ) == 'neb' )
|
||||
!
|
||||
END IF
|
||||
!
|
||||
lsmd = ( TRIM( calculation ) == 'smd' )
|
||||
!
|
||||
|
|
144
CPV/main.f90
144
CPV/main.f90
|
@ -96,7 +96,7 @@
|
|||
tsteepdesc, ekin_conv_thr, ekin_maxiter, ionic_conjugate_gradient, &
|
||||
tconjgrad_ion, conv_elec, lneb, tnoseh, tuspp, etot_conv_thr, tdamp
|
||||
USE atoms_type_module, ONLY: atoms_type
|
||||
USE print_out_module, ONLY: printout, print_time, print_sfac, &
|
||||
USE print_out_module, ONLY: printout, print_sfac, &
|
||||
printacc
|
||||
USE cell_module, ONLY: movecell, press, boxdimensions, updatecell
|
||||
USE empty_states, ONLY: empty
|
||||
|
@ -121,11 +121,9 @@
|
|||
USE kohn_sham_states, ONLY: ks_states_force_pairing
|
||||
USE io_global, ONLY: ionode
|
||||
USE io_global, ONLY: stdout
|
||||
USE optical_properties, ONLY: opticalp, optical_closeup
|
||||
USE optical_properties, ONLY: opticalp
|
||||
USE wave_functions, ONLY: update_wave_functions
|
||||
USE mp, ONLY: mp_report
|
||||
USE runsd_module, ONLY: runsd
|
||||
USE guess, ONLY: guess_closeup
|
||||
USE input, ONLY: iosys
|
||||
USE cell_base, ONLY: alat, a1, a2, a3, cell_kinene, velh
|
||||
USE cell_base, ONLY: frich, greash
|
||||
|
@ -144,8 +142,6 @@
|
|||
USE cell_base, ONLY: cell_gamma
|
||||
USE grid_subroutines, ONLY: realspace_grids_init, realspace_grids_para
|
||||
!
|
||||
USE reciprocal_space_mesh, ONLY: gindex_closeup
|
||||
!
|
||||
USE reciprocal_vectors, ONLY: &
|
||||
g, & ! G-vectors square modulus
|
||||
gx, & ! G-vectors component
|
||||
|
@ -204,9 +200,8 @@
|
|||
REAL(DP) :: ekinc, ekcell, ekinp, erhoold, maxfion
|
||||
REAL(DP) :: derho
|
||||
REAL(DP) :: ekincs( nspinx )
|
||||
REAL(DP) :: s1, s2, s3, s4, s5, s6, s7, s8
|
||||
REAL(DP) :: timernl, timerho, timevof, timepre
|
||||
REAL(DP) :: timeform, timerd, timeorto, timeloop
|
||||
REAL(DP) :: timepre
|
||||
REAL(DP) :: timerd, timeorto
|
||||
REAL(DP) :: ekmt(3,3) = 0.0d0
|
||||
REAL(DP) :: hgamma(3,3) = 0.0d0
|
||||
REAL(DP) :: temphh(3,3) = 0.0d0
|
||||
|
@ -221,8 +216,6 @@
|
|||
|
||||
REAL(DP) :: fccc, vnosep
|
||||
|
||||
REAL(DP), EXTERNAL :: cclock
|
||||
|
||||
!
|
||||
! ... end of declarations
|
||||
!
|
||||
|
@ -236,19 +229,18 @@
|
|||
ekinc = 0.0_DP
|
||||
ekcell = 0.0_DP
|
||||
timepre = 0.0_DP
|
||||
timernl = 0.0_DP
|
||||
timerho = 0.0_DP
|
||||
timevof = 0.0_DP
|
||||
timerd = 0.0_DP
|
||||
timeorto = 0.0_DP
|
||||
timeform = 0.0_DP
|
||||
timeloop = 0.0_DP
|
||||
fccc = 1.0d0
|
||||
nstep_this_run = 0
|
||||
|
||||
|
||||
ttexit = .FALSE.
|
||||
|
||||
|
||||
MAIN_LOOP: DO
|
||||
|
||||
s3 = cclock()
|
||||
call start_clock( 'main_loop' )
|
||||
|
||||
! ... increment simulation steps counter
|
||||
!
|
||||
|
@ -264,11 +256,12 @@
|
|||
|
||||
! ... set the right flags for the current MD step
|
||||
!
|
||||
if(.not.tcg) then
|
||||
ttprint = ( MOD(nfi, iprint) == 0 ) .OR. ( iprsta > 2 )
|
||||
else
|
||||
ttprint = .true.
|
||||
endif
|
||||
IF ( .NOT. tcg ) THEN
|
||||
ttprint = ( MOD(nfi, iprint) == 0 ) .OR. ( iprsta > 2 ) .OR. ttexit
|
||||
ELSE
|
||||
ttprint = .TRUE.
|
||||
ENDIF
|
||||
!
|
||||
ttsave = MOD(nfi, isave) == 0
|
||||
!
|
||||
ttconvchk = tconvthrs%active .AND. ( MOD( nfi, tconvthrs%nstep ) == 0 )
|
||||
|
@ -289,8 +282,6 @@
|
|||
!
|
||||
END IF
|
||||
|
||||
IF( memchk ) CALL memstat(0)
|
||||
|
||||
IF( thdyn .AND. tnoseh ) THEN
|
||||
!
|
||||
CALL cell_nosevel( vnhh, xnhh0, xnhhm, delt )
|
||||
|
@ -309,8 +300,6 @@
|
|||
!
|
||||
END IF
|
||||
|
||||
IF(memchk) CALL memstat(1)
|
||||
|
||||
IF( tfor .OR. thdyn ) THEN
|
||||
!
|
||||
! ... ionic positions aren't fixed, recompute structure factors
|
||||
|
@ -321,8 +310,6 @@
|
|||
!
|
||||
END IF
|
||||
|
||||
IF(memchk) CALL memstat(2)
|
||||
|
||||
IF( thdyn ) THEN
|
||||
!
|
||||
! the simulation cell isn't fixed, recompute local
|
||||
|
@ -332,11 +319,6 @@
|
|||
!
|
||||
END IF
|
||||
|
||||
IF(memchk) CALL memstat(3)
|
||||
|
||||
s4 = cclock()
|
||||
timeform = s4 - s3
|
||||
|
||||
IF( ttdiis .AND. t_diis_simple ) THEN
|
||||
!
|
||||
! ... perform DIIS minimization on electronic states
|
||||
|
@ -390,28 +372,16 @@
|
|||
!
|
||||
END IF
|
||||
|
||||
IF(memchk) CALL memstat(4)
|
||||
|
||||
! ... compute nonlocal pseudopotential
|
||||
!
|
||||
atoms0%for = 0.0d0
|
||||
!
|
||||
edft%enl = nlrh_m( c0, wfill, ttforce, atoms0, occn, bec, becdr, eigr)
|
||||
|
||||
IF(memchk) CALL memstat(5)
|
||||
|
||||
s5 = cclock()
|
||||
timernl = s5 - s4
|
||||
|
||||
! ... compute the new charge density "rhor"
|
||||
!
|
||||
CALL rhoofr( nfi, c0, wfill, occn, rhor, ht0)
|
||||
|
||||
IF(memchk) CALL memstat(6)
|
||||
|
||||
s6 = cclock()
|
||||
timerho = s6 - s5
|
||||
|
||||
! ... vofrhos compute the new DFT potential "vpot", and energies "edft",
|
||||
! ... ionc forces "fion" and stress "pail".
|
||||
!
|
||||
|
@ -420,11 +390,6 @@
|
|||
|
||||
! CALL debug_energies( edft ) ! DEBUG
|
||||
|
||||
IF(memchk) CALL memstat(7)
|
||||
|
||||
s7 = cclock()
|
||||
timevof = s7 - s6
|
||||
|
||||
! ... Car-Parrinello dynamics for the electrons
|
||||
!
|
||||
IF( ttcarpar ) THEN
|
||||
|
@ -483,8 +448,6 @@
|
|||
!
|
||||
END IF
|
||||
|
||||
IF(memchk) CALL memstat(8)
|
||||
|
||||
! ... Ions Dynamics
|
||||
!
|
||||
ekinp = 0.d0 ! kinetic energy of ions
|
||||
|
@ -542,8 +505,7 @@
|
|||
|
||||
END IF
|
||||
|
||||
|
||||
IF(memchk) CALL memstat(10)
|
||||
call stop_clock( 'main_loop' )
|
||||
|
||||
! ... Here find Empty states eigenfunctions and eigenvalues
|
||||
!
|
||||
|
@ -597,7 +559,9 @@
|
|||
tconv = tconv .AND. ( ekinc < tconvthrs%ekin )
|
||||
END IF
|
||||
!
|
||||
tconv = tconv .AND. ( maxfion < tconvthrs%force )
|
||||
IF( .NOT. lneb ) THEN
|
||||
tconv = tconv .AND. ( maxfion < tconvthrs%force )
|
||||
END IF
|
||||
!
|
||||
IF( ionode ) THEN
|
||||
!
|
||||
|
@ -610,9 +574,9 @@
|
|||
ekinc, tconvthrs%ekin, derho, tconvthrs%derho, maxfion, tconvthrs%force
|
||||
!
|
||||
IF( tconv ) THEN
|
||||
WRITE( stdout,fmt="(3X,'MAIN: convergence achieved for system relaxation')")
|
||||
WRITE( stdout,fmt="(3X,'MAIN: convergence achieved for system relaxation',/)")
|
||||
ELSE
|
||||
WRITE( stdout,fmt="(3X,'MAIN: convergence NOT achieved for system relaxation')")
|
||||
WRITE( stdout,fmt="(3X,'MAIN: convergence NOT achieved for system relaxation',/)")
|
||||
END IF
|
||||
!
|
||||
END IF
|
||||
|
@ -628,8 +592,6 @@
|
|||
|
||||
CALL printout( nfi, atoms0, ekinc, ekcell, ttprint, ht0, acc, acc_this_run, edft)
|
||||
|
||||
IF(memchk) CALL memstat(11)
|
||||
|
||||
! ... Update variables
|
||||
|
||||
IF ( .NOT. ttdiis ) THEN
|
||||
|
@ -673,8 +635,6 @@
|
|||
END IF
|
||||
|
||||
|
||||
IF(memchk) CALL memstat(12)
|
||||
|
||||
frich = frich * greash
|
||||
|
||||
! ... stop the code if either the file .cp_stop is present or the
|
||||
|
@ -685,10 +645,36 @@
|
|||
! ... stop if only the electronic minimization was required
|
||||
! IF(.NOT. (tfor .OR. thdyn) .AND. ttdiis ) tstop = .TRUE.
|
||||
|
||||
tstop = tstop .OR. tconv
|
||||
|
||||
ttexit = tstop .OR. ( nfi >= nomore )
|
||||
tstop = tstop .OR. tconv .OR. ( nfi >= nomore )
|
||||
!
|
||||
!
|
||||
tstop = tstop .OR. ttexit
|
||||
!
|
||||
|
||||
IF( tstop ) THEN
|
||||
!
|
||||
! ... all condition to stop the code are satisfied
|
||||
!
|
||||
IF( ttprint ) THEN
|
||||
!
|
||||
! ... we are in a step where printing is active,
|
||||
! ... exit immediately
|
||||
!
|
||||
ttexit = .TRUE.
|
||||
!
|
||||
ELSE IF( .NOT. ttexit ) THEN
|
||||
!
|
||||
! ... perform an additional step, in order to compute
|
||||
! ... quantity to print out
|
||||
!
|
||||
ttexit = .TRUE.
|
||||
!
|
||||
CYCLE MAIN_LOOP
|
||||
!
|
||||
END IF
|
||||
!
|
||||
END IF
|
||||
!
|
||||
! ... write the restart file
|
||||
!
|
||||
IF( ttsave .OR. ttexit ) THEN
|
||||
|
@ -696,21 +682,6 @@
|
|||
taui, cdmi, htm, ht0, rhor, vpot )
|
||||
END IF
|
||||
|
||||
IF( ttexit .AND. .NOT. ttprint ) THEN
|
||||
!
|
||||
! When code stop write to stdout quantities regardles of the value of nfi
|
||||
! but do not print if MOD( nfi, iprint ) == 0
|
||||
!
|
||||
CALL printout( nfi, atoms0, ekinc, ekcell, ttexit, ht0, acc, acc_this_run, edft)
|
||||
!
|
||||
END IF
|
||||
|
||||
s8 = cclock()
|
||||
timeloop = s8 - s3
|
||||
|
||||
CALL print_time( ttprint, ttexit, timeform, timernl, timerho, &
|
||||
timevof, timerd, timeorto, timeloop, timing )
|
||||
|
||||
! ... loop back
|
||||
!
|
||||
IF( ttexit ) EXIT MAIN_LOOP
|
||||
|
@ -745,7 +716,6 @@
|
|||
! ... report statistics
|
||||
|
||||
CALL printacc(nfi, nstep_this_run, acc, acc_this_run)
|
||||
CALL mp_report()
|
||||
|
||||
DO iunit = 10, 99
|
||||
IF( iunit == stdout ) CYCLE
|
||||
|
@ -756,20 +726,6 @@
|
|||
END IF
|
||||
END DO
|
||||
|
||||
! ... free memory
|
||||
|
||||
IF( allocated( c0 ) ) deallocate(c0)
|
||||
IF( allocated( cp ) ) deallocate(cp)
|
||||
IF( allocated( cm ) ) deallocate(cm)
|
||||
IF( allocated( ce ) ) deallocate(ce)
|
||||
|
||||
CALL optical_closeup()
|
||||
CALL gindex_closeup
|
||||
CALL guess_closeup
|
||||
CALL ks_states_closeup
|
||||
|
||||
CALL deallocate_modules_var()
|
||||
|
||||
RETURN
|
||||
END SUBROUTINE cpmain
|
||||
|
||||
|
|
|
@ -93,8 +93,9 @@ SUBROUTINE cpr_loop( nloop )
|
|||
!
|
||||
USE kinds, ONLY : DP
|
||||
USE ions_base, ONLY : nat
|
||||
USE control_flags, ONLY : lmetadyn
|
||||
USE control_flags, ONLY : lmetadyn, program_name
|
||||
USE metadyn_base, ONLY : metadyn_init
|
||||
USE main_module, ONLY : cpmain
|
||||
!
|
||||
IMPLICIT NONE
|
||||
!
|
||||
|
@ -129,7 +130,15 @@ SUBROUTINE cpr_loop( nloop )
|
|||
!
|
||||
DO iloop = 1, nloop
|
||||
!
|
||||
CALL cprmain( tau(1,1), fion(1,1), etot )
|
||||
IF( program_name == 'CP90' ) THEN
|
||||
!
|
||||
CALL cprmain( tau(1,1), fion(1,1), etot )
|
||||
!
|
||||
ELSE
|
||||
!
|
||||
CALL cpmain( tau, fion, etot )
|
||||
!
|
||||
END IF
|
||||
!
|
||||
CALL memstat( 1 )
|
||||
!
|
||||
|
@ -144,65 +153,3 @@ SUBROUTINE cpr_loop( nloop )
|
|||
RETURN
|
||||
!
|
||||
END SUBROUTINE cpr_loop
|
||||
!
|
||||
!----------------------------------------------------------------------------
|
||||
SUBROUTINE fpmd_loop( iloop )
|
||||
!----------------------------------------------------------------------------
|
||||
!
|
||||
USE kinds, ONLY : DP
|
||||
USE main_module, ONLY : cpmain
|
||||
USE input_parameters, ONLY : restart_mode
|
||||
USE io_files, ONLY : outdir
|
||||
USE ions_base, ONLY : nat
|
||||
USE io_global, ONLY : stdout
|
||||
!
|
||||
IMPLICIT NONE
|
||||
!
|
||||
INTEGER, INTENT(IN) :: iloop
|
||||
!
|
||||
CHARACTER(LEN=256), SAVE :: outdir_orig
|
||||
!
|
||||
REAL(DP), ALLOCATABLE :: tau(:,:)
|
||||
REAL(DP), ALLOCATABLE :: fion(:,:)
|
||||
REAL(DP) :: etot
|
||||
!
|
||||
!
|
||||
IF ( iloop == 1 ) outdir_orig = outdir
|
||||
!
|
||||
IF ( iloop > 1 ) THEN
|
||||
!
|
||||
restart_mode = 'restart'
|
||||
!
|
||||
END IF
|
||||
!
|
||||
SELECT CASE( iloop )
|
||||
CASE( 1 )
|
||||
!
|
||||
outdir = TRIM( outdir_orig ) // '/' // 'image01'
|
||||
!
|
||||
CASE( 2 )
|
||||
!
|
||||
outdir = TRIM( outdir_orig ) // '/' // 'image02'
|
||||
!
|
||||
END SELECT
|
||||
!
|
||||
! ... Car-Parrinello main routine
|
||||
!
|
||||
IF ( nat > 0 ) THEN
|
||||
!
|
||||
ALLOCATE( tau( 3, nat ) )
|
||||
ALLOCATE( fion( 3, nat ) )
|
||||
!
|
||||
ELSE
|
||||
!
|
||||
CALL errore( ' fpmd_loop ', ' nat less or equal 0 ', 1 )
|
||||
!
|
||||
END IF
|
||||
!
|
||||
CALL init_run()
|
||||
!
|
||||
CALL cpmain( tau, fion, etot )
|
||||
!
|
||||
RETURN
|
||||
!
|
||||
END SUBROUTINE fpmd_loop
|
||||
|
|
88
CPV/nlcc.f90
88
CPV/nlcc.f90
|
@ -146,6 +146,11 @@
|
|||
use gvecp, only: ngm
|
||||
use atom, only: nlcc
|
||||
USE fft_module, ONLY: invfft
|
||||
USE io_global, ONLY: stdout
|
||||
USE mp_global, ONLY: intra_image_comm
|
||||
USE cell_base, ONLY: omega
|
||||
USE mp, ONLY: mp_sum
|
||||
USE control_flags, ONLY: iprsta
|
||||
|
||||
implicit none
|
||||
|
||||
|
@ -157,6 +162,7 @@
|
|||
|
||||
COMPLEX(DP), ALLOCATABLE :: vtemp(:), psi(:)
|
||||
REAL(DP) :: fac
|
||||
REAL(DP) :: rsum
|
||||
integer :: is, ig
|
||||
|
||||
ALLOCATE( vtemp( ngm ), psi( dfftp%nnr ) )
|
||||
|
@ -174,16 +180,20 @@
|
|||
|
||||
rhoetg( 1:ngm ) = rhoetg( 1:ngm ) + vtemp( 1:ngm )
|
||||
|
||||
! rhoetr = 1.0d0 * rhoetr + INVFFT( vtemp )
|
||||
|
||||
! CALL pinvfft( rhoetr, vtemp, 1.0d0 )
|
||||
|
||||
CALL rho2psi( 'Dense', psi, dfftp%nnr, vtemp, ngm )
|
||||
CALL invfft( 'Dense', psi, dfftp%nr1, dfftp%nr2, dfftp%nr3, dfftp%nr1x, dfftp%nr2x, dfftp%nr3x )
|
||||
|
||||
IF( SIZE( rhoetr ) /= SIZE( psi ) ) &
|
||||
CALL errore( " add_core_charge ", " inconsistent sizes ", 1 )
|
||||
|
||||
IF( iprsta > 2 ) THEN
|
||||
rsum = DBLE( SUM( psi ) ) * omega / DBLE( dfftp%nr1 * dfftp%nr2 * dfftp%nr3 )
|
||||
CALL mp_sum( rsum, intra_image_comm )
|
||||
WRITE( stdout, 10 ) rsum
|
||||
10 FORMAT( 3X, 'Core Charge = ', D14.6 )
|
||||
END IF
|
||||
|
||||
|
||||
rhoetr(:) = rhoetr(:) + DBLE( psi )
|
||||
|
||||
|
||||
|
@ -294,50 +304,68 @@
|
|||
|
||||
|
||||
!-----------------------------------------------------------------------
|
||||
subroutine add_cc(rhoc,rhog,rhor)
|
||||
subroutine add_cc( rhoc, rhog, rhor )
|
||||
!-----------------------------------------------------------------------
|
||||
!
|
||||
! add core correction to the charge density for exch-corr calculation
|
||||
!
|
||||
use electrons_base, only: nspin
|
||||
use recvecs_indexes, only: np
|
||||
USE kinds, ONLY: DP
|
||||
use electrons_base, only: nspin
|
||||
use control_flags, only: iprsta
|
||||
use io_global, only: stdout
|
||||
use mp_global, only: intra_image_comm
|
||||
use cell_base, only: omega
|
||||
use recvecs_indexes, only: np
|
||||
USE mp, ONLY: mp_sum
|
||||
|
||||
! this isn't really needed, but if I remove it, ifc 7.1
|
||||
! gives an "internal compiler error"
|
||||
use reciprocal_vectors, only: gstart
|
||||
use gvecp, only: ngm
|
||||
|
||||
use grid_dimensions, only: nr1, nr2, nr3, &
|
||||
nr1x, nr2x, nr3x, nnr => nnrx
|
||||
|
||||
USE fft_module, ONLY: fwfft
|
||||
nr1x, nr2x, nr3x, nnrx
|
||||
USE fft_module, ONLY: fwfft
|
||||
!
|
||||
implicit none
|
||||
real(8), intent(in) :: rhoc(nnr)
|
||||
real(8), intent(inout):: rhor(nnr,nspin)
|
||||
complex(8), intent(inout):: rhog(ngm,nspin)
|
||||
complex(8), allocatable :: wrk1( : )
|
||||
!
|
||||
REAL(DP), INTENT(IN) :: rhoc( nnrx )
|
||||
REAL(DP), INTENT(INOUT):: rhor( nnrx, nspin )
|
||||
COMPLEX(DP), INTENT(INOUT):: rhog( ngm, nspin )
|
||||
!
|
||||
COMPLEX(DP), ALLOCATABLE :: wrk1( : )
|
||||
!
|
||||
integer ig, ir, iss, isup, isdw
|
||||
!
|
||||
! In r-space:
|
||||
!
|
||||
if (nspin.eq.1) then
|
||||
integer :: ig, ir, iss, isup, isdw
|
||||
REAL(DP) :: rsum
|
||||
!
|
||||
IF( iprsta > 2 ) THEN
|
||||
rsum = SUM( rhoc ) * omega / DBLE(nr1*nr2*nr3)
|
||||
CALL mp_sum( rsum, intra_image_comm )
|
||||
WRITE( stdout, 10 ) rsum
|
||||
10 FORMAT( 3X, 'Core Charge = ', D14.6 )
|
||||
END IF
|
||||
!
|
||||
! In r-space:
|
||||
!
|
||||
if ( nspin .eq. 1 ) then
|
||||
iss=1
|
||||
call DAXPY(nnr,1.d0,rhoc,1,rhor(1,iss),1)
|
||||
call DAXPY(nnrx,1.d0,rhoc,1,rhor(1,iss),1)
|
||||
else
|
||||
isup=1
|
||||
isdw=2
|
||||
call DAXPY(nnr,0.5d0,rhoc,1,rhor(1,isup),1)
|
||||
call DAXPY(nnr,0.5d0,rhoc,1,rhor(1,isdw),1)
|
||||
call DAXPY(nnrx,0.5d0,rhoc,1,rhor(1,isup),1)
|
||||
call DAXPY(nnrx,0.5d0,rhoc,1,rhor(1,isdw),1)
|
||||
end if
|
||||
! rhoc(r) -> rhoc(g) (wrk1 is used as work space)
|
||||
allocate( wrk1( nnr ) )
|
||||
do ir=1,nnr
|
||||
wrk1(ir)=rhoc(ir)
|
||||
end do
|
||||
!
|
||||
! rhoc(r) -> rhoc(g) (wrk1 is used as work space)
|
||||
!
|
||||
allocate( wrk1( nnrx ) )
|
||||
|
||||
wrk1(:) = rhoc(:)
|
||||
|
||||
call fwfft('Dense',wrk1,nr1,nr2,nr3,nr1x,nr2x,nr3x)
|
||||
! In g-space:
|
||||
!
|
||||
! In g-space:
|
||||
!
|
||||
if (nspin.eq.1) then
|
||||
do ig=1,ngm
|
||||
rhog(ig,iss)=rhog(ig,iss)+wrk1(np(ig))
|
||||
|
@ -534,7 +562,7 @@
|
|||
end do
|
||||
endif
|
||||
!
|
||||
call invfft('Box',qv,nr1b,nr2b,nr3b,nr1bx,nr2bx,nr3bx,isa)
|
||||
call invfft('Box',qv,nr1b,nr2b,nr3b,nr1bx,nr2bx,nr3bx,isa+ia)
|
||||
!
|
||||
call box2grid(irb(1,ia+isa),1,qv,wrk1)
|
||||
if (nfft.eq.2) call box2grid(irb(1,ia+1+isa),2,qv,wrk1)
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
|
||||
|
||||
PUBLIC :: printout_new
|
||||
PUBLIC :: printout, printmain
|
||||
PUBLIC :: print_time, print_sfac, printacc, print_legend
|
||||
PUBLIC :: printout
|
||||
PUBLIC :: print_sfac, printacc, print_legend
|
||||
PUBLIC :: cp_print_rho
|
||||
|
||||
!=----------------------------------------------------------------------------=!
|
||||
|
@ -473,49 +473,6 @@
|
|||
RETURN
|
||||
END SUBROUTINE printout
|
||||
|
||||
!=----------------------------------------------------------------------------=!
|
||||
|
||||
|
||||
SUBROUTINE printmain( tbeg, taurdr, atoms )
|
||||
|
||||
use ions_module, only: print_scaled_positions
|
||||
USE atoms_type_module, ONLY: atoms_type
|
||||
|
||||
implicit none
|
||||
|
||||
logical TBEG,TAURDR
|
||||
TYPE (atoms_type) :: atoms
|
||||
|
||||
if(ionode) then
|
||||
WRITE( stdout,*)
|
||||
WRITE( stdout,*) ' ===> MAIN (FROM FILE NDR) <==='
|
||||
WRITE( stdout,*)
|
||||
|
||||
IF(.NOT.TBEG) THEN
|
||||
WRITE( stdout,*) ' Initial cell (HT0) from restart file NDR'
|
||||
ELSE
|
||||
WRITE( stdout,*) ' Initial cell (HT0) from input file'
|
||||
END IF
|
||||
|
||||
WRITE( stdout,*)
|
||||
IF(TAURDR) THEN
|
||||
WRITE( stdout,10)
|
||||
ELSE
|
||||
WRITE( stdout,9)
|
||||
END IF
|
||||
call print_scaled_positions(atoms, stdout )
|
||||
|
||||
end if
|
||||
|
||||
35 FORMAT(3(1X,F6.2),6X,F6.4,14X,I5)
|
||||
9 FORMAT(' SCALED ATOMIC COORDINATES (FROM NDR) : ')
|
||||
10 FORMAT(' SCALED ATOMIC COORDINATES (FROM STDIN): ')
|
||||
555 FORMAT(3(4X,3(1X,F8.4)))
|
||||
600 FORMAT(4X,I3,3(2X,F12.8))
|
||||
|
||||
RETURN
|
||||
END SUBROUTINE printmain
|
||||
|
||||
!=----------------------------------------------------------------------------=!
|
||||
|
||||
SUBROUTINE print_legend()
|
||||
|
@ -543,109 +500,6 @@
|
|||
|
||||
!=----------------------------------------------------------------------------=!
|
||||
|
||||
SUBROUTINE print_time( tprint, texit, timeform_ , timernl_ , timerho_ , &
|
||||
timevof_ , timerd_ , timeorto_ , timeloop_ , timing )
|
||||
|
||||
USE potentials, ONLY: print_vofrho_time
|
||||
USE stress, ONLY: print_stress_time
|
||||
USE printout_base, ONLY: pprefix
|
||||
|
||||
IMPLICIT NONE
|
||||
|
||||
REAL(DP) :: timeform_ , timernl_ , timerho_ , timevof_ , timerd_
|
||||
REAL(DP) :: timeorto_ , timeloop_
|
||||
LOGICAL, INTENT(IN) :: timing, tprint, texit
|
||||
|
||||
REAL(DP) :: timeav
|
||||
REAL(DP), SAVE :: timesum = 0.0d0
|
||||
INTEGER, SAVE :: index = 0
|
||||
CHARACTER(LEN=256) :: file_name
|
||||
|
||||
timeform = timeform + timeform_
|
||||
timernl = timernl + timernl_
|
||||
timerho = timerho + timerho_
|
||||
timevof = timevof + timevof_
|
||||
timerd = timerd + timerd_
|
||||
timeorto = timeorto + timeorto_
|
||||
timeloop = timeloop + timeloop_
|
||||
timecnt = timecnt + 1
|
||||
|
||||
! IF( timing .AND. ( tprint .OR. texit ) ) THEN
|
||||
IF( timing ) THEN
|
||||
|
||||
IF( ionode ) THEN
|
||||
|
||||
file_name = trim(pprefix)//'.tmv'
|
||||
CALL open_and_append( opt_unit, file_name )
|
||||
IF( index == 0 ) WRITE( opt_unit, 940 )
|
||||
CALL print_vofrho_time( opt_unit )
|
||||
CLOSE( opt_unit )
|
||||
940 FORMAT(' ESR FWFFT XC HAR INVFFT STRESS TOT')
|
||||
|
||||
file_name = trim(pprefix)//'.tms'
|
||||
CALL open_and_append( opt_unit, file_name )
|
||||
IF( index == 0 ) WRITE( opt_unit, 920 )
|
||||
CALL print_stress_time( opt_unit )
|
||||
CLOSE( opt_unit )
|
||||
920 FORMAT(' EK EXC ESR EH EL ENL TOT')
|
||||
|
||||
file_name = trim(pprefix)//'.tml'
|
||||
CALL open_and_append( opt_unit, file_name )
|
||||
IF( index == 0 ) WRITE( opt_unit, 910 )
|
||||
IF( timecnt > 0 ) THEN
|
||||
timeform = timeform / timecnt
|
||||
timernl = timernl / timecnt
|
||||
timerho = timerho / timecnt
|
||||
timevof = timevof / timecnt
|
||||
timerd = timerd / timecnt
|
||||
timeorto = timeorto / timecnt
|
||||
timeloop = timeloop / timecnt
|
||||
WRITE( opt_unit, 999 ) TIMEFORM, TIMERNL, TIMERHO, TIMEVOF, TIMERD, TIMEORTO, TIMELOOP
|
||||
999 FORMAT(7(F9.3))
|
||||
END IF
|
||||
CLOSE( opt_unit )
|
||||
910 FORMAT(' FORM NLRH RHOOFR VOFRHO FORCE ORTHO LOOP')
|
||||
|
||||
index = index + 1
|
||||
timesum = timesum + timeloop
|
||||
|
||||
END IF
|
||||
|
||||
timeform = 0.0d0
|
||||
timernl = 0.0d0
|
||||
timerho = 0.0d0
|
||||
timevof = 0.0d0
|
||||
timerd = 0.0d0
|
||||
timeorto = 0.0d0
|
||||
timeloop = 0.0d0
|
||||
timecnt = 0
|
||||
|
||||
END IF
|
||||
|
||||
IF ( texit ) THEN
|
||||
|
||||
IF( index > 0 ) timeav = timesum / DBLE( MAX( index, 1 ) )
|
||||
|
||||
IF (ionode) THEN
|
||||
WRITE( stdout,*)
|
||||
WRITE( stdout, fmt='(3X,"Execution time statistics (SEC)")')
|
||||
WRITE( stdout, fmt='(3X,"Mean time for MD step ..",F12.3)') timeav
|
||||
END IF
|
||||
|
||||
CALL print_clock( 'fft' )
|
||||
CALL print_clock( 'ffts' )
|
||||
CALL print_clock( 'fftw' )
|
||||
CALL print_clock( 'fftb' )
|
||||
|
||||
ENDIF
|
||||
|
||||
RETURN
|
||||
END SUBROUTINE print_time
|
||||
|
||||
|
||||
!=----------------------------------------------------------------------------=!
|
||||
|
||||
|
||||
SUBROUTINE print_sfac( rhoe, sfac )
|
||||
|
||||
USE mp_global, ONLY: me_image, nproc_image, intra_image_comm
|
||||
|
|
|
@ -493,7 +493,6 @@ MODULE from_restart_module
|
|||
USE energies, ONLY : dft_energy_type
|
||||
USE cell_module, ONLY : boxdimensions, gethinv, alat
|
||||
USE cell_base, ONLY : r_to_s, s_to_r
|
||||
USE print_out_module, ONLY : printmain
|
||||
USE nl, ONLY : nlrh_m
|
||||
USE potentials, ONLY : vofrhos
|
||||
USE forces, ONLY : dforce_all
|
||||
|
|
|
@ -157,8 +157,9 @@
|
|||
nr2sx = nr2s
|
||||
nr3sx = good_fft_dimension(nr3s)
|
||||
|
||||
IF ( nr1s > nr1 .or. nr2s > nr2 .or. nr3s > nr3 ) &
|
||||
CALL errore(' realspace_grids_init ', ' smooth grid larger than dense grid?',1)
|
||||
IF ( nr1s > nr1 .or. nr2s > nr2 .or. nr3s > nr3 ) THEN
|
||||
CALL errore(' realspace_grids_init ', ' smooth grid larger than dense grid?',1)
|
||||
END IF
|
||||
|
||||
IF( nr1b < 1 ) nr1b = 1
|
||||
IF( nr2b < 1 ) nr2b = 1
|
||||
|
@ -178,7 +179,7 @@
|
|||
nr3bl = nr3b
|
||||
|
||||
IF ( nr1b > nr1 .or. nr2b > nr2 .or. nr3b > nr3 ) THEN
|
||||
CALL errore(' realspace_grids_init ', ' box grid larger than dense grid?',1)
|
||||
CALL errore(' realspace_grids_init ', ' box grid larger than dense grid?',1)
|
||||
END IF
|
||||
|
||||
RETURN
|
||||
|
|
|
@ -109,13 +109,14 @@ MODULE input_parameters
|
|||
! 'smd' = String Method search of the Minimum Energy Path (MEP)
|
||||
! 'cp-wf' = Car-Parrinello with wannier functions
|
||||
! 'fpmd' = Compatibility with the old FPMD code
|
||||
! 'fpmd-neb' = NEB using fpmd as scf engine
|
||||
! 'metadyn' = meta-dynamics (Laio-Parrinello dynamics)
|
||||
|
||||
|
||||
CHARACTER(LEN=80) :: calculation_allowed(15)
|
||||
CHARACTER(LEN=80) :: calculation_allowed(16)
|
||||
DATA calculation_allowed / 'scf', 'nscf', 'relax', 'md', 'cp', &
|
||||
'vc-relax', 'vc-md', 'vc-cp', 'phonon', 'bands', 'neb', 'smd', &
|
||||
'cp-wf', 'fpmd', 'metadyn' /
|
||||
'cp-wf', 'fpmd', 'metadyn', 'fpmd-neb' /
|
||||
! Allowed value for calculation parameters
|
||||
|
||||
|
||||
|
|
|
@ -1344,7 +1344,7 @@ MODULE read_namelists_module
|
|||
CALL errore( sub_name, ' opt_scheme '''// &
|
||||
& TRIM( opt_scheme )//''' not allowed ', 1 )
|
||||
!
|
||||
IF ( calculation == 'neb' .OR. calculation == 'smd' ) THEN
|
||||
IF ( calculation == 'neb' .OR. calculation == 'smd' .OR. calculation == 'fpmd-neb' ) THEN
|
||||
!
|
||||
IF ( phase_space == 'coarse-grained' ) THEN
|
||||
!
|
||||
|
@ -1571,6 +1571,14 @@ MODULE read_namelists_module
|
|||
!
|
||||
END IF
|
||||
!
|
||||
CASE ( 'fpmd-neb' )
|
||||
!
|
||||
! ... "path" optimizations using fpmd as scf engine
|
||||
!
|
||||
electron_dynamics = 'damp'
|
||||
ion_dynamics = 'none'
|
||||
cell_dynamics = 'none'
|
||||
!
|
||||
CASE ( 'smd' )
|
||||
!
|
||||
IF( prog == 'CP' ) THEN
|
||||
|
@ -1755,6 +1763,7 @@ MODULE read_namelists_module
|
|||
TRIM( calculation ) == 'cp-wf' .OR. &
|
||||
TRIM( calculation ) == 'neb' .OR. &
|
||||
TRIM( calculation ) == 'fpmd' .OR. &
|
||||
TRIM( calculation ) == 'fpmd-neb' .OR. &
|
||||
TRIM( calculation ) == 'metadyn' ) READ( 5, ions, iostat = ios )
|
||||
!
|
||||
END IF
|
||||
|
@ -1775,6 +1784,7 @@ MODULE read_namelists_module
|
|||
TRIM( calculation ) == 'vc-cp' .OR. &
|
||||
TRIM( calculation ) == 'vc-md' .OR. &
|
||||
TRIM( calculation ) == 'fpmd' .OR. &
|
||||
TRIM( calculation ) == 'fpmd-neb' .OR. &
|
||||
TRIM( calculation ) == 'vc-md' ) THEN
|
||||
READ( 5, cell, iostat = ios )
|
||||
END IF
|
||||
|
|
Loading…
Reference in New Issue