CP2K 2.4 (Revision 12889)

physcon.f90

Go to the documentation of this file.
00001 !-----------------------------------------------------------------------------!
00002 !   CP2K: A general program to perform molecular dynamics simulations         !
00003 !   Copyright (C) 2000 - 2013  CP2K developers group                          !
00004 !-----------------------------------------------------------------------------!
00005 
00006 ! *****************************************************************************
00062 MODULE physcon
00063 
00064   USE f77_blas
00065   USE kinds,                           ONLY: dp
00066   USE mathconstants,                   ONLY: pi
00067   USE periodic_table,                  ONLY: init_periodic_table
00068 
00069   IMPLICIT NONE
00070 
00071   PRIVATE
00072 
00073   INTEGER, PARAMETER :: maxmom = 3
00074 
00075   REAL(KIND = dp) :: a_bohr,a_fine,a_mass,angstrom,atm,bar,bohr,boltzmann,
00076                      c_light,debye,e_charge,e_gfactor,e_mass,evolt,
00077                      femtoseconds,h_bar,h_planck,hertz,joule,kcalmol,kelvin,
00078                      kjmol,massunit,mu_perm,n_avogadro,p_mass,pascal,permittivity,
00079                      picoseconds,rydberg,seconds,vibfac,wavenumbers
00080 
00081   REAL(KIND = dp), DIMENSION(maxmom) :: esu
00082 
00083   PUBLIC :: a_bohr,a_fine,a_mass,angstrom,atm,bar,bohr,boltzmann,c_light,&
00084             debye,e_charge,e_gfactor,e_mass,evolt,femtoseconds,h_bar,h_planck,&
00085             hertz,joule,kcalmol,kelvin,kjmol,massunit,mu_perm,n_avogadro,&
00086             p_mass,pascal,permittivity,picoseconds,rydberg,seconds,vibfac,wavenumbers
00087 
00088   PUBLIC :: init_physcon,&
00089             write_physcon
00090 
00091 CONTAINS
00092 
00093 ! *****************************************************************************
00105   SUBROUTINE init_physcon()
00106 
00107     INTEGER                                  :: i
00108 
00109 ! Exact constants
00110 ! Speed of light in vacuum [m/s]
00111 
00112     c_light = 299792458.0_dp
00113 
00114     ! Magnetic constant or permeability of vacuum [N/A**2]
00115     mu_perm = 4.0_dp*pi*1.0E-7_dp
00116 
00117     ! Electric constant or permittivity of vacuum [F/m]
00118     permittivity = 1.0_dp/(mu_perm*c_light**2)
00119 
00120 #define CODATA_DEFAULT_VERSION 2006
00121 
00122 #if !defined CODATA_VERSION
00123 #define CODATA_VERSION CODATA_DEFAULT_VERSION
00124 #endif
00125 
00126 #if CODATA_VERSION != 1998 && CODATA_VERSION != 2006 && CODATA_VERSION != 2010
00127 #define CODATA_VERSION CODATA_DEFAULT_VERSION
00128 #endif
00129 
00130 #if CODATA_VERSION == 1998
00131     ! Recommended fundamental constants of physics
00132     ! and chemistry based on the 1998 adjustment
00133 
00134     ! Planck constant [J*s]
00135     h_planck = 6.62606876E-34_dp
00136     h_bar = h_planck/(2.0_dp*pi)
00137 
00138     ! Elementary charge [C]
00139     e_charge = 1.602176462E-19_dp
00140 
00141     ! Electron mass [kg]
00142     e_mass = 9.10938188E-31_dp
00143 
00144     ! Proton mass [kg]
00145     p_mass = 1.67262158Eā27_dp
00146 
00147     ! Electron g factor [ ]
00148     e_gfactor = -2.0023193043718_dp
00149 
00150     ! Fine-structure constant
00151 !MK a_fine = 0.5_dp*mu_perm*c_light*e_charge**2/h_planck
00152     a_fine = 7.297352533E-3_dp
00153 
00154     ! Rydberg constant [1/m]
00155 !MK rydberg = 0.5_dp*e_mass*c_light*a_fine**2/h_planck
00156     rydberg = 10973731.568549_dp
00157 
00158     ! Avogadro constant [1/mol]
00159     n_avogadro = 6.02214199E+23_dp
00160 
00161     ! Boltzmann constant [J/K]
00162     boltzmann = 1.3806503E-23_dp
00163 
00164     ! Atomic mass unit [kg]; conversion factor [u] -> [kg]
00165     a_mass = 1.66053873E-27_dp
00166 
00167     ! Bohr radius [m]
00168 !MK a_bohr = a_fine/(4.0_dp*pi*rydberg)
00169     a_bohr = 0.5291772083E-10_dp
00170 #endif
00171 
00172 #if CODATA_VERSION == 2006
00173     ! Recommended fundamental constants of physics
00174     ! and chemistry based on the 2006 adjustment
00175 
00176     ! Planck constant [J*s]
00177     h_planck = 6.62606896E-34_dp
00178     h_bar = h_planck/(2.0_dp*pi)
00179 
00180     ! Elementary charge [C]
00181     e_charge = 1.602176487E-19_dp
00182 
00183     ! Electron mass [kg]
00184     e_mass = 9.10938215E-31_dp
00185 
00186     ! Proton mass [kg]
00187     p_mass = 1.672621637E-27_dp
00188 
00189     ! Electron g factor [ ]
00190     e_gfactor = -2.0023193043622_dp
00191 
00192     ! Fine-structure constant
00193 !MK a_fine = 0.5_dp*mu_perm*c_light*e_charge**2/h_planck
00194     a_fine = 7.2973525376E-3_dp
00195 
00196     ! Rydberg constant [1/m]
00197 !MK rydberg = 0.5_dp*e_mass*c_light*a_fine**2/h_planck
00198     rydberg = 10973731.568527_dp
00199 
00200     ! Avogadro constant [1/mol]
00201     n_avogadro = 6.02214179E+23_dp
00202 
00203     ! Boltzmann constant [J/K]
00204     boltzmann = 1.3806504E-23_dp
00205 
00206     ! Atomic mass unit [kg]; conversion factor [u] -> [kg]
00207     a_mass = 1.660538782E-27_dp
00208 
00209     ! Bohr radius [m]
00210 !MK a_bohr = a_fine/(4.0_dp*pi*rydberg)
00211     a_bohr = 0.52917720859E-10_dp
00212 #endif
00213 
00214 #if CODATA_VERSION == 2010
00215     ! Recommended fundamental constants of physics
00216     ! and chemistry based on the 2010 adjustment
00217 
00218     ! Planck constant [J*s]
00219     h_planck = 6.62606957E-34_dp
00220     h_bar = h_planck/(2.0_dp*pi)
00221 
00222     ! Elementary charge [C]
00223     e_charge = 1.602176565E-19_dp
00224 
00225     ! Electron mass [kg]
00226     e_mass = 9.10938291E-31_dp
00227 
00228     ! Proton mass [kg]
00229     p_mass = 1.672621777E-27_dp
00230 
00231     ! Electron g factor [ ]
00232     e_gfactor = -2.00231930436153_dp
00233 
00234     ! Fine-structure constant
00235 !MK a_fine = 0.5_dp*mu_perm*c_light*e_charge**2/h_planck
00236     a_fine = 7.2973525698E-3_dp
00237 
00238     ! Rydberg constant [1/m]
00239 !MK rydberg = 0.5_dp*e_mass*c_light*a_fine**2/h_planck
00240     rydberg = 10973731.568539_dp
00241 
00242     ! Avogadro constant [1/mol]
00243     n_avogadro = 6.02214129E+23_dp
00244 
00245     ! Boltzmann constant [J/K]
00246     boltzmann = 1.3806488E-23_dp
00247 
00248     ! Atomic mass unit [kg]; conversion factor [u] -> [kg]
00249     a_mass = 1.660538921E-27_dp
00250 
00251     ! Bohr radius [m]
00252 !MK a_bohr = a_fine/(4.0_dp*pi*rydberg)
00253     a_bohr = 0.52917721092E-10_dp
00254 #endif
00255 
00256     ! Conversion factors
00257 
00258     ! [u] -> [a.u.]
00259     massunit = a_mass/e_mass
00260 
00261     ! [Bohr] -> [Angstrom]
00262     angstrom = 1.0E+10_dp*a_bohr
00263 
00264     ! [Angstrom] -> [Bohr]
00265     bohr = 1.0_dp/angstrom
00266 
00267     ! [a.u.] -> [s]
00268     seconds = 1.0_dp/(4.0_dp*pi*rydberg*c_light)
00269 
00270     ! [a.u.] -> [fs]
00271     femtoseconds = 1.0E+15_dp*seconds
00272 
00273     ! [a.u.] -> [ps]
00274     picoseconds = 1.0E+12_dp*seconds
00275 
00276     ! [a.u.] -> [J]
00277     joule = 2.0_dp*rydberg*h_planck*c_light
00278 
00279     ! [a.u.] -> [K]
00280     kelvin = joule/boltzmann
00281 
00282     ! [a.u.] -> [kJ/mol]
00283     kjmol = 0.001_dp*joule*n_avogadro
00284 
00285     ! [a.u.] -> [kcal/mol]
00286     kcalmol = kjmol/4.184_dp
00287 
00288     ! [a.u.] -> [Pa]
00289     pascal = joule/a_bohr**3
00290 
00291     ! [a.u.] -> [bar]
00292     bar = pascal/1.0E+5_dp
00293 
00294     ! [a.u.] -> [atm]
00295     atm = pascal/1.013250E+5_dp
00296 
00297     ! [a.u.] -> [eV]
00298     evolt = joule/e_charge
00299 
00300     ! [a.u.] -> [Hz]
00301     hertz = joule/h_planck
00302 
00303     ! [a.u./Bohr**2] -> [1/cm] (wave numbers)
00304     vibfac = 5.0_dp*SQRT(kjmol)/(pi*a_bohr*c_light)
00305 
00306     ! [a.u.] -> [1/cm] (wave numbers)
00307     wavenumbers = 0.02_dp*rydberg
00308 
00309     ! [a.u.] -> [esu] (electrostatic units)
00310     esu(1) = 1.0E+21_dp*a_bohr*c_light*e_charge
00311     DO i=2,maxmom
00312       esu(i) = esu(i-1)/bohr
00313     END DO
00314 
00315     ! [a.u.] -> [debye] (electrostatic units)
00316     Debye = esu(1)
00317 
00318     ! Initialize the periodic table
00319     CALL init_periodic_table()
00320 
00321   END SUBROUTINE init_physcon
00322 
00323 ! *****************************************************************************
00333   SUBROUTINE write_physcon(output_unit)
00334 
00335     INTEGER, INTENT(IN) :: output_unit
00336 
00337 #if CODATA_VERSION == 1998
00338     WRITE (UNIT=output_unit,FMT="(T2,/,T2,A,/,/,(T2,A))")&
00339       "*** Fundamental physical constants (SI units) ***",&
00340       "*** Literature: B. J. Mohr and B. N. Taylor,",&
00341       "***             CODATA recommended values of the fundamental physical",&
00342       "***             constants: 1998, Rev. Mod. Phys. 72(2), 351 (2000)"
00343 #endif
00344 
00345 #if CODATA_VERSION == 2006
00346     WRITE (UNIT=output_unit,FMT="(T2,/,T2,A,/,/,(T2,A))")&
00347       "*** Fundamental physical constants (SI units) ***",&
00348       "*** Literature: B. J. Mohr and B. N. Taylor,",&
00349       "***             CODATA recommended values of the fundamental physical",&
00350       "***             constants: 2006, Web Version 5.1",&
00351       "***             http://physics.nist.gov/constants"
00352 #endif
00353 
00354 #if CODATA_VERSION == 2010
00355     WRITE (UNIT=output_unit,FMT="(T2,/,T2,A,/,/,(T2,A))")&
00356       "*** Fundamental physical constants (SI units) ***",&
00357       "*** Literature: P. J. Mohr, B. N. Taylor, and D. B. Newell,",&
00358       "***             CODATA recommended values of the fundamental physical",&
00359       "***             constants: 2010, Rev. Mod. Phys. 84, 1527-1605 (2012)"
00360 #endif
00361 
00362     WRITE (UNIT=output_unit,FMT="(/,T2,A,T61,ES20.14)")&
00363       "Speed of light in vacuum [m/s]",c_light
00364     WRITE (UNIT=output_unit,FMT="(T2,A,T61,ES20.14)")&
00365       "Magnetic constant or permeability of vacuum [N/A**2]",mu_perm
00366     WRITE (UNIT=output_unit,FMT="(T2,A,T61,ES20.14)")&
00367       "Electric constant or permittivity of vacuum [F/m]",permittivity
00368     WRITE (UNIT=output_unit,FMT="(T2,A,T61,ES20.14)")&
00369       "Planck constant (h) [J*s]",h_planck
00370     WRITE (UNIT=output_unit,FMT="(T2,A,T61,ES20.14)")&
00371       "Planck constant (h-bar) [J*s]",h_bar
00372     WRITE (UNIT=output_unit,FMT="(T2,A,T61,ES20.14)")&
00373       "Elementary charge [C]",e_charge
00374     WRITE (UNIT=output_unit,FMT="(T2,A,T61,ES20.14)")&
00375       "Electron mass [kg]",e_mass
00376     WRITE (UNIT=output_unit,FMT="(T2,A,T60,ES21.14)")&
00377       "Electron g factor [ ]",e_gfactor
00378     WRITE (UNIT=output_unit,FMT="(T2,A,T61,ES20.14)")&
00379       "Proton mass [kg]",p_mass
00380     WRITE (UNIT=output_unit,FMT="(T2,A,T61,ES20.14)")&
00381       "Fine-structure constant",a_fine
00382     WRITE (UNIT=output_unit,FMT="(T2,A,T61,ES20.14)")&
00383       "Rydberg constant [1/m]",rydberg
00384     WRITE (UNIT=output_unit,FMT="(T2,A,T61,ES20.14)")&
00385       "Avogadro constant [1/mol]",n_avogadro
00386     WRITE (UNIT=output_unit,FMT="(T2,A,T61,ES20.14)")&
00387       "Boltzmann constant [J/K]",boltzmann
00388     WRITE (UNIT=output_unit,FMT="(T2,A,T61,ES20.14)")&
00389       "Atomic mass unit [kg]",a_mass
00390     WRITE (UNIT=output_unit,FMT="(T2,A,T61,ES20.14)")&
00391       "Bohr radius [m]",a_bohr
00392 
00393     ! Conversion factors
00394 
00395     WRITE (UNIT=output_unit,FMT="(/,T2,A,/)")&
00396       "*** Conversion factors ***"
00397 
00398     WRITE (UNIT=output_unit,FMT="(T2,A,T61,ES20.14)")&
00399       "[u] -> [a.u.]",massunit,&
00400       "[Angstrom] -> [Bohr] = [a.u.]",bohr,&
00401       "[a.u.] = [Bohr] -> [Angstrom]",angstrom,&
00402       "[a.u.] -> [s]",seconds,&
00403       "[a.u.] -> [fs]",femtoseconds,&
00404       "[a.u.] -> [J]",joule,&
00405       "[a.u.] -> [K]",kelvin,&
00406       "[a.u.] -> [kJ/mol]",kjmol,&
00407       "[a.u.] -> [kcal/mol]",kcalmol,&
00408       "[a.u.] -> [Pa]",pascal,&
00409       "[a.u.] -> [bar]",bar,&
00410       "[a.u.] -> [atm]",atm,&
00411       "[a.u.] -> [eV]",evolt,&
00412       "[a.u.] -> [Hz]",hertz,&
00413       "[a.u.] -> [1/cm] (wave numbers)",wavenumbers,&
00414       "[a.u./Bohr**2] -> [1/cm]",vibfac
00415     WRITE (UNIT=output_unit,FMT="(T2,A)") ""
00416 
00417   END SUBROUTINE write_physcon
00418 
00419 END MODULE physcon