(git:71c3ab0)
Loading...
Searching...
No Matches
extended_system_mapping.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \par History
10!> CJM, 20-Feb-01
11!> JGH (10-Mar-2001)
12!> CJM (10-Apr-2001)
13!> \author CJM
14! **************************************************************************************************
16
21 USE input_constants, ONLY: &
26 USE kinds, ONLY: dp
31 USE simpar_types, ONLY: simpar_type
36#include "../../base/base_uses.f90"
37
38 IMPLICIT NONE
39
40 PRIVATE
41
42 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'extended_system_mapping'
43
47
48CONTAINS
49
50! **************************************************************************************************
51!> \brief Creates the thermostatting for the barostat
52!> \param simpar ...
53!> \param nhc ...
54!> \par History
55!> CJM, 20-Feb-01 : nhc structure allocated to zero when not in use
56!> JGH (10-Mar-2001) : set nhc variables to zero when not in use
57!> \author CJM
58! **************************************************************************************************
59 SUBROUTINE nhc_to_barostat_mapping(simpar, nhc)
60
61 TYPE(simpar_type), POINTER :: simpar
62 TYPE(lnhc_parameters_type), POINTER :: nhc
63
64 CHARACTER(LEN=*), PARAMETER :: routinen = 'nhc_to_barostat_mapping'
65
66 INTEGER :: handle, i, number
67 TYPE(map_info_type), POINTER :: map_info
68
69 CALL timeset(routinen, handle)
70
71 SELECT CASE (simpar%ensemble)
72 CASE DEFAULT
73 cpabort('Never reach this point!')
75 map_info => nhc%map_info
76 map_info%dis_type = do_thermo_only_master
77
78 ! Counting the total number of thermostats ( 1 for NPT_I, NPT_IA, and NPT_F )
79 nhc%loc_num_nhc = 1
80 nhc%glob_num_nhc = 1
81 IF (simpar%ensemble == npt_f_ensemble) THEN
82 number = 9
83 ELSE
84 number = 1
85 END IF
86
87 CALL init_baro_map_info(map_info, number, nhc%loc_num_nhc)
88
89 ALLOCATE (nhc%nvt(nhc%nhc_len, nhc%loc_num_nhc))
90 ! Now that we know how many there are stick this into nhc % nkt
91 ! (number of degrees of freedom times k_B T )
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
95 IF (debug_isotropic_limit) THEN
96 nhc%nvt(1, i)%nkt = simpar%temp_ext
97 END IF
98 END DO
99
100 ! getting the number of degrees of freedom times k_B T for the rest of the chain
101 DO i = 2, nhc%nhc_len
102 nhc%nvt(i, :)%nkt = simpar%temp_ext
103 END DO
104
105 ! Let's clean the arrays
106 map_info%s_kin = 0.0_dp
107 map_info%v_scale = 0.0_dp
108 END SELECT
109
110 CALL timestop(handle)
111
112 END SUBROUTINE nhc_to_barostat_mapping
113
114! **************************************************************************************************
115!> \brief Creates the thermostatting maps
116!> \param thermostat_info ...
117!> \param simpar ...
118!> \param local_molecules ...
119!> \param molecule_set ...
120!> \param molecule_kind_set ...
121!> \param nhc ...
122!> \param para_env ...
123!> \param gci ...
124!> \par History
125!> 29-Nov-00 (JGH) correct counting of DOF if constraints are off
126!> CJM, 20-Feb-01 : nhc structure allocated to zero when not in use
127!> JGH (10-Mar-2001) : set nhc variables to zero when not in use
128!> CJM(10-NOV-2001) : New parallelization with new molecule structures
129!> Teodoro Laino 09.2007 [tlaino] - University of Zurich - cleaning and updating
130!> \author CJM
131! **************************************************************************************************
132 SUBROUTINE nhc_to_particle_mapping(thermostat_info, simpar, local_molecules, &
133 molecule_set, molecule_kind_set, nhc, para_env, gci)
134
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
143
144 CHARACTER(LEN=*), PARAMETER :: routinen = 'nhc_to_particle_mapping'
145
146 INTEGER :: handle, i, imap, j, natoms_local, &
147 sum_of_thermostats
148 INTEGER, DIMENSION(:), POINTER :: deg_of_freedom, massive_atom_list
149 REAL(kind=dp) :: fac
150 TYPE(map_info_type), POINTER :: map_info
151
152 CALL timeset(routinen, handle)
153
154 NULLIFY (massive_atom_list, deg_of_freedom)
155
156 SELECT CASE (simpar%ensemble)
157 CASE DEFAULT
158 cpabort('Unknown ensemble!')
161 cpabort('Never reach this point!')
163
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)
167
168 ! Sum up the number of degrees of freedom on each thermostat.
169 ! first: initialize the target
170 map_info => nhc%map_info
171 map_info%s_kin = 0.0_dp
172 DO i = 1, 3
173 DO j = 1, natoms_local
174 map_info%p_kin(i, j)%point = map_info%p_kin(i, j)%point + 1
175 END DO
176 END DO
177
178 ! if thermostats are replicated but molecules distributed, we have to
179 ! sum s_kin over all processors
180 IF (map_info%dis_type == do_thermo_communication) CALL para_env%sum(map_info%s_kin)
181
182 ! We know the total number of system thermostats.
183 IF ((sum_of_thermostats == 1) .AND. (map_info%dis_type /= do_thermo_no_communication)) THEN
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!')
187 END IF
188 nhc%nvt(1, 1)%nkt = simpar%temp_ext*fac
189 nhc%nvt(1, 1)%degrees_of_freedom = floor(fac)
190 ELSE
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)
196 END DO
197 END IF
198
199 ! Getting the number of degrees of freedom times k_B T for the rest
200 ! of the chain
201 DO i = 2, nhc%nhc_len
202 nhc%nvt(i, :)%nkt = simpar%temp_ext
203 nhc%nvt(i, :)%degrees_of_freedom = 1
204 END DO
205 DEALLOCATE (deg_of_freedom)
206 DEALLOCATE (massive_atom_list)
207
208 ! Let's clean the arrays
209 map_info%s_kin = 0.0_dp
210 map_info%v_scale = 0.0_dp
211 END SELECT
212
213 CALL timestop(handle)
214
215 END SUBROUTINE nhc_to_particle_mapping
216
217! **************************************************************************************************
218!> \brief Main general setup for Adiabatic Nose-Hoover thermostats
219!> \param nhc ...
220!> \param thermostat_info ...
221!> \param deg_of_freedom ...
222!> \param massive_atom_list ...
223!> \param molecule_kind_set ...
224!> \param local_molecules ...
225!> \param molecule_set ...
226!> \param para_env ...
227!> \param natoms_local ...
228!> \param simpar ...
229!> \param sum_of_thermostats ...
230!> \param gci ...
231!> \param shell ...
232!> \author CJM -PNNL -2011
233! **************************************************************************************************
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)
237
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
250
251 CHARACTER(LEN=*), PARAMETER :: routinen = 'setup_adiabatic_thermostat'
252
253 INTEGER :: handle, nkind, number, region
254 LOGICAL :: do_shell
255 TYPE(map_info_type), POINTER :: map_info
256
257 CALL timeset(routinen, handle)
258
259 do_shell = .false.
260 IF (PRESENT(shell)) do_shell = shell
261 map_info => nhc%map_info
262
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
267 region = nhc%region
268
269 CALL adiabatic_mapping_region(map_info, deg_of_freedom, massive_atom_list, &
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, &
272 sum_of_thermostats)
273 ALLOCATE (nhc%nvt(nhc%nhc_len, number))
274
275 ! Now that we know how many there are stick this into nhc%nkt
276 ! (number of degrees of freedom times k_B T for the first thermostat
277 ! on the chain)
278 nhc%loc_num_nhc = number
279 nhc%glob_num_nhc = sum_of_thermostats
280
281 CALL timestop(handle)
282
283 END SUBROUTINE setup_adiabatic_thermostat
284
285! **************************************************************************************************
286!> \brief Creates the thermostatting maps
287!> \param thermostat_info ...
288!> \param simpar ...
289!> \param local_molecules ...
290!> \param molecule_set ...
291!> \param molecule_kind_set ...
292!> \param nhc ...
293!> \param para_env ...
294!> \param gci ...
295!> \par History
296!> \author CJM
297! **************************************************************************************************
298 SUBROUTINE nhc_to_particle_mapping_slow(thermostat_info, simpar, local_molecules, &
299 molecule_set, molecule_kind_set, nhc, para_env, gci)
300
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
309
310 CHARACTER(LEN=*), PARAMETER :: routinen = 'nhc_to_particle_mapping_slow'
311
312 INTEGER :: handle, i, imap, j, natoms_local, &
313 sum_of_thermostats
314 INTEGER, DIMENSION(:), POINTER :: deg_of_freedom, massive_atom_list
315 REAL(kind=dp) :: fac
316 TYPE(map_info_type), POINTER :: map_info
317
318 CALL timeset(routinen, handle)
319
320 NULLIFY (massive_atom_list, deg_of_freedom)
321
322 SELECT CASE (simpar%ensemble)
323 CASE DEFAULT
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)
329
330 ! Sum up the number of degrees of freedom on each thermostat.
331 ! first: initialize the target
332 map_info => nhc%map_info
333 map_info%s_kin = 0.0_dp
334 DO i = 1, 3
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
338 END IF
339 END DO
340 END DO
341
342 ! if thermostats are replicated but molecules distributed, we have to
343 ! sum s_kin over all processors
344 IF (map_info%dis_type == do_thermo_communication) CALL para_env%sum(map_info%s_kin)
345
346 ! We know the total number of system thermostats.
347 IF ((sum_of_thermostats == 1) .AND. (map_info%dis_type /= do_thermo_no_communication)) THEN
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!')
351 END IF
352 nhc%nvt(1, 1)%nkt = simpar%temp_slow*fac
353 nhc%nvt(1, 1)%degrees_of_freedom = floor(fac)
354 ELSE
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)
360 END DO
361 END IF
362
363 ! Getting the number of degrees of freedom times k_B T for the rest
364 ! of the chain
365 DO i = 2, nhc%nhc_len
366 nhc%nvt(i, :)%nkt = simpar%temp_slow
367 nhc%nvt(i, :)%degrees_of_freedom = 1
368 END DO
369 DEALLOCATE (deg_of_freedom)
370 DEALLOCATE (massive_atom_list)
371
372 ! Let's clean the arrays
373 map_info%s_kin = 0.0_dp
374 map_info%v_scale = 0.0_dp
375 END SELECT
376
377 CALL timestop(handle)
378
379 END SUBROUTINE nhc_to_particle_mapping_slow
380
381! **************************************************************************************************
382!> \brief Creates the thermostatting maps
383!> \param thermostat_info ...
384!> \param simpar ...
385!> \param local_molecules ...
386!> \param molecule_set ...
387!> \param molecule_kind_set ...
388!> \param nhc ...
389!> \param para_env ...
390!> \param gci ...
391!> \par History
392!> \author CJM
393! **************************************************************************************************
394 SUBROUTINE nhc_to_particle_mapping_fast(thermostat_info, simpar, local_molecules, &
395 molecule_set, molecule_kind_set, nhc, para_env, gci)
396
397 TYPE(thermostat_info_type), POINTER :: thermostat_info
398 TYPE(simpar_type), POINTER :: simpar
399 TYPE(distribution_1d_type), POINTER :: local_molecules
400 TYPE(molecule_type), POINTER :: molecule_set(:)
401 TYPE(molecule_kind_type), POINTER :: molecule_kind_set(:)
402 TYPE(lnhc_parameters_type), POINTER :: nhc
403 TYPE(mp_para_env_type), POINTER :: para_env
404 TYPE(global_constraint_type), POINTER :: gci
405
406 CHARACTER(LEN=*), PARAMETER :: routinen = 'nhc_to_particle_mapping_fast'
407
408 INTEGER :: handle, i, imap, j, natoms_local, &
409 sum_of_thermostats
410 INTEGER, DIMENSION(:), POINTER :: deg_of_freedom, massive_atom_list
411 REAL(kind=dp) :: fac
412 TYPE(map_info_type), POINTER :: map_info
413
414 CALL timeset(routinen, handle)
415
416 NULLIFY (massive_atom_list, deg_of_freedom)
417
418 SELECT CASE (simpar%ensemble)
419 CASE DEFAULT
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)
425
426 ! Sum up the number of degrees of freedom on each thermostat.
427 ! first: initialize the target
428 map_info => nhc%map_info
429 map_info%s_kin = 0.0_dp
430 DO i = 1, 3
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
434 END IF
435 END DO
436 END DO
437
438 ! if thermostats are replicated but molecules distributed, we have to
439 ! sum s_kin over all processors
440 IF (map_info%dis_type == do_thermo_communication) CALL para_env%sum(map_info%s_kin)
441
442 ! We know the total number of system thermostats.
443 IF ((sum_of_thermostats == 1) .AND. (map_info%dis_type /= do_thermo_no_communication)) THEN
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!')
447 END IF
448 nhc%nvt(1, 1)%nkt = simpar%temp_fast*fac
449 nhc%nvt(1, 1)%degrees_of_freedom = floor(fac)
450 ELSE
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)
456 END DO
457 END IF
458
459 ! Getting the number of degrees of freedom times k_B T for the rest
460 ! of the chain
461 DO i = 2, nhc%nhc_len
462 nhc%nvt(i, :)%nkt = simpar%temp_fast
463 nhc%nvt(i, :)%degrees_of_freedom = 1
464 END DO
465 DEALLOCATE (deg_of_freedom)
466 DEALLOCATE (massive_atom_list)
467
468 ! Let's clean the arrays
469 map_info%s_kin = 0.0_dp
470 map_info%v_scale = 0.0_dp
471 END SELECT
472
473 CALL timestop(handle)
474
475 END SUBROUTINE nhc_to_particle_mapping_fast
476
477! **************************************************************************************************
478!> \brief Main general setup for Nose-Hoover thermostats
479!> \param nhc ...
480!> \param thermostat_info ...
481!> \param deg_of_freedom ...
482!> \param massive_atom_list ...
483!> \param molecule_kind_set ...
484!> \param local_molecules ...
485!> \param molecule_set ...
486!> \param para_env ...
487!> \param natoms_local ...
488!> \param simpar ...
489!> \param sum_of_thermostats ...
490!> \param gci ...
491!> \param shell ...
492!> \author Teodoro Laino [tlaino] - University of Zurich - 10.2007
493! **************************************************************************************************
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)
497
498 TYPE(lnhc_parameters_type), POINTER :: nhc
499 TYPE(thermostat_info_type), POINTER :: thermostat_info
500 INTEGER, DIMENSION(:), POINTER :: deg_of_freedom, massive_atom_list
501 TYPE(molecule_kind_type), POINTER :: molecule_kind_set(:)
502 TYPE(distribution_1d_type), POINTER :: local_molecules
503 TYPE(molecule_type), POINTER :: molecule_set(:)
504 TYPE(mp_para_env_type), POINTER :: para_env
505 INTEGER, INTENT(OUT) :: natoms_local
506 TYPE(simpar_type), POINTER :: simpar
507 INTEGER, INTENT(OUT) :: sum_of_thermostats
508 TYPE(global_constraint_type), POINTER :: gci
509 LOGICAL, INTENT(IN), OPTIONAL :: shell
510
511 CHARACTER(LEN=*), PARAMETER :: routinen = 'setup_nhc_thermostat'
512
513 INTEGER :: handle, nkind, number, region
514 LOGICAL :: do_shell
515 TYPE(map_info_type), POINTER :: map_info
516
517 CALL timeset(routinen, handle)
518
519 do_shell = .false.
520 IF (PRESENT(shell)) do_shell = shell
521 map_info => nhc%map_info
522
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
527 region = nhc%region
528
529 CALL thermostat_mapping_region(map_info, deg_of_freedom, massive_atom_list, &
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, &
532 sum_of_thermostats)
533
534 ALLOCATE (nhc%nvt(nhc%nhc_len, number))
535
536 ! Now that we know how many there are stick this into nhc%nkt
537 ! (number of degrees of freedom times k_B T for the first thermostat
538 ! on the chain)
539 nhc%loc_num_nhc = number
540 nhc%glob_num_nhc = sum_of_thermostats
541
542 CALL timestop(handle)
543
544 END SUBROUTINE setup_nhc_thermostat
545
546! **************************************************************************************************
547!> \brief ...
548!> \param thermostat_info ...
549!> \param simpar ...
550!> \param local_molecules ...
551!> \param molecule_set ...
552!> \param molecule_kind_set ...
553!> \param nhc ...
554!> \param para_env ...
555!> \param gci ...
556! **************************************************************************************************
557 SUBROUTINE nhc_to_shell_mapping(thermostat_info, simpar, local_molecules, &
558 molecule_set, molecule_kind_set, nhc, para_env, gci)
559
560 TYPE(thermostat_info_type), POINTER :: thermostat_info
561 TYPE(simpar_type), POINTER :: simpar
562 TYPE(distribution_1d_type), POINTER :: local_molecules
563 TYPE(molecule_type), POINTER :: molecule_set(:)
564 TYPE(molecule_kind_type), POINTER :: molecule_kind_set(:)
565 TYPE(lnhc_parameters_type), POINTER :: nhc
566 TYPE(mp_para_env_type), POINTER :: para_env
567 TYPE(global_constraint_type), POINTER :: gci
568
569 CHARACTER(LEN=*), PARAMETER :: routinen = 'nhc_to_shell_mapping'
570
571 INTEGER :: handle, i, imap, j, nshell_local, &
572 sum_of_thermostats
573 INTEGER, DIMENSION(:), POINTER :: deg_of_freedom, massive_shell_list
574 TYPE(map_info_type), POINTER :: map_info
575
576 CALL timeset(routinen, handle)
577
578 NULLIFY (massive_shell_list, deg_of_freedom)
579
580 SELECT CASE (simpar%ensemble)
581 CASE DEFAULT
582 cpabort('Unknown ensemble!')
585 cpabort('Never reach this point!')
588
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.)
592
593 map_info => nhc%map_info
594 ! Sum up the number of degrees of freedom on each thermostat.
595 ! first: initialize the target, via p_kin init s_kin
596 map_info%s_kin = 0.0_dp
597 DO j = 1, nshell_local
598 DO i = 1, 3
599 map_info%p_kin(i, j)%point = map_info%p_kin(i, j)%point + 1
600 END DO
601 END DO
602
603 ! If thermostats are replicated but molecules distributed, we have to
604 ! sum s_kin over all processors
605 IF (map_info%dis_type == do_thermo_communication) CALL para_env%sum(map_info%s_kin)
606
607 ! Now that we know how many there are stick this into nhc%nkt
608 ! (number of degrees of freedom times k_B T )
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))
613 END DO
614
615 ! Getting the number of degrees of freedom times k_B T for the rest of the chain
616 DO i = 2, nhc%nhc_len
617 nhc%nvt(i, :)%nkt = simpar%temp_sh_ext
618 nhc%nvt(i, :)%degrees_of_freedom = 1
619 END DO
620 DEALLOCATE (deg_of_freedom)
621 DEALLOCATE (massive_shell_list)
622
623 ! Let's clean the arrays
624 map_info%s_kin = 0.0_dp
625 map_info%v_scale = 0.0_dp
626 END SELECT
627
628 CALL timestop(handle)
629
630 END SUBROUTINE nhc_to_shell_mapping
631
static GRID_HOST_DEVICE double fac(const int i)
Factorial function, e.g. fac(5) = 5! = 120.
Definition grid_common.h:56
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
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_thermo_no_communication
integer, parameter, public do_thermo_only_master
integer, parameter, public nvt_adiabatic_ensemble
integer, parameter, public nph_uniaxial_ensemble
integer, parameter, public npt_i_ensemble
integer, parameter, public isokin_ensemble
integer, parameter, public nph_uniaxial_damped_ensemble
integer, parameter, public npe_f_ensemble
integer, parameter, public langevin_ensemble
integer, parameter, public npe_i_ensemble
integer, parameter, public npt_ia_ensemble
integer, parameter, public nve_ensemble
integer, parameter, public npt_f_ensemble
integer, parameter, public reftraj_ensemble
integer, parameter, public nvt_ensemble
integer, parameter, public do_thermo_communication
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
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.