36#include "../../base/base_uses.f90"
42 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'extended_system_mapping'
64 CHARACTER(LEN=*),
PARAMETER :: routinen =
'nhc_to_barostat_mapping'
66 INTEGER :: handle, i, number
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)
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
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)
240 INTEGER,
DIMENSION(:),
POINTER :: deg_of_freedom, massive_atom_list
245 INTEGER,
INTENT(OUT) :: natoms_local
247 INTEGER,
INTENT(OUT) :: sum_of_thermostats
249 LOGICAL,
INTENT(IN),
OPTIONAL :: shell
251 CHARACTER(LEN=*),
PARAMETER :: routinen =
'setup_adiabatic_thermostat'
253 INTEGER :: handle, nkind, number, region
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)
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
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))
THEN
337 map_info%p_kin(i, j)%point = map_info%p_kin(i, j)%point + 1
348 fac = map_info%s_kin(1) - deg_of_freedom(1) - simpar%nfree_rot_transl
349 IF (
fac == 0.0_dp)
THEN
350 cpabort(
'Zero degrees of freedom. Nothing to thermalize!')
352 nhc%nvt(1, 1)%nkt = simpar%temp_slow*
fac
353 nhc%nvt(1, 1)%degrees_of_freedom = floor(
fac)
355 DO i = 1, nhc%loc_num_nhc
356 imap = map_info%map_index(i)
357 fac = (map_info%s_kin(imap) - deg_of_freedom(i))
358 nhc%nvt(1, i)%nkt = simpar%temp_slow*
fac
359 nhc%nvt(1, i)%degrees_of_freedom = floor(
fac)
365 DO i = 2, nhc%nhc_len
366 nhc%nvt(i, :)%nkt = simpar%temp_slow
367 nhc%nvt(i, :)%degrees_of_freedom = 1
369 DEALLOCATE (deg_of_freedom)
370 DEALLOCATE (massive_atom_list)
373 map_info%s_kin = 0.0_dp
374 map_info%v_scale = 0.0_dp
377 CALL timestop(handle)
395 molecule_set, molecule_kind_set, nhc, para_env, gci)
406 CHARACTER(LEN=*),
PARAMETER :: routinen =
'nhc_to_particle_mapping_fast'
408 INTEGER :: handle, i, imap, j, natoms_local, &
410 INTEGER,
DIMENSION(:),
POINTER :: deg_of_freedom, massive_atom_list
414 CALL timeset(routinen, handle)
416 NULLIFY (massive_atom_list, deg_of_freedom)
418 SELECT CASE (simpar%ensemble)
420 cpabort(
'Unknown ensemble!')
422 CALL setup_adiabatic_thermostat(nhc, thermostat_info, deg_of_freedom, massive_atom_list, &
423 molecule_kind_set, local_molecules, molecule_set, para_env, natoms_local, &
424 simpar, sum_of_thermostats, gci)
428 map_info => nhc%map_info
429 map_info%s_kin = 0.0_dp
431 DO j = 1, natoms_local
432 IF (
ASSOCIATED(map_info%p_kin(i, j)%point))
THEN
433 map_info%p_kin(i, j)%point = map_info%p_kin(i, j)%point + 1
444 fac = map_info%s_kin(1) - deg_of_freedom(1) - simpar%nfree_rot_transl
445 IF (
fac == 0.0_dp)
THEN
446 cpabort(
'Zero degrees of freedom. Nothing to thermalize!')
448 nhc%nvt(1, 1)%nkt = simpar%temp_fast*
fac
449 nhc%nvt(1, 1)%degrees_of_freedom = floor(
fac)
451 DO i = 1, nhc%loc_num_nhc
452 imap = map_info%map_index(i)
453 fac = (map_info%s_kin(imap) - deg_of_freedom(i))
454 nhc%nvt(1, i)%nkt = simpar%temp_fast*
fac
455 nhc%nvt(1, i)%degrees_of_freedom = floor(
fac)
461 DO i = 2, nhc%nhc_len
462 nhc%nvt(i, :)%nkt = simpar%temp_fast
463 nhc%nvt(i, :)%degrees_of_freedom = 1
465 DEALLOCATE (deg_of_freedom)
466 DEALLOCATE (massive_atom_list)
469 map_info%s_kin = 0.0_dp
470 map_info%v_scale = 0.0_dp
473 CALL timestop(handle)
494 SUBROUTINE setup_nhc_thermostat(nhc, thermostat_info, deg_of_freedom, &
495 massive_atom_list, molecule_kind_set, local_molecules, molecule_set, &
496 para_env, natoms_local, simpar, sum_of_thermostats, gci, shell)
500 INTEGER,
DIMENSION(:),
POINTER :: deg_of_freedom, massive_atom_list
505 INTEGER,
INTENT(OUT) :: natoms_local
507 INTEGER,
INTENT(OUT) :: sum_of_thermostats
509 LOGICAL,
INTENT(IN),
OPTIONAL :: shell
511 CHARACTER(LEN=*),
PARAMETER :: routinen =
'setup_nhc_thermostat'
513 INTEGER :: handle, nkind, number, region
517 CALL timeset(routinen, handle)
520 IF (
PRESENT(shell)) do_shell = shell
521 map_info => nhc%map_info
523 nkind =
SIZE(molecule_kind_set)
524 sum_of_thermostats = thermostat_info%sum_of_thermostats
525 map_info%dis_type = thermostat_info%dis_type
526 number = thermostat_info%number_of_thermostats
530 molecule_kind_set, local_molecules, molecule_set, para_env, natoms_local, &
531 simpar, number, region, gci, do_shell, thermostat_info%map_loc_thermo_gen, &
534 ALLOCATE (nhc%nvt(nhc%nhc_len, number))
539 nhc%loc_num_nhc = number
540 nhc%glob_num_nhc = sum_of_thermostats
542 CALL timestop(handle)
544 END SUBROUTINE setup_nhc_thermostat
558 molecule_set, molecule_kind_set, nhc, para_env, gci)
569 CHARACTER(LEN=*),
PARAMETER :: routinen =
'nhc_to_shell_mapping'
571 INTEGER :: handle, i, imap, j, nshell_local, &
573 INTEGER,
DIMENSION(:),
POINTER :: deg_of_freedom, massive_shell_list
576 CALL timeset(routinen, handle)
578 NULLIFY (massive_shell_list, deg_of_freedom)
580 SELECT CASE (simpar%ensemble)
582 cpabort(
'Unknown ensemble!')
585 cpabort(
'Never reach this point!')
589 CALL setup_nhc_thermostat(nhc, thermostat_info, deg_of_freedom, massive_shell_list, &
590 molecule_kind_set, local_molecules, molecule_set, para_env, nshell_local, &
591 simpar, sum_of_thermostats, gci, shell=.true.)
593 map_info => nhc%map_info
596 map_info%s_kin = 0.0_dp
597 DO j = 1, nshell_local
599 map_info%p_kin(i, j)%point = map_info%p_kin(i, j)%point + 1
609 DO i = 1, nhc%loc_num_nhc
610 imap = map_info%map_index(i)
611 nhc%nvt(1, i)%nkt = simpar%temp_sh_ext*map_info%s_kin(imap)
612 nhc%nvt(1, i)%degrees_of_freedom = int(map_info%s_kin(imap))
616 DO i = 2, nhc%nhc_len
617 nhc%nvt(i, :)%nkt = simpar%temp_sh_ext
618 nhc%nvt(i, :)%degrees_of_freedom = 1
620 DEALLOCATE (deg_of_freedom)
621 DEALLOCATE (massive_shell_list)
624 map_info%s_kin = 0.0_dp
625 map_info%v_scale = 0.0_dp
628 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.
structure to store local (to a processor) ordered lists of integers.
stores all the informations relevant to an mpi environment
Simulation parameter type for molecular dynamics.