It is important to note that a single connected structure is assumed for algorithm 1, but in certain situations it is necessary to construct a Zmatrix for an ensemble of molecules/fragments. In this case algorithm 1 is applied onto each fragment/substructure separately. The resulting Z-matrices are then concatenated, which is performed by substituting the absolute references in the first three rows with atom labels from other Z-matrices.