Skip to content

Commit

Permalink
reduce the absolute tolerance for flatness checks of molecules
Browse files Browse the repository at this point in the history
  • Loading branch information
stefdoerr committed Dec 16, 2024
1 parent bf569d2 commit 1ba97b7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions moleculekit/tools/moleculechecks.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def isProteinProtonated(mol):
return True


def isLigandOptimized(mol):
def isLigandOptimized(mol, atol=1e-06):
"""Checks if a ligand is optimized. If all dihedral angles are 0 it means it's flat."""
from moleculekit.util import guessAnglesAndDihedrals

Expand All @@ -48,8 +48,8 @@ def isLigandOptimized(mol):

_, dihedrals = guessAnglesAndDihedrals(mol.bonds)
for dih in dihedrals:
angle = mol.getDihedral(dih)
if not (abs(angle) < 1e-08 or abs(abs(angle) - pi) < 1e-08):
radians = mol.getDihedral(dih)
if not (abs(radians) < atol or abs(abs(radians) - pi) < atol):
return True
return False

Expand Down

0 comments on commit 1ba97b7

Please sign in to comment.