Esempio n. 1
0
    def satisfiedBy(self, example):
        try:
            a = lookup(self.descriptionA, example).center
            b = lookup(self.descriptionB, example).center
            c = lookup(self.descriptionC, example).center
            d = lookup(self.descriptionD, example).center

        except DescriptionException:
            return False
        except AttributeError:
            return False

        t = torsion(a, b, c, d)
        #print a, b, c, d
        #print self.center -self.range, t, self.center + self.range

        satisfied = self.center - self.range < t < self.center + self.range
        if self.negated:
            satisfied = not satisfied

        if satisfied:
            example.__dict__[self.name] = t
            return satisfied # ho ho
        else:
            return False
Esempio n. 2
0
    def measure(self, structure):
        try:
            a = lookup(self.descriptionA, structure).center
            b = lookup(self.descriptionB, structure).center

            return distance(a, b)
        except AttributeError, ae:
            print "DISTANCE MEASURE FALIURE :", self.descriptionA, self.descriptionB, str(ae)
            return 0.0
Esempio n. 3
0
    def satisfiedBy(self, example):
        try:
            donorAtomPosition    = lookup(self.donorDescription, example).center
            hydrogenAtomPosition = lookup(self.hydrogenDescription, example).center
            acceptorAtomPosition = lookup(self.acceptorDescription, example).center
            attachedAtomPosition = lookup(self.attachedDescription, example).center

        except DescriptionException, d:
            return False
Esempio n. 4
0
    def measure(self, structure):
        try:
            a = lookup(self.descriptionA, structure).center
            b = lookup(self.descriptionB, structure).center
            c = lookup(self.descriptionC, structure).center

            return angle(a, b, c)
        except AttributeError:
            print "ANGLE MEASURE FALIURE :", self.descriptionA, self.descriptionB, self.descriptionC
            return 0.0
Esempio n. 5
0
    def measure(self, structure):
        try:
            a = lookup(self.descriptionA, structure).center
            b = lookup(self.descriptionB, structure).center
            c = lookup(self.descriptionC, structure).center
            d = lookup(self.descriptionD, structure).center

            return torsion(a, b, c, d)
        except AttributeError:
            print "TORSION MEASURE FALIURE :", self.descriptionA, self.descriptionB, self.descriptionC, self.descriptionD
            return 0.0
Esempio n. 6
0
    def measure(self, structure):
        try:
            donorAtom    = lookup(self.donorDescription, structure)
            hydrogenAtom = lookup(self.hydrogenDescription, structure)
            acceptorAtom = lookup(self.acceptorDescription, structure)
            attachedAtom = lookup(self.attachedDescription, structure)

            #print donorAtom.toFullString(), hydrogenAtom.toFullString(), acceptorAtom.toFullString(), attachedAtom.toFullString()

        except DescriptionException, d:
            # better to re-raise some kind of error?
            return (0,0,0)
Esempio n. 7
0
    def satisfiedBy(self, example):
        try:
            a = lookup(self.descriptionA, example).center
            b = lookup(self.descriptionB, example).center

        except DescriptionException:
            sys.stderr.write("description exception")
            return False
        except AttributeError, e:
            #dstr = "%s %s" % (self.descriptionA.to_str(), self.descriptionB.to_str())
            #sys.stderr.write("attribute error %s for %s %s\n" % (e, dstr, example))
            return False
Esempio n. 8
0
    def satisfiedBy(self, example):
        try:
            a = lookup(self.descriptionA, example).center
            b = lookup(self.descriptionB, example).center
            c = lookup(self.descriptionC, example).center

        except DescriptionException:
            return False
        except AttributeError:
            return False

        aa = angle(a, b, c)

        satisfied = self.center - self.range < aa < self.center + self.range
        if self.negated:
            satisfied = not satisfied

        if satisfied:
            chain.__dict__[self.name] = aa
            return satisfied # ho ho
        else:
            return False