19 lnhc_parameters_type,&
36 #include "../../base/base_uses.f90"
42 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'extended_system_mapping'
61 TYPE(simpar_type),
POINTER :: simpar
62 TYPE(lnhc_parameters_type),
POINTER :: nhc
64 CHARACTER(LEN=*),
PARAMETER :: routinen =
'nhc_to_barostat_mapping'
66 INTEGER :: handle, i, number
67 TYPE(map_info_type),
POINTER :: map_info
69 CALL timeset(routinen, handle)
71 SELECT CASE (simpar%ensemble)
73 cpabort(
'Never reach this point!')
75 map_info => nhc%map_info
89 ALLOCATE (nhc%nvt(nhc%nhc_len, nhc%loc_num_nhc))
92 DO i = 1, nhc%loc_num_nhc
93 nhc%nvt(1, i)%nkt = simpar%temp_ext*number
94 nhc%nvt(1, i)%degrees_of_freedom = number
96 nhc%nvt(1, i)%nkt = simpar%temp_ext
101 DO i = 2, nhc%nhc_len
102 nhc%nvt(i, :)%nkt = simpar%temp_ext
106 map_info%s_kin = 0.0_dp
107 map_info%v_scale = 0.0_dp
110 CALL timestop(handle)
133 molecule_set, molecule_kind_set, nhc, para_env, gci)
135 TYPE(thermostat_info_type),
POINTER :: thermostat_info
136 TYPE(simpar_type),
POINTER :: simpar
137 TYPE(distribution_1d_type),
POINTER :: local_molecules
138 TYPE(molecule_type),
POINTER :: molecule_set(:)
139 TYPE(molecule_kind_type),
POINTER :: molecule_kind_set(:)
140 TYPE(lnhc_parameters_type),
POINTER :: nhc
141 TYPE(mp_para_env_type),
POINTER :: para_env
142 TYPE(global_constraint_type),
POINTER :: gci
144 CHARACTER(LEN=*),
PARAMETER :: routinen =
'nhc_to_particle_mapping'
146 INTEGER :: handle, i, imap, j, natoms_local, &
148 INTEGER,
DIMENSION(:),
POINTER :: deg_of_freedom, massive_atom_list
150 TYPE(map_info_type),
POINTER :: map_info
152 CALL timeset(routinen, handle)
154 NULLIFY (massive_atom_list, deg_of_freedom)
156 SELECT CASE (simpar%ensemble)
158 cpabort(
'Unknown ensemble!')
161 cpabort(
'Never reach this point!')
164 CALL setup_nhc_thermostat(nhc, thermostat_info, deg_of_freedom, massive_atom_list, &
165 molecule_kind_set, local_molecules, molecule_set, para_env, natoms_local, &
166 simpar, sum_of_thermostats, gci)
170 map_info => nhc%map_info
171 map_info%s_kin = 0.0_dp
173 DO j = 1, natoms_local
174 map_info%p_kin(i, j)%point = map_info%p_kin(i, j)%point + 1
184 fac = map_info%s_kin(1) - deg_of_freedom(1) - simpar%nfree_rot_transl
185 IF (
fac == 0.0_dp)
THEN
186 cpabort(
'Zero degrees of freedom. Nothing to thermalize!')
188 nhc%nvt(1, 1)%nkt = simpar%temp_ext*
fac
189 nhc%nvt(1, 1)%degrees_of_freedom = floor(
fac)
191 DO i = 1, nhc%loc_num_nhc
192 imap = map_info%map_index(i)
193 fac = (map_info%s_kin(imap) - deg_of_freedom(i))
194 nhc%nvt(1, i)%nkt = simpar%temp_ext*
fac
195 nhc%nvt(1, i)%degrees_of_freedom = floor(
fac)
201 DO i = 2, nhc%nhc_len
202 nhc%nvt(i, :)%nkt = simpar%temp_ext
203 nhc%nvt(i, :)%degrees_of_freedom = 1
205 DEALLOCATE (deg_of_freedom)
206 DEALLOCATE (massive_atom_list)
209 map_info%s_kin = 0.0_dp
210 map_info%v_scale = 0.0_dp
213 CALL timestop(handle)
234 SUBROUTINE setup_adiabatic_thermostat(nhc, thermostat_info, deg_of_freedom, &
235 massive_atom_list, molecule_kind_set, local_molecules, molecule_set, &
236 para_env, natoms_local, simpar, sum_of_thermostats, gci, shell)
238 TYPE(lnhc_parameters_type),
POINTER :: nhc
239 TYPE(thermostat_info_type),
POINTER :: thermostat_info
240 INTEGER,
DIMENSION(:),
POINTER :: deg_of_freedom, massive_atom_list
241 TYPE(molecule_kind_type),
POINTER :: molecule_kind_set(:)
242 TYPE(distribution_1d_type),
POINTER :: local_molecules
243 TYPE(molecule_type),
POINTER :: molecule_set(:)
244 TYPE(mp_para_env_type),
POINTER :: para_env
245 INTEGER,
INTENT(OUT) :: natoms_local
246 TYPE(simpar_type),
POINTER :: simpar
247 INTEGER,
INTENT(OUT) :: sum_of_thermostats
248 TYPE(global_constraint_type),
POINTER :: gci
249 LOGICAL,
INTENT(IN),
OPTIONAL :: shell
251 CHARACTER(LEN=*),
PARAMETER :: routinen =
'setup_adiabatic_thermostat'
253 INTEGER :: handle, nkind, number, region
255 TYPE(map_info_type),
POINTER :: map_info
257 CALL timeset(routinen, handle)
260 IF (
PRESENT(shell)) do_shell = shell
261 map_info => nhc%map_info
263 nkind =
SIZE(molecule_kind_set)
264 sum_of_thermostats = thermostat_info%sum_of_thermostats
265 map_info%dis_type = thermostat_info%dis_type
266 number = thermostat_info%number_of_thermostats
270 molecule_kind_set, local_molecules, molecule_set, para_env, natoms_local, &
271 simpar, number, region, gci, do_shell, thermostat_info%map_loc_thermo_gen, &
273 ALLOCATE (nhc%nvt(nhc%nhc_len, number))
278 nhc%loc_num_nhc = number
279 nhc%glob_num_nhc = sum_of_thermostats
281 CALL timestop(handle)
283 END SUBROUTINE setup_adiabatic_thermostat
299 molecule_set, molecule_kind_set, nhc, para_env, gci)
301 TYPE(thermostat_info_type),
POINTER :: thermostat_info
302 TYPE(simpar_type),
POINTER :: simpar
303 TYPE(distribution_1d_type),
POINTER :: local_molecules
304 TYPE(molecule_type),
POINTER :: molecule_set(:)
305 TYPE(molecule_kind_type),
POINTER :: molecule_kind_set(:)
306 TYPE(lnhc_parameters_type),
POINTER :: nhc
307 TYPE(mp_para_env_type),
POINTER :: para_env
308 TYPE(global_constraint_type),
POINTER :: gci
310 CHARACTER(LEN=*),
PARAMETER :: routinen =
'nhc_to_particle_mapping_slow'
312 INTEGER :: handle, i, imap, j, natoms_local, &
314 INTEGER,
DIMENSION(:),
POINTER :: deg_of_freedom, massive_atom_list
316 TYPE(map_info_type),
POINTER :: map_info
318 CALL timeset(routinen, handle)
320 NULLIFY (massive_atom_list, deg_of_freedom)
322 SELECT CASE (simpar%ensemble)
324 cpabort(
'Unknown ensemble!')
326 CALL setup_adiabatic_thermostat(nhc, thermostat_info, deg_of_freedom, massive_atom_list, &
327 molecule_kind_set, local_molecules, molecule_set, para_env, natoms_local, &
328 simpar, sum_of_thermostats, gci)
332 map_info => nhc%map_info
333 map_info%s_kin = 0.0_dp
335 DO j = 1, natoms_local
336 IF (
ASSOCIATED(map_info%p_kin(i, j)%point)) &
337 map_info%p_kin(i, j)%point = map_info%p_kin(i, j)%point + 1
347 fac = map_info%s_kin(1) - deg_of_freedom(1) - simpar%nfree_rot_transl
348 IF (
fac == 0.0_dp)
THEN
349 cpabort(
'Zero degrees of freedom. Nothing to thermalize!')
351 nhc%nvt(1, 1)%nkt = simpar%temp_slow*
fac
352 nhc%nvt(1, 1)%degrees_of_freedom = floor(
fac)
354 DO i = 1, nhc%loc_num_nhc
355 imap = map_info%map_index(i)
356 fac = (map_info%s_kin(imap) - deg_of_freedom(i))
357 nhc%nvt(1, i)%nkt = simpar%temp_slow*
fac
358 nhc%nvt(1, i)%degrees_of_freedom = floor(
fac)
364 DO i = 2, nhc%nhc_len
365 nhc%nvt(i, :)%nkt = simpar%temp_slow
366 nhc%nvt(i, :)%degrees_of_freedom = 1
368 DEALLOCATE (deg_of_freedom)
369 DEALLOCATE (massive_atom_list)
372 map_info%s_kin = 0.0_dp
373 map_info%v_scale = 0.0_dp
376 CALL timestop(handle)
394 molecule_set, molecule_kind_set, nhc, para_env, gci)
396 TYPE(thermostat_info_type),
POINTER :: thermostat_info
397 TYPE(simpar_type),
POINTER :: simpar
398 TYPE(distribution_1d_type),
POINTER :: local_molecules
399 TYPE(molecule_type),
POINTER :: molecule_set(:)
400 TYPE(molecule_kind_type),
POINTER :: molecule_kind_set(:)
401 TYPE(lnhc_parameters_type),
POINTER :: nhc
402 TYPE(mp_para_env_type),
POINTER :: para_env
403 TYPE(global_constraint_type),
POINTER :: gci
405 CHARACTER(LEN=*),
PARAMETER :: routinen =
'nhc_to_particle_mapping_fast'
407 INTEGER :: handle, i, imap, j, natoms_local, &
409 INTEGER,
DIMENSION(:),
POINTER :: deg_of_freedom, massive_atom_list
411 TYPE(map_info_type),
POINTER :: map_info
413 CALL timeset(routinen, handle)
415 NULLIFY (massive_atom_list, deg_of_freedom)
417 SELECT CASE (simpar%ensemble)
419 cpabort(
'Unknown ensemble!')
421 CALL setup_adiabatic_thermostat(nhc, thermostat_info, deg_of_freedom, massive_atom_list, &
422 molecule_kind_set, local_molecules, molecule_set, para_env, natoms_local, &
423 simpar, sum_of_thermostats, gci)
427 map_info => nhc%map_info
428 map_info%s_kin = 0.0_dp
430 DO j = 1, natoms_local
431 IF (
ASSOCIATED(map_info%p_kin(i, j)%point)) &
432 map_info%p_kin(i, j)%point = map_info%p_kin(i, j)%point + 1
442 fac = map_info%s_kin(1) - deg_of_freedom(1) - simpar%nfree_rot_transl
443 IF (
fac == 0.0_dp)
THEN
444 cpabort(
'Zero degrees of freedom. Nothing to thermalize!')
446 nhc%nvt(1, 1)%nkt = simpar%temp_fast*
fac
447 nhc%nvt(1, 1)%degrees_of_freedom = floor(
fac)
449 DO i = 1, nhc%loc_num_nhc
450 imap = map_info%map_index(i)
451 fac = (map_info%s_kin(imap) - deg_of_freedom(i))
452 nhc%nvt(1, i)%nkt = simpar%temp_fast*
fac
453 nhc%nvt(1, i)%degrees_of_freedom = floor(
fac)
459 DO i = 2, nhc%nhc_len
460 nhc%nvt(i, :)%nkt = simpar%temp_fast
461 nhc%nvt(i, :)%degrees_of_freedom = 1
463 DEALLOCATE (deg_of_freedom)
464 DEALLOCATE (massive_atom_list)
467 map_info%s_kin = 0.0_dp
468 map_info%v_scale = 0.0_dp
471 CALL timestop(handle)
492 SUBROUTINE setup_nhc_thermostat(nhc, thermostat_info, deg_of_freedom, &
493 massive_atom_list, molecule_kind_set, local_molecules, molecule_set, &
494 para_env, natoms_local, simpar, sum_of_thermostats, gci, shell)
496 TYPE(lnhc_parameters_type),
POINTER :: nhc
497 TYPE(thermostat_info_type),
POINTER :: thermostat_info
498 INTEGER,
DIMENSION(:),
POINTER :: deg_of_freedom, massive_atom_list
499 TYPE(molecule_kind_type),
POINTER :: molecule_kind_set(:)
500 TYPE(distribution_1d_type),
POINTER :: local_molecules
501 TYPE(molecule_type),
POINTER :: molecule_set(:)
502 TYPE(mp_para_env_type),
POINTER :: para_env
503 INTEGER,
INTENT(OUT) :: natoms_local
504 TYPE(simpar_type),
POINTER :: simpar
505 INTEGER,
INTENT(OUT) :: sum_of_thermostats
506 TYPE(global_constraint_type),
POINTER :: gci
507 LOGICAL,
INTENT(IN),
OPTIONAL :: shell
509 CHARACTER(LEN=*),
PARAMETER :: routinen =
'setup_nhc_thermostat'
511 INTEGER :: handle, nkind, number, region
513 TYPE(map_info_type),
POINTER :: map_info
515 CALL timeset(routinen, handle)
518 IF (
PRESENT(shell)) do_shell = shell
519 map_info => nhc%map_info
521 nkind =
SIZE(molecule_kind_set)
522 sum_of_thermostats = thermostat_info%sum_of_thermostats
523 map_info%dis_type = thermostat_info%dis_type
524 number = thermostat_info%number_of_thermostats
528 molecule_kind_set, local_molecules, molecule_set, para_env, natoms_local, &
529 simpar, number, region, gci, do_shell, thermostat_info%map_loc_thermo_gen, &
532 ALLOCATE (nhc%nvt(nhc%nhc_len, number))
537 nhc%loc_num_nhc = number
538 nhc%glob_num_nhc = sum_of_thermostats
540 CALL timestop(handle)
542 END SUBROUTINE setup_nhc_thermostat
556 molecule_set, molecule_kind_set, nhc, para_env, gci)
558 TYPE(thermostat_info_type),
POINTER :: thermostat_info
559 TYPE(simpar_type),
POINTER :: simpar
560 TYPE(distribution_1d_type),
POINTER :: local_molecules
561 TYPE(molecule_type),
POINTER :: molecule_set(:)
562 TYPE(molecule_kind_type),
POINTER :: molecule_kind_set(:)
563 TYPE(lnhc_parameters_type),
POINTER :: nhc
564 TYPE(mp_para_env_type),
POINTER :: para_env
565 TYPE(global_constraint_type),
POINTER :: gci
567 CHARACTER(LEN=*),
PARAMETER :: routinen =
'nhc_to_shell_mapping'
569 INTEGER :: handle, i, imap, j, nshell_local, &
571 INTEGER,
DIMENSION(:),
POINTER :: deg_of_freedom, massive_shell_list
572 TYPE(map_info_type),
POINTER :: map_info
574 CALL timeset(routinen, handle)
576 NULLIFY (massive_shell_list, deg_of_freedom)
578 SELECT CASE (simpar%ensemble)
580 cpabort(
'Unknown ensemble!')
583 cpabort(
'Never reach this point!')
587 CALL setup_nhc_thermostat(nhc, thermostat_info, deg_of_freedom, massive_shell_list, &
588 molecule_kind_set, local_molecules, molecule_set, para_env, nshell_local, &
589 simpar, sum_of_thermostats, gci, shell=.true.)
591 map_info => nhc%map_info
594 map_info%s_kin = 0.0_dp
595 DO j = 1, nshell_local
597 map_info%p_kin(i, j)%point = map_info%p_kin(i, j)%point + 1
607 DO i = 1, nhc%loc_num_nhc
608 imap = map_info%map_index(i)
609 nhc%nvt(1, i)%nkt = simpar%temp_sh_ext*map_info%s_kin(imap)
610 nhc%nvt(1, i)%degrees_of_freedom = int(map_info%s_kin(imap))
614 DO i = 2, nhc%nhc_len
615 nhc%nvt(i, :)%nkt = simpar%temp_sh_ext
616 nhc%nvt(i, :)%degrees_of_freedom = 1
618 DEALLOCATE (deg_of_freedom)
619 DEALLOCATE (massive_shell_list)
622 map_info%s_kin = 0.0_dp
623 map_info%v_scale = 0.0_dp
626 CALL timestop(handle)
static GRID_HOST_DEVICE double fac(const int i)
Factorial function, e.g. fac(5) = 5! = 120.
stores a lists of integer that are local to a processor. The idea is that these integers represent ob...
subroutine, public nhc_to_particle_mapping_fast(thermostat_info, simpar, local_molecules, molecule_set, molecule_kind_set, nhc, para_env, gci)
Creates the thermostatting maps.
subroutine, public nhc_to_particle_mapping_slow(thermostat_info, simpar, local_molecules, molecule_set, molecule_kind_set, nhc, para_env, gci)
Creates the thermostatting maps.
subroutine, public nhc_to_barostat_mapping(simpar, nhc)
Creates the thermostatting for the barostat.
subroutine, public nhc_to_shell_mapping(thermostat_info, simpar, local_molecules, molecule_set, molecule_kind_set, nhc, para_env, gci)
...
subroutine, public nhc_to_particle_mapping(thermostat_info, simpar, local_molecules, molecule_set, molecule_kind_set, nhc, para_env, gci)
Creates the thermostatting maps.
Lumps all possible extended system variables into one type for easy access and passing.
logical, parameter, public debug_isotropic_limit
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.
Type for storing MD parameters.
subroutine, public adiabatic_mapping_region(map_info, deg_of_freedom, massive_atom_list, molecule_kind_set, local_molecules, molecule_set, para_env, natoms_local, simpar, number, region, gci, shell, map_loc_thermo_gen, sum_of_thermostats)
Main general setup for adiabatic thermostat regions (Nose only)
subroutine, public thermostat_mapping_region(map_info, deg_of_freedom, massive_atom_list, molecule_kind_set, local_molecules, molecule_set, para_env, natoms_local, simpar, number, region, gci, shell, map_loc_thermo_gen, sum_of_thermostats)
Main general setup thermostat regions (thermostat independent)
subroutine, public init_baro_map_info(map_info, ndeg, num_thermo)
Initialize the map_info for barostat thermostat.
Thermostat structure: module containing thermostat available for MD.