(git:871dbd5)
Loading...
Searching...
No Matches
cp2k_info.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#ifdef __GAUXC
9#include "gauxc/gauxc_config.f"
10#endif
11
12#include "cp2k_build_info.h"
13
14! **************************************************************************************************
15!> \brief some minimal info about CP2K, including its version and license
16!> \par History
17!> - created (2007-09, Joost VandeVondele)
18!> - moved into this module information related to runtime:pid, user_name,
19!> host_name, cwd, timestamp (2009-06, Teodoro Laino, 2025-08 MK)
20!> \author Joost VandeVondele
21! **************************************************************************************************
23
24 USE iso_fortran_env, ONLY: compiler_options
25 USE kinds, ONLY: default_path_length,&
27 USE machine, ONLY: m_getcwd,&
28 m_getlog,&
29 m_getpid,&
30 m_hostnm,&
34
35 IMPLICIT NONE
36 PRIVATE
37
41
42#if defined(__COMPILE_REVISION)
43 CHARACTER(LEN=*), PARAMETER :: compile_revision = __compile_revision
44#else
45 CHARACTER(LEN=*), PARAMETER :: compile_revision = "unknown"
46#endif
47
48 !!! Keep version in sync with CMakeLists.txt !!!
49 CHARACTER(LEN=*), PARAMETER :: cp2k_version = "CP2K version 2026.1 (Development Version)"
50 CHARACTER(LEN=*), PARAMETER :: cp2k_year = "2026"
51 CHARACTER(LEN=*), PARAMETER :: cp2k_home = "https://www.cp2k.org/"
52
53 ! compile time information
54#if defined(__COMPILE_ARCH)
55 CHARACTER(LEN=*), PARAMETER :: compile_arch = __compile_arch
56#else
57 CHARACTER(LEN=*), PARAMETER :: compile_arch = "unknown: -D__COMPILE_ARCH=?"
58#endif
59
60#if defined(__COMPILE_DATE)
61 CHARACTER(LEN=default_string_length), SAVE :: compile_date = __compile_date
62#else
63 CHARACTER(LEN=default_string_length), SAVE :: compile_date = "unknown: -D__COMPILE_DATE=?"
64#endif
65
66#if defined(__COMPILE_HOST)
67 CHARACTER(LEN=*), PARAMETER :: compile_host = __compile_host
68#else
69 CHARACTER(LEN=*), PARAMETER :: compile_host = "unknown: -D__COMPILE_HOST=?"
70#endif
71
72 ! Local runtime informations
73 CHARACTER(LEN=default_path_length), PUBLIC :: r_cwd
74 CHARACTER(LEN=default_string_length), PUBLIC :: r_host_name, r_user_name
75 CHARACTER(LEN=timestamp_length), PUBLIC :: r_timestamp
76 INTEGER, PUBLIC :: r_pid
77
78 CHARACTER(len=*), PARAMETER, PRIVATE :: modulen = 'cp2k_info'
79CONTAINS
80
81! **************************************************************************************************
82!> \brief list all compile time options that influence the capabilities of cp2k.
83!> All new flags should be added here (and be unique grep-able)
84!> \return ...
85! **************************************************************************************************
86 FUNCTION cp2k_flags() RESULT(flags)
87 CHARACTER(len=10*default_string_length) :: flags
88
89 CHARACTER(len=default_string_length) :: tmp_str
90
91 flags = "cp2kflags:"
92
93 ! Ensure that tmp_str is used to silence compiler warnings
94 tmp_str = ""
95 flags = trim(flags)//trim(tmp_str)
96
97 IF (index(compiler_options(), "-fsanitize=leak") > 0) THEN
98 flags = trim(flags)//" lsan"
99 END IF
100
101!$ flags = TRIM(flags)//" omp"
102
103 ! TODO: remove __INTEL_LLVM_COMPILER conditions (regtests)
104#if defined(__INTEL_LLVM_COMPILER)
105 flags = trim(flags)//" ifx"
106#endif
107#if defined(__LIBINT)
108 flags = trim(flags)//" libint"
109#endif
110#if defined(__FFTW3)
111 flags = trim(flags)//" fftw3"
112#endif
113#if defined(__LIBXC)
114 flags = trim(flags)//" libxc"
115#endif
116#if defined(__GAUXC)
117 flags = trim(flags)//" gauxc"
118#endif
119#if defined(GAUXC_HAS_MPI)
120 flags = trim(flags)//" gauxc_mpi"
121#endif
122#if defined(GAUXC_HAS_ONEDFT)
123 flags = trim(flags)//" gauxc_onedft"
124#endif
125#if defined(GAUXC_HAS_HOST)
126 flags = trim(flags)//" gauxc_host"
127#endif
128#if defined(GAUXC_HAS_DEVICE)
129 flags = trim(flags)//" gauxc_device"
130#endif
131#if defined(GAUXC_HAS_CUDA)
132 flags = trim(flags)//" gauxc_cuda"
133#endif
134#if defined(GAUXC_HAS_HDF5)
135 flags = trim(flags)//" gauxc_hdf5"
136#endif
137#if defined(__PEXSI)
138 flags = trim(flags)//" pexsi"
139#endif
140#if defined(__ELPA)
141 flags = trim(flags)//" elpa"
142#endif
143#if defined(__parallel)
144#if defined(__SCALAPACK_NO_WA)
145 flags = trim(flags)//" parallel scalapack"
146#else
147 flags = trim(flags)//" parallel scalapack"
148#endif
149#endif
150#if defined(__MPI_F08)
151 flags = trim(flags)//" mpi_f08"
152#endif
153#if defined(__COSMA)
154 flags = trim(flags)//" cosma"
155#endif
156#if defined(__ACE)
157 flags = trim(flags)//" ace"
158#endif
159#if defined(__DEEPMD)
160 flags = trim(flags)//" deepmd"
161#endif
162#if defined(__PW_FPGA)
163 flags = trim(flags)//" pw_fpga"
164#endif
165#if defined(__PW_FPGA_SP)
166 flags = trim(flags)//" pw_fpga_sp"
167#endif
168#if defined(__LIBXS)
169 flags = trim(flags)//" libxs"
170#endif
171#if defined(__LIBXSMM)
172 flags = trim(flags)//" libxsmm"
173#endif
174#if defined(__LIBXSTREAM)
175 flags = trim(flags)//" libxstream"
176#endif
177#if defined(__CRAY_PM_ACCEL_ENERGY)
178 flags = trim(flags)//" cray_pm_accel_energy"
179#endif
180#if defined(__CRAY_PM_ENERGY)
181 flags = trim(flags)//" cray_pm_energy"
182#endif
183#if defined(__CRAY_PM_FAKE_ENERGY)
184 flags = trim(flags)//" cray_pm_fake_energy"
185#endif
186#if defined(__DBCSR_ACC)
187 flags = trim(flags)//" dbcsr_acc"
188#endif
189#if defined(__MAX_CONTR)
190 CALL integer_to_string(__max_contr, tmp_str)
191 flags = trim(flags)//" max_contr="//trim(tmp_str)
192#endif
193#if defined(__NO_SOCKETS)
194 flags = trim(flags)//" no_sockets"
195#endif
196#if defined(__NO_STATM_ACCESS)
197 flags = trim(flags)//" no_statm_access"
198#endif
199#if defined(__PW_CUDA_NO_HOSTALLOC)
200 flags = trim(flags)//" pw_cuda_no_hostalloc"
201#endif
202#if defined(__STATM_RESIDENT)
203 flags = trim(flags)//" statm_resident"
204#endif
205#if defined(__STATM_TOTAL)
206 flags = trim(flags)//" statm_total"
207#endif
208#if defined(__PLUMED2)
209 flags = trim(flags)//" plumed2"
210#endif
211#if defined(__HAS_IEEE_EXCEPTIONS)
212 flags = trim(flags)//" has_ieee_exceptions"
213#endif
214#if defined(__NO_ABORT)
215 flags = trim(flags)//" no_abort"
216#endif
217#if defined(__SPGLIB)
218 flags = trim(flags)//" spglib"
219#endif
220#if defined(__ACCELERATE)
221 flags = trim(flags)//" accelerate"
222#endif
223#if defined(__MKL)
224 flags = trim(flags)//" mkl"
225#endif
226#if defined(__DFTD4)
227 flags = trim(flags)//" libdftd4"
228#endif
229#if defined(__DFTD4_V3)
230 flags = trim(flags)//" dftd4_v3"
231#endif
232#if defined(__DFTD4_V4_2)
233 flags = trim(flags)//" dftd4_v4_2"
234#endif
235#if defined(__S_DFTD3)
236 flags = trim(flags)//" s_dftd3"
237#endif
238#if defined(__TBLITE)
239 flags = trim(flags)//" mctc-lib"
240 flags = trim(flags)//" tblite"
241#endif
242#if defined(__TBLITE_DEBUG_DIAGNOSTICS)
243 flags = trim(flags)//" tblite_debug_diagnostics"
244#endif
245#if defined(__SIRIUS)
246 flags = trim(flags)//" sirius"
247#endif
248#if defined(__SIRIUS_NLCG)
249 flags = trim(flags)//" sirius_nlcg"
250#endif
251#if defined(__SIRIUS_DFTD3)
252 flags = trim(flags)//" sirius_dftd3"
253#endif
254#if defined(__SIRIUS_DFTD4)
255 flags = trim(flags)//" sirius_dftd4"
256#endif
257#if defined(__SIRIUS_VCSQNM)
258 flags = trim(flags)//" sirius_vcsqnm"
259#endif
260#if defined(__CHECK_DIAG)
261 flags = trim(flags)//" check_diag"
262#endif
263#if defined(__LIBVORI)
264 flags = trim(flags)//" libvori"
265 flags = trim(flags)//" libbqb"
266#endif
267#if defined(__LIBMAXWELL)
268 flags = trim(flags)//" libmaxwell"
269#endif
270#if defined(__LIBTORCH)
271 flags = trim(flags)//" libtorch"
272#endif
273#if defined(__MIMIC)
274 flags = trim(flags)//" mimic"
275#endif
276#if defined(__OFFLOAD_CUDA)
277 flags = trim(flags)//" offload_cuda"
278#endif
279#if defined(__OFFLOAD_HIP)
280 flags = trim(flags)//" offload_hip"
281#endif
282#if defined(__OFFLOAD_OPENCL)
283 flags = trim(flags)//" offload_opencl"
284#endif
285#if defined(__NO_OFFLOAD_ELPA)
286 flags = trim(flags)//" no_offload_elpa"
287#endif
288#if defined(__NO_OFFLOAD_GRID)
289 flags = trim(flags)//" no_offload_grid"
290#endif
291#if defined(__NO_OFFLOAD_DBM)
292 flags = trim(flags)//" no_offload_dbm"
293#endif
294#if defined(__NO_OFFLOAD_PW)
295 flags = trim(flags)//" no_offload_pw"
296#endif
297#if defined(__OFFLOAD_PROFILING)
298 flags = trim(flags)//" offload_profiling"
299#endif
300#if defined(__SPLA) && defined(__OFFLOAD_GEMM)
301 flags = trim(flags)//" spla_gemm_offloading"
302#endif
303#if defined(__CUSOLVERMP)
304 flags = trim(flags)//" cusolvermp"
305#endif
306#if defined(__CUSOLVERMP_NCCL)
307 flags = trim(flags)//" cusolvermp_nccl"
308#endif
309#if defined(__DLAF)
310 flags = trim(flags)//" dlaf"
311#endif
312#if defined(__LIBVDWXC)
313 flags = trim(flags)//" libvdwxc"
314#endif
315#if defined(__HDF5)
316 flags = trim(flags)//" hdf5"
317#endif
318#if defined(__TREXIO)
319 flags = trim(flags)//" trexio"
320#endif
321#if defined(__LIBFCI)
322 flags = trim(flags)//" libfci"
323#endif
324#if defined(__OFFLOAD_UNIFIED_MEMORY)
325 flags = trim(flags)//" offload_unified_memory"
326#endif
327#if defined(__SMEAGOL)
328 flags = trim(flags)//" libsmeagol"
329#endif
330#if defined(__GREENX)
331 flags = trim(flags)//" greenx"
332#endif
333
334#if defined(__OPENPMD)
335 flags = trim(flags)//" openpmd"
336#endif
337
338 END FUNCTION cp2k_flags
339
340! **************************************************************************************************
341!> \brief ...
342!> \param iunit ...
343! **************************************************************************************************
344 SUBROUTINE print_cp2k_license(iunit)
345
346 INTEGER :: iunit
347
348 WRITE (unit=iunit, fmt="(T2,A)") &
349 "******************************************************************************", &
350 "* *", &
351 "* CP2K: A general program to perform molecular dynamics simulations *", &
352 "* Copyright (C) 2000-2026 CP2K developer group <https://www.cp2k.org/> *", &
353 "* *", &
354 "* This program is free software: you can redistribute it and/or modify *", &
355 "* it under the terms of the GNU General Public License as published by *", &
356 "* the Free Software Foundation, either version 2 of the License, or *", &
357 "* (at your option) any later version. *", &
358 "* *", &
359 "* This program is distributed in the hope that it will be useful, *", &
360 "* but WITHOUT ANY WARRANTY; without even the implied warranty of *", &
361 "* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *", &
362 "* GNU General Public License for more details. *", &
363 "* *", &
364 "* You should have received a copy of the GNU General Public License *", &
365 "* along with this program. If not, see <https://www.gnu.org/licenses/>. *", &
366 "* *", &
367 "******************************************************************************"
368
369 END SUBROUTINE print_cp2k_license
370
371! **************************************************************************************************
372!> \brief ...
373! **************************************************************************************************
374 SUBROUTINE get_runtime_info()
375
376 r_cwd = ""
377 r_host_name = ""
378 r_timestamp = ""
379 r_user_name = ""
380 r_pid = -1
381
382 CALL m_getpid(r_pid)
386 CALL m_getcwd(r_cwd)
387
388 END SUBROUTINE get_runtime_info
389
390! **************************************************************************************************
391!> \brief Writes the header for the restart file
392!> \param iunit ...
393!> \par History
394!> 01.2008 [created] - Split from write_restart
395!> \author Teodoro Laino - University of Zurich - 01.2008
396! **************************************************************************************************
397 SUBROUTINE write_restart_header(iunit)
398 INTEGER, INTENT(IN) :: iunit
399
400 CHARACTER(LEN=256) :: cwd
401 CHARACTER(LEN=timestamp_length) :: timestamp
402
403 CALL m_timestamp(timestamp)
404 CALL m_getcwd(cwd)
405
406 WRITE (unit=iunit, fmt="(T2,A)") "# Version information for this restart file "
407 WRITE (unit=iunit, fmt="(T2,A)") "# current date "//timestamp
408 WRITE (unit=iunit, fmt="(T2,A)") "# current working dir "//trim(cwd)
409
410 WRITE (unit=iunit, fmt="(T2,A,T31,A50)") &
411 "# Program compiled at", &
412 adjustr(compile_date(1:min(50, len(compile_date))))
413 WRITE (unit=iunit, fmt="(T2,A,T31,A50)") &
414 "# Program compiled on", &
415 adjustr(compile_host(1:min(50, len(compile_host))))
416 WRITE (unit=iunit, fmt="(T2,A,T31,A50)") &
417 "# Program compiled for", &
418 adjustr(compile_arch(1:min(50, len(compile_arch))))
419 WRITE (unit=iunit, fmt="(T2,A,T31,A50)") &
420 "# Source code revision number", &
421 adjustr(compile_revision)
422
423 END SUBROUTINE write_restart_header
424
425END MODULE cp2k_info
some minimal info about CP2K, including its version and license
Definition cp2k_info.F:22
character(len=default_string_length), save, public compile_date
Definition cp2k_info.F:63
character(len=default_string_length), public r_host_name
Definition cp2k_info.F:74
character(len= *), parameter, public cp2k_home
Definition cp2k_info.F:51
character(len= *), parameter, public compile_host
Definition cp2k_info.F:69
character(len= *), parameter, public compile_arch
Definition cp2k_info.F:57
integer, public r_pid
Definition cp2k_info.F:76
subroutine, public print_cp2k_license(iunit)
...
Definition cp2k_info.F:345
subroutine, public write_restart_header(iunit)
Writes the header for the restart file.
Definition cp2k_info.F:398
character(len= *), parameter, public compile_revision
Definition cp2k_info.F:45
character(len=timestamp_length), public r_timestamp
Definition cp2k_info.F:75
character(len= *), parameter, public cp2k_year
Definition cp2k_info.F:50
character(len=10 *default_string_length) function, public cp2k_flags()
list all compile time options that influence the capabilities of cp2k. All new flags should be added ...
Definition cp2k_info.F:87
character(len= *), parameter, public cp2k_version
Definition cp2k_info.F:49
character(len=default_path_length), public r_cwd
Definition cp2k_info.F:73
subroutine, public get_runtime_info()
...
Definition cp2k_info.F:375
character(len=default_string_length), public r_user_name
Definition cp2k_info.F:74
Defines the basic variable types.
Definition kinds.F:23
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
subroutine, public m_getpid(pid)
...
Definition machine.F:655
integer, parameter, public timestamp_length
Definition machine.F:46
subroutine, public m_timestamp(timestamp)
Returns a human readable timestamp.
Definition machine.F:381
subroutine, public m_getcwd(curdir)
...
Definition machine.F:607
subroutine, public m_getlog(user)
...
Definition machine.F:736
subroutine, public m_hostnm(hname)
...
Definition machine.F:580
Utilities for string manipulations.
subroutine, public integer_to_string(inumber, string)
Converts an integer number to a string. The WRITE statement will return an error message,...