Module cell_nose separated from cell_base and moved to CPV/

git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@7477 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
giannozz 2011-02-04 11:16:35 +00:00
parent 2b7d346620
commit f2b094c7dc
6 changed files with 153 additions and 140 deletions

View File

@ -10,6 +10,7 @@ atoms_type.o \
berryion.o \ berryion.o \
berry_phase.o \ berry_phase.o \
bforceion.o \ bforceion.o \
cell_nose.o \
cg.o \ cg.o \
cg_sub.o \ cg_sub.o \
cglib.o \ cglib.o \

142
CPV/cell_nose.f90 Normal file
View File

@ -0,0 +1,142 @@
!
! Copyright (C) 2002-2011 Quantum ESPRESSO group
! 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 .
!
!------------------------------------------------------------------------------!
MODULE cell_nose
!------------------------------------------------------------------------------!
USE kinds, ONLY : DP
!
IMPLICIT NONE
SAVE
REAL(DP) :: xnhh0(3,3) = 0.0_DP
REAL(DP) :: xnhhm(3,3) = 0.0_DP
REAL(DP) :: xnhhp(3,3) = 0.0_DP
REAL(DP) :: vnhh(3,3) = 0.0_DP
REAL(DP) :: temph = 0.0_DP ! Thermostat temperature (from input)
REAL(DP) :: fnoseh = 0.0_DP ! Thermostat frequency (from input)
REAL(DP) :: qnh = 0.0_DP ! Thermostat mass (computed)
CONTAINS
subroutine cell_nose_init( temph_init, fnoseh_init )
USE constants, ONLY: pi, au_terahertz, k_boltzmann_au
REAL(DP), INTENT(IN) :: temph_init, fnoseh_init
! set thermostat parameter for cell
qnh = 0.0_DP
temph = temph_init
fnoseh = fnoseh_init
if( fnoseh > 0.0_DP ) qnh = 2.0_DP * ( 3 * 3 ) * temph * k_boltzmann_au / &
(fnoseh*(2.0_DP*pi)*au_terahertz)**2
return
end subroutine cell_nose_init
subroutine cell_nosezero( vnhh, xnhh0, xnhhm )
real(DP), intent(out) :: vnhh(3,3), xnhh0(3,3), xnhhm(3,3)
xnhh0=0.0_DP
xnhhm=0.0_DP
vnhh =0.0_DP
return
end subroutine cell_nosezero
subroutine cell_nosevel( vnhh, xnhh0, xnhhm, delt )
implicit none
REAL(DP), intent(inout) :: vnhh(3,3)
REAL(DP), intent(in) :: xnhh0(3,3), xnhhm(3,3), delt
vnhh(:,:)=2.0_DP*(xnhh0(:,:)-xnhhm(:,:))/delt-vnhh(:,:)
return
end subroutine cell_nosevel
subroutine cell_noseupd( xnhhp, xnhh0, xnhhm, delt, qnh, temphh, temph, vnhh )
use constants, only: k_boltzmann_au
implicit none
REAL(DP), intent(out) :: xnhhp(3,3), vnhh(3,3)
REAL(DP), intent(in) :: xnhh0(3,3), xnhhm(3,3), delt, qnh, temphh(3,3), temph
integer :: i, j
do j=1,3
do i=1,3
xnhhp(i,j) = 2.0_DP*xnhh0(i,j)-xnhhm(i,j) + &
(delt**2/qnh)* k_boltzmann_au * (temphh(i,j)-temph)
vnhh(i,j) =(xnhhp(i,j)-xnhhm(i,j))/( 2.0_DP * delt )
end do
end do
return
end subroutine cell_noseupd
REAL(DP) function cell_nose_nrg( qnh, xnhh0, vnhh, temph, iforceh )
use constants, only: k_boltzmann_au
implicit none
REAL(DP) :: qnh, vnhh( 3, 3 ), temph, xnhh0( 3, 3 )
integer :: iforceh( 3, 3 )
integer :: i, j
REAL(DP) :: enij
cell_nose_nrg = 0.0_DP
do i=1,3
do j=1,3
enij = 0.5_DP*qnh*vnhh(i,j)*vnhh(i,j)+temph*k_boltzmann_au*xnhh0(i,j)
cell_nose_nrg = cell_nose_nrg + iforceh( i, j ) * enij
enddo
enddo
return
end function cell_nose_nrg
subroutine cell_nose_shiftvar( xnhhp, xnhh0, xnhhm )
! shift values of nose variables to start a new step
implicit none
REAL(DP), intent(out) :: xnhhm(3,3)
REAL(DP), intent(inout) :: xnhh0(3,3)
REAL(DP), intent(in) :: xnhhp(3,3)
xnhhm = xnhh0
xnhh0 = xnhhp
return
end subroutine cell_nose_shiftvar
SUBROUTINE cell_nose_info ( delt )
use constants, only: au_terahertz, pi
USE io_global, ONLY: stdout
USE control_flags, ONLY: tnoseh
IMPLICIT NONE
REAL(DP), INTENT (IN) :: delt
INTEGER :: nsvar
REAL(DP) :: wnoseh
IF( tnoseh ) THEN
!
IF( fnoseh <= 0.0_DP) &
CALL errore(' cell_nose_info ', ' fnoseh less than zero ', 1)
IF( delt <= 0.0_DP) &
CALL errore(' cell_nose_info ', ' delt less than zero ', 1)
wnoseh = fnoseh * ( 2.0_DP * pi ) * au_terahertz
nsvar = ( 2.0_DP * pi ) / ( wnoseh * delt )
WRITE( stdout,563) temph, nsvar, fnoseh, qnh
END IF
563 format( //, &
& 3X,'cell dynamics with nose` temperature control:', /, &
& 3X,'Kinetic energy required = ', f10.5, ' (Kelvin) ', /, &
& 3X,'time steps per nose osc. = ', i5, /, &
& 3X,'nose` frequency = ', f10.3, ' (THz) ', /, &
& 3X,'nose` mass(es) = ', 20(1X,f10.3),//)
RETURN
END SUBROUTINE cell_nose_info
!
!------------------------------------------------------------------------------!
END MODULE cell_nose
!------------------------------------------------------------------------------!

View File

@ -17,6 +17,10 @@ bforceion.o : ../Modules/ions_base.o
bforceion.o : ../Modules/kind.o bforceion.o : ../Modules/kind.o
bforceion.o : ../Modules/mp_global.o bforceion.o : ../Modules/mp_global.o
bforceion.o : ../Modules/uspp.o bforceion.o : ../Modules/uspp.o
cell_nose.o : ../Modules/constants.o
cell_nose.o : ../Modules/control_flags.o
cell_nose.o : ../Modules/io_global.o
cell_nose.o : ../Modules/kind.o
cg.o : ../Modules/electrons_base.o cg.o : ../Modules/electrons_base.o
cg.o : ../Modules/io_global.o cg.o : ../Modules/io_global.o
cg.o : ../Modules/kind.o cg.o : ../Modules/kind.o
@ -207,6 +211,7 @@ cpr.o : ../Modules/timestep.o
cpr.o : ../Modules/uspp.o cpr.o : ../Modules/uspp.o
cpr.o : ../Modules/wave_base.o cpr.o : ../Modules/wave_base.o
cpr.o : ../Modules/wavefunctions.o cpr.o : ../Modules/wavefunctions.o
cpr.o : cell_nose.o
cpr.o : cg.o cpr.o : cg.o
cpr.o : cp_autopilot.o cpr.o : cp_autopilot.o
cpr.o : cp_emass.o cpr.o : cp_emass.o
@ -362,6 +367,7 @@ fromscra.o : ../Modules/uspp.o
fromscra.o : ../Modules/wave_base.o fromscra.o : ../Modules/wave_base.o
fromscra.o : ../Modules/wavefunctions.o fromscra.o : ../Modules/wavefunctions.o
fromscra.o : atoms_type.o fromscra.o : atoms_type.o
fromscra.o : cell_nose.o
fromscra.o : cg.o fromscra.o : cg.o
fromscra.o : cp_emass.o fromscra.o : cp_emass.o
fromscra.o : cp_interfaces.o fromscra.o : cp_interfaces.o
@ -425,7 +431,6 @@ init.o : modules.o
init.o : problem_size.o init.o : problem_size.o
init.o : smallbox.o init.o : smallbox.o
init.o : smallbox_grid.o init.o : smallbox_grid.o
init.o : smallbox_gvec.o
init.o : smallbox_subs.o init.o : smallbox_subs.o
init_run.o : ../Modules/cell_base.o init_run.o : ../Modules/cell_base.o
init_run.o : ../Modules/control_flags.o init_run.o : ../Modules/control_flags.o
@ -446,6 +451,7 @@ init_run.o : ../Modules/timestep.o
init_run.o : ../Modules/uspp.o init_run.o : ../Modules/uspp.o
init_run.o : ../Modules/wavefunctions.o init_run.o : ../Modules/wavefunctions.o
init_run.o : ../Modules/xml_io_base.o init_run.o : ../Modules/xml_io_base.o
init_run.o : cell_nose.o
init_run.o : cg.o init_run.o : cg.o
init_run.o : cp_emass.o init_run.o : cp_emass.o
init_run.o : cp_interfaces.o init_run.o : cp_interfaces.o
@ -506,6 +512,7 @@ input.o : ../Modules/uspp.o
input.o : ../Modules/wave_base.o input.o : ../Modules/wave_base.o
input.o : ../Modules/xml_input.o input.o : ../Modules/xml_input.o
input.o : ../iotk/src/iotk_module.o input.o : ../iotk/src/iotk_module.o
input.o : cell_nose.o
input.o : cg.o input.o : cg.o
input.o : cp_emass.o input.o : cp_emass.o
input.o : efield.o input.o : efield.o
@ -868,6 +875,7 @@ smallbox_grid.o : ../Modules/io_global.o
smallbox_gvec.o : ../Modules/kind.o smallbox_gvec.o : ../Modules/kind.o
smallbox_subs.o : ../Modules/io_global.o smallbox_subs.o : ../Modules/io_global.o
smallbox_subs.o : ../Modules/kind.o smallbox_subs.o : ../Modules/kind.o
smallbox_subs.o : smallbox.o
smallbox_subs.o : smallbox_grid.o smallbox_subs.o : smallbox_grid.o
smallbox_subs.o : smallbox_gvec.o smallbox_subs.o : smallbox_gvec.o
spline.o : ../Modules/kind.o spline.o : ../Modules/kind.o

View File

@ -71,7 +71,7 @@ sic.o \
splinelib.o \ splinelib.o \
stick_base.o \ stick_base.o \
stick_set.o \ stick_set.o \
timestep.o \ timestep.o\
version.o \ version.o \
upf.o \ upf.o \
upf_to_internal.o \ upf_to_internal.o \

View File

@ -917,140 +917,3 @@ END FUNCTION saw
!------------------------------------------------------------------------------! !------------------------------------------------------------------------------!
END MODULE cell_base END MODULE cell_base
!------------------------------------------------------------------------------! !------------------------------------------------------------------------------!
!------------------------------------------------------------------------------!
MODULE cell_nose
!------------------------------------------------------------------------------!
USE kinds, ONLY : DP
!
IMPLICIT NONE
SAVE
REAL(DP) :: xnhh0(3,3) = 0.0_DP
REAL(DP) :: xnhhm(3,3) = 0.0_DP
REAL(DP) :: xnhhp(3,3) = 0.0_DP
REAL(DP) :: vnhh(3,3) = 0.0_DP
REAL(DP) :: temph = 0.0_DP ! Thermostat temperature (from input)
REAL(DP) :: fnoseh = 0.0_DP ! Thermostat frequency (from input)
REAL(DP) :: qnh = 0.0_DP ! Thermostat mass (computed)
CONTAINS
subroutine cell_nose_init( temph_init, fnoseh_init )
USE constants, ONLY: pi, au_terahertz, k_boltzmann_au
REAL(DP), INTENT(IN) :: temph_init, fnoseh_init
! set thermostat parameter for cell
qnh = 0.0_DP
temph = temph_init
fnoseh = fnoseh_init
if( fnoseh > 0.0_DP ) qnh = 2.0_DP * ( 3 * 3 ) * temph * k_boltzmann_au / &
(fnoseh*(2.0_DP*pi)*au_terahertz)**2
return
end subroutine cell_nose_init
subroutine cell_nosezero( vnhh, xnhh0, xnhhm )
real(DP), intent(out) :: vnhh(3,3), xnhh0(3,3), xnhhm(3,3)
xnhh0=0.0_DP
xnhhm=0.0_DP
vnhh =0.0_DP
return
end subroutine cell_nosezero
subroutine cell_nosevel( vnhh, xnhh0, xnhhm, delt )
implicit none
REAL(DP), intent(inout) :: vnhh(3,3)
REAL(DP), intent(in) :: xnhh0(3,3), xnhhm(3,3), delt
vnhh(:,:)=2.0_DP*(xnhh0(:,:)-xnhhm(:,:))/delt-vnhh(:,:)
return
end subroutine cell_nosevel
subroutine cell_noseupd( xnhhp, xnhh0, xnhhm, delt, qnh, temphh, temph, vnhh )
use constants, only: k_boltzmann_au
implicit none
REAL(DP), intent(out) :: xnhhp(3,3), vnhh(3,3)
REAL(DP), intent(in) :: xnhh0(3,3), xnhhm(3,3), delt, qnh, temphh(3,3), temph
integer :: i, j
do j=1,3
do i=1,3
xnhhp(i,j) = 2.0_DP*xnhh0(i,j)-xnhhm(i,j) + &
(delt**2/qnh)* k_boltzmann_au * (temphh(i,j)-temph)
vnhh(i,j) =(xnhhp(i,j)-xnhhm(i,j))/( 2.0_DP * delt )
end do
end do
return
end subroutine cell_noseupd
REAL(DP) function cell_nose_nrg( qnh, xnhh0, vnhh, temph, iforceh )
use constants, only: k_boltzmann_au
implicit none
REAL(DP) :: qnh, vnhh( 3, 3 ), temph, xnhh0( 3, 3 )
integer :: iforceh( 3, 3 )
integer :: i, j
REAL(DP) :: enij
cell_nose_nrg = 0.0_DP
do i=1,3
do j=1,3
enij = 0.5_DP*qnh*vnhh(i,j)*vnhh(i,j)+temph*k_boltzmann_au*xnhh0(i,j)
cell_nose_nrg = cell_nose_nrg + iforceh( i, j ) * enij
enddo
enddo
return
end function cell_nose_nrg
subroutine cell_nose_shiftvar( xnhhp, xnhh0, xnhhm )
! shift values of nose variables to start a new step
implicit none
REAL(DP), intent(out) :: xnhhm(3,3)
REAL(DP), intent(inout) :: xnhh0(3,3)
REAL(DP), intent(in) :: xnhhp(3,3)
xnhhm = xnhh0
xnhh0 = xnhhp
return
end subroutine cell_nose_shiftvar
SUBROUTINE cell_nose_info ( delt )
use constants, only: au_terahertz, pi
USE io_global, ONLY: stdout
USE control_flags, ONLY: tnoseh
IMPLICIT NONE
REAL(DP), INTENT (IN) :: delt
INTEGER :: nsvar
REAL(DP) :: wnoseh
IF( tnoseh ) THEN
!
IF( fnoseh <= 0.0_DP) &
CALL errore(' cell_nose_info ', ' fnoseh less than zero ', 1)
IF( delt <= 0.0_DP) &
CALL errore(' cell_nose_info ', ' delt less than zero ', 1)
wnoseh = fnoseh * ( 2.0_DP * pi ) * au_terahertz
nsvar = ( 2.0_DP * pi ) / ( wnoseh * delt )
WRITE( stdout,563) temph, nsvar, fnoseh, qnh
END IF
563 format( //, &
& 3X,'cell dynamics with nose` temperature control:', /, &
& 3X,'Kinetic energy required = ', f10.5, ' (Kelvin) ', /, &
& 3X,'time steps per nose osc. = ', i5, /, &
& 3X,'nose` frequency = ', f10.3, ' (THz) ', /, &
& 3X,'nose` mass(es) = ', 20(1X,f10.3),//)
RETURN
END SUBROUTINE cell_nose_info
!
!------------------------------------------------------------------------------!
END MODULE cell_nose
!------------------------------------------------------------------------------!

View File

@ -14,7 +14,6 @@ cell_base.o : constants.o
cell_base.o : control_flags.o cell_base.o : control_flags.o
cell_base.o : io_global.o cell_base.o : io_global.o
cell_base.o : kind.o cell_base.o : kind.o
cell_base.o : timestep.o
check_stop.o : input_parameters.o check_stop.o : input_parameters.o
check_stop.o : io_files.o check_stop.o : io_files.o
check_stop.o : io_global.o check_stop.o : io_global.o