Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ categories = ["science::computational-chemistry::electronic-structure", "command
[[bin]]
name = "rustiq"
path = "src/main.rs"
doc = false

[features]
default = ["online", "manpages", "completions"]
Expand Down
2 changes: 1 addition & 1 deletion THIRD-PARTY-NOTICES.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fd10896a1c4a5a5be0dfdcabb49197b9fb5dc80a93d9e0e8a917ff746ca3169e THIRD-PARTY-NOTICES.txt
2fbcaed6277c0ee1532734dbf6474fea1965985e94c34c8fe07ab9ea0dbaf992 THIRD-PARTY-NOTICES.txt
2 changes: 1 addition & 1 deletion THIRD-PARTY-NOTICES.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/rustiq-core/src/hf/density_guess/one_electron.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl<R: HfReference> DensityGuess<R> for OneElectron {
h_core: &DMatrix<f64>,
_basis: &Basis,
) -> Result<OrbitalGuess<R>, Self::Error> {
crate::debug_assert_is_symmetric!(h_core, 1e-8);
crate::math_utils::debug_assert_is_symmetric!(h_core, 1e-8);
match self.perturbation {
Some(perturbation) => {
perturb_fock_like_matrices(h_core, perturbation).map_err(Into::into)
Expand Down Expand Up @@ -101,7 +101,7 @@ mod tests {
let density = scf.density_matrix;

// Check that the density is symmetric
crate::debug_assert_is_symmetric!(&density, 1e-8);
crate::math_utils::debug_assert_is_symmetric!(&density, 1e-8);

// AO densities are normalized in the overlap metric, not the Euclidean trace.
let trace = (&density * basis.overlap_ints()).trace();
Expand Down
2 changes: 1 addition & 1 deletion crates/rustiq-core/src/hf/scf_setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ fn prepare_scf_setup_with_thresholds(
let step_start = Instant::now();
let overlap = builder.overlap();
timings.overlap = step_start.elapsed();
crate::debug_assert_is_symmetric!(&overlap, 1e-8);
crate::math_utils::debug_assert_is_symmetric!(&overlap, 1e-8);

progress(ScfSetupStep::OverlapOrthogonalizer);
let step_start = Instant::now();
Expand Down
11 changes: 6 additions & 5 deletions crates/rustiq-core/src/math_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ pub fn hermite(n: u64, PA: u32, QA: u32, p: f64, q: f64, f0: f64) -> f64 {
f0 * hermite_classic(n, x)
}

#[macro_export]
#[cfg(debug_assertions)]
macro_rules! debug_assert_is_symmetric {
($matrix:expr, $tol:expr) => {{
Expand Down Expand Up @@ -98,12 +97,13 @@ macro_rules! debug_assert_is_symmetric {
}};
}

#[macro_export]
#[cfg(not(debug_assertions))]
macro_rules! debug_assert_is_symmetric {
($matrix:expr, $tol:expr) => {{}};
}

pub(crate) use debug_assert_is_symmetric;

#[cfg(test)]
pub(crate) fn is_positive_definite(matrix: &DMatrix<f64>) -> bool {
matrix
Expand Down Expand Up @@ -162,11 +162,12 @@ mod tests {
#[cfg(debug_assertions)]
{
let mat = DMatrix::from_row_slice(2, 2, &[1.0, 2.0, 2.0, 1.0]);
crate::debug_assert_is_symmetric!(&mat, 1e-12); // Should not fail
crate::math_utils::debug_assert_is_symmetric!(&mat, 1e-12); // Should not fail

let mat_non_sym = DMatrix::from_row_slice(2, 2, &[1.0, 3.0, 2.0, 1.0]); // Corrected to make it non-symmetric
let result =
std::panic::catch_unwind(|| crate::debug_assert_is_symmetric!(&mat_non_sym, 1e-12));
let result = std::panic::catch_unwind(|| {
crate::math_utils::debug_assert_is_symmetric!(&mat_non_sym, 1e-12);
});
assert!(result.is_err(), "The matrix should not be symmetric");
}
}
Expand Down
Loading