def saveRestartFile(path, rmg, delay=0):
    """
    Save a restart file to `path` on disk containing the contents of the
    provided `reactionModel`. The `delay` parameter is a time in seconds; if
    the restart file is not at least that old, the save is aborted. (Use the
    default value of 0 to force the restart file to be saved.)
    """
    warnings.warn("The saveRestartFile is no longer supported and may be"
                  " removed in version 2.3.", DeprecationWarning)
    # Saving of a restart file is very slow (likely due to all the Quantity objects)
    # Therefore, to save it less frequently, don't bother if the restart file is less than an hour old
    if os.path.exists(path) and time.time() - os.path.getmtime(path) < delay:
        logging.info('Not saving restart file in this iteration.')
        return
    
    # Pickle the reaction model to the specified file
    # We also compress the restart file to save space (and lower the disk read/write time)
    logging.info('Saving restart file...')

    from rmgpy.rmg.main import RMG
    rmg_restart = RMG()
    rmg_restart.reactionModel = rmg.reactionModel
    rmg_restart.unimolecularReact = rmg.unimolecularReact
    rmg_restart.bimolecularReact = rmg.bimolecularReact
    rmg_restart.trimolecularReact = rmg.trimolecularReact
    if rmg.filterReactions:
        rmg_restart.unimolecularThreshold = rmg.unimolecularThreshold
        rmg_restart.bimolecularThreshold = rmg.bimolecularThreshold
        rmg_restart.trimolecularThreshold = rmg.trimolecularThreshold
    
    f = open(path, 'wb')
    cPickle.dump(rmg_restart, f, cPickle.HIGHEST_PROTOCOL)
    f.close()
def saveRestartFile(path, rmg, delay=0):
    """
    Save a restart file to `path` on disk containing the contents of the
    provided `reactionModel`. The `delay` parameter is a time in seconds; if
    the restart file is not at least that old, the save is aborted. (Use the
    default value of 0 to force the restart file to be saved.)
    """

    # Saving of a restart file is very slow (likely due to all the Quantity objects)
    # Therefore, to save it less frequently, don't bother if the restart file is less than an hour old
    if os.path.exists(path) and time.time() - os.path.getmtime(path) < delay:
        logging.info('Not saving restart file in this iteration.')
        return

    # Pickle the reaction model to the specified file
    # We also compress the restart file to save space (and lower the disk read/write time)
    logging.info('Saving restart file...')

    from rmgpy.rmg.main import RMG
    rmg_restart = RMG()
    rmg_restart.reactionModel = rmg.reactionModel
    rmg_restart.unimolecularReact = rmg.unimolecularReact
    rmg_restart.bimolecularReact = rmg.bimolecularReact
    if rmg.filterReactions:
        rmg_restart.unimolecularThreshold = rmg.unimolecularThreshold
        rmg_restart.bimolecularThreshold = rmg.bimolecularThreshold

    f = open(path, 'wb')
    cPickle.dump(rmg_restart, f, cPickle.HIGHEST_PROTOCOL)
    f.close()