35 #include "../../base/base_uses.f90"
40 LOGICAL,
PARAMETER :: debug_this_module = .false.
46 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'extended_system_dynamics'
62 TYPE(lnhc_parameters_type),
POINTER :: nhc
63 TYPE(npt_info_type),
DIMENSION(:, :), &
65 TYPE(mp_comm_type),
INTENT(IN) :: group
67 CHARACTER(len=*),
PARAMETER :: routinen =
'lnhc_barostat'
70 TYPE(map_info_type),
POINTER :: map_info
72 CALL timeset(routinen, handle)
73 map_info => nhc%map_info
79 CALL do_nhc(nhc, map_info)
106 particle_set, local_molecules, group, shell_adiabatic, &
107 shell_particle_set, core_particle_set, vel, shell_vel, core_vel)
109 TYPE(lnhc_parameters_type),
POINTER :: nhc
110 TYPE(molecule_kind_type),
POINTER :: molecule_kind_set(:)
111 TYPE(molecule_type),
POINTER :: molecule_set(:)
112 TYPE(particle_type),
POINTER :: particle_set(:)
113 TYPE(distribution_1d_type),
POINTER :: local_molecules
114 TYPE(mp_comm_type),
INTENT(IN) :: group
115 LOGICAL,
INTENT(IN),
OPTIONAL :: shell_adiabatic
116 TYPE(particle_type),
OPTIONAL,
POINTER :: shell_particle_set(:), &
118 REAL(kind=
dp),
INTENT(INOUT),
OPTIONAL :: vel(:, :), shell_vel(:, :), &
121 CHARACTER(len=*),
PARAMETER :: routinen =
'lnhc_particles'
124 LOGICAL :: my_shell_adiabatic
125 TYPE(map_info_type),
POINTER :: map_info
127 CALL timeset(routinen, handle)
128 my_shell_adiabatic = .false.
129 IF (
PRESENT(shell_adiabatic)) my_shell_adiabatic = shell_adiabatic
130 map_info => nhc%map_info
134 local_molecules, molecule_set, group, vel)
137 CALL do_nhc(nhc, map_info)
141 local_molecules, my_shell_adiabatic, shell_particle_set, core_particle_set, &
142 vel, shell_vel, core_vel)
144 CALL timestop(handle)
163 SUBROUTINE lnhc_shells(nhc, atomic_kind_set, particle_set, local_particles, &
164 group, shell_particle_set, core_particle_set, vel, shell_vel, core_vel)
166 TYPE(lnhc_parameters_type),
POINTER :: nhc
167 TYPE(atomic_kind_type),
POINTER :: atomic_kind_set(:)
168 TYPE(particle_type),
POINTER :: particle_set(:)
169 TYPE(distribution_1d_type),
POINTER :: local_particles
170 TYPE(mp_comm_type),
INTENT(IN) :: group
171 TYPE(particle_type),
OPTIONAL,
POINTER :: shell_particle_set(:), &
173 REAL(kind=
dp),
INTENT(INOUT),
OPTIONAL :: vel(:, :), shell_vel(:, :), &
176 CHARACTER(len=*),
PARAMETER :: routinen =
'lnhc_shells'
179 TYPE(map_info_type),
POINTER :: map_info
181 CALL timeset(routinen, handle)
182 map_info => nhc%map_info
185 CALL ke_region_shells(map_info, particle_set, atomic_kind_set, local_particles, &
186 group, core_particle_set, shell_particle_set, core_vel, shell_vel)
189 CALL do_nhc(nhc, map_info)
193 shell_particle_set, core_particle_set, shell_vel, core_vel, vel)
195 CALL timestop(handle)
204 SUBROUTINE do_nhc(nhc, map_info)
205 TYPE(lnhc_parameters_type),
POINTER :: nhc
206 TYPE(map_info_type),
POINTER :: map_info
212 DO n = 1, nhc%loc_num_nhc
213 imap = nhc%map_info%map_index(n)
214 IF (nhc%nvt(1, n)%nkt == 0.0_dp) cycle
215 nhc%nvt(1, n)%f = (map_info%s_kin(imap) - nhc%nvt(1, n)%nkt)/nhc%nvt(1, n)%mass
219 CALL multiple_step_yoshida(nhc)
221 END SUBROUTINE do_nhc
236 com_vel, shell_vel, core_vel)
238 TYPE(atomic_kind_type),
POINTER :: atomic_kind_set(:)
239 TYPE(distribution_1d_type),
POINTER :: local_particles
240 TYPE(particle_type),
POINTER :: particle_set(:)
241 REAL(kind=
dp),
INTENT(IN) :: com_vel(:, :)
242 REAL(kind=
dp),
INTENT(INOUT) :: shell_vel(:, :), core_vel(:, :)
244 INTEGER :: iparticle, iparticle_kind, &
245 iparticle_local, nparticle_kind, &
246 nparticle_local, shell_index
248 REAL(kind=
dp) :: fac_massc, fac_masss, mass, vc(3), vs(3)
249 TYPE(atomic_kind_type),
POINTER :: atomic_kind
250 TYPE(shell_kind_type),
POINTER :: shell
252 nparticle_kind =
SIZE(atomic_kind_set)
254 DO iparticle_kind = 1, nparticle_kind
255 atomic_kind => atomic_kind_set(iparticle_kind)
257 shell_active=is_shell, shell=shell)
259 fac_masss = shell%mass_shell/mass
260 fac_massc = shell%mass_core/mass
261 nparticle_local = local_particles%n_el(iparticle_kind)
262 DO iparticle_local = 1, nparticle_local
263 iparticle = local_particles%list(iparticle_kind)%array(iparticle_local)
264 shell_index = particle_set(iparticle)%shell_index
265 vs(1:3) = shell_vel(1:3, shell_index)
266 vc(1:3) = core_vel(1:3, shell_index)
267 shell_vel(1, shell_index) = com_vel(1, iparticle) + fac_massc*(vs(1) - vc(1))
268 shell_vel(2, shell_index) = com_vel(2, iparticle) + fac_massc*(vs(2) - vc(2))
269 shell_vel(3, shell_index) = com_vel(3, iparticle) + fac_massc*(vs(3) - vc(3))
270 core_vel(1, shell_index) = com_vel(1, iparticle) + fac_masss*(vc(1) - vs(1))
271 core_vel(2, shell_index) = com_vel(2, iparticle) + fac_masss*(vc(2) - vs(2))
272 core_vel(3, shell_index) = com_vel(3, iparticle) + fac_masss*(vc(3) - vs(3))
285 SUBROUTINE multiple_step_yoshida(nhc)
287 TYPE(lnhc_parameters_type),
POINTER :: nhc
289 INTEGER :: imap, inc, inhc, iyosh, n, nx1, nx2
290 REAL(kind=
dp) :: scale
291 TYPE(map_info_type),
POINTER :: map_info
293 nx1 =
SIZE(nhc%nvt, 1)
294 nx2 =
SIZE(nhc%nvt, 2)
295 map_info => nhc%map_info
297 ncloop:
DO inc = 1, nhc%nc
298 yosh:
DO iyosh = 1, nhc%nyosh
301 nhc%nvt(nhc%nhc_len, :)%v = nhc%nvt(nhc%nhc_len, :)%v + &
302 nhc%nvt(nhc%nhc_len, :)%f*0.25_dp*nhc%dt_yosh(iyosh)*nhc%dt_fact
305 DO n = 1, nhc%loc_num_nhc
306 IF (nhc%nvt(1, n)%nkt == 0.0_dp) cycle
307 DO inhc = nhc%nhc_len - 1, 1, -1
308 scale = exp(-0.125_dp*nhc%nvt(inhc + 1, n)%v*nhc%dt_yosh(iyosh)*nhc%dt_fact)
309 nhc%nvt(inhc, n)%v = nhc%nvt(inhc, n)%v*scale
310 nhc%nvt(inhc, n)%v = nhc%nvt(inhc, n)%v + &
311 nhc%nvt(inhc, n)%f*0.25_dp*nhc%dt_yosh(iyosh)*nhc%dt_fact
312 nhc%nvt(inhc, n)%v = nhc%nvt(inhc, n)%v*scale
318 nhc%nvt(:, :)%eta = nhc%nvt(:, :)%eta + &
319 0.5_dp*nhc%nvt(:, :)%v*nhc%dt_yosh(iyosh)*nhc%dt_fact
322 DO n = 1, nhc%loc_num_nhc
323 imap = nhc%map_info%map_index(n)
324 IF (nhc%nvt(1, n)%nkt == 0.0_dp) cycle
325 map_info%v_scale(imap) = map_info%v_scale(imap)*exp(-0.5_dp*nhc%dt_yosh(iyosh)*nhc%dt_fact*nhc%nvt(1, n)%v)
330 DO n = 1, nhc%loc_num_nhc
331 imap = nhc%map_info%map_index(n)
332 IF (nhc%nvt(1, n)%nkt == 0.0_dp) cycle
333 nhc%nvt(1, n)%f = (map_info%s_kin(imap)*map_info%v_scale(imap)* &
334 map_info%v_scale(imap) - nhc%nvt(1, n)%nkt)/nhc%nvt(1, n)%mass
338 DO inhc = 1, nhc%nhc_len - 1
339 DO n = 1, nhc%loc_num_nhc
340 IF (nhc%nvt(1, n)%nkt == 0.0_dp) cycle
341 scale = exp(-0.125_dp*nhc%nvt(inhc + 1, n)%v*nhc%dt_yosh(iyosh)*nhc%dt_fact)
342 nhc%nvt(inhc, n)%v = nhc%nvt(inhc, n)%v*scale
343 nhc%nvt(inhc, n)%v = nhc%nvt(inhc, n)%v + &
344 nhc%nvt(inhc, n)%f*0.25_dp*nhc%dt_yosh(iyosh)*nhc%dt_fact
345 nhc%nvt(inhc, n)%v = nhc%nvt(inhc, n)%v*scale
349 DO n = 1, nhc%loc_num_nhc
350 IF (nhc%nvt(1, n)%nkt == 0.0_dp) cycle
351 nhc%nvt(inhc + 1, n)%f = (nhc%nvt(inhc, n)%mass*nhc%nvt(inhc, n)%v &
352 *nhc%nvt(inhc, n)%v - nhc%nvt(inhc + 1, n)%nkt)/nhc%nvt(inhc + 1, n)%mass
356 nhc%nvt(nhc%nhc_len, :)%v = nhc%nvt(nhc%nhc_len, :)%v + &
357 nhc%nvt(nhc%nhc_len, :)%f*0.25_dp*nhc%dt_yosh(iyosh)*nhc%dt_fact
360 END SUBROUTINE multiple_step_yoshida
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
stores a lists of integer that are local to a processor. The idea is that these integers represent ob...
subroutine, public lnhc_barostat(nhc, npt, group)
...
subroutine, public shell_scale_comv(atomic_kind_set, local_particles, particle_set, com_vel, shell_vel, core_vel)
...
subroutine, public lnhc_shells(nhc, atomic_kind_set, particle_set, local_particles, group, shell_particle_set, core_particle_set, vel, shell_vel, core_vel)
...
subroutine, public lnhc_particles(nhc, molecule_kind_set, molecule_set, particle_set, local_molecules, group, shell_adiabatic, shell_particle_set, core_particle_set, vel, shell_vel, core_vel)
...
Lumps all possible extended system variables into one type for easy access and passing.
Defines the basic variable types.
integer, parameter, public dp
Interface to the message passing library MPI.
Define the molecule kind structure types and the corresponding functionality.
Define the data structure for the molecule information.
Define the data structure for the particle information.
Utilities for thermostats.
subroutine, public vel_rescale_shells(map_info, atomic_kind_set, particle_set, local_particles, shell_particle_set, core_particle_set, shell_vel, core_vel, vel)
...
subroutine, public vel_rescale_particles(map_info, molecule_kind_set, molecule_set, particle_set, local_molecules, shell_adiabatic, shell_particle_set, core_particle_set, vel, shell_vel, core_vel)
...
subroutine, public ke_region_shells(map_info, particle_set, atomic_kind_set, local_particles, group, core_particle_set, shell_particle_set, core_vel, shell_vel)
...
subroutine, public ke_region_baro(map_info, npt, group)
...
subroutine, public vel_rescale_baro(map_info, npt)
...
subroutine, public ke_region_particles(map_info, particle_set, molecule_kind_set, local_molecules, molecule_set, group, vel)
...