Create a molecule type for the parent and add bonds.
484150
def _add_intermol_molecule_type(intermol_system, parent):
        
        from intermol.moleculetype import MoleculeType
        from intermol.forces.bond import Bond as InterMolBond

        molecule_type = MoleculeType(name=parent.name)
        intermol_system.add_molecule_type(molecule_type)

        for index, parent_atom in enumerate(parent.particles()):
            parent_atom.index = index + 1

        for atom1, atom2 in parent.bonds():
            intermol_bond = InterMolBond(atom1.index, atom2.index)
            molecule_type.bonds.add(intermol_bond)
65475
def add(self, schema):
        
        key = schema.tns[1]
        existing = self.namespaces.get(key)
        if existing is None:
            self.children.append(schema)
            self.namespaces[key] = schema
        else:
            existing.root.children += schema.root.children
            existing.root.nsprefixes.update(schema.root.nsprefixes)
909824
def add_parent(self, parent):
        
        parent.add_child(self)
        self.parent = parent
        return parent
942037
public static IAtomContainer createNewMolecule(IChemModel chemModel) {
        // Add a new molecule either the set of molecules
        IAtomContainer molecule = chemModel.getBuilder().newInstance(IAtomContainer.class);
        if (chemModel.getMoleculeSet() != null) {
            IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
            for (int i = 0; i < moleculeSet.getAtomContainerCount(); i++) {
                if (moleculeSet.getAtomContainer(i).getAtomCount() == 0) {
                    moleculeSet.removeAtomContainer(i);
                    i--;
                }
            }
            moleculeSet.addAtomContainer(molecule);
        } else {
            IAtomContainerSet moleculeSet = chemModel.getBuilder().newInstance(IAtomContainerSet.class);
            moleculeSet.addAtomContainer(molecule);
            chemModel.setMoleculeSet(moleculeSet);
        }
        return molecule;
    }
679491
def _add_type_node(self, node, label):
        """"""
        child = node.add_child(name=label)
        child.add_feature(TYPE_NODE_TAG, True)
        return child
395525
def put_everything_together(self):
        
        molecule_list = [self.filestart]+[self.white_circles]+[self.draw_molecule]+[self.draw.draw_hbonds]+[self.draw.draw_pi_lines]+[self.draw.draw_saltbridges]+[self.draw.cloud]+[self.draw_plots]+[self.end_symbol]
        self.final_molecule = "".join(map(str,molecule_list))
1047170
def add_node(self, node):
        """"""
        num_agents = len(self.nodes(type=Agent))
        curr_generation = int((num_agents - 1) / float(self.generation_size))
        node.generation = curr_generation

        if curr_generation == 0 and self.initial_source:
            parent = self._select_oldest_source()
        else:
            parent = self._select_fit_node_from_generation(
                node_type=type(node), generation=curr_generation - 1
            )

        if parent is not None:
            parent.connect(whom=node)
            parent.transmit(to_whom=node)
1325839
def parent(self, parent):
        
        self._parent = parent
        self.graph.add(
            (self.asNode(), RDF_NAMESPACES.CAPITAINS.parent, parent.asNode())
        )
        parent._add_member(self)
378602
def build(self):
        """"""
        monomers = [HelicalHelix(major_pitch=self.major_pitches[i],
                                 major_radius=self.major_radii[i],
                                 major_handedness=self.major_handedness[i],
                                 aa=self.aas[i],
                                 minor_helix_type=self.minor_helix_types[i],
                                 orientation=self.orientations[i],
                                 phi_c_alpha=self.phi_c_alphas[i],
                                 minor_repeat=self.minor_repeats[i],
                                 )
                    for i in range(self.oligomeric_state)]
        axis_unit_vector = numpy.array([0, 0, 1])
        for i, m in enumerate(monomers):
            m.rotate(angle=self.rotational_offsets[i], axis=axis_unit_vector)
            m.translate(axis_unit_vector * self.z_shifts[i])
        self._molecules = monomers[:]
        self.relabel_all()
        for m in self._molecules:
            m.ampal_parent = self
        return
563194
def create(cls, parent, child, relation_type, index=None):
        """"""
        try:
            with db.session.begin_nested():
                obj = cls(parent_id=parent.id,
                          child_id=child.id,
                          relation_type=relation_type,
                          index=index)
                db.session.add(obj)
        except IntegrityError:
            raise Exception("PID Relation already exists.")
            # msg = "PIDRelation already exists: " \
            #       "{0} -> {1} ({2})".format(
            #         parent_pid, child_pid, relation_type)
            # logger.exception(msg)
            # raise Exception(msg)
        return obj
364137
def add_to(self, parent, name=None, index=None):
        """"""
        parent.add_child(self, name=name, index=index)
        return self
1031693
def append(self, traverse):
        """"""
        self.data.extend(traverse.data)
        self.atoms.extend(traverse.atoms)
        self.bonds.extend(traverse.bonds)
403788
def _setup_bonds(self):
        """"""
        self._bonds = {}
        if 'bonds' not in self.record:
            return
        # Create bonds
        aid1s = self.record['bonds']['aid1']
        aid2s = self.record['bonds']['aid2']
        orders = self.record['bonds']['order']
        if not len(aid1s) == len(aid2s) == len(orders):
            raise ResponseParseError('Error parsing bonds')
        for aid1, aid2, order in zip(aid1s, aid2s, orders):
            self._bonds[frozenset((aid1, aid2))] = Bond(aid1=aid1, aid2=aid2, order=order)
        # Add styles
        if 'coords' in self.record and 'style' in self.record['coords'][0]['conformers'][0]:
            aid1s = self.record['coords'][0]['conformers'][0]['style']['aid1']
            aid2s = self.record['coords'][0]['conformers'][0]['style']['aid2']
            styles = self.record['coords'][0]['conformers'][0]['style']['annotation']
            for aid1, aid2, style in zip(aid1s, aid2s, styles):
                self._bonds[frozenset((aid1, aid2))].style = style
268888
def add_group_bonds(data_setters, bond_indices, bond_orders):
    """"""
    for bond_index in range(len(bond_orders)):
        data_setters.set_group_bond(bond_indices[bond_index*2],bond_indices[bond_index*2+1],bond_orders[bond_index])
559472
def pclink(self, parent, child):
    """"""
    if parent._children is None:
      parent._children = set()
    if child._parents is None:
      child._parents = set()
    parent._children.add(child)
    child._parents.add(parent)
258605
private void addSelfToAtoms() {
		List<Bond> bonds = atomA.getBonds();
		if (bonds==null) {
			bonds = new ArrayList<Bond>(AtomImpl.BONDS_INITIAL_CAPACITY);
			atomA.setBonds(bonds);
		}

		boolean exists = false;
		for (Bond bond : bonds) {
			// TODO is it equals() what we want here, or is it == ? - JD 2016-03-02
			if (bond.getOther(atomA).equals(atomB)) {
				exists = true;
				break;
			}
		}
		if (!exists) {
			atomA.addBond(this);
			atomB.addBond(this);
		}
	}
1052361
def set_parent(self, parent):
        '''
        '''
        if not isinstance(parent, Node):
            raise TypeError("parent must be a Node")
        self.parent = parent