Line data Source code
1 : /*----------------------------------------------------------------------------*/
2 : /* CP2K: A general program to perform molecular dynamics simulations */
3 : /* Copyright 2000-2025 CP2K developers group <https://cp2k.org> */
4 : /* */
5 : /* SPDX-License-Identifier: MIT */
6 : /*----------------------------------------------------------------------------*/
7 :
8 : /*
9 : * libgrpp - a library for the evaluation of integrals over
10 : * generalized relativistic pseudopotentials.
11 : *
12 : * Copyright (C) 2021-2023 Alexander Oleynichenko
13 : */
14 :
15 : #include "libgrpp.h"
16 :
17 : void libgrpp_create_real_spherical_harmonic_coeffs_tables(int Lmax);
18 : void libgrpp_pretabulate_bessel();
19 :
20 : static int libgrpp_initialized = 0;
21 :
22 : /**
23 : * thread-safe initialization
24 : */
25 12600 : void libgrpp_init() {
26 25200 : #pragma omp critical
27 : {
28 12600 : if (libgrpp_initialized == 0) {
29 18 : libgrpp_create_real_spherical_harmonic_coeffs_tables(40);
30 18 : libgrpp_pretabulate_bessel();
31 :
32 18 : libgrpp_initialized = 1;
33 : }
34 : }
35 12600 : }
36 :
37 194176 : int libgrpp_is_initialized() { return libgrpp_initialized; }
38 :
39 : /**
40 : * thread-safe finalization
41 : */
42 0 : void libgrpp_finalize() {
43 0 : #pragma omp critical
44 : {
45 0 : if (libgrpp_initialized == 1) {
46 0 : libgrpp_initialized = 0;
47 : }
48 : }
49 0 : }
|