def augment_bonds(geom, root=0, proj=False):
    assert geom.coord_type != "cart"
    log(logger, "Trying to augment bonds.")

    hessian = geom.cart_hessian
    try:
        energy = geom.energy
    except AttributeError:
        energy = None

    func = find_missing_bonds_by_projection if proj else find_missing_strong_bonds

    missing_bonds = func(geom, hessian, root=root)

    if missing_bonds:
        aux_bond_pt = PrimTypes.AUX_BOND
        missing_aux_bonds = [(aux_bond_pt, *mbond) for mbond in missing_bonds]
        print("\t@Missing bonds:", missing_bonds)
        new_geom = Geometry(
            geom.atoms,
            geom.cart_coords,
            coord_type=geom.coord_type,
            coord_kwargs={
                "define_prims": missing_aux_bonds,
            },
        )
        new_geom.set_calculator(geom.calculator)
        new_geom.energy = energy
        new_geom.cart_hessian = hessian
        return new_geom
    else:
        return geom
def augment_bonds(geom, root=0, proj=False):
    assert geom.coord_type != "cart"

    hessian = geom.cart_hessian
    energy = geom.energy

    func = find_missing_bonds_by_projection if proj else find_missing_strong_bonds

    missing_bonds = func(geom, hessian, root=root)

    if missing_bonds:
        print("\t@Missing bonds:", missing_bonds)
        new_geom = Geometry(geom.atoms, geom.cart_coords,
                            coord_type=geom.coord_type,
                            coord_kwargs={"define_prims": missing_bonds,},
        )
        new_geom.set_calculator(geom.calculator)
        new_geom.energy = energy
        new_geom.cart_hessian = hessian
        return new_geom
    else:
        return geom