File: xtb.h

package info (click to toggle)
xtb 6.7.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,348 kB
  • sloc: f90: 139,236; fortran: 2,948; ansic: 2,215; makefile: 71; sh: 17; csh: 7; tcl: 7
file content (318 lines) | stat: -rw-r--r-- 11,940 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
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
/* This file is part of xtb.
 *
 * Copyright (C) 2019-2020  Sebastian Ehlert
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#pragma once

#define XTB_API_ENTRY
#define XTB_API_CALL
#define XTB_API_SUFFIX__VERSION_1_0_0

/// Define proprocessor to allow to check for specific API features
#define XTB_API_VERSION 10000
#define XTB_VERSION_6_3_0   1
#define XTB_VERSION_6_3_1   1
#define XTB_VERSION_6_3_2   1
#define XTB_VERSION_6_3_3   1

/// Possible print levels for API calls
#define XTB_VERBOSITY_FULL    2
#define XTB_VERBOSITY_MINIMAL 1
#define XTB_VERBOSITY_MUTED   0

/// Convencience macro for deleting a handle
#define xtb_delete(ptr) _Generic((ptr), \
                xtb_TEnvironment: xtb_delEnvironment, \
                   xtb_TMolecule: xtb_delMolecule, \
                 xtb_TCalculator: xtb_delCalculator, \
                    xtb_TResults: xtb_delResults \
                                )(&ptr)

#ifdef __cplusplus
extern "C" {
#else
#include <stdbool.h>
#endif

/*
 * Opaque pointers to Fortran objects
**/

/// Calculation environment class
typedef struct _xtb_TEnvironment* xtb_TEnvironment;

/// Molecular structure data class
typedef struct _xtb_TMolecule* xtb_TMolecule;

/// Single point calculator class
typedef struct _xtb_TCalculator* xtb_TCalculator;

/// Single point results class
typedef struct _xtb_TResults* xtb_TResults;

/*
 * Query for semantic API version
**/

/// Returns API version as 10000 * major + 100 * minor + 1 * patch
extern XTB_API_ENTRY int XTB_API_CALL
xtb_getAPIVersion() XTB_API_SUFFIX__VERSION_1_0_0;

/*
 * Calculation environment
**/

/// Create new xtb calculation environment object
extern XTB_API_ENTRY xtb_TEnvironment XTB_API_CALL
xtb_newEnvironment(void) XTB_API_SUFFIX__VERSION_1_0_0;

/// Delete a xtb calculation environment object
extern XTB_API_ENTRY void XTB_API_CALL
xtb_delEnvironment(xtb_TEnvironment* /* env */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Check current status of calculation environment
extern XTB_API_ENTRY int XTB_API_CALL
xtb_checkEnvironment(xtb_TEnvironment /* env */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Show and empty error stack
extern XTB_API_ENTRY void XTB_API_CALL
xtb_showEnvironment(xtb_TEnvironment /* env */,
                    const char* /* message */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Return and empty error stack
extern XTB_API_ENTRY void XTB_API_CALL
xtb_getError(xtb_TEnvironment /* env */,
             char* /* buffer */,
             const int* /* buffersize */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Bind output from this environment
extern XTB_API_ENTRY void XTB_API_CALL
xtb_setOutput(xtb_TEnvironment /* env */,
              const char* /* filename */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Release output unit from this environment
extern XTB_API_ENTRY void XTB_API_CALL
xtb_releaseOutput(xtb_TEnvironment /* env */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Set verbosity of calculation output
extern XTB_API_ENTRY void XTB_API_CALL
xtb_setVerbosity(xtb_TEnvironment /* env */,
                 int /* verbosity */) XTB_API_SUFFIX__VERSION_1_0_0;

/*
 * Molecular structure data class
**/

/// Create new molecular structure data (quantities in Bohr)
extern XTB_API_ENTRY xtb_TMolecule XTB_API_CALL
xtb_newMolecule(xtb_TEnvironment /* env */,
                const int* /* natoms */,
                const int* /* numbers [natoms] */,
                const double* /* positions [natoms][3] */,
                const double* /* charge in e */,
                const int* /* uhf */,
                const double* /* lattice [3][3] */,
                const bool* /* periodic [3] */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Delete molecular structure data
extern XTB_API_ENTRY void XTB_API_CALL
xtb_delMolecule(xtb_TMolecule* /* mol */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Update coordinates and lattice parameters (quantities in Bohr)
extern XTB_API_ENTRY void XTB_API_CALL
xtb_updateMolecule(xtb_TEnvironment /* env */,
                   xtb_TMolecule /* mol */,
                   const double* /* positions [natoms][3] */,
                   const double* /* lattice [3][3] */) XTB_API_SUFFIX__VERSION_1_0_0;

/*
 * Singlepoint calculator
**/

/// Create new calculator object
extern XTB_API_ENTRY xtb_TCalculator XTB_API_CALL
xtb_newCalculator(void) XTB_API_SUFFIX__VERSION_1_0_0;

/// Delete calculator object
extern XTB_API_ENTRY void XTB_API_CALL
xtb_delCalculator(xtb_TCalculator* /* calc */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Load GFN0-xTB calculator
extern XTB_API_ENTRY void XTB_API_CALL
xtb_loadGFN0xTB(xtb_TEnvironment /* env */,
                xtb_TMolecule /* mol */,
                xtb_TCalculator /* calc */,
                char* /* filename */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Load GFN1-xTB calculator
extern XTB_API_ENTRY void XTB_API_CALL
xtb_loadGFN1xTB(xtb_TEnvironment /* env */,
                xtb_TMolecule /* mol */,
                xtb_TCalculator /* calc */,
                char* /* filename */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Load GFN2-xTB calculator
extern XTB_API_ENTRY void XTB_API_CALL
xtb_loadGFN2xTB(xtb_TEnvironment /* env */,
                xtb_TMolecule /* mol */,
                xtb_TCalculator /* calc */,
                char* /* filename */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Load GFN-FF calculator
extern XTB_API_ENTRY void XTB_API_CALL
xtb_loadGFNFF(xtb_TEnvironment /* env */,
              xtb_TMolecule /* mol */,
              xtb_TCalculator /* calc */,
              char* /* filename */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Add a solvation model to calculator (requires loaded parametrisation)
extern XTB_API_ENTRY void XTB_API_CALL
xtb_setSolvent(xtb_TEnvironment /* env */,
               xtb_TCalculator /* calc */,
               char* /* solvent */,
               int* /* state */,
               double* /* temp */,
               int* /* grid */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Unset the solvation model
extern XTB_API_ENTRY void XTB_API_CALL
xtb_releaseSolvent(xtb_TEnvironment /* env */,
                   xtb_TCalculator /* calc */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Add a external charge potential to calculator (only supported in GFN1/2-xTB)
extern XTB_API_ENTRY void XTB_API_CALL
xtb_setExternalCharges(xtb_TEnvironment /* env */,
                       xtb_TCalculator /* calc */,
                       int* /* n */,
                       int* /* numbers [n] */,
                       double* /* charges [n] */,
                       double* /* positions [n][3] */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Unset the external charge potential
extern XTB_API_ENTRY void XTB_API_CALL
xtb_releaseExternalCharges(xtb_TEnvironment /* env */,
                           xtb_TCalculator /* calc */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Set numerical accuracy of calculator in the range of 1000 to 0.0001
extern XTB_API_ENTRY void XTB_API_CALL
xtb_setAccuracy(xtb_TEnvironment /* env */,
                xtb_TCalculator /* calc */,
                double /* accuracy */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Set maximum number of iterations for self-consistent TB calculators
extern XTB_API_ENTRY void XTB_API_CALL
xtb_setMaxIter(xtb_TEnvironment /* env */,
               xtb_TCalculator /* calc */,
               int /* iterations */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Set electronic temperature for level filling in tight binding calculators in K
extern XTB_API_ENTRY void XTB_API_CALL
xtb_setElectronicTemp(xtb_TEnvironment /* env */,
                      xtb_TCalculator /* calc */,
                      double /* temperature */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Perform singlepoint calculation
extern XTB_API_ENTRY void XTB_API_CALL
xtb_singlepoint(xtb_TEnvironment /* env */,
                xtb_TMolecule /* mol */,
                xtb_TCalculator /* calc */,
                xtb_TResults /* res */) XTB_API_SUFFIX__VERSION_1_0_0;

/*
 * Calculation results
**/

/// Create new singlepoint results object
extern XTB_API_ENTRY xtb_TResults XTB_API_CALL
xtb_newResults(void) XTB_API_SUFFIX__VERSION_1_0_0;

/// Delete singlepoint results object
extern XTB_API_ENTRY void XTB_API_CALL
xtb_delResults(xtb_TResults* /* res */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Create copy from a singlepoint results object
extern XTB_API_ENTRY xtb_TResults XTB_API_CALL
xtb_copyResults(xtb_TResults /* res */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Query singlepoint results object for energy in Hartree
extern XTB_API_ENTRY void XTB_API_CALL
xtb_getEnergy(xtb_TEnvironment /* env */,
              xtb_TResults /* res */,
              double* /* energy */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Query singlepoint results object for gradient in Hartree / Bohr
extern XTB_API_ENTRY void XTB_API_CALL
xtb_getGradient(xtb_TEnvironment /* env */,
                xtb_TResults /* res */,
                double* /* gradient [natoms][3] */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Query singlepoint results object for pc gradient in Hartree / Bohr
extern XTB_API_ENTRY void XTB_API_CALL
xtb_getPCGradient(xtb_TEnvironment /* env */,
                  xtb_TResults /* res */,
                  double* /* gradient [natoms][3] */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Query singlepoint results object for virial in Hartree
extern XTB_API_ENTRY void XTB_API_CALL
xtb_getVirial(xtb_TEnvironment /* env */,
              xtb_TResults /* res */,
              double* /* virial [3][3] */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Query singlepoint results object for dipole in e Bohr
extern XTB_API_ENTRY void XTB_API_CALL
xtb_getDipole(xtb_TEnvironment /* env */,
              xtb_TResults /* res */,
              double* /* dipole [3] */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Query singlepoint results object for partial charges in e
extern XTB_API_ENTRY void XTB_API_CALL
xtb_getCharges(xtb_TEnvironment /* env */,
               xtb_TResults /* res */,
               double* /* charges [natoms] */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Query singlepoint results object for bond orders
extern XTB_API_ENTRY void XTB_API_CALL
xtb_getBondOrders(xtb_TEnvironment /* env */,
                  xtb_TResults /* res */,
                  double* /* wbo [natoms][natoms] */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Query singlepoint results object for the number of basis functions
extern XTB_API_ENTRY void XTB_API_CALL
xtb_getNao(xtb_TEnvironment /* env */,
           xtb_TResults /* res */,
           int* /* nao */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Query singlepoint results object for orbital energies in Hartree [nao]
extern XTB_API_ENTRY void XTB_API_CALL
xtb_getOrbitalEigenvalues(xtb_TEnvironment /* env */,
                          xtb_TResults /* res */,
                          double* /* emo */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Query singlepoint results object for occupation numbers [nao]
extern XTB_API_ENTRY void XTB_API_CALL
xtb_getOrbitalOccupations(xtb_TEnvironment /* env */,
                          xtb_TResults /* res */,
                          double* /* focc */) XTB_API_SUFFIX__VERSION_1_0_0;

/// Query singlepoint results object for orbital coefficients [nao][nao]
extern XTB_API_ENTRY void XTB_API_CALL
xtb_getOrbitalCoefficients(xtb_TEnvironment /* env */,
                           xtb_TResults /* res */,
                           double* /* c */) XTB_API_SUFFIX__VERSION_1_0_0;

#ifdef __cplusplus
}
#endif