50 USE dbt_api,
ONLY: dbt_library_finalize,&
156 USE xc_gauxc_interface,
ONLY: cp_gauxc_status_type,&
161#include "./base/base_uses.f90"
166 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
167 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'f77_interface'
171 TYPE(f_env_type),
POINTER :: f_env => null()
172 END TYPE f_env_p_type
177 LOGICAL :: is_dirty = .true.
182 CHARACTER(len=default_path_length) :: my_path =
"", old_path =
""
185 TYPE(f_env_p_type),
DIMENSION(:),
POINTER,
SAVE ::
f_envs
187 LOGICAL,
SAVE :: module_initialized = .false.
188 INTEGER,
SAVE :: last_f_env_id = 0, n_f_envs = 0
208 FUNCTION get_pos_of_env(env_id)
RESULT(res)
209 INTEGER,
INTENT(in) :: env_id
212 INTEGER :: env_pos, isub
215 DO isub = 1, n_f_envs
216 IF (
f_envs(isub)%f_env%id_nr == env_id)
THEN
221 END FUNCTION get_pos_of_env
233 LOGICAL,
INTENT(in) :: init_mpi
234 INTEGER,
INTENT(out) :: ierr
237 INTEGER :: offload_chosen_device, &
238 offload_device_count, unit_nr
239 TYPE(cp_gauxc_status_type) :: gauxc_status
242 IF (.NOT. module_initialized)
THEN
263 IF (
PRESENT(mpi_comm))
THEN
282 default_global_unit_nr=unit_nr, &
283 close_global_unit_on_dealloc=.false.)
288 module_initialized = .true.
300 IF (offload_device_count > 0)
THEN
306#if defined(__parallel)
309 CALL gauxc_init(status=gauxc_status)
311 CALL gauxc_check_status(gauxc_status)
316 CALL dbt_library_init()
339 INTEGER,
INTENT(IN) :: output_unit
341 INTEGER,
POINTER :: active_device_id
342 INTEGER,
TARGET :: chosen_device
344 NULLIFY (active_device_id)
347 active_device_id => chosen_device
351 accdrv_active_device_id=active_device_id)
361 LOGICAL,
INTENT(in) :: finalize_mpi
362 INTEGER,
INTENT(out) :: ierr
365 TYPE(cp_gauxc_status_type) :: gauxc_status
371 IF (.NOT. module_initialized)
THEN
374 DO ienv = n_f_envs, 1, -1
389 CALL dbt_library_finalize()
395 CALL gauxc_finalize(gauxc_status)
396 CALL gauxc_check_status(gauxc_status)
398 CALL dbcsr_finalize_lib()
413 IF (finalize_mpi)
THEN
426 RECURSIVE SUBROUTINE f_env_dealloc(f_env)
431 cpassert(
ASSOCIATED(f_env))
436 IF (f_env%old_path /= f_env%my_path)
THEN
437 CALL m_chdir(f_env%old_path, ierr)
440 END SUBROUTINE f_env_dealloc
453 SUBROUTINE f_env_create(f_env, force_env, timer_env, mp_perf_env, id_nr, logger, old_dir)
458 INTEGER,
INTENT(in) :: id_nr
460 CHARACTER(len=*),
INTENT(in) :: old_dir
463 f_env%force_env => force_env
465 f_env%logger => logger
467 f_env%timer_env => timer_env
473 f_env%old_path = old_dir
474 END SUBROUTINE f_env_create
482 INTEGER,
INTENT(in) :: f_env_id
488 f_env_pos = get_pos_of_env(f_env_id)
489 IF (f_env_pos < 1)
THEN
492 f_env =>
f_envs(f_env_pos)%f_env
513 INTEGER,
INTENT(in) :: f_env_id
515 INTEGER,
INTENT(out),
OPTIONAL :: handle
517 INTEGER :: f_env_pos, ierr
521 f_env_pos = get_pos_of_env(f_env_id)
522 IF (f_env_pos < 1)
THEN
525 f_env =>
f_envs(f_env_pos)%f_env
526 logger => f_env%logger
527 cpassert(
ASSOCIATED(logger))
529 IF (f_env%old_path /= f_env%my_path)
THEN
530 CALL m_chdir(trim(f_env%my_path), ierr)
558 INTEGER,
INTENT(out),
OPTIONAL :: ierr
559 INTEGER,
INTENT(in),
OPTIONAL :: handle
566 IF (
ASSOCIATED(f_env))
THEN
567 IF (
PRESENT(handle))
THEN
571 logger => f_env%logger
575 cpassert(
ASSOCIATED(logger))
576 cpassert(
ASSOCIATED(d_logger))
577 cpassert(
ASSOCIATED(d_timer_env))
578 cpassert(
ASSOCIATED(d_mp_perf_env))
579 cpassert(
ASSOCIATED(logger, d_logger))
581 cpassert(
ASSOCIATED(d_mp_perf_env, f_env%mp_perf_env))
582 IF (f_env%old_path /= f_env%my_path)
THEN
583 CALL m_chdir(trim(f_env%old_path), ierr2)
586 IF (
PRESENT(ierr))
THEN
593 IF (
PRESENT(ierr))
THEN
627 output_path, mpi_comm, output_unit, owns_out_unit, &
628 input, ierr, work_dir, initial_variables)
629 INTEGER,
INTENT(out) :: new_env_id
631 CHARACTER(len=*),
INTENT(in) :: input_path
632 CHARACTER(len=*),
INTENT(in),
OPTIONAL :: output_path
635 INTEGER,
INTENT(in),
OPTIONAL :: output_unit
636 LOGICAL,
INTENT(in),
OPTIONAL :: owns_out_unit
638 INTEGER,
INTENT(out),
OPTIONAL :: ierr
639 CHARACTER(len=*),
INTENT(in),
OPTIONAL :: work_dir
640 CHARACTER(len=*),
DIMENSION(:, :),
OPTIONAL :: initial_variables
642 CHARACTER(len=*),
PARAMETER :: routinen =
'create_force_env'
644 CHARACTER(len=default_path_length) :: old_dir, wdir
645 INTEGER :: handle, i, ierr2, iforce_eval, isubforce_eval, k, method_name_id, my_group, &
646 nforce_eval, ngroups, nsubforce_size, unit_nr
647 INTEGER,
DIMENSION(:),
POINTER :: group_distribution, i_force_eval, &
649 LOGICAL ::
check, do_qmmm_force_mixing, multiple_subsys, my_owns_out_unit, &
650 use_motion_section, use_multiple_para_env
656 TYPE(f_env_p_type),
DIMENSION(:),
POINTER :: f_envs_old
658 TYPE(
fp_type),
POINTER :: fp_env
671 TYPE(
section_vals_type),
POINTER :: fe_section, force_env_section, force_env_sections, &
672 fp_section, input_file, qmmm_section, qmmmx_section, root_section, subsys_section, &
676 cpassert(
ASSOCIATED(input_declaration))
677 NULLIFY (para_env, force_env, timer_env,
mp_perf_env, globenv, meta_env, &
678 fp_env, eip_env, pwdft_env, mixed_env, qs_env, qmmm_env, embed_env)
680 IF (
PRESENT(mpi_comm))
THEN
685 CALL para_env%retain()
692 IF (
PRESENT(work_dir))
THEN
693 IF (work_dir /=
" ")
THEN
696 IF (
PRESENT(ierr)) ierr = ierr2
703 IF (
PRESENT(output_unit))
THEN
704 unit_nr = output_unit
706 IF (para_env%is_source())
THEN
707 IF (output_path ==
"__STD_OUT__")
THEN
711 file_status=
"UNKNOWN", &
712 file_action=
"WRITE", &
713 file_position=
"APPEND", &
722 IF (
PRESENT(owns_out_unit)) my_owns_out_unit = owns_out_unit
724 CALL cp2k_init(para_env, output_unit=unit_nr, globenv=globenv, input_file_name=input_path, &
731 IF (
PRESENT(input)) input_file => input
732 IF (.NOT.
ASSOCIATED(input_file))
THEN
733 IF (
PRESENT(initial_variables))
THEN
734 input_file =>
read_input(input_declaration, input_path, initial_variables, para_env=para_env)
736 input_file =>
read_input(input_declaration, input_path, empty_initial_variables, para_env=para_env)
742 CALL check_cp2k_input(input_declaration, input_file, para_env=para_env, output_unit=unit_nr)
744 root_section => input_file
747 IF (n_f_envs + 1 >
SIZE(
f_envs))
THEN
749 ALLOCATE (
f_envs(n_f_envs + 10))
751 f_envs(i)%f_env => f_envs_old(i)%f_env
753 DO i = n_f_envs + 1,
SIZE(
f_envs)
756 DEALLOCATE (f_envs_old)
759 CALL cp2k_read(root_section, para_env, globenv)
761 CALL cp2k_setup(root_section, para_env, globenv)
763 ALLOCATE (group_distribution(0:para_env%num_pe - 1))
764 group_distribution = 0
765 lgroup_distribution => group_distribution
769 l_val=multiple_subsys)
770 CALL multiple_fe_list(force_env_sections, root_section, i_force_eval, nforce_eval)
772 IF (.NOT. multiple_subsys)
THEN
773 DO iforce_eval = 2, nforce_eval
775 i_rep_section=i_force_eval(iforce_eval))
779 nsubforce_size = nforce_eval - 1
780 use_multiple_para_env = .false.
781 use_motion_section = .true.
782 DO iforce_eval = 1, nforce_eval
783 NULLIFY (force_env_section, my_force_env, subsys_section)
785 IF (.NOT. multiple_subsys)
THEN
787 i_rep_section=i_force_eval(1))
790 IF (use_multiple_para_env)
THEN
793 i_rep_section=i_force_eval(1))
796 "In case of multiple force_eval the MAIN force_eval (the first in the list of FORCE_EVAL_ORDER or "// &
797 "the one omitted from that order list) must be a MIXED_ENV type calculation. Please check your "// &
798 "input file and possibly correct the MULTIPLE_FORCE_EVAL%FORCE_EVAL_ORDER. ")
801 IF (method_name_id ==
do_mixed)
THEN
802 check =
ASSOCIATED(force_env%mixed_env%sub_para_env)
804 ngroups = force_env%mixed_env%ngroups
805 my_group = lgroup_distribution(para_env%mepos)
806 isubforce_eval = iforce_eval - 1
808 IF (
modulo(isubforce_eval - 1, ngroups) /= my_group) cycle
809 my_para_env => force_env%mixed_env%sub_para_env(my_group + 1)%para_env
810 my_logger => force_env%mixed_env%sub_logger(my_group + 1)%p
814 IF (method_name_id ==
do_embed)
THEN
815 check =
ASSOCIATED(force_env%embed_env%sub_para_env)
817 ngroups = force_env%embed_env%ngroups
818 my_group = lgroup_distribution(para_env%mepos)
819 isubforce_eval = iforce_eval - 1
821 IF (
modulo(isubforce_eval - 1, ngroups) /= my_group) cycle
822 my_para_env => force_env%embed_env%sub_para_env(my_group + 1)%para_env
823 my_logger => force_env%embed_env%sub_logger(my_group + 1)%p
828 my_para_env => para_env
834 IF (nforce_eval > 1)
THEN
836 i_force_eval(iforce_eval), i_force_eval(iforce_eval))
837 IF (iforce_eval /= 1) use_motion_section = .false.
839 force_env_section => force_env_sections
840 use_motion_section = .true.
844 IF (method_name_id ==
do_qmmm)
THEN
847 IF (do_qmmm_force_mixing)
THEN
852 SELECT CASE (method_name_id)
855 force_env_section=force_env_section, subsys_section=subsys_section, &
856 use_motion_section=use_motion_section)
861 CALL qs_init(qs_env, my_para_env, root_section, globenv=globenv, force_env_section=force_env_section, &
862 subsys_section=subsys_section, use_motion_section=use_motion_section)
863 CALL force_env_create(my_force_env, root_section, qs_env=qs_env, para_env=my_para_env, globenv=globenv, &
864 force_env_section=force_env_section)
870 force_env_section, qmmm_section, subsys_section, use_motion_section)
871 CALL force_env_create(my_force_env, root_section, qmmm_env=qmmm_env, para_env=my_para_env, &
872 globenv=globenv, force_env_section=force_env_section)
877 force_env_section, subsys_section, use_motion_section)
878 CALL force_env_create(my_force_env, root_section, qmmmx_env=qmmmx_env, para_env=my_para_env, &
879 globenv=globenv, force_env_section=force_env_section)
884 CALL eip_init(eip_env, root_section, my_para_env, force_env_section=force_env_section, &
885 subsys_section=subsys_section)
886 CALL force_env_create(my_force_env, root_section, eip_env=eip_env, para_env=my_para_env, &
887 globenv=globenv, force_env_section=force_env_section)
891 IF (unit_nr > 0)
WRITE (unit=unit_nr, fmt=
"(T2,A)", advance=
"NO")
"SIRIUS| "
896 CALL pwdft_init(pwdft_env, root_section, my_para_env, force_env_section=force_env_section, &
897 subsys_section=subsys_section, use_motion_section=use_motion_section)
898 CALL force_env_create(my_force_env, root_section, pwdft_env=pwdft_env, para_env=my_para_env, &
899 globenv=globenv, force_env_section=force_env_section)
904 force_env_section=force_env_section, n_subforce_eval=nsubforce_size, &
905 use_motion_section=use_motion_section)
906 CALL force_env_create(my_force_env, root_section, mixed_env=mixed_env, para_env=my_para_env, &
907 globenv=globenv, force_env_section=force_env_section)
909 use_multiple_para_env = .true.
911 lgroup_distribution => my_force_env%mixed_env%group_distribution
916 force_env_section=force_env_section, n_subforce_eval=nsubforce_size, &
917 use_motion_section=use_motion_section)
918 CALL force_env_create(my_force_env, root_section, embed_env=embed_env, para_env=my_para_env, &
919 globenv=globenv, force_env_section=force_env_section)
921 use_multiple_para_env = .true.
923 lgroup_distribution => my_force_env%embed_env%group_distribution
927 CALL nnp_init(nnp_env, root_section, my_para_env, force_env_section=force_env_section, &
928 subsys_section=subsys_section, use_motion_section=use_motion_section)
929 CALL force_env_create(my_force_env, root_section, nnp_env=nnp_env, para_env=my_para_env, &
930 globenv=globenv, force_env_section=force_env_section)
934 CALL ipi_init(ipi_env, root_section, my_para_env, force_env_section=force_env_section, &
935 subsys_section=subsys_section)
936 CALL force_env_create(my_force_env, root_section, ipi_env=ipi_env, para_env=my_para_env, &
937 globenv=globenv, force_env_section=force_env_section)
944 "Invalid METHOD <"//trim(
enum_i2c(enum, method_name_id))// &
949 NULLIFY (meta_env, fp_env)
950 IF (use_motion_section)
THEN
953 CALL metadyn_read(meta_env, my_force_env, root_section, my_para_env, fe_section)
964 IF (nforce_eval > 1 .AND. iforce_eval == 1)
THEN
965 ALLOCATE (my_force_env%sub_force_env(nsubforce_size))
967 DO k = 1, nsubforce_size
968 NULLIFY (my_force_env%sub_force_env(k)%force_env)
972 IF (iforce_eval == 1)
THEN
973 force_env => my_force_env
975 force_env%sub_force_env(iforce_eval - 1)%force_env => my_force_env
978 IF (.NOT. use_multiple_para_env)
THEN
979 lgroup_distribution = iforce_eval
984 IF (use_multiple_para_env)
THEN
987 DEALLOCATE (group_distribution)
988 DEALLOCATE (i_force_eval)
991 CALL para_env%max(last_f_env_id)
992 last_f_env_id = last_f_env_id + 1
993 new_env_id = last_f_env_id
994 n_f_envs = n_f_envs + 1
995 CALL f_env_create(
f_envs(n_f_envs)%f_env, logger=logger, &
997 id_nr=last_f_env_id, old_dir=old_dir)
1021 INTEGER,
INTENT(in) :: env_id
1022 INTEGER,
INTENT(out) :: ierr
1023 LOGICAL,
INTENT(IN),
OPTIONAL :: q_finalize
1025 INTEGER :: env_pos, i
1033 env_pos = get_pos_of_env(env_id)
1034 n_f_envs = n_f_envs - 1
1035 DO i = env_pos, n_f_envs
1038 NULLIFY (
f_envs(n_f_envs + 1)%f_env)
1041 root_section=root_section, para_env=para_env)
1043 cpassert(
ASSOCIATED(globenv))
1044 NULLIFY (f_env%force_env%globenv)
1045 CALL f_env_dealloc(f_env)
1046 IF (
PRESENT(q_finalize))
THEN
1047 CALL cp2k_finalize(root_section, para_env, globenv, f_env%old_path, q_finalize)
1049 CALL cp2k_finalize(root_section, para_env, globenv, f_env%old_path)
1067 INTEGER,
INTENT(IN) :: env_id
1068 INTEGER,
INTENT(OUT) :: n_atom, ierr
1090 INTEGER,
INTENT(IN) :: env_id
1091 INTEGER,
INTENT(OUT) :: n_particle, ierr
1113 INTEGER,
INTENT(IN) :: env_id
1114 REAL(kind=
dp),
DIMENSION(3, 3) :: cell
1115 INTEGER,
DIMENSION(3),
OPTIONAL :: per
1116 INTEGER,
INTENT(OUT) :: ierr
1125 cpassert(
ASSOCIATED(cell_full))
1126 cell = cell_full%hmat
1127 IF (
PRESENT(per)) per(:) = cell_full%perd(:)
1141 INTEGER,
INTENT(IN) :: env_id
1142 REAL(kind=
dp),
DIMENSION(3, 3) :: cell
1143 INTEGER,
INTENT(OUT) :: ierr
1153 CALL get_qs_env(qmmm_env%qs_env, cell=cell_qmmm)
1154 cpassert(
ASSOCIATED(cell_qmmm))
1155 cell = cell_qmmm%hmat
1170 SUBROUTINE get_result_r1(env_id, description, N, RESULT, res_exist, ierr)
1172 CHARACTER(LEN=default_string_length) :: description
1174 REAL(kind=
dp),
DIMENSION(1:N) :: result
1175 LOGICAL,
OPTIONAL :: res_exist
1179 LOGICAL :: exist_res
1184 NULLIFY (f_env, subsys, results)
1190 IF (
PRESENT(res_exist))
THEN
1192 exist_res = res_exist
1198 CALL get_results(results, description=description, n_rep=nres)
1199 CALL get_results(results, description=description, values=result, nval=nres)
1204 END SUBROUTINE get_result_r1
1217 INTEGER,
INTENT(IN) :: env_id, n_el
1218 REAL(kind=
dp),
DIMENSION(1:n_el) :: frc
1219 INTEGER,
INTENT(OUT) :: ierr
1240 INTEGER,
INTENT(IN) :: env_id
1241 REAL(kind=
dp),
DIMENSION(3, 3),
INTENT(OUT) :: stress_tensor
1242 INTEGER,
INTENT(OUT) :: ierr
1243 LOGICAL,
INTENT(OUT),
OPTIONAL :: available
1250 NULLIFY (f_env, subsys, virial, cell)
1251 stress_tensor(:, :) = 0.0_dp
1254 CALL force_env_get(f_env%force_env, subsys=subsys, cell=cell)
1256 IF (
PRESENT(available)) available = virial%pv_availability
1257 IF (virial%pv_availability)
THEN
1258 stress_tensor(:, :) = virial%pv_virial(:, :)/cell%deth
1275 INTEGER,
INTENT(IN) :: env_id, n_el
1276 REAL(kind=
dp),
DIMENSION(1:n_el) :: pos
1277 INTEGER,
INTENT(OUT) :: ierr
1297 SUBROUTINE get_vel(env_id, vel, n_el, ierr)
1299 INTEGER,
INTENT(IN) :: env_id, n_el
1300 REAL(kind=
dp),
DIMENSION(1:n_el) :: vel
1301 INTEGER,
INTENT(OUT) :: ierr
1310 END SUBROUTINE get_vel
1321 INTEGER,
INTENT(IN) :: env_id
1322 REAL(kind=
dp),
DIMENSION(3, 3) :: new_cell
1323 INTEGER,
INTENT(OUT) :: ierr
1329 NULLIFY (f_env, cell, subsys)
1331 f_env%is_dirty = .true.
1334 cpassert(
ASSOCIATED(cell))
1335 cell%hmat = new_cell
1354 INTEGER,
INTENT(IN) :: env_id, n_el
1355 REAL(kind=
dp),
DIMENSION(1:n_el) :: new_pos
1356 INTEGER,
INTENT(OUT) :: ierr
1366 f_env%is_dirty = .true.
1382 INTEGER,
INTENT(IN) :: env_id, n_el
1383 REAL(kind=
dp),
DIMENSION(1:n_el) :: new_vel
1384 INTEGER,
INTENT(OUT) :: ierr
1394 f_env%is_dirty = .true.
1409 INTEGER,
INTENT(in) :: env_id
1411 INTEGER,
INTENT(out) :: ierr
1420 f_env%is_dirty = .true.
1422 f_env%is_dirty = .false.
1436 INTEGER,
INTENT(in) :: env_id
1437 REAL(kind=
dp),
INTENT(out) :: e_pot
1438 INTEGER,
INTENT(out) :: ierr
1463 INTEGER,
INTENT(IN) :: env_id, n_el
1464 REAL(kind=
dp),
DIMENSION(1:n_el),
INTENT(IN) :: pos
1465 REAL(kind=
dp),
INTENT(OUT) :: e_pot
1466 INTEGER,
INTENT(OUT) :: ierr
1468 REAL(kind=
dp),
DIMENSION(1) :: dummy_f
1470 CALL calc_force(env_id, pos, n_el, e_pot, dummy_f, 0, ierr)
1491 RECURSIVE SUBROUTINE calc_force(env_id, pos, n_el_pos, e_pot, force, n_el_force, ierr)
1493 INTEGER,
INTENT(in) :: env_id, n_el_pos
1494 REAL(kind=
dp),
DIMENSION(1:n_el_pos),
INTENT(in) :: pos
1495 REAL(kind=
dp),
INTENT(out) :: e_pot
1496 INTEGER,
INTENT(in) :: n_el_force
1497 REAL(kind=
dp),
DIMENSION(1:n_el_force), &
1498 INTENT(inout) :: force
1499 INTEGER,
INTENT(out) :: ierr
1503 calc_f = (n_el_force /= 0)
1504 CALL set_pos(env_id, pos, n_el_pos, ierr)
1506 IF (ierr == 0)
CALL get_energy(env_id, e_pot, ierr)
1507 IF (calc_f .AND. (ierr == 0))
CALL get_force(env_id, force, n_el_force, ierr)
1525 SUBROUTINE check_input(input_declaration, input_file_path, output_file_path, &
1526 echo_input, mpi_comm, initial_variables, ierr)
1528 CHARACTER(len=*),
INTENT(in) :: input_file_path, output_file_path
1529 LOGICAL,
INTENT(in),
OPTIONAL :: echo_input
1531 CHARACTER(len=default_path_length), &
1532 DIMENSION(:, :),
INTENT(IN) :: initial_variables
1533 INTEGER,
INTENT(out) :: ierr
1536 LOGICAL :: my_echo_input
1541 my_echo_input = .false.
1542 IF (
PRESENT(echo_input)) my_echo_input = echo_input
1544 IF (
PRESENT(mpi_comm))
THEN
1549 CALL para_env%retain()
1551 IF (para_env%is_source())
THEN
1552 IF (output_file_path ==
"__STD_OUT__")
THEN
1555 CALL open_file(file_name=output_file_path, file_status=
"UNKNOWN", &
1556 file_action=
"WRITE", file_position=
"APPEND", &
1557 unit_number=unit_nr)
1565 default_global_unit_nr=unit_nr, &
1566 close_global_unit_on_dealloc=.false.)
1570 input_file =>
read_input(input_declaration, input_file_path, initial_variables=initial_variables, &
1572 CALL check_cp2k_input(input_declaration, input_file, para_env=para_env, output_unit=unit_nr)
1573 IF (my_echo_input .AND. (unit_nr > 0))
THEN
1577 hide_defaults=.false.)
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
Central dispatch for basic hooks.
procedure(cp_warn_interface), pointer, public cp_warn_hook
subroutine, public cp_abort(location, message)
Terminate the program.
subroutine, public timeset(routinen, handle)
Start timer.
procedure(cp_abort_interface), pointer, public cp_abort_hook
procedure(timeset_interface), pointer, public timeset_hook
subroutine, public timestop(handle)
Stop timer.
procedure(timestop_interface), pointer, public timestop_hook
collects all references to literature in CP2K as new algorithms / method are included from literature...
subroutine, public add_all_references()
adds references that can later be cited / printed using the key
Handles all functions related to the CELL.
subroutine, public init_cell(cell, hmat, periodic)
Initialise/readjust a simulation cell after hmat has been changed.
Handles all functions related to the CELL.
some minimal info about CP2K, including its version and license
subroutine, public get_runtime_info()
...
subroutine, public cp_dlaf_finalize()
Finalize DLA-Future and pika runtime.
subroutine, public cp_dlaf_free_all_grids()
Free all DLA-Future grids.
Module that contains the routines for error handling.
subroutine, public cp_error_handling_setup()
Registers handlers with base_hooks.F.
Utility routines to open and close files.
subroutine, public open_file(file_name, unit_number, file_status, file_form, file_action, file_position, file_pad, file_access, debug)
Opens a file and returns its logical unit number.
various routines to log and control the output. The idea is that decisions about where to log should ...
subroutine, public cp_rm_default_logger()
the cousin of cp_add_default_logger, decrements the stack, so that the default logger is what it has ...
subroutine, public cp_logger_release(logger)
releases this logger
subroutine, public cp_logger_create(logger, para_env, print_level, default_global_unit_nr, default_local_unit_nr, global_filename, local_filename, close_global_unit_on_dealloc, iter_info, close_local_unit_on_dealloc, suffix, template_logger)
initializes a logger
integer function, public cp_default_logger_stack_size()
...
integer, parameter, public cp_failure_level
subroutine, public cp_logger_retain(logger)
retains the given logger (to be called to keep a shared copy of the logger)
subroutine, public cp_add_default_logger(logger)
adds a default logger. MUST be called before logging occours
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...
subroutine, public cp_openpmd_output_finalize()
Close all outputs.
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
subroutine, public cp_iterate(iteration_info, last, iter_nr, increment, iter_nr_out)
adds one to the actual iteration
set of type/routines to handle the storage of results in force_envs
logical function, public test_for_result(results, description)
test for a certain result in the result_list
set of type/routines to handle the storage of results in force_envs
types that represent a subsys, i.e. a part of the system
subroutine, public cp_subsys_set(subsys, atomic_kinds, particles, local_particles, molecules, molecule_kinds, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, results, cell, cell_ref, use_ref_cell)
sets various propreties of the subsys
subroutine, public unpack_subsys_particles(subsys, f, r, s, v, fscale, cell)
Unpack components of a subsystem particle sets into a single vector.
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, cell_ref, use_ref_cell)
returns information about various attributes of the given subsys
subroutine, public dbm_library_init()
Initialize DBM library.
subroutine, public dbm_library_finalize()
Finalize DBM library.
This is the start of a dbt_api, all publically needed functions are exported here....
The environment for the empirical interatomic potential methods.
subroutine, public eip_env_create(eip_env)
Creates the eip environment.
Methods and functions on the EIP environment.
subroutine, public eip_init(eip_env, root_section, para_env, force_env_section, subsys_section)
Initialize the eip environment.
Main force create for embedding.
subroutine, public embed_create_force_env(embed_env, root_section, para_env, force_env_section, n_subforce_eval, use_motion_section)
Controls program flow for embedded calculations.
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_get_from_id(f_env_id, f_env)
...
subroutine, public set_vel(env_id, new_vel, n_el, ierr)
sets the velocities of the particles
subroutine, public get_nparticle(env_id, n_particle, ierr)
returns the number of particles in the given force env
subroutine, public get_natom(env_id, n_atom, ierr)
returns the number of atoms in the given force env
subroutine, public get_stress_tensor(env_id, stress_tensor, ierr, available)
gets the stress tensor
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 ...
subroutine, public get_cell(env_id, cell, per, ierr)
gets a cell
type(mp_para_env_type), pointer, save, public default_para_env
recursive subroutine, public calc_energy_force(env_id, calc_force, ierr)
updates the energy and the forces of given force_env
subroutine, public configure_dbcsr(mpi_comm, output_unit)
Configure DBCSR with CP2K's hooks and selected accelerator device. For an active library the DBCSR AP...
subroutine, public get_energy(env_id, e_pot, ierr)
returns the energy of the last configuration calculated
subroutine, public init_cp2k(init_mpi, ierr, mpi_comm)
initializes cp2k, needs to be called once before using any of the other functions when using cp2k as ...
subroutine, public get_qmmm_cell(env_id, cell, ierr)
gets the qmmm cell
subroutine, public get_pos(env_id, pos, n_el, ierr)
gets the positions of the particles
type(f_env_p_type), dimension(:), pointer, save f_envs
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...
recursive subroutine, public calc_energy(env_id, pos, n_el, e_pot, ierr)
returns the energy of the configuration given by the positions passed as argument
subroutine, public set_cell(env_id, new_cell, ierr)
sets a new cell
subroutine, public finalize_cp2k(finalize_mpi, ierr)
cleanup after you have finished using this interface
subroutine, public set_pos(env_id, new_pos, n_el, ierr)
sets the positions of the particles
subroutine, public check_input(input_declaration, input_file_path, output_file_path, echo_input, mpi_comm, initial_variables, ierr)
performs a check of the input
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...
subroutine, public get_force(env_id, frc, n_el, ierr)
gets the forces of the particles
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
perform classical molecular dynamics and path integral simulations
subroutine, public fist_create_force_env(force_env, root_section, para_env, globenv, qmmm, qmmm_env, force_env_section, subsys_section, use_motion_section, prev_subsys)
Controls program flow for classical MD and path-integrals.
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.
subroutine, public force_env_create(force_env, root_section, para_env, globenv, fist_env, qs_env, meta_env, sub_force_env, qmmm_env, qmmmx_env, eip_env, pwdft_env, force_env_section, mixed_env, embed_env, nnp_env, ipi_env)
creates and initializes a force environment
Interface for the force calculations.
integer function, public force_env_get_natom(force_env)
returns the number of atoms
subroutine, public force_env_get_vel(force_env, vel, n)
returns the particle velocities in a dimension(*) array
subroutine, public multiple_fe_list(force_env_sections, root_section, i_force_eval, nforce_eval)
returns the order of the multiple force_env
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 force_env_retain(force_env)
retains the given force env
subroutine, public force_env_get_pos(force_env, pos, n)
returns the particle positions in a dimension(*) array
subroutine, public force_env_set(force_env, meta_env, fp_env, force_env_section, method_name_id, additional_potential)
changes some attributes of the force_env
subroutine, public force_env_get_frc(force_env, frc, n)
returns the particle forces in a dimension(*) array
recursive subroutine, public force_env_release(force_env)
releases the given force env
integer function, public force_env_get_nparticle(force_env)
returns the number of particles in a force environment
types used in the flexible partitioning scheme
subroutine, public fp_env_write(fp_env, fp_section)
writes information concerning the fp_env to the output
subroutine, public fp_env_read(fp_env, fp_section)
reads the corresponding input section and stores it in the fp_env
pure subroutine, public fp_env_create(fp_env)
create retain release the flexible partitioning environment
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_init()
Initialize grid library.
subroutine, public grid_library_finalize()
Finalize grid library.
The environment for the empirical interatomic potential methods.
Methods and functions on the i–PI environment.
subroutine, public ipi_init(ipi_env, root_section, para_env, force_env_section, subsys_section)
Initialize the ipi environment.
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
integer, parameter, public default_path_length
Interface to the Libint-Library or a c++ wrapper.
subroutine, public cp_libint_static_cleanup()
subroutine, public cp_libint_static_init()
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_getcwd(curdir)
...
subroutine, public m_chdir(dir, ierror)
...
Interface to the message passing library MPI.
subroutine, public mp_world_init(mp_comm)
initializes the system default communicator
subroutine, public mp_query_thread_level()
Query the MPI thread-support level when MPI is managed by an embedding application.
type(mp_comm_type), parameter, public mp_comm_world
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)
subroutine, public mp_world_finalize()
Finalize the system default communicator and MPI when CP2K owns MPI.
perform biased molecular dynamics (H= k H1 + (1-k) H2 [linear or general mixing)
subroutine, public mixed_create_force_env(mixed_env, root_section, para_env, force_env_section, n_subforce_eval, use_motion_section)
Controls program flow for mixed calculations.
Defines all routines to deal with the performance of MPI routines.
subroutine, public mp_perf_env_release(perf_env)
...
subroutine, public rm_mp_perf_env()
...
type(mp_perf_env_type) function, pointer, public get_mp_perf_env()
...
elemental subroutine, public mp_perf_env_retain(perf_env)
...
subroutine, public add_mp_perf_env(perf_env)
start and stop the performance indicators for every call to start there has to be (exactly) one call ...
Data types for neural network potentials.
Methods dealing with Neural Network potentials.
subroutine, public nnp_init(nnp_env, root_section, para_env, force_env_section, subsys_section, use_motion_section)
Read and initialize all the information for neural network potentials.
Fortran API for the offload package, which is written in C.
subroutine, public offload_set_chosen_device(device_id)
Selects the chosen device to be used.
integer function, public offload_get_device_count()
Returns the number of available devices.
subroutine, public offload_init()
Initialize runtime.
integer function, public offload_get_chosen_device()
Returns the chosen device.
Periodic Table related data definitions.
subroutine, public init_periodic_table()
Initialization of Periodic Table related data.
subroutine, public pw_fpga_finalize()
Releases resources on the fpga device.
subroutine, public pw_fpga_init()
Allocates resources on the fpga device.
subroutine, public pw_gpu_init()
Allocates resources on the gpu device for gpu fft acceleration.
subroutine, public pw_gpu_finalize()
Releases resources on the gpu device for gpu fft acceleration.
The type definitions for the PWDFT environment.
subroutine, public pwdft_env_create(pwdft_env)
Creates the pwdft environment.
Methods and functions on the PWDFT environment.
subroutine, public pwdft_init(pwdft_env, root_section, para_env, force_env_section, subsys_section, use_motion_section)
Initialize the pwdft environment.
Initialize a QM/MM calculation.
subroutine, public qmmm_env_create(qmmm_env, root_section, para_env, globenv, force_env_section, qmmm_section, subsys_section, use_motion_section, prev_subsys, ignore_outside_box)
...
Basic container type for QM/MM.
Initialize a QM/MM calculation with Force-Mixing.
subroutine, public qmmmx_env_create(qmmmx_env, root_section, para_env, globenv, force_env_section, subsys_section, use_motion_section)
...
Basic container type for QM/MM with force mixing.
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.
subroutine, public qs_env_create(qs_env, globenv)
allocates and intitializes a qs_env
subroutine, public qs_init(qs_env, para_env, root_section, globenv, cp_subsys, kpoint_env, qmmm, qmmm_env_qm, force_env_section, subsys_section, use_motion_section, silent, multip, charge)
Read the input and the database files for the setup of the QUICKSTEP environment.
provides a uniform framework to add references to CP2K cite and output these
subroutine, public remove_all_references()
deallocate the bibliography
Interface to the SIRIUS Library.
subroutine, public cp_sirius_init()
Empty implementation in case SIRIUS is not compiled in.
logical function, public cp_sirius_is_initialized()
Return always .FALSE. because the Sirius library is not compiled in.
subroutine, public cp_sirius_finalize()
Empty implementation in case SIRIUS is not compiled in.
generates a unique id number for a string (str2id) that can be used two compare two strings....
subroutine, public string_table_deallocate(iw)
deallocates the string table
subroutine, public string_table_allocate()
allocates the string table
Types used by timings.F and timings_report.F Due to the fortran restriction on cicular module-depende...
Timing routines for accounting.
subroutine, public timings_register_hooks()
Registers handlers with base_hooks.F.
type(timer_env_type) function, pointer, public get_timer_env()
returns the current timer env from the stack
subroutine, public add_timer_env(timer_env)
adds the given timer_env to the top of the stack
subroutine, public rm_timer_env()
removes the current timer env from the stack
subroutine, public timer_env_release(timer_env)
releases the given timer env
subroutine, public timer_env_retain(timer_env)
retains the given timer env
calculates a functional from libxc and its derivatives
subroutine, public libxc_release_workers()
Reads the external parameters of a LibXC functional from its input section.
subroutine check(condition, label)
Stops with an error message if a test fails.
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...
contains arbitrary information which need to be stored
represents a system: atoms, molecules, their pos,vel,...
The empirical interatomic potential environment.
Embedding environment type.
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
Main data type collecting all relevant data for neural network potentials.
The PWDFT environment type.