1!
2! Copyright (C) 2002-2005 FPMD-CPV groups
3! This file is distributed under the terms of the
4! GNU General Public License. See the file `License'
5! in the root directory of the present distribution,
6! or http://www.gnu.org/copyleft/gpl.txt .
7!
8
9!------------------------------------------------------------------------------!
10  MODULE cp_electronic_mass
11!------------------------------------------------------------------------------!
12
13    !  This module contains variable and functions relative to the
14    !  Car-Parrinello fictitious electronic masse
15
16      USE kinds, ONLY: DP
17!
18      IMPLICIT NONE
19      SAVE
20
21      REAL(DP) :: emass        = 1.0d0    !  fictitious electronic mass ( mu )
22      REAL(DP) :: emass_cutoff = 1.0d0    !  kinetic energy cutoff for plane
23                                           !  waves to be used for Fourier acceleration
24                                           !  preconditioning
25
26!------------------------------------------------------------------------------!
27  CONTAINS
28!------------------------------------------------------------------------------!
29
30    SUBROUTINE emass_precond( ema0bg, ggp, ngw, tpiba2, emaec )
31      USE control_flags, ONLY: iverbosity
32      IMPLICIT NONE
33      REAL(DP), INTENT(OUT) :: ema0bg(:)
34      REAL(DP), INTENT(IN) :: ggp(:), tpiba2, emaec
35      INTEGER, INTENT(IN) :: ngw
36      INTEGER :: i
37      !  mass preconditioning: ema0bg(i) = ratio of emass(g=0) to emass(g)
38      !  for g**2>emaec the electron mass ema0bg(g) rises quadratically
39      do i = 1, ngw
40         ema0bg(i) = 1.0d0 / MAX( 1.d0, tpiba2 * ggp(i) / emaec )
41         IF( iverbosity > 2 ) print *,i,' ema0bg(i) ',ema0bg(i)
42      end do
43
44      RETURN
45    END SUBROUTINE emass_precond
46
47
48!------------------------------------------------------------------------------!
49  END MODULE cp_electronic_mass
50!------------------------------------------------------------------------------!
51