Source code for schrodinger.test.stu.outcomes.confgen_workups
from schrodinger.infra import structure as infrastructure
from schrodinger.structure import StructureReader
[docs]def check_atom_clashes(filename, threshold=0.75):
    """
    Checks the input file for steric clashes.
    Tolerance for maximum overlap is from maestro's default for ugly clashes: 0.75
    """
    with StructureReader(filename) as reader:
        for st in reader:
            params = infrastructure.ContactParams()
            params.setCutoff(threshold)
            atoms = infrastructure.all_atom_bitset(st)
            contacts = infrastructure.get_contacts(st, atoms, params)
            pairs = [(c.getAtom1().getIndex(), c.getAtom2().getIndex(),
                      c.getValue()) for c in contacts]
        if contacts:
            raise AssertionError(f"{len(pairs)} atom pairs overlap.")