readcon_core/lib.rs
1pub mod array;
2pub mod compression;
3#[cfg(feature = "cuda")]
4pub mod cuda_array;
5pub mod error;
6pub mod ffi;
7#[cfg(feature = "grammar")]
8pub mod grammar;
9pub mod helpers;
10/// Campaign screening scalars / CON ingest contracts for corpus stores (`readcon-db`).
11pub mod index_proj;
12pub mod iterators;
13pub mod parser;
14/// RCSO/RCSB cooked numerics for a caller-side broadcast. No MPI in this crate.
15pub mod rcso;
16pub mod storage_dtype;
17pub mod types;
18pub mod units;
19pub mod writer;
20
21/// Foreign path / CON → CON write for stack migration (CLI + library).
22pub mod convert;
23
24#[cfg(feature = "metatensor")]
25pub mod metatensor_export;
26
27/// Chemfiles multi-format import (real impl behind `chemfiles` feature; stubs otherwise).
28pub mod chemfiles_import;
29
30/// Chemfiles selection grammar on CON frames (real impl behind `chemfiles` feature; stubs otherwise).
31pub mod chemfiles_selection;
32
33#[cfg(feature = "rpc")]
34pub mod rpc;
35
36// Re-export for generated capnp code which references crate::ReadCon_capnp
37#[cfg(feature = "rpc")]
38pub use rpc::read_con_capnp as ReadCon_capnp;
39
40#[cfg(feature = "python")]
41pub mod python;
42
43/// CON/convel format spec version implemented by this build.
44///
45/// - Version 1: column 5 present but semantics undefined. Readers MAY
46/// ignore it. No JSON metadata line.
47/// - Version 2: column 5 is the original atom index before type-based
48/// grouping; JSON line 2 with at least `{"con_spec_version": 2}`.
49/// - Version 3: same as v2 plus **required** `units` object on JSON **line 2**
50/// with non-empty `length` and `energy`. Writers emit canonical names
51/// (`angstrom`, `eV`). A velocities section on minor 1 also requires
52/// `units.time`. See `units::canonicalize_unit_expression`.
53///
54/// See `docs/orgmode/spec.org` for the full specification.
55pub const CON_SPEC_VERSION: u32 = 3;
56
57/// Minor implemented by this reader. Newer minors of major 3 are accepted.
58/// An unknown section is skipped only when the frame minor is greater than
59/// this value and `section_arity` gives the value-field count
60/// (CON-section.8, CON-section.12, D14).
61pub const CON_SPEC_MINOR: u32 = 1;
62
63/// Library version string, injected from Cargo.toml at compile time.
64pub const VERSION: &str = env!("CARGO_PKG_VERSION");
65
66#[cfg(test)]
67mod tests {
68 use super::*;
69
70 #[test]
71 fn test_spec_version_is_current() {
72 assert_eq!(CON_SPEC_VERSION, 3);
73 assert_eq!(ffi::RKR_CON_SPEC_VERSION, CON_SPEC_VERSION);
74 }
75
76 #[test]
77 fn test_version_matches_cargo() {
78 assert_eq!(VERSION, "0.17.0");
79 }
80}