seams-core v2.14.0
libyodaLib, the C++ engine of d-SEAMS
Loading...
Searching...
No Matches
seams_c_api.h
Go to the documentation of this file.
1#ifndef SEAMS_C_API_H_
2#define SEAMS_C_API_H_
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8/* C ABI for native callers and for an emscripten/WASM build.
9 * xyz is n*3, box is ox,oy,oz,lx,ly,lz (ortho). labels[i] is
10 * 0 cubic, 1 hexagonal, 2 water, 3 interfacial, 4 clathrate,
11 * 5 interClathrate, 6 unclassified, 7 reCubic, 8 reHex.
12 * Returns 0 on success.
13 * seams_chill_plus bonds every pair closer than 3.5 A (the cutoff list).
14 * seams_chill_plus_graph takes the cutoff and graph: "cutoff" (also NULL
15 * or "") or "mutual", the mutual four nearest inside cutoff + 1.5. */
16int seams_chill_plus_flat(const double *xyz, int n, const double *box, int *labels);
17int seams_chill_plus_graph(const double *xyz, int n, const double *box,
18 double cutoff, const char *graph, int *labels);
19/* rule is "chill+" (NULL or "") or "ovito-chill+". A YAML or Lua
20 * document with a rule field is accepted. Returns 1 on a bad rule. */
21int seams_chill_plus_rule(const double *xyz, int n, const double *box,
22 double cutoff, const char *graph, const char *rule,
23 int *labels);
24
25/* box9 is xlo, ylo, zlo, lx, ly, lz, xy, xz, yz. lx, ly, lz are the
26 * edge lengths xhi-xlo, not the bound spans, and xlo, ylo, zlo are the
27 * edge origin. A zero tilt matches seams_chill_plus_graph. */
28int seams_chill_plus_graph_lammps(const double *xyz, int n,
29 const double *box9, double cutoff,
30 const char *graph, int *labels);
31
32/* Local symmetry. points is n*3. Template ids:
33 * 0 ice-Ih, 1 ice-Ic, 2 ice-Isd, 3 5^12, 4 5^12 6^2, 5 5^12 6^4,
34 * 6 ring-5, 7 ring-6.
35 * permutation[i] is the environment index matched to template atom i.
36 * rotation9 is row-major and, with translation3, takes that environment
37 * atom onto the template. Returns 0 on success. */
38int seams_symmetry_match(const double *points, int n, int *template_id,
39 double *rmsd, double *hausdorff, double *rotation9,
40 double *translation3, int *permutation);
41/* Returns 2 when SOFI is not linked. */
42int seams_symmetry_point_group(const double *points, int n, double sym_thr,
43 char *symbol, int symbol_len, int *n_operations);
44/* lattice9 is three row vectors (ax,ay,az, bx,by,bz, cx,cy,cz).
45 * Returns 2 when spglib is not linked. */
46int seams_symmetry_space_group(const double *lattice9, const double *cartesian,
47 int n, double symprec, int *number, char *symbol,
48 int symbol_len);
49/* Writes the ideal template. points may be null to query *n_out. */
50int seams_symmetry_template(int id, double *points, int cap, int *n_out);
51/* which: 0 ice Ih, 1 ice Ic, 2 stacking-fault cell. */
52int seams_symmetry_crystal(int which, double *lattice9, double *xyz, int cap,
53 int *n_out);
54int seams_symmetry_backend(char *name, int name_len);
55/* Per-atom ice label. lattice9 is three row vectors. labels[i] is
56 * 0 ice-Ih, 1 ice-Ic, 2 ice-Isd, or -1. The second-shell RMSD ceiling
57 * is the scale-free ceiling kShellRmsd (0.12). */
58int seams_symmetry_classify(const double *xyz, int n, const double *lattice9,
59 int *labels);
60/* Same labels with an explicit scale-free residual ceiling. */
61int seams_symmetry_classify_tol(const double *xyz, int n, const double *lattice9,
62 double shell_rmsd, int *labels);
63/* thermal_q is the tetrahedral-order prefilter and bond_ratio is the
64 * longest/shortest of the four nearest bonds. The shipped gates are
65 * 0.85 and 1.20. The previous gates were 0.94 and 1.15 with shell_rmsd 0.12. */
66int seams_symmetry_classify_gates(const double *xyz, int n, const double *lattice9,
67 double shell_rmsd, double thermal_q, double bond_ratio,
68 int *labels);
69
70/* Mixed frames. types and mols may be NULL (every atom is then one
71 * species, mol id = index + 1). oxygen_type > 0 keeps that LAMMPS type.
72 * mol_mode 0 ignores molecules, 1 keeps the water oxygen of each
73 * multi-atom molecule, 2 keeps mol_ids[0..n_mol_ids). A mixed frame
74 * with mol_mode 0 and oxygen_type 0 is an error. Labels of atoms that
75 * are not water oxygens are unclassified (6). ion_ice, ion_liquid and
76 * ion_front may be NULL. ion_front is the nearest ice oxygen, or -1.
77 * seams_c_error() is the message after a non-zero return.
78 * On a single-species cloud the labels match seams_chill_plus_graph_lammps. */
79int seams_chill_plus_species(const double *xyz, int n, const double *box9,
80 const int *types, const int *mols,
81 int oxygen_type, int mol_mode, const int *mol_ids,
82 int n_mol_ids, double cutoff, const char *graph,
83 int *labels, int *ion_ice, int *ion_liquid,
84 double *ion_front);
85
86/* degree[i] is the oxygen-oxygen neighbour count inside cutoff, or -1
87 * when atom i is not a selected water oxygen. */
88int seams_oxygen_cutoff_degree(const double *xyz, int n, const double *box9,
89 const int *types, const int *mols,
90 int oxygen_type, int mol_mode,
91 const int *mol_ids, int n_mol_ids, double cutoff,
92 int *degree);
93
94const char *seams_c_error(void);
95
96/* Local q4 and q6 on the cutoff shell. Degrees 4 and 6 use the
97 * solid-harmonic kernel. xyz is n*3. box is ox,oy,oz,lx,ly,lz.
98 * q4 and q6 are n doubles. q4bar and q6bar may be null; a null pointer
99 * skips that Lechner-Dellago average. Returns 0 on success. */
100int seams_q4_q6(const double *xyz, int n, const double *box, double cutoff,
101 double *q4, double *q6, double *q4bar, double *q6bar);
102/* box9 is xlo,ylo,zlo,lx,ly,lz,xy,xz,yz, the same cell as
103 * seams_chill_plus_graph_lammps. */
104int seams_q4_q6_lammps(const double *xyz, int n, const double *box9,
105 double cutoff, double *q4, double *q6, double *q4bar,
106 double *q6bar);
107
108/* box9 is xlo, ylo, zlo, lx, ly, lz, xy, xz, yz, the same edges as
109 * seams_chill_plus_graph_lammps. The cutoff list is orthoFullCsr: cloud
110 * indices, no self entry, both directions, squared distance strictly
111 * below cutoff squared.
112 * offsets has n + 1 entries. When cols is null, *n_cols receives the
113 * pair count and the call returns 0. When cols_cap is short, *n_cols is
114 * that count and the call returns 2. */
115int seams_cutoff_csr(const double *xyz, int n, const double *box9, double cutoff,
116 int *offsets, int *cols, int cols_cap, int *n_cols);
117/* Local Steinhardt q_l on that cutoff list. order_l is 3, 4, 6, 8, or 12. */
118int seams_ql_cutoff(const double *xyz, int n, const double *box9, double cutoff,
119 int order_l, double *ql);
120/* Wall seconds of the last successful seams_cutoff_csr or seams_ql_cutoff
121 * call on the calling thread. seconds[0] builds the point cloud from xyz,
122 * [1] the cutoff list, [2] q_l, [3] copies into the caller's arrays.
123 * seams_cutoff_csr has no q_l stage. For order 8 or 12, seams_ql_cutoff
124 * counts the list inside [2] and leaves [1] at 0. */
125void seams_c_last_stages(double seconds[4]);
126/* Diamond common-neighbour labels. 1 cubic, 0 hexagonal, -1 otherwise. */
127int seams_diamond_cna(const double *xyz, int n, const double *box9, double cutoff,
128 int *labels);
129/* counts[k] is the number of primitive rings of size k.
130 * counts_len must be at least max_depth + 1. max_depth is at least 3. */
131int seams_primitive_rings(const double *xyz, int n, const double *box9,
132 double cutoff, int max_depth, int *counts, int counts_len);
133
134#ifdef __cplusplus
135}
136#endif
137
138#endif
int seams_cutoff_csr(const double *xyz, int n, const double *box9, double cutoff, int *offsets, int *cols, int cols_cap, int *n_cols)
int seams_q4_q6(const double *xyz, int n, const double *box, double cutoff, double *q4, double *q6, double *q4bar, double *q6bar)
int seams_chill_plus_rule(const double *xyz, int n, const double *box, double cutoff, const char *graph, const char *rule, int *labels)
int seams_symmetry_backend(char *name, int name_len)
int seams_symmetry_classify_tol(const double *xyz, int n, const double *lattice9, double shell_rmsd, int *labels)
int seams_chill_plus_species(const double *xyz, int n, const double *box9, const int *types, const int *mols, int oxygen_type, int mol_mode, const int *mol_ids, int n_mol_ids, double cutoff, const char *graph, int *labels, int *ion_ice, int *ion_liquid, double *ion_front)
int seams_symmetry_space_group(const double *lattice9, const double *cartesian, int n, double symprec, int *number, char *symbol, int symbol_len)
int seams_chill_plus_graph(const double *xyz, int n, const double *box, double cutoff, const char *graph, int *labels)
int seams_chill_plus_flat(const double *xyz, int n, const double *box, int *labels)
int seams_ql_cutoff(const double *xyz, int n, const double *box9, double cutoff, int order_l, double *ql)
int seams_symmetry_match(const double *points, int n, int *template_id, double *rmsd, double *hausdorff, double *rotation9, double *translation3, int *permutation)
int seams_primitive_rings(const double *xyz, int n, const double *box9, double cutoff, int max_depth, int *counts, int counts_len)
int seams_chill_plus_graph_lammps(const double *xyz, int n, const double *box9, double cutoff, const char *graph, int *labels)
int seams_oxygen_cutoff_degree(const double *xyz, int n, const double *box9, const int *types, const int *mols, int oxygen_type, int mol_mode, const int *mol_ids, int n_mol_ids, double cutoff, int *degree)
int seams_q4_q6_lammps(const double *xyz, int n, const double *box9, double cutoff, double *q4, double *q6, double *q4bar, double *q6bar)
int seams_symmetry_point_group(const double *points, int n, double sym_thr, char *symbol, int symbol_len, int *n_operations)
void seams_c_last_stages(double seconds[4])
const char * seams_c_error(void)
int seams_symmetry_classify_gates(const double *xyz, int n, const double *lattice9, double shell_rmsd, double thermal_q, double bond_ratio, int *labels)
int seams_diamond_cna(const double *xyz, int n, const double *box9, double cutoff, int *labels)
int seams_symmetry_classify(const double *xyz, int n, const double *lattice9, int *labels)
int seams_symmetry_crystal(int which, double *lattice9, double *xyz, int cap, int *n_out)
int seams_symmetry_template(int id, double *points, int cap, int *n_out)