def insertion_scan_coordinate(rxn, zma): """ Obtain the scan coordinate for an insertion :param rxn: a Reaction object :returns: the name of the scan coordinate in the z-matrix :rtype: str """ frm_bnd_key, _ = insertion_forming_bond_keys(rxn) scan_name = automol.zmat.distance_coordinate_name(zma, *frm_bnd_key) return scan_name
def insertion_ts_zmatrix(rxn, ts_geo): """ z-matrix for an insertion transition state geometry :param rxn: a Reaction object :param ts_geo: a transition state geometry """ rxn = rxn.copy() rxn.forward_ts_graph = rxn.forward_ts_graph # 1. Get keys to linear or near-linear atoms lin_idxs = list(automol.geom.linear_atoms(ts_geo)) # 2. Add dummy atoms over the linear atoms rcts_gra = ts.reactants_graph(rxn.forward_ts_graph) geo, dummy_key_dct = automol.geom.insert_dummies_on_linear_atoms( ts_geo, lin_idxs=lin_idxs, gra=rcts_gra) # 3. Add dummy atoms to the Reaction object as well rxn = add_dummy_atoms(rxn, dummy_key_dct) # 4. Generate a z-matrix for the geometry rng_keys, = ts.forming_rings_atom_keys(rxn.forward_ts_graph) brk_bnd_key, = ts.breaking_bond_keys(rxn.forward_ts_graph) # Drop one of the forming bonds from the z-matrix by sorting the ring atom # keys to exclude it. If one of the forming bonds intersects with the # breaking bond, choose that one. _, frm_bnd_key = insertion_forming_bond_keys(rxn) # Cycle the ring keys such that the atom closest to the breaking bond is # the beginning of the ring and the other atom is the end if frm_bnd_key & brk_bnd_key: key1, = frm_bnd_key & brk_bnd_key key2, = frm_bnd_key - brk_bnd_key else: path = automol.graph.shortest_path_between_groups( rxn.forward_ts_graph, frm_bnd_key, brk_bnd_key) key2, = frm_bnd_key - set(path) rng_keys = automol.graph.cycle_ring_atom_key_to_front(rng_keys, key1, end_key=key2) vma, zma_keys = automol.graph.vmat.vmatrix(rxn.forward_ts_graph, rng_keys=rng_keys) zma_geo = automol.geom.from_subset(geo, zma_keys) zma = automol.zmat.from_geometry(vma, zma_geo) return zma, zma_keys, dummy_key_dct