29 #include "../base/base_uses.f90"
40 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'pint_pile'
53 TYPE(pile_therm_type),
INTENT(OUT) :: pile_therm
54 TYPE(pint_env_type),
INTENT(INOUT) :: pint_env
55 TYPE(normalmode_env_type),
POINTER :: normalmode_env
56 TYPE(section_vals_type),
POINTER :: section
58 CHARACTER(LEN=rng_record_length) :: rng_record
59 INTEGER :: i, i_propagator, j, p
61 REAL(kind=
dp) :: dti2, ex
62 REAL(kind=
dp),
DIMENSION(3, 2) :: initial_seed
63 TYPE(section_vals_type),
POINTER :: pint_section, rng_section
65 pint_env%e_pile = 0.0_dp
66 pile_therm%thermostat_energy = 0.0_dp
75 pile_therm%tau = 0.0_dp
79 dti2 = 0.5_dp*pint_env%dt
80 ALLOCATE (pile_therm%c1(p))
81 ALLOCATE (pile_therm%c2(p))
82 ALLOCATE (pile_therm%g_fric(p))
83 ALLOCATE (pile_therm%massfact(p, pint_env%ndim))
87 IF (pile_therm%tau <= 0.0_dp)
THEN
88 pile_therm%g_fric(1) = 0.0_dp
90 pile_therm%g_fric(1) = 1.0_dp/pile_therm%tau
93 pile_therm%g_fric(i) = 2.0_dp*pile_therm%lamb*sqrt(normalmode_env%lambda(i))
96 ex = -dti2*pile_therm%g_fric(i)
97 pile_therm%c1(i) = exp(ex)
98 ex = pile_therm%c1(i)*pile_therm%c1(i)
99 pile_therm%c2(i) = sqrt(1.0_dp - ex)
101 DO j = 1, pint_env%ndim
103 pile_therm%massfact(i, j) = sqrt(pint_env%kT/pint_env%mass_fict(i, j))
108 NULLIFY (rng_section)
110 subsection_name=
"RNG_INIT")
114 i_rep_val=1, c_val=rng_record)
118 initial_seed(:, :) = real(pint_env%thermostat_rng_seed,
dp)
119 pile_therm%gaussian_rng_stream = rng_stream_type( &
120 name=
"pile_rng_gaussian", distribution_type=
gaussian, &
121 extended_precision=.true., &
138 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: vold, vnew
139 INTEGER,
INTENT(IN) :: p, ndim, first_mode
140 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: masses
141 TYPE(pile_therm_type),
POINTER :: pile_therm
143 CHARACTER(len=*),
PARAMETER :: routinen =
'pint_pile_step'
145 INTEGER :: handle, ibead, idim
146 REAL(kind=
dp) :: delta_ekin
148 CALL timeset(routinen, handle)
151 DO ibead = first_mode, p
152 vnew(ibead, idim) = pile_therm%c1(ibead)*vold(ibead, idim) + &
153 pile_therm%massfact(ibead, idim)*pile_therm%c2(ibead)* &
154 pile_therm%gaussian_rng_stream%next()
155 delta_ekin = delta_ekin + masses(ibead, idim)*( &
156 vnew(ibead, idim)*vnew(ibead, idim) - &
157 vold(ibead, idim)*vold(ibead, idim))
160 pile_therm%thermostat_energy = pile_therm%thermostat_energy - 0.5_dp*delta_ekin
162 CALL timestop(handle)
172 TYPE(pile_therm_type),
INTENT(INOUT) :: pile_therm
174 DEALLOCATE (pile_therm%c1)
175 DEALLOCATE (pile_therm%c2)
176 DEALLOCATE (pile_therm%g_fric)
177 DEALLOCATE (pile_therm%massfact)
187 TYPE(pint_env_type),
INTENT(INOUT) :: pint_env
189 IF (
ASSOCIATED(pint_env%pile_therm))
THEN
190 pint_env%e_pile = pint_env%pile_therm%thermostat_energy
Defines the basic variable types.
integer, parameter, public dp
Parallel (pseudo)random number generator (RNG) for multiple streams and substreams of random numbers.
type(rng_stream_type) function, public rng_stream_type_from_record(rng_record)
Create a RNG stream from a record given as an internal file (string).
integer, parameter, public rng_record_length
integer, parameter, public gaussian
Methods to apply a simple Lagevin thermostat to PI runs. v_new = c1*vold + SQRT(kT/m)*c2*random.
subroutine, public pint_pile_step(vold, vnew, p, ndim, first_mode, masses, pile_therm)
...
subroutine, public pint_pile_init(pile_therm, pint_env, normalmode_env, section)
initializes the data for a pile run
subroutine, public pint_pile_release(pile_therm)
releases the pile environment
subroutine, public pint_calc_pile_energy(pint_env)
returns the pile kinetic energy contribution