(git:34a1bdb)
Loading...
Searching...
No Matches
global_types.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!> \brief Define type storing the global information of a run. Keep the amount of stored data small.
10!> Use it sparingly and try not to send it too deep in your structures.
11!> \par History
12!> - print keys, basis_set_file name and potential_file_name added to the
13!> global type (27.02.2001, MK)
14!> - added pp_library_path to type (28.11.2001, JGH)
15!> - Merged with MODULE print_keys (17.01.2002, MK)
16!> - reference counting, create (08.2004, fawzi)
17!> - new (parallel) random number generator (11.03.2006, MK)
18!> - add eps_check_diag, remove id_nr from globenv, and revise initialization (04.05.2021, MK)
19!> \author JGH, MK, fawzi
20! **************************************************************************************************
22
24 USE kinds, ONLY: default_path_length,&
26 dp
27 USE machine, ONLY: m_walltime
29#include "./base/base_uses.f90"
30
31 IMPLICIT NONE
32
33 PRIVATE
34
35 ! Global parameters
36
37 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'global_types'
38
39 INTEGER, PARAMETER :: SILENT = 0, &
40 low = 1, &
41 medium = 2, &
42 high = 3, &
43 debug = 4
44
45 ! Public data types
46
48
49 ! Public subroutines
50
51 PUBLIC :: globenv_create, &
54
55! **************************************************************************************************
56!> \brief contains the initially parsed file and the initial parallel environment
57!> \param ref_count reference count (see doc/ReferenceCounting.html)
58!> \param handle handle with the total time of the computation
59!>
60!> Personally I think that all the other attributes should go away
61!> (and maybe add a logger)[fawzi]
62!> \note
63!> This is not but really should be passed as pointer and use reference
64!> counting. Use it accordingly wherever possible.
65! **************************************************************************************************
67 INTEGER :: ref_count = 0
68 TYPE(rng_stream_type), ALLOCATABLE :: gaussian_rng_stream
69 CHARACTER(LEN=default_string_length) :: diag_library = "ScaLAPACK"
70 CHARACTER(LEN=default_string_length) :: cholesky_library = "ScaLAPACK"
71 CHARACTER(LEN=default_string_length) :: default_fft_library = "FFTSG"
72 CHARACTER(LEN=default_path_length) :: fftw_wisdom_file_name = "/etc/fftw/wisdom"
73 CHARACTER(LEN=default_string_length) :: default_dgemm_library = "BLAS"
74
75 INTEGER :: fft_pool_scratch_limit = 0 ! limit number of used FFT scratches
76 INTEGER :: fftw_plan_type = 0 ! which kind of planning to use with FFTW
77 INTEGER :: idum = 0 ! random number seed
78 INTEGER :: prog_name_id = 0 ! index to define the type of program
79 INTEGER :: run_type_id = 0 ! index to define the run_tupe
80 INTEGER :: blacs_grid_layout = blacs_grid_square ! will store the user preference for the BLACS grid
81 INTEGER :: k_elpa = 1 ! optimized kernel for the ELPA diagonalization library
82 INTEGER :: elpa_neigvec_min = 0 ! Minimum number of eigenvectors for ELPA usage
83 LOGICAL :: elpa_qr = .true. ! allow ELPA to use QR during diagonalization
84 LOGICAL :: elpa_print = .false. ! if additional information about ELPA diagonalization should be printed
85 LOGICAL :: elpa_one_stage = .false. ! enable one-stage ELPA solver
86 INTEGER :: dlaf_neigvec_min = 0 ! Minimum number of eigenvectors for DLAF eigensolver usage
87 INTEGER :: dlaf_cholesky_n_min = 0 ! Minimum matrix size for DLAF Cholesky decomposition usage
88 LOGICAL :: cusolver_generalized = .true. ! use cuSOLVERMp generalized solver
89 LOGICAL :: blacs_repeatable = .false. ! will store the user preference for the repeatability of BLACS collectives
90 REAL(kind=dp) :: cp2k_start_time = 0.0_dp
91 REAL(kind=dp) :: cp2k_target_time = huge(0.0_dp) ! Maximum run time in seconds
92 ! Threshold value for the orthonormality of the eigenvectors after diagonalization
93 ! A negative threshold value disables the check which is the default
94 REAL(kind=dp) :: eps_check_diag = -1.0_dp
95 INTEGER :: handle = 0
97
98CONTAINS
99
100! **************************************************************************************************
101!> \brief Creates the global environment globenv
102!> \param globenv the globenv to create
103!> \author fawzi
104! **************************************************************************************************
105 SUBROUTINE globenv_create(globenv)
106 TYPE(global_environment_type), POINTER :: globenv
107
108 cpassert(.NOT. ASSOCIATED(globenv))
109 ALLOCATE (globenv)
110 ALLOCATE (globenv%gaussian_rng_stream)
111 globenv%ref_count = 1
112 globenv%cp2k_start_time = m_walltime()
113
114 END SUBROUTINE globenv_create
115
116! **************************************************************************************************
117!> \brief Retains the global environment globenv
118!> \param globenv the global environment to retain
119!> \author fawzi
120! **************************************************************************************************
121 SUBROUTINE globenv_retain(globenv)
122 TYPE(global_environment_type), POINTER :: globenv
123
124 cpassert(ASSOCIATED(globenv))
125 cpassert(globenv%ref_count > 0)
126 globenv%ref_count = globenv%ref_count + 1
127
128 END SUBROUTINE globenv_retain
129
130! **************************************************************************************************
131!> \brief Releases the global environment globenv
132!> \param globenv the global environment to release
133!> \author fawzi
134! **************************************************************************************************
135 SUBROUTINE globenv_release(globenv)
136 TYPE(global_environment_type), POINTER :: globenv
137
138 IF (ASSOCIATED(globenv)) THEN
139 cpassert(globenv%ref_count > 0)
140 globenv%ref_count = globenv%ref_count - 1
141 IF (globenv%ref_count == 0) THEN
142 IF (ALLOCATED(globenv%gaussian_rng_stream)) &
143 DEALLOCATE (globenv%gaussian_rng_stream)
144 DEALLOCATE (globenv)
145 END IF
146 END IF
147
148 NULLIFY (globenv)
149
150 END SUBROUTINE globenv_release
151
152END MODULE global_types
methods related to the blacs parallel environment
integer, parameter, public blacs_grid_square
Define type storing the global information of a run. Keep the amount of stored data small....
subroutine, public globenv_retain(globenv)
Retains the global environment globenv.
subroutine, public globenv_create(globenv)
Creates the global environment globenv.
subroutine, public globenv_release(globenv)
Releases the global environment globenv.
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
integer, parameter, public default_string_length
Definition kinds.F:57
integer, parameter, public default_path_length
Definition kinds.F:58
Machine interface based on Fortran 2003 and POSIX.
Definition machine.F:17
real(kind=dp) function, public m_walltime()
returns time from a real-time clock, protected against rolling early/easily
Definition machine.F:153
Parallel (pseudo)random number generator (RNG) for multiple streams and substreams of random numbers.
contains the initially parsed file and the initial parallel environment