Skip to content

Commit 78a4dd7

Browse files
committed
rebond: add parameter cov_radius_scale_factor
1 parent fa89f97 commit 78a4dd7

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

src/lib.rs

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

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)")]
742+
#[pyo3(signature = (ignore_pbc=false, bond_tolerance=None, cov_radius_scale_factor=None, bonding_scheme=None))]
743+
#[pyo3(text_signature = "(ignore_pbc=False, bond_tolerance=None, radius_scale_factor=None, bonding_scheme=None)")]
744744
/// Recalculates all bonds in molecule based on interatomic
745745
/// distances and covalent radii. For periodic system, the bonds
746746
/// are determined in miniumu image convention.
747747
///
748748
/// # 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>) {
749+
/// * ignore_pbc: force to ignore periodicity when search nearest
750+
/// neighbors. The default is False.
751+
/// * bonding_scheme: the bonding scheme for rebond. Avaialbe scheme
752+
/// includes jmol and multiwfn.
753+
/// * bond_tolerance: the bonding tolerance used in jmol scheme. The
754+
/// default value is 0.45.
755+
/// * cov_radius_scale_factor: set the scale factor for covalent
756+
/// radius for perception of bond in multiwfn scheme. The
757+
/// default value is 1.15.
758+
pub fn rebond(
759+
&mut self,
760+
ignore_pbc: bool,
761+
bond_tolerance: Option<f64>,
762+
cov_radius_scale_factor: Option<f64>,
763+
bonding_scheme: Option<String>,
764+
) {
753765
let mut options = Molecule::rebond_options();
754766
options.ignore_pbc = ignore_pbc;
755-
options.bond_tolerance = bond_tolerance;
767+
if let Some(v) = bond_tolerance {
768+
options.bond_tolerance = v;
769+
}
770+
if let Some(v) = cov_radius_scale_factor {
771+
options.cov_radius_scale_factor = v;
772+
}
756773
if let Some(s) = bonding_scheme {
757774
options.set_bonding_scheme(&s);
758775
}

0 commit comments

Comments
 (0)