Skip to content

Commit 134d964

Browse files
committed
rebond: allow set distance cutoff for nearest neighbors
1 parent 231b4b6 commit 134d964

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/lib.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,8 +739,10 @@ impl PyMolecule {
739739
Ok(n)
740740
}
741741

742-
#[pyo3(signature = (ignore_pbc=false, bond_tolerance=None, bond_scale_factor=None, bonding_scheme=None))]
743-
#[pyo3(text_signature = "(ignore_pbc=False, bond_tolerance=None, bond_scale_factor=None, bonding_scheme=None)")]
742+
#[pyo3(signature = (ignore_pbc=false, bond_tolerance=None, bond_scale_factor=None, bonding_scheme=None, distance_cutoff=None))]
743+
#[pyo3(
744+
text_signature = "(ignore_pbc=False, bond_tolerance=None, bond_scale_factor=None, bonding_scheme=None, distance_cutoff=None)"
745+
)]
744746
/// Recalculates all bonds in molecule based on interatomic
745747
/// distances and covalent radii. For periodic system, the bonds
746748
/// are determined in miniumu image convention.
@@ -755,17 +757,21 @@ impl PyMolecule {
755757
/// * bond_scale_factor: set the scale factor for covalent or vdw radius
756758
/// for bond perception, only relevant in multiwfn or vmd scheme. The
757759
/// default value is 1.15 for multiwfn and 0.6 for vmd.
760+
/// * distance_cutoff: the nearest neighbor search distance cutoff. The
761+
/// default value is 3.6
758762
pub fn rebond(
759763
&mut self,
760764
ignore_pbc: bool,
761765
bond_tolerance: Option<f64>,
762766
bond_scale_factor: Option<f64>,
763767
bonding_scheme: Option<String>,
768+
distance_cutoff: Option<f64>,
764769
) {
765770
let mut options = Molecule::rebond_options();
766771
options.ignore_pbc = ignore_pbc;
767772
options.bond_tolerance = bond_tolerance;
768773
options.bond_scale_factor = bond_scale_factor;
774+
options.distance_cutoff = distance_cutoff;
769775
if let Some(s) = bonding_scheme {
770776
options.set_bonding_scheme(&s);
771777
}

0 commit comments

Comments
 (0)