(git:ed6f26b)
Loading...
Searching...
No Matches
grpp.c
Go to the documentation of this file.
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#include <stdlib.h>
18
19#define LIBGRPP_MAX_NUMBER_POTENTIALS 100
20
22 return (libgrpp_grpp_t *)calloc(1, sizeof(libgrpp_grpp_t));
23}
24
27 if (grpp->U_L != NULL) {
29 }
30
31 grpp->U_L = pot;
32}
33
36 if (grpp->n_arep == 0) {
37 grpp->U_arep = (libgrpp_potential_t **)calloc(
39 }
40
41 grpp->U_arep[grpp->n_arep++] = pot;
42}
43
46 if (grpp->n_esop == 0) {
47 grpp->U_esop = (libgrpp_potential_t **)calloc(
49 }
50
51 grpp->U_esop[grpp->n_esop++] = pot;
52}
53
56 libgrpp_shell_t *oc_shell) {
57 if (grpp->n_oc_shells == 0) {
59 sizeof(libgrpp_potential_t *));
61 sizeof(libgrpp_shell_t *));
62 }
63
64 grpp->U_oc[grpp->n_oc_shells] = pot;
65 grpp->oc_shells[grpp->n_oc_shells] = oc_shell;
66 grpp->n_oc_shells++;
67}
68
70 if (grpp == NULL) {
71 return;
72 }
73
74 /*
75 * scalar-relativistic part
76 */
77 if (grpp->U_L != NULL) {
79 }
80
81 for (int i = 0; i < grpp->n_arep; i++) {
82 if (grpp->U_arep[i] != NULL) {
84 }
85 }
86 free(grpp->U_arep);
87
88 /*
89 * effective spin-orbit operator
90 */
91 for (int i = 0; i < grpp->n_esop; i++) {
92 if (grpp->U_esop[i] != NULL) {
94 }
95 }
96 free(grpp->U_esop);
97
98 /*
99 * outercore shells and potentials
100 */
101 for (int i = 0; i < grpp->n_oc_shells; i++) {
102 if (grpp->U_oc[i] != NULL) {
104 }
105 if (grpp->oc_shells[i] != NULL) {
107 }
108 }
109 free(grpp->U_oc);
110 free(grpp->oc_shells);
111
112 free(grpp);
113}
static void const int const int i
#define LIBGRPP_MAX_NUMBER_POTENTIALS
Definition grpp.c:19
libgrpp_grpp_t * libgrpp_new_grpp()
Definition grpp.c:21
void libgrpp_grpp_add_spin_orbit_potential(libgrpp_grpp_t *grpp, libgrpp_potential_t *pot)
Definition grpp.c:44
void libgrpp_grpp_add_outercore_potential(libgrpp_grpp_t *grpp, libgrpp_potential_t *pot, libgrpp_shell_t *oc_shell)
Definition grpp.c:54
void libgrpp_delete_grpp(libgrpp_grpp_t *grpp)
Definition grpp.c:69
void libgrpp_grpp_add_averaged_potential(libgrpp_grpp_t *grpp, libgrpp_potential_t *pot)
Definition grpp.c:34
void libgrpp_grpp_set_local_potential(libgrpp_grpp_t *grpp, libgrpp_potential_t *pot)
Definition grpp.c:25
void libgrpp_delete_potential(libgrpp_potential_t *potential)
void libgrpp_delete_shell(libgrpp_shell_t *shell)
Definition grpp_shell.c:103
libgrpp_potential_t ** U_esop
libgrpp_potential_t ** U_oc
libgrpp_shell_t ** oc_shells
libgrpp_potential_t * U_L
libgrpp_potential_t ** U_arep