Skip to main content

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 stream;
24pub mod trajectory;
25pub mod types;
26pub mod units;
27pub mod writer;
28
29/// Foreign path / CON → CON write for stack migration (CLI + library).
30pub mod convert;
31
32#[cfg(feature = "metatensor")]
33pub mod metatensor_export;
34
35/// Chemfiles multi-format import (real impl behind `chemfiles` feature; stubs otherwise).
36pub mod chemfiles_import;
37
38/// Chemfiles selection grammar on CON frames (real impl behind `chemfiles` feature; stubs otherwise).
39pub mod chemfiles_selection;
40
41#[cfg(feature = "rpc")]
42pub mod rpc;
43
44// Re-export for generated capnp code which references crate::ReadCon_capnp
45#[cfg(feature = "rpc")]
46pub use rpc::read_con_capnp as ReadCon_capnp;
47
48#[cfg(feature = "python")]
49pub mod python;
50
51/// CON/convel format spec version implemented by this build.
52///
53/// - Version 1: column 5 present but semantics undefined. Readers MAY
54///   ignore it. No JSON metadata line.
55/// - Version 2: column 5 is the original atom index before type-based
56///   grouping; JSON line 2 with at least `{"con_spec_version": 2}`.
57/// - Version 3: same as v2 plus **required** `units` object on JSON **line 2**
58///   with non-empty `length` and `energy`. Writers emit canonical names
59///   (`angstrom`, `eV`). A velocities section on minor 1 also requires
60///   `units.time`. See `units::canonicalize_unit_expression`.
61///
62/// See `docs/orgmode/spec.org` for the full specification.
63pub const CON_SPEC_VERSION: u32 = 3;
64
65/// Minor implemented by this reader. Newer minors of major 3 are accepted.
66/// An unknown section is skipped only when the frame minor is greater than
67/// this value and `section_arity` gives the value-field count
68/// (CON-section.8, CON-section.12, D14).
69pub const CON_SPEC_MINOR: u32 = 1;
70
71/// Library version string, injected from Cargo.toml at compile time.
72pub const VERSION: &str = env!("CARGO_PKG_VERSION");
73
74#[cfg(test)]
75mod tests {
76    use super::*;
77
78    #[test]
79    fn test_spec_version_is_current() {
80        assert_eq!(CON_SPEC_VERSION, 3);
81        assert_eq!(ffi::RKR_CON_SPEC_VERSION, CON_SPEC_VERSION);
82    }
83
84    #[test]
85    fn test_version_matches_cargo() {
86        assert_eq!(VERSION, "0.17.3");
87    }
88}