Function to generate the contact sets
323387
private void initContactSet() {

		// Initialise an array of atoms
		atoms = new Atom[groups.length];
		// Remake this local var
		indResMap = new HashMap<>();
		for (int i=0 ; i < groups.length ; i++){
			SecStrucGroup one = groups[i];
			indResMap.put(one.getResidueNumber(), i);
			atoms[i] = one.getCA();
		}
		Grid grid = new Grid(CA_MIN_DIST);
		if(atoms.length==0){
			contactSet = new AtomContactSet(CA_MIN_DIST);
		}
		else{
			grid.addAtoms(atoms);
			contactSet = grid.getAtomContacts();
		}
	}
132305
def distance_to_contact(D, alpha=1):
    

    if callable(alpha):
        distance_function = alpha
    else:
        try:
            a = np.float64(alpha)

            def distance_function(x):
                return 1 / (x ** (1 / a))
        except TypeError:
            print("Alpha parameter must be callable or an array-like")
            raise
        except ZeroDivisionError:
            raise ValueError("Alpha parameter must be non-zero")

    m = np.max(distance_function(D[D != 0]))
    M = np.zeros(D.shape)
    M[D != 0] = distance_function(D[D != 0])
    M[D == 0] = m
    return M
1166188
def meet(self, featuresets):
        """"""
        concepts = (f.concept for f in featuresets)
        meet = self.lattice.meet(concepts)
        return self._featuresets[meet.index]
488448
def _gen_mods(self, action, records, existing_rrsets):
        '''
        
        '''
        return [r.mod(action, existing_rrsets) for r in records]
1296994
def generate_shapes(shapes):
        
        new_shapes = {'ellipse': [], 'rectangle': []}

        for shape in shapes:
            tmp_shape = {}
            for shape_item in shapes[shape]:
                if shape_item != 'type':
                    tmp_shape[shape_item] = shapes[shape][shape_item]

            new_shapes[shapes[shape]['type']].append(tmp_shape)

        return new_shapes
197284
def get_contacts(self):
        
        all_contacts = self.wapi_functions.getAllContacts()
        return [Contact(contact, self) for contact in all_contacts]
304869
function generateLonLat() {
  return [
    getRandomNumber(options.bbox[0], options.bbox[2]),
    getRandomNumber(options.bbox[1], options.bbox[3])
  ];
}
513387
def _init_edges_relationships(rel2src2dsts, rel2dst2srcs):
        """"""
        edge_rel2fromto = {}
        relationships = set(rel2src2dsts).union(rel2dst2srcs)
        for reltype in relationships:
            edge_from_to = []
            if reltype in rel2src2dsts:
                for parent, children in rel2src2dsts[reltype].items():
                    for child in children:
                        edge_from_to.append((child, parent))
            if reltype in rel2dst2srcs:
                for parent, children in rel2dst2srcs[reltype].items():
                    for child in children:
                        edge_from_to.append((child, parent))
            edge_rel2fromto[reltype] = edge_from_to
        return edge_rel2fromto
649179
public AtomContactSet getAtomContacts() {

		AtomContactSet contacts = new AtomContactSet(cutoff);

		List<Contact> list = getIndicesContacts();

		if (jAtomObjects == null) {
			for (Contact cont : list) {
				contacts.add(new AtomContact(new Pair<Atom>(iAtomObjects[cont.getI()],iAtomObjects[cont.getJ()]),cont.getDistance()));
			}

		} else {
			for (Contact cont : list) {
				contacts.add(new AtomContact(new Pair<Atom>(iAtomObjects[cont.getI()],jAtomObjects[cont.getJ()]),cont.getDistance()));
			}
		}

		return contacts;
	}
995052
def getContacts(self, only_active=True):
        
        contacts = self.objectValues("Contact")
        if only_active:
            contacts = filter(api.is_active, contacts)
        return contacts
432262
function setCardCodes(set) {
  const codeSet = new Set()
  for (const v of set) codeSet.add(cardCode(v))
  return codeSet
}
770849
def _generate_edges(self, edge_prob):
        
        self.E, self.parent = [], {}
        for i in range(self.m):
            if random() < edge_prob and i > 0:
                p_i = choice(i)
                self.E.append((p_i, i))
                self.parent[i] = p_i
22298
function Contacts(options) {
    ActionFactoryAbstract.call(this, options);

    this.groups = new ContactsGroups(options);
    this.fields = new ContactsFields(options);
}
607613
function(p1, p2, r1, r2)
{
    var mindist = r1 + r2;
    var delta = vsub(p2, p1);
    var distsq = vlengthsq(delta);
    if(distsq >= mindist*mindist) return;
    
    var dist = Math.sqrt(distsq);

    // Allocate and initialize the contact.
    return new Contact(
        vadd(p1, vmult(delta, 0.5 + (r1 - 0.5*mindist)/(dist ? dist : Infinity))),
        (dist ? vmult(delta, 1/dist) : new Vect(1, 0)),
        dist - mindist,
        0
    );
}
821903
def linkify_with_contacts(self, contacts):
        
        for i in self:
            if not hasattr(i, 'contacts'):
                continue

            links_list = strip_and_uniq(i.contacts)
            new = []
            for name in [e for e in links_list if e]:
                contact = contacts.find_by_name(name)
                if contact is not None and contact.uuid not in new:
                    new.append(contact.uuid)
                else:
                    i.add_error("the contact '%s' defined for '%s' is unknown"
                                % (name, i.get_name()))

            i.contacts = new
410558
def contact_of
      @contact_of ||= Person.distinct
                            .joins(activity_object: { circles: :ties })
                            .merge(Tie.with_contact_id(contact_id: guid))
    end
787975
def gen_relations(self):
        
        relations_elem = E('relations')
        for relname in sorted(self.relations):
            relations_elem.append(
                E('rel', OrderedDict([('name', relname), ('type', self.relations[relname])])))
        return relations_elem