def add_molecular_graph(self, molecular_graph, atom_types=None, charges=None, split=True, molecule=None):
<EOL>new = len(molecular_graph.numbers)<EOL>if new == <NUM_LIT:0>: return<EOL>prev = len(self.numbers)<EOL>offset = prev<EOL>self.numbers.resize(prev + new)<EOL>self.numbers[-new:] = molecular_graph.numbers<EOL>if atom_types is None:<EOL><INDENT>atom_types = [periodic[number].symbol for number in molecular_graph.numbers]<EOL><DEDENT>self.atom_types.extend(atom_types)<EOL>if charges is None:<EOL><INDENT>charges = [<NUM_LIT:0.0>]*len(molecular_graph.numbers)<EOL><DEDENT>self.charges.extend(charges)<EOL>self.molecules.resize(prev + new)<EOL>if split:<EOL><INDENT>groups = molecular_graph.independent_vertices<EOL>names = [self._get_name(molecular_graph, group) for group in groups]<EOL>group_indices = np.zeros(new, int)<EOL>for group_index, group in enumerate(groups):<EOL><INDENT>for index in group:<EOL><INDENT>group_indices[index] = group_index<EOL><DEDENT><DEDENT>self.names.extend([names[group_index] for group_index in group_indices])<EOL>if prev == <NUM_LIT:0>:<EOL><INDENT>self.molecules[:] = group_indices<EOL><DEDENT>else:<EOL><INDENT>self.molecules[-new:] = self.molecules[-new]+group_indices+<NUM_LIT:1><EOL><DEDENT><DEDENT>else:<EOL><INDENT>if prev == <NUM_LIT:0>:<EOL><INDENT>self.molecules[-new:] = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>self.molecules[-new:] = self.molecules[-new]+<NUM_LIT:1><EOL><DEDENT>name = self._get_name(molecular_graph)<EOL>self.names.extend([name]*new)<EOL><DEDENT>self._add_graph_bonds(molecular_graph, offset, atom_types, molecule)<EOL>self._add_graph_bends(molecular_graph, offset, atom_types, molecule)<EOL>self._add_graph_dihedrals(molecular_graph, offset, atom_types, molecule)<EOL>self._add_graph_impropers(molecular_graph, offset, atom_types, molecule)<EOL>
Add the molecular graph to the data structure

           Argument:
            | ``molecular_graph``  --  a MolecularGraph instance

           Optional arguments:
            | ``atom_types``  --  a list with atom type strings
            | ``charges``  --  The net atom charges
            | ``split``  --  When True, the molecule is split into disconnected
                             molecules [default=True]