2828
2929from pdbeccdutils .core import ccd_reader
3030
31- from rdkit import Chem , RDLogger
31+ from rdkit import Chem , rdBase
3232from rdkit .Chem import AllChem , rdDetermineBonds
3333from rdkit .Chem .rdchem import Atom , Mol
3434from rdkit .Geometry import Point3D
6666from alphafold3_pytorch .utils .model_utils import exclusive_cumsum
6767from alphafold3_pytorch .utils .utils import default , exists , first , identity
6868
69- # silence RDKit's warnings
70-
71- RDLogger .DisableLog ("rdApp.*" )
72-
7369# constants
7470
7571IS_MOLECULE_TYPES = 5
@@ -1793,9 +1789,15 @@ def create_mol_from_atom_positions_and_types(
17931789 for i , (x , y , z ) in enumerate (atom_positions ):
17941790 conf .SetAtomPosition (i , Point3D (x , y , z ))
17951791
1792+ # add the conformer to the molecule
1793+
17961794 mol .AddConformer (conf )
17971795 Chem .SanitizeMol (mol )
17981796
1797+ # block the RDKit logger
1798+
1799+ blocker = rdBase .BlockLogs ()
1800+
17991801 # finalize molecule by inferring bonds
18001802
18011803 determined_bonds = False
@@ -1817,6 +1819,10 @@ def create_mol_from_atom_positions_and_types(
18171819 "Failed to determine bonds in the input molecule. Skipping bond assignment."
18181820 )
18191821
1822+ # unblock the RDKit logger
1823+
1824+ del blocker
1825+
18201826 mol = Chem .RemoveHs (mol )
18211827 Chem .SanitizeMol (mol )
18221828
0 commit comments