コード例 #1
0
def evaluationPoints(object, n, smallest = 0.3, largest = 0.5):
    """Returns a list of |n| points suitable for the evaluation of
    the electrostatic potential around |object|. The points are chosen
    at random and uniformly in a shell around the object such that
    no point has a distance larger than |largest| from any atom or
    smaller than |smallest| from any non-hydrogen atom.
    """
    atoms = object.atomList()
    p1, p2 = object.boundingBox()
    margin = Vector(largest, largest, largest)
    p1 = p1 - margin
    p2 = p2 + margin
    a, b, c = tuple(p2-p1)
    offset = 0.5*Vector(a, b, c)
    points = []
    while len(points) < n:
        p = p1 + Random.randomPointInBox(a, b, c) + offset
        m = 2*largest
        ok = 1
        for atom in atoms:
            d = (p-atom.position()).length()
            m = min(m, d)
            if d < smallest and atom.symbol != 'H':
                ok = 0
            if not ok: break
        if ok and m <= largest:
            points.append(p)
    return points
コード例 #2
0
def evaluationPoints(object, n, smallest=0.3, largest=0.5):
    """Returns a list of |n| points suitable for the evaluation of
    the electrostatic potential around |object|. The points are chosen
    at random and uniformly in a shell around the object such that
    no point has a distance larger than |largest| from any atom or
    smaller than |smallest| from any non-hydrogen atom.
    """
    atoms = object.atomList()
    p1, p2 = object.boundingBox()
    margin = Vector(largest, largest, largest)
    p1 = p1 - margin
    p2 = p2 + margin
    a, b, c = tuple(p2 - p1)
    offset = 0.5 * Vector(a, b, c)
    points = []
    while len(points) < n:
        p = p1 + Random.randomPointInBox(a, b, c) + offset
        m = 2 * largest
        ok = 1
        for atom in atoms:
            d = (p - atom.position()).length()
            m = min(m, d)
            if d < smallest and atom.symbol != 'H':
                ok = 0
            if not ok: break
        if ok and m <= largest:
            points.append(p)
    return points
コード例 #3
0
ファイル: ChargeFit.py プロジェクト: acousticpants/mmtk
def evaluationPoints(system, n, smallest = 0.3, largest = 0.5):
    """
    Generate points in space around a molecule that are suitable
    for potential evaluation in view of a subsequent charge fit.
    The points are chosen at random and uniformly in a shell around the system.

    :param system: the chemical object for which the charges
                   will be fitted
    :param n: the number of evaluation points to be generated
    :param smallest: the smallest allowed distance of any evaluation
                     point from any non-hydrogen atom
    :param largest: the largest allowed value for the distance
                    from an evaluation point to the nearest atom
    :returns: a list of evaluation points
    :rtype: list of Scientific.Geometry.Vector
    """
    atoms = system.atomList()
    p1, p2 = system.boundingBox()
    margin = Vector(largest, largest, largest)
    p1 -= margin
    p2 += margin
    a, b, c = tuple(p2-p1)
    offset = 0.5*Vector(a, b, c)
    points = []
    while len(points) < n:
        p = p1 + Random.randomPointInBox(a, b, c) + offset
        m = 2*largest
        ok = 1
        for atom in atoms:
            d = (p-atom.position()).length()
            m = min(m, d)
            if d < smallest and atom.symbol != 'H':
                ok = 0
            if not ok: break
        if ok and m <= largest:
            points.append(p)
    return points
コード例 #4
0
def evaluationPoints(system, n, smallest=0.3, largest=0.5):
    """
    Generate points in space around a molecule that are suitable
    for potential evaluation in view of a subsequent charge fit.
    The points are chosen at random and uniformly in a shell around the system.

    :param system: the chemical object for which the charges
                   will be fitted
    :param n: the number of evaluation points to be generated
    :param smallest: the smallest allowed distance of any evaluation
                     point from any non-hydrogen atom
    :param largest: the largest allowed value for the distance
                    from an evaluation point to the nearest atom
    :returns: a list of evaluation points
    :rtype: list of Scientific.Geometry.Vector
    """
    atoms = system.atomList()
    p1, p2 = system.boundingBox()
    margin = Vector(largest, largest, largest)
    p1 -= margin
    p2 += margin
    a, b, c = tuple(p2 - p1)
    offset = 0.5 * Vector(a, b, c)
    points = []
    while len(points) < n:
        p = p1 + Random.randomPointInBox(a, b, c) + offset
        m = 2 * largest
        ok = 1
        for atom in atoms:
            d = (p - atom.position()).length()
            m = min(m, d)
            if d < smallest and atom.symbol != 'H':
                ok = 0
            if not ok: break
        if ok and m <= largest:
            points.append(p)
    return points