TABLE OF CONTENTS
ABINIT/dfpt_etot [ Functions ]
NAME
dfpt_etot
FUNCTION
Assemble different contributions to the variational part of the 2nd derivative of total energy
COPYRIGHT
Copyright (C) 1999-2018 ABINIT group (XG, DRH, MT) This file is distributed under the terms of the GNU General Public License, see ~abinit/COPYING or http://www.gnu.org/copyleft/gpl.txt . For the initials of contributors, see ~abinit/doc/developers/contributors.txt .
INPUTS
berryopt= 4/14: electric field is on; berryopt = 6/7/16/17: electric displacement field is on; eberry=energy associated with Berry phase edocc=correction to 2nd-order total energy coming from changes of occupation ehart1=1st-order Hartree part of 2nd-order total energy eeig0=0th-order eigenenergies part of 2nd-order total energy eew=2nd derivative of Ewald energy (hartree) efrhar=contrib. from frozen-wavefunction, hartree energy, to the 2nd-derivative of total energy efrkin=contrib. from frozen-wavefunction, kinetic energy, to the 2nd-derivative of total energy efrloc=contrib. from frozen-wavefunction, local potential, to the 2nd-derivative of total energy efrnl=contribution from frozen-wavefunction, non-local potential, to the 2nd-derivative of total energy efrx1=contrib. from frozen-wavefunction, xc core correction(1), to the 2nd-derivative of total energy efrx2=contribution from frozen-wavefunction, xc core correction(2), to the second-derivative of total energy. ek0=0th-order kinetic energy part of 2nd-order total energy. ek1=1st-order kinetic energy part of 2nd-order total energy. eii=2nd derivative of pseudopotential core energy (hartree) eloc0=0th-order local (psp+vxc+Hart) part of 2nd-order total energy elpsp1=1st-order local pseudopot. part of 2nd-order total energy. enl0=0th-order nonlocal pseudopot. part of 2nd-order total energy. enl1=1st-order nonlocal pseudopot. part of 2nd-order total energy. epaw1=1st-order PAW on-sitew part of 2nd-order total energy. evdw=DFT-D semi-empirical part of 2nd-order total energy exc1=1st-order exchange-correlation part of 2nd-order total energy ipert=type of the perturbation natom=number of atoms optene=option for the computation of 2nd-order total energy (-1=no computation; 0=direct scheme; 1=double-counting scheme)
OUTPUT
deltae=change in energy between the previous and present SCF cycle and previous SCF cycle. etotal=2nd-order total energy evar=variational part of the 2nd-order total energy
SIDE EFFECTS
input/output elast=previous value of the 2nd-order total energy, needed to compute deltae, then updated (cannot simply be saved, because set to zero at each new call of dfpt_scfcv).
PARENTS
dfpt_scfcv
CHILDREN
SOURCE
65 #if defined HAVE_CONFIG_H 66 #include "config.h" 67 #endif 68 69 #include "abi_common.h" 70 71 72 subroutine dfpt_etot(berryopt,deltae,eberry,edocc,eeig0,eew,efrhar,efrkin,efrloc,& 73 & efrnl,efrx1,efrx2,ehart1,ek0,ek1,eii,elast,eloc0,elpsp1,& 74 & enl0,enl1,epaw1,etotal,evar,evdw,exc1,ipert,natom,optene) 75 76 use defs_basis 77 use m_profiling_abi 78 use m_errors 79 80 !This section has been created automatically by the script Abilint (TD). 81 !Do not modify the following lines by hand. 82 #undef ABI_FUNC 83 #define ABI_FUNC 'dfpt_etot' 84 !End of the abilint section 85 86 implicit none 87 88 !Arguments ------------------------------------ 89 !scalars 90 integer,intent(in) :: berryopt,ipert,natom,optene 91 real(dp),intent(in) :: eberry,edocc,eeig0,eew,efrhar,efrkin,efrloc,efrnl,efrx1 92 real(dp),intent(in) :: efrx2,ehart1,eii,ek0,ek1,eloc0,elpsp1,enl0,enl1,epaw1 93 real(dp),intent(in) :: evdw,exc1 94 real(dp),intent(inout) :: elast 95 real(dp),intent(out) :: deltae,etotal,evar 96 97 !Local variables------------------------------- 98 !scalars 99 character(len=500) :: message 100 101 ! ********************************************************************* 102 103 if (optene==1) then 104 message = 'Double-counting scheme not yet allowed !' 105 MSG_BUG(message) 106 end if 107 108 if (optene>-1) then 109 110 ! Compute 2nd-order variational energy by direct scheme 111 if (optene==0) then 112 113 ! Atomic displ. perturbation 114 if ( ipert>=1 .and. ipert<=natom ) then 115 evar=ek0+edocc+eeig0+eloc0+elpsp1+ehart1+exc1+enl0+enl1+epaw1 116 117 else if (ipert==natom+1) then 118 evar=ek0+edocc+eeig0+eloc0+ek1+ehart1+exc1+enl0+enl1 119 120 else if (ipert==natom+10 .or. ipert==natom+11) then 121 evar=ek0+edocc+eeig0+eloc0+enl0+ek1 ! here ek1 contains a lot of contributions 122 123 ! For ipert==natom+2, some contributions vanishes, noticeably ek1 124 else if (ipert==natom+2) then 125 evar=ek0+edocc+eeig0+eloc0+ek1+ehart1+exc1+enl0+enl1+epaw1 126 127 ! All terms enter for strain perturbation 128 else if ( ipert==natom+3 .or. ipert==natom+4 ) then 129 evar=ek0+ek1+edocc+eeig0+eloc0+elpsp1+ehart1+exc1+enl0+enl1+epaw1 130 131 ! terms for Zeeman perturbation, SPr 2deb 132 else if ( ipert==natom+5 ) then 133 evar=ek0+edocc+eeig0+eloc0+ehart1+exc1+enl0+epaw1 134 end if 135 end if 136 137 ! Compute energy residual 138 deltae=evar-elast 139 elast=evar 140 141 ! Compute 2nd-order total energy by direct scheme 142 if (optene==0) then 143 if (berryopt==4 .or. berryopt==6 .or. berryopt==7 .or. berryopt==14 .or. berryopt==16 .or. berryopt==17) then 144 if (ipert<=natom) then 145 etotal=evar+eew+evdw+eii+efrhar+efrkin+efrloc+efrnl+efrx1+efrx2+two*eberry 146 else if (ipert==natom+2) then 147 etotal=half*evar+eew+evdw+eii+efrhar+efrkin+efrloc+efrnl+efrx1+efrx2+two*eberry 148 end if 149 else 150 if (ipert/=natom+10 .and. ipert/=natom+11) then 151 etotal=evar+eew+evdw+eii+efrhar+efrkin+efrloc+efrnl+efrx1+efrx2 152 else 153 etotal=evar ! For 2nd order sternheimer equations, the total (4th order) energy is not used (yet) 154 end if 155 end if 156 end if 157 158 end if 159 160 end subroutine dfpt_etot