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