31 #include "../../base/base_uses.f90"
36 LOGICAL,
PARAMETER :: debug_this_module = .false.
41 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'csvr_system_dynamics'
54 TYPE(csvr_system_type),
POINTER :: csvr
55 TYPE(npt_info_type),
DIMENSION(:, :), &
57 TYPE(mp_comm_type),
INTENT(IN) :: group
59 CHARACTER(len=*),
PARAMETER :: routinen =
'csvr_barostat'
62 TYPE(map_info_type),
POINTER :: map_info
64 CALL timeset(routinen, handle)
65 map_info => csvr%map_info
71 CALL do_csvr(csvr, map_info)
80 CALL do_csvr_eval_energy(csvr, map_info)
102 particle_set, local_molecules, group, shell_adiabatic, &
103 shell_particle_set, core_particle_set, vel, shell_vel, core_vel)
105 TYPE(csvr_system_type),
POINTER :: csvr
106 TYPE(molecule_kind_type),
POINTER :: molecule_kind_set(:)
107 TYPE(molecule_type),
POINTER :: molecule_set(:)
108 TYPE(particle_type),
POINTER :: particle_set(:)
109 TYPE(distribution_1d_type),
POINTER :: local_molecules
110 TYPE(mp_comm_type),
INTENT(IN) :: group
111 LOGICAL,
INTENT(IN),
OPTIONAL :: shell_adiabatic
112 TYPE(particle_type),
OPTIONAL,
POINTER :: shell_particle_set(:), &
114 REAL(kind=
dp),
INTENT(INOUT),
OPTIONAL :: vel(:, :), shell_vel(:, :), &
117 CHARACTER(len=*),
PARAMETER :: routinen =
'csvr_particles'
120 LOGICAL :: my_shell_adiabatic
121 TYPE(map_info_type),
POINTER :: map_info
123 CALL timeset(routinen, handle)
124 my_shell_adiabatic = .false.
125 IF (
PRESENT(shell_adiabatic)) my_shell_adiabatic = shell_adiabatic
126 map_info => csvr%map_info
130 local_molecules, molecule_set, group, vel)
133 CALL do_csvr(csvr, map_info)
137 local_molecules, my_shell_adiabatic, shell_particle_set, core_particle_set, &
138 vel, shell_vel, core_vel)
142 local_molecules, molecule_set, group, vel)
145 CALL do_csvr_eval_energy(csvr, map_info)
147 CALL timestop(handle)
164 SUBROUTINE csvr_shells(csvr, atomic_kind_set, particle_set, local_particles, &
165 group, shell_particle_set, core_particle_set, vel, shell_vel, core_vel)
167 TYPE(csvr_system_type),
POINTER :: csvr
168 TYPE(atomic_kind_type),
POINTER :: atomic_kind_set(:)
169 TYPE(particle_type),
POINTER :: particle_set(:)
170 TYPE(distribution_1d_type),
POINTER :: local_particles
171 TYPE(mp_comm_type),
INTENT(IN) :: group
172 TYPE(particle_type),
OPTIONAL,
POINTER :: shell_particle_set(:), &
174 REAL(kind=
dp),
INTENT(INOUT),
OPTIONAL :: vel(:, :), shell_vel(:, :), &
177 CHARACTER(len=*),
PARAMETER :: routinen =
'csvr_shells'
180 TYPE(map_info_type),
POINTER :: map_info
182 CALL timeset(routinen, handle)
183 map_info => csvr%map_info
186 CALL ke_region_shells(map_info, particle_set, atomic_kind_set, local_particles, &
187 group, core_particle_set, shell_particle_set, core_vel, shell_vel)
190 CALL do_csvr(csvr, map_info)
194 shell_particle_set, core_particle_set, shell_vel, core_vel, vel)
197 CALL ke_region_shells(map_info, particle_set, atomic_kind_set, local_particles, &
198 group, core_particle_set, shell_particle_set, core_vel, shell_vel)
201 CALL do_csvr_eval_energy(csvr, map_info)
203 CALL timestop(handle)
212 SUBROUTINE do_csvr(csvr, map_info)
213 TYPE(csvr_system_type),
POINTER :: csvr
214 TYPE(map_info_type),
POINTER :: map_info
216 INTEGER :: i, imap, ndeg
217 REAL(kind=
dp) :: kin_energy, kin_target, taut
218 TYPE(rng_stream_type),
POINTER :: rng_stream
220 DO i = 1, csvr%loc_num_csvr
221 imap = map_info%map_index(i)
222 kin_energy = map_info%s_kin(imap)
223 csvr%nvt(i)%region_kin_energy = kin_energy
224 kin_energy = kin_energy*0.5_dp
225 kin_target = csvr%nvt(i)%nkt*0.5_dp
226 ndeg = csvr%nvt(i)%degrees_of_freedom
227 taut = csvr%tau_csvr/csvr%dt_fact
228 rng_stream => csvr%nvt(i)%gaussian_rng_stream
229 map_info%v_scale(imap) =
rescaling_factor(kin_energy, kin_target, ndeg, taut, &
233 END SUBROUTINE do_csvr
241 SUBROUTINE do_csvr_eval_energy(csvr, map_info)
242 TYPE(csvr_system_type),
POINTER :: csvr
243 TYPE(map_info_type),
POINTER :: map_info
246 REAL(kind=
dp) :: kin_energy_ar, kin_energy_br
248 DO i = 1, csvr%loc_num_csvr
249 imap = map_info%map_index(i)
250 kin_energy_br = csvr%nvt(i)%region_kin_energy
251 kin_energy_ar = map_info%s_kin(imap)
252 csvr%nvt(i)%thermostat_energy = csvr%nvt(i)%thermostat_energy + &
253 0.5_dp*(kin_energy_br - kin_energy_ar)
256 END SUBROUTINE do_csvr_eval_energy
Define the atomic kind types and their sub types.
subroutine, public csvr_shells(csvr, atomic_kind_set, particle_set, local_particles, group, shell_particle_set, core_particle_set, vel, shell_vel, core_vel)
...
subroutine, public csvr_particles(csvr, molecule_kind_set, molecule_set, particle_set, local_molecules, group, shell_adiabatic, shell_particle_set, core_particle_set, vel, shell_vel, core_vel)
...
subroutine, public csvr_barostat(csvr, npt, group)
...
Type for the canonical sampling through velocity rescaling.
real(kind=dp) function, public rescaling_factor(kk, sigma, ndeg, taut, rng_stream)
Stochastic velocity rescale, as described in Bussi, Donadio and Parrinello, J. Chem....
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.
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.
Parallel (pseudo)random number generator (RNG) for multiple streams and substreams of random numbers.
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)
...