File: c_api.rst

package info (click to toggle)
gau2grid 2.0.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 688 kB
  • sloc: python: 5,326; makefile: 31; sh: 24
file content (194 lines) | stat: -rw-r--r-- 12,943 bytes parent folder | download | duplicates (3)
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
API Reference
=============

Helper Functions
++++++++++++++++

A collection of function ment to provide information and the gau2grid library.

.. c:function:: int gg_max_L();

    Returns the maximum compiled angular momentum

.. c:function:: int gg_ncomponents(const int L, const int spherical)

    Returns the number of components for a given angular momentum.

    :param L: The angular momentum of the basis function.
    :param spherical: Boolean that returns spherical (1) or cartesian (0) basis representations.

The following enums are also specified:

 - ``GG_SPHERICAL_CCA`` - CCA spherical output.
 - ``GG_SPHERICAL_GAUSSIAN`` - Gaussian spherical output.
 - ``GG_CARTESIAN_CCA`` - CCA cartesian output.
 - ``GG_CARTESIAN_MOLDEN`` - Molden cartesian output.

Transpose Functions
+++++++++++++++++++

Transposes matrices if input or output order is incorrect.

.. c:function:: void gg_naive_transpose(unsigned long n, unsigned long m, const double* PRAGMA_RESTRICT input, double* PRAGMA_RESTRICT output)

    Transposes a matrix using a simple for loop.

    :param n: The number of rows in the input matrix.
    :param m: The number of rows in the output matrix.
    :param input: The ``(n x m)`` input matrix.
    :param output: The ``(m x n)`` output matrix.


.. c:function:: void gg_fast_transpose(unsigned long n, unsigned long m, const double* PRAGMA_RESTRICT input, double* PRAGMA_RESTRICT output)

    Transposes a matrix using a small on-cache temporary array. Is usually faster than :c:func:`~gg_naive_transpose`.

    :param n: The number of rows in the input matrix.
    :param m: The number of rows in the output matrix.
    :param input: The ``(n x m)`` input matrix.
    :param output: The ``(m x n)`` output matrix.

Orbital Functions
+++++++++++++++++

Computes orbitals on a grid.


.. 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)

    Computes orbital a section on a grid. This function performs the following
    contraction inplace.

    .. math::

        C_{im} \phi_{m p} \rightarrow ret_{i p}

    This is often more efficient than generating :math:`\phi_{m p}` and then
    contracting with the orbitals C as there is greater cache locality.

    :param L: The angular momentum of the basis function.
    :param C: A ``(norbitals, ncomponents)`` matrix of orbital coefficients.
    :param norbitals: The number of orbs to compute.
    :param npoints: The number of grid points to compute.
    :param xyz: A ``(npoints, 3)`` or (npoints, n) array of the xyz coordinates.
    :param xyz_stride: The stride of the xyz input array. 1 for ``xx..., yy..., zz...`` style input, 3 for ``xyz, xyz, xyz, ...`` style input.
    :param nprim: The number of primitives (exponents and coefficients) in the basis set
    :param coeffs: A ``(nprim, )`` array of coefficients (:math:`c`).
    :param exponents: A ``(nprim, )`` array of exponents (:math:`\alpha`).
    :param center: A ``(3, )`` array of x, y, z coordinate of the basis center.
    :param order: Enum that specifies the output order.
    :param orbital_out: ``(norbitals, npoints)`` array of orbitals on the grid.

Collocation Functions
+++++++++++++++++++++

Creates collocation matrices between a gaussian function and a set of grid points.


.. 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)

    Computes the collocation array:

    .. math::

        \phi_{m p} = Y_\ell^m \sum_i c_i e^{-\alpha_i |\phi_{\rm center} - p| ^2}

    :param L: The angular momentum of the basis function.
    :param npoints: The number of grid points to compute.
    :param xyz: A ``(npoints, 3)`` or (npoints, n) array of the xyz coordinates.
    :param xyz_stride: The stride of the xyz input array. 1 for ``xx..., yy..., zz...`` style input, 3 for ``xyz, xyz, xyz, ...`` style input.
    :param nprim: The number of primitives (exponents and coefficients) in the basis set
    :param coeffs: A ``(nprim, )`` array of coefficients (:math:`c`).
    :param exponents: A ``(nprim, )`` array of exponents (:math:`\alpha`).
    :param center: A ``(3, )`` array of x, y, z coordinate of the basis center.
    :param order: Enum that specifies the output order.
    :param phi_out: ``(ncomponents, npoints)`` collocation array.

.. 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)

    Computes the collocation array and the corresponding first cartesian derivatives:

    .. math::

        \phi_{m p} = Y_\ell^m \sum_i c_i e^{-\alpha_i |\phi_{\rm center} - p| ^2}

    :param L: The angular momentum of the basis function.
    :param npoints: The number of grid points to compute.
    :param xyz: A ``(npoints, 3)`` or (npoints, n) array of the xyz coordinates.
    :param xyz_stride: The stride of the xyz input array. 1 for ``xx..., yy..., zz...`` style input, 3 for ``xyz, xyz, xyz, ...`` style input.
    :param nprim: The number of primitives (exponents and coefficients) in the basis set
    :param coeffs: A ``(nprim, )`` array of coefficients (:math:`c`).
    :param exponents: A ``(nprim, )`` array of exponents (:math:`\alpha`).
    :param center: A ``(3, )`` array of x, y, z coordinate of the basis center.
    :param order: Enum that specifies the output order.
    :param phi_out: ``(ncomponents, npoints)`` collocation array.
    :param phi_x_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``x``.
    :param phi_y_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``y``.
    :param phi_z_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``z``.


.. 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)

    Computes the collocation array and the corresponding first and second cartesian derivatives:

    .. math::

        \phi_{m p} = Y_\ell^m \sum_i c_i e^{-\alpha_i |\phi_{\rm center} - p| ^2}

    :param L: The angular momentum of the basis function.
    :param npoints: The number of grid points to compute.
    :param xyz: A ``(npoints, 3)`` or (npoints, n) array of the xyz coordinates.
    :param xyz_stride: The stride of the xyz input array. 1 for ``xx..., yy..., zz...`` style input, 3 for ``xyz, xyz, xyz, ...`` style input.
    :param nprim: The number of primitives (exponents and coefficients) in the basis set
    :param coeffs: A ``(nprim, )`` array of coefficients (:math:`c`).
    :param exponents: A ``(nprim, )`` array of exponents (:math:`\alpha`).
    :param center: A ``(3, )`` array of x, y, z coordinate of the basis center.
    :param order: Enum that specifies the output order.
    :param phi_out: ``(ncomponents, npoints)`` collocation array.
    :param phi_x_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``x``.
    :param phi_y_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``y``.
    :param phi_z_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``z``.
    :param phi_xx_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``xx``.
    :param phi_xy_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``xy``.
    :param phi_xz_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``xz``.
    :param phi_yy_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``yy``.
    :param phi_yz_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``yz``.
    :param phi_zz_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``zz``.

.. 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)

    Computes the collocation array and the corresponding first, second, and third cartesian derivatives:

    .. math::

        \phi_{m p} = Y_\ell^m \sum_i c_i e^{-\alpha_i |\phi_{\rm center} - p| ^2}

    :param L: The angular momentum of the basis function.
    :param npoints: The number of grid points to compute.
    :param xyz: A ``(npoints, 3)`` or (npoints, n) array of the xyz coordinates.
    :param xyz_stride: The stride of the xyz input array. 1 for ``xx..., yy..., zz...`` style input, 3 for ``xyz, xyz, xyz, ...`` style input.
    :param nprim: The number of primitives (exponents and coefficients) in the basis set
    :param coeffs: A ``(nprim, )`` array of coefficients (:math:`c`).
    :param exponents: A ``(nprim, )`` array of exponents (:math:`\alpha`).
    :param center: A ``(3, )`` array of x, y, z coordinate of the basis center.
    :param order: Enum that specifies the output order.
    :param phi_out: ``(ncomponents, npoints)`` collocation array.
    :param phi_x_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``x``.
    :param phi_y_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``y``.
    :param phi_z_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``z``.
    :param phi_xx_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``xx``.
    :param phi_xy_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``xy``.
    :param phi_xz_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``xz``.
    :param phi_yy_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``yy``.
    :param phi_yz_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``yz``.
    :param phi_zz_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``zz``.
    :param phi_xxx_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``xxx``.
    :param phi_xxy_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``xxy``.
    :param phi_xxz_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``xxz``.
    :param phi_xyy_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``xyy``.
    :param phi_xyz_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``xyz``.
    :param phi_xzz_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``xzz``.
    :param phi_yyy_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``yyy``.
    :param phi_yyz_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``yyz``.
    :param phi_yzz_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``yzz``.
    :param phi_zzz_out: ``(ncomponents, npoints)`` collocation derivative with respect to ``zzz``.