Skip to content

Commit d7a3e1b

Browse files
authored
Update inputs.py (#142)
1 parent 2b66f46 commit d7a3e1b

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

alphafold3_pytorch/inputs.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
from pdbeccdutils.core import ccd_reader
3030

31-
from rdkit import Chem, RDLogger
31+
from rdkit import Chem, rdBase
3232
from rdkit.Chem import AllChem, rdDetermineBonds
3333
from rdkit.Chem.rdchem import Atom, Mol
3434
from rdkit.Geometry import Point3D
@@ -66,10 +66,6 @@
6666
from alphafold3_pytorch.utils.model_utils import exclusive_cumsum
6767
from alphafold3_pytorch.utils.utils import default, exists, first, identity
6868

69-
# silence RDKit's warnings
70-
71-
RDLogger.DisableLog("rdApp.*")
72-
7369
# constants
7470

7571
IS_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

Comments
 (0)