84#include "../../base/base_uses.f90"
94 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'thermostat_methods'
112 para_env, globenv, global_section)
121 CHARACTER(LEN=default_path_length) :: binary_restart_file_name
123 LOGICAL :: apply_general_thermo, apply_thermo_adiabatic, apply_thermo_baro, &
124 apply_thermo_shell, explicit_adiabatic_fast, explicit_adiabatic_slow, explicit_baro, &
125 explicit_barostat_section, explicit_part, explicit_shell, save_mem, shell_adiabatic, &
136 TYPE(
section_vals_type),
POINTER :: adiabatic_fast_section, adiabatic_slow_section, &
137 barostat_section, print_section, region_section_fast, region_section_slow, &
138 region_sections, thermo_baro_section, thermo_part_section, thermo_shell_section, &
141 NULLIFY (qmmm_env, cell)
142 ALLOCATE (thermostats)
152 CALL force_env_get(force_env, qmmm_env=qmmm_env, subsys=subsys, cell=cell)
158 CALL section_vals_get(adiabatic_fast_section, explicit=explicit_adiabatic_fast)
159 CALL section_vals_get(adiabatic_slow_section, explicit=explicit_adiabatic_slow)
166 (.NOT. apply_thermo_adiabatic)
168 apply_general_thermo = apply_thermo_baro .OR. (simpar%ensemble ==
nvt_ensemble) .AND. &
169 (.NOT. apply_thermo_adiabatic)
171 apply_thermo_shell = (simpar%ensemble ==
nve_ensemble) .OR. &
178 (.NOT. apply_thermo_adiabatic)
180 binary_restart_file_name =
""
182 c_val=binary_restart_file_name)
190 IF (explicit_adiabatic_fast)
CALL section_vals_val_get(adiabatic_fast_section,
"REGION", i_val=region)
191 IF (explicit_adiabatic_slow)
CALL section_vals_val_get(adiabatic_slow_section,
"REGION", i_val=region)
192 CALL cp_subsys_get(subsys, molecule_kinds=molecule_kinds, local_molecules=local_molecules, &
193 molecules=molecules, gci=gci, particles=particles)
195 print_section, particles, gci)
196 IF (explicit_adiabatic_fast .AND. explicit_adiabatic_slow)
THEN
197 IF (apply_thermo_adiabatic)
THEN
198 ALLOCATE (thermostats%thermostat_fast)
201 ALLOCATE (thermostats%thermostat_slow)
205 molecule_kinds%els, local_molecules, molecules, particles, &
206 region, simpar%ensemble, region_sections=region_section_fast, &
210 molecule_kinds%els, local_molecules, molecules, particles, &
211 region, simpar%ensemble, region_sections=region_section_slow, &
217 molecules%els, molecule_kinds%els, para_env, globenv, &
218 thermostats%thermostat_fast%nhc, nose_section=work_section, gci=gci, &
222 molecules%els, molecule_kinds%els, para_env, globenv, &
223 thermostats%thermostat_slow%nhc, nose_section=work_section, gci=gci, &
227 CALL cp_warn(__location__, &
228 "Adiabatic Thermostat has been defined but the ensemble provided "// &
229 "does not support thermostat for Particles! Ignoring thermostat input.")
232 DEALLOCATE (thermostats%thermostat_info_fast)
234 DEALLOCATE (thermostats%thermostat_info_fast)
239 CALL cp_subsys_get(subsys, molecule_kinds=molecule_kinds, local_molecules=local_molecules, &
240 molecules=molecules, gci=gci, particles=particles)
242 local_molecules, molecules, particles, print_section, region_sections, gci, &
247 IF (explicit_part)
THEN
248 IF (apply_general_thermo)
THEN
249 ALLOCATE (thermostats%thermostat_part)
253 IF (thermostats%thermostat_part%type_of_thermostat ==
do_thermo_nose)
THEN
257 molecules%els, molecule_kinds%els, para_env, globenv, &
258 thermostats%thermostat_part%nhc, nose_section=work_section, gci=gci, &
259 save_mem=save_mem, binary_restart_file_name=binary_restart_file_name)
260 ELSE IF (thermostats%thermostat_part%type_of_thermostat ==
do_thermo_csvr)
THEN
264 molecules%els, molecule_kinds%els, para_env, &
265 thermostats%thermostat_part%csvr, csvr_section=work_section, &
267 ELSE IF (thermostats%thermostat_part%type_of_thermostat ==
do_thermo_al)
THEN
271 molecules%els, molecule_kinds%els, para_env, &
272 thermostats%thermostat_part%al, al_section=work_section, &
274 ELSE IF (thermostats%thermostat_part%type_of_thermostat ==
do_thermo_gle)
THEN
278 molecules%els, molecule_kinds%els, para_env, &
279 thermostats%thermostat_part%gle, gle_section=work_section, &
280 gci=gci, save_mem=save_mem)
282 CALL thermostat_info(thermostats%thermostat_part,
"PARTICLES", thermo_part_section, &
285 CALL cp_warn(__location__, &
286 "Thermostat for Particles has been defined but the ensemble provided "// &
287 "does not support thermostat for Particles! Ignoring thermostat input.")
289 ELSE IF (apply_general_thermo)
THEN
290 CALL cp_abort(__location__, &
291 "One constant temperature ensemble has been required, but no thermostat for the "// &
292 "particles has been defined. You may want to change your input and add a "// &
293 "THERMOSTAT section in the MD section.")
299 IF (shell_present)
THEN
300 IF (explicit_shell)
THEN
303 IF (apply_thermo_shell)
THEN
304 ALLOCATE (thermostats%thermostat_shell)
307 CALL get_atomic_kind_set(atomic_kind_set=atomic_kinds%els, shell_adiabatic=shell_adiabatic)
311 thermostats%thermostat_info_shell, molecule_kinds%els, &
312 local_molecules, molecules, particles, region, simpar%ensemble, shell=shell_adiabatic, &
313 region_sections=region_sections, qmmm_env=qmmm_env)
314 IF (shell_adiabatic)
THEN
316 IF (thermostats%thermostat_shell%type_of_thermostat ==
do_thermo_nose)
THEN
320 molecules%els, molecule_kinds%els, para_env, globenv, &
321 thermostats%thermostat_shell%nhc, nose_section=work_section, gci=gci, &
322 save_mem=save_mem, binary_restart_file_name=binary_restart_file_name)
323 ELSE IF (thermostats%thermostat_shell%type_of_thermostat ==
do_thermo_csvr)
THEN
327 molecules%els, molecule_kinds%els, para_env, &
328 thermostats%thermostat_shell%csvr, csvr_section=work_section, gci=gci)
330 CALL thermostat_info(thermostats%thermostat_shell,
"CORE-SHELL", thermo_shell_section, &
333 CALL cp_warn(__location__, &
334 "Thermostat for Core-Shell motion only with adiabatic shell-model. "// &
335 "Continuing calculation ignoring the thermostat info! No Thermostat "// &
336 "applied to Shells!")
338 DEALLOCATE (thermostats%thermostat_shell)
340 DEALLOCATE (thermostats%thermostat_info_shell)
343 CALL cp_warn(__location__, &
344 "Thermostat for Shells has been defined but for the selected ensemble the adiabatic "// &
345 "shell model has not been implemented! Ignoring thermostat input.")
348 ELSE IF (explicit_shell)
THEN
349 CALL cp_warn(__location__, &
350 "Thermostat for Shells has been defined but the system provided "// &
351 "does not contain any Shells! Ignoring thermostat input.")
355 IF (explicit_barostat_section)
THEN
356 simpar%temp_baro_ext = simpar%temp_ext
360 cpassert(simpar%temp_baro_ext >= 0.0_dp)
364 IF (apply_thermo_baro)
THEN
367 work_section => thermo_baro_section
370 ALLOCATE (thermostats%thermostat_baro)
374 IF (thermostats%thermostat_baro%type_of_thermostat ==
do_thermo_nose)
THEN
378 nose_section=work_section, save_mem=save_mem)
379 ELSE IF (thermostats%thermostat_baro%type_of_thermostat ==
do_thermo_csvr)
THEN
383 csvr_section=work_section)
385 CALL thermostat_info(thermostats%thermostat_baro,
"BAROSTAT", thermo_baro_section, &
390 CALL update_thermo_baro_section(thermostats%thermostat_baro, thermo_baro_section)
393 IF (explicit_baro)
THEN
394 CALL cp_warn(__location__, &
395 "Thermostat for Barostat has been defined but the ensemble provided "// &
396 "does not support thermostat for Barostat! Ignoring thermostat input.")
405 DEALLOCATE (thermostats%thermostat_info_part)
407 DEALLOCATE (thermostats%thermostat_info_shell)
411 IF ((.NOT.
ASSOCIATED(thermostats%thermostat_part)) .AND. &
412 (.NOT.
ASSOCIATED(thermostats%thermostat_shell)) .AND. &
413 (.NOT.
ASSOCIATED(thermostats%thermostat_baro)) .AND. &
414 (.NOT.
ASSOCIATED(thermostats%thermostat_fast)) .AND. &
415 (.NOT.
ASSOCIATED(thermostats%thermostat_slow)))
THEN
417 DEALLOCATE (thermostats)
430 SUBROUTINE update_thermo_baro_section(thermostat, section)
437 SELECT CASE (thermostat%type_of_thermostat)
452 END SUBROUTINE update_thermo_baro_section
465 SUBROUTINE thermostat_info(thermostat, label, section, simpar, para_env)
467 CHARACTER(LEN=*),
INTENT(IN) :: label
473 REAL(kind=
dp) :: kin_energy, pot_energy, tmp
482 WRITE (iw,
'(/,T2,A)') &
483 'THERMOSTAT| Thermostat information for '//trim(label)
484 SELECT CASE (thermostat%type_of_thermostat)
486 WRITE (iw,
'(T2,A,T63,A)') &
487 'THERMOSTAT| Type of thermostat',
'Nose-Hoover-Chains'
488 WRITE (iw,
'(T2,A,T71,I10)') &
489 'THERMOSTAT| Nose-Hoover-Chain length', thermostat%nhc%nhc_len
491 WRITE (iw,
'(T2,A,T61,F20.6)') &
492 'THERMOSTAT| Nose-Hoover-Chain time constant [fs]', tmp
493 WRITE (iw,
'(T2,A,T71,I10)') &
494 'THERMOSTAT| Order of Yoshida integrator', thermostat%nhc%nyosh
495 WRITE (iw,
'(T2,A,T71,I10)') &
496 'THERMOSTAT| Number of multiple time steps', thermostat%nhc%nc
497 WRITE (iw,
'(T2,A,T61,E20.12)') &
498 'THERMOSTAT| Initial potential energy', pot_energy, &
499 'THERMOSTAT| Initial kinetic energy', kin_energy
501 WRITE (iw,
'(T2,A,T44,A)') &
502 'THERMOSTAT| Type of thermostat',
'Canonical Sampling/Velocity Rescaling'
504 WRITE (iw,
'(T2,A,T61,F20.6)') &
505 'THERMOSTAT| CSVR time constant [fs]', tmp
506 WRITE (iw,
'(T2,A,T61,E20.12)') &
507 'THERMOSTAT| Initial kinetic energy', kin_energy
509 WRITE (iw,
'(T2,A,T44,A)') &
510 'THERMOSTAT| Type of thermostat',
'Adaptive Langevin'
512 WRITE (iw,
'(T2,A,T61,F20.6)') &
513 'THERMOSTAT| Time constant of Nose-Hoover part [fs]', tmp
515 WRITE (iw,
'(T2,A,T61,F20.6)') &
516 'THERMOSTAT| Time constant of Langevin part [fs]', tmp
518 WRITE (iw,
'(T2,A)') &
519 'THERMOSTAT| End of thermostat information for '//trim(label)
523 END SUBROUTINE thermostat_info
540 IF (
ASSOCIATED(thermostat))
THEN
543 cpassert(
ASSOCIATED(thermostat%nhc))
547 cpassert(
ASSOCIATED(thermostat%csvr))
574 particle_set, local_molecules, local_particles, &
575 group, shell_adiabatic, shell_particle_set, &
576 core_particle_set, vel, shell_vel, core_vel)
586 LOGICAL,
INTENT(IN),
OPTIONAL :: shell_adiabatic
587 TYPE(
particle_type),
OPTIONAL,
POINTER :: shell_particle_set(:), &
589 REAL(kind=
dp),
INTENT(INOUT),
OPTIONAL :: vel(:, :), shell_vel(:, :), &
592 IF (
ASSOCIATED(thermostat))
THEN
595 cpassert(
ASSOCIATED(thermostat%nhc))
596 CALL lnhc_particles(thermostat%nhc, molecule_kind_set, molecule_set, &
597 particle_set, local_molecules, group, shell_adiabatic, shell_particle_set, &
598 core_particle_set, vel, shell_vel, core_vel)
601 cpassert(
ASSOCIATED(thermostat%csvr))
602 CALL csvr_particles(thermostat%csvr, molecule_kind_set, molecule_set, &
603 particle_set, local_molecules, group, shell_adiabatic, shell_particle_set, &
604 core_particle_set, vel, shell_vel, core_vel)
605 ELSE IF (thermostat%type_of_thermostat ==
do_thermo_al)
THEN
607 cpassert(
ASSOCIATED(thermostat%al))
608 CALL al_particles(thermostat%al, force_env, molecule_kind_set, molecule_set, &
609 particle_set, local_molecules, local_particles, group, vel)
610 ELSE IF (thermostat%type_of_thermostat ==
do_thermo_gle)
THEN
612 cpassert(
ASSOCIATED(thermostat%gle))
613 CALL gle_particles(thermostat%gle, molecule_kind_set, molecule_set, &
614 particle_set, local_molecules, group, shell_adiabatic, shell_particle_set, &
615 core_particle_set, vel, shell_vel, core_vel)
637 local_particles, group, shell_particle_set, core_particle_set, vel, shell_vel, &
646 TYPE(
particle_type),
OPTIONAL,
POINTER :: shell_particle_set(:), &
648 REAL(kind=
dp),
INTENT(INOUT),
OPTIONAL :: vel(:, :), shell_vel(:, :), &
651 IF (
ASSOCIATED(thermostat))
THEN
654 cpassert(
ASSOCIATED(thermostat%nhc))
655 CALL lnhc_shells(thermostat%nhc, atomic_kind_set, particle_set, local_particles, &
656 group, shell_particle_set, core_particle_set, vel, shell_vel, core_vel)
659 cpassert(
ASSOCIATED(thermostat%csvr))
660 CALL csvr_shells(thermostat%csvr, atomic_kind_set, particle_set, local_particles, &
661 group, shell_particle_set, core_particle_set, vel, shell_vel, core_vel)
subroutine, public al_particles(al, force_env, molecule_kind_set, molecule_set, particle_set, local_molecules, local_particles, group, vel)
...
subroutine, public initialize_al_part(thermostat_info, simpar, local_molecules, molecule, molecule_kind_set, para_env, al, al_section, gci)
...
represent a simple array based list of the given type
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind_set(atomic_kind_set, atom_of_kind, kind_of, natom_of_kind, maxatom, natom, nshell, fist_potential_present, shell_present, shell_adiabatic, shell_check_distance, damping_present)
Get attributes of an atomic kind set.
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public vandevondele2002
Handles all functions related to the CELL.
various routines to log and control the output. The idea is that decisions about where to log should ...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
types that represent a subsys, i.e. a part of the system
subroutine, public cp_subsys_get(subsys, ref_count, atomic_kinds, atomic_kind_set, particles, particle_set, local_particles, molecules, molecule_set, molecule_kinds, molecule_kind_set, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, natom, nparticle, ncore, nshell, nkind, atprop, virial, results, cell)
returns information about various attributes of the given subsys
real(kind=dp) function, public cp_unit_from_cp2k(value, unit_str, defaults, power)
converts from the internal cp2k units to the given unit
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)
...
subroutine, public initialize_csvr_shell(thermostat_info, simpar, local_molecules, molecule, molecule_kind_set, para_env, csvr, csvr_section, gci)
...
subroutine, public initialize_csvr_baro(simpar, csvr, csvr_section)
fire up the thermostats, if NPT
subroutine, public initialize_csvr_part(thermostat_info, simpar, local_molecules, molecule, molecule_kind_set, para_env, csvr, csvr_section, gci)
...
stores a lists of integer that are local to a processor. The idea is that these integers represent ob...
subroutine, public lnhc_barostat(nhc, npt, group)
...
subroutine, public lnhc_shells(nhc, atomic_kind_set, particle_set, local_particles, group, shell_particle_set, core_particle_set, vel, shell_vel, core_vel)
...
subroutine, public lnhc_particles(nhc, 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 initialize_nhc_baro(simpar, para_env, globenv, nhc, nose_section, save_mem)
fire up the thermostats, if NPT
subroutine, public initialize_nhc_slow(thermostat_info, simpar, local_molecules, molecule, molecule_kind_set, para_env, globenv, nhc, nose_section, gci, save_mem)
...
subroutine, public initialize_nhc_shell(thermostat_info, simpar, local_molecules, molecule, molecule_kind_set, para_env, globenv, nhc, nose_section, gci, save_mem, binary_restart_file_name)
...
subroutine, public initialize_nhc_fast(thermostat_info, simpar, local_molecules, molecule, molecule_kind_set, para_env, globenv, nhc, nose_section, gci, save_mem)
...
subroutine, public initialize_nhc_part(thermostat_info, simpar, local_molecules, molecule, molecule_kind_set, para_env, globenv, nhc, nose_section, gci, save_mem, binary_restart_file_name)
...
Lumps all possible extended system variables into one type for easy access and passing.
Interface for the force calculations.
recursive subroutine, public force_env_get(force_env, in_use, fist_env, qs_env, meta_env, fp_env, subsys, para_env, potential_energy, additional_potential, kinetic_energy, harmonic_shell, kinetic_shell, cell, sub_force_env, qmmm_env, qmmmx_env, eip_env, pwdft_env, globenv, input, force_env_section, method_name_id, root_section, mixed_env, nnp_env, embed_env, ipi_env)
returns various attributes about the force environment
subroutine, public gle_particles(gle, 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 initialize_gle_part(thermostat_info, simpar, local_molecules, molecule, molecule_kind_set, para_env, gle, gle_section, gci, save_mem)
...
Define type storing the global information of a run. Keep the amount of stored data small....
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_path_length
Interface to the message passing library MPI.
represent a simple array based list of the given type
Define the molecule kind structure types and the corresponding functionality.
represent a simple array based list of the given type
Define the data structure for the molecule information.
represent a simple array based list of the given type
Define the data structure for the particle information.
Basic container type for QM/MM.
Type for storing MD parameters.
subroutine, public apply_thermostat_baro(thermostat, npt, group)
...
subroutine, public apply_thermostat_shells(thermostat, atomic_kind_set, particle_set, local_particles, group, shell_particle_set, core_particle_set, vel, shell_vel, core_vel)
...
subroutine, public create_thermostats(thermostats, md_section, force_env, simpar, para_env, globenv, global_section)
...
subroutine, public apply_thermostat_particles(thermostat, force_env, molecule_kind_set, molecule_set, particle_set, local_molecules, local_particles, group, shell_adiabatic, shell_particle_set, core_particle_set, vel, shell_vel, core_vel)
...
Thermostat structure: module containing thermostat available for MD.
subroutine, public allocate_thermostats(thermostats)
...
subroutine, public release_thermostat_info(thermostat_info)
...
subroutine, public release_thermostat_type(thermostat)
...
subroutine, public create_thermostat_type(thermostat, simpar, section, skip_region, label)
Create a thermostat type.
subroutine, public release_thermostats(thermostats)
...
Utilities for thermostats.
subroutine, public setup_adiabatic_thermostat_info(thermostat_info, molecule_kind_set, local_molecules, molecules, particles, region, ensemble, nfree, shell, region_sections, qmmm_env)
...
subroutine, public compute_nfree(cell, simpar, molecule_kind_set, print_section, particles, gci)
...
subroutine, public get_thermostat_energies(thermostat, thermostat_pot, thermostat_kin, para_env, array_pot, array_kin)
Calculates energy associated with a thermostat.
subroutine, public setup_thermostat_info(thermostat_info, molecule_kind_set, local_molecules, molecules, particles, region, ensemble, nfree, shell, region_sections, qmmm_env)
...
subroutine, public compute_degrees_of_freedom(thermostats, cell, simpar, molecule_kind_set, local_molecules, molecules, particles, print_section, region_sections, gci, region, qmmm_env)
...
represent a list of objects
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
type of a logger, at the moment it contains just a print level starting at which level it should be l...
represents a system: atoms, molecules, their pos,vel,...
structure to store local (to a processor) ordered lists of integers.
wrapper to abstract the force evaluation of the various methods
contains the initially parsed file and the initial parallel environment
stores all the informations relevant to an mpi environment
represent a list of objects
represent a list of objects
represent a list of objects
Simulation parameter type for molecular dynamics.