File: cp2k_info.F

package info (click to toggle)
cp2k 6.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 205,372 kB
  • sloc: fortran: 835,185; f90: 59,605; python: 9,861; sh: 7,882; cpp: 4,868; ansic: 2,807; xml: 2,185; lisp: 733; pascal: 612; perl: 547; makefile: 497; csh: 16
file content (373 lines) | stat: -rw-r--r-- 14,710 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
!--------------------------------------------------------------------------------------------------!
!   CP2K: A general program to perform molecular dynamics simulations                              !
!   Copyright (C) 2000 - 2018  CP2K developers group                                               !
!--------------------------------------------------------------------------------------------------!

! **************************************************************************************************
!> \brief some minimal info about CP2K, including its version and license
!> \par History
!>      - created (2007-09, Joost VandeVondele)
!>      - moved into this module information related to runtime:pid, user_name,
!>        host_name, cwd, datx  (2009-06, Teodoro Laino)
!> \author Joost VandeVondele
! **************************************************************************************************
MODULE cp2k_info

   USE input_constants,                 ONLY: id_development_version,&
                                              id_release_version
   USE kinds,                           ONLY: default_path_length,&
                                              default_string_length
   USE machine,                         ONLY: m_datum,&
                                              m_getcwd,&
                                              m_getlog,&
                                              m_getpid,&
                                              m_hostnm
   USE string_utilities,                ONLY: integer_to_string

   IMPLICIT NONE
   PRIVATE

   PUBLIC :: cp2k_year, cp2k_version, cp2k_home, id_cp2k_version, cp2k_flags
   PUBLIC :: compile_arch, compile_date, compile_host, compile_revision
   PUBLIC :: print_cp2k_license, get_runtime_info, write_restart_header

   ! the version string of CP2K intended to be adjust after releases and branches
#if defined(__RELEASE_VERSION)
   INTEGER, PARAMETER          :: id_cp2k_version = id_release_version ! (Uncomment for release     version)
#else
!  INTEGER, PARAMETER          :: id_cp2k_version = id_development_version ! (Uncomment for development version)
   INTEGER, PARAMETER          :: id_cp2k_version = 2                      ! (Uncomment for branch      version)
#endif

#if defined(__COMPILE_REVISION)
   CHARACTER(LEN=*), PARAMETER :: compile_revision = __COMPILE_REVISION
#else
   CHARACTER(LEN=*), PARAMETER :: compile_revision = "unknown"
#endif

   CHARACTER(LEN=*), PARAMETER :: version_nr = "6.1"
   CHARACTER(LEN=*), PARAMETER :: cp2k_year = "2018"
   CHARACTER(LEN=*), PARAMETER :: cp2k_version = "CP2K version "//TRIM(version_nr)
   CHARACTER(LEN=*), PARAMETER :: cp2k_home = "https://www.cp2k.org/"

   ! compile time information
#if defined(__COMPILE_ARCH)
   CHARACTER(LEN=*), PARAMETER :: compile_arch = __COMPILE_ARCH
#else
   CHARACTER(LEN=*), PARAMETER :: compile_arch = "unknown: -D__COMPILE_ARCH=?"
#endif

#if defined(__COMPILE_DATE)
   CHARACTER(LEN=*), PARAMETER :: compile_date = __COMPILE_DATE
#else
   CHARACTER(LEN=*), PARAMETER :: compile_date = "unknown: -D__COMPILE_DATE=?"
#endif

#if defined(__COMPILE_HOST)
   CHARACTER(LEN=*), PARAMETER :: compile_host = __COMPILE_HOST
#else
   CHARACTER(LEN=*), PARAMETER :: compile_host = "unknown: -D__COMPILE_HOST=?"
#endif

   ! Local runtime informations
   CHARACTER(LEN=26), PUBLIC                        :: r_datx
   CHARACTER(LEN=default_path_length), PUBLIC       :: r_cwd
   CHARACTER(LEN=default_string_length), PUBLIC     :: r_host_name, r_user_name
   INTEGER, PUBLIC                                  :: r_pid

   CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'cp2k_info'
CONTAINS

! **************************************************************************************************
!> \brief list all compile time options that influence the capabilities of cp2k.
!>        All new flags should be added here (and be unique grep-able)
!> \return ...
! **************************************************************************************************
   FUNCTION cp2k_flags() RESULT(flags)
      CHARACTER(len=10*default_string_length)            :: flags

      CHARACTER(len=default_string_length)               :: tmp_str

      flags = "cp2kflags:"

      ! Ensure that tmp_str is used to silence compiler warnings
      tmp_str = ""
      flags = TRIM(flags)//TRIM(tmp_str)

!$    flags = TRIM(flags)//" omp"

#if defined(__LIBINT)
      flags = TRIM(flags)//" libint"
#endif
#if defined(__FFTW3)
      flags = TRIM(flags)//" fftw3"
#endif
#if defined(__LIBXC)
      flags = TRIM(flags)//" libxc"
#endif
#if defined(__LIBPEXSI)
      flags = TRIM(flags)//" pexsi"
#endif
#if defined(__ELPA)
      CALL integer_to_string(__ELPA, tmp_str)
      flags = TRIM(flags)//" elpa="//TRIM(tmp_str)
#if (__ELPA==201502) || (__ELPA==201505) || (__ELPA==201511) || (__ELPA==201605) || (__ELPA==201611) || (__ELPA==201705) || (__ELPA==201711)
      flags = TRIM(flags)//" elpa_qr"
#endif
#endif
#if defined(__parallel)
      flags = TRIM(flags)//" parallel"
#if !defined(__MPI_VERSION) || (__MPI_VERSION > 2)
      flags = TRIM(flags)//" mpi3"
#else
      flags = TRIM(flags)//" mpi2"
#endif
#endif
#if defined(__SCALAPACK)
      flags = TRIM(flags)//" scalapack"
#endif
#if defined(__SCALAPACK2)
      flags = TRIM(flags)//" scalapack2"
#endif

#if defined(__QUIP)
      flags = TRIM(flags)//" quip"
#endif

#if defined(__ACC)
      flags = TRIM(flags)//" acc"
#endif
#if defined(__PW_CUDA)
      flags = TRIM(flags)//" pw_cuda"
#endif
#if defined(__HAS_PATCHED_CUFFT_70)
      flags = TRIM(flags)//" patched_cufft_70"
#endif

#if defined __HAS_smm_vec
      flags = TRIM(flags)//" smm_vec"
#endif
#if defined __HAS_smm_snn
      flags = TRIM(flags)//" smm_snn"
#endif
#if defined __HAS_smm_snt
      flags = TRIM(flags)//" smm_snt"
#endif
#if defined __HAS_smm_stn
      flags = TRIM(flags)//" smm_stn"
#endif
#if defined __HAS_smm_stt
      flags = TRIM(flags)//" smm_stt"
#endif
#if defined __HAS_smm_znn
      flags = TRIM(flags)//" smm_znn"
#endif
#if defined __HAS_smm_znt
      flags = TRIM(flags)//" smm_znt"
#endif
#if defined __HAS_smm_ztn
      flags = TRIM(flags)//" smm_ztn"
#endif
#if defined __HAS_smm_ztt
      flags = TRIM(flags)//" smm_ztt"
#endif
#if defined __HAS_smm_cnn
      flags = TRIM(flags)//" smm_cnn"
#endif
#if defined __HAS_smm_cnt
      flags = TRIM(flags)//" smm_cnt"
#endif
#if defined __HAS_smm_ctn
      flags = TRIM(flags)//" smm_ctn"
#endif
#if defined __HAS_smm_ctt
      flags = TRIM(flags)//" smm_ctt"
#endif
#if defined __HAS_smm_dnn
      flags = TRIM(flags)//" smm_dnn"
#endif
#if defined __HAS_smm_dnt
      flags = TRIM(flags)//" smm_dnt"
#endif
#if defined __HAS_smm_dtn
      flags = TRIM(flags)//" smm_dtn"
#endif
#if defined __HAS_smm_dtt
      flags = TRIM(flags)//" smm_dtt"
#endif
      IF (INDEX(flags, " smm_") > 0) THEN
         flags = TRIM(flags)//" smm"
      ENDIF

#if defined __LIBXSMM
      flags = TRIM(flags)//" xsmm"
#endif

#if defined __CRAY_PM_ACCEL_ENERGY
      flags = TRIM(flags)//" cray_pm_accel_energy"
#endif
#if defined __CRAY_PM_ENERGY
      flags = TRIM(flags)//" cray_pm_energy"
#endif
#if defined __CRAY_PM_FAKE_ENERGY
      flags = TRIM(flags)//" cray_pm_fake_energy"
#endif
#if defined __CUDA_PROFILING
      flags = TRIM(flags)//" cuda_profiling"
#endif
#if defined __DBCSR_ACC
      flags = TRIM(flags)//" dbcsr_acc"
#endif
#if defined __HAS_LIBGRID
      flags = TRIM(flags)//" libgrid"
#endif
#if defined __HAS_NO_CUDA_STREAM_PRIORITIES
      flags = TRIM(flags)//" has_no_cuda_stream_priorities"
#endif
#if defined __HAS_NO_MPI_MOD
      flags = TRIM(flags)//" has_no_mpi_mod"
#endif
#if defined __HAS_NO_SHARED_GLIBC
      flags = TRIM(flags)//" has_no_shared_glibc"
#endif
#if defined __MAX_CONTR
      CALL integer_to_string(__MAX_CONTR, tmp_str)
      flags = TRIM(flags)//" max_contr="//TRIM(tmp_str)
#endif
#if defined __NO_IPI_DRIVER
      flags = TRIM(flags)//" no_ipi_driver"
#endif
#if defined __NO_MPI_THREAD_SUPPORT_CHECK
      flags = TRIM(flags)//" no_mpi_thread_support_check"
#endif
#if defined __NO_STATM_ACCESS
      flags = TRIM(flags)//" no_statm_access"
#endif
#if defined __PW_CUDA_NO_HOSTALLOC
      flags = TRIM(flags)//" pw_cuda_no_hostalloc"
#endif
#if defined __STATM_RESIDENT
      flags = TRIM(flags)//" statm_resident"
#endif
#if defined __STATM_TOTAL
      flags = TRIM(flags)//" statm_total"
#endif
#if defined __PLUMED2
      flags = TRIM(flags)//" plumed2"
#endif
#if defined __HAS_IEEE_EXCEPTIONS
      flags = TRIM(flags)//" has_ieee_exceptions"
#endif
#if defined __NO_ABORT
      flags = TRIM(flags)//" no_abort"
#endif
#if defined __SPGLIB
      flags = TRIM(flags)//" spglib"
#endif
#if defined __ACCELERATE
      flags = TRIM(flags)//" accelerate"
#endif
#if defined __MKL
      flags = TRIM(flags)//" mkl"
#endif

   END FUNCTION cp2k_flags

! **************************************************************************************************
!> \brief ...
!> \param iunit ...
! **************************************************************************************************
   SUBROUTINE print_cp2k_license(iunit)
      INTEGER                                            :: iunit

      WRITE (iunit, '(T2,A)') '!-----------------------------------------------------------------------------!'
      WRITE (iunit, '(T2,A)') '!                                                                             !'
      WRITE (iunit, '(T2,A)') '!   CP2K: A general program to perform molecular dynamics simulations         !'
      WRITE (iunit, '(T2,A)') '!   Copyright (C) 2000, 2001, 2002, 2003  CP2K developers group               !'
      WRITE (iunit, '(T2,A)') '!   Copyright (C) 2004, 2005, 2006, 2007  CP2K developers group               !'
      WRITE (iunit, '(T2,A)') '!   Copyright (C) 2008, 2009, 2010, 2011  CP2K developers group               !'
      WRITE (iunit, '(T2,A)') '!   Copyright (C) 2012, 2013, 2014, 2015  CP2K developers group               !'
      WRITE (iunit, '(T2,A)') '!   Copyright (C) 2016                    CP2K developers group               !'
      WRITE (iunit, '(T2,A)') '!                                                                             !'
      WRITE (iunit, '(T2,A)') '!   This program is free software; you can redistribute it and/or modify      !'
      WRITE (iunit, '(T2,A)') '!   it under the terms of the GNU General Public License as published by      !'
      WRITE (iunit, '(T2,A)') '!   the Free Software Foundation; either version 2 of the License, or         !'
      WRITE (iunit, '(T2,A)') '!   (at your option) any later version.                                       !'
      WRITE (iunit, '(T2,A)') '!                                                                             !'
      WRITE (iunit, '(T2,A)') '!   This program is distributed in the hope that it will be useful,           !'
      WRITE (iunit, '(T2,A)') '!   but WITHOUT ANY WARRANTY; without even the implied warranty of            !'
      WRITE (iunit, '(T2,A)') '!   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             !'
      WRITE (iunit, '(T2,A)') '!   GNU General Public License for more details.                              !'
      WRITE (iunit, '(T2,A)') '!                                                                             !'
      WRITE (iunit, '(T2,A)') '!   You should have received a copy of the GNU General Public License         !'
      WRITE (iunit, '(T2,A)') '!   along with this program; if not, write to the Free Software               !'
      WRITE (iunit, '(T2,A)') '!   Foundation, Inc., 51 Franklin Street, Fifth Floor,                        !'
      WRITE (iunit, '(T2,A)') '!   Boston, MA  02110-1301, USA.                                              !'
      WRITE (iunit, '(T2,A)') '!                                                                             !'
      WRITE (iunit, '(T2,A)') '!   See also https://www.fsf.org/licensing/licenses/gpl.html                  !'
      WRITE (iunit, '(T2,A)') '!                                                                             !'
      WRITE (iunit, '(T2,A)') '!-----------------------------------------------------------------------------!'
      WRITE (iunit, '(T2,A)') '!   CP2K, including its sources and pointers to the authors                   !'
      WRITE (iunit, '(T2,A)') '!   can be found at  https://www.cp2k.org/                                    !'
      WRITE (iunit, '(T2,A)') '!-----------------------------------------------------------------------------!'

   END SUBROUTINE print_cp2k_license

! **************************************************************************************************
!> \brief ...
! **************************************************************************************************
   SUBROUTINE get_runtime_info()

      r_datx = ""
      r_cwd = ""
      r_host_name = ""
      r_user_name = ""
      r_pid = -1

      CALL m_getpid(r_pid)
      CALL m_getlog(r_user_name)
      CALL m_hostnm(r_host_name)
      CALL m_datum(r_datx)
      CALL m_getcwd(r_cwd)

   END SUBROUTINE

! **************************************************************************************************
!> \brief Writes the header for the restart file
!> \param iunit ...
!> \par History
!>      01.2008 [created] - Splitted from write_restart
!> \author Teodoro Laino - University of Zurich - 01.2008
! **************************************************************************************************
   SUBROUTINE write_restart_header(iunit)
      INTEGER, INTENT(IN)                                :: iunit

      CHARACTER(LEN=*), PARAMETER :: routineN = 'write_restart_header', &
         routineP = moduleN//':'//routineN

      CHARACTER(LEN=256)                                 :: cwd, datx

      CALL m_datum(datx)
      CALL m_getcwd(cwd)

      WRITE (UNIT=iunit, FMT="(T2,A)") "# Version information for this restart file "
      WRITE (UNIT=iunit, FMT="(T2,A)") "# current date "//TRIM(datx)
      WRITE (UNIT=iunit, FMT="(T2,A)") "# current working dir "//TRIM(cwd)

      WRITE (UNIT=iunit, FMT="(T2,A,T31,A50)") &
         "# Program compiled at", &
         ADJUSTR(compile_date(1:MIN(50, LEN(compile_date))))
      WRITE (UNIT=iunit, FMT="(T2,A,T31,A50)") &
         "# Program compiled on", &
         ADJUSTR(compile_host(1:MIN(50, LEN(compile_host))))
      WRITE (UNIT=iunit, FMT="(T2,A,T31,A50)") &
         "# Program compiled for", &
         ADJUSTR(compile_arch(1:MIN(50, LEN(compile_arch))))
      WRITE (UNIT=iunit, FMT="(T2,A,T31,A50)") &
         "# Source code revision number", &
         ADJUSTR(compile_revision)

   END SUBROUTINE write_restart_header

END MODULE cp2k_info