25 dbcsr_print_statistics
134#include "../base/base_uses.f90"
142 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'cp2k_runs'
169 RECURSIVE SUBROUTINE cp2k_run(input_declaration, input_file_name, output_unit, mpi_comm, initial_variables)
170 TYPE(section_type),
POINTER :: input_declaration
171 CHARACTER(LEN=*),
INTENT(IN) :: input_file_name
172 INTEGER,
INTENT(IN) :: output_unit
174 CLASS(mp_comm_type) :: mpi_comm
175 CHARACTER(len=default_path_length), &
176 DIMENSION(:, :),
INTENT(IN) :: initial_variables
178 INTEGER :: f_env_handle, grid_backend, ierr, &
179 iter_level, method_name_id, &
180 new_env_id, prog_name_id, run_type_id
181#if defined(__DBCSR_ACC)
182 INTEGER,
TARGET :: offload_chosen_device
184 INTEGER,
POINTER :: active_device_id
185 INTEGER(KIND=int_8) :: m_memory_max_mpi
186 LOGICAL :: echo_input, grid_apply_cutoff, &
187 grid_validate, has_excited_states, has_properties, &
189 TYPE(cp_logger_type),
POINTER :: logger, sublogger
190 TYPE(mp_para_env_type),
POINTER :: para_env
191 TYPE(dft_control_type),
POINTER :: dft_control
192 TYPE(f_env_type),
POINTER :: f_env
193 TYPE(force_env_type),
POINTER :: force_env
194 TYPE(global_environment_type),
POINTER :: globenv
195 TYPE(section_vals_type),
POINTER :: glob_section, input_file, root_section, &
198 NULLIFY (para_env, f_env, dft_control, active_device_id)
202#if defined(__DBCSR_ACC)
205 active_device_id => offload_chosen_device
208 CALL dbcsr_init_lib(mpi_comm%get_handle(), io_unit=output_unit, &
209 accdrv_active_device_id=active_device_id)
211 NULLIFY (globenv, force_env)
217 input_file =>
read_input(input_declaration, input_file_name, &
218 initial_variables=initial_variables, &
227 IF (echo_input .AND. (output_unit > 0))
THEN
229 unit_nr=output_unit, &
231 hide_defaults=.false.)
234 CALL check_cp2k_input(input_declaration, input_file, para_env=para_env, output_unit=output_unit)
235 root_section => input_file
242 IF (prog_name_id /=
do_cp2k)
THEN
246 CALL cp2k_init(para_env, output_unit, globenv, input_file_name=input_file_name)
247 CALL cp2k_read(root_section, para_env, globenv)
248 CALL cp2k_setup(root_section, para_env, globenv)
252 IF (output_unit > 0 .AND. &
254 CALL dbcsr_print_config(unit_nr=output_unit)
255 WRITE (unit=output_unit, fmt=
'()')
267 SELECT CASE (prog_name_id)
274 CALL run_swarm(input_declaration, root_section, para_env, globenv, input_file_name)
276 CALL dbcsr_finalize_lib()
277 CALL farming_run(input_declaration, root_section, para_env, initial_variables)
278 CALL dbcsr_init_lib(mpi_comm%get_handle(), io_unit=output_unit, &
279 accdrv_active_device_id=active_device_id)
285 input_declaration=input_declaration, &
286 input_path=input_file_name, &
287 output_path=
"__STD_OUT__", mpi_comm=para_env, &
288 output_unit=output_unit, &
289 owns_out_unit=.false., &
290 input=input_file, ierr=ierr)
293 force_env => f_env%force_env
296 CALL lib_test(root_section, para_env, globenv)
298 CALL do_tmc(input_declaration, root_section, para_env, globenv)
302 cpabort(
"Unknown program")
306 SELECT CASE (globenv%run_type_id)
308 CALL do_pint_run(para_env, root_section, input_declaration, globenv)
314 IF (method_name_id /=
do_qs .AND. &
316 method_name_id /=
do_qmmm .AND. &
318 method_name_id /=
do_nnp .AND. &
320 method_name_id /=
do_fist .AND. &
321 method_name_id /=
do_ipi)
THEN
322 cpabort(
"Energy/Force run not available for all methods ")
327 n_rlevel_new=iter_level)
338 IF (method_name_id ==
do_qs)
THEN
339 CALL get_qs_env(force_env%qs_env, dft_control=dft_control)
344 force_env%qs_env%skip_wf_history = .NOT. (has_properties .OR. has_excited_states .OR. &
345 dft_control%qs_control%cdft .OR. &
346 dft_control%qs_control%et_coupling_calc .OR. &
347 dft_control%do_xas_calculation .OR. &
348 dft_control%do_xas_tdp_calculation .OR. &
352 SELECT CASE (globenv%run_type_id)
358 cpabort(
"Unknown run type")
360 IF (method_name_id ==
do_qs) force_env%qs_env%skip_wf_history = .false.
361 CALL cp_rm_iter_level(sublogger%iter_info, level_name=
"JUST_ENERGY", n_rlevel_att=iter_level)
369 CALL do_mon_car(force_env, globenv, input_declaration, input_file_name)
371 CALL qs_tamc(force_env, globenv)
373 IF (method_name_id /=
do_qs)
THEN
374 cpabort(
"Real time propagation needs METHOD QS. ")
376 CALL get_qs_env(force_env%qs_env, dft_control=dft_control)
377 dft_control%rtp_control%fixed_ions = .true.
378 SELECT CASE (dft_control%rtp_control%rtp_method)
390 IF (method_name_id /=
do_qs)
THEN
391 cpabort(
"Ehrenfest dynamics needs METHOD QS ")
393 CALL get_qs_env(force_env%qs_env, dft_control=dft_control)
394 dft_control%rtp_control%fixed_ions = .false.
399 IF (method_name_id /=
do_qs .AND. &
400 method_name_id /=
do_qmmm)
THEN
401 cpabort(
"Property calculations by Linear Response only within the QS or QMMM program ")
407 SELECT CASE (method_name_id)
411 cpabort(
"Debug run available only with QS, FIST, and QMMM program ")
414 CALL vb_anal(root_section, input_declaration, para_env, globenv)
416 CALL neb(root_section, input_declaration, para_env, globenv)
422 IF (method_name_id /=
do_qs)
THEN
423 cpabort(
"RUN_TYPE MTLR is available only for METHOD QS.")
427 cpabort(
"Unknown run type")
433 CALL dbcsr_print_statistics()
439 CALL mpi_comm%max(m_memory_max_mpi)
440 IF (output_unit > 0)
THEN
441 WRITE (output_unit, *)
442 WRITE (output_unit,
'(T2,"MEMORY| Estimated peak process memory [MiB]",T73,I8)') &
443 (m_memory_max_mpi + (1024*1024) - 1)/(1024*1024)
446 IF (prog_name_id ==
do_cp2k)
THEN
447 f_env%force_env => force_env
448 IF (
ASSOCIATED(force_env%globenv))
THEN
449 IF (.NOT.
ASSOCIATED(force_env%globenv, globenv))
THEN
453 force_env%globenv => globenv
460 i_was_ionode = para_env%is_source()
462 cpassert(globenv%ref_count == 1)
467 CALL dbcsr_finalize_lib()
471 END SUBROUTINE cp2k_run
484 RECURSIVE SUBROUTINE farming_run(input_declaration, root_section, para_env, initial_variables)
485 TYPE(section_type),
POINTER :: input_declaration
486 TYPE(section_vals_type),
POINTER :: root_section
487 TYPE(mp_para_env_type),
POINTER :: para_env
488 CHARACTER(len=default_path_length),
DIMENSION(:, :),
INTENT(IN) :: initial_variables
490 CHARACTER(len=*),
PARAMETER :: routineN =
'farming_run'
491 INTEGER,
PARAMETER :: minion_status_done = -3, &
492 minion_status_wait = -4
494 CHARACTER(len=7) :: label
495 CHARACTER(LEN=default_path_length) :: output_file
496 CHARACTER(LEN=default_string_length) :: str
497 INTEGER :: dest, handle, i, i_job_to_restart, ierr, ijob, ijob_current, &
498 ijob_end, ijob_start, iunit, n_jobs_to_run, new_output_unit, &
499 new_rank, ngroups, num_minions, output_unit, primus_minion, &
500 minion_rank, source, tag, todo
501 INTEGER,
DIMENSION(:),
POINTER :: group_distribution, &
502 captain_minion_partition, &
503 minion_distribution, &
505 LOGICAL :: found, captain, minion
506 REAL(KIND=
dp) :: t1, t2
507 REAL(KIND=
dp),
ALLOCATABLE,
DIMENSION(:) :: waittime
508 TYPE(cp_logger_type),
POINTER :: logger
509 TYPE(cp_parser_type),
POINTER :: my_parser
510 TYPE(cp_unit_set_type) :: default_units
511 TYPE(farming_env_type),
POINTER :: farming_env
512 TYPE(section_type),
POINTER :: g_section
513 TYPE(section_vals_type),
POINTER :: g_data
514 TYPE(mp_comm_type) :: minion_group, new_group
517 CALL timeset(routinen, handle)
518 NULLIFY (my_parser, g_section, g_data)
524 IF (output_unit > 0)
WRITE (output_unit, fmt=
"(T2,A)")
"FARMING| Hi, welcome on this farm!"
526 ALLOCATE (farming_env)
535 IF (farming_env%captain_minion)
THEN
536 IF (output_unit > 0)
WRITE (output_unit, fmt=
"(T2,A)")
"FARMING| Using a Captain-Minion setup"
538 ALLOCATE (captain_minion_partition(0:1))
539 captain_minion_partition = [1, para_env%num_pe - 1]
540 ALLOCATE (group_distribution(0:para_env%num_pe - 1))
542 CALL minion_group%from_split(para_env, ngroups, group_distribution, &
543 n_subgroups=2, group_partition=captain_minion_partition)
544 DEALLOCATE (captain_minion_partition)
545 DEALLOCATE (group_distribution)
546 num_minions = minion_group%num_pe
547 minion_rank = minion_group%mepos
549 IF (para_env%mepos == 0)
THEN
553 cpassert(num_minions == 1)
554 num_minions = para_env%num_pe - 1
557 cpassert(num_minions == para_env%num_pe - 1)
560 IF (output_unit > 0)
WRITE (output_unit, fmt=
"(T2,A)")
"FARMING| Using a Minion-only setup"
561 CALL minion_group%from_dup(para_env)
562 num_minions = minion_group%num_pe
563 minion_rank = minion_group%mepos
565 IF (output_unit > 0)
WRITE (output_unit, fmt=
"(T2,A,I0)")
"FARMING| Number of Minions ", num_minions
568 ALLOCATE (minion_distribution(0:para_env%num_pe - 1))
569 minion_distribution = 0
570 minion_distribution(para_env%mepos) = minion_rank
571 CALL para_env%sum(minion_distribution)
574 DO i = 1, para_env%num_pe - 1
575 IF (minion_distribution(i) == 0) primus_minion = i
580 ALLOCATE (group_distribution(0:num_minions - 1))
581 group_distribution = -1
583 IF (farming_env%group_size_wish_set)
THEN
584 farming_env%group_size_wish = min(farming_env%group_size_wish, para_env%num_pe)
585 CALL new_group%from_split(minion_group, ngroups, group_distribution, &
586 subgroup_min_size=farming_env%group_size_wish, stride=farming_env%stride)
587 ELSE IF (farming_env%ngroup_wish_set)
THEN
588 IF (
ASSOCIATED(farming_env%group_partition))
THEN
589 CALL new_group%from_split(minion_group, ngroups, group_distribution, &
590 n_subgroups=farming_env%ngroup_wish, &
591 group_partition=farming_env%group_partition, stride=farming_env%stride)
593 CALL new_group%from_split(minion_group, ngroups, group_distribution, &
594 n_subgroups=farming_env%ngroup_wish, stride=farming_env%stride)
597 cpabort(
"must set either group_size_wish or ngroup_wish")
599 new_rank = new_group%mepos
603 IF (farming_env%captain_minion)
THEN
604 IF (para_env%mepos == primus_minion)
THEN
606 CALL para_env%send(group_distribution, 0, tag)
608 CALL para_env%send(ngroups, 0, tag)
610 IF (para_env%mepos == 0)
THEN
612 CALL para_env%recv(group_distribution, primus_minion, tag)
614 CALL para_env%recv(ngroups, primus_minion, tag)
619 IF (output_unit > 0)
THEN
620 WRITE (output_unit, fmt=
"(T2,A,T71,I10)")
"FARMING| Number of created MPI (Minion) groups:", ngroups
621 WRITE (output_unit, fmt=
"(T2,A)", advance=
"NO")
"FARMING| MPI (Minion) process to group correspondence:"
622 DO i = 0, num_minions - 1
623 IF (
modulo(i, 4) == 0)
WRITE (output_unit, *)
624 WRITE (output_unit, fmt=
'(A3,I6,A3,I6,A1)', advance=
"NO") &
625 " (", i,
" : ", group_distribution(i),
")"
627 WRITE (output_unit, *)
633 IF (farming_env%cycle)
THEN
634 n_jobs_to_run = farming_env%max_steps*ngroups
635 i_job_to_restart =
modulo(farming_env%restart_n + n_jobs_to_run - 1, farming_env%njobs) + 1
637 n_jobs_to_run = min(farming_env%njobs, farming_env%max_steps*ngroups)
638 n_jobs_to_run = min(n_jobs_to_run, farming_env%njobs - farming_env%restart_n + 1)
639 i_job_to_restart = n_jobs_to_run + farming_env%restart_n
644 extension=
".restart")
646 WRITE (iunit, *) i_job_to_restart
651 ijob_start = farming_env%restart_n
652 ijob_end = ijob_start + n_jobs_to_run - 1
653 IF (output_unit > 0 .AND. ijob_end - ijob_start < 0)
THEN
654 WRITE (output_unit, fmt=
"(T2,A)")
"FARMING| --- WARNING --- NO JOBS NEED EXECUTION ? "
655 WRITE (output_unit, fmt=
"(T2,A)")
"FARMING| is the cycle keyword required ?"
656 WRITE (output_unit, fmt=
"(T2,A)")
"FARMING| or is a stray RESTART file present ?"
657 WRITE (output_unit, fmt=
"(T2,A)")
"FARMING| or is the group_size requested smaller than the number of CPUs?"
661 IF (farming_env%captain_minion)
THEN
666 IF (new_rank == 0)
THEN
671 CALL para_env%send(todo, dest, tag)
676 CALL para_env%recv(todo, source, tag)
679 CALL new_group%bcast(todo, 0)
681 CALL new_group%bcast(todo, 0)
691 IF (t2 - t1 > farming_env%wait_time)
EXIT
696 CALL execute_job(todo)
700 ALLOCATE (minion_status(0:ngroups - 1))
701 minion_status = minion_status_wait
702 ijob_current = ijob_start - 1
705 IF (all(minion_status == minion_status_done))
EXIT
710 CALL para_env%recv(todo, source, tag)
713 IF (output_unit > 0)
THEN
714 WRITE (output_unit, fmt=*)
"Job finished: ", todo
720 CALL get_next_job(farming_env, ijob_start, ijob_end, ijob_current, todo)
723 CALL para_env%send(todo, dest, tag)
727 IF (output_unit > 0)
THEN
728 WRITE (output_unit, fmt=*)
"Job: ", todo,
" Dir: ", trim(farming_env%Job(todo)%cwd), &
729 " assigned to group ", group_distribution(minion_distribution(dest))
734 minion_status(group_distribution(minion_distribution(dest))) = minion_status_done
735 IF (output_unit > 0)
THEN
736 WRITE (output_unit, fmt=*)
"group done: ", group_distribution(minion_distribution(dest))
741 IF (output_unit > 0)
THEN
742 WRITE (output_unit, fmt=*)
""
743 WRITE (output_unit, fmt=*)
"FARMING JOB DEADLOCKED ... CIRCULAR DEPENDENCIES"
744 WRITE (output_unit, fmt=*)
""
753 DEALLOCATE (minion_status)
760 IF (output_unit > 0)
THEN
761 IF (ijob_end - ijob_start >= 0)
THEN
762 WRITE (output_unit, fmt=
"(T2,A)")
"FARMING| List of jobs : "
763 DO ijob = ijob_start, ijob_end
764 i =
modulo(ijob - 1, farming_env%njobs) + 1
765 WRITE (output_unit, fmt=*)
"Job: ", i,
" Dir: ", trim(farming_env%Job(i)%cwd),
" Input: ", &
766 trim(farming_env%Job(i)%input),
" MPI group:",
modulo(i - 1, ngroups)
772 DO ijob = ijob_start, ijob_end
773 i =
modulo(ijob - 1, farming_env%njobs) + 1
775 IF (
modulo(i - 1, ngroups) == group_distribution(minion_rank))
THEN
776 IF (output_unit > 0)
THEN
777 WRITE (output_unit, fmt=
"(T2,A,I5.5,A)", advance=
"NO")
" Running Job ", i, &
778 " in "//trim(farming_env%Job(i)%cwd)//
"."
782 IF (output_unit > 0)
THEN
783 WRITE (output_unit, fmt=
"(A)")
" Done, output in "//trim(output_file)
795 ALLOCATE (waittime(0:para_env%num_pe - 1))
797 waittime(para_env%mepos) = t2 - t1
798 CALL para_env%sum(waittime)
799 IF (output_unit > 0)
THEN
800 WRITE (output_unit,
'(T2,A)')
"Process idle times [s] at the end of the run"
801 DO i = 0, para_env%num_pe - 1
802 WRITE (output_unit, fmt=
'(A2,I6,A3,F8.3,A1)', advance=
"NO") &
803 " (", i,
" : ", waittime(i),
")"
804 IF (mod(i + 1, 4) == 0)
WRITE (output_unit,
'(A)')
""
808 DEALLOCATE (waittime)
811 IF (minion)
CALL new_group%free()
812 CALL minion_group%free()
815 DEALLOCATE (group_distribution)
816 DEALLOCATE (minion_distribution)
822 "FARMING%PROGRAM_RUN_INFO")
824 CALL timestop(handle)
831 RECURSIVE SUBROUTINE execute_job(i)
836 CALL m_chdir(trim(farming_env%Job(i)%cwd), ierr)
838 cpabort(
"Failed to change dir to: "//trim(farming_env%Job(i)%cwd))
842 IF (new_rank == 0)
THEN
844 IF (farming_env%Job(i)%output ==
"")
THEN
846 WRITE (output_file,
'(A12,I5.5)')
"FARMING_OUT_", i
848 CALL parser_create(my_parser, file_name=trim(farming_env%Job(i)%input))
859 IF (str /=
"") output_file = trim(str)//
".out"
862 IF (str /=
"") output_file = str
867 DEALLOCATE (my_parser)
869 output_file = farming_env%Job(i)%output
872 CALL open_file(file_name=trim(output_file), &
873 file_action=
"WRITE", &
874 file_status=
"UNKNOWN", &
875 file_position=
"APPEND", &
876 unit_number=new_output_unit)
884 CALL cp2k_run(input_declaration, trim(farming_env%Job(i)%input), new_output_unit, new_group, initial_variables)
886 IF (new_rank == 0)
CALL close_file(unit_number=new_output_unit)
889 CALL m_chdir(trim(farming_env%cwd), ierr)
892 END SUBROUTINE execute_job
893 END SUBROUTINE farming_run
900 INTEGER :: i, unit_number
903 NULLIFY (root_section)
906 CALL open_file(unit_number=unit_number, &
907 file_name=
"cp2k_input.xml", &
908 file_action=
"WRITE", &
909 file_status=
"REPLACE")
911 WRITE (unit=unit_number, fmt=
"(A)")
'<?xml version="1.0" encoding="utf-8"?>'
914 WRITE (unit=unit_number, fmt=
"(A)") &
916 " <CP2K_VERSION>"//trim(
cp2k_version)//
"</CP2K_VERSION>", &
917 " <CP2K_YEAR>"//trim(
cp2k_year)//
"</CP2K_YEAR>", &
918 " <COMPILE_DATE>"//trim(
compile_date)//
"</COMPILE_DATE>", &
924 DO i = 1, root_section%n_subsections
928 WRITE (unit=unit_number, fmt=
"(A)")
"</CP2K_INPUT>"
947 SUBROUTINE run_input(input_declaration, input_file_path, output_file_path, initial_variables, mpi_comm)
949 CHARACTER(len=*),
INTENT(in) :: input_file_path, output_file_path
950 CHARACTER(len=default_path_length), &
951 DIMENSION(:, :),
INTENT(IN) :: initial_variables
957 IF (
PRESENT(mpi_comm))
THEN
961 para_env => f77_default_para_env
962 CALL para_env%retain()
964 IF (para_env%is_source())
THEN
965 IF (output_file_path ==
"__STD_OUT__")
THEN
968 INQUIRE (file=output_file_path, number=unit_nr)
973 CALL cp2k_run(input_declaration, input_file_path, unit_nr, para_env, initial_variables)
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
void apply_cutoff(void *ptr)
subroutine, public atom_code(root_section)
Driver routine to perform atomic calculations.
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public cp2kqs2020
integer, save, public iannuzzi2026
Module to perform a counterpoise correction (BSSE).
subroutine, public do_bsse_calculation(force_env, globenv)
Perform an COUNTERPOISE CORRECTION (BSSE) For a 2-body system the correction scheme can be represente...
performs CELL optimization
subroutine, public cp_cell_opt(force_env, globenv)
Main driver to perform geometry optimization.
Debug energy and derivatives w.r.t. finite differences.
subroutine, public cp2k_debug_energy_and_forces(force_env)
...
some minimal info about CP2K, including its version and license
character(len=default_string_length), save, public compile_date
character(len= *), parameter, public compile_revision
character(len= *), parameter, public cp2k_year
character(len= *), parameter, public cp2k_version
subroutine, public run_input(input_declaration, input_file_path, output_file_path, initial_variables, mpi_comm)
runs the given input
subroutine, public write_xml_file()
...
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
Routines that link DBCSR and CP2K concepts together.
subroutine, public cp_dbcsr_config(root_section)
Configures options for DBCSR.
Utility routines to open and close files. Tracking of preconnections.
subroutine, public open_file(file_name, file_status, file_form, file_action, file_position, file_pad, unit_number, debug, skip_get_unit_number, file_access)
Opens the requested file using a free unit number.
subroutine, public close_file(unit_number, file_status, keep_preconnection)
Close an open file given by its logical unit number. Optionally, keep the file and unit preconnected.
various routines to log and control the output. The idea is that decisions about where to log should ...
logical function, public cp_logger_would_log(logger, level)
this function can be called to check if the logger would log a message with the given level from the ...
integer, parameter, public cp_note_level
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,...
subroutine, public cp_rm_iter_level(iteration_info, level_name, n_rlevel_att)
Removes an iteration level.
subroutine, public cp_add_iter_level(iteration_info, level_name, n_rlevel_new)
Adds an iteration level.
Utility routines to read data from files. Kept as close as possible to the old parser because.
subroutine, public parser_search_string(parser, string, ignore_case, found, line, begin_line, search_from_begin_of_file)
Search a string pattern in a file defined by its logical unit number "unit". A case sensitive search ...
Utility routines to read data from files. Kept as close as possible to the old parser because.
subroutine, public parser_release(parser)
releases the parser
subroutine, public parser_create(parser, file_name, unit_nr, para_env, end_section_label, separator_chars, comment_char, continuation_char, quote_char, section_char, parse_white_lines, initial_variables, apply_preprocessing)
Start a parser run. Initial variables allow to @SET stuff before opening the file.
subroutine, public cp_unit_set_release(unit_set)
releases the given unit set
subroutine, public cp_unit_set_create(unit_set, name)
initializes the given unit set
subroutine, public export_units_as_xml(iw)
Exports all available units as XML.
subroutine validate(matrix)
Dummy for when DBM_VALIDATE_AGAINST_DBCSR is not defined.
subroutine, public dbm_library_print_stats(mpi_comm, output_unit)
Print DBM library statistics.
Sets up and terminates the global environment variables.
subroutine, public cp2k_finalize(root_section, para_env, globenv, wdir, q_finalize)
Writes final timings and banner for CP2K.
subroutine, public cp2k_read(root_section, para_env, globenv)
read part of cp2k_init
subroutine, public cp2k_init(para_env, output_unit, globenv, input_file_name, wdir)
Initializes a CP2K run (setting of the global environment variables).
subroutine, public cp2k_setup(root_section, para_env, globenv)
globenv initializations that need the input and error
interface to use cp2k as library
recursive subroutine, public destroy_force_env(env_id, ierr, q_finalize)
deallocates the force_env with the given id
subroutine, public f_env_add_defaults(f_env_id, f_env, handle)
adds the default environments of the f_env to the stack of the defaults, and returns a new error and ...
type(mp_para_env_type), pointer, save, public default_para_env
recursive subroutine, public create_force_env(new_env_id, input_declaration, input_path, output_path, mpi_comm, output_unit, owns_out_unit, input, ierr, work_dir, initial_variables)
creates a new force environment using the given input, and writing the output to the given output uni...
subroutine, public f_env_rm_defaults(f_env, ierr, handle)
removes the default environments of the f_env to the stack of the defaults, and sets ierr accordingly...
recursive subroutine, public calc_force(env_id, pos, n_el_pos, e_pot, force, n_el_force, ierr)
returns the energy of the configuration given by the positions passed as argument
subroutine, public farming_parse_input(farming_env, root_section, para_env)
...
integer, parameter, public do_nothing
integer, parameter, public do_wait
subroutine, public get_next_job(farming_env, start, end, current, todo)
...
integer, parameter, public do_deadlock
subroutine, public deallocate_farming_env(farming_env)
deallocates all associated fields of the farming_env type and the type itself
integer, parameter, public job_finished
integer, parameter, public job_running
subroutine, public init_farming_env(farming_env)
help poor compilers do their job i.e. provide a default initialization
Interface for the force calculations.
recursive subroutine, public force_env_calc_energy_force(force_env, calc_force, consistent_energies, skip_external_control, eval_energy_forces, require_consistent_energy_force, linres, calc_stress_tensor)
Interface routine for force and energy calculations.
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
performs geometry optimization
subroutine, public cp_geo_opt(force_env, globenv, eval_opt_geo, rm_restart_info)
Main driver to perform geometry optimization.
Define type storing the global information of a run. Keep the amount of stored data small....
subroutine, public globenv_create(globenv)
Creates the global environment globenv.
subroutine, public globenv_release(globenv)
Releases the global environment globenv.
Fortran API for the grid package, which is written in C.
subroutine, public grid_library_set_config(backend, validate, apply_cutoff)
Configures the grid library.
subroutine, public grid_library_print_stats(mpi_comm, output_unit)
Print grid library statistics.
Driver mode - To communicate with i-PI Python wrapper.
subroutine, public run_driver(force_env, globenv)
...
Defines the basic variable types.
integer, parameter, public int_8
integer, parameter, public dp
integer, parameter, public default_string_length
integer, parameter, public default_path_length
Performance tests for basic tasks like matrix multiplies, copy, fft.
subroutine, public lib_test(root_section, para_env, globenv)
Master routine for tests.
Machine interface based on Fortran 2003 and POSIX.
integer, parameter, public default_output_unit
subroutine, public m_memory(mem)
Returns the total amount of memory [bytes] in use, if known, zero otherwise.
subroutine, public m_flush(lunit)
flushes units if the &GLOBAL flag is set accordingly
subroutine, public m_getcwd(curdir)
...
subroutine, public m_chdir(dir, ierror)
...
integer(kind=int_8), save, public m_memory_max
real(kind=dp) function, public m_walltime()
returns time from a real-time clock, protected against rolling early/easily
preps the system for a Monte Carlo run (sets up some environments, calls the routines to read in the ...
subroutine, public do_mon_car(force_env_1, globenv, input_declaration, input_file_name)
starts the Monte Carlo simulation and determines which ensemble we're running
Perform a molecular dynamics (MD) run using QUICKSTEP.
subroutine, public qs_mol_dyn(force_env, globenv, averages, rm_restart_info, hmc_e_initial, hmc_e_final, mdctrl)
Main driver module for Molecular Dynamics.
Interface to the message passing library MPI.
subroutine, public mp_para_env_release(para_env)
releases the para object (to be called when you don't want anymore the shared copy of this object)
integer, parameter, public mp_any_source
Module containing the main loop for simulations with the MiMiC framework.
subroutine, public do_mimic_loop(force_env)
The main loop for a MiMiC run.
Subroutines to perform calculations on molecules from a bigger system. Useful to generate a high-qual...
subroutine, public loop_over_molecules(globenv, force_env)
Prepare data for calculations on isolated molecules.
logical function, public do_mol_loop(force_env)
Is the loop over molecules requested?
Driver for self-consistent minimum tracking linear response U and J calculations.
subroutine, public do_mtlr_u_j(force_env)
Driver for self-consistent MTLR U/J iteration. Each outer iteration performs: 1) one standard ENERGY ...
Module performing a Nudged Elastic Band Calculation.
subroutine, public neb(input, input_declaration, para_env, globenv)
Real subroutine for NEB calculations.
NEGF based quantum transport calculations.
subroutine, public do_negf(force_env)
Perform NEGF calculation.
Fortran API for the offload package, which is written in C.
integer function, public offload_get_device_count()
Returns the number of available devices.
subroutine, public offload_mempool_stats_print(mpi_comm, output_unit)
Print allocation statistics.
integer function, public offload_get_chosen_device()
Returns the chosen device.
subroutine, public run_optimize_basis(input_declaration, root_section, para_env, globenv)
main entry point for methods aimed at optimizing basis sets
Methods to performs a path integral run.
subroutine, public do_pint_run(para_env, input, input_declaration, globenv)
Perform a path integral simulation.
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, mimic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_vhxc, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Get the QUICKSTEP environment.
Contains the setup for the calculation of properties by linear response by the application of second ...
subroutine, public linres_calculation(force_env)
Driver for the linear response calculatios.
provides a uniform framework to add references to CP2K cite and output these
subroutine, public cite_reference(key)
marks a given reference as cited.
subroutine, public export_references_as_xml(unit)
Exports all references as XML.
Routines for the propagation of the linearized RT-BSE equations of motion. Propagates the first-order...
subroutine, public run_propagation_linearized_bse(force_env)
Runs the electron-only real time propagation of the linearized BSE.
Routines for the propagation via RT-BSE method.
subroutine, public run_propagation_bse(force_env)
Runs the electron-only real time BSE propagation.
Routines for the real time propagation.
subroutine, public rt_prop_setup(force_env)
creates rtp_type, gets the initial state, either by reading MO's from file or calling SCF run
Swarm-framwork, provides a convenient master/worker architecture.
subroutine, public run_swarm(input_declaration, root_section, para_env, globenv, input_path)
Central driver routine of the swarm framework, called by cp2k_runs.F.
Perform a temperature accelarated hybrid monte carlo (TAHMC) run using QUICKSTEP.
subroutine, public qs_tamc(force_env, globenv, averages)
Driver routine for TAHMC.
Tree Monte Carlo entry point, set up, CPU redistribution and input reading.
subroutine, public do_analyze_files(input_declaration, root_section, para_env)
analyze TMC trajectory files
subroutine, public do_tmc(input_declaration, root_section, para_env, globenv)
tmc_entry point
Module performing a vibrational analysis.
subroutine, public vb_anal(input, input_declaration, para_env, globenv)
Module performing a vibrational analysis.
type of a logger, at the moment it contains just a print level starting at which level it should be l...
stores the default units to be used
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