Example #1
0
 def SetDomainZLines(self):
     # Large buffer for intersections
     for f in range(100):
         self.FIntersect.append(linegrids.TLineSegment())
     self.FIntersectHigh = -1
     # Clear grid and set to nil to distinguish lines where core was processed
     self.FDomainGrid.Shape.Grid = []
     for f in range(self.FDomainGrid.Block.DomainEndX + 1):
         self.FDomainGrid.Shape.Grid.append([])
         for g in range(self.FDomainGrid.Block.DomainEndY + 1):
             self.FDomainGrid.Shape.Grid[f].append([])
     # Set lines with surface contacts
     self.FOverlapIxs = basetypes.FilledInts(
         2 * self.FDomainGrid.Block.ProbeEndZ +
         self.FDomainGrid.Block.TargetEndZ, 0)
     # FOverlapIxs used with accumulator, must span all range of surface, not actual domain
     for x in range(len(self.FDomainGrid.Shape.NonEmpty)):
         for y in range(len(self.FDomainGrid.Shape.NonEmpty[x])):
             for yy in range(self.FDomainGrid.Shape.NonEmpty[x][y][0],
                             self.FDomainGrid.Shape.NonEmpty[x][y][1] + 1):
                 self.SetZExtremes(x, yy)
     # Set lines with core overlaps
     if self.RemoveCores:
         self.FOverlapIxs = basetypes.FilledInts(
             self.FDomainGrid.Block.DomainEndZ + 1, 0)
         for x in range(len(self.FCoreContacts)):
             if self.FCoreContacts[x] is not None:
                 for y in range(len(self.FCoreContacts[x])):
                     for yy in range(self.FCoreContacts[x][y][0],
                                     self.FCoreContacts[x][y][1] + 1):
                         if self.FDomainGrid.Shape.Grid[x][yy] is not None and \
                                 len(self.FDomainGrid.Shape.Grid[x][yy]) != 0:
                             self.RemoveZCores(x, yy)
Example #2
0
 def SelectAxesByMaxmin(self, MinDist, MaxAxes):
     self.FSelectedAxes = basetypes.FilledInts(1, len(self.FAxes))
     # This selects the last axis as te first point. The last axis is the Z axis
     rows = basetypes.FilledInts(
         1, 0
     )  # This is just a 0...N index to avoid using the FAxialDistances matrix
     distances = [self.AxisDistances(self.FSelectedAxes[0])]
     for f in range(1, MaxAxes):
         distances.append([])
     maxd = MinDist + 1
     while (maxd > MinDist) and (len(self.FSelectedAxes) < MaxAxes):
         mins = self.MinDistances(distances, rows)
         maxd, maxix = basetypes.MaxValIx(mins)
         self.FSelectedAxes.append(maxix)
         rows.append(len(self.FSelectedAxes) - 1)
         distances[len(self.FSelectedAxes) - 1] = self.AxisDistances(maxix)
     self.FAxialDistance = maxd
Example #3
0
def GroupsInContact(Groups1, Groups2, Dist):
    hulls1 = CalcHulls(Groups1, Dist)
    hulls2 = CalcHulls(Groups2, Dist)
    interfixs1 = basetypes.FilledInts(len(hulls1), 0)
    interfixs2 = basetypes.FilledInts(len(hulls2), 0)
    for ix1 in range(len(hulls1)):
        for ix2 in range(len(hulls2)):
            if (basetypes.InContact(hulls1[ix1], hulls2[ix2])) and \
               (AtomsInContact(Groups1[ix1].GroupAtoms, Groups2[ix2].GroupAtoms, Dist)):
                interfixs1[ix1] = 1
                interfixs2[ix2] = 1
    Interface1 = []
    for f in range(len(interfixs1)):
        if interfixs1[f] > 0:
            Interface1.append(f)
    Interface2 = []
    for f in range(len(interfixs2)):
        if interfixs2[f] > 0:
            Interface2.append(f)
    # In Python return TIntegers, TIntegers
    return Interface1, Interface2
Example #4
0
 def PlaneConstraint(self, Point, Normal, Margin):
     # Scaling factors for the shapes
     tres = 1 / self.FTargetResolution
     pres = 1 / self.FProbeResolution
     # Plane and line variables
     planepoint = geomutils.Subtract(
         geomutils.Add(Point, geomutils.Multiply(self.FTargetTransVec,
                                                 tres)),
         geomutils.Multiply(self.FProbeTransVec, pres))
     planepoint = geomutils.Subtract(
         planepoint,
         basetypes.TCoord(self.FDomainBlock.XOffset,
                          self.FDomainBlock.YOffset,
                          self.FDomainBlock.ZOffset))
     xflags = basetypes.FilledInts(self.FDomainBlock.DomainEndX + 1, -1)
     yflags = basetypes.FilledInts(self.FDomainBlock.DomainEndY + 1, -1)
     zflags = basetypes.FilledInts(self.FDomainBlock.DomainEndZ + 1, -1)
     for x in range(len(self.FXDomain)):
         for xx in range(self.FXDomain[x][0], self.FXDomain[x][1] + 1):
             self.SetYDomain(xx, yflags, zflags, planepoint, Normal, Margin)
             if self.FYDomainAtX[xx] is not None and (len(
                     self.FYDomainAtX[xx]) != 0):
                 xflags[xx] = 1
     self.FXDomain = linegrids.IntegersToLine(xflags)
Example #5
0
def ComputeShapeStats(Shape):
    Shape.ZMax = 0
    Shape.TotalCount = 0
    for x in range(len(Shape.Grid)):
        tmpline = basetypes.FilledInts(len(Shape.Grid[0]), 0)
        Shape.CellCounts.append([])
        for y in range(len(Shape.Grid[0])):
            Shape.CellCounts[x].append([])
            if Shape.Grid[x][y] is not None and len(Shape.Grid[x][y]) != 0:
                tmpline[y] = 1
                if Shape.ZMax < Shape.Grid[x][y][len(Shape.Grid[x][y]) - 1][1]:
                    Shape.ZMax = Shape.Grid[x][y][len(Shape.Grid[x][y]) - 1][1]
                Shape.CellCounts[x][y] = CountCells(Shape.Grid[x][y])
                Shape.TotalCount = Shape.TotalCount + Shape.CellCounts[x][y]
        Shape.NonEmpty.append(IntegersToLine(tmpline, 0))
Example #6
0
def MagicFit(Probe,
             Target,
             SubMat,
             TargetExclusion=None,
             MinSequenceMatch=0.7,
             MinAlfaCarbons=20):
    Result = TFitResult()
    Result.Rmsd = -1
    alignments = BuildAlignmentMatrix(Probe, Target, SubMat, TargetExclusion)
    # Target ix for each probe chain
    map = basetypes.FilledInts(Probe.GroupCount, -1)
    FindBestMap(0, Result, Probe, Target, map, alignments, MinSequenceMatch,
                MinAlfaCarbons)
    # Return TFitResult
    return Result
Example #7
0
 def Score(self):
     if self.FAddModel is not None:
         # Large buffer for intersections
         for f in range(basetypes.Max(len(self.FIntersect) - 1, 0), 100):
             self.FIntersect.append(linegrids.TLineSegment())
         for f in range(len(self.FIntersect) - 1, 99, -1):
             del self.FIntersect[f]
         self.FIntersectHigh = -1
         self.FScores = basetypes.FilledInts(
             self.FDomainGrid.Block.DomainEndZ + 1, 0)
         for x in range(len(self.FDomainGrid.Shape.NonEmpty)):
             for y in range(len(self.FDomainGrid.Shape.NonEmpty[x])):
                 for yy in range(
                         self.FDomainGrid.Shape.NonEmpty[x][y][0],
                         self.FDomainGrid.Shape.NonEmpty[x][y][1] + 1):
                     if self.FDomainGrid.Shape.Grid[x][yy] is not None and \
                             len(self.FDomainGrid.Shape.Grid[x][yy]) != 0:
                         self.ScoreOverlap(x, yy)
Example #8
0
def FilledIntsTest():
    ia = basetypes.FilledInts(5, 2)
    for f in range(len(ia)):
        print(str(ia[f]))