Skip to content

Commit 03485f4

Browse files
committed
rebond in multiwfn scheme based covalent radii sum
1 parent 9a06a38 commit 03485f4

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# [[file:spdkit-python.note::e345323a][e345323a]]
22
[package]
33
name = "spdkit-python"
4-
version = "0.1.15"
4+
version = "0.1.16"
55
edition = "2021"
66
authors = ["Wenping Guo <[email protected]>"]
77
description = "structure prediction kit for python"

src/lib.rs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -739,15 +739,24 @@ impl PyMolecule {
739739
Ok(n)
740740
}
741741

742-
#[pyo3(signature = (ignore_pbc=false, bond_tolerance=0.45))]
743-
#[pyo3(text_signature = "(ignore_pbc=False, bond_tolerance=0.45)")]
742+
#[pyo3(signature = (ignore_pbc=false, bond_tolerance=0.45, bonding_scheme=None))]
743+
#[pyo3(text_signature = "(ignore_pbc=False, bond_tolerance=0.45, bonding_scheme=None)")]
744744
/// Recalculates all bonds in molecule based on interatomic
745745
/// distances and covalent radii. For periodic system, the bonds
746-
/// are determined by applying miniumu image convention.
747-
pub fn rebond(&mut self, ignore_pbc: bool, bond_tolerance: f64) {
748-
std::env::set_var("GCHEMOL_REBOND_IGNORE_PBC", format!("{ignore_pbc}"));
749-
std::env::set_var("GCHEMOL_REBOND_BOND_TOLERANCE", format!("{bond_tolerance}"));
750-
self.inner.rebond();
746+
/// are determined in miniumu image convention.
747+
///
748+
/// # Parameters
749+
/// * ignore_pbc: force to ignore periodicity when search nearest neighbors. The default is False.
750+
/// * bonding_scheme: the bonding scheme for rebond. Avaialbe scheme includes jmol and multiwfn.
751+
/// * bond_tolerance: the bonding tolerance used in jmol scheme.
752+
pub fn rebond(&mut self, ignore_pbc: bool, bond_tolerance: f64, bonding_scheme: Option<String>) {
753+
let mut options = Molecule::rebond_options();
754+
options.ignore_pbc = ignore_pbc;
755+
options.bond_tolerance = bond_tolerance;
756+
if let Some(s) = bonding_scheme {
757+
options.set_bonding_scheme(&s);
758+
}
759+
self.inner.rebond_with_options(&options);
751760
}
752761

753762
/// Removes all existing bonds between atoms.

0 commit comments

Comments
 (0)