Remove vnodes that are too close to existing atoms in the structure

        Args:
            min_dist(float): The minimum distance that a vertex needs to be
                from existing atoms.
484627
def remove_collisions(self, min_dist=0.5):
        
        vfcoords = [v.frac_coords for v in self.vnodes]
        sfcoords = self.structure.frac_coords
        dist_matrix = self.structure.lattice.get_all_distances(vfcoords,
                                                               sfcoords)
        all_dist = np.min(dist_matrix, axis=1)
        new_vnodes = []
        for i, v in enumerate(self.vnodes):
            if all_dist[i] > min_dist:
                new_vnodes.append(v)
        self.vnodes = new_vnodes
1166964
function minV(v) {
         return this._set(this.x < v.x ? this.x : v.x, this.y < v.y ? this.y : v.y);
       }
1263445
def remove_neighbours(self):
        
        time_delta = 1 << (2*(IntervalSet.HPY_MAX_ORDER - self.max_order))

        intervals_arr = self._interval_set._intervals
        intervals_arr[:, 0] = np.minimum(intervals_arr[:, 0] + time_delta, (1 << 58) - 1)
        intervals_arr[:, 1] = np.maximum(intervals_arr[:, 1] - time_delta, 0)

        good_intervals = intervals_arr[:, 1] > intervals_arr[:, 0]

        self._interval_set = IntervalSet(intervals_arr[good_intervals])
1235212
def local_minima(vector,min_distance = 4, brd_mode = "wrap"):
    
    fits = gaussian_filter(numpy.asarray(vector,dtype=numpy.float32),1., mode=brd_mode)
    for ii in range(len(fits)):
        if fits[ii] == fits[ii-1]:
            fits[ii-1] = numpy.pi/2.0
    minfits = minimum_filter(fits, size=min_distance, mode=brd_mode)
    minima_mask = fits == minfits
    minima = numpy.transpose(minima_mask.nonzero())
    return numpy.asarray(minima)
139787
def minimum_distance2(hull_a, center_a, hull_b, center_b):
    '''
    '''
    if hull_a.shape[0] < 3 or hull_b.shape[0] < 3:
        return slow_minimum_distance2(hull_a, hull_b)
    else:
        return faster_minimum_distance2(hull_a, center_a, hull_b, center_b)
952329
def dist_between(h,seg1,seg2):
    
    h.distance(0, seg1.x, sec=seg1.sec)
    return h.distance(seg2.x, sec=seg2.sec)
505876
function(seg, n, d)
{
    var a = vdot(n, seg.ta) - seg.r;
    var b = vdot(n, seg.tb) - seg.r;
    return min(a, b) - d;
}
390978
public void minus(LinearSparseVector sv) {
		for (int r = 0; r < sv.length; r++) {
			int p = Arrays.binarySearch(index, sv.index[r]);
			if (p >= 0) {
				data[p] = (float) data[p] - (float) sv.data[r];
			} else {
				put(sv.index[r], -(float) sv.data[r]);
			}
		}
	}
472293
def add_cable_dist(self, lv_cable_dist):
        
        if lv_cable_dist not in self._cable_distributors and isinstance(lv_cable_dist,
                                                                        LVCableDistributorDing0):
            self._cable_distributors.append(lv_cable_dist)
            self.graph_add_node(lv_cable_dist)
595308
def remove_symbol_from_dist(dist, index):
    '''
    
    '''
    if type(dist) is not Distribution:
        raise TypeError("remove_symbol_from_dist got an object ot type {0}".format(type(dist)))

    new_prob = dist.prob.copy()
    new_prob[index]=0
    new_prob /= sum(new_prob)
    return Distribution(new_prob)
390031
function removeBrsAdjacentToPastedBlocks( nodesData, range ) {
			var succeedingNode = range.endContainer.getChild( range.endOffset ),
				precedingNode = range.endContainer.getChild( range.endOffset - 1 );

			if ( succeedingNode )
				remove( succeedingNode, nodesData[ nodesData.length - 1 ] );

			if ( precedingNode && remove( precedingNode, nodesData[ 0 ] ) ) {
				// If preceding <br> was removed - move range left.
				range.setEnd( range.endContainer, range.endOffset - 1 );
				range.collapse();
			}

			function remove( maybeBr, maybeBlockData ) {
				if ( maybeBlockData.isBlock && maybeBlockData.isElement && !maybeBlockData.node.is( 'br' ) &&
					checkIfElement( maybeBr ) && maybeBr.is( 'br' ) ) {
					maybeBr.remove();
					return 1;
				}
			}
		}
1004096
def displace(x,y,z)
      Geometry.new(atoms(:all).collect{|a|
        a.displace(x,y,z)
      }, self.lattice_vectors)
      #TODO copy miller indices
    end
253873
public static void prune(List<Point3D_F64> cloud , int minNeighbors , double radius ) {
		if( minNeighbors < 0 )
			throw new IllegalArgumentException("minNeighbors must be >= 0");
		NearestNeighbor<Point3D_F64> nn = FactoryNearestNeighbor.kdtree(new KdTreePoint3D_F64() );
		NearestNeighbor.Search<Point3D_F64> search = nn.createSearch();

		nn.setPoints(cloud,false);
		FastQueue<NnData<Point3D_F64>> results = new FastQueue(NnData.class,true);

		// It will always find itself
		minNeighbors += 1;

		// distance is Euclidean squared
		radius *= radius;

		for( int i = cloud.size()-1; i >= 0; i-- ) {
			search.findNearest(cloud.get(i),radius,minNeighbors,results);

			if( results.size < minNeighbors ) {
				cloud.remove(i);
			}
		}
	}
262661
static void pruneIncorrectSize(List<List<EllipsesIntoClusters.Node>> clusters, int N) {
		// prune clusters which can't be a member calibration target
		for (int i = clusters.size()-1; i >= 0; i--) {
			if( clusters.get(i).size() != N ) {
				clusters.remove(i);
			}
		}
	}
7072
def connect(polylines, max_dist=10):
    
    ll = len(polylines)
    remove = []
    for n in range(ll - 1, -1, -1):
        c = polylines[n]
        if len(c) > 1:
            for d0, p0 in enumerate((c[0, 0], c[-1, 0])):
                for m in range(len(polylines) - 1, -1, -1):
                    # combine all x all polylines
                    if n == m:
                        continue
                    cc = polylines[m]

                    for d1, p1 in enumerate((cc[0, 0], cc[-1, 0])):
                        # for end points of other polylines:
                        # measure closest distance for current polyline
                        ndist = norm(p0 - p1)
                        if ndist < max_dist:
                            is_same, c = _connect(c, cc, d0, d1)
                            if is_same:
                                if m not in remove:
                                    remove.append(m)
                                polylines[n] = c
                                break
    # remove those which are already in connected to other polyline:
    remove.sort()
    remove.reverse()
    for r in remove:
        polylines.pop(r)
601591
private void minimisationWithBinaryResolution(final LNGIntVector outLearnt) {
    long lbd = computeLBD(outLearnt, -1);
    int p = not(outLearnt.get(0));
    if (lbd <= lbLBDMinimizingClause) {
      myflag++;
      for (int i = 1; i < outLearnt.size(); i++)
        permDiff.set(var(outLearnt.get(i)), myflag);
      int nb = 0;
      for (final MSWatcher wbin : watchesBin.get(p)) {
        int imp = wbin.blocker();
        if (permDiff.get(var(imp)) == myflag && value(imp) == Tristate.TRUE) {
          nb++;
          permDiff.set(var(imp), myflag - 1);
        }
      }
      int l = outLearnt.size() - 1;
      if (nb > 0) {
        for (int i = 1; i < outLearnt.size() - nb; i++) {
          if (permDiff.get(var(outLearnt.get(i))) != myflag) {
            p = outLearnt.get(l);
            outLearnt.set(l, outLearnt.get(i));
            outLearnt.set(i, p);
            l--;
            i--;
          }
        }
        outLearnt.removeElements(nb);
      }
    }
  }
388527
def displace(x,y,z)
      Atom.new(self.x+x, self.y+y, self.z+z, self.species, self.constrain)
    end