Debian Codegraph @

docs/source/c_api.rst

raw
1 API Reference
2 =============
3
4 Helper Functions
5 ++++++++++++++++
6
7 A collection of function ment to provide information and the gau2grid library.
8
9 .. c:function:: int gg_max_L();
10
11 Returns the maximum compiled angular momentum
12
13 .. c:function:: int gg_ncomponents(const int L, const int spherical)
14
15 Returns the number of components for a given angular momentum.
16
17 :param L: The angular momentum of the basis function.
18 :param spherical: Boolean that returns spherical (1) or cartesian (0) basis representations.
19
20 The following enums are also specified:
21
22 - ``GG_SPHERICAL_CCA`` - CCA spherical output.
23 - ``GG_SPHERICAL_GAUSSIAN`` - Gaussian spherical output.
24 - ``GG_CARTESIAN_CCA`` - CCA cartesian output.
25 - ``GG_CARTESIAN_MOLDEN`` - Molden cartesian output.
26
27 Transpose Functions
28 +++++++++++++++++++
29
30 Transposes matrices if input or output order is incorrect.
31
32 .. c:function:: void gg_naive_transpose(unsigned long n, unsigned long m, const double* PRAGMA_RESTRICT input, double* PRAGMA_RESTRICT output)
33
34 Transposes a matrix using a simple for loop.
35
36 :param n: The number of rows in the input matrix.
37 :param m: The number of rows in the output matrix.
38 :param input: The ``(n x m)`` input matrix.
39 :param output: The ``(m x n)`` output matrix.
40
41
42 .. c:function:: void gg_fast_transpose(unsigned long n, unsigned long m, const double* PRAGMA_RESTRICT input, double* PRAGMA_RESTRICT output)
43
44 Transposes a matrix using a small on-cache temporary array. Is usually faster than :c:func:`~gg_naive_transpose`.
45
46 :param n: The number of rows in the input matrix.
47 :param m: The number of rows in the output matrix.
48 :param input: The ``(n x m)`` input matrix.
49 :param output: The ``(m x n)`` output matrix.
50
51 Orbital Functions
52 +++++++++++++++++
53
54 Computes orbitals on a grid.
55
56
57 .. c:function:: void gg_orbitals(int L, const double* PRAGMA_RESTRICT C, const unsigned long norbitals, const unsigned long npoints, const double* PRAGMA_RESTRICT xyz, const unsigned long xyz_stride, const int nprim, const double* PRAGMA_RESTRICT coeffs, const double* PRAGMA_RESTRICT exponents, const double* PRAGMA_RESTRICT center, const int order, double* PRAGMA_RESTRICT orbital_out)
58
59 Computes orbital a section on a grid. This function performs the following
60 contraction inplace.
61
62 .. math::
63
64 C_{im} \phi_{m p} \rightarrow ret_{i p}
65
66 This is often more efficient than generating :math:`\phi_{m p}` and then
67 contracting with the orbitals C as there is greater cache locality.
68
69 :param L: The angular momentum of the basis function.
70 :param C: A ``(norbitals, ncomponents)`` matrix of orbital coefficients.
71 :param norbitals: The number of orbs to compute.
72 :param npoints: The number of grid points to compute.
73 :param xyz: A ``(npoints, 3)`` or (npoints, n) array of the xyz coordinates.
74 :param xyz_stride: The stride of the xyz input array. 1 for ``xx..., yy..., zz...`` style input, 3 for ``xyz, xyz, xyz, ...`` style input.
75 :param nprim: The number of primitives (exponents and coefficients) in the basis set
76 :param coeffs: A ``(nprim, )`` array of coefficients (:math:`c`).
77 :param exponents: A ``(nprim, )`` array of exponents (:math:`\alpha`).
78 :param center: A ``(3, )`` array of x, y, z coordinate of the basis center.
79 :param order: Enum that specifies the output order.
80 :param orbital_out: ``(norbitals, npoints)`` array of orbitals on the grid.
81
82 Collocation Functions
83 +++++++++++++++++++++
84
85 Creates collocation matrices between a gaussian function and a set of grid points.
86
87
88 .. c:function:: void gg_collocation(int L, const unsigned long npoints, const double* PRAGMA_RESTRICT xyz, const unsigned long xyz_stride, const int nprim, const double* PRAGMA_RESTRICT coeffs, const double* PRAGMA_RESTRICT exponents, const double* PRAGMA_RESTRICT center, const int order, double* PRAGMA_RESTRICT phi_out)
89
90 Computes the collocation array:
91
92 .. math::
93
94 \phi_{m p} = Y_\ell^m \sum_i c_i e^{-\alpha_i |\phi_{\rm center} - p| ^2}
95
96 :param L: The angular momentum of the basis function.
97 :param npoints: The number of grid points to compute.
98 :param xyz: A ``(npoints, 3)`` or (npoints, n) array of the xyz coordinates.
99 :param xyz_stride: The stride of the xyz input array. 1 for ``xx..., yy..., zz...`` style input, 3 for ``xyz, xyz, xyz, ...`` style input.
100 :param nprim: The number of primitives (exponents and coefficients) in the basis set
101 :param coeffs: A ``(nprim, )`` array of coefficients (:math:`c`).
102 :param exponents: A ``(nprim, )`` array of exponents (:math:`\alpha`).
103 :param center: A ``(3, )`` array of x, y, z coordinate of the basis center.
104 :param order: Enum that specifies the output order.
105 :param phi_out: ``(ncomponents, npoints)`` collocation array.
106
107 .. c:function:: void gg_collocation_deriv1(int L, const unsigned long npoints, const double* PRAGMA_RESTRICT xyz, const unsigned long xyz_stride, const int nprim, const double* PRAGMA_RESTRICT coeffs, const double* PRAGMA_RESTRICT exponents, const double* PRAGMA_RESTRICT center, const int order, double* PRAGMA_RESTRICT phi_out, double* PRAGMA_RESTRICT phi_out, double* PRAGMA_RESTRICT phi_x_out, double* PRAGMA_RESTRICT phi_y_out, double* PRAGMA_RESTRICT phi_z_out)
108
109 Computes the collocation array and the corresponding first cartesian derivatives:
110
111 .. math::
112
113 \phi_{m p} = Y_\ell^m \sum_i c_i e^{-\alpha_i |\phi_{\rm center} - p| ^2}
114
115 :param L: The angular momentum of the basis function.
116 :param npoints: The number of grid points to compute.
117 :param xyz: A ``(npoints, 3)`` or (npoints, n) array of the xyz coordinates.
118 :param xyz_stride: The stride of the xyz input array. 1 for ``xx..., yy..., zz...`` style input, 3 for ``xyz, xyz, xyz, ...`` style input.
119 :param nprim: The number of primitives (exponents and coefficients) in the basis set
120 :param coeffs: A ``(nprim, )`` array of coefficients (:math:`c`).
121 :param exponents: A ``(nprim, )`` array of exponents (:math:`\alpha`).
122 :param center: A ``(3, )`` array of x, y, z coordinate of the basis center.
123 :param order: Enum that specifies the output order.
124 :param phi_out: ``(ncomponents, npoints)`` collocation array.
125 :param phi_x_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``x``.
126 :param phi_y_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``y``.
127 :param phi_z_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``z``.
128
129
130 .. c:function:: void gg_collocation_deriv2(int L, const unsigned long npoints, const double* PRAGMA_RESTRICT xyz, const unsigned long xyz_stride, const int nprim, const double* PRAGMA_RESTRICT coeffs, const double* PRAGMA_RESTRICT exponents, const double* PRAGMA_RESTRICT center, const int order, double* PRAGMA_RESTRICT phi_out, double* PRAGMA_RESTRICT phi_out, double* PRAGMA_RESTRICT phi_x_out, double* PRAGMA_RESTRICT phi_y_out, double* PRAGMA_RESTRICT phi_z_out, double* PRAGMA_RESTRICT phi_xx_out, double* PRAGMA_RESTRICT phi_xy_out, double* PRAGMA_RESTRICT phi_xz_out, double* PRAGMA_RESTRICT phi_yy_out, double* PRAGMA_RESTRICT phi_yz_out, double* PRAGMA_RESTRICT phi_zz_out)
131
132 Computes the collocation array and the corresponding first and second cartesian derivatives:
133
134 .. math::
135
136 \phi_{m p} = Y_\ell^m \sum_i c_i e^{-\alpha_i |\phi_{\rm center} - p| ^2}
137
138 :param L: The angular momentum of the basis function.
139 :param npoints: The number of grid points to compute.
140 :param xyz: A ``(npoints, 3)`` or (npoints, n) array of the xyz coordinates.
141 :param xyz_stride: The stride of the xyz input array. 1 for ``xx..., yy..., zz...`` style input, 3 for ``xyz, xyz, xyz, ...`` style input.
142 :param nprim: The number of primitives (exponents and coefficients) in the basis set
143 :param coeffs: A ``(nprim, )`` array of coefficients (:math:`c`).
144 :param exponents: A ``(nprim, )`` array of exponents (:math:`\alpha`).
145 :param center: A ``(3, )`` array of x, y, z coordinate of the basis center.
146 :param order: Enum that specifies the output order.
147 :param phi_out: ``(ncomponents, npoints)`` collocation array.
148 :param phi_x_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``x``.
149 :param phi_y_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``y``.
150 :param phi_z_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``z``.
151 :param phi_xx_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``xx``.
152 :param phi_xy_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``xy``.
153 :param phi_xz_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``xz``.
154 :param phi_yy_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``yy``.
155 :param phi_yz_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``yz``.
156 :param phi_zz_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``zz``.
157
158 .. c:function:: void gg_collocation_deriv3(int L, const unsigned long npoints, const double* PRAGMA_RESTRICT xyz, const unsigned long xyz_stride, const int nprim, const double* PRAGMA_RESTRICT coeffs, const double* PRAGMA_RESTRICT exponents, const double* PRAGMA_RESTRICT center, const int order, double* PRAGMA_RESTRICT phi_out, double* PRAGMA_RESTRICT phi_out, double* PRAGMA_RESTRICT phi_x_out, double* PRAGMA_RESTRICT phi_y_out, double* PRAGMA_RESTRICT phi_z_out, double* PRAGMA_RESTRICT phi_xx_out, double* PRAGMA_RESTRICT phi_xy_out, double* PRAGMA_RESTRICT phi_xz_out, double* PRAGMA_RESTRICT phi_yy_out, double* PRAGMA_RESTRICT phi_yz_out, double* PRAGMA_RESTRICT phi_zz_out, double* PRAGMA_RESTRICT phi_xxx_out, double* PRAGMA_RESTRICT phi_xxy_out, double* PRAGMA_RESTRICT phi_xxz_out, double* PRAGMA_RESTRICT phi_xyy_out, double* PRAGMA_RESTRICT phi_xyz_out, double* PRAGMA_RESTRICT phi_xzz_out, double* PRAGMA_RESTRICT phi_yyy_out, double* PRAGMA_RESTRICT phi_yyz_out, double* PRAGMA_RESTRICT phi_yzz_out, double* PRAGMA_RESTRICT phi_zzz_out)
159
160 Computes the collocation array and the corresponding first, second, and third cartesian derivatives:
161
162 .. math::
163
164 \phi_{m p} = Y_\ell^m \sum_i c_i e^{-\alpha_i |\phi_{\rm center} - p| ^2}
165
166 :param L: The angular momentum of the basis function.
167 :param npoints: The number of grid points to compute.
168 :param xyz: A ``(npoints, 3)`` or (npoints, n) array of the xyz coordinates.
169 :param xyz_stride: The stride of the xyz input array. 1 for ``xx..., yy..., zz...`` style input, 3 for ``xyz, xyz, xyz, ...`` style input.
170 :param nprim: The number of primitives (exponents and coefficients) in the basis set
171 :param coeffs: A ``(nprim, )`` array of coefficients (:math:`c`).
172 :param exponents: A ``(nprim, )`` array of exponents (:math:`\alpha`).
173 :param center: A ``(3, )`` array of x, y, z coordinate of the basis center.
174 :param order: Enum that specifies the output order.
175 :param phi_out: ``(ncomponents, npoints)`` collocation array.
176 :param phi_x_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``x``.
177 :param phi_y_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``y``.
178 :param phi_z_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``z``.
179 :param phi_xx_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``xx``.
180 :param phi_xy_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``xy``.
181 :param phi_xz_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``xz``.
182 :param phi_yy_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``yy``.
183 :param phi_yz_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``yz``.
184 :param phi_zz_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``zz``.
185 :param phi_xxx_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``xxx``.
186 :param phi_xxy_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``xxy``.
187 :param phi_xxz_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``xxz``.
188 :param phi_xyy_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``xyy``.
189 :param phi_xyz_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``xyz``.
190 :param phi_xzz_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``xzz``.
191 :param phi_yyy_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``yyy``.
192 :param phi_yyz_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``yyz``.
193 :param phi_yzz_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``yzz``.
194 :param phi_zzz_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``zzz``.