@@ -739,15 +739,24 @@ impl PyMolecule {
739
739
Ok ( n)
740
740
}
741
741
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 )" ) ]
744
744
/// Recalculates all bonds in molecule based on interatomic
745
745
/// 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) ;
751
760
}
752
761
753
762
/// Removes all existing bonds between atoms.
0 commit comments