Skip to content

Commit 231b4b6

Browse files
committed
rebond: support vmd scheme with param bond_scale_factor
1 parent 78a4dd7 commit 231b4b6

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

src/lib.rs

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

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)")]
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)")]
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.
@@ -749,27 +749,23 @@ impl PyMolecule {
749749
/// * ignore_pbc: force to ignore periodicity when search nearest
750750
/// neighbors. The default is False.
751751
/// * bonding_scheme: the bonding scheme for rebond. Avaialbe scheme
752-
/// includes jmol and multiwfn.
752+
/// includes jmol, multiwfn and vmd.
753753
/// * bond_tolerance: the bonding tolerance used in jmol scheme. The
754754
/// 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.
755+
/// * bond_scale_factor: set the scale factor for covalent or vdw radius
756+
/// for bond perception, only relevant in multiwfn or vmd scheme. The
757+
/// default value is 1.15 for multiwfn and 0.6 for vmd.
758758
pub fn rebond(
759759
&mut self,
760760
ignore_pbc: bool,
761761
bond_tolerance: Option<f64>,
762-
cov_radius_scale_factor: Option<f64>,
762+
bond_scale_factor: Option<f64>,
763763
bonding_scheme: Option<String>,
764764
) {
765765
let mut options = Molecule::rebond_options();
766766
options.ignore_pbc = ignore_pbc;
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-
}
767+
options.bond_tolerance = bond_tolerance;
768+
options.bond_scale_factor = bond_scale_factor;
773769
if let Some(s) = bonding_scheme {
774770
options.set_bonding_scheme(&s);
775771
}

0 commit comments

Comments
 (0)