28#include "../../base/base_uses.f90"
33 LOGICAL,
PARAMETER :: debug_this_module = .false.
36 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'al_system_dynamics'
53 SUBROUTINE al_particles(al, force_env, molecule_kind_set, molecule_set, &
54 particle_set, local_molecules, local_particles, group, vel)
63 REAL(kind=
dp),
INTENT(INOUT),
OPTIONAL :: vel(:, :)
65 CHARACTER(len=*),
PARAMETER :: routinen =
'al_particles'
68 LOGICAL :: my_shell_adiabatic
71 CALL timeset(routinen, handle)
72 my_shell_adiabatic = .false.
73 map_info => al%map_info
75 IF (debug_this_module)
THEN
76 CALL dump_vel(molecule_kind_set, molecule_set, local_molecules, particle_set, vel,
"INIT")
79 IF (al%tau_nh <= 0.0_dp)
THEN
80 CALL al_ou_step(0.5_dp, al, force_env, map_info, molecule_kind_set, molecule_set, &
81 particle_set, local_molecules, local_particles, vel)
82 IF (debug_this_module)
THEN
83 CALL dump_vel(molecule_kind_set, molecule_set, local_molecules, particle_set, vel,
"post OU")
87 CALL al_ou_step(0.25_dp, al, force_env, map_info, molecule_kind_set, molecule_set, &
88 particle_set, local_molecules, local_particles, vel)
89 IF (debug_this_module)
THEN
90 CALL dump_vel(molecule_kind_set, molecule_set, local_molecules, particle_set, vel,
"post 1st OU")
95 local_molecules, molecule_set, group, vel=vel)
97 CALL al_nh_quarter_step(al, map_info, set_half_step_vel_factors=.true.)
101 local_molecules, my_shell_adiabatic, vel=vel)
104 local_molecules, molecule_set, group, vel=vel)
105 IF (debug_this_module)
THEN
106 CALL dump_vel(molecule_kind_set, molecule_set, local_molecules, particle_set, vel,
"post rescale_vel")
110 CALL al_nh_quarter_step(al, map_info, set_half_step_vel_factors=.false.)
113 CALL al_ou_step(0.25_dp, al, force_env, map_info, molecule_kind_set, molecule_set, &
114 particle_set, local_molecules, local_particles, vel)
115 IF (debug_this_module)
THEN
116 CALL dump_vel(molecule_kind_set, molecule_set, local_molecules, particle_set, vel,
"post 2nd OU")
122 local_molecules, molecule_set, group, vel=vel)
124 CALL timestop(handle)
136 SUBROUTINE dump_vel(molecule_kind_set, molecule_set, local_molecules, particle_set, vel, label)
141 REAL(
dp),
OPTIONAL :: vel(:, :)
142 CHARACTER(len=*) :: label
144 INTEGER :: first_atom, ikind, imol, imol_local, &
145 ipart, last_atom, nmol_local
148 DO ikind = 1,
SIZE(molecule_kind_set)
149 nmol_local = local_molecules%n_el(ikind)
150 DO imol_local = 1, nmol_local
151 imol = local_molecules%list(ikind)%array(imol_local)
152 molecule => molecule_set(imol)
153 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
154 DO ipart = first_atom, last_atom
155 IF (
PRESENT(vel))
THEN
156 WRITE (unit=*, fmt=
'("VEL ",A20," IPART ",I6," V ",3F20.10)') trim(label), ipart, vel(:, ipart)
158 WRITE (unit=*, fmt=
'("PARTICLE_SET%VEL ",A20," IPART ",I6," V ",3F20.10)') trim(label), &
159 ipart, particle_set(ipart)%v(:)
164 END SUBROUTINE dump_vel
179 SUBROUTINE al_ou_step(step, al, force_env, map_info, molecule_kind_set, molecule_set, &
180 particle_set, local_molecules, local_particles, vel)
181 REAL(
dp),
INTENT(in) :: step
189 REAL(kind=
dp),
INTENT(INOUT),
OPTIONAL :: vel(:, :)
191 INTEGER :: first_atom, i, ii, ikind, imap, imol, imol_local, ipart, iparticle_kind, &
192 iparticle_local, jj, last_atom, nmol_local, nparticle, nparticle_kind, nparticle_local
193 LOGICAL :: check, present_vel
194 REAL(kind=
dp) :: mass
195 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: w
199 present_vel =
PRESENT(vel)
202 DO i = 1, al%loc_num_al
203 imap = map_info%map_index(i)
205 IF (al%tau_langevin > 0.0_dp)
THEN
206 map_info%v_scale(imap) = exp(-step*al%dt/al%tau_langevin)
207 map_info%s_kin(imap) = sqrt((al%nvt(i)%nkt/al%nvt(i)%degrees_of_freedom)*(1.0_dp - map_info%v_scale(imap)**2))
209 map_info%v_scale(imap) = 1.0_dp
210 map_info%s_kin(imap) = 0.0_dp
215 nparticle =
SIZE(particle_set)
216 nparticle_kind =
SIZE(local_particles%n_el)
217 ALLOCATE (w(3, nparticle))
219 check = (nparticle_kind <=
SIZE(local_particles%n_el) .AND. nparticle_kind <=
SIZE(local_particles%list))
221 check =
ASSOCIATED(local_particles%local_particle_set)
223 DO iparticle_kind = 1, nparticle_kind
224 nparticle_local = local_particles%n_el(iparticle_kind)
225 check = (nparticle_local <=
SIZE(local_particles%list(iparticle_kind)%array))
227 DO iparticle_local = 1, nparticle_local
228 ipart = local_particles%list(iparticle_kind)%array(iparticle_local)
229 w(1, ipart) = local_particles%local_particle_set(iparticle_kind)%rng(iparticle_local)%stream%next(variance=1.0_dp)
230 w(2, ipart) = local_particles%local_particle_set(iparticle_kind)%rng(iparticle_local)%stream%next(variance=1.0_dp)
231 w(3, ipart) = local_particles%local_particle_set(iparticle_kind)%rng(iparticle_local)%stream%next(variance=1.0_dp)
238 DO ikind = 1,
SIZE(molecule_kind_set)
239 nmol_local = local_molecules%n_el(ikind)
240 DO imol_local = 1, nmol_local
241 imol = local_molecules%list(ikind)%array(imol_local)
242 molecule => molecule_set(imol)
243 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
244 DO ipart = first_atom, last_atom
246 atomic_kind => particle_set(ipart)%atomic_kind
248 IF (present_vel)
THEN
250 vel(jj, ipart) = vel(jj, ipart)*map_info%p_scale(jj, ii)%point + &
251 map_info%p_kin(jj, ii)%point/sqrt(mass)*w(jj, ipart)
255 particle_set(ipart)%v(jj) = particle_set(ipart)%v(jj)*map_info%p_scale(jj, ii)%point + &
256 map_info%p_kin(jj, ii)%point/sqrt(mass)*w(jj, ipart)
265 END SUBROUTINE al_ou_step
274 SUBROUTINE al_nh_quarter_step(al, map_info, set_half_step_vel_factors)
277 LOGICAL,
INTENT(in) :: set_half_step_vel_factors
280 REAL(kind=
dp) :: decay, delta_k
284 DO i = 1, al%loc_num_al
285 IF (al%nvt(i)%mass > 0.0_dp)
THEN
286 imap = map_info%map_index(i)
287 delta_k = 0.5_dp*(map_info%s_kin(imap) - al%nvt(i)%nkt)
288 al%nvt(i)%chi = al%nvt(i)%chi + 0.5_dp*al%dt*delta_k/al%nvt(i)%mass
289 IF (set_half_step_vel_factors)
THEN
290 decay = exp(-0.5_dp*al%dt*al%nvt(i)%chi)
291 map_info%v_scale(imap) = decay
294 al%nvt(i)%chi = 0.0_dp
295 IF (set_half_step_vel_factors)
THEN
296 map_info%v_scale(imap) = 1.0_dp
301 END SUBROUTINE al_nh_quarter_step
subroutine, public al_particles(al, force_env, molecule_kind_set, molecule_set, particle_set, local_molecules, local_particles, group, vel)
...
Type for the canonical sampling through velocity rescaling.
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.
subroutine, public fix_atom_control(force_env, w)
allows for fix atom constraints
stores a lists of integer that are local to a processor. The idea is that these integers represent ob...
Lumps all possible extended system variables into one type for easy access and passing.
Interface for the force calculations.
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.
subroutine, public get_molecule(molecule, molecule_kind, lmi, lci, lg3x3, lg4x6, lcolv, first_atom, last_atom, first_shell, last_shell)
Get components from a molecule data set.
Define the data structure for the particle information.
Utilities for thermostats.
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_particles(map_info, particle_set, molecule_kind_set, local_molecules, molecule_set, group, vel)
...
Provides all information about an atomic kind.
structure to store local (to a processor) ordered lists of integers.
wrapper to abstract the force evaluation of the various methods